xrpl 2.11.0 → 2.12.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 +453 -51
- package/build/xrpl-latest.js.map +1 -1
- package/dist/npm/models/common/index.d.ts +8 -1
- package/dist/npm/models/common/index.d.ts.map +1 -1
- package/dist/npm/models/ledger/AMM.d.ts +5 -3
- package/dist/npm/models/ledger/AMM.d.ts.map +1 -1
- package/dist/npm/models/ledger/AccountRoot.d.ts +1 -0
- package/dist/npm/models/ledger/AccountRoot.d.ts.map +1 -1
- 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 +4 -1
- package/dist/npm/models/ledger/LedgerEntry.d.ts.map +1 -1
- package/dist/npm/models/ledger/XChainOwnedClaimID.d.ts +26 -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 +23 -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 +5 -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 +4 -3
- package/dist/npm/models/methods/ammInfo.d.ts.map +1 -1
- package/dist/npm/models/methods/ledgerEntry.d.ts +17 -0
- package/dist/npm/models/methods/ledgerEntry.d.ts.map +1 -1
- package/dist/npm/models/methods/serverInfo.d.ts +6 -0
- package/dist/npm/models/methods/serverInfo.d.ts.map +1 -1
- package/dist/npm/models/transactions/AMMBid.d.ts +3 -3
- package/dist/npm/models/transactions/AMMBid.d.ts.map +1 -1
- package/dist/npm/models/transactions/AMMBid.js.map +1 -1
- package/dist/npm/models/transactions/AMMDeposit.d.ts.map +1 -1
- package/dist/npm/models/transactions/AMMDeposit.js.map +1 -1
- package/dist/npm/models/transactions/AMMWithdraw.d.ts.map +1 -1
- package/dist/npm/models/transactions/AMMWithdraw.js.map +1 -1
- 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 +14 -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 +20 -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 +19 -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 +14 -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 +13 -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 +12 -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 +12 -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 +16 -0
- package/dist/npm/models/transactions/XChainModifyBridge.js.map +1 -0
- package/dist/npm/models/transactions/accountSet.d.ts.map +1 -1
- package/dist/npm/models/transactions/accountSet.js.map +1 -1
- package/dist/npm/models/transactions/checkCash.d.ts.map +1 -1
- package/dist/npm/models/transactions/checkCash.js.map +1 -1
- package/dist/npm/models/transactions/checkCreate.d.ts.map +1 -1
- package/dist/npm/models/transactions/checkCreate.js.map +1 -1
- package/dist/npm/models/transactions/common.d.ts +6 -1
- package/dist/npm/models/transactions/common.d.ts.map +1 -1
- package/dist/npm/models/transactions/common.js +43 -38
- package/dist/npm/models/transactions/common.js.map +1 -1
- package/dist/npm/models/transactions/depositPreauth.d.ts.map +1 -1
- package/dist/npm/models/transactions/depositPreauth.js.map +1 -1
- package/dist/npm/models/transactions/escrowCancel.d.ts +1 -1
- package/dist/npm/models/transactions/escrowCancel.d.ts.map +1 -1
- package/dist/npm/models/transactions/escrowCancel.js +5 -3
- package/dist/npm/models/transactions/escrowCancel.js.map +1 -1
- package/dist/npm/models/transactions/escrowCreate.d.ts.map +1 -1
- package/dist/npm/models/transactions/escrowCreate.js.map +1 -1
- package/dist/npm/models/transactions/escrowFinish.d.ts +1 -1
- package/dist/npm/models/transactions/escrowFinish.d.ts.map +1 -1
- package/dist/npm/models/transactions/escrowFinish.js +5 -3
- package/dist/npm/models/transactions/escrowFinish.js.map +1 -1
- package/dist/npm/models/transactions/index.d.ts +9 -1
- package/dist/npm/models/transactions/index.d.ts.map +1 -1
- package/dist/npm/models/transactions/index.js +3 -1
- package/dist/npm/models/transactions/index.js.map +1 -1
- package/dist/npm/models/transactions/offerCreate.d.ts.map +1 -1
- package/dist/npm/models/transactions/offerCreate.js.map +1 -1
- package/dist/npm/models/transactions/payment.d.ts.map +1 -1
- package/dist/npm/models/transactions/payment.js.map +1 -1
- package/dist/npm/models/transactions/paymentChannelClaim.d.ts.map +1 -1
- package/dist/npm/models/transactions/paymentChannelClaim.js.map +1 -1
- package/dist/npm/models/transactions/paymentChannelCreate.d.ts.map +1 -1
- package/dist/npm/models/transactions/paymentChannelCreate.js.map +1 -1
- package/dist/npm/models/transactions/signerListSet.d.ts.map +1 -1
- package/dist/npm/models/transactions/signerListSet.js.map +1 -1
- package/dist/npm/models/transactions/transaction.d.ts +9 -1
- package/dist/npm/models/transactions/transaction.d.ts.map +1 -1
- package/dist/npm/models/transactions/transaction.js +32 -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 +4 -0
- 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 +126 -0
- package/dist/npm/snippets/src/bridgeTransfer.js.map +1 -0
- package/dist/npm/src/models/common/index.d.ts +8 -1
- package/dist/npm/src/models/common/index.d.ts.map +1 -1
- package/dist/npm/src/models/ledger/AMM.d.ts +5 -3
- package/dist/npm/src/models/ledger/AMM.d.ts.map +1 -1
- package/dist/npm/src/models/ledger/AccountRoot.d.ts +1 -0
- package/dist/npm/src/models/ledger/AccountRoot.d.ts.map +1 -1
- 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 +4 -1
- package/dist/npm/src/models/ledger/LedgerEntry.d.ts.map +1 -1
- package/dist/npm/src/models/ledger/XChainOwnedClaimID.d.ts +26 -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 +23 -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 +5 -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 +4 -3
- package/dist/npm/src/models/methods/ammInfo.d.ts.map +1 -1
- package/dist/npm/src/models/methods/ledgerEntry.d.ts +17 -0
- package/dist/npm/src/models/methods/ledgerEntry.d.ts.map +1 -1
- package/dist/npm/src/models/methods/serverInfo.d.ts +6 -0
- package/dist/npm/src/models/methods/serverInfo.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/AMMBid.d.ts +3 -3
- package/dist/npm/src/models/transactions/AMMBid.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/AMMBid.js.map +1 -1
- package/dist/npm/src/models/transactions/AMMDeposit.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/AMMDeposit.js.map +1 -1
- package/dist/npm/src/models/transactions/AMMWithdraw.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/AMMWithdraw.js.map +1 -1
- 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 +14 -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 +20 -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 +19 -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 +14 -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 +13 -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 +12 -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 +12 -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 +16 -0
- package/dist/npm/src/models/transactions/XChainModifyBridge.js.map +1 -0
- package/dist/npm/src/models/transactions/accountSet.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/accountSet.js.map +1 -1
- package/dist/npm/src/models/transactions/checkCash.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/checkCash.js.map +1 -1
- package/dist/npm/src/models/transactions/checkCreate.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/checkCreate.js.map +1 -1
- package/dist/npm/src/models/transactions/common.d.ts +6 -1
- package/dist/npm/src/models/transactions/common.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/common.js +43 -38
- package/dist/npm/src/models/transactions/common.js.map +1 -1
- package/dist/npm/src/models/transactions/depositPreauth.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/depositPreauth.js.map +1 -1
- package/dist/npm/src/models/transactions/escrowCancel.d.ts +1 -1
- package/dist/npm/src/models/transactions/escrowCancel.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/escrowCancel.js +5 -3
- package/dist/npm/src/models/transactions/escrowCancel.js.map +1 -1
- package/dist/npm/src/models/transactions/escrowCreate.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/escrowCreate.js.map +1 -1
- package/dist/npm/src/models/transactions/escrowFinish.d.ts +1 -1
- package/dist/npm/src/models/transactions/escrowFinish.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/escrowFinish.js +5 -3
- package/dist/npm/src/models/transactions/escrowFinish.js.map +1 -1
- package/dist/npm/src/models/transactions/index.d.ts +9 -1
- package/dist/npm/src/models/transactions/index.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/index.js +3 -1
- package/dist/npm/src/models/transactions/index.js.map +1 -1
- package/dist/npm/src/models/transactions/offerCreate.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/offerCreate.js.map +1 -1
- package/dist/npm/src/models/transactions/payment.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/payment.js.map +1 -1
- package/dist/npm/src/models/transactions/paymentChannelClaim.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/paymentChannelClaim.js.map +1 -1
- package/dist/npm/src/models/transactions/paymentChannelCreate.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/paymentChannelCreate.js.map +1 -1
- package/dist/npm/src/models/transactions/signerListSet.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/signerListSet.js.map +1 -1
- package/dist/npm/src/models/transactions/transaction.d.ts +9 -1
- package/dist/npm/src/models/transactions/transaction.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/transaction.js +32 -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 +4 -0
- 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.map +1 -1
- package/dist/npm/src/utils/getXChainClaimID.d.ts +3 -0
- package/dist/npm/src/utils/getXChainClaimID.d.ts.map +1 -0
- package/dist/npm/src/utils/getXChainClaimID.js +29 -0
- package/dist/npm/src/utils/getXChainClaimID.js.map +1 -0
- package/dist/npm/src/utils/index.d.ts +2 -1
- package/dist/npm/src/utils/index.d.ts.map +1 -1
- package/dist/npm/src/utils/index.js +3 -1
- package/dist/npm/src/utils/index.js.map +1 -1
- package/dist/npm/src/utils/signPaymentChannelClaim.d.ts +1 -1
- package/dist/npm/src/utils/signPaymentChannelClaim.d.ts.map +1 -1
- package/dist/npm/src/utils/signPaymentChannelClaim.js +2 -2
- package/dist/npm/src/utils/signPaymentChannelClaim.js.map +1 -1
- package/dist/npm/src/utils/verifyPaymentChannelClaim.d.ts +1 -1
- package/dist/npm/src/utils/verifyPaymentChannelClaim.d.ts.map +1 -1
- package/dist/npm/src/utils/verifyPaymentChannelClaim.js +2 -2
- package/dist/npm/src/utils/verifyPaymentChannelClaim.js.map +1 -1
- package/dist/npm/sugar/autofill.d.ts.map +1 -1
- package/dist/npm/sugar/autofill.js.map +1 -1
- package/dist/npm/utils/getXChainClaimID.d.ts +3 -0
- package/dist/npm/utils/getXChainClaimID.d.ts.map +1 -0
- package/dist/npm/utils/getXChainClaimID.js +29 -0
- package/dist/npm/utils/getXChainClaimID.js.map +1 -0
- package/dist/npm/utils/index.d.ts +2 -1
- package/dist/npm/utils/index.d.ts.map +1 -1
- package/dist/npm/utils/index.js +3 -1
- package/dist/npm/utils/index.js.map +1 -1
- package/dist/npm/utils/signPaymentChannelClaim.d.ts +1 -1
- package/dist/npm/utils/signPaymentChannelClaim.d.ts.map +1 -1
- package/dist/npm/utils/signPaymentChannelClaim.js +2 -2
- package/dist/npm/utils/signPaymentChannelClaim.js.map +1 -1
- package/dist/npm/utils/verifyPaymentChannelClaim.d.ts +1 -1
- package/dist/npm/utils/verifyPaymentChannelClaim.d.ts.map +1 -1
- package/dist/npm/utils/verifyPaymentChannelClaim.js +2 -2
- package/dist/npm/utils/verifyPaymentChannelClaim.js.map +1 -1
- package/package.json +6 -7
- package/src/models/common/index.ts +9 -1
- package/src/models/ledger/AMM.ts +11 -3
- package/src/models/ledger/AccountRoot.ts +6 -0
- package/src/models/ledger/Bridge.ts +84 -0
- package/src/models/ledger/LedgerEntry.ts +6 -0
- package/src/models/ledger/XChainOwnedClaimID.ts +89 -0
- package/src/models/ledger/XChainOwnedCreateAccountClaimID.ts +74 -0
- package/src/models/ledger/index.ts +9 -0
- package/src/models/methods/accountObjects.ts +12 -0
- package/src/models/methods/ammInfo.ts +8 -3
- package/src/models/methods/ledgerEntry.ts +25 -0
- package/src/models/methods/serverInfo.ts +21 -0
- package/src/models/transactions/AMMBid.ts +5 -6
- package/src/models/transactions/AMMDeposit.ts +0 -1
- package/src/models/transactions/AMMWithdraw.ts +0 -1
- package/src/models/transactions/XChainAccountCreateCommit.ts +69 -0
- package/src/models/transactions/XChainAddAccountCreateAttestation.ts +121 -0
- package/src/models/transactions/XChainAddClaimAttestation.ts +115 -0
- package/src/models/transactions/XChainClaim.ts +77 -0
- package/src/models/transactions/XChainCommit.ts +74 -0
- package/src/models/transactions/XChainCreateBridge.ts +56 -0
- package/src/models/transactions/XChainCreateClaimID.ts +53 -0
- package/src/models/transactions/XChainModifyBridge.ts +77 -0
- package/src/models/transactions/accountSet.ts +0 -2
- package/src/models/transactions/checkCash.ts +0 -1
- package/src/models/transactions/checkCreate.ts +0 -1
- package/src/models/transactions/common.ts +108 -54
- package/src/models/transactions/depositPreauth.ts +0 -1
- package/src/models/transactions/escrowCancel.ts +8 -4
- package/src/models/transactions/escrowCreate.ts +0 -1
- package/src/models/transactions/escrowFinish.ts +8 -4
- package/src/models/transactions/index.ts +13 -1
- package/src/models/transactions/offerCreate.ts +0 -1
- package/src/models/transactions/payment.ts +0 -1
- package/src/models/transactions/paymentChannelClaim.ts +0 -1
- package/src/models/transactions/paymentChannelCreate.ts +0 -1
- package/src/models/transactions/signerListSet.ts +0 -1
- package/src/models/transactions/transaction.ts +67 -1
- package/src/models/utils/flags.ts +4 -0
- package/src/sugar/autofill.ts +0 -2
- package/src/utils/getXChainClaimID.ts +64 -0
- package/src/utils/index.ts +2 -0
- package/src/utils/signPaymentChannelClaim.ts +3 -3
- package/src/utils/verifyPaymentChannelClaim.ts +3 -3
- package/dist/npm/snippets/tsconfig.tsbuildinfo +0 -1
@@ -1,10 +1,14 @@
|
|
1
|
-
/* eslint-disable max-lines-per-function -- Necessary for validateBaseTransaction */
|
2
|
-
/* eslint-disable complexity -- Necessary for validateBaseTransaction */
|
3
|
-
/* eslint-disable max-statements -- Necessary for validateBaseTransaction */
|
4
1
|
import { TRANSACTION_TYPES } from 'ripple-binary-codec'
|
5
2
|
|
6
3
|
import { ValidationError } from '../../errors'
|
7
|
-
import {
|
4
|
+
import {
|
5
|
+
Amount,
|
6
|
+
Currency,
|
7
|
+
IssuedCurrencyAmount,
|
8
|
+
Memo,
|
9
|
+
Signer,
|
10
|
+
XChainBridge,
|
11
|
+
} from '../common'
|
8
12
|
import { onlyHasFields } from '../utils'
|
9
13
|
|
10
14
|
const MEMO_SIZE = 3
|
@@ -53,11 +57,32 @@ function isSigner(obj: unknown): boolean {
|
|
53
57
|
const XRP_CURRENCY_SIZE = 1
|
54
58
|
const ISSUE_SIZE = 2
|
55
59
|
const ISSUED_CURRENCY_SIZE = 3
|
60
|
+
const XCHAIN_BRIDGE_SIZE = 4
|
56
61
|
|
57
62
|
function isRecord(value: unknown): value is Record<string, unknown> {
|
58
63
|
return value !== null && typeof value === 'object'
|
59
64
|
}
|
60
65
|
|
66
|
+
/**
|
67
|
+
* Verify the form and type of a string at runtime.
|
68
|
+
*
|
69
|
+
* @param str - The object to check the form and type of.
|
70
|
+
* @returns Whether the string is properly formed.
|
71
|
+
*/
|
72
|
+
export function isString(str: unknown): str is string {
|
73
|
+
return typeof str === 'string'
|
74
|
+
}
|
75
|
+
|
76
|
+
/**
|
77
|
+
* Verify the form and type of a number at runtime.
|
78
|
+
*
|
79
|
+
* @param num - The object to check the form and type of.
|
80
|
+
* @returns Whether the number is properly formed.
|
81
|
+
*/
|
82
|
+
export function isNumber(num: unknown): num is number {
|
83
|
+
return typeof num === 'number'
|
84
|
+
}
|
85
|
+
|
61
86
|
/**
|
62
87
|
* Verify the form and type of an IssuedCurrency at runtime.
|
63
88
|
*
|
@@ -103,6 +128,73 @@ export function isAmount(amount: unknown): amount is Amount {
|
|
103
128
|
return typeof amount === 'string' || isIssuedCurrency(amount)
|
104
129
|
}
|
105
130
|
|
131
|
+
/**
|
132
|
+
* Verify the form and type of an XChainBridge at runtime.
|
133
|
+
*
|
134
|
+
* @param input - The input to check the form and type of.
|
135
|
+
* @returns Whether the XChainBridge is properly formed.
|
136
|
+
*/
|
137
|
+
export function isXChainBridge(input: unknown): input is XChainBridge {
|
138
|
+
return (
|
139
|
+
isRecord(input) &&
|
140
|
+
Object.keys(input).length === XCHAIN_BRIDGE_SIZE &&
|
141
|
+
typeof input.LockingChainDoor === 'string' &&
|
142
|
+
isCurrency(input.LockingChainIssue) &&
|
143
|
+
typeof input.IssuingChainDoor === 'string' &&
|
144
|
+
isCurrency(input.IssuingChainIssue)
|
145
|
+
)
|
146
|
+
}
|
147
|
+
|
148
|
+
/* eslint-disable @typescript-eslint/restrict-template-expressions -- tx.TransactionType is checked before any calls */
|
149
|
+
|
150
|
+
/**
|
151
|
+
* Verify the form and type of a required type for a transaction at runtime.
|
152
|
+
*
|
153
|
+
* @param tx - The transaction input to check the form and type of.
|
154
|
+
* @param paramName - The name of the transaction parameter.
|
155
|
+
* @param checkValidity - The function to use to check the type.
|
156
|
+
* @throws
|
157
|
+
*/
|
158
|
+
export function validateRequiredField(
|
159
|
+
tx: Record<string, unknown>,
|
160
|
+
paramName: string,
|
161
|
+
checkValidity: (inp: unknown) => boolean,
|
162
|
+
): void {
|
163
|
+
if (tx[paramName] == null) {
|
164
|
+
throw new ValidationError(
|
165
|
+
`${tx.TransactionType}: missing field ${paramName}`,
|
166
|
+
)
|
167
|
+
}
|
168
|
+
|
169
|
+
if (!checkValidity(tx[paramName])) {
|
170
|
+
throw new ValidationError(
|
171
|
+
`${tx.TransactionType}: invalid field ${paramName}`,
|
172
|
+
)
|
173
|
+
}
|
174
|
+
}
|
175
|
+
|
176
|
+
/**
|
177
|
+
* Verify the form and type of an optional type for a transaction at runtime.
|
178
|
+
*
|
179
|
+
* @param tx - The transaction input to check the form and type of.
|
180
|
+
* @param paramName - The name of the transaction parameter.
|
181
|
+
* @param checkValidity - The function to use to check the type.
|
182
|
+
* @throws
|
183
|
+
*/
|
184
|
+
export function validateOptionalField(
|
185
|
+
tx: Record<string, unknown>,
|
186
|
+
paramName: string,
|
187
|
+
checkValidity: (inp: unknown) => boolean,
|
188
|
+
): void {
|
189
|
+
if (tx[paramName] !== undefined && !checkValidity(tx[paramName])) {
|
190
|
+
throw new ValidationError(
|
191
|
+
`${tx.TransactionType}: invalid field ${paramName}`,
|
192
|
+
)
|
193
|
+
}
|
194
|
+
}
|
195
|
+
|
196
|
+
/* eslint-enable @typescript-eslint/restrict-template-expressions -- checked before */
|
197
|
+
|
106
198
|
// eslint-disable-next-line @typescript-eslint/no-empty-interface -- no global flags right now, so this is fine
|
107
199
|
export interface GlobalFlags {}
|
108
200
|
|
@@ -191,14 +283,6 @@ export interface BaseTransaction {
|
|
191
283
|
* @throws When the common param is malformed.
|
192
284
|
*/
|
193
285
|
export function validateBaseTransaction(common: Record<string, unknown>): void {
|
194
|
-
if (common.Account === undefined) {
|
195
|
-
throw new ValidationError('BaseTransaction: missing field Account')
|
196
|
-
}
|
197
|
-
|
198
|
-
if (typeof common.Account !== 'string') {
|
199
|
-
throw new ValidationError('BaseTransaction: Account not string')
|
200
|
-
}
|
201
|
-
|
202
286
|
if (common.TransactionType === undefined) {
|
203
287
|
throw new ValidationError('BaseTransaction: missing field TransactionType')
|
204
288
|
}
|
@@ -211,27 +295,15 @@ export function validateBaseTransaction(common: Record<string, unknown>): void {
|
|
211
295
|
throw new ValidationError('BaseTransaction: Unknown TransactionType')
|
212
296
|
}
|
213
297
|
|
214
|
-
|
215
|
-
throw new ValidationError('BaseTransaction: invalid Fee')
|
216
|
-
}
|
298
|
+
validateRequiredField(common, 'Account', isString)
|
217
299
|
|
218
|
-
|
219
|
-
throw new ValidationError('BaseTransaction: invalid Sequence')
|
220
|
-
}
|
300
|
+
validateOptionalField(common, 'Fee', isString)
|
221
301
|
|
222
|
-
|
223
|
-
common.AccountTxnID !== undefined &&
|
224
|
-
typeof common.AccountTxnID !== 'string'
|
225
|
-
) {
|
226
|
-
throw new ValidationError('BaseTransaction: invalid AccountTxnID')
|
227
|
-
}
|
302
|
+
validateOptionalField(common, 'Sequence', isNumber)
|
228
303
|
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
) {
|
233
|
-
throw new ValidationError('BaseTransaction: invalid LastLedgerSequence')
|
234
|
-
}
|
304
|
+
validateOptionalField(common, 'AccountTxnID', isString)
|
305
|
+
|
306
|
+
validateOptionalField(common, 'LastLedgerSequence', isNumber)
|
235
307
|
|
236
308
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- Only used by JS
|
237
309
|
const memos = common.Memos as Array<{ Memo?: unknown }> | undefined
|
@@ -249,33 +321,15 @@ export function validateBaseTransaction(common: Record<string, unknown>): void {
|
|
249
321
|
throw new ValidationError('BaseTransaction: invalid Signers')
|
250
322
|
}
|
251
323
|
|
252
|
-
|
253
|
-
throw new ValidationError('BaseTransaction: invalid SourceTag')
|
254
|
-
}
|
324
|
+
validateOptionalField(common, 'SourceTag', isNumber)
|
255
325
|
|
256
|
-
|
257
|
-
common.SigningPubKey !== undefined &&
|
258
|
-
typeof common.SigningPubKey !== 'string'
|
259
|
-
) {
|
260
|
-
throw new ValidationError('BaseTransaction: invalid SigningPubKey')
|
261
|
-
}
|
326
|
+
validateOptionalField(common, 'SigningPubKey', isString)
|
262
327
|
|
263
|
-
|
264
|
-
common.TicketSequence !== undefined &&
|
265
|
-
typeof common.TicketSequence !== 'number'
|
266
|
-
) {
|
267
|
-
throw new ValidationError('BaseTransaction: invalid TicketSequence')
|
268
|
-
}
|
328
|
+
validateOptionalField(common, 'TicketSequence', isNumber)
|
269
329
|
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
) {
|
274
|
-
throw new ValidationError('BaseTransaction: invalid TxnSignature')
|
275
|
-
}
|
276
|
-
if (common.NetworkID !== undefined && typeof common.NetworkID !== 'number') {
|
277
|
-
throw new ValidationError('BaseTransaction: invalid NetworkID')
|
278
|
-
}
|
330
|
+
validateOptionalField(common, 'TxnSignature', isString)
|
331
|
+
|
332
|
+
validateOptionalField(common, 'NetworkID', isNumber)
|
279
333
|
}
|
280
334
|
|
281
335
|
/**
|
@@ -15,7 +15,7 @@ export interface EscrowCancel extends BaseTransaction {
|
|
15
15
|
* Transaction sequence (or Ticket number) of EscrowCreate transaction that.
|
16
16
|
* created the escrow to cancel.
|
17
17
|
*/
|
18
|
-
OfferSequence: number
|
18
|
+
OfferSequence: number | string
|
19
19
|
}
|
20
20
|
|
21
21
|
/**
|
@@ -27,7 +27,7 @@ export interface EscrowCancel extends BaseTransaction {
|
|
27
27
|
export function validateEscrowCancel(tx: Record<string, unknown>): void {
|
28
28
|
validateBaseTransaction(tx)
|
29
29
|
|
30
|
-
if (tx.Owner
|
30
|
+
if (tx.Owner == null) {
|
31
31
|
throw new ValidationError('EscrowCancel: missing Owner')
|
32
32
|
}
|
33
33
|
|
@@ -35,11 +35,15 @@ export function validateEscrowCancel(tx: Record<string, unknown>): void {
|
|
35
35
|
throw new ValidationError('EscrowCancel: Owner must be a string')
|
36
36
|
}
|
37
37
|
|
38
|
-
if (tx.OfferSequence
|
38
|
+
if (tx.OfferSequence == null) {
|
39
39
|
throw new ValidationError('EscrowCancel: missing OfferSequence')
|
40
40
|
}
|
41
41
|
|
42
|
-
if (
|
42
|
+
if (
|
43
|
+
(typeof tx.OfferSequence !== 'number' &&
|
44
|
+
typeof tx.OfferSequence !== 'string') ||
|
45
|
+
Number.isNaN(Number(tx.OfferSequence))
|
46
|
+
) {
|
43
47
|
throw new ValidationError('EscrowCancel: OfferSequence must be a number')
|
44
48
|
}
|
45
49
|
}
|
@@ -15,7 +15,7 @@ export interface EscrowFinish extends BaseTransaction {
|
|
15
15
|
* Transaction sequence of EscrowCreate transaction that created the held.
|
16
16
|
* payment to finish.
|
17
17
|
*/
|
18
|
-
OfferSequence: number
|
18
|
+
OfferSequence: number | string
|
19
19
|
/**
|
20
20
|
* Hex value matching the previously-supplied PREIMAGE-SHA-256.
|
21
21
|
* crypto-condition of the held payment.
|
@@ -37,7 +37,7 @@ export interface EscrowFinish extends BaseTransaction {
|
|
37
37
|
export function validateEscrowFinish(tx: Record<string, unknown>): void {
|
38
38
|
validateBaseTransaction(tx)
|
39
39
|
|
40
|
-
if (tx.Owner
|
40
|
+
if (tx.Owner == null) {
|
41
41
|
throw new ValidationError('EscrowFinish: missing field Owner')
|
42
42
|
}
|
43
43
|
|
@@ -45,11 +45,15 @@ export function validateEscrowFinish(tx: Record<string, unknown>): void {
|
|
45
45
|
throw new ValidationError('EscrowFinish: Owner must be a string')
|
46
46
|
}
|
47
47
|
|
48
|
-
if (tx.OfferSequence
|
48
|
+
if (tx.OfferSequence == null) {
|
49
49
|
throw new ValidationError('EscrowFinish: missing field OfferSequence')
|
50
50
|
}
|
51
51
|
|
52
|
-
if (
|
52
|
+
if (
|
53
|
+
(typeof tx.OfferSequence !== 'number' &&
|
54
|
+
typeof tx.OfferSequence !== 'string') ||
|
55
|
+
Number.isNaN(Number(tx.OfferSequence))
|
56
|
+
) {
|
53
57
|
throw new ValidationError('EscrowFinish: OfferSequence must be a number')
|
54
58
|
}
|
55
59
|
|
@@ -25,6 +25,7 @@ export {
|
|
25
25
|
export { CheckCancel } from './checkCancel'
|
26
26
|
export { CheckCash } from './checkCash'
|
27
27
|
export { CheckCreate } from './checkCreate'
|
28
|
+
export { Clawback } from './clawback'
|
28
29
|
export { DepositPreauth } from './depositPreauth'
|
29
30
|
export { EscrowCancel } from './escrowCancel'
|
30
31
|
export { EscrowCreate } from './escrowCreate'
|
@@ -63,4 +64,15 @@ export { SignerListSet } from './signerListSet'
|
|
63
64
|
export { TicketCreate } from './ticketCreate'
|
64
65
|
export { TrustSetFlagsInterface, TrustSetFlags, TrustSet } from './trustSet'
|
65
66
|
export { UNLModify } from './UNLModify'
|
66
|
-
export {
|
67
|
+
export { XChainAddAccountCreateAttestation } from './XChainAddAccountCreateAttestation'
|
68
|
+
export { XChainAddClaimAttestation } from './XChainAddClaimAttestation'
|
69
|
+
export { XChainClaim } from './XChainClaim'
|
70
|
+
export { XChainCommit } from './XChainCommit'
|
71
|
+
export { XChainCreateBridge } from './XChainCreateBridge'
|
72
|
+
export { XChainCreateClaimID } from './XChainCreateClaimID'
|
73
|
+
export { XChainAccountCreateCommit } from './XChainAccountCreateCommit'
|
74
|
+
export {
|
75
|
+
XChainModifyBridge,
|
76
|
+
XChainModifyBridgeFlags,
|
77
|
+
XChainModifyBridgeFlagsInterface,
|
78
|
+
} from './XChainModifyBridge'
|
@@ -36,7 +36,6 @@ const HEX_WALLET_LOCATOR_REGEX = /^[0-9A-Fa-f]{64}$/u
|
|
36
36
|
* @param tx - An SignerListSet Transaction.
|
37
37
|
* @throws When the SignerListSet is Malformed.
|
38
38
|
*/
|
39
|
-
// eslint-disable-next-line complexity -- validation can be complex
|
40
39
|
export function validateSignerListSet(tx: Record<string, unknown>): void {
|
41
40
|
validateBaseTransaction(tx)
|
42
41
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
/* eslint-disable
|
1
|
+
/* eslint-disable max-lines -- need to work with a lot of transactions in a switch statement */
|
2
2
|
/* eslint-disable max-lines-per-function -- need to work with a lot of Tx verifications */
|
3
3
|
|
4
4
|
import { ValidationError } from '../../errors'
|
@@ -57,6 +57,32 @@ import { SetRegularKey, validateSetRegularKey } from './setRegularKey'
|
|
57
57
|
import { SignerListSet, validateSignerListSet } from './signerListSet'
|
58
58
|
import { TicketCreate, validateTicketCreate } from './ticketCreate'
|
59
59
|
import { TrustSet, validateTrustSet } from './trustSet'
|
60
|
+
import {
|
61
|
+
XChainAccountCreateCommit,
|
62
|
+
validateXChainAccountCreateCommit,
|
63
|
+
} from './XChainAccountCreateCommit'
|
64
|
+
import {
|
65
|
+
XChainAddAccountCreateAttestation,
|
66
|
+
validateXChainAddAccountCreateAttestation,
|
67
|
+
} from './XChainAddAccountCreateAttestation'
|
68
|
+
import {
|
69
|
+
XChainAddClaimAttestation,
|
70
|
+
validateXChainAddClaimAttestation,
|
71
|
+
} from './XChainAddClaimAttestation'
|
72
|
+
import { XChainClaim, validateXChainClaim } from './XChainClaim'
|
73
|
+
import { XChainCommit, validateXChainCommit } from './XChainCommit'
|
74
|
+
import {
|
75
|
+
XChainCreateBridge,
|
76
|
+
validateXChainCreateBridge,
|
77
|
+
} from './XChainCreateBridge'
|
78
|
+
import {
|
79
|
+
XChainCreateClaimID,
|
80
|
+
validateXChainCreateClaimID,
|
81
|
+
} from './XChainCreateClaimID'
|
82
|
+
import {
|
83
|
+
XChainModifyBridge,
|
84
|
+
validateXChainModifyBridge,
|
85
|
+
} from './XChainModifyBridge'
|
60
86
|
|
61
87
|
/**
|
62
88
|
* @category Transaction Models
|
@@ -93,6 +119,14 @@ export type Transaction =
|
|
93
119
|
| SignerListSet
|
94
120
|
| TicketCreate
|
95
121
|
| TrustSet
|
122
|
+
| XChainAddAccountCreateAttestation
|
123
|
+
| XChainAddClaimAttestation
|
124
|
+
| XChainClaim
|
125
|
+
| XChainCommit
|
126
|
+
| XChainCreateBridge
|
127
|
+
| XChainCreateClaimID
|
128
|
+
| XChainAccountCreateCommit
|
129
|
+
| XChainModifyBridge
|
96
130
|
|
97
131
|
/**
|
98
132
|
* @category Transaction Models
|
@@ -295,6 +329,38 @@ export function validate(transaction: Record<string, unknown>): void {
|
|
295
329
|
validateTrustSet(tx)
|
296
330
|
break
|
297
331
|
|
332
|
+
case 'XChainAddAccountCreateAttestation':
|
333
|
+
validateXChainAddAccountCreateAttestation(tx)
|
334
|
+
break
|
335
|
+
|
336
|
+
case 'XChainAddClaimAttestation':
|
337
|
+
validateXChainAddClaimAttestation(tx)
|
338
|
+
break
|
339
|
+
|
340
|
+
case 'XChainClaim':
|
341
|
+
validateXChainClaim(tx)
|
342
|
+
break
|
343
|
+
|
344
|
+
case 'XChainCommit':
|
345
|
+
validateXChainCommit(tx)
|
346
|
+
break
|
347
|
+
|
348
|
+
case 'XChainCreateBridge':
|
349
|
+
validateXChainCreateBridge(tx)
|
350
|
+
break
|
351
|
+
|
352
|
+
case 'XChainCreateClaimID':
|
353
|
+
validateXChainCreateClaimID(tx)
|
354
|
+
break
|
355
|
+
|
356
|
+
case 'XChainAccountCreateCommit':
|
357
|
+
validateXChainAccountCreateCommit(tx)
|
358
|
+
break
|
359
|
+
|
360
|
+
case 'XChainModifyBridge':
|
361
|
+
validateXChainModifyBridge(tx)
|
362
|
+
break
|
363
|
+
|
298
364
|
default:
|
299
365
|
throw new ValidationError(
|
300
366
|
`Invalid field TransactionType: ${tx.TransactionType}`,
|
@@ -15,6 +15,7 @@ import { PaymentFlags } from '../transactions/payment'
|
|
15
15
|
import { PaymentChannelClaimFlags } from '../transactions/paymentChannelClaim'
|
16
16
|
import type { Transaction } from '../transactions/transaction'
|
17
17
|
import { TrustSetFlags } from '../transactions/trustSet'
|
18
|
+
import { XChainModifyBridgeFlags } from '../transactions/XChainModifyBridge'
|
18
19
|
|
19
20
|
import { isFlagEnabled } from '.'
|
20
21
|
|
@@ -78,6 +79,9 @@ export function setTransactionFlagsToNumber(tx: Transaction): void {
|
|
78
79
|
case 'TrustSet':
|
79
80
|
tx.Flags = convertFlagsToNumber(tx.Flags, TrustSetFlags)
|
80
81
|
return
|
82
|
+
case 'XChainModifyBridge':
|
83
|
+
tx.Flags = convertFlagsToNumber(tx.Flags, XChainModifyBridgeFlags)
|
84
|
+
return
|
81
85
|
default:
|
82
86
|
tx.Flags = 0
|
83
87
|
}
|
package/src/sugar/autofill.ts
CHANGED
@@ -176,8 +176,6 @@ function txNeedsNetworkID(client: Client): boolean {
|
|
176
176
|
client.networkID !== undefined &&
|
177
177
|
client.networkID > RESTRICTED_NETWORKS
|
178
178
|
) {
|
179
|
-
// TODO: remove the buildVersion logic when 1.11.0 is out and widely used.
|
180
|
-
// Issue: https://github.com/XRPLF/xrpl.js/issues/2339
|
181
179
|
if (
|
182
180
|
(client.buildVersion &&
|
183
181
|
isNotLaterRippledVersion(
|
@@ -0,0 +1,64 @@
|
|
1
|
+
import { decode } from 'ripple-binary-codec'
|
2
|
+
|
3
|
+
import {
|
4
|
+
CreatedNode,
|
5
|
+
isCreatedNode,
|
6
|
+
TransactionMetadata,
|
7
|
+
} from '../models/transactions/metadata'
|
8
|
+
|
9
|
+
/**
|
10
|
+
* Ensures that the metadata is in a deserialized format to parse.
|
11
|
+
*
|
12
|
+
* @param meta - the metadata from a `tx` method call. Can be in json format or binary format.
|
13
|
+
* @returns the metadata in a deserialized format.
|
14
|
+
*/
|
15
|
+
function ensureDecodedMeta(
|
16
|
+
meta: TransactionMetadata | string,
|
17
|
+
): TransactionMetadata {
|
18
|
+
if (typeof meta === 'string') {
|
19
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- Meta is either metadata or serialized metadata.
|
20
|
+
return decode(meta) as unknown as TransactionMetadata
|
21
|
+
}
|
22
|
+
return meta
|
23
|
+
}
|
24
|
+
|
25
|
+
/**
|
26
|
+
* Gets the XChainClaimID value from the metadata of an `XChainCreateClaimID` transaction.
|
27
|
+
*
|
28
|
+
* @param meta - Metadata from the response to submitting and waiting for an XChainCreateClaimID transaction
|
29
|
+
* or from a `tx` method call.
|
30
|
+
* @returns The XChainClaimID for the minted NFT.
|
31
|
+
* @throws if meta is not TransactionMetadata.
|
32
|
+
*/
|
33
|
+
export default function getXChainClaimID(
|
34
|
+
meta: TransactionMetadata | string | undefined,
|
35
|
+
): string | undefined {
|
36
|
+
if (typeof meta !== 'string' && meta?.AffectedNodes === undefined) {
|
37
|
+
throw new TypeError(`Unable to parse the parameter given to getXChainClaimID.
|
38
|
+
'meta' must be the metadata from an XChainCreateClaimID transaction. Received ${JSON.stringify(
|
39
|
+
meta,
|
40
|
+
)} instead.`)
|
41
|
+
}
|
42
|
+
|
43
|
+
const decodedMeta = ensureDecodedMeta(meta)
|
44
|
+
|
45
|
+
if (!decodedMeta.TransactionResult) {
|
46
|
+
throw new TypeError(
|
47
|
+
'Cannot get XChainClaimID from un-validated transaction',
|
48
|
+
)
|
49
|
+
}
|
50
|
+
|
51
|
+
if (decodedMeta.TransactionResult !== 'tesSUCCESS') {
|
52
|
+
return undefined
|
53
|
+
}
|
54
|
+
|
55
|
+
const createdNode = decodedMeta.AffectedNodes.find(
|
56
|
+
(node) =>
|
57
|
+
isCreatedNode(node) &&
|
58
|
+
node.CreatedNode.LedgerEntryType === 'XChainOwnedClaimID',
|
59
|
+
)
|
60
|
+
|
61
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- necessary here
|
62
|
+
return (createdNode as CreatedNode).CreatedNode.NewFields
|
63
|
+
.XChainClaimID as string
|
64
|
+
}
|
package/src/utils/index.ts
CHANGED
@@ -25,6 +25,7 @@ import { Transaction } from '../models/transactions/transaction'
|
|
25
25
|
import { deriveKeypair, deriveAddress, deriveXAddress } from './derive'
|
26
26
|
import getBalanceChanges from './getBalanceChanges'
|
27
27
|
import getNFTokenID from './getNFTokenID'
|
28
|
+
import getXChainClaimID from './getXChainClaimID'
|
28
29
|
import {
|
29
30
|
hashSignedTx,
|
30
31
|
hashTx,
|
@@ -220,4 +221,5 @@ export {
|
|
220
221
|
encodeForSigningClaim,
|
221
222
|
getNFTokenID,
|
222
223
|
parseNFTokenID,
|
224
|
+
getXChainClaimID,
|
223
225
|
}
|
@@ -7,19 +7,19 @@ import { xrpToDrops } from './xrpConversion'
|
|
7
7
|
* Sign a payment channel claim.
|
8
8
|
*
|
9
9
|
* @param channel - Channel identifier specified by the paymentChannelClaim.
|
10
|
-
* @param
|
10
|
+
* @param xrpAmount - XRP Amount specified by the paymentChannelClaim.
|
11
11
|
* @param privateKey - Private Key to sign paymentChannelClaim with.
|
12
12
|
* @returns True if the channel is valid.
|
13
13
|
* @category Utilities
|
14
14
|
*/
|
15
15
|
function signPaymentChannelClaim(
|
16
16
|
channel: string,
|
17
|
-
|
17
|
+
xrpAmount: string,
|
18
18
|
privateKey: string,
|
19
19
|
): string {
|
20
20
|
const signingData = encodeForSigningClaim({
|
21
21
|
channel,
|
22
|
-
amount: xrpToDrops(
|
22
|
+
amount: xrpToDrops(xrpAmount),
|
23
23
|
})
|
24
24
|
return sign(signingData, privateKey)
|
25
25
|
}
|
@@ -7,7 +7,7 @@ import { xrpToDrops } from './xrpConversion'
|
|
7
7
|
* Verify the signature of a payment channel claim.
|
8
8
|
*
|
9
9
|
* @param channel - Channel identifier specified by the paymentChannelClaim.
|
10
|
-
* @param
|
10
|
+
* @param xrpAmount - XRP Amount specified by the paymentChannelClaim.
|
11
11
|
* @param signature - Signature produced from signing paymentChannelClaim.
|
12
12
|
* @param publicKey - Public key that signed the paymentChannelClaim.
|
13
13
|
* @returns True if the channel is valid.
|
@@ -16,13 +16,13 @@ import { xrpToDrops } from './xrpConversion'
|
|
16
16
|
// eslint-disable-next-line max-params -- Needs 4 params
|
17
17
|
function verifyPaymentChannelClaim(
|
18
18
|
channel: string,
|
19
|
-
|
19
|
+
xrpAmount: string,
|
20
20
|
signature: string,
|
21
21
|
publicKey: string,
|
22
22
|
): boolean {
|
23
23
|
const signingData = encodeForSigningClaim({
|
24
24
|
channel,
|
25
|
-
amount: xrpToDrops(
|
25
|
+
amount: xrpToDrops(xrpAmount),
|
26
26
|
})
|
27
27
|
return verify(signingData, signature, publicKey)
|
28
28
|
}
|