XRPL Pseudo-Transaction Models

Model objects for specific types of Pseudo-Transactions in the XRP Ledger.

class xrpl.models.transactions.pseudo_transactions.EnableAmendment(*args: List[Any], **kwargs: Dict[str, Any])

Bases: PseudoTransaction

An EnableAmendment pseudo-transaction marks a change in status of an amendment to the XRP Ledger protocol, including:

  • A proposed amendment gained supermajority approval from validators.

  • A proposed amendment lost supermajority approval.

  • A proposed amendment has been enabled.

account: str

The address of the sender of the transaction. Required.

account_txn_id: str | None = None

A hash value identifying a previous transaction from the same sender. If provided, this transaction is only considered valid if the identified transaction is the most recent transaction sent by this address. See AccountTxnID for details.

amendment: str

A unique identifier for the amendment. This is not intended to be a human-readable name. See Amendments for a list of known amendments. This field is required.

blob() str

Creates the canonical binary format of the Transaction object.

Returns:

The binary-encoded object, as a hexadecimal string.

fee: str = '0'

(Auto-fillable) The amount of XRP to destroy as a cost to send this transaction. See Transaction Cost for details.

flags: int | List[int] = 0

The Flags value of the EnableAmendment pseudo-transaction indicates the status of the amendment at the time of the ledger including the pseudo-transaction. A Flags value of 0 (no flags) or an omitted Flags field indicates that the amendment has been enabled, and applies to all ledgers afterward.

static from_blob(tx_blob: str) Transaction

Decodes a transaction blob.

Parameters:

tx_blob – the tx blob to decode.

Returns:

The formatted transaction.

classmethod from_dict(value: Dict[str, Any]) T

Construct a new Transaction from a dictionary of parameters.

Parameters:

value – The value to construct the Transaction from.

Returns:

A new Transaction object, constructed using the given parameters.

Raises:

XRPLModelException – If the dictionary provided is invalid.

classmethod from_xrpl(value: str | Dict[str, Any]) BM

Creates a BaseModel object based on a JSON-like dictionary of keys in the JSON format used by the binary codec, or an actual JSON string representing the same data.

Parameters:

value – The dictionary or JSON string to be instantiated.

Returns:

A BaseModel object instantiated from the input.

get_hash() str

Hashes the Transaction object as the ledger does. Only valid for signed Transaction objects.

Returns:

The hash of the Transaction object.

Raises:

XRPLModelException – if the Transaction is unsigned.

classmethod get_transaction_type(transaction_type: str) Type[Transaction]

Returns the correct transaction type based on the string name.

Parameters:

transaction_type – The String name of the Transaction object.

Returns:

The transaction class with the given name.

Raises:

XRPLModelException – If transaction_type is not a valid Transaction type.

has_flag(flag: int) bool

Returns whether the transaction has the given flag value set.

Parameters:

flag – The given flag value for which the function will determine whether it is set.

Returns:

Whether the transaction has the given flag value set.

classmethod is_dict_of_model(dictionary: Any) bool

Checks whether the provided dictionary is a dictionary representation of this class.

Note: This only checks the exact model, and does not count model inheritance. This method returns False if the dictionary represents a subclass of this class.

Parameters:

dictionary – The dictionary to check.

Returns:

True if dictionary is a dict representation of an instance of this class; False if not.

is_signed() bool

Checks if a transaction has been signed.

Returns:

Whether the transaction has been signed

is_valid() bool

Returns whether this BaseModel is valid.

Returns:

Whether this BaseModel is valid.

last_ledger_sequence: int | None = None

The highest ledger index this transaction can appear in. Specifying this field places a strict upper limit on how long the transaction can wait to be validated or rejected. See Reliable Transaction Submission for details.

ledger_sequence: int

The ledger index where this pseudo-transaction appears. This distinguishes the pseudo-transaction from other occurrences of the same change. This field is required.

memos: List[Memo] | None = None

