Skip to content

Commit c342cea

Browse files
committed
cleanup docs
1 parent 9b97911 commit c342cea

File tree

4 files changed

+41
-34
lines changed

4 files changed

+41
-34
lines changed

convex_api/account.py

Lines changed: 34 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -25,57 +25,60 @@
2525

2626

2727
class Account:
28-
"""
2928

30-
The Convex account class, contains the public/private keys and possibly an address.
29+
def __init__(self, private_key, address=None):
30+
"""
3131
32-
You can create a new account object, it will only have it's public/private keys but does not have a valid account address.
33-
To obtain a new account address, you need to call the :py:meth:`.ConvexAPI.create_account` with the new account object.
32+
Create a new account with a private key as a Ed25519PrivateKey. It is better to use
33+
one of the following static methods to create an Account object:
3434
35-
This is so that you can use the same public/private keys for multiple convex accounts.
35+
* :meth:`.create`
36+
* :meth:`import_from_bytes`
37+
* :meth:`import_from_file`
38+
* :meth:`import_from_mnemonic`
39+
* :meth:`import_from_text`
3640
37-
Once you have your new account you need to save the public/private keys using the `export..` methods and also you
38-
need to save the account address.
41+
:param Ed25519PrivateKey private_key: The public/private key as an Ed25519PrivateKey object
3942
40-
To re-use the account again, you can import the keys and set the account address using one of the `import..` methods.
43+
:param int address: address of the account
4144
42-
**Note**
43-
For security reasons all of the keys, and text returned by the accounts are only truncated ending with a **`...`**
4445
45-
.. code-block:: python
46+
The Convex account class, contains the public/private keys and possibly an address.
4647
47-
>>> # import convex-api
48-
>>> from convex_api import ConvexAPI
48+
You can create a new account object, it will only have it's public/private keys but does not have a valid account address.
49+
To obtain a new account address, you need to call the :py:meth:`.ConvexAPI.create_account` with the new account object.
4950
50-
>>> # setup the network connection
51-
>>> convex_api = ConvexAPI('https://convex.world')
51+
This is so that you can use the same public/private keys for multiple convex accounts.
5252
53-
>>> # create a new account and address
54-
>>> account = convex_api.create_account()
53+
Once you have your new account you need to save the public/private keys using the `export..` methods and also you
54+
need to save the account address.
5555
56-
>>> # export the private key to a file
57-
>>> account.export_to_file('/tmp/my_account.pem', 'my secret password')
56+
To re-use the account again, you can import the keys and set the account address using one of the `import..` methods.
5857
59-
>>> # save the address for later
60-
>>> my_address = account.address
58+
**Note**
59+
For security reasons all of the keys, and text returned by the accounts are only truncated ending with a **`...`**
6160
62-
>>> # ----
61+
.. code-block:: python
6362
64-
>>> # now import the account and address for later use
65-
>>> reload_account = Account.import_from_file('/tmp/my_account.pem', 'my secret password', my_address)
63+
>>> # import convex-api
64+
>>> from convex_api import ConvexAPI
6665
67-
"""
68-
def __init__(self, private_key, address=None):
69-
"""
66+
>>> # setup the network connection
67+
>>> convex_api = ConvexAPI('https://convex.world')
7068
71-
Create a new account with a private key as a Ed25519PrivateKey. It is better to use
72-
one of the `create` or `import` methods instead of creating this object directly.
69+
>>> # create a new account and address
70+
>>> account = convex_api.create_account()
7371
74-
:param Ed25519PrivateKey private_key: The public/private key as an Ed25519PrivateKey object
72+
>>> # export the private key to a file
73+
>>> account.export_to_file('/tmp/my_account.pem', 'my secret password')
7574
76-
:param int address: address of the account
75+
>>> # save the address for later
76+
>>> my_address = account.address
7777
78+
>>> # ----
7879
80+
>>> # now import the account and address for later use
81+
>>> reload_account = Account.import_from_file('/tmp/my_account.pem', 'my secret password', my_address)
7982
8083
"""
8184
self._private_key = private_key

docs/source/classes/account.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
Account class
22
=============
33

4-
.. autoclass:: convex_api.account.Account
4+
.. autoclass:: convex_api.Account
55
:members:
66
:undoc-members:
77
:show-inheritance:
8+
9+

docs/source/classes/convex_api.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
ConvexAPI class
22
===============
33

4-
.. autoclass:: convex_api.convex_api.ConvexAPI
4+
.. autoclass:: convex_api.ConvexAPI
55
:members:
66
:undoc-members:
77
:show-inheritance:

docs/source/conf.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import shutil
1818
from sphinx.domains.python import PythonDomain
1919

20-
print(os.path.abspath('../../'))
20+
# print(os.path.abspath('../../'))
2121
sys.path.insert(0, os.path.abspath('../../'))
2222

2323
# -- Project information -----------------------------------------------------
@@ -52,6 +52,7 @@
5252
apidoc_module_dir = '../../convex_api'
5353
# apidoc_output_dir = 'api' by default, and leave it that way!
5454
apidoc_separate_modules = True
55+
5556
# See https://www.sphinx-doc.org/en/master/man/sphinx-apidoc.html
5657
apidoc_extra_args = []
5758
apidoc_excluded_paths = [
@@ -71,6 +72,7 @@
7172
# 'special-members': None,
7273
# 'inherited-members': None,
7374
# }
75+
autoclass_content = 'both'
7476

7577
# Add any paths that contain templates here, relative to this directory.
7678
templates_path = ['_templates']

0 commit comments

Comments
 (0)