From c729611c814cb49f279f2f4583c984b7057e2234 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Sa=C5=82aban?= Date: Thu, 15 Feb 2018 21:32:26 +0100 Subject: [PATCH] Add numbers module docs, describe transaction priorities --- docs/source/index.rst | 1 + docs/source/misc.rst | 8 ++++++++ monero/account.py | 8 ++++++-- monero/numbers.py | 11 ++++++++++- monero/wallet.py | 8 ++++++-- 5 files changed, 31 insertions(+), 5 deletions(-) create mode 100644 docs/source/misc.rst diff --git a/docs/source/index.rst b/docs/source/index.rst index cc60ff9..00ff5ae 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -24,6 +24,7 @@ Project homepage: https://github.com/emesik/monero-python transactions daemon backends + misc exceptions license authors diff --git a/docs/source/misc.rst b/docs/source/misc.rst new file mode 100644 index 0000000..c6e2540 --- /dev/null +++ b/docs/source/misc.rst @@ -0,0 +1,8 @@ +Miscellaneous functions, types and constants +============================================ + +API reference +------------- + +.. automodule:: monero.numbers + :members: diff --git a/monero/account.py b/monero/account.py index 3f1210e..5d97f72 100644 --- a/monero/account.py +++ b/monero/account.py @@ -72,7 +72,9 @@ class Account(object): :param address: destination :class:`Address ` or subtype :param amount: amount to send - :param priority: transaction priority (implies fee) + :param priority: transaction priority, implies fee. The priority can be a number + from 1 to 4 (unimportant, normal, elevated, priority) or a constant + from `monero.prio`. :param ringsize: the ring size (mixin + 1) :param payment_id: ID for the payment (must be None if :class:`IntegratedAddress ` @@ -100,7 +102,9 @@ class Account(object): :param destinations: a list of destination and amount pairs: [(:class:`Address `, `Decimal`), ...] - :param priority: transaction priority (implies fee) + :param priority: transaction priority, implies fee. The priority can be a number + from 1 to 4 (unimportant, normal, elevated, priority) or a constant + from `monero.prio`. :param ringsize: the ring size (mixin + 1) :param payment_id: ID for the payment (must be None if :class:`IntegratedAddress ` diff --git a/monero/numbers.py b/monero/numbers.py index 5b7c761..0590e1f 100644 --- a/monero/numbers.py +++ b/monero/numbers.py @@ -25,6 +25,15 @@ def as_monero(amount): class PaymentID(object): + """ + A class that validates Monero payment ID. + + Payment IDs can be used as str or int across the module, however this class + offers validation as well as simple conversion and comparison to those two + primitive types. + + :param payment_id: the payment ID as integer or hexadecimal string + """ _payment_id = None def __init__(self, payment_id): @@ -41,7 +50,7 @@ class PaymentID(object): def is_short(self): """Returns True if payment ID is short enough to be included - in Integrated Address.""" + in :class:`IntegratedAddress `.""" return self._payment_id.bit_length() <= 64 def __repr__(self): diff --git a/monero/wallet.py b/monero/wallet.py index 6265124..b3dc040 100644 --- a/monero/wallet.py +++ b/monero/wallet.py @@ -157,7 +157,9 @@ class Wallet(object): :param address: destination :class:`Address ` or subtype :param amount: amount to send - :param priority: transaction priority (implies fee) + :param priority: transaction priority, implies fee. The priority can be a number + from 1 to 4 (unimportant, normal, elevated, priority) or a constant + from `monero.prio`. :param ringsize: the ring size (mixin + 1) :param payment_id: ID for the payment (must be None if :class:`IntegratedAddress ` @@ -185,7 +187,9 @@ class Wallet(object): transactions. :param destinations: a list of destination and amount pairs: [(address, amount), ...] - :param priority: transaction priority (implies fee) + :param priority: transaction priority, implies fee. The priority can be a number + from 1 to 4 (unimportant, normal, elevated, priority) or a constant + from `monero.prio`. :param ringsize: the ring size (mixin + 1) :param payment_id: ID for the payment (must be None if :class:`IntegratedAddress `