Additional arbitrary information attached to this transaction.

network_id: int | None = None

The network id of the transaction.

sequence: int = 0

(Auto-fillable) The sequence number of the transaction. Must match the sending account’s next unused sequence number. See Account Sequence for details.

signers: List[Signer] | None = None

Signing data authorizing a multi-signed transaction. Added during multi-signing.

signing_pub_key: str = ''

The public key authorizing a single-signed transaction. Automatically added during signing.

source_tag: None = None

An arbitrary source tag representing a hosted user or specific purpose at the sending account where this transaction comes from.

tf_got_majority: bool | None = None

Support for this amendment increased to at least 80% of trusted validators starting with this ledger version.

tf_lost_majority: bool | None = None

Support for this amendment decreased to less than 80% of trusted validators starting with this ledger version.

ticket_sequence: int | None = None

The sequence number of the ticket to use in place of a Sequence number. If this is provided, sequence must be 0. Cannot be used with account_txn_id.

to_dict() Dict[str, Any]

Returns the dictionary representation of a Transaction.

Returns:

The dictionary representation of a Transaction.

to_xrpl() Dict[str, Any]

Creates a JSON-like dictionary in the JSON format used by the binary codec based on the Transaction object.

Returns:

A JSON-like dictionary in the JSON format used by the binary codec.

transaction_type: PseudoTransactionType = 'EnableAmendment'
txn_signature: str = ''

The cryptographic signature from the sender that authorizes this transaction. Automatically added during signing.

validate() None

Raises if this object is invalid.

Raises:

XRPLModelException – if this object is invalid.

