xrpl 2.10.0 → 2.12.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/xrpl-latest-min.js +1 -1
- package/build/xrpl-latest-min.js.map +1 -1
- package/build/xrpl-latest.js +1308 -33
- package/build/xrpl-latest.js.map +1 -1
- package/dist/npm/Wallet/walletFromSecretNumbers.d.ts +7 -0
- package/dist/npm/Wallet/walletFromSecretNumbers.d.ts.map +1 -0
- package/dist/npm/Wallet/walletFromSecretNumbers.js +27 -0
- package/dist/npm/Wallet/walletFromSecretNumbers.js.map +1 -0
- package/dist/npm/client/index.d.ts +2 -1
- package/dist/npm/client/index.d.ts.map +1 -1
- package/dist/npm/client/index.js.map +1 -1
- package/dist/npm/index.d.ts +1 -0
- package/dist/npm/index.d.ts.map +1 -1
- package/dist/npm/index.js +3 -1
- package/dist/npm/index.js.map +1 -1
- package/dist/npm/models/common/index.d.ts +11 -0
- package/dist/npm/models/common/index.d.ts.map +1 -1
- package/dist/npm/models/ledger/AMM.d.ts +27 -0
- package/dist/npm/models/ledger/AMM.d.ts.map +1 -0
- package/dist/npm/models/ledger/AMM.js +3 -0
- package/dist/npm/models/ledger/AMM.js.map +1 -0
- package/dist/npm/models/ledger/AccountRoot.d.ts +2 -0
- package/dist/npm/models/ledger/AccountRoot.d.ts.map +1 -1
- package/dist/npm/models/ledger/AccountRoot.js +1 -0
- package/dist/npm/models/ledger/AccountRoot.js.map +1 -1
- package/dist/npm/models/ledger/Bridge.d.ts +17 -0
- package/dist/npm/models/ledger/Bridge.d.ts.map +1 -0
- package/dist/npm/models/ledger/Bridge.js +3 -0
- package/dist/npm/models/ledger/Bridge.js.map +1 -0
- package/dist/npm/models/ledger/LedgerEntry.d.ts +5 -1
- package/dist/npm/models/ledger/LedgerEntry.d.ts.map +1 -1
- package/dist/npm/models/ledger/XChainOwnedClaimID.d.ts +16 -0
- package/dist/npm/models/ledger/XChainOwnedClaimID.d.ts.map +1 -0
- package/dist/npm/models/ledger/XChainOwnedClaimID.js +3 -0
- package/dist/npm/models/ledger/XChainOwnedClaimID.js.map +1 -0
- package/dist/npm/models/ledger/XChainOwnedCreateAccountClaimID.d.ts +14 -0
- package/dist/npm/models/ledger/XChainOwnedCreateAccountClaimID.d.ts.map +1 -0
- package/dist/npm/models/ledger/XChainOwnedCreateAccountClaimID.js +3 -0
- package/dist/npm/models/ledger/XChainOwnedCreateAccountClaimID.js.map +1 -0
- package/dist/npm/models/ledger/index.d.ts +4 -1
- package/dist/npm/models/ledger/index.d.ts.map +1 -1
- package/dist/npm/models/ledger/index.js.map +1 -1
- package/dist/npm/models/methods/accountObjects.d.ts +3 -3
- package/dist/npm/models/methods/accountObjects.d.ts.map +1 -1
- package/dist/npm/models/methods/ammInfo.d.ts +39 -0
- package/dist/npm/models/methods/ammInfo.d.ts.map +1 -0
- package/dist/npm/models/methods/ammInfo.js +3 -0
- package/dist/npm/models/methods/ammInfo.js.map +1 -0
- package/dist/npm/models/methods/index.d.ts +4 -3
- package/dist/npm/models/methods/index.d.ts.map +1 -1
- package/dist/npm/models/methods/ledgerEntry.d.ts +27 -0
- package/dist/npm/models/methods/ledgerEntry.d.ts.map +1 -1
- package/dist/npm/models/transactions/AMMBid.d.ts +12 -0
- package/dist/npm/models/transactions/AMMBid.d.ts.map +1 -0
- package/dist/npm/models/transactions/AMMBid.js +56 -0
- package/dist/npm/models/transactions/AMMBid.js.map +1 -0
- package/dist/npm/models/transactions/AMMCreate.d.ts +11 -0
- package/dist/npm/models/transactions/AMMCreate.d.ts.map +1 -0
- package/dist/npm/models/transactions/AMMCreate.js +32 -0
- package/dist/npm/models/transactions/AMMCreate.js.map +1 -0
- package/dist/npm/models/transactions/AMMDelete.d.ts +9 -0
- package/dist/npm/models/transactions/AMMDelete.d.ts.map +1 -0
- package/dist/npm/models/transactions/AMMDelete.js +22 -0
- package/dist/npm/models/transactions/AMMDelete.js.map +1 -0
- package/dist/npm/models/transactions/AMMDeposit.d.ts +27 -0
- package/dist/npm/models/transactions/AMMDeposit.d.ts.map +1 -0
- package/dist/npm/models/transactions/AMMDeposit.js +51 -0
- package/dist/npm/models/transactions/AMMDeposit.js.map +1 -0
- package/dist/npm/models/transactions/AMMVote.d.ts +10 -0
- package/dist/npm/models/transactions/AMMVote.d.ts.map +1 -0
- package/dist/npm/models/transactions/AMMVote.js +32 -0
- package/dist/npm/models/transactions/AMMVote.js.map +1 -0
- package/dist/npm/models/transactions/AMMWithdraw.d.ts +31 -0
- package/dist/npm/models/transactions/AMMWithdraw.d.ts.map +1 -0
- package/dist/npm/models/transactions/AMMWithdraw.js +50 -0
- package/dist/npm/models/transactions/AMMWithdraw.js.map +1 -0
- package/dist/npm/models/transactions/XChainAccountCreateCommit.d.ts +11 -0
- package/dist/npm/models/transactions/XChainAccountCreateCommit.d.ts.map +1 -0
- package/dist/npm/models/transactions/XChainAccountCreateCommit.js +35 -0
- package/dist/npm/models/transactions/XChainAccountCreateCommit.js.map +1 -0
- package/dist/npm/models/transactions/XChainAddAccountCreateAttestation.d.ts +18 -0
- package/dist/npm/models/transactions/XChainAddAccountCreateAttestation.d.ts.map +1 -0
- package/dist/npm/models/transactions/XChainAddAccountCreateAttestation.js +77 -0
- package/dist/npm/models/transactions/XChainAddAccountCreateAttestation.js.map +1 -0
- package/dist/npm/models/transactions/XChainAddClaimAttestation.d.ts +17 -0
- package/dist/npm/models/transactions/XChainAddClaimAttestation.d.ts.map +1 -0
- package/dist/npm/models/transactions/XChainAddClaimAttestation.js +68 -0
- package/dist/npm/models/transactions/XChainAddClaimAttestation.js.map +1 -0
- package/dist/npm/models/transactions/XChainClaim.d.ts +12 -0
- package/dist/npm/models/transactions/XChainClaim.d.ts.map +1 -0
- package/dist/npm/models/transactions/XChainClaim.js +39 -0
- package/dist/npm/models/transactions/XChainClaim.js.map +1 -0
- package/dist/npm/models/transactions/XChainCommit.d.ts +11 -0
- package/dist/npm/models/transactions/XChainCommit.d.ts.map +1 -0
- package/dist/npm/models/transactions/XChainCommit.js +33 -0
- package/dist/npm/models/transactions/XChainCommit.js.map +1 -0
- package/dist/npm/models/transactions/XChainCreateBridge.d.ts +10 -0
- package/dist/npm/models/transactions/XChainCreateBridge.d.ts.map +1 -0
- package/dist/npm/models/transactions/XChainCreateBridge.js +26 -0
- package/dist/npm/models/transactions/XChainCreateBridge.js.map +1 -0
- package/dist/npm/models/transactions/XChainCreateClaimID.d.ts +10 -0
- package/dist/npm/models/transactions/XChainCreateClaimID.d.ts.map +1 -0
- package/dist/npm/models/transactions/XChainCreateClaimID.js +28 -0
- package/dist/npm/models/transactions/XChainCreateClaimID.js.map +1 -0
- package/dist/npm/models/transactions/XChainModifyBridge.d.ts +17 -0
- package/dist/npm/models/transactions/XChainModifyBridge.d.ts.map +1 -0
- package/dist/npm/models/transactions/XChainModifyBridge.js +27 -0
- package/dist/npm/models/transactions/XChainModifyBridge.js.map +1 -0
- package/dist/npm/models/transactions/common.d.ts +3 -1
- package/dist/npm/models/transactions/common.d.ts.map +1 -1
- package/dist/npm/models/transactions/common.js +22 -1
- package/dist/npm/models/transactions/common.js.map +1 -1
- package/dist/npm/models/transactions/index.d.ts +15 -1
- package/dist/npm/models/transactions/index.d.ts.map +1 -1
- package/dist/npm/models/transactions/index.js +7 -1
- package/dist/npm/models/transactions/index.js.map +1 -1
- package/dist/npm/models/transactions/transaction.d.ts +15 -1
- package/dist/npm/models/transactions/transaction.d.ts.map +1 -1
- package/dist/npm/models/transactions/transaction.js +56 -0
- package/dist/npm/models/transactions/transaction.js.map +1 -1
- package/dist/npm/models/utils/flags.d.ts.map +1 -1
- package/dist/npm/models/utils/flags.js +18 -21
- package/dist/npm/models/utils/flags.js.map +1 -1
- package/dist/npm/snippets/src/bridgeTransfer.d.ts +2 -0
- package/dist/npm/snippets/src/bridgeTransfer.d.ts.map +1 -0
- package/dist/npm/snippets/src/bridgeTransfer.js +124 -0
- package/dist/npm/snippets/src/bridgeTransfer.js.map +1 -0
- package/dist/npm/snippets/tsconfig.tsbuildinfo +1 -1
- package/dist/npm/src/Wallet/walletFromSecretNumbers.d.ts +7 -0
- package/dist/npm/src/Wallet/walletFromSecretNumbers.d.ts.map +1 -0
- package/dist/npm/src/Wallet/walletFromSecretNumbers.js +27 -0
- package/dist/npm/src/Wallet/walletFromSecretNumbers.js.map +1 -0
- package/dist/npm/src/client/index.d.ts +2 -1
- package/dist/npm/src/client/index.d.ts.map +1 -1
- package/dist/npm/src/client/index.js.map +1 -1
- package/dist/npm/src/index.d.ts +1 -0
- package/dist/npm/src/index.d.ts.map +1 -1
- package/dist/npm/src/index.js +3 -1
- package/dist/npm/src/index.js.map +1 -1
- package/dist/npm/src/models/common/index.d.ts +11 -0
- package/dist/npm/src/models/common/index.d.ts.map +1 -1
- package/dist/npm/src/models/ledger/AMM.d.ts +27 -0
- package/dist/npm/src/models/ledger/AMM.d.ts.map +1 -0
- package/dist/npm/src/models/ledger/AMM.js +3 -0
- package/dist/npm/src/models/ledger/AMM.js.map +1 -0
- package/dist/npm/src/models/ledger/AccountRoot.d.ts +2 -0
- package/dist/npm/src/models/ledger/AccountRoot.d.ts.map +1 -1
- package/dist/npm/src/models/ledger/AccountRoot.js +1 -0
- package/dist/npm/src/models/ledger/AccountRoot.js.map +1 -1
- package/dist/npm/src/models/ledger/Bridge.d.ts +17 -0
- package/dist/npm/src/models/ledger/Bridge.d.ts.map +1 -0
- package/dist/npm/src/models/ledger/Bridge.js +3 -0
- package/dist/npm/src/models/ledger/Bridge.js.map +1 -0
- package/dist/npm/src/models/ledger/LedgerEntry.d.ts +5 -1
- package/dist/npm/src/models/ledger/LedgerEntry.d.ts.map +1 -1
- package/dist/npm/src/models/ledger/XChainOwnedClaimID.d.ts +16 -0
- package/dist/npm/src/models/ledger/XChainOwnedClaimID.d.ts.map +1 -0
- package/dist/npm/src/models/ledger/XChainOwnedClaimID.js +3 -0
- package/dist/npm/src/models/ledger/XChainOwnedClaimID.js.map +1 -0
- package/dist/npm/src/models/ledger/XChainOwnedCreateAccountClaimID.d.ts +14 -0
- package/dist/npm/src/models/ledger/XChainOwnedCreateAccountClaimID.d.ts.map +1 -0
- package/dist/npm/src/models/ledger/XChainOwnedCreateAccountClaimID.js +3 -0
- package/dist/npm/src/models/ledger/XChainOwnedCreateAccountClaimID.js.map +1 -0
- package/dist/npm/src/models/ledger/index.d.ts +4 -1
- package/dist/npm/src/models/ledger/index.d.ts.map +1 -1
- package/dist/npm/src/models/ledger/index.js.map +1 -1
- package/dist/npm/src/models/methods/accountObjects.d.ts +3 -3
- package/dist/npm/src/models/methods/accountObjects.d.ts.map +1 -1
- package/dist/npm/src/models/methods/ammInfo.d.ts +39 -0
- package/dist/npm/src/models/methods/ammInfo.d.ts.map +1 -0
- package/dist/npm/src/models/methods/ammInfo.js +3 -0
- package/dist/npm/src/models/methods/ammInfo.js.map +1 -0
- package/dist/npm/src/models/methods/index.d.ts +4 -3
- package/dist/npm/src/models/methods/index.d.ts.map +1 -1
- package/dist/npm/src/models/methods/ledgerEntry.d.ts +27 -0
- package/dist/npm/src/models/methods/ledgerEntry.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/AMMBid.d.ts +12 -0
- package/dist/npm/src/models/transactions/AMMBid.d.ts.map +1 -0
- package/dist/npm/src/models/transactions/AMMBid.js +56 -0
- package/dist/npm/src/models/transactions/AMMBid.js.map +1 -0
- package/dist/npm/src/models/transactions/AMMCreate.d.ts +11 -0
- package/dist/npm/src/models/transactions/AMMCreate.d.ts.map +1 -0
- package/dist/npm/src/models/transactions/AMMCreate.js +32 -0
- package/dist/npm/src/models/transactions/AMMCreate.js.map +1 -0
- package/dist/npm/src/models/transactions/AMMDelete.d.ts +9 -0
- package/dist/npm/src/models/transactions/AMMDelete.d.ts.map +1 -0
- package/dist/npm/src/models/transactions/AMMDelete.js +22 -0
- package/dist/npm/src/models/transactions/AMMDelete.js.map +1 -0
- package/dist/npm/src/models/transactions/AMMDeposit.d.ts +27 -0
- package/dist/npm/src/models/transactions/AMMDeposit.d.ts.map +1 -0
- package/dist/npm/src/models/transactions/AMMDeposit.js +51 -0
- package/dist/npm/src/models/transactions/AMMDeposit.js.map +1 -0
- package/dist/npm/src/models/transactions/AMMVote.d.ts +10 -0
- package/dist/npm/src/models/transactions/AMMVote.d.ts.map +1 -0
- package/dist/npm/src/models/transactions/AMMVote.js +32 -0
- package/dist/npm/src/models/transactions/AMMVote.js.map +1 -0
- package/dist/npm/src/models/transactions/AMMWithdraw.d.ts +31 -0
- package/dist/npm/src/models/transactions/AMMWithdraw.d.ts.map +1 -0
- package/dist/npm/src/models/transactions/AMMWithdraw.js +50 -0
- package/dist/npm/src/models/transactions/AMMWithdraw.js.map +1 -0
- package/dist/npm/src/models/transactions/XChainAccountCreateCommit.d.ts +11 -0
- package/dist/npm/src/models/transactions/XChainAccountCreateCommit.d.ts.map +1 -0
- package/dist/npm/src/models/transactions/XChainAccountCreateCommit.js +35 -0
- package/dist/npm/src/models/transactions/XChainAccountCreateCommit.js.map +1 -0
- package/dist/npm/src/models/transactions/XChainAddAccountCreateAttestation.d.ts +18 -0
- package/dist/npm/src/models/transactions/XChainAddAccountCreateAttestation.d.ts.map +1 -0
- package/dist/npm/src/models/transactions/XChainAddAccountCreateAttestation.js +77 -0
- package/dist/npm/src/models/transactions/XChainAddAccountCreateAttestation.js.map +1 -0
- package/dist/npm/src/models/transactions/XChainAddClaimAttestation.d.ts +17 -0
- package/dist/npm/src/models/transactions/XChainAddClaimAttestation.d.ts.map +1 -0
- package/dist/npm/src/models/transactions/XChainAddClaimAttestation.js +68 -0
- package/dist/npm/src/models/transactions/XChainAddClaimAttestation.js.map +1 -0
- package/dist/npm/src/models/transactions/XChainClaim.d.ts +12 -0
- package/dist/npm/src/models/transactions/XChainClaim.d.ts.map +1 -0
- package/dist/npm/src/models/transactions/XChainClaim.js +39 -0
- package/dist/npm/src/models/transactions/XChainClaim.js.map +1 -0
- package/dist/npm/src/models/transactions/XChainCommit.d.ts +11 -0
- package/dist/npm/src/models/transactions/XChainCommit.d.ts.map +1 -0
- package/dist/npm/src/models/transactions/XChainCommit.js +33 -0
- package/dist/npm/src/models/transactions/XChainCommit.js.map +1 -0
- package/dist/npm/src/models/transactions/XChainCreateBridge.d.ts +10 -0
- package/dist/npm/src/models/transactions/XChainCreateBridge.d.ts.map +1 -0
- package/dist/npm/src/models/transactions/XChainCreateBridge.js +26 -0
- package/dist/npm/src/models/transactions/XChainCreateBridge.js.map +1 -0
- package/dist/npm/src/models/transactions/XChainCreateClaimID.d.ts +10 -0
- package/dist/npm/src/models/transactions/XChainCreateClaimID.d.ts.map +1 -0
- package/dist/npm/src/models/transactions/XChainCreateClaimID.js +28 -0
- package/dist/npm/src/models/transactions/XChainCreateClaimID.js.map +1 -0
- package/dist/npm/src/models/transactions/XChainModifyBridge.d.ts +17 -0
- package/dist/npm/src/models/transactions/XChainModifyBridge.d.ts.map +1 -0
- package/dist/npm/src/models/transactions/XChainModifyBridge.js +27 -0
- package/dist/npm/src/models/transactions/XChainModifyBridge.js.map +1 -0
- package/dist/npm/src/models/transactions/common.d.ts +3 -1
- package/dist/npm/src/models/transactions/common.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/common.js +22 -1
- package/dist/npm/src/models/transactions/common.js.map +1 -1
- package/dist/npm/src/models/transactions/index.d.ts +15 -1
- package/dist/npm/src/models/transactions/index.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/index.js +7 -1
- package/dist/npm/src/models/transactions/index.js.map +1 -1
- package/dist/npm/src/models/transactions/transaction.d.ts +15 -1
- package/dist/npm/src/models/transactions/transaction.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/transaction.js +56 -0
- package/dist/npm/src/models/transactions/transaction.js.map +1 -1
- package/dist/npm/src/models/utils/flags.d.ts.map +1 -1
- package/dist/npm/src/models/utils/flags.js +18 -21
- package/dist/npm/src/models/utils/flags.js.map +1 -1
- package/dist/npm/src/sugar/autofill.d.ts.map +1 -1
- package/dist/npm/src/sugar/autofill.js +4 -3
- package/dist/npm/src/sugar/autofill.js.map +1 -1
- package/dist/npm/sugar/autofill.d.ts.map +1 -1
- package/dist/npm/sugar/autofill.js +4 -3
- package/dist/npm/sugar/autofill.js.map +1 -1
- package/package.json +8 -6
- package/src/ECDSA.ts +6 -0
- package/src/Wallet/defaultFaucets.ts +82 -0
- package/src/Wallet/fundWallet.ts +344 -0
- package/src/Wallet/index.ts +504 -0
- package/src/Wallet/rfc1751.ts +190 -0
- package/src/Wallet/rfc1751Words.json +243 -0
- package/src/Wallet/signer.ts +173 -0
- package/src/Wallet/walletFromSecretNumbers.ts +37 -0
- package/src/client/BroadcastClient.ts +84 -0
- package/src/client/ConnectionManager.ts +40 -0
- package/src/client/ExponentialBackoff.ts +71 -0
- package/src/client/RequestManager.ts +194 -0
- package/src/client/WSWrapper.ts +106 -0
- package/src/client/connection.ts +593 -0
- package/src/client/index.ts +712 -0
- package/src/client/partialPayment.ts +153 -0
- package/src/errors.ts +161 -0
- package/src/index.ts +20 -0
- package/src/models/common/index.ts +156 -0
- package/src/models/index.ts +16 -0
- package/src/models/ledger/AMM.ts +78 -0
- package/src/models/ledger/AccountRoot.ts +217 -0
- package/src/models/ledger/Amendments.ts +45 -0
- package/src/models/ledger/BaseLedgerEntry.ts +3 -0
- package/src/models/ledger/Bridge.ts +84 -0
- package/src/models/ledger/Check.ts +70 -0
- package/src/models/ledger/DepositPreauth.ts +35 -0
- package/src/models/ledger/DirectoryNode.ts +46 -0
- package/src/models/ledger/Escrow.ts +74 -0
- package/src/models/ledger/FeeSettings.ts +52 -0
- package/src/models/ledger/Ledger.ts +65 -0
- package/src/models/ledger/LedgerEntry.ts +40 -0
- package/src/models/ledger/LedgerHashes.ts +24 -0
- package/src/models/ledger/NFTokenOffer.ts +16 -0
- package/src/models/ledger/NFTokenPage.ts +20 -0
- package/src/models/ledger/NegativeUNL.ts +34 -0
- package/src/models/ledger/Offer.ts +52 -0
- package/src/models/ledger/PayChannel.ts +107 -0
- package/src/models/ledger/RippleState.ts +88 -0
- package/src/models/ledger/SignerList.ts +56 -0
- package/src/models/ledger/Ticket.ts +36 -0
- package/src/models/ledger/XChainOwnedClaimID.ts +73 -0
- package/src/models/ledger/XChainOwnedCreateAccountClaimID.ts +60 -0
- package/src/models/ledger/index.ts +64 -0
- package/src/models/methods/accountChannels.ts +93 -0
- package/src/models/methods/accountCurrencies.ts +45 -0
- package/src/models/methods/accountInfo.ts +182 -0
- package/src/models/methods/accountLines.ts +137 -0
- package/src/models/methods/accountNFTs.ts +72 -0
- package/src/models/methods/accountObjects.ts +129 -0
- package/src/models/methods/accountOffers.ts +100 -0
- package/src/models/methods/accountTx.ts +109 -0
- package/src/models/methods/ammInfo.ts +145 -0
- package/src/models/methods/baseMethod.ts +58 -0
- package/src/models/methods/bookOffers.ts +96 -0
- package/src/models/methods/channelVerify.ts +41 -0
- package/src/models/methods/depositAuthorized.ts +56 -0
- package/src/models/methods/fee.ts +91 -0
- package/src/models/methods/gatewayBalances.ts +85 -0
- package/src/models/methods/index.ts +391 -0
- package/src/models/methods/ledger.ts +125 -0
- package/src/models/methods/ledgerClosed.ts +32 -0
- package/src/models/methods/ledgerCurrent.ts +31 -0
- package/src/models/methods/ledgerData.ts +78 -0
- package/src/models/methods/ledgerEntry.ts +202 -0
- package/src/models/methods/manifest.ts +54 -0
- package/src/models/methods/nftBuyOffers.ts +37 -0
- package/src/models/methods/nftHistory.ts +113 -0
- package/src/models/methods/nftInfo.ts +25 -0
- package/src/models/methods/nftSellOffers.ts +37 -0
- package/src/models/methods/norippleCheck.ts +82 -0
- package/src/models/methods/pathFind.ts +116 -0
- package/src/models/methods/ping.ts +21 -0
- package/src/models/methods/random.ts +23 -0
- package/src/models/methods/ripplePathFind.ts +81 -0
- package/src/models/methods/serverInfo.ts +257 -0
- package/src/models/methods/serverState.ts +77 -0
- package/src/models/methods/submit.ts +94 -0
- package/src/models/methods/submitMultisigned.ts +51 -0
- package/src/models/methods/subscribe.ts +435 -0
- package/src/models/methods/transactionEntry.ts +47 -0
- package/src/models/methods/tx.ts +69 -0
- package/src/models/methods/unsubscribe.ts +49 -0
- package/src/models/transactions/AMMBid.ts +140 -0
- package/src/models/transactions/AMMCreate.ts +80 -0
- package/src/models/transactions/AMMDelete.ts +55 -0
- package/src/models/transactions/AMMDeposit.ts +130 -0
- package/src/models/transactions/AMMVote.ts +71 -0
- package/src/models/transactions/AMMWithdraw.ts +126 -0
- package/src/models/transactions/NFTokenAcceptOffer.ts +104 -0
- package/src/models/transactions/NFTokenBurn.ts +48 -0
- package/src/models/transactions/NFTokenCancelOffer.ts +45 -0
- package/src/models/transactions/NFTokenCreateOffer.ts +145 -0
- package/src/models/transactions/NFTokenMint.ts +123 -0
- package/src/models/transactions/UNLModify.ts +20 -0
- package/src/models/transactions/XChainAccountCreateCommit.ts +107 -0
- package/src/models/transactions/XChainAddAccountCreateAttestation.ts +225 -0
- package/src/models/transactions/XChainAddClaimAttestation.ts +198 -0
- package/src/models/transactions/XChainClaim.ts +103 -0
- package/src/models/transactions/XChainCommit.ts +95 -0
- package/src/models/transactions/XChainCreateBridge.ts +78 -0
- package/src/models/transactions/XChainCreateClaimID.ts +78 -0
- package/src/models/transactions/XChainModifyBridge.ts +93 -0
- package/src/models/transactions/accountDelete.ts +50 -0
- package/src/models/transactions/accountSet.ts +228 -0
- package/src/models/transactions/checkCancel.ts +34 -0
- package/src/models/transactions/checkCash.ts +73 -0
- package/src/models/transactions/checkCreate.ts +90 -0
- package/src/models/transactions/clawback.ts +49 -0
- package/src/models/transactions/common.ts +320 -0
- package/src/models/transactions/depositPreauth.ts +68 -0
- package/src/models/transactions/enableAmendment.ts +26 -0
- package/src/models/transactions/escrowCancel.ts +45 -0
- package/src/models/transactions/escrowCreate.ts +100 -0
- package/src/models/transactions/escrowFinish.ts +63 -0
- package/src/models/transactions/index.ts +78 -0
- package/src/models/transactions/metadata.ts +69 -0
- package/src/models/transactions/offerCancel.ts +37 -0
- package/src/models/transactions/offerCreate.ts +144 -0
- package/src/models/transactions/payment.ts +278 -0
- package/src/models/transactions/paymentChannelClaim.ts +165 -0
- package/src/models/transactions/paymentChannelCreate.ts +116 -0
- package/src/models/transactions/paymentChannelFund.ts +65 -0
- package/src/models/transactions/setFee.ts +48 -0
- package/src/models/transactions/setRegularKey.ts +33 -0
- package/src/models/transactions/signerListSet.ts +89 -0
- package/src/models/transactions/ticketCreate.ts +50 -0
- package/src/models/transactions/transaction.ts +370 -0
- package/src/models/transactions/trustSet.ts +146 -0
- package/src/models/utils/flags.ts +103 -0
- package/src/models/utils/index.ts +37 -0
- package/src/sugar/autofill.ts +373 -0
- package/src/sugar/balances.ts +123 -0
- package/src/sugar/getFeeXrp.ts +45 -0
- package/src/sugar/getLedgerIndex.ts +15 -0
- package/src/sugar/getOrderbook.ts +152 -0
- package/src/sugar/index.ts +11 -0
- package/src/sugar/submit.ts +305 -0
- package/src/sugar/utils.ts +29 -0
- package/src/utils/derive.ts +23 -0
- package/src/utils/getBalanceChanges.ts +186 -0
- package/src/utils/getNFTokenID.ts +97 -0
- package/src/utils/hashes/HashPrefix.ts +40 -0
- package/src/utils/hashes/README.md +65 -0
- package/src/utils/hashes/SHAMap/InnerNode.ts +124 -0
- package/src/utils/hashes/SHAMap/LeafNode.ts +69 -0
- package/src/utils/hashes/SHAMap/index.ts +41 -0
- package/src/utils/hashes/SHAMap/node.ts +14 -0
- package/src/utils/hashes/hashLedger.ts +236 -0
- package/src/utils/hashes/index.ts +187 -0
- package/src/utils/hashes/ledgerSpaces.ts +34 -0
- package/src/utils/hashes/sha512Half.ts +19 -0
- package/src/utils/index.ts +223 -0
- package/src/utils/parseNFTokenID.ts +84 -0
- package/src/utils/quality.ts +169 -0
- package/src/utils/signPaymentChannelClaim.ts +27 -0
- package/src/utils/stringConversion.ts +27 -0
- package/src/utils/timeConversion.ts +53 -0
- package/src/utils/verifyPaymentChannelClaim.ts +30 -0
- package/src/utils/xrpConversion.ts +104 -0
@@ -0,0 +1,165 @@
|
|
1
|
+
/* eslint-disable complexity -- Necessary for validatePaymentChannelClaim */
|
2
|
+
import { ValidationError } from '../../errors'
|
3
|
+
|
4
|
+
import { BaseTransaction, GlobalFlags, validateBaseTransaction } from './common'
|
5
|
+
|
6
|
+
/**
|
7
|
+
* Enum representing values for PaymentChannelClaim transaction flags.
|
8
|
+
*
|
9
|
+
* @category Transaction Flags
|
10
|
+
*/
|
11
|
+
export enum PaymentChannelClaimFlags {
|
12
|
+
/**
|
13
|
+
* Clear the channel's Expiration time. (Expiration is different from the
|
14
|
+
* channel's immutable CancelAfter time.) Only the source address of the
|
15
|
+
* payment channel can use this flag.
|
16
|
+
*/
|
17
|
+
tfRenew = 0x00010000,
|
18
|
+
/**
|
19
|
+
* Request to close the channel. Only the channel source and destination
|
20
|
+
* addresses can use this flag. This flag closes the channel immediately if it
|
21
|
+
* has no more XRP allocated to it after processing the current claim, or if
|
22
|
+
* the destination address uses it. If the source address uses this flag when
|
23
|
+
* the channel still holds XRP, this schedules the channel to close after
|
24
|
+
* SettleDelay seconds have passed. (Specifically, this sets the Expiration of
|
25
|
+
* the channel to the close time of the previous ledger plus the channel's
|
26
|
+
* SettleDelay time, unless the channel already has an earlier Expiration
|
27
|
+
* time.) If the destination address uses this flag when the channel still
|
28
|
+
* holds XRP, any XRP that remains after processing the claim is returned to
|
29
|
+
* the source address.
|
30
|
+
*/
|
31
|
+
tfClose = 0x00020000,
|
32
|
+
}
|
33
|
+
|
34
|
+
/**
|
35
|
+
* Map of flags to boolean values representing {@link PaymentChannelClaim}
|
36
|
+
* transaction flags.
|
37
|
+
*
|
38
|
+
* @category Transaction Flags
|
39
|
+
*
|
40
|
+
* @example
|
41
|
+
* ```typescript
|
42
|
+
* const paymentChannelClaim: PaymentChannelClaim = {
|
43
|
+
* Account: 'rMpxZpuy5RBSP47oK2hDWUtk3B5BNQHfGj,
|
44
|
+
* TransactionType: 'PaymentChannelClaim',
|
45
|
+
* Channel: hashes.hashPaymentChannel(
|
46
|
+
* 'rMpxZpuy5RBSP47oK2hDWUtk3B5BNQHfGj',
|
47
|
+
* 'rQGYqiyH5Ue9J96p4E6Qt6AvqxK4sDhnS5',
|
48
|
+
* 21970712,
|
49
|
+
* ),
|
50
|
+
* Amount: '100',
|
51
|
+
* Flags: {
|
52
|
+
* tfClose: true
|
53
|
+
* }
|
54
|
+
*}
|
55
|
+
*
|
56
|
+
* // Autofill the tx to see how flags actually look compared to the interface usage.
|
57
|
+
* const autofilledTx = await client.autofill(paymentChannelClaim)
|
58
|
+
* console.log(autofilledTx)
|
59
|
+
* // {
|
60
|
+
* // Account: 'rMpxZpuy5RBSP47oK2hDWUtk3B5BNQHfGj',
|
61
|
+
* // TransactionType: 'PaymentChannelClaim',
|
62
|
+
* // Channel: 'FC14BF9245D731DC1749EE0F070765E4EB4E993F8ECEE3D00F7E6E26D6EF98CF',
|
63
|
+
* // Amount: '100',
|
64
|
+
* // Flags: 131072,
|
65
|
+
* // Sequence: 21970713,
|
66
|
+
* // Fee: '12',
|
67
|
+
* // LastLedgerSequence: 21970658
|
68
|
+
* // }
|
69
|
+
* ```
|
70
|
+
*/
|
71
|
+
export interface PaymentChannelClaimFlagsInterface extends GlobalFlags {
|
72
|
+
/**
|
73
|
+
* Clear the channel's Expiration time. (Expiration is different from the
|
74
|
+
* channel's immutable CancelAfter time.) Only the source address of the
|
75
|
+
* payment channel can use this flag.
|
76
|
+
*/
|
77
|
+
tfRenew?: boolean
|
78
|
+
/**
|
79
|
+
* Request to close the channel. Only the channel source and destination
|
80
|
+
* addresses can use this flag. This flag closes the channel immediately if it
|
81
|
+
* has no more XRP allocated to it after processing the current claim, or if
|
82
|
+
* the destination address uses it. If the source address uses this flag when
|
83
|
+
* the channel still holds XRP, this schedules the channel to close after
|
84
|
+
* SettleDelay seconds have passed. (Specifically, this sets the Expiration of
|
85
|
+
* the channel to the close time of the previous ledger plus the channel's
|
86
|
+
* SettleDelay time, unless the channel already has an earlier Expiration
|
87
|
+
* time.) If the destination address uses this flag when the channel still
|
88
|
+
* holds XRP, any XRP that remains after processing the claim is returned to
|
89
|
+
* the source address.
|
90
|
+
*/
|
91
|
+
tfClose?: boolean
|
92
|
+
}
|
93
|
+
|
94
|
+
/**
|
95
|
+
* Claim XRP from a payment channel, adjust the payment channel's expiration,
|
96
|
+
* or both.
|
97
|
+
*
|
98
|
+
* @category Transaction Models
|
99
|
+
*/
|
100
|
+
export interface PaymentChannelClaim extends BaseTransaction {
|
101
|
+
TransactionType: 'PaymentChannelClaim'
|
102
|
+
Flags?: number | PaymentChannelClaimFlagsInterface
|
103
|
+
/** The unique ID of the channel as a 64-character hexadecimal string. */
|
104
|
+
Channel: string
|
105
|
+
/**
|
106
|
+
* Total amount of XRP, in drops, delivered by this channel after processing
|
107
|
+
* this claim. Required to deliver XRP. Must be more than the total amount
|
108
|
+
* delivered by the channel so far, but not greater than the Amount of the
|
109
|
+
* signed claim. Must be provided except when closing the channel.
|
110
|
+
*/
|
111
|
+
Balance?: string
|
112
|
+
/**
|
113
|
+
* The amount of XRP, in drops, authorized by the Signature. This must match
|
114
|
+
* the amount in the signed message. This is the cumulative amount of XRP that
|
115
|
+
* can be dispensed by the channel, including XRP previously redeemed.
|
116
|
+
*/
|
117
|
+
Amount?: string
|
118
|
+
/**
|
119
|
+
* The signature of this claim, as hexadecimal. The signed message contains
|
120
|
+
* the channel ID and the amount of the claim. Required unless the sender of
|
121
|
+
* the transaction is the source address of the channel.
|
122
|
+
*/
|
123
|
+
Signature?: string
|
124
|
+
/**
|
125
|
+
* The public key used for the signature, as hexadecimal. This must match the
|
126
|
+
* PublicKey stored in the ledger for the channel. Required unless the sender
|
127
|
+
* of the transaction is the source address of the channel and the Signature
|
128
|
+
* field is omitted.
|
129
|
+
*/
|
130
|
+
PublicKey?: string
|
131
|
+
}
|
132
|
+
|
133
|
+
/**
|
134
|
+
* Verify the form and type of an PaymentChannelClaim at runtime.
|
135
|
+
*
|
136
|
+
* @param tx - An PaymentChannelClaim Transaction.
|
137
|
+
* @throws When the PaymentChannelClaim is Malformed.
|
138
|
+
*/
|
139
|
+
export function validatePaymentChannelClaim(tx: Record<string, unknown>): void {
|
140
|
+
validateBaseTransaction(tx)
|
141
|
+
|
142
|
+
if (tx.Channel === undefined) {
|
143
|
+
throw new ValidationError('PaymentChannelClaim: missing Channel')
|
144
|
+
}
|
145
|
+
|
146
|
+
if (typeof tx.Channel !== 'string') {
|
147
|
+
throw new ValidationError('PaymentChannelClaim: Channel must be a string')
|
148
|
+
}
|
149
|
+
|
150
|
+
if (tx.Balance !== undefined && typeof tx.Balance !== 'string') {
|
151
|
+
throw new ValidationError('PaymentChannelClaim: Balance must be a string')
|
152
|
+
}
|
153
|
+
|
154
|
+
if (tx.Amount !== undefined && typeof tx.Amount !== 'string') {
|
155
|
+
throw new ValidationError('PaymentChannelClaim: Amount must be a string')
|
156
|
+
}
|
157
|
+
|
158
|
+
if (tx.Signature !== undefined && typeof tx.Signature !== 'string') {
|
159
|
+
throw new ValidationError('PaymentChannelClaim: Signature must be a string')
|
160
|
+
}
|
161
|
+
|
162
|
+
if (tx.PublicKey !== undefined && typeof tx.PublicKey !== 'string') {
|
163
|
+
throw new ValidationError('PaymentChannelClaim: PublicKey must be a string')
|
164
|
+
}
|
165
|
+
}
|
@@ -0,0 +1,116 @@
|
|
1
|
+
/* eslint-disable complexity -- Necessary for validatePaymentChannelCreate */
|
2
|
+
import { ValidationError } from '../../errors'
|
3
|
+
|
4
|
+
import { BaseTransaction, validateBaseTransaction } from './common'
|
5
|
+
|
6
|
+
/**
|
7
|
+
* Create a unidirectional channel and fund it with XRP. The address sending
|
8
|
+
* this transaction becomes the "source address" of the payment channel.
|
9
|
+
*
|
10
|
+
* @category Transaction Models
|
11
|
+
*/
|
12
|
+
export interface PaymentChannelCreate extends BaseTransaction {
|
13
|
+
TransactionType: 'PaymentChannelCreate'
|
14
|
+
/**
|
15
|
+
* Amount of XRP, in drops, to deduct from the sender's balance and set aside
|
16
|
+
* in this channel. While the channel is open, the XRP can only go to the
|
17
|
+
* Destination address. When the channel closes, any unclaimed XRP is returned
|
18
|
+
* to the source address's balance.
|
19
|
+
*/
|
20
|
+
Amount: string
|
21
|
+
/**
|
22
|
+
* Address to receive XRP claims against this channel. This is also known as
|
23
|
+
* the "destination address" for the channel.
|
24
|
+
*/
|
25
|
+
Destination: string
|
26
|
+
/**
|
27
|
+
* Amount of time the source address must wait before closing the channel if
|
28
|
+
* it has unclaimed XRP.
|
29
|
+
*/
|
30
|
+
SettleDelay: number
|
31
|
+
/**
|
32
|
+
* The public key of the key pair the source will use to sign claims against
|
33
|
+
* this channel in hexadecimal. This can be any secp256k1 or ed25519 public
|
34
|
+
* key.
|
35
|
+
*/
|
36
|
+
PublicKey: string
|
37
|
+
/**
|
38
|
+
* The time, in seconds since the Ripple Epoch, when this channel expires.
|
39
|
+
* Any transaction that would modify the channel after this time closes the
|
40
|
+
* channel without otherwise affecting it. This value is immutable; the
|
41
|
+
* channel can be closed earlier than this time but cannot remain open after
|
42
|
+
* this time.
|
43
|
+
*/
|
44
|
+
CancelAfter?: number
|
45
|
+
/**
|
46
|
+
* Arbitrary tag to further specify the destination for this payment channel,
|
47
|
+
* such as a hosted recipient at the destination address.
|
48
|
+
*/
|
49
|
+
DestinationTag?: number
|
50
|
+
}
|
51
|
+
|
52
|
+
/**
|
53
|
+
* Verify the form and type of an PaymentChannelCreate at runtime.
|
54
|
+
*
|
55
|
+
* @param tx - An PaymentChannelCreate Transaction.
|
56
|
+
* @throws When the PaymentChannelCreate is Malformed.
|
57
|
+
*/
|
58
|
+
// eslint-disable-next-line max-lines-per-function -- okay for this function, there's a lot of things to check
|
59
|
+
export function validatePaymentChannelCreate(
|
60
|
+
tx: Record<string, unknown>,
|
61
|
+
): void {
|
62
|
+
validateBaseTransaction(tx)
|
63
|
+
|
64
|
+
if (tx.Amount === undefined) {
|
65
|
+
throw new ValidationError('PaymentChannelCreate: missing Amount')
|
66
|
+
}
|
67
|
+
|
68
|
+
if (typeof tx.Amount !== 'string') {
|
69
|
+
throw new ValidationError('PaymentChannelCreate: Amount must be a string')
|
70
|
+
}
|
71
|
+
|
72
|
+
if (tx.Destination === undefined) {
|
73
|
+
throw new ValidationError('PaymentChannelCreate: missing Destination')
|
74
|
+
}
|
75
|
+
|
76
|
+
if (typeof tx.Destination !== 'string') {
|
77
|
+
throw new ValidationError(
|
78
|
+
'PaymentChannelCreate: Destination must be a string',
|
79
|
+
)
|
80
|
+
}
|
81
|
+
|
82
|
+
if (tx.SettleDelay === undefined) {
|
83
|
+
throw new ValidationError('PaymentChannelCreate: missing SettleDelay')
|
84
|
+
}
|
85
|
+
|
86
|
+
if (typeof tx.SettleDelay !== 'number') {
|
87
|
+
throw new ValidationError(
|
88
|
+
'PaymentChannelCreate: SettleDelay must be a number',
|
89
|
+
)
|
90
|
+
}
|
91
|
+
|
92
|
+
if (tx.PublicKey === undefined) {
|
93
|
+
throw new ValidationError('PaymentChannelCreate: missing PublicKey')
|
94
|
+
}
|
95
|
+
|
96
|
+
if (typeof tx.PublicKey !== 'string') {
|
97
|
+
throw new ValidationError(
|
98
|
+
'PaymentChannelCreate: PublicKey must be a string',
|
99
|
+
)
|
100
|
+
}
|
101
|
+
|
102
|
+
if (tx.CancelAfter !== undefined && typeof tx.CancelAfter !== 'number') {
|
103
|
+
throw new ValidationError(
|
104
|
+
'PaymentChannelCreate: CancelAfter must be a number',
|
105
|
+
)
|
106
|
+
}
|
107
|
+
|
108
|
+
if (
|
109
|
+
tx.DestinationTag !== undefined &&
|
110
|
+
typeof tx.DestinationTag !== 'number'
|
111
|
+
) {
|
112
|
+
throw new ValidationError(
|
113
|
+
'PaymentChannelCreate: DestinationTag must be a number',
|
114
|
+
)
|
115
|
+
}
|
116
|
+
}
|
@@ -0,0 +1,65 @@
|
|
1
|
+
import { ValidationError } from '../../errors'
|
2
|
+
|
3
|
+
import { BaseTransaction, validateBaseTransaction } from './common'
|
4
|
+
|
5
|
+
/**
|
6
|
+
* Add additional XRP to an open payment channel, and optionally update the
|
7
|
+
* expiration time of the channel. Only the source address of the channel can
|
8
|
+
* use this transaction.
|
9
|
+
*
|
10
|
+
* @category Transaction Models
|
11
|
+
*/
|
12
|
+
export interface PaymentChannelFund extends BaseTransaction {
|
13
|
+
TransactionType: 'PaymentChannelFund'
|
14
|
+
/**
|
15
|
+
* The unique ID of the channel to fund as a 64-character hexadecimal
|
16
|
+
* string.
|
17
|
+
*/
|
18
|
+
Channel: string
|
19
|
+
/**
|
20
|
+
* Amount of XRP in drops to add to the channel. Must be a positive amount
|
21
|
+
* of XRP.
|
22
|
+
*/
|
23
|
+
Amount: string
|
24
|
+
/**
|
25
|
+
* New Expiration time to set for the channel in seconds since the Ripple
|
26
|
+
* Epoch. This must be later than either the current time plus the SettleDelay
|
27
|
+
* of the channel, or the existing Expiration of the channel. After the
|
28
|
+
* Expiration time, any transaction that would access the channel closes the
|
29
|
+
* channel without taking its normal action. Any unspent XRP is returned to
|
30
|
+
* the source address when the channel closes. (Expiration is separate from
|
31
|
+
* the channel's immutable CancelAfter time.) For more information, see the
|
32
|
+
* PayChannel ledger object type.
|
33
|
+
*/
|
34
|
+
Expiration?: number
|
35
|
+
}
|
36
|
+
|
37
|
+
/**
|
38
|
+
* Verify the form and type of an PaymentChannelFund at runtime.
|
39
|
+
*
|
40
|
+
* @param tx - An PaymentChannelFund Transaction.
|
41
|
+
* @throws When the PaymentChannelFund is Malformed.
|
42
|
+
*/
|
43
|
+
export function validatePaymentChannelFund(tx: Record<string, unknown>): void {
|
44
|
+
validateBaseTransaction(tx)
|
45
|
+
|
46
|
+
if (tx.Channel === undefined) {
|
47
|
+
throw new ValidationError('PaymentChannelFund: missing Channel')
|
48
|
+
}
|
49
|
+
|
50
|
+
if (typeof tx.Channel !== 'string') {
|
51
|
+
throw new ValidationError('PaymentChannelFund: Channel must be a string')
|
52
|
+
}
|
53
|
+
|
54
|
+
if (tx.Amount === undefined) {
|
55
|
+
throw new ValidationError('PaymentChannelFund: missing Amount')
|
56
|
+
}
|
57
|
+
|
58
|
+
if (typeof tx.Amount !== 'string') {
|
59
|
+
throw new ValidationError('PaymentChannelFund: Amount must be a string')
|
60
|
+
}
|
61
|
+
|
62
|
+
if (tx.Expiration !== undefined && typeof tx.Expiration !== 'number') {
|
63
|
+
throw new ValidationError('PaymentChannelFund: Expiration must be a number')
|
64
|
+
}
|
65
|
+
}
|
@@ -0,0 +1,48 @@
|
|
1
|
+
import { BaseTransaction } from './common'
|
2
|
+
|
3
|
+
export interface SetFeePreAmendment extends BaseTransaction {
|
4
|
+
/**
|
5
|
+
* The charge, in drops of XRP, for the reference transaction, as hex. (This is the transaction cost before scaling for load.)
|
6
|
+
*/
|
7
|
+
BaseFee: string
|
8
|
+
/**
|
9
|
+
* The cost, in fee units, of the [reference transaction](https://xrpl.org/transaction-cost.html#reference-transaction-cost)
|
10
|
+
*/
|
11
|
+
ReferenceFeeUnits: number
|
12
|
+
/**
|
13
|
+
* The base reserve, in drops
|
14
|
+
*/
|
15
|
+
ReserveBase: number
|
16
|
+
/**
|
17
|
+
* The incremental reserve, in drops
|
18
|
+
*/
|
19
|
+
ReserveIncrement: number
|
20
|
+
}
|
21
|
+
|
22
|
+
export interface SetFeePostAmendment extends BaseTransaction {
|
23
|
+
/**
|
24
|
+
* The charge, in drops of XRP, for the reference transaction. (This is the transaction cost before scaling for load.)
|
25
|
+
*/
|
26
|
+
BaseFeeDrops: string
|
27
|
+
/**
|
28
|
+
* The base reserve, in drops
|
29
|
+
*/
|
30
|
+
ReserveBaseDrops: string
|
31
|
+
/**
|
32
|
+
* The incremental reserve, in drops
|
33
|
+
*/
|
34
|
+
ReserveIncrementDrops: string
|
35
|
+
}
|
36
|
+
|
37
|
+
/**
|
38
|
+
* Marks a change in transaction cost or reserve requirements as a result of Fee Voting.
|
39
|
+
*
|
40
|
+
* The output will be based on the status of the `XRPFees` amendment at the time of this transaction.
|
41
|
+
* - Before: {@link SetFeePostAmendment}
|
42
|
+
* - After: {@link SetFeePostAmendment}
|
43
|
+
*
|
44
|
+
* @category Pseudo Transaction Models
|
45
|
+
*/
|
46
|
+
export type SetFee = {
|
47
|
+
TransactionType: 'SetFee'
|
48
|
+
} & (SetFeePreAmendment | SetFeePostAmendment)
|
@@ -0,0 +1,33 @@
|
|
1
|
+
import { ValidationError } from '../../errors'
|
2
|
+
|
3
|
+
import { BaseTransaction, validateBaseTransaction } from './common'
|
4
|
+
|
5
|
+
/**
|
6
|
+
* A SetRegularKey transaction assigns, changes, or removes the regular key
|
7
|
+
* pair associated with an account.
|
8
|
+
*
|
9
|
+
* @category Transaction Models
|
10
|
+
*/
|
11
|
+
export interface SetRegularKey extends BaseTransaction {
|
12
|
+
TransactionType: 'SetRegularKey'
|
13
|
+
/**
|
14
|
+
* A base-58-encoded Address that indicates the regular key pair to be
|
15
|
+
* assigned to the account. If omitted, removes any existing regular key pair.
|
16
|
+
* from the account. Must not match the master key pair for the address.
|
17
|
+
*/
|
18
|
+
RegularKey?: string
|
19
|
+
}
|
20
|
+
|
21
|
+
/**
|
22
|
+
* Verify the form and type of a SetRegularKey at runtime.
|
23
|
+
*
|
24
|
+
* @param tx - A SetRegularKey Transaction.
|
25
|
+
* @throws When the SetRegularKey is malformed.
|
26
|
+
*/
|
27
|
+
export function validateSetRegularKey(tx: Record<string, unknown>): void {
|
28
|
+
validateBaseTransaction(tx)
|
29
|
+
|
30
|
+
if (tx.RegularKey !== undefined && typeof tx.RegularKey !== 'string') {
|
31
|
+
throw new ValidationError('SetRegularKey: RegularKey must be a string')
|
32
|
+
}
|
33
|
+
}
|
@@ -0,0 +1,89 @@
|
|
1
|
+
import { ValidationError } from '../../errors'
|
2
|
+
import { SignerEntry } from '../common'
|
3
|
+
|
4
|
+
import { BaseTransaction, validateBaseTransaction } from './common'
|
5
|
+
|
6
|
+
/**
|
7
|
+
* The SignerListSet transaction creates, replaces, or removes a list of
|
8
|
+
* signers that can be used to multi-sign a transaction.
|
9
|
+
*
|
10
|
+
* @category Transaction Models
|
11
|
+
*/
|
12
|
+
export interface SignerListSet extends BaseTransaction {
|
13
|
+
TransactionType: 'SignerListSet'
|
14
|
+
/**
|
15
|
+
* A target number for the signer weights. A multi-signature from this list
|
16
|
+
* is valid only if the sum weights of the signatures provided is greater than
|
17
|
+
* or equal to this value. To delete a signer list, use the value 0.
|
18
|
+
*/
|
19
|
+
SignerQuorum: number
|
20
|
+
/**
|
21
|
+
* Array of SignerEntry objects, indicating the addresses and weights of
|
22
|
+
* signers in this list. This signer list must have at least 1 member and no
|
23
|
+
* more than 32 members. No address may appear more than once in the list, nor
|
24
|
+
* may the Account submitting the transaction appear in the list.
|
25
|
+
*/
|
26
|
+
SignerEntries?: SignerEntry[]
|
27
|
+
}
|
28
|
+
|
29
|
+
const MAX_SIGNERS = 32
|
30
|
+
|
31
|
+
const HEX_WALLET_LOCATOR_REGEX = /^[0-9A-Fa-f]{64}$/u
|
32
|
+
|
33
|
+
/**
|
34
|
+
* Verify the form and type of an SignerListSet at runtime.
|
35
|
+
*
|
36
|
+
* @param tx - An SignerListSet Transaction.
|
37
|
+
* @throws When the SignerListSet is Malformed.
|
38
|
+
*/
|
39
|
+
// eslint-disable-next-line complexity -- validation can be complex
|
40
|
+
export function validateSignerListSet(tx: Record<string, unknown>): void {
|
41
|
+
validateBaseTransaction(tx)
|
42
|
+
|
43
|
+
if (tx.SignerQuorum === undefined) {
|
44
|
+
throw new ValidationError('SignerListSet: missing field SignerQuorum')
|
45
|
+
}
|
46
|
+
|
47
|
+
if (typeof tx.SignerQuorum !== 'number') {
|
48
|
+
throw new ValidationError('SignerListSet: invalid SignerQuorum')
|
49
|
+
}
|
50
|
+
|
51
|
+
// All other checks are for if SignerQuorum is greater than 0
|
52
|
+
if (tx.SignerQuorum === 0) {
|
53
|
+
return
|
54
|
+
}
|
55
|
+
|
56
|
+
if (tx.SignerEntries === undefined) {
|
57
|
+
throw new ValidationError('SignerListSet: missing field SignerEntries')
|
58
|
+
}
|
59
|
+
|
60
|
+
if (!Array.isArray(tx.SignerEntries)) {
|
61
|
+
throw new ValidationError('SignerListSet: invalid SignerEntries')
|
62
|
+
}
|
63
|
+
|
64
|
+
if (tx.SignerEntries.length === 0) {
|
65
|
+
throw new ValidationError(
|
66
|
+
'SignerListSet: need at least 1 member in SignerEntries',
|
67
|
+
)
|
68
|
+
}
|
69
|
+
|
70
|
+
if (tx.SignerEntries.length > MAX_SIGNERS) {
|
71
|
+
throw new ValidationError(
|
72
|
+
`SignerListSet: maximum of ${MAX_SIGNERS} members allowed in SignerEntries`,
|
73
|
+
)
|
74
|
+
}
|
75
|
+
|
76
|
+
for (const entry of tx.SignerEntries) {
|
77
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- Should be a SignerEntry
|
78
|
+
const signerEntry = entry as SignerEntry
|
79
|
+
const { WalletLocator } = signerEntry.SignerEntry
|
80
|
+
if (
|
81
|
+
WalletLocator !== undefined &&
|
82
|
+
!HEX_WALLET_LOCATOR_REGEX.test(WalletLocator)
|
83
|
+
) {
|
84
|
+
throw new ValidationError(
|
85
|
+
`SignerListSet: WalletLocator in SignerEntry must be a 256-bit (32-byte) hexadecimal value`,
|
86
|
+
)
|
87
|
+
}
|
88
|
+
}
|
89
|
+
}
|
@@ -0,0 +1,50 @@
|
|
1
|
+
import { ValidationError } from '../../errors'
|
2
|
+
|
3
|
+
import { BaseTransaction, validateBaseTransaction } from './common'
|
4
|
+
|
5
|
+
/**
|
6
|
+
* A TicketCreate transaction sets aside one or more sequence numbers as
|
7
|
+
* Tickets.
|
8
|
+
*
|
9
|
+
* @category Transaction Models
|
10
|
+
*/
|
11
|
+
export interface TicketCreate extends BaseTransaction {
|
12
|
+
TransactionType: 'TicketCreate'
|
13
|
+
/**
|
14
|
+
* How many Tickets to create. This must be a positive number and cannot
|
15
|
+
* cause the account to own more than 250 Tickets after executing this
|
16
|
+
* transaction.
|
17
|
+
*/
|
18
|
+
TicketCount: number
|
19
|
+
}
|
20
|
+
|
21
|
+
const MAX_TICKETS = 250
|
22
|
+
|
23
|
+
/**
|
24
|
+
* Verify the form and type of a TicketCreate at runtime.
|
25
|
+
*
|
26
|
+
* @param tx - A TicketCreate Transaction.
|
27
|
+
* @throws When the TicketCreate is malformed.
|
28
|
+
*/
|
29
|
+
export function validateTicketCreate(tx: Record<string, unknown>): void {
|
30
|
+
validateBaseTransaction(tx)
|
31
|
+
const { TicketCount } = tx
|
32
|
+
|
33
|
+
if (TicketCount === undefined) {
|
34
|
+
throw new ValidationError('TicketCreate: missing field TicketCount')
|
35
|
+
}
|
36
|
+
|
37
|
+
if (typeof TicketCount !== 'number') {
|
38
|
+
throw new ValidationError('TicketCreate: TicketCount must be a number')
|
39
|
+
}
|
40
|
+
|
41
|
+
if (
|
42
|
+
!Number.isInteger(TicketCount) ||
|
43
|
+
TicketCount < 1 ||
|
44
|
+
TicketCount > MAX_TICKETS
|
45
|
+
) {
|
46
|
+
throw new ValidationError(
|
47
|
+
'TicketCreate: TicketCount must be an integer from 1 to 250',
|
48
|
+
)
|
49
|
+
}
|
50
|
+
}
|