mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-20 12:15:51 +00:00
Switch to reduced binformat.
This commit is contained in:
@@ -1,182 +1,90 @@
|
|||||||
var ST = require("./serializedtypes");
|
var ST = require("./serializedtypes");
|
||||||
|
|
||||||
var REQUIRED = 0,
|
var REQUIRED = exports.REQUIRED = 0,
|
||||||
OPTIONAL = 1,
|
OPTIONAL = exports.OPTIONAL = 1,
|
||||||
DEFAULT = 2,
|
DEFAULT = exports.DEFAULT = 2;
|
||||||
|
|
||||||
CloseResolution = ['CloseResolution' , ST.Int8, 1],
|
ST.Int16.id = 1;
|
||||||
TemplateEntryType = ['TemplateEntryType' , ST.Int8, 2],
|
ST.Int32.id = 2;
|
||||||
TransactionResult = ['TransactionResult' , ST.Int8, 3],
|
ST.Int64.id = 3;
|
||||||
LedgerEntryType = ['LedgerEntryType' , ST.Int16, 1],
|
ST.Hash128.id = 4;
|
||||||
TransactionType = ['TransactionType' , ST.Int16, 2],
|
ST.Hash256.id = 5;
|
||||||
Flags = ['Flags' , ST.Int32, 2],
|
ST.Amount.id = 6;
|
||||||
SourceTag = ['SourceTag' , ST.Int32, 3],
|
ST.VariableLength.id = 7;
|
||||||
Sequence = ['Sequence' , ST.Int32, 4],
|
ST.Account.id = 8;
|
||||||
PreviousTxnLgrSeq = ['PreviousTxnLgrSeq' , ST.Int32, 5],
|
ST.Object.id = 14;
|
||||||
LedgerSequence = ['LedgerSequence' , ST.Int32, 6],
|
ST.Array.id = 15;
|
||||||
CloseTime = ['CloseTime' , ST.Int32, 7],
|
ST.Int8.id = 16;
|
||||||
ParentCloseTime = ['ParentCloseTime' , ST.Int32, 8],
|
ST.Hash160.id = 17;
|
||||||
SigningTime = ['SigningTime' , ST.Int32, 9],
|
ST.PathSet.id = 18;
|
||||||
Expiration = ['Expiration' , ST.Int32, 10],
|
ST.Vector256.id = 19;
|
||||||
TransferRate = ['TransferRate' , ST.Int32, 11],
|
|
||||||
WalletSize = ['WalletSize' , ST.Int32, 12],
|
|
||||||
OwnerCount = ['OwnerCount' , ST.Int32, 13],
|
|
||||||
DestinationTag = ['DestinationTag' , ST.Int32, 14],
|
|
||||||
HighQualityIn = ['HighQualityIn' , ST.Int32, 16],
|
|
||||||
HighQualityOut = ['HighQualityOut' , ST.Int32, 17],
|
|
||||||
LowQualityIn = ['LowQualityIn' , ST.Int32, 18],
|
|
||||||
LowQualityOut = ['LowQualityOut' , ST.Int32, 19],
|
|
||||||
QualityIn = ['QualityIn' , ST.Int32, 20],
|
|
||||||
QualityOut = ['QualityOut' , ST.Int32, 21],
|
|
||||||
StampEscrow = ['StampEscrow' , ST.Int32, 22],
|
|
||||||
BondAmount = ['BondAmount' , ST.Int32, 23],
|
|
||||||
LoadFee = ['LoadFee' , ST.Int32, 24],
|
|
||||||
OfferSequence = ['OfferSequence' , ST.Int32, 25],
|
|
||||||
LastLedgerSequence = ['LastLedgerSequence' , ST.Int32, 27],
|
|
||||||
TransactionIndex = ['TransactionIndex' , ST.Int32, 28],
|
|
||||||
OperationLimit = ['OperationLimit' , ST.Int32, 29],
|
|
||||||
ReferenceFeeUnits = ['ReferenceFeeUnits' , ST.Int32, 30],
|
|
||||||
ReserveBase = ['ReserveBase' , ST.Int32, 31],
|
|
||||||
ReserveIncrement = ['ReserveIncrement' , ST.Int32, 32],
|
|
||||||
IndexNext = ['IndexNext' , ST.Int64, 1],
|
|
||||||
IndexPrevious = ['IndexPrevious' , ST.Int64, 2],
|
|
||||||
BookNode = ['BookNode' , ST.Int64, 3],
|
|
||||||
OwnerNode = ['OwnerNode' , ST.Int64, 4],
|
|
||||||
BaseFee = ['BaseFee' , ST.Int64, 5],
|
|
||||||
ExchangeRate = ['ExchangeRate' , ST.Int64, 6],
|
|
||||||
LowNode = ['LowNode' , ST.Int64, 7],
|
|
||||||
HighNode = ['HighNode' , ST.Int64, 8],
|
|
||||||
EmailHash = ['EmailHash' , ST.Hash128, 1],
|
|
||||||
LedgerHash = ['LedgerHash' , ST.Hash256, 1],
|
|
||||||
ParentHash = ['ParentHash' , ST.Hash256, 2],
|
|
||||||
TransactionHash = ['TransactionHash' , ST.Hash256, 3],
|
|
||||||
AccountHash = ['AccountHash' , ST.Hash256, 4],
|
|
||||||
PreviousTxnID = ['PreviousTxnID' , ST.Hash256, 5],
|
|
||||||
LedgerIndex = ['LedgerIndex' , ST.Hash256, 6],
|
|
||||||
WalletLocator = ['WalletLocator' , ST.Hash256, 7],
|
|
||||||
RootIndex = ['RootIndex' , ST.Hash256, 8],
|
|
||||||
BookDirectory = ['BookDirectory' , ST.Hash256, 16],
|
|
||||||
InvoiceID = ['InvoiceID' , ST.Hash256, 17],
|
|
||||||
Nickname = ['Nickname' , ST.Hash256, 18],
|
|
||||||
Feature = ['Feature' , ST.Hash256, 19],
|
|
||||||
TakerPaysCurrency = ['TakerPaysCurrency' , ST.Hash160, 1],
|
|
||||||
TakerPaysIssuer = ['TakerPaysIssuer' , ST.Hash160, 2],
|
|
||||||
TakerGetsCurrency = ['TakerGetsCurrency' , ST.Hash160, 3],
|
|
||||||
TakerGetsIssuer = ['TakerGetsIssuer' , ST.Hash160, 4],
|
|
||||||
Amount = ['Amount' , ST.Amount, 1],
|
|
||||||
Balance = ['Balance' , ST.Amount, 2],
|
|
||||||
LimitAmount = ['LimitAmount' , ST.Amount, 3],
|
|
||||||
TakerPays = ['TakerPays' , ST.Amount, 4],
|
|
||||||
TakerGets = ['TakerGets' , ST.Amount, 5],
|
|
||||||
LowLimit = ['LowLimit' , ST.Amount, 6],
|
|
||||||
HighLimit = ['HighLimit' , ST.Amount, 7],
|
|
||||||
Fee = ['Fee' , ST.Amount, 8],
|
|
||||||
SendMax = ['SendMax' , ST.Amount, 9],
|
|
||||||
MinimumOffer = ['MinimumOffer' , ST.Amount, 16],
|
|
||||||
RippleEscrow = ['RippleEscrow' , ST.Amount, 17],
|
|
||||||
PublicKey = ['PublicKey' , ST.VariableLength, 1],
|
|
||||||
MessageKey = ['MessageKey' , ST.VariableLength, 2],
|
|
||||||
SigningPubKey = ['SigningPubKey' , ST.VariableLength, 3],
|
|
||||||
TxnSignature = ['TxnSignature' , ST.VariableLength, 4],
|
|
||||||
Generator = ['Generator' , ST.VariableLength, 5],
|
|
||||||
Signature = ['Signature' , ST.VariableLength, 6],
|
|
||||||
Domain = ['Domain' , ST.VariableLength, 7],
|
|
||||||
FundCode = ['FundCode' , ST.VariableLength, 8],
|
|
||||||
RemoveCode = ['RemoveCode' , ST.VariableLength, 9],
|
|
||||||
ExpireCode = ['ExpireCode' , ST.VariableLength, 10],
|
|
||||||
CreateCode = ['CreateCode' , ST.VariableLength, 11],
|
|
||||||
Account = ['Account' , ST.Account, 1],
|
|
||||||
Owner = ['Owner' , ST.Account, 2],
|
|
||||||
Destination = ['Destination' , ST.Account, 3],
|
|
||||||
Issuer = ['Issuer' , ST.Account, 4],
|
|
||||||
Target = ['Target' , ST.Account, 7],
|
|
||||||
RegularKey = ['RegularKey' , ST.Account, 8],
|
|
||||||
Paths = ['Paths' , ST.PathSet, 1],
|
|
||||||
Indexes = ['Indexes' , ST.Vector256, 1],
|
|
||||||
Hashes = ['Hashes' , ST.Vector256, 2],
|
|
||||||
TransactionMetaData = ['TransactionMetaData' , ST.Object, 2],
|
|
||||||
CreatedNode = ['CreatedNode' , ST.Object, 3],
|
|
||||||
DeletedNode = ['DeletedNode' , ST.Object, 4],
|
|
||||||
ModifiedNode = ['ModifiedNode' , ST.Object, 5],
|
|
||||||
PreviousFields = ['PreviousFields' , ST.Object, 6],
|
|
||||||
FinalFields = ['FinalFields' , ST.Object, 7],
|
|
||||||
NewFields = ['NewFields' , ST.Object, 8],
|
|
||||||
TemplateEntry = ['TemplateEntry' , ST.Object, 9],
|
|
||||||
SigningAccounts = ['SigningAccounts' , ST.Array, 2],
|
|
||||||
TxnSignatures = ['TxnSignatures' , ST.Array, 3],
|
|
||||||
Signatures = ['Signatures' , ST.Array, 4],
|
|
||||||
Template = ['Template' , ST.Array, 5],
|
|
||||||
Necessary = ['Necessary' , ST.Array, 6],
|
|
||||||
Sufficient = ['Sufficient' , ST.Array, 7],
|
|
||||||
AffectedNodes = ['AffectedNodes' , ST.Array, 8],
|
|
||||||
Features = ['Features' , ST.Array, 9],
|
|
||||||
|
|
||||||
base = [
|
var base = [
|
||||||
[ TransactionType , REQUIRED ],
|
[ 'TransactionType' , REQUIRED, 2, ST.Int16 ],
|
||||||
[ Flags , OPTIONAL ],
|
[ 'Flags' , OPTIONAL, 2, ST.Int32 ],
|
||||||
[ SourceTag , OPTIONAL ],
|
[ 'SourceTag' , OPTIONAL, 3, ST.Int32 ],
|
||||||
[ Account , REQUIRED ],
|
[ 'Account' , REQUIRED, 1, ST.Account ],
|
||||||
[ Sequence , REQUIRED ],
|
[ 'Sequence' , REQUIRED, 4, ST.Int32 ],
|
||||||
[ Fee , REQUIRED ],
|
[ 'Fee' , REQUIRED, 8, ST.Amount ],
|
||||||
[ OperationLimit , OPTIONAL ],
|
[ 'OperationLimit' , OPTIONAL, 29, ST.Int32 ],
|
||||||
[ SigningPubKey , REQUIRED ],
|
[ 'SigningPubKey' , REQUIRED, 3, ST.VariableLength ],
|
||||||
[ TxnSignature , OPTIONAL ]
|
[ 'TxnSignature' , OPTIONAL, 4, ST.VariableLength ]
|
||||||
];
|
];
|
||||||
|
|
||||||
exports.tx = {
|
exports.tx = {
|
||||||
AccountSet: [3].concat(base, [
|
AccountSet: [3].concat(base, [
|
||||||
[ EmailHash , OPTIONAL ],
|
[ 'EmailHash' , OPTIONAL, 1, ST.Hash128 ],
|
||||||
[ WalletLocator , OPTIONAL ],
|
[ 'WalletLocator' , OPTIONAL, 7, ST.Hash256 ],
|
||||||
[ WalletSize , OPTIONAL ],
|
[ 'WalletSize' , OPTIONAL, 12, ST.Int32 ],
|
||||||
[ MessageKey , OPTIONAL ],
|
[ 'MessageKey' , OPTIONAL, 2, ST.VariableLength ],
|
||||||
[ Domain , OPTIONAL ],
|
[ 'Domain' , OPTIONAL, 7, ST.VariableLength ],
|
||||||
[ TransferRate , OPTIONAL ]
|
[ 'TransferRate' , OPTIONAL, 11, ST.Int32 ]
|
||||||
],
|
]),
|
||||||
TrustSet: [20].concat(base, [
|
TrustSet: [20].concat(base, [
|
||||||
[ LimitAmount , OPTIONAL ],
|
[ 'LimitAmount' , OPTIONAL, 3, ST.Amount ],
|
||||||
[ QualityIn , OPTIONAL ],
|
[ 'QualityIn' , OPTIONAL, 20, ST.Int32 ],
|
||||||
[ QualityOut , OPTIONAL ]
|
[ 'QualityOut' , OPTIONAL, 21, ST.Int32 ]
|
||||||
],
|
]),
|
||||||
OfferCreate: [7].concat(base, [
|
OfferCreate: [7].concat(base, [
|
||||||
[ TakerPays , REQUIRED ],
|
[ 'TakerPays' , REQUIRED, 4, ST.Amount ],
|
||||||
[ TakerGets , REQUIRED ],
|
[ 'TakerGets' , REQUIRED, 5, ST.Amount ],
|
||||||
[ Expiration , OPTIONAL ]
|
[ 'Expiration' , OPTIONAL, 10, ST.Int32 ]
|
||||||
],
|
]),
|
||||||
OfferCancel: [8].concat(base, [
|
OfferCancel: [8].concat(base, [
|
||||||
[ OfferSequence , REQUIRED ]
|
[ 'OfferSequence' , REQUIRED, 25, ST.Int32 ]
|
||||||
],
|
]),
|
||||||
SetRegularKey: [5].concat(base, [
|
SetRegularKey: [5].concat(base, [
|
||||||
[ RegularKey , REQUIRED ]
|
[ 'RegularKey' , REQUIRED, 8, ST.Account ]
|
||||||
],
|
]),
|
||||||
Payment: [0].concat(base, [
|
Payment: [0].concat(base, [
|
||||||
[ Destination , REQUIRED ],
|
[ 'Destination' , REQUIRED, 3, ST.Account ],
|
||||||
[ Amount , REQUIRED ],
|
[ 'Amount' , REQUIRED, 1, ST.Amount ],
|
||||||
[ SendMax , OPTIONAL ],
|
[ 'SendMax' , OPTIONAL, 9, ST.Amount ],
|
||||||
[ Paths , DEFAULT ],
|
[ 'Paths' , DEFAULT , 1, ST.PathSet ],
|
||||||
[ InvoiceID , OPTIONAL ],
|
[ 'InvoiceID' , OPTIONAL, 17, ST.Hash256 ],
|
||||||
[ DestinationTag , OPTIONAL ]
|
[ 'DestinationTag' , OPTIONAL, 14, ST.Int32 ]
|
||||||
],
|
]),
|
||||||
Contract: [9].concat(base, [
|
Contract: [9].concat(base, [
|
||||||
[ Expiration , REQUIRED ],
|
[ 'Expiration' , REQUIRED, 10, ST.Int32 ],
|
||||||
[ BondAmount , REQUIRED ],
|
[ 'BondAmount' , REQUIRED, 23, ST.Int32 ],
|
||||||
[ StampEscrow , REQUIRED ],
|
[ 'StampEscrow' , REQUIRED, 22, ST.Int32 ],
|
||||||
[ RippleEscrow , REQUIRED ],
|
[ 'RippleEscrow' , REQUIRED, 17, ST.Amount ],
|
||||||
[ CreateCode , OPTIONAL ],
|
[ 'CreateCode' , OPTIONAL, 11, ST.VariableLength ],
|
||||||
[ FundCode , OPTIONAL ],
|
[ 'FundCode' , OPTIONAL, 8, ST.VariableLength ],
|
||||||
[ RemoveCode , OPTIONAL ],
|
[ 'RemoveCode' , OPTIONAL, 9, ST.VariableLength ],
|
||||||
[ ExpireCode , OPTIONAL ]
|
[ 'ExpireCode' , OPTIONAL, 10, ST.VariableLength ]
|
||||||
],
|
]),
|
||||||
RemoveContract: [10].concat(base, [
|
RemoveContract: [10].concat(base, [
|
||||||
[ Target , REQUIRED ]
|
[ 'Target' , REQUIRED, 7, ST.Account ]
|
||||||
],
|
]),
|
||||||
EnableFeature: [100].concat(base, [
|
EnableFeature: [100].concat(base, [
|
||||||
[ Feature , REQUIRED ]
|
[ 'Feature' , REQUIRED, 19, ST.Hash256 ]
|
||||||
],
|
]),
|
||||||
SetFee: [101].concat(base, [
|
SetFee: [101].concat(base, [
|
||||||
[ Features , REQUIRED ],
|
[ 'Features' , REQUIRED, 9, ST.Array ],
|
||||||
[ BaseFee , REQUIRED ],
|
[ 'BaseFee' , REQUIRED, 5, ST.Int64 ],
|
||||||
[ ReferenceFeeUnits , REQUIRED ],
|
[ 'ReferenceFeeUnits' , REQUIRED, 30, ST.Int32 ],
|
||||||
[ ReserveBase , REQUIRED ],
|
[ 'ReserveBase' , REQUIRED, 31, ST.Int32 ],
|
||||||
[ ReserveIncrement , REQUIRED ]
|
[ 'ReserveIncrement' , REQUIRED, 32, ST.Int32 ]
|
||||||
]
|
])
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user