Skip to content
Snippets Groups Projects
Commit 2fcd9e26 authored by Holger Nahrstaedt's avatar Holger Nahrstaedt
Browse files

more improvements

parent 909763e8
No related branches found
No related tags found
No related merge requests found
......@@ -15,13 +15,13 @@ You can access those variables like a regular dictionary by using
.. code-block:: python
from steem import BitShares
steem = BitShares()
from steem import Steem
steem = Steem()
print(steem.config.items())
Keys can be added and changed like they are for regular dictionaries.
If you don't want to load the :class:`steem.BitShares` class, you
If you don't want to load the :class:`steem.Steem` class, you
can load the configuration directly by using:
.. code-block:: python
......
Exceptions
~~~~~~~~~~
.. autoclass:: steem.exceptions
.. autoclass:: steempy.exceptions
:members:
.. autoclass:: steemapi.exceptions
.. autoclass:: steempyapi.exceptions
:members:
......@@ -10,14 +10,14 @@ Install with `pip`:
::
$ sudo apt-get install libffi-dev libssl-dev python-dev
$ pip3 install steem
$ pip3 install steempy
Manual installation:
::
$ git clone https://github.com/xeroc/python-steem/
$ cd python-steem
$ git clone https://github.com/holgern/steempy/
$ cd steempy
$ python3 setup.py install --user
Upgrade
......
Proposal
~~~~~~~~
.. autoclass:: steem.proposal.Proposal
:members:
.. autoclass:: steem.proposal.Proposals
:members:
......@@ -7,5 +7,5 @@ the related blockchain technology and cryptography. This library can be
used to do anything that is allowed according to the BitShares
blockchain protocol.
.. autoclass:: steem.steem.BitShares
.. autoclass:: steempy.steem.BitShares
:members:
......@@ -7,11 +7,11 @@ These classes are very low level and are not well documented.
API
---
.. autoclass:: steem.storage.DataDir
.. autoclass:: steempy.storage.DataDir
:members:
.. autoclass:: steem.storage.Key
.. autoclass:: steempy.storage.Key
:members:
.. autoclass:: steem.storage.MasterPassword
.. autoclass:: steempy.storage.MasterPassword
:members:
......@@ -16,7 +16,7 @@ We load the class for manual transaction construction via:
.. code-block:: python
from steembase import transactions, operations
from steempybase import transactions, operations
Construction
############
......
......@@ -5,7 +5,7 @@ Tutorials
Bundle Many Operations
----------------------
With BitShares, you can bundle multiple operations into a single
With Steem, you can bundle multiple operations into a single
transactions. This can be used to do a multi-send (one sender, multiple
receivers), but it also allows to use any other kind of operation. The
advantage here is that the user can be sure that the operations are
......@@ -14,9 +14,9 @@ executed in the same order as they are added to the transaction.
.. code-block:: python
from pprint import pprint
from steem import BitShares
from steempy import Steem
testnet = BitShares(
testnet = Steem(
"wss://node.testnet.steem.eu",
nobroadcast=True,
bundle=True,
......@@ -35,7 +35,7 @@ executed in the same order as they are added to the transaction.
Proposing a Transaction
-----------------------
In BitShares, you can propose a transactions to any account. This is
In Steem, you can propose a transactions to any account. This is
used to facilitate on-chain multisig transactions. With
python-steem, you can do this simply by using the ``proposer``
attribute:
......@@ -43,9 +43,9 @@ attribute:
.. code-block:: python
from pprint import pprint
from steem import BitShares
from steem import Steem
testnet = BitShares(
testnet = Steem(
"wss://node.testnet.steem.eu",
proposer="xeroc"
)
......@@ -57,15 +57,15 @@ Simple Sell Script
.. code-block:: python
from steem import BitShares
from steem import Steem
from steem.market import Market
from steem.price import Price
from steem.amount import Amount
#
# Instanciate BitShares (pick network via API node)
# Instanciate Steem (pick network via API node)
#
steem = BitShares(
steem = Steem(
"wss://node.testnet.steem.eu",
nobroadcast=True # <<--- set this to False when you want to fire!
)
......@@ -100,7 +100,7 @@ Sell at a timely rate
.. code-block:: python
import threading
from steem import BitShares
from steem import Steem
from steem.market import Market
from steem.price import Price
from steem.amount import Amount
......@@ -119,9 +119,9 @@ Sell at a timely rate
if __name__ == "__main__":
#
# Instanciate BitShares (pick network via API node)
# Instanciate Steem (pick network via API node)
#
steem = BitShares(
steem = Steem(
"wss://node.testnet.steem.eu",
nobroadcast=True # <<--- set this to False when you want to fire!
)
......
Utilities
~~~~~~~~~~~~~~~~~~~
.. autoclass:: steem.utils
.. autoclass:: steempy.utils
:members:
Vesting
~~~~~~~
.. autoclass:: steem.vesting.Vesting
:members:
......@@ -8,8 +8,8 @@ A new wallet can be created by using:
.. code-block:: python
from steem import BitShares
steem = BitShares()
from steempy import Steem
steem = Steem()
steem.wallet.create("supersecret-passphrase")
This will raise an exception if you already have a wallet installed.
......@@ -21,8 +21,8 @@ The wallet can be unlocked for signing using
.. code-block:: python
from steem import BitShares
steem = BitShares()
from steempy import Steem
steem = Steem()
steem.wallet.unlock("supersecret-passphrase")
Adding a Private Key
......@@ -34,8 +34,8 @@ A private key can be added by using the
.. code-block:: python
from steem import BitShares
steem = BitShares()
from steempy import Steem
steem = Steem()
steem.wallet.unlock("supersecret-passphrase")
steem.wallet.addPrivateKey("5xxxxxxxxxxxxxxxxxxxx")
......@@ -45,5 +45,5 @@ A private key can be added by using the
API
---
.. autoclass:: steem.wallet.Wallet
.. autoclass:: steempy.wallet.Wallet
:members:
******************
BitSharesWebsocket
SteemWebsocket
******************
This class allows subscribe to push notifications from the BitShares
This class allows subscribe to push notifications from the Steem
node.
.. code-block:: python
from pprint import pprint
from steemapi.websocket import BitSharesWebsocket
from steempyapi.websocket import SteemWebsocket
ws = BitSharesWebsocket(
"wss://node.testnet.steem.eu",
markets=[["1.3.0", "1.3.172"]],
accounts=["xeroc"],
objects=["2.0.x", "2.1.x"],
on_market=pprint,
ws = SteemWebsocket(
"wss://testnet.steem.vc,
accounts=["test"],
# on_market=pprint,
on_account=print,
)
......@@ -23,7 +21,7 @@ node.
Defintion
=========
.. autoclass:: steemapi.websocket.BitSharesWebsocket
.. autoclass:: steempyapi.websocket.SteemWebsocket
:members:
:undoc-members:
:private-members:
......
****************
BitSharesNodeRPC
SteemNodeRPC
****************
This class allows to call API methods exposed by the witness node via
......@@ -7,5 +7,5 @@ websockets.
Defintion
=========
.. autoclass:: steemapi.steemnoderpc.BitSharesNodeRPC
.. autoclass:: steempyapi.steemnoderpc.SteemNodeRPC
:members: rpcexec, __getattr__
......@@ -5,11 +5,11 @@ Read data about a witness
.. code-block:: python
from steem.witness import Witness
from steempy.witness import Witness
Witness("chainsquad.com")
.. autoclass:: steem.witness.Witness
.. autoclass:: steempy.witness.Witness
:members:
.. autoclass:: steem.witness.Witnesses
.. autoclass:: steempy.witness.Witnesses
:members:
......@@ -374,7 +374,7 @@ class Steem(object):
def create_account(
self,
account_name,
registrar=None,
creator=None,
owner_key=None,
active_key=None,
memo_key=None,
......@@ -387,6 +387,7 @@ class Steem(object):
additional_active_accounts=[],
additional_posting_accounts=[],
storekeys=True,
store_owner_key=False,
**kwargs
):
""" Create new account on Steem
......@@ -433,9 +434,9 @@ class Steem(object):
the blockchain
"""
if not registrar and config["default_account"]:
registrar = config["default_account"]
if not registrar:
if not creator and config["default_account"]:
creator = config["default_account"]
if not creator:
raise ValueError(
"Not registrar account given. Define it with " +
"registrar=x, or set the default_account using uptick")
......@@ -450,7 +451,7 @@ class Steem(object):
except:
pass
registrar = Account(registrar, steem_instance=self)
# creator = Account(creator, steem_instance=self)
" Generate new keys from password"
from steempybase.account import PasswordKey, PublicKey
......@@ -469,7 +470,8 @@ class Steem(object):
memo_privkey = memo_key.get_private_key()
# store private keys
if storekeys:
# self.wallet.addPrivateKey(owner_privkey)
if store_owner_key:
self.wallet.addPrivateKey(owner_privkey)
self.wallet.addPrivateKey(active_privkey)
self.wallet.addPrivateKey(memo_privkey)
self.wallet.addPrivateKey(posting_privkey)
......@@ -518,7 +520,7 @@ class Steem(object):
op = {
"fee": Amount(0, "STEEM"),
"creator": registrar["name"],
"creator": creator,
"new_account_name": account_name,
'owner': {'account_auths': owner_accounts_authority,
'key_auths': owner_key_authority,
......@@ -536,7 +538,7 @@ class Steem(object):
"json_metadata": {},
}
op = operations.Account_create(**op)
return self.finalizeOp(op, registrar, "active", **kwargs)
return self.finalizeOp(op, creator, "active", **kwargs)
def upgrade_account(self, account=None, **kwargs):
""" Upgrade an account to Lifetime membership
......
......@@ -98,7 +98,7 @@ class TransactionBuilder(dict):
""" Try to obtain the wif key from the wallet by telling which account
and permission is supposed to sign the transaction
"""
assert permission in ["active", "owner"], "Invalid permission"
assert permission in ["active", "owner", "posting"], "Invalid permission"
account = Account(account, steem_instance=self.steem)
required_treshold = account[permission]["weight_threshold"]
......
......@@ -54,7 +54,7 @@ class Testcases(unittest.TestCase):
key5 = PrivateKey()
tx = bts.create_account(
name,
registrar="test", # 1.2.7
creator="test", # 1.2.7
owner_key=format(key1.pubkey, core_unit),
active_key=format(key2.pubkey, core_unit),
posting_key=format(key3.pubkey, core_unit),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment