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,78 @@
|
|
1
|
+
import { ValidationError } from '../../errors'
|
2
|
+
import { Amount, XChainBridge } from '../common'
|
3
|
+
|
4
|
+
import {
|
5
|
+
BaseTransaction,
|
6
|
+
isAmount,
|
7
|
+
isXChainBridge,
|
8
|
+
validateBaseTransaction,
|
9
|
+
} from './common'
|
10
|
+
|
11
|
+
/**
|
12
|
+
* The XChainCreateClaimID transaction creates a new cross-chain claim ID that is
|
13
|
+
* used for a cross-chain transfer. A cross-chain claim ID represents one
|
14
|
+
* cross-chain transfer of value.
|
15
|
+
*
|
16
|
+
* @category Transaction Models
|
17
|
+
*/
|
18
|
+
export interface XChainCreateClaimID extends BaseTransaction {
|
19
|
+
TransactionType: 'XChainCreateClaimID'
|
20
|
+
|
21
|
+
/**
|
22
|
+
* The bridge to create the claim ID for.
|
23
|
+
*/
|
24
|
+
XChainBridge: XChainBridge
|
25
|
+
|
26
|
+
/**
|
27
|
+
* The amount, in XRP, to reward the witness servers for providing signatures.
|
28
|
+
* This must match the amount on the {@link Bridge} ledger object.
|
29
|
+
*/
|
30
|
+
SignatureReward: Amount
|
31
|
+
|
32
|
+
/**
|
33
|
+
* The account that must send the {@link XChainCommit} transaction on the source chain.
|
34
|
+
*/
|
35
|
+
OtherChainSource: string
|
36
|
+
}
|
37
|
+
|
38
|
+
/**
|
39
|
+
* Verify the form and type of a XChainCreateClaimID at runtime.
|
40
|
+
*
|
41
|
+
* @param tx - A XChainCreateClaimID Transaction.
|
42
|
+
* @throws When the XChainCreateClaimID is malformed.
|
43
|
+
*/
|
44
|
+
export function validateXChainCreateClaimID(tx: Record<string, unknown>): void {
|
45
|
+
validateBaseTransaction(tx)
|
46
|
+
|
47
|
+
if (tx.XChainBridge == null) {
|
48
|
+
throw new ValidationError('XChainCreateClaimID: missing field XChainBridge')
|
49
|
+
}
|
50
|
+
|
51
|
+
if (!isXChainBridge(tx.XChainBridge)) {
|
52
|
+
throw new ValidationError('XChainCreateClaimID: invalid field XChainBridge')
|
53
|
+
}
|
54
|
+
|
55
|
+
if (tx.SignatureReward == null) {
|
56
|
+
throw new ValidationError(
|
57
|
+
'XChainCreateClaimID: missing field SignatureReward',
|
58
|
+
)
|
59
|
+
}
|
60
|
+
|
61
|
+
if (!isAmount(tx.SignatureReward)) {
|
62
|
+
throw new ValidationError(
|
63
|
+
'XChainCreateClaimID: invalid field SignatureReward',
|
64
|
+
)
|
65
|
+
}
|
66
|
+
|
67
|
+
if (tx.OtherChainSource == null) {
|
68
|
+
throw new ValidationError(
|
69
|
+
'XChainCreateClaimID: missing field OtherChainSource',
|
70
|
+
)
|
71
|
+
}
|
72
|
+
|
73
|
+
if (typeof tx.OtherChainSource !== 'string') {
|
74
|
+
throw new ValidationError(
|
75
|
+
'XChainCreateClaimID: invalid field OtherChainSource',
|
76
|
+
)
|
77
|
+
}
|
78
|
+
}
|
@@ -0,0 +1,93 @@
|
|
1
|
+
import { ValidationError } from '../../errors'
|
2
|
+
import { Amount, XChainBridge } from '../common'
|
3
|
+
|
4
|
+
import {
|
5
|
+
BaseTransaction,
|
6
|
+
GlobalFlags,
|
7
|
+
isAmount,
|
8
|
+
isXChainBridge,
|
9
|
+
validateBaseTransaction,
|
10
|
+
} from './common'
|
11
|
+
|
12
|
+
/**
|
13
|
+
* Enum representing values of {@link XChainModifyBridge} transaction flags.
|
14
|
+
*
|
15
|
+
* @category Transaction Flags
|
16
|
+
*/
|
17
|
+
export enum XChainModifyBridgeFlags {
|
18
|
+
/** Clears the MinAccountCreateAmount of the bridge. */
|
19
|
+
tfClearAccountCreateAmount = 0x00010000,
|
20
|
+
}
|
21
|
+
|
22
|
+
/**
|
23
|
+
* Map of flags to boolean values representing {@link XChainModifyBridge} transaction
|
24
|
+
* flags.
|
25
|
+
*
|
26
|
+
* @category Transaction Flags
|
27
|
+
*/
|
28
|
+
export interface XChainModifyBridgeFlagsInterface extends GlobalFlags {
|
29
|
+
/** Clears the MinAccountCreateAmount of the bridge. */
|
30
|
+
tfClearAccountCreateAmount?: boolean
|
31
|
+
}
|
32
|
+
|
33
|
+
/**
|
34
|
+
* The XChainModifyBridge transaction allows bridge managers to modify the parameters
|
35
|
+
* of the bridge.
|
36
|
+
*
|
37
|
+
* @category Transaction Models
|
38
|
+
*/
|
39
|
+
export interface XChainModifyBridge extends BaseTransaction {
|
40
|
+
TransactionType: 'XChainModifyBridge'
|
41
|
+
|
42
|
+
/**
|
43
|
+
* The bridge to modify.
|
44
|
+
*/
|
45
|
+
XChainBridge: XChainBridge
|
46
|
+
|
47
|
+
/**
|
48
|
+
* The signature reward split between the witnesses for submitting attestations.
|
49
|
+
*/
|
50
|
+
SignatureReward?: Amount
|
51
|
+
|
52
|
+
/**
|
53
|
+
* The minimum amount, in XRP, required for a {@link XChainAccountCreateCommit}
|
54
|
+
* transaction. If this is not present, the {@link XChainAccountCreateCommit}
|
55
|
+
* transaction will fail. This field can only be present on XRP-XRP bridges.
|
56
|
+
*/
|
57
|
+
MinAccountCreateAmount?: Amount
|
58
|
+
|
59
|
+
Flags?: number | XChainModifyBridgeFlagsInterface
|
60
|
+
}
|
61
|
+
|
62
|
+
/**
|
63
|
+
* Verify the form and type of a XChainModifyBridge at runtime.
|
64
|
+
*
|
65
|
+
* @param tx - A XChainModifyBridge Transaction.
|
66
|
+
* @throws When the XChainModifyBridge is malformed.
|
67
|
+
*/
|
68
|
+
export function validateXChainModifyBridge(tx: Record<string, unknown>): void {
|
69
|
+
validateBaseTransaction(tx)
|
70
|
+
|
71
|
+
if (tx.XChainBridge == null) {
|
72
|
+
throw new ValidationError('XChainModifyBridge: missing field XChainBridge')
|
73
|
+
}
|
74
|
+
|
75
|
+
if (!isXChainBridge(tx.XChainBridge)) {
|
76
|
+
throw new ValidationError('XChainModifyBridge: invalid field XChainBridge')
|
77
|
+
}
|
78
|
+
|
79
|
+
if (tx.SignatureReward !== undefined && !isAmount(tx.SignatureReward)) {
|
80
|
+
throw new ValidationError(
|
81
|
+
'XChainModifyBridge: invalid field SignatureReward',
|
82
|
+
)
|
83
|
+
}
|
84
|
+
|
85
|
+
if (
|
86
|
+
tx.MinAccountCreateAmount !== undefined &&
|
87
|
+
!isAmount(tx.MinAccountCreateAmount)
|
88
|
+
) {
|
89
|
+
throw new ValidationError(
|
90
|
+
'XChainModifyBridge: invalid field MinAccountCreateAmount',
|
91
|
+
)
|
92
|
+
}
|
93
|
+
}
|
@@ -0,0 +1,50 @@
|
|
1
|
+
import { ValidationError } from '../../errors'
|
2
|
+
|
3
|
+
import { BaseTransaction, validateBaseTransaction } from './common'
|
4
|
+
|
5
|
+
/**
|
6
|
+
* An AccountDelete transaction deletes an account and any objects it owns in
|
7
|
+
* the XRP Ledger, if possible, sending the account's remaining XRP to a
|
8
|
+
* specified destination account.
|
9
|
+
*
|
10
|
+
* @category Transaction Models
|
11
|
+
*/
|
12
|
+
export interface AccountDelete extends BaseTransaction {
|
13
|
+
TransactionType: 'AccountDelete'
|
14
|
+
/**
|
15
|
+
* The address of an account to receive any leftover XRP after deleting the
|
16
|
+
* sending account. Must be a funded account in the ledger, and must not be.
|
17
|
+
* the sending account.
|
18
|
+
*/
|
19
|
+
Destination: string
|
20
|
+
/**
|
21
|
+
* Arbitrary destination tag that identifies a hosted recipient or other.
|
22
|
+
* information for the recipient of the deleted account's leftover XRP.
|
23
|
+
*/
|
24
|
+
DestinationTag?: number
|
25
|
+
}
|
26
|
+
|
27
|
+
/**
|
28
|
+
* Verify the form and type of an AccountDelete at runtime.
|
29
|
+
*
|
30
|
+
* @param tx - An AccountDelete Transaction.
|
31
|
+
* @throws When the AccountDelete is Malformed.
|
32
|
+
*/
|
33
|
+
export function validateAccountDelete(tx: Record<string, unknown>): void {
|
34
|
+
validateBaseTransaction(tx)
|
35
|
+
|
36
|
+
if (tx.Destination === undefined) {
|
37
|
+
throw new ValidationError('AccountDelete: missing field Destination')
|
38
|
+
}
|
39
|
+
|
40
|
+
if (typeof tx.Destination !== 'string') {
|
41
|
+
throw new ValidationError('AccountDelete: invalid Destination')
|
42
|
+
}
|
43
|
+
|
44
|
+
if (
|
45
|
+
tx.DestinationTag !== undefined &&
|
46
|
+
typeof tx.DestinationTag !== 'number'
|
47
|
+
) {
|
48
|
+
throw new ValidationError('AccountDelete: invalid DestinationTag')
|
49
|
+
}
|
50
|
+
}
|
@@ -0,0 +1,228 @@
|
|
1
|
+
/* eslint-disable complexity -- Necessary for validateAccountSet */
|
2
|
+
|
3
|
+
import { isValidClassicAddress } from 'ripple-address-codec'
|
4
|
+
|
5
|
+
import { ValidationError } from '../../errors'
|
6
|
+
|
7
|
+
import { BaseTransaction, validateBaseTransaction } from './common'
|
8
|
+
|
9
|
+
/**
|
10
|
+
* Enum for AccountSet Flags.
|
11
|
+
*
|
12
|
+
* @category Transaction Flags
|
13
|
+
*/
|
14
|
+
export enum AccountSetAsfFlags {
|
15
|
+
/** Require a destination tag to send transactions to this account. */
|
16
|
+
asfRequireDest = 1,
|
17
|
+
/**
|
18
|
+
* Require authorization for users to hold balances issued by this address
|
19
|
+
* can only be enabled if the address has no trust lines connected to it.
|
20
|
+
*/
|
21
|
+
asfRequireAuth = 2,
|
22
|
+
/** XRP should not be sent to this account. */
|
23
|
+
asfDisallowXRP = 3,
|
24
|
+
/**
|
25
|
+
* Disallow use of the master key pair. Can only be enabled if the account
|
26
|
+
* has configured another way to sign transactions, such as a Regular Key or a
|
27
|
+
* Signer List.
|
28
|
+
*/
|
29
|
+
asfDisableMaster = 4,
|
30
|
+
/**
|
31
|
+
* Track the ID of this account's most recent transaction. Required for
|
32
|
+
* AccountTxnID.
|
33
|
+
*/
|
34
|
+
asfAccountTxnID = 5,
|
35
|
+
/**
|
36
|
+
* Permanently give up the ability to freeze individual trust lines or
|
37
|
+
* disable Global Freeze. This flag can never be disabled after being enabled.
|
38
|
+
*/
|
39
|
+
asfNoFreeze = 6,
|
40
|
+
/** Freeze all assets issued by this account. */
|
41
|
+
asfGlobalFreeze = 7,
|
42
|
+
/** Enable rippling on this account's trust lines by default. */
|
43
|
+
asfDefaultRipple = 8,
|
44
|
+
/** Enable Deposit Authorization on this account. */
|
45
|
+
asfDepositAuth = 9,
|
46
|
+
/**
|
47
|
+
* Allow another account to mint and burn tokens on behalf of this account.
|
48
|
+
*/
|
49
|
+
asfAuthorizedNFTokenMinter = 10,
|
50
|
+
/** asf 11 is reserved for Hooks amendment */
|
51
|
+
/** Disallow other accounts from creating incoming NFTOffers */
|
52
|
+
asfDisallowIncomingNFTokenOffer = 12,
|
53
|
+
/** Disallow other accounts from creating incoming Checks */
|
54
|
+
asfDisallowIncomingCheck = 13,
|
55
|
+
/** Disallow other accounts from creating incoming PayChannels */
|
56
|
+
asfDisallowIncomingPayChan = 14,
|
57
|
+
/** Disallow other accounts from creating incoming Trustlines */
|
58
|
+
asfDisallowIncomingTrustline = 15,
|
59
|
+
/** Permanently gain the ability to claw back issued IOUs */
|
60
|
+
asfAllowTrustLineClawback = 16,
|
61
|
+
}
|
62
|
+
|
63
|
+
/**
|
64
|
+
* Enum for AccountSet Transaction Flags.
|
65
|
+
*
|
66
|
+
* @category Transaction Flags
|
67
|
+
*/
|
68
|
+
export enum AccountSetTfFlags {
|
69
|
+
/** The same as SetFlag: asfRequireDest. */
|
70
|
+
tfRequireDestTag = 0x00010000,
|
71
|
+
/** The same as ClearFlag: asfRequireDest. */
|
72
|
+
tfOptionalDestTag = 0x00020000,
|
73
|
+
/** The same as SetFlag: asfRequireAuth. */
|
74
|
+
tfRequireAuth = 0x00040000,
|
75
|
+
/** The same as ClearFlag: asfRequireAuth. */
|
76
|
+
tfOptionalAuth = 0x00080000,
|
77
|
+
/** The same as SetFlag: asfDisallowXRP. */
|
78
|
+
tfDisallowXRP = 0x00100000,
|
79
|
+
/** The same as ClearFlag: asfDisallowXRP. */
|
80
|
+
tfAllowXRP = 0x00200000,
|
81
|
+
}
|
82
|
+
|
83
|
+
/**
|
84
|
+
* Map of flags to boolean values representing {@link AccountSet} transaction
|
85
|
+
* flags.
|
86
|
+
*
|
87
|
+
* @category Transaction Flags
|
88
|
+
*
|
89
|
+
* @example
|
90
|
+
* ```typescript
|
91
|
+
* const accountSetTx: AccountSet = {
|
92
|
+
* TransactionType: 'AccountSet',
|
93
|
+
* Account: 'rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn',
|
94
|
+
* Flags: {
|
95
|
+
* tfOptionalDestTag: true,
|
96
|
+
* tfRequireAuth: true
|
97
|
+
* },
|
98
|
+
* }
|
99
|
+
*
|
100
|
+
* // Autofill the tx to see how flags actually look compared to the interface usage.
|
101
|
+
* const autofilledTx = await client.autofill(accountSetTx)
|
102
|
+
* console.log(autofilledTx)
|
103
|
+
* // {
|
104
|
+
* // TransactionType: 'AccountSet',
|
105
|
+
* // Account: 'rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn',
|
106
|
+
* // Flags: 393216,
|
107
|
+
* // Sequence: 1,
|
108
|
+
* // Fee: '12',
|
109
|
+
* // LastLedgerSequence: 21971793
|
110
|
+
* // }
|
111
|
+
* ```
|
112
|
+
*/
|
113
|
+
export interface AccountSetFlagsInterface {
|
114
|
+
tfRequireDestTag?: boolean
|
115
|
+
tfOptionalDestTag?: boolean
|
116
|
+
tfRequireAuth?: boolean
|
117
|
+
tfOptionalAuth?: boolean
|
118
|
+
tfDisallowXRP?: boolean
|
119
|
+
tfAllowXRP?: boolean
|
120
|
+
}
|
121
|
+
|
122
|
+
/**
|
123
|
+
* An AccountSet transaction modifies the properties of an account in the XRP
|
124
|
+
* Ledger.
|
125
|
+
*
|
126
|
+
* @category Transaction Models
|
127
|
+
*/
|
128
|
+
export interface AccountSet extends BaseTransaction {
|
129
|
+
TransactionType: 'AccountSet'
|
130
|
+
Flags?: number | AccountSetFlagsInterface
|
131
|
+
/** Unique identifier of a flag to disable for this account. */
|
132
|
+
ClearFlag?: number
|
133
|
+
/**
|
134
|
+
* The domain that owns this account, as a string of hex representing the.
|
135
|
+
* ASCII for the domain in lowercase.
|
136
|
+
*/
|
137
|
+
Domain?: string
|
138
|
+
/** Hash of an email address to be used for generating an avatar image. */
|
139
|
+
EmailHash?: string
|
140
|
+
/** Public key for sending encrypted messages to this account. */
|
141
|
+
MessageKey?: string
|
142
|
+
/** Integer flag to enable for this account. */
|
143
|
+
SetFlag?: AccountSetAsfFlags
|
144
|
+
/**
|
145
|
+
* The fee to charge when users transfer this account's issued currencies,
|
146
|
+
* represented as billionths of a unit. Cannot be more than 2000000000 or less
|
147
|
+
* than 1000000000, except for the special case 0 meaning no fee.
|
148
|
+
*/
|
149
|
+
TransferRate?: number
|
150
|
+
/**
|
151
|
+
* Tick size to use for offers involving a currency issued by this address.
|
152
|
+
* The exchange rates of those offers is rounded to this many significant
|
153
|
+
* digits. Valid values are 3 to 15 inclusive, or 0 to disable.
|
154
|
+
*/
|
155
|
+
TickSize?: number
|
156
|
+
/**
|
157
|
+
* Sets an alternate account that is allowed to mint NFTokens on this
|
158
|
+
* account's behalf using NFTokenMint's `Issuer` field.
|
159
|
+
*/
|
160
|
+
NFTokenMinter?: string
|
161
|
+
}
|
162
|
+
|
163
|
+
const MIN_TICK_SIZE = 3
|
164
|
+
const MAX_TICK_SIZE = 15
|
165
|
+
|
166
|
+
/**
|
167
|
+
* Verify the form and type of an AccountSet at runtime.
|
168
|
+
*
|
169
|
+
* @param tx - An AccountSet Transaction.
|
170
|
+
* @throws When the AccountSet is Malformed.
|
171
|
+
*/
|
172
|
+
// eslint-disable-next-line max-lines-per-function, max-statements -- okay for this method, only a little over
|
173
|
+
export function validateAccountSet(tx: Record<string, unknown>): void {
|
174
|
+
validateBaseTransaction(tx)
|
175
|
+
|
176
|
+
if (
|
177
|
+
tx.NFTokenMinter !== undefined &&
|
178
|
+
!isValidClassicAddress(String(tx.NFTokenMinter))
|
179
|
+
) {
|
180
|
+
throw new ValidationError('AccountSet: invalid NFTokenMinter')
|
181
|
+
}
|
182
|
+
|
183
|
+
if (tx.ClearFlag !== undefined) {
|
184
|
+
if (typeof tx.ClearFlag !== 'number') {
|
185
|
+
throw new ValidationError('AccountSet: invalid ClearFlag')
|
186
|
+
}
|
187
|
+
if (!Object.values(AccountSetAsfFlags).includes(tx.ClearFlag)) {
|
188
|
+
throw new ValidationError('AccountSet: invalid ClearFlag')
|
189
|
+
}
|
190
|
+
}
|
191
|
+
|
192
|
+
if (tx.Domain !== undefined && typeof tx.Domain !== 'string') {
|
193
|
+
throw new ValidationError('AccountSet: invalid Domain')
|
194
|
+
}
|
195
|
+
|
196
|
+
if (tx.EmailHash !== undefined && typeof tx.EmailHash !== 'string') {
|
197
|
+
throw new ValidationError('AccountSet: invalid EmailHash')
|
198
|
+
}
|
199
|
+
|
200
|
+
if (tx.MessageKey !== undefined && typeof tx.MessageKey !== 'string') {
|
201
|
+
throw new ValidationError('AccountSet: invalid MessageKey')
|
202
|
+
}
|
203
|
+
|
204
|
+
if (tx.SetFlag !== undefined) {
|
205
|
+
if (typeof tx.SetFlag !== 'number') {
|
206
|
+
throw new ValidationError('AccountSet: invalid SetFlag')
|
207
|
+
}
|
208
|
+
if (!Object.values(AccountSetAsfFlags).includes(tx.SetFlag)) {
|
209
|
+
throw new ValidationError('AccountSet: invalid SetFlag')
|
210
|
+
}
|
211
|
+
}
|
212
|
+
|
213
|
+
if (tx.TransferRate !== undefined && typeof tx.TransferRate !== 'number') {
|
214
|
+
throw new ValidationError('AccountSet: invalid TransferRate')
|
215
|
+
}
|
216
|
+
|
217
|
+
if (tx.TickSize !== undefined) {
|
218
|
+
if (typeof tx.TickSize !== 'number') {
|
219
|
+
throw new ValidationError('AccountSet: invalid TickSize')
|
220
|
+
}
|
221
|
+
if (
|
222
|
+
tx.TickSize !== 0 &&
|
223
|
+
(tx.TickSize < MIN_TICK_SIZE || tx.TickSize > MAX_TICK_SIZE)
|
224
|
+
) {
|
225
|
+
throw new ValidationError('AccountSet: invalid TickSize')
|
226
|
+
}
|
227
|
+
}
|
228
|
+
}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import { ValidationError } from '../../errors'
|
2
|
+
|
3
|
+
import { BaseTransaction, validateBaseTransaction } from './common'
|
4
|
+
|
5
|
+
/**
|
6
|
+
* Cancels an unredeemed Check, removing it from the ledger without sending any
|
7
|
+
* money. The source or the destination of the check can cancel a Check at any
|
8
|
+
* time using this transaction type. If the Check has expired, any address can
|
9
|
+
* cancel it.
|
10
|
+
*
|
11
|
+
* @category Transaction Models
|
12
|
+
*/
|
13
|
+
export interface CheckCancel extends BaseTransaction {
|
14
|
+
TransactionType: 'CheckCancel'
|
15
|
+
/**
|
16
|
+
* The ID of the Check ledger object to cancel as a 64-character hexadecimal
|
17
|
+
* string.
|
18
|
+
*/
|
19
|
+
CheckID: string
|
20
|
+
}
|
21
|
+
|
22
|
+
/**
|
23
|
+
* Verify the form and type of an CheckCancel at runtime.
|
24
|
+
*
|
25
|
+
* @param tx - An CheckCancel Transaction.
|
26
|
+
* @throws When the CheckCancel is Malformed.
|
27
|
+
*/
|
28
|
+
export function validateCheckCancel(tx: Record<string, unknown>): void {
|
29
|
+
validateBaseTransaction(tx)
|
30
|
+
|
31
|
+
if (tx.CheckID !== undefined && typeof tx.CheckID !== 'string') {
|
32
|
+
throw new ValidationError('CheckCancel: invalid CheckID')
|
33
|
+
}
|
34
|
+
}
|
@@ -0,0 +1,73 @@
|
|
1
|
+
/* eslint-disable complexity -- Necessary for validateCheckCash */
|
2
|
+
import { ValidationError } from '../../errors'
|
3
|
+
import { Amount } from '../common'
|
4
|
+
|
5
|
+
import { BaseTransaction, validateBaseTransaction, isAmount } from './common'
|
6
|
+
|
7
|
+
/**
|
8
|
+
* Attempts to redeem a Check object in the ledger to receive up to the amount
|
9
|
+
* authorized by the corresponding CheckCreate transaction. Only the Destination
|
10
|
+
* address of a Check can cash it with a CheckCash transaction.
|
11
|
+
*
|
12
|
+
* @category Transaction Models
|
13
|
+
*/
|
14
|
+
export interface CheckCash extends BaseTransaction {
|
15
|
+
TransactionType: 'CheckCash'
|
16
|
+
/**
|
17
|
+
* The ID of the Check ledger object to cash as a 64-character hexadecimal
|
18
|
+
* string.
|
19
|
+
*/
|
20
|
+
CheckID: string
|
21
|
+
/**
|
22
|
+
* Redeem the Check for exactly this amount, if possible. The currency must
|
23
|
+
* match that of the SendMax of the corresponding CheckCreate transaction. You.
|
24
|
+
* must provide either this field or DeliverMin.
|
25
|
+
*/
|
26
|
+
Amount?: Amount
|
27
|
+
/**
|
28
|
+
* Redeem the Check for at least this amount and for as much as possible. The
|
29
|
+
* currency must match that of the SendMax of the corresponding CheckCreate.
|
30
|
+
* transaction. You must provide either this field or Amount.
|
31
|
+
*/
|
32
|
+
DeliverMin?: Amount
|
33
|
+
}
|
34
|
+
|
35
|
+
/**
|
36
|
+
* Verify the form and type of an CheckCash at runtime.
|
37
|
+
*
|
38
|
+
* @param tx - An CheckCash Transaction.
|
39
|
+
* @throws When the CheckCash is Malformed.
|
40
|
+
*/
|
41
|
+
export function validateCheckCash(tx: Record<string, unknown>): void {
|
42
|
+
validateBaseTransaction(tx)
|
43
|
+
|
44
|
+
if (tx.Amount == null && tx.DeliverMin == null) {
|
45
|
+
throw new ValidationError(
|
46
|
+
'CheckCash: must have either Amount or DeliverMin',
|
47
|
+
)
|
48
|
+
}
|
49
|
+
|
50
|
+
if (tx.Amount != null && tx.DeliverMin != null) {
|
51
|
+
throw new ValidationError(
|
52
|
+
'CheckCash: cannot have both Amount and DeliverMin',
|
53
|
+
)
|
54
|
+
}
|
55
|
+
|
56
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- Necessary check
|
57
|
+
if (tx.Amount != null && tx.Amount !== undefined && !isAmount(tx.Amount)) {
|
58
|
+
throw new ValidationError('CheckCash: invalid Amount')
|
59
|
+
}
|
60
|
+
|
61
|
+
if (
|
62
|
+
tx.DeliverMin != null &&
|
63
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- Necessary check
|
64
|
+
tx.DeliverMin !== undefined &&
|
65
|
+
!isAmount(tx.DeliverMin)
|
66
|
+
) {
|
67
|
+
throw new ValidationError('CheckCash: invalid DeliverMin')
|
68
|
+
}
|
69
|
+
|
70
|
+
if (tx.CheckID !== undefined && typeof tx.CheckID !== 'string') {
|
71
|
+
throw new ValidationError('CheckCash: invalid CheckID')
|
72
|
+
}
|
73
|
+
}
|
@@ -0,0 +1,90 @@
|
|
1
|
+
/* eslint-disable complexity -- Necessary for validateCheckCreate */
|
2
|
+
import { ValidationError } from '../../errors'
|
3
|
+
import { Amount } from '../common'
|
4
|
+
|
5
|
+
import {
|
6
|
+
BaseTransaction,
|
7
|
+
validateBaseTransaction,
|
8
|
+
isIssuedCurrency,
|
9
|
+
} from './common'
|
10
|
+
|
11
|
+
/**
|
12
|
+
* Create a Check object in the ledger, which is a deferred payment that can be
|
13
|
+
* cashed by its intended destination. The sender of this transaction is the
|
14
|
+
* sender of the Check.
|
15
|
+
*
|
16
|
+
* @category Transaction Models
|
17
|
+
*/
|
18
|
+
export interface CheckCreate extends BaseTransaction {
|
19
|
+
TransactionType: 'CheckCreate'
|
20
|
+
/** The unique address of the account that can cash the Check. */
|
21
|
+
Destination: string
|
22
|
+
/**
|
23
|
+
* Maximum amount of source currency the Check is allowed to debit the
|
24
|
+
* sender, including transfer fees on non-XRP currencies. The Check can only
|
25
|
+
* credit the destination with the same currency (from the same issuer, for
|
26
|
+
* non-XRP currencies). For non-XRP amounts, the nested field names MUST be.
|
27
|
+
* lower-case.
|
28
|
+
*/
|
29
|
+
SendMax: Amount
|
30
|
+
/**
|
31
|
+
* Arbitrary tag that identifies the reason for the Check, or a hosted.
|
32
|
+
* recipient to pay.
|
33
|
+
*/
|
34
|
+
DestinationTag?: number
|
35
|
+
/**
|
36
|
+
* Time after which the Check is no longer valid, in seconds since the Ripple.
|
37
|
+
* Epoch.
|
38
|
+
*/
|
39
|
+
Expiration?: number
|
40
|
+
/**
|
41
|
+
* Arbitrary 256-bit hash representing a specific reason or identifier for.
|
42
|
+
* this Check.
|
43
|
+
*/
|
44
|
+
InvoiceID?: string
|
45
|
+
}
|
46
|
+
|
47
|
+
/**
|
48
|
+
* Verify the form and type of an CheckCreate at runtime.
|
49
|
+
*
|
50
|
+
* @param tx - An CheckCreate Transaction.
|
51
|
+
* @throws When the CheckCreate is Malformed.
|
52
|
+
*/
|
53
|
+
export function validateCheckCreate(tx: Record<string, unknown>): void {
|
54
|
+
validateBaseTransaction(tx)
|
55
|
+
|
56
|
+
if (tx.SendMax === undefined) {
|
57
|
+
throw new ValidationError('CheckCreate: missing field SendMax')
|
58
|
+
}
|
59
|
+
|
60
|
+
if (tx.Destination === undefined) {
|
61
|
+
throw new ValidationError('CheckCreate: missing field Destination')
|
62
|
+
}
|
63
|
+
|
64
|
+
if (
|
65
|
+
typeof tx.SendMax !== 'string' &&
|
66
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- Only used by JS
|
67
|
+
!isIssuedCurrency(tx.SendMax as Record<string, unknown>)
|
68
|
+
) {
|
69
|
+
throw new ValidationError('CheckCreate: invalid SendMax')
|
70
|
+
}
|
71
|
+
|
72
|
+
if (typeof tx.Destination !== 'string') {
|
73
|
+
throw new ValidationError('CheckCreate: invalid Destination')
|
74
|
+
}
|
75
|
+
|
76
|
+
if (
|
77
|
+
tx.DestinationTag !== undefined &&
|
78
|
+
typeof tx.DestinationTag !== 'number'
|
79
|
+
) {
|
80
|
+
throw new ValidationError('CheckCreate: invalid DestinationTag')
|
81
|
+
}
|
82
|
+
|
83
|
+
if (tx.Expiration !== undefined && typeof tx.Expiration !== 'number') {
|
84
|
+
throw new ValidationError('CheckCreate: invalid Expiration')
|
85
|
+
}
|
86
|
+
|
87
|
+
if (tx.InvoiceID !== undefined && typeof tx.InvoiceID !== 'string') {
|
88
|
+
throw new ValidationError('CheckCreate: invalid InvoiceID')
|
89
|
+
}
|
90
|
+
}
|
@@ -0,0 +1,49 @@
|
|
1
|
+
import { ValidationError } from '../../errors'
|
2
|
+
import { IssuedCurrencyAmount } from '../common'
|
3
|
+
|
4
|
+
import {
|
5
|
+
BaseTransaction,
|
6
|
+
validateBaseTransaction,
|
7
|
+
isIssuedCurrency,
|
8
|
+
} from './common'
|
9
|
+
|
10
|
+
/**
|
11
|
+
* The Clawback transaction is used by the token issuer to claw back
|
12
|
+
* issued tokens from a holder.
|
13
|
+
*/
|
14
|
+
export interface Clawback extends BaseTransaction {
|
15
|
+
TransactionType: 'Clawback'
|
16
|
+
/**
|
17
|
+
* Indicates the AccountID that submitted this transaction. The account MUST
|
18
|
+
* be the issuer of the currency.
|
19
|
+
*/
|
20
|
+
Account: string
|
21
|
+
/**
|
22
|
+
* The amount of currency to deliver, and it must be non-XRP. The nested field
|
23
|
+
* names MUST be lower-case. The `issuer` field MUST be the holder's address,
|
24
|
+
* whom to be clawed back.
|
25
|
+
*/
|
26
|
+
Amount: IssuedCurrencyAmount
|
27
|
+
}
|
28
|
+
|
29
|
+
/**
|
30
|
+
* Verify the form and type of an Clawback at runtime.
|
31
|
+
*
|
32
|
+
* @param tx - An Clawback Transaction.
|
33
|
+
* @throws When the Clawback is Malformed.
|
34
|
+
*/
|
35
|
+
export function validateClawback(tx: Record<string, unknown>): void {
|
36
|
+
validateBaseTransaction(tx)
|
37
|
+
|
38
|
+
if (tx.Amount == null) {
|
39
|
+
throw new ValidationError('Clawback: missing field Amount')
|
40
|
+
}
|
41
|
+
|
42
|
+
if (!isIssuedCurrency(tx.Amount)) {
|
43
|
+
throw new ValidationError('Clawback: invalid Amount')
|
44
|
+
}
|
45
|
+
|
46
|
+
if (isIssuedCurrency(tx.Amount) && tx.Account === tx.Amount.issuer) {
|
47
|
+
throw new ValidationError('Clawback: invalid holder Account')
|
48
|
+
}
|
49
|
+
}
|