Add numbers module docs, describe transaction priorities

This commit is contained in:
Michał Sałaban 2018-02-15 21:32:26 +01:00
parent 775e3bd7a4
commit c729611c81
5 changed files with 31 additions and 5 deletions

View File

@ -24,6 +24,7 @@ Project homepage: https://github.com/emesik/monero-python
transactions
daemon
backends
misc
exceptions
license
authors

8
docs/source/misc.rst Normal file
View File

@ -0,0 +1,8 @@
Miscellaneous functions, types and constants
============================================
API reference
-------------
.. automodule:: monero.numbers
:members:

View File

@ -72,7 +72,9 @@ class Account(object):
:param address: destination :class:`Address <monero.address.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 <monero.address.IntegratedAddress>`
@ -100,7 +102,9 @@ class Account(object):
:param destinations: a list of destination and amount pairs:
[(:class:`Address <monero.address.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 <monero.address.IntegratedAddress>`

View File

@ -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 <monero.address.IntegratedAddress>`."""
return self._payment_id.bit_length() <= 64
def __repr__(self):

View File

@ -157,7 +157,9 @@ class Wallet(object):
:param address: destination :class:`Address <monero.address.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 <monero.address.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 <monero.address.IntegratedAddress>`