Add API docs for backend and transaction classes

This commit is contained in:
Michał Sałaban 2018-02-16 13:46:14 +01:00
parent 0aff11fc59
commit 9e9b75a42e
3 changed files with 54 additions and 1 deletions

View File

@ -24,5 +24,5 @@ the official `Wallet RPC`_ documentation.
API reference
-------------
.. automodule:: monero.backends
.. automodule:: monero.backends.jsonrpc
:members:

View File

@ -16,6 +16,14 @@ _log = logging.getLogger(__name__)
class JSONRPCDaemon(object):
"""
JSON RPC backend for Monero daemon
:param protocol: `http` or `https`
:param host: host name or IP
:param port: port number
:param path: path for JSON RPC requests (should not be changed)
"""
def __init__(self, protocol='http', host='127.0.0.1', port=18081, path='/json_rpc'):
self.url = '{protocol}://{host}:{port}'.format(
protocol=protocol,
@ -99,6 +107,16 @@ class JSONRPCDaemon(object):
class JSONRPCWallet(object):
"""
JSON RPC backend for Monero wallet (``monero-wallet-rpc``)
:param protocol: `http` or `https`
:param host: host name or IP
:param port: port number
:param path: path for JSON RPC requests (should not be changed)
:param user: username to authenticate with over RPC
:param password: password to authenticate with over RPC
"""
_master_address = None
_addresses = None

View File

@ -3,6 +3,13 @@ from .address import address
from .numbers import PaymentID
class Payment(object):
"""
A payment base class, representing payment not associated with any
:class:`Account <monero.account.Account>`.
This class is not intended to be turned into objects by the user,
it is used by backends.
"""
payment_id = None
amount = None
timestamp = None
@ -28,14 +35,29 @@ class Payment(object):
class IncomingPayment(Payment):
"""
An incoming payment (one that increases the balance of an
:class:`Account <monero.account.Account>`)
"""
_reprstr = "in: {} @ {} {:.12f} id={}"
class OutgoingPayment(Payment):
"""
An outgoing payment (one that decreases the balance of an
:class:`Account <monero.account.Account>`)
"""
_reprstr = "out: {} @ {} {:.12f} id={}"
class Transaction(object):
"""
A Monero transaction. Identified by `hash`, it can be a part of a block of some `height`
or not yet mined (`height` is `None` then).
This class is not intended to be turned into objects by the user,
it is used by backends.
"""
hash = None
fee = None
height = None
@ -62,6 +84,13 @@ else:
class PaymentManager(object):
"""
A payment query manager, handling either incoming or outgoing payments of
an :class:`Account <monero.account.Account>`.
This class is not intended to be turned into objects by the user,
it is used by backends.
"""
account_idx = 0
backend = None
@ -76,6 +105,12 @@ class PaymentManager(object):
class PaymentFilter(object):
"""
A helper class that filters payments retrieved by the backend.
This class is not intended to be turned into objects by the user,
it is used by backends.
"""
def __init__(self, **filterparams):
self.min_height = filterparams.pop('min_height', None)
self.max_height = filterparams.pop('max_height', None)