mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2025-11-20 19:55:54 +00:00
181 lines
3.8 KiB
Python
181 lines
3.8 KiB
Python
# Canonical ordering (of transaction signing fields only)
|
|
# for serializing and signing transactions
|
|
|
|
TYPES = {
|
|
# Type name: canonical order for this type
|
|
"UInt16": 1,
|
|
"UInt32": 2,
|
|
"UInt64": 3,
|
|
"Hash128": 4,
|
|
"Hash256": 5,
|
|
"Amount": 6,
|
|
"VL": 7, # VariableLength
|
|
"Account": 8,
|
|
# 9-13 are reserved
|
|
"Object": 14,
|
|
"Array": 15,
|
|
"UInt8": 16,
|
|
"Hash160": 17,
|
|
"PathSet": 18, # "Paths" field of cross-currency payments only
|
|
"Vector256": 19,
|
|
}
|
|
|
|
FIELDS = {
|
|
# Type name: Canonical order for this field (among fields of its type)
|
|
|
|
# UInt16 types
|
|
"LedgerEntryType": 1,
|
|
"TransactionType": 2,
|
|
"SignerWeight": 3,
|
|
# UInt32 types
|
|
"Flags": 2,
|
|
"SourceTag": 3,
|
|
"Sequence": 4,
|
|
"PreviousTxnLgrSeq": 5,
|
|
"LedgerSequence": 6,
|
|
"CloseTime": 7,
|
|
"ParentCloseTime": 8,
|
|
"SigningTime": 9,
|
|
"Expiration": 10,
|
|
"TransferRate": 11,
|
|
"WalletSize": 12,
|
|
"OwnerCount": 13,
|
|
"DestinationTag": 14,
|
|
"HighQualityIn": 16,
|
|
"HighQualityOut": 17,
|
|
"LowQualityIn": 18,
|
|
"LowQualityOut": 19,
|
|
"QualityIn": 20,
|
|
"QualityOut": 21,
|
|
"StampEscrow": 22,
|
|
"BondAmount": 23,
|
|
"LoadFee": 24,
|
|
"OfferSequence": 25,
|
|
"FirstLedgerSequence": 26,
|
|
"LastLedgerSequence": 27,
|
|
"TransactionIndex": 28,
|
|
"OperationLimit": 29,
|
|
"ReferenceFeeUnits": 30,
|
|
"ReserveBase": 31,
|
|
"ReserveIncrement": 32,
|
|
"SetFlag": 33,
|
|
"ClearFlag": 34,
|
|
"SignerQuorum": 35,
|
|
"CancelAfter": 36,
|
|
"FinishAfter": 37,
|
|
"SignerListID": 38,
|
|
"SettleDelay": 39,
|
|
# UInt64 types
|
|
"IndexNext": 1,
|
|
"IndexPrevious": 2,
|
|
"BookNode": 3,
|
|
"OwnerNode": 4,
|
|
"BaseFee": 5,
|
|
"ExchangeRate": 6,
|
|
"LowNode": 7,
|
|
"HighNode": 8,
|
|
"DestinationNode": 9,
|
|
"Cookie": 10,
|
|
# Hash128 types
|
|
"EmailHash": 1,
|
|
# Hash256 types
|
|
"LedgerHash": 1,
|
|
"ParentHash": 2,
|
|
"TransactionHash": 3,
|
|
"AccountHash": 4,
|
|
"PreviousTxnID": 5,
|
|
"LedgerIndex": 6,
|
|
"WalletLocator": 7,
|
|
"RootIndex": 8,
|
|
"AccountTxnID": 9,
|
|
"BookDirectory": 16,
|
|
"InvoiceID": 17,
|
|
"Nickname": 18,
|
|
"Amendment": 19,
|
|
"TicketID": 20,
|
|
"Digest": 21,
|
|
"Channel": 22,
|
|
"ConsensusHash": 23,
|
|
"CheckID": 24,
|
|
"hash": 257,
|
|
"index": 258,
|
|
# Amount types
|
|
"Amount": 1,
|
|
"Balance": 2,
|
|
"LimitAmount": 3,
|
|
"TakerPays": 4,
|
|
"TakerGets": 5,
|
|
"LowLimit": 6,
|
|
"HighLimit": 7,
|
|
"Fee": 8,
|
|
"SendMax": 9,
|
|
"DeliverMin": 10,
|
|
"MinimumOffer": 16,
|
|
"RippleEscrow": 17,
|
|
"DeliveredAmount": 18,
|
|
# VL types
|
|
"PublicKey": 1,
|
|
"MessageKey": 2,
|
|
"SigningPubKey": 3,
|
|
"TxnSignature": 4,
|
|
"Signature": 6,
|
|
"Domain": 7,
|
|
"FundCode": 8,
|
|
"RemoveCode": 9,
|
|
"ExpireCode": 10,
|
|
"CreateCode": 11,
|
|
"MemoType": 12,
|
|
"MemoData": 13,
|
|
"MemoFormat": 14,
|
|
"Fulfillment": 16,
|
|
"Condition": 17,
|
|
"MasterSignature": 18,
|
|
# Account types
|
|
"Account": 1,
|
|
"Owner": 2,
|
|
"Destination": 3,
|
|
"Issuer": 4,
|
|
"Authorize": 5,
|
|
"Unauthorize": 6,
|
|
"Target": 7,
|
|
"RegularKey": 8,
|
|
# Object types
|
|
"TransactionMetaData": 2,
|
|
"CreatedNode": 3,
|
|
"DeletedNode": 4,
|
|
"ModifiedNode": 5,
|
|
"PreviousFields": 6,
|
|
"FinalFields": 7,
|
|
"NewFields": 8,
|
|
"TemplateEntry": 9,
|
|
"Memo": 10,
|
|
"SignerEntry": 11,
|
|
"Signer": 16,
|
|
"Majority": 18,
|
|
# Array types
|
|
"Signers": 3,
|
|
"SignerEntries": 4,
|
|
"Template": 5,
|
|
"Necessary": 6,
|
|
"Sufficient": 7,
|
|
"AffectedNodes": 8,
|
|
"Memos": 9,
|
|
"Majorities": 16,
|
|
# UInt8 types
|
|
"CloseResolution": 1,
|
|
"Method": 2,
|
|
"TransactionResult": 3,
|
|
"TickSize": 16,
|
|
# Hash160 types
|
|
"TakerPaysCurrency": 1,
|
|
"TakerPaysIssuer": 2,
|
|
"TakerGetsCurrency": 3,
|
|
"TakerGetsIssuer": 4,
|
|
# PathSet types
|
|
"Paths": 1,
|
|
# Vector256 types
|
|
"Indexes": 1,
|
|
"Hashes": 2,
|
|
"Amendments": 3,
|
|
}
|