class xrpl.models.transactions.pseudo_transactions.EnableAmendmentFlag(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: int, Enum

The Flags value of the EnableAmendment pseudo-transaction indicates the status of the amendment at the time of the ledger including the pseudo-transaction.

A Flags value of 0 (no flags) or an omitted Flags field indicates that the amendment has been enabled, and applies to all ledgers afterward.

See EnableAmendment Flags

TF_GOT_MAJORITY = 65536

Support for this amendment increased to at least 80% of trusted validators starting with this ledger version.

TF_LOST_MAJORITY = 131072

Support for this amendment decreased to less than 80% of trusted validators starting with this ledger version.

as_integer_ratio()

Return integer ratio.

Return a pair of integers, whose ratio is exactly equal to the original int and with a positive denominator.

>>> (10).as_integer_ratio()
(10, 1)
>>> (-10).as_integer_ratio()
(-10, 1)
>>> (0).as_integer_ratio()
(0, 1)
bit_count()

Number of ones in the binary representation of the absolute value of self.

Also known as the population count.

>>> bin(13)
'0b1101'
>>> (13).bit_count()
3
bit_length()

Number of bits necessary to represent self in binary.

>>> bin(37)
'0b100101'
>>> (37).bit_length()
6
conjugate()

Returns self, the complex conjugate of any int.

denominator

the denominator of a rational number in lowest terms

from_bytes(byteorder='big', *, signed=False)

Return the integer represented by the given array of bytes.

bytes

Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.

byteorder

The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value. Default is to use ‘big’.

signed

Indicates whether two’s complement is used to represent the integer.

imag

the imaginary part of a complex number

numerator

the numerator of a rational number in lowest terms

real

the real part of a complex number

to_bytes(length=1, byteorder='big', *, signed=False)

Return an array of bytes representing an integer.

length

Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes. Default is length 1.

byteorder

The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value. Default is to use ‘big’.

signed

Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.

class xrpl.models.transactions.pseudo_transactions.EnableAmendmentFlagInterface

Bases: FlagInterface

The Flags value of the EnableAmendment pseudo-transaction indicates the status of the amendment at the time of the ledger including the pseudo-transaction.

A Flags value of 0 (no flags) or an omitted Flags field indicates that the amendment has been enabled, and applies to all ledgers afterward.

See EnableAmendment Flags

TF_GOT_MAJORITY: bool
TF_LOST_MAJORITY: bool
clear() None.  Remove all items from D.
copy() a shallow copy of D
fromkeys(value=None, /)

Create a new dictionary with keys from iterable and values set to value.

get(key, default=None, /)

Return the value for key if key is in the dictionary, else default.

items() a set-like object providing a view on D's items
keys() a set-like object providing a view on D's keys
pop(k[, d]) v, remove specified key and return the corresponding value.

If the key is not found, return the default if given; otherwise, raise a KeyError.

popitem()

Remove and return a (key, value) pair as a 2-tuple.

Pairs are returned in LIFO (last-in, first-out) order. Raises KeyError if the dict is empty.

setdefault(key, default=None, /)

Insert key with a value of default if key is not in the dictionary.

Return the value for key if key is in the dictionary, else default.

update([E, ]**F) None.  Update D from dict/iterable E and F.

If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

values() an object providing a view on D's values
class xrpl.models.transactions.pseudo_transactions.SetFee(*args: List[Any], **kwargs: Dict[str, Any])

Bases: PseudoTransaction

A SetFee pseudo-transaction marks a change in transaction cost or reserve requirements as a result of Fee Voting.

The parameters are different depending on if this is before or after the `XRPFees Amendment<https://xrpl.org/known-amendments.html#xrpfees>`_

Before the XRPFees Amendment which was proposed in rippled 1.10.0 base_fee, reference_fee_units, reserve_base, and reserve_increment were required fields.

After the XRPFees Amendment, base_fee_drops, reserve_base_drops, and reserve_increment_drops are required fields.

No SetFee Pseudo Transaction should contain fields from BOTH before and after the XRPFees amendment.

account: str

The address of the sender of the transaction. Required.

account_txn_id: str | None = None

A hash value identifying a previous transaction from the same sender. If provided, this transaction is only considered valid if the identified transaction is the most recent transaction sent by this address. See AccountTxnID for details.

base_fee: str | None

The charge, in drops of XRP, for the reference transaction, as hex. (This is the transaction cost before scaling for load.) This field is required.

base_fee_drops: str | None

The charge, in drops of XRP, for the reference transaction, as hex. (This is the transaction cost before scaling for load.) This field is required.

blob() str

Creates the canonical binary format of the Transaction object.

Returns:

The binary-encoded object, as a hexadecimal string.

fee: str = '0'

(Auto-fillable) The amount of XRP to destroy as a cost to send this transaction. See Transaction Cost for details.

flags: Dict[str, bool] | int | List[int] = 0

A List of flags, or a bitwise map of flags, modifying this transaction’s behavior. See Flags Field for more details.

static from_blob(tx_blob: str) Transaction

Decodes a transaction blob.

Parameters:

tx_blob – the tx blob to decode.

Returns:

The formatted transaction.

classmethod from_dict(value: Dict[str, Any]) T

Construct a new Transaction from a dictionary of parameters.

Parameters:

value – The value to construct the Transaction from.

Returns:

A new Transaction object, constructed using the given parameters.

Raises:

XRPLModelException – If the dictionary provided is invalid.

classmethod from_xrpl(value: str | Dict[str, Any]) BM

Creates a BaseModel object based on a JSON-like dictionary of keys in the JSON format used by the binary codec, or an actual JSON string representing the same data.

Parameters:

value – The dictionary or JSON string to be instantiated.

Returns:

A BaseModel object instantiated from the input.

get_hash() str

Hashes the Transaction object as the ledger does. Only valid for signed Transaction objects.

Returns:

The hash of the Transaction object.

Raises:

XRPLModelException – if the Transaction is unsigned.

classmethod get_transaction_type(transaction_type: str) Type[Transaction]

Returns the correct transaction type based on the string name.

Parameters:

transaction_type – The String name of the Transaction object.

Returns:

The transaction class with the given name.

Raises:

XRPLModelException – If transaction_type is not a valid Transaction type.

has_flag(flag: int) bool

Returns whether the transaction has the given flag value set.

Parameters:

flag – The given flag value for which the function will determine whether it is set.

Returns:

Whether the transaction has the given flag value set.

classmethod is_dict_of_model(dictionary: Any) bool

Checks whether the provided dictionary is a dictionary representation of this class.

Note: This only checks the exact model, and does not count model inheritance. This method returns False if the dictionary represents a subclass of this class.

Parameters:

dictionary – The dictionary to check.

Returns:

True if dictionary is a dict representation of an instance of this class; False if not.

is_signed() bool

Checks if a transaction has been signed.

Returns:

Whether the transaction has been signed

is_valid() bool

Returns whether this BaseModel is valid.

Returns:

Whether this BaseModel is valid.

last_ledger_sequence: int | None = None

The highest ledger index this transaction can appear in. Specifying this field places a strict upper limit on how long the transaction can wait to be validated or rejected. See Reliable Transaction Submission for details.

memos: List[Memo] | None = None

Additional arbitrary information attached to this transaction.

network_id: int | None = None

The network id of the transaction.

reference_fee_units: int | None

The cost, in fee units, of the reference transaction. This field is required.

reserve_base: int | None

The base reserve, in drops. This field is required.

reserve_base_drops: str | None

The base reserve, in drops. This field is required.

reserve_increment: int | None

The incremental reserve, in drops. This field is required.

reserve_increment_drops: str | None

The incremental reserve, in drops. This field is required.

sequence: int = 0

(Auto-fillable) The sequence number of the transaction. Must match the sending account’s next unused sequence number. See Account Sequence for details.

signers: List[Signer] | None = None

Signing data authorizing a multi-signed transaction. Added during multi-signing.

signing_pub_key: str = ''

The public key authorizing a single-signed transaction. Automatically added during signing.

source_tag: None = None

An arbitrary source tag representing a hosted user or specific purpose at the sending account where this transaction comes from.

ticket_sequence: int | None = None

The sequence number of the ticket to use in place of a Sequence number. If this is provided, sequence must be 0. Cannot be used with account_txn_id.

to_dict() Dict[str, Any]

Returns the dictionary representation of a Transaction.

Returns:

The dictionary representation of a Transaction.

to_xrpl() Dict[str, Any]

Creates a JSON-like dictionary in the JSON format used by the binary codec based on the Transaction object.

Returns:

A JSON-like dictionary in the JSON format used by the binary codec.

transaction_type: PseudoTransactionType = 'SetFee'
txn_signature: str = ''

The cryptographic signature from the sender that authorizes this transaction. Automatically added during signing.

validate() None

Raises if this object is invalid.

Raises:

XRPLModelException – if this object is invalid.

class xrpl.models.transactions.pseudo_transactions.UNLModify(*args: List[Any], **kwargs: Dict[str, Any])

Bases: PseudoTransaction

A UNLModify pseudo-transaction marks a change to the Negative UNL, indicating that a trusted validator has gone offline or come back online.

account: str

The address of the sender of the transaction. Required.

account_txn_id: str | None = None

A hash value identifying a previous transaction from the same sender. If provided, this transaction is only considered valid if the identified transaction is the most recent transaction sent by this address. See AccountTxnID for details.

blob() str

Creates the canonical binary format of the Transaction object.

Returns:

The binary-encoded object, as a hexadecimal string.

fee: str = '0'

(Auto-fillable) The amount of XRP to destroy as a cost to send this transaction. See Transaction Cost for details.

flags: int = 0

The Flags value of the EnableAmendment pseudo-transaction indicates the status of the amendment at the time of the ledger including the pseudo-transaction. A Flags value of 0 (no flags) or an omitted Flags field indicates that the amendment has been enabled, and applies to all ledgers afterward.

static from_blob(tx_blob: str) Transaction

Decodes a transaction blob.

Parameters:

tx_blob – the tx blob to decode.

Returns:

The formatted transaction.

classmethod from_dict(value: Dict[str, Any]) T

Construct a new Transaction from a dictionary of parameters.

Parameters:

value – The value to construct the Transaction from.

Returns:

A new Transaction object, constructed using the given parameters.

Raises:

XRPLModelException – If the dictionary provided is invalid.

classmethod from_xrpl(value: str | Dict[str, Any]) BM

Creates a BaseModel object based on a JSON-like dictionary of keys in the JSON format used by the binary codec, or an actual JSON string representing the same data.

Parameters:

value – The dictionary or JSON string to be instantiated.

Returns:

A BaseModel object instantiated from the input.

get_hash() str

Hashes the Transaction object as the ledger does. Only valid for signed Transaction objects.

Returns:

The hash of the Transaction object.

Raises:

XRPLModelException – if the Transaction is unsigned.

classmethod get_transaction_type(transaction_type: str) Type[Transaction]

Returns the correct transaction type based on the string name.

Parameters:

transaction_type – The String name of the Transaction object.

Returns:

The transaction class with the given name.

Raises:

XRPLModelException – If transaction_type is not a valid Transaction type.

has_flag(flag: int) bool

Returns whether the transaction has the given flag value set.

Parameters:

flag – The given flag value for which the function will determine whether it is set.

Returns:

Whether the transaction has the given flag value set.

classmethod is_dict_of_model(dictionary: Any) bool

Checks whether the provided dictionary is a dictionary representation of this class.

Note: This only checks the exact model, and does not count model inheritance. This method returns False if the dictionary represents a subclass of this class.

Parameters:

dictionary – The dictionary to check.

Returns:

True if dictionary is a dict representation of an instance of this class; False if not.

is_signed() bool

Checks if a transaction has been signed.

Returns:

Whether the transaction has been signed

is_valid() bool

Returns whether this BaseModel is valid.

Returns:

Whether this BaseModel is valid.

last_ledger_sequence: int | None = None

The highest ledger index this transaction can appear in. Specifying this field places a strict upper limit on how long the transaction can wait to be validated or rejected. See Reliable Transaction Submission for details.

ledger_sequence: int

The ledger index where this pseudo-transaction appears. This distinguishes the pseudo-transaction from other occurrences of the same change. This field is required.

memos: List[Memo] | None = None

Additional arbitrary information attached to this transaction.

network_id: int | None = None

The network id of the transaction.

sequence: int = 0

(Auto-fillable) The sequence number of the transaction. Must match the sending account’s next unused sequence number. See Account Sequence for details.

signers: List[Signer] | None = None

Signing data authorizing a multi-signed transaction. Added during multi-signing.

signing_pub_key: str = ''

The public key authorizing a single-signed transaction. Automatically added during signing.

source_tag: None = None

An arbitrary source tag representing a hosted user or specific purpose at the sending account where this transaction comes from.

ticket_sequence: int | None = None

The sequence number of the ticket to use in place of a Sequence number. If this is provided, sequence must be 0. Cannot be used with account_txn_id.

to_dict() Dict[str, Any]

Returns the dictionary representation of a Transaction.

Returns:

The dictionary representation of a Transaction.

to_xrpl() Dict[str, Any]

Creates a JSON-like dictionary in the JSON format used by the binary codec based on the Transaction object.

Returns:

A JSON-like dictionary in the JSON format used by the binary codec.

transaction_type: PseudoTransactionType = 'UNLModify'
txn_signature: str = ''

The cryptographic signature from the sender that authorizes this transaction. Automatically added during signing.

unl_modify_disabling: int

If 1, this change represents adding a validator to the Negative UNL. If 0, this change represents removing a validator from the Negative UNL. (No other values are allowed.) This field is required.

unl_modify_validator: str

The validator to add or remove, as identified by its master public key. This field is required.

validate() None

Raises if this object is invalid.

Raises:

XRPLModelException – if this object is invalid.