xrpl 4.3.0 → 4.4.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 +1609 -1773
- package/build/xrpl-latest.js.map +1 -1
- package/dist/npm/client/index.d.ts +3 -3
- package/dist/npm/client/index.d.ts.map +1 -1
- package/dist/npm/client/index.js +10 -7
- package/dist/npm/client/index.js.map +1 -1
- package/dist/npm/client/partialPayment.d.ts.map +1 -1
- package/dist/npm/client/partialPayment.js +2 -2
- package/dist/npm/client/partialPayment.js.map +1 -1
- package/dist/npm/models/common/index.d.ts +17 -0
- package/dist/npm/models/common/index.d.ts.map +1 -1
- package/dist/npm/models/ledger/AccountRoot.d.ts +4 -2
- 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/DirectoryNode.d.ts +1 -0
- package/dist/npm/models/ledger/DirectoryNode.d.ts.map +1 -1
- package/dist/npm/models/ledger/Escrow.d.ts +2 -0
- package/dist/npm/models/ledger/Escrow.d.ts.map +1 -1
- package/dist/npm/models/ledger/LedgerEntry.d.ts +3 -2
- package/dist/npm/models/ledger/LedgerEntry.d.ts.map +1 -1
- package/dist/npm/models/ledger/MPToken.d.ts +1 -0
- package/dist/npm/models/ledger/MPToken.d.ts.map +1 -1
- package/dist/npm/models/ledger/MPTokenIssuance.d.ts +1 -0
- package/dist/npm/models/ledger/MPTokenIssuance.d.ts.map +1 -1
- package/dist/npm/models/ledger/Offer.d.ts +10 -1
- package/dist/npm/models/ledger/Offer.d.ts.map +1 -1
- package/dist/npm/models/ledger/Offer.js +1 -0
- package/dist/npm/models/ledger/Offer.js.map +1 -1
- package/dist/npm/models/ledger/Vault.d.ts +21 -0
- package/dist/npm/models/ledger/Vault.d.ts.map +1 -0
- package/dist/npm/models/ledger/Vault.js +3 -0
- package/dist/npm/models/ledger/Vault.js.map +1 -0
- package/dist/npm/models/ledger/index.d.ts +2 -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/bookOffers.d.ts +1 -0
- package/dist/npm/models/methods/bookOffers.d.ts.map +1 -1
- package/dist/npm/models/methods/index.d.ts +5 -4
- package/dist/npm/models/methods/index.d.ts.map +1 -1
- package/dist/npm/models/methods/pathFind.d.ts +2 -0
- package/dist/npm/models/methods/pathFind.d.ts.map +1 -1
- package/dist/npm/models/methods/ripplePathFind.d.ts +1 -0
- package/dist/npm/models/methods/ripplePathFind.d.ts.map +1 -1
- package/dist/npm/models/methods/subscribe.d.ts +4 -0
- package/dist/npm/models/methods/subscribe.d.ts.map +1 -1
- package/dist/npm/models/methods/vaultInfo.d.ts +46 -0
- package/dist/npm/models/methods/vaultInfo.d.ts.map +1 -0
- package/dist/npm/models/methods/vaultInfo.js +3 -0
- package/dist/npm/models/methods/vaultInfo.js.map +1 -0
- package/dist/npm/models/transactions/AMMBid.d.ts.map +1 -1
- package/dist/npm/models/transactions/AMMBid.js +7 -5
- package/dist/npm/models/transactions/AMMBid.js.map +1 -1
- package/dist/npm/models/transactions/AMMClawback.d.ts.map +1 -1
- package/dist/npm/models/transactions/AMMClawback.js +5 -6
- package/dist/npm/models/transactions/AMMClawback.js.map +1 -1
- package/dist/npm/models/transactions/AMMDelete.d.ts.map +1 -1
- package/dist/npm/models/transactions/AMMDelete.js +2 -2
- package/dist/npm/models/transactions/AMMDelete.js.map +1 -1
- package/dist/npm/models/transactions/AMMDeposit.js +3 -3
- package/dist/npm/models/transactions/AMMDeposit.js.map +1 -1
- package/dist/npm/models/transactions/AMMVote.d.ts.map +1 -1
- package/dist/npm/models/transactions/AMMVote.js +2 -2
- package/dist/npm/models/transactions/AMMVote.js.map +1 -1
- package/dist/npm/models/transactions/AMMWithdraw.js +3 -3
- package/dist/npm/models/transactions/AMMWithdraw.js.map +1 -1
- package/dist/npm/models/transactions/MPTokenIssuanceCreate.d.ts +1 -1
- package/dist/npm/models/transactions/MPTokenIssuanceCreate.d.ts.map +1 -1
- package/dist/npm/models/transactions/MPTokenIssuanceCreate.js +17 -8
- package/dist/npm/models/transactions/MPTokenIssuanceCreate.js.map +1 -1
- package/dist/npm/models/transactions/MPTokenIssuanceSet.js +4 -4
- package/dist/npm/models/transactions/MPTokenIssuanceSet.js.map +1 -1
- package/dist/npm/models/transactions/NFTokenCancelOffer.d.ts.map +1 -1
- package/dist/npm/models/transactions/NFTokenCancelOffer.js +1 -1
- package/dist/npm/models/transactions/NFTokenCancelOffer.js.map +1 -1
- package/dist/npm/models/transactions/NFTokenCreateOffer.d.ts.map +1 -1
- package/dist/npm/models/transactions/NFTokenCreateOffer.js +6 -2
- package/dist/npm/models/transactions/NFTokenCreateOffer.js.map +1 -1
- package/dist/npm/models/transactions/accountSet.d.ts +2 -1
- package/dist/npm/models/transactions/accountSet.d.ts.map +1 -1
- package/dist/npm/models/transactions/accountSet.js +1 -0
- package/dist/npm/models/transactions/accountSet.js.map +1 -1
- package/dist/npm/models/transactions/checkCreate.d.ts.map +1 -1
- package/dist/npm/models/transactions/checkCreate.js +1 -2
- package/dist/npm/models/transactions/checkCreate.js.map +1 -1
- package/dist/npm/models/transactions/clawback.d.ts +2 -2
- package/dist/npm/models/transactions/clawback.d.ts.map +1 -1
- package/dist/npm/models/transactions/clawback.js +4 -6
- package/dist/npm/models/transactions/clawback.js.map +1 -1
- package/dist/npm/models/transactions/common.d.ts +13 -4
- package/dist/npm/models/transactions/common.d.ts.map +1 -1
- package/dist/npm/models/transactions/common.js +184 -28
- package/dist/npm/models/transactions/common.js.map +1 -1
- package/dist/npm/models/transactions/escrowCreate.d.ts +2 -1
- package/dist/npm/models/transactions/escrowCreate.d.ts.map +1 -1
- package/dist/npm/models/transactions/escrowCreate.js +1 -6
- package/dist/npm/models/transactions/escrowCreate.js.map +1 -1
- package/dist/npm/models/transactions/index.d.ts +9 -3
- package/dist/npm/models/transactions/index.d.ts.map +1 -1
- package/dist/npm/models/transactions/index.js +5 -1
- package/dist/npm/models/transactions/index.js.map +1 -1
- package/dist/npm/models/transactions/offerCreate.d.ts +4 -1
- package/dist/npm/models/transactions/offerCreate.d.ts.map +1 -1
- package/dist/npm/models/transactions/offerCreate.js +10 -0
- package/dist/npm/models/transactions/offerCreate.js.map +1 -1
- package/dist/npm/models/transactions/oracleSet.d.ts.map +1 -1
- package/dist/npm/models/transactions/oracleSet.js +22 -21
- package/dist/npm/models/transactions/oracleSet.js.map +1 -1
- package/dist/npm/models/transactions/payment.d.ts +2 -0
- package/dist/npm/models/transactions/payment.d.ts.map +1 -1
- package/dist/npm/models/transactions/payment.js +7 -4
- package/dist/npm/models/transactions/payment.js.map +1 -1
- package/dist/npm/models/transactions/signerListSet.d.ts.map +1 -1
- package/dist/npm/models/transactions/signerListSet.js +10 -16
- package/dist/npm/models/transactions/signerListSet.js.map +1 -1
- package/dist/npm/models/transactions/transaction.d.ts +7 -1
- package/dist/npm/models/transactions/transaction.d.ts.map +1 -1
- package/dist/npm/models/transactions/transaction.js +28 -35
- package/dist/npm/models/transactions/transaction.js.map +1 -1
- package/dist/npm/models/transactions/vaultClawback.d.ts +10 -0
- package/dist/npm/models/transactions/vaultClawback.d.ts.map +1 -0
- package/dist/npm/models/transactions/vaultClawback.js +12 -0
- package/dist/npm/models/transactions/vaultClawback.js.map +1 -0
- package/dist/npm/models/transactions/vaultCreate.d.ts +24 -0
- package/dist/npm/models/transactions/vaultCreate.d.ts.map +1 -0
- package/dist/npm/models/transactions/vaultCreate.js +60 -0
- package/dist/npm/models/transactions/vaultCreate.js.map +1 -0
- package/dist/npm/models/transactions/vaultDelete.d.ts +7 -0
- package/dist/npm/models/transactions/vaultDelete.d.ts.map +1 -0
- package/dist/npm/models/transactions/vaultDelete.js +10 -0
- package/dist/npm/models/transactions/vaultDelete.js.map +1 -0
- package/dist/npm/models/transactions/vaultDeposit.d.ts +9 -0
- package/dist/npm/models/transactions/vaultDeposit.d.ts.map +1 -0
- package/dist/npm/models/transactions/vaultDeposit.js +11 -0
- package/dist/npm/models/transactions/vaultDeposit.js.map +1 -0
- package/dist/npm/models/transactions/vaultSet.d.ts +10 -0
- package/dist/npm/models/transactions/vaultSet.d.ts.map +1 -0
- package/dist/npm/models/transactions/vaultSet.js +25 -0
- package/dist/npm/models/transactions/vaultSet.js.map +1 -0
- package/dist/npm/models/transactions/vaultWithdraw.d.ts +10 -0
- package/dist/npm/models/transactions/vaultWithdraw.d.ts.map +1 -0
- package/dist/npm/models/transactions/vaultWithdraw.js +12 -0
- package/dist/npm/models/transactions/vaultWithdraw.js.map +1 -0
- package/dist/npm/models/utils/flags.d.ts.map +1 -1
- package/dist/npm/models/utils/flags.js +2 -0
- package/dist/npm/models/utils/flags.js.map +1 -1
- package/dist/npm/snippets/src/permissionedDEX.d.ts +2 -0
- package/dist/npm/snippets/src/permissionedDEX.d.ts.map +1 -0
- package/dist/npm/snippets/src/permissionedDEX.js +173 -0
- package/dist/npm/snippets/src/permissionedDEX.js.map +1 -0
- package/dist/npm/snippets/tsconfig.tsbuildinfo +1 -1
- package/dist/npm/src/client/index.d.ts +3 -3
- package/dist/npm/src/client/index.d.ts.map +1 -1
- package/dist/npm/src/client/index.js +10 -7
- package/dist/npm/src/client/index.js.map +1 -1
- package/dist/npm/src/client/partialPayment.d.ts.map +1 -1
- package/dist/npm/src/client/partialPayment.js +2 -2
- package/dist/npm/src/client/partialPayment.js.map +1 -1
- package/dist/npm/src/models/common/index.d.ts +17 -0
- package/dist/npm/src/models/common/index.d.ts.map +1 -1
- package/dist/npm/src/models/ledger/AccountRoot.d.ts +4 -2
- 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/DirectoryNode.d.ts +1 -0
- package/dist/npm/src/models/ledger/DirectoryNode.d.ts.map +1 -1
- package/dist/npm/src/models/ledger/Escrow.d.ts +2 -0
- package/dist/npm/src/models/ledger/Escrow.d.ts.map +1 -1
- package/dist/npm/src/models/ledger/LedgerEntry.d.ts +3 -2
- package/dist/npm/src/models/ledger/LedgerEntry.d.ts.map +1 -1
- package/dist/npm/src/models/ledger/MPToken.d.ts +1 -0
- package/dist/npm/src/models/ledger/MPToken.d.ts.map +1 -1
- package/dist/npm/src/models/ledger/MPTokenIssuance.d.ts +1 -0
- package/dist/npm/src/models/ledger/MPTokenIssuance.d.ts.map +1 -1
- package/dist/npm/src/models/ledger/Offer.d.ts +10 -1
- package/dist/npm/src/models/ledger/Offer.d.ts.map +1 -1
- package/dist/npm/src/models/ledger/Offer.js +1 -0
- package/dist/npm/src/models/ledger/Offer.js.map +1 -1
- package/dist/npm/src/models/ledger/Vault.d.ts +21 -0
- package/dist/npm/src/models/ledger/Vault.d.ts.map +1 -0
- package/dist/npm/src/models/ledger/Vault.js +3 -0
- package/dist/npm/src/models/ledger/Vault.js.map +1 -0
- package/dist/npm/src/models/ledger/index.d.ts +2 -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/bookOffers.d.ts +1 -0
- package/dist/npm/src/models/methods/bookOffers.d.ts.map +1 -1
- package/dist/npm/src/models/methods/index.d.ts +5 -4
- package/dist/npm/src/models/methods/index.d.ts.map +1 -1
- package/dist/npm/src/models/methods/pathFind.d.ts +2 -0
- package/dist/npm/src/models/methods/pathFind.d.ts.map +1 -1
- package/dist/npm/src/models/methods/ripplePathFind.d.ts +1 -0
- package/dist/npm/src/models/methods/ripplePathFind.d.ts.map +1 -1
- package/dist/npm/src/models/methods/subscribe.d.ts +4 -0
- package/dist/npm/src/models/methods/subscribe.d.ts.map +1 -1
- package/dist/npm/src/models/methods/vaultInfo.d.ts +46 -0
- package/dist/npm/src/models/methods/vaultInfo.d.ts.map +1 -0
- package/dist/npm/src/models/methods/vaultInfo.js +3 -0
- package/dist/npm/src/models/methods/vaultInfo.js.map +1 -0
- package/dist/npm/src/models/transactions/AMMBid.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/AMMBid.js +7 -5
- package/dist/npm/src/models/transactions/AMMBid.js.map +1 -1
- package/dist/npm/src/models/transactions/AMMClawback.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/AMMClawback.js +5 -6
- package/dist/npm/src/models/transactions/AMMClawback.js.map +1 -1
- package/dist/npm/src/models/transactions/AMMDelete.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/AMMDelete.js +2 -2
- package/dist/npm/src/models/transactions/AMMDelete.js.map +1 -1
- package/dist/npm/src/models/transactions/AMMDeposit.js +3 -3
- package/dist/npm/src/models/transactions/AMMDeposit.js.map +1 -1
- package/dist/npm/src/models/transactions/AMMVote.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/AMMVote.js +2 -2
- package/dist/npm/src/models/transactions/AMMVote.js.map +1 -1
- package/dist/npm/src/models/transactions/AMMWithdraw.js +3 -3
- package/dist/npm/src/models/transactions/AMMWithdraw.js.map +1 -1
- package/dist/npm/src/models/transactions/MPTokenIssuanceCreate.d.ts +1 -1
- package/dist/npm/src/models/transactions/MPTokenIssuanceCreate.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/MPTokenIssuanceCreate.js +17 -8
- package/dist/npm/src/models/transactions/MPTokenIssuanceCreate.js.map +1 -1
- package/dist/npm/src/models/transactions/MPTokenIssuanceSet.js +4 -4
- package/dist/npm/src/models/transactions/MPTokenIssuanceSet.js.map +1 -1
- package/dist/npm/src/models/transactions/NFTokenCancelOffer.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/NFTokenCancelOffer.js +1 -1
- package/dist/npm/src/models/transactions/NFTokenCancelOffer.js.map +1 -1
- package/dist/npm/src/models/transactions/NFTokenCreateOffer.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/NFTokenCreateOffer.js +6 -2
- package/dist/npm/src/models/transactions/NFTokenCreateOffer.js.map +1 -1
- package/dist/npm/src/models/transactions/accountSet.d.ts +2 -1
- package/dist/npm/src/models/transactions/accountSet.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/accountSet.js +1 -0
- package/dist/npm/src/models/transactions/accountSet.js.map +1 -1
- package/dist/npm/src/models/transactions/checkCreate.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/checkCreate.js +1 -2
- package/dist/npm/src/models/transactions/checkCreate.js.map +1 -1
- package/dist/npm/src/models/transactions/clawback.d.ts +2 -2
- package/dist/npm/src/models/transactions/clawback.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/clawback.js +4 -6
- package/dist/npm/src/models/transactions/clawback.js.map +1 -1
- package/dist/npm/src/models/transactions/common.d.ts +13 -4
- package/dist/npm/src/models/transactions/common.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/common.js +184 -28
- package/dist/npm/src/models/transactions/common.js.map +1 -1
- package/dist/npm/src/models/transactions/escrowCreate.d.ts +2 -1
- package/dist/npm/src/models/transactions/escrowCreate.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/escrowCreate.js +1 -6
- package/dist/npm/src/models/transactions/escrowCreate.js.map +1 -1
- package/dist/npm/src/models/transactions/index.d.ts +9 -3
- package/dist/npm/src/models/transactions/index.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/index.js +5 -1
- package/dist/npm/src/models/transactions/index.js.map +1 -1
- package/dist/npm/src/models/transactions/offerCreate.d.ts +4 -1
- package/dist/npm/src/models/transactions/offerCreate.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/offerCreate.js +10 -0
- package/dist/npm/src/models/transactions/offerCreate.js.map +1 -1
- package/dist/npm/src/models/transactions/oracleSet.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/oracleSet.js +22 -21
- package/dist/npm/src/models/transactions/oracleSet.js.map +1 -1
- package/dist/npm/src/models/transactions/payment.d.ts +2 -0
- package/dist/npm/src/models/transactions/payment.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/payment.js +7 -4
- package/dist/npm/src/models/transactions/payment.js.map +1 -1
- package/dist/npm/src/models/transactions/signerListSet.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/signerListSet.js +10 -16
- package/dist/npm/src/models/transactions/signerListSet.js.map +1 -1
- package/dist/npm/src/models/transactions/transaction.d.ts +7 -1
- package/dist/npm/src/models/transactions/transaction.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/transaction.js +28 -35
- package/dist/npm/src/models/transactions/transaction.js.map +1 -1
- package/dist/npm/src/models/transactions/vaultClawback.d.ts +10 -0
- package/dist/npm/src/models/transactions/vaultClawback.d.ts.map +1 -0
- package/dist/npm/src/models/transactions/vaultClawback.js +12 -0
- package/dist/npm/src/models/transactions/vaultClawback.js.map +1 -0
- package/dist/npm/src/models/transactions/vaultCreate.d.ts +24 -0
- package/dist/npm/src/models/transactions/vaultCreate.d.ts.map +1 -0
- package/dist/npm/src/models/transactions/vaultCreate.js +60 -0
- package/dist/npm/src/models/transactions/vaultCreate.js.map +1 -0
- package/dist/npm/src/models/transactions/vaultDelete.d.ts +7 -0
- package/dist/npm/src/models/transactions/vaultDelete.d.ts.map +1 -0
- package/dist/npm/src/models/transactions/vaultDelete.js +10 -0
- package/dist/npm/src/models/transactions/vaultDelete.js.map +1 -0
- package/dist/npm/src/models/transactions/vaultDeposit.d.ts +9 -0
- package/dist/npm/src/models/transactions/vaultDeposit.d.ts.map +1 -0
- package/dist/npm/src/models/transactions/vaultDeposit.js +11 -0
- package/dist/npm/src/models/transactions/vaultDeposit.js.map +1 -0
- package/dist/npm/src/models/transactions/vaultSet.d.ts +10 -0
- package/dist/npm/src/models/transactions/vaultSet.d.ts.map +1 -0
- package/dist/npm/src/models/transactions/vaultSet.js +25 -0
- package/dist/npm/src/models/transactions/vaultSet.js.map +1 -0
- package/dist/npm/src/models/transactions/vaultWithdraw.d.ts +10 -0
- package/dist/npm/src/models/transactions/vaultWithdraw.d.ts.map +1 -0
- package/dist/npm/src/models/transactions/vaultWithdraw.js +12 -0
- package/dist/npm/src/models/transactions/vaultWithdraw.js.map +1 -0
- package/dist/npm/src/models/utils/flags.d.ts.map +1 -1
- package/dist/npm/src/models/utils/flags.js +2 -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/sugar/autofill.d.ts.map +1 -1
- package/dist/npm/sugar/autofill.js.map +1 -1
- package/package.json +6 -5
- package/src/client/index.ts +43 -38
- package/src/client/partialPayment.ts +1 -2
- package/src/models/common/index.ts +27 -0
- package/src/models/ledger/AccountRoot.ts +11 -1
- package/src/models/ledger/DirectoryNode.ts +3 -0
- package/src/models/ledger/Escrow.ts +14 -1
- package/src/models/ledger/LedgerEntry.ts +3 -0
- package/src/models/ledger/MPToken.ts +1 -0
- package/src/models/ledger/MPTokenIssuance.ts +1 -0
- package/src/models/ledger/Offer.ts +21 -0
- package/src/models/ledger/Vault.ts +83 -0
- package/src/models/ledger/index.ts +3 -1
- package/src/models/methods/bookOffers.ts +7 -0
- package/src/models/methods/index.ts +10 -0
- package/src/models/methods/pathFind.ts +10 -0
- package/src/models/methods/ripplePathFind.ts +5 -0
- package/src/models/methods/subscribe.ts +21 -0
- package/src/models/methods/vaultInfo.ts +193 -0
- package/src/models/transactions/AMMBid.ts +12 -20
- package/src/models/transactions/AMMClawback.ts +8 -11
- package/src/models/transactions/AMMDelete.ts +7 -3
- package/src/models/transactions/AMMDeposit.ts +4 -4
- package/src/models/transactions/AMMVote.ts +7 -3
- package/src/models/transactions/AMMWithdraw.ts +4 -4
- package/src/models/transactions/MPTokenIssuanceCreate.ts +36 -11
- package/src/models/transactions/MPTokenIssuanceSet.ts +1 -1
- package/src/models/transactions/NFTokenCancelOffer.ts +2 -2
- package/src/models/transactions/NFTokenCreateOffer.ts +8 -4
- package/src/models/transactions/accountSet.ts +2 -0
- package/src/models/transactions/checkCreate.ts +2 -6
- package/src/models/transactions/clawback.ts +9 -10
- package/src/models/transactions/common.ts +350 -42
- package/src/models/transactions/escrowCreate.ts +8 -12
- package/src/models/transactions/index.ts +14 -3
- package/src/models/transactions/offerCreate.ts +25 -0
- package/src/models/transactions/oracleSet.ts +32 -39
- package/src/models/transactions/payment.ts +25 -7
- package/src/models/transactions/signerListSet.ts +21 -21
- package/src/models/transactions/transaction.ts +46 -43
- package/src/models/transactions/vaultClawback.ts +55 -0
- package/src/models/transactions/vaultCreate.ts +166 -0
- package/src/models/transactions/vaultDelete.ts +32 -0
- package/src/models/transactions/vaultDeposit.ts +42 -0
- package/src/models/transactions/vaultSet.ts +71 -0
- package/src/models/transactions/vaultWithdraw.ts +51 -0
- package/src/models/utils/flags.ts +2 -0
- package/src/sugar/autofill.ts +5 -6
@@ -1,5 +1,5 @@
|
|
1
1
|
/* eslint-disable max-lines -- common utility file */
|
2
|
-
import { HEX_REGEX } from '@xrplf/isomorphic/utils'
|
2
|
+
import { HEX_REGEX, hexToString } from '@xrplf/isomorphic/utils'
|
3
3
|
import { isValidClassicAddress, isValidXAddress } from 'ripple-address-codec'
|
4
4
|
import { TRANSACTION_TYPES } from 'ripple-binary-codec'
|
5
5
|
|
@@ -7,31 +7,83 @@ import { ValidationError } from '../../errors'
|
|
7
7
|
import {
|
8
8
|
Amount,
|
9
9
|
AuthorizeCredential,
|
10
|
+
ClawbackAmount,
|
10
11
|
Currency,
|
12
|
+
IssuedCurrency,
|
11
13
|
IssuedCurrencyAmount,
|
12
14
|
MPTAmount,
|
15
|
+
MPTokenMetadata,
|
13
16
|
Memo,
|
14
17
|
Signer,
|
15
18
|
XChainBridge,
|
16
19
|
} from '../common'
|
17
|
-
import { onlyHasFields } from '../utils'
|
20
|
+
import { isHex, onlyHasFields } from '../utils'
|
18
21
|
|
19
22
|
const MEMO_SIZE = 3
|
20
23
|
export const MAX_AUTHORIZED_CREDENTIALS = 8
|
21
24
|
const MAX_CREDENTIAL_BYTE_LENGTH = 64
|
22
25
|
const MAX_CREDENTIAL_TYPE_LENGTH = MAX_CREDENTIAL_BYTE_LENGTH * 2
|
26
|
+
export const MAX_MPT_META_BYTE_LENGTH = 1024
|
27
|
+
|
28
|
+
// Used for Vault transactions
|
29
|
+
export const VAULT_DATA_MAX_BYTE_LENGTH = 256
|
30
|
+
|
31
|
+
// To validate MPTokenMetadata as per XLS-89d
|
32
|
+
const TICKER_REGEX = /^[A-Z0-9]{1,6}$/u
|
33
|
+
|
34
|
+
const MAX_MPT_META_TOP_LEVEL_FIELD_COUNT = 9
|
35
|
+
|
36
|
+
const MPT_META_URL_FIELD_COUNT = 3
|
37
|
+
|
38
|
+
const MPT_META_REQUIRED_FIELDS = [
|
39
|
+
'ticker',
|
40
|
+
'name',
|
41
|
+
'icon',
|
42
|
+
'asset_class',
|
43
|
+
'issuer_name',
|
44
|
+
]
|
45
|
+
|
46
|
+
const MPT_META_ASSET_CLASSES = [
|
47
|
+
'rwa',
|
48
|
+
'memes',
|
49
|
+
'wrapped',
|
50
|
+
'gaming',
|
51
|
+
'defi',
|
52
|
+
'other',
|
53
|
+
]
|
54
|
+
|
55
|
+
const MPT_META_ASSET_SUB_CLASSES = [
|
56
|
+
'stablecoin',
|
57
|
+
'commodity',
|
58
|
+
'real_estate',
|
59
|
+
'private_credit',
|
60
|
+
'equity',
|
61
|
+
'treasury',
|
62
|
+
'other',
|
63
|
+
]
|
64
|
+
|
65
|
+
export const MPT_META_WARNING_HEADER =
|
66
|
+
'MPTokenMetadata is not properly formatted as JSON as per the XLS-89d standard. ' +
|
67
|
+
"While adherence to this standard is not mandatory, such non-compliant MPToken's might not be discoverable " +
|
68
|
+
'by Explorers and Indexers in the XRPL ecosystem.'
|
69
|
+
|
70
|
+
function isMemo(obj: unknown): obj is Memo {
|
71
|
+
if (!isRecord(obj)) {
|
72
|
+
return false
|
73
|
+
}
|
23
74
|
|
24
|
-
|
25
|
-
if (
|
75
|
+
const memo = obj.Memo
|
76
|
+
if (!isRecord(memo)) {
|
26
77
|
return false
|
27
78
|
}
|
28
|
-
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- Only used by JS
|
29
|
-
const memo = obj.Memo as Record<string, unknown>
|
30
79
|
const size = Object.keys(memo).length
|
31
|
-
const validData =
|
80
|
+
const validData =
|
81
|
+
memo.MemoData == null || (isString(memo.MemoData) && isHex(memo.MemoData))
|
32
82
|
const validFormat =
|
33
|
-
memo.MemoFormat == null ||
|
34
|
-
|
83
|
+
memo.MemoFormat == null ||
|
84
|
+
(isString(memo.MemoFormat) && isHex(memo.MemoFormat))
|
85
|
+
const validType =
|
86
|
+
memo.MemoType == null || (isString(memo.MemoType) && isHex(memo.MemoType))
|
35
87
|
|
36
88
|
return (
|
37
89
|
size >= 1 &&
|
@@ -45,20 +97,21 @@ function isMemo(obj: { Memo?: unknown }): boolean {
|
|
45
97
|
|
46
98
|
const SIGNER_SIZE = 3
|
47
99
|
|
48
|
-
function isSigner(obj: unknown):
|
49
|
-
|
50
|
-
|
100
|
+
function isSigner(obj: unknown): obj is Signer {
|
101
|
+
if (!isRecord(obj)) {
|
102
|
+
return false
|
103
|
+
}
|
51
104
|
|
52
|
-
|
105
|
+
const signer = obj.Signer
|
106
|
+
if (!isRecord(signer)) {
|
53
107
|
return false
|
54
108
|
}
|
55
|
-
|
56
|
-
const signer = signerWrapper.Signer as Record<string, unknown>
|
109
|
+
|
57
110
|
return (
|
58
111
|
Object.keys(signer).length === SIGNER_SIZE &&
|
59
|
-
|
60
|
-
|
61
|
-
|
112
|
+
isString(signer.Account) &&
|
113
|
+
isString(signer.TxnSignature) &&
|
114
|
+
isString(signer.SigningPubKey)
|
62
115
|
)
|
63
116
|
}
|
64
117
|
|
@@ -76,7 +129,7 @@ const AUTHORIZE_CREDENTIAL_SIZE = 1
|
|
76
129
|
* @returns Whether the Record/Object is properly formed.
|
77
130
|
*/
|
78
131
|
export function isRecord(value: unknown): value is Record<string, unknown> {
|
79
|
-
return value !== null && typeof value === 'object'
|
132
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value)
|
80
133
|
}
|
81
134
|
|
82
135
|
/**
|
@@ -99,18 +152,50 @@ export function isNumber(num: unknown): num is number {
|
|
99
152
|
return typeof num === 'number'
|
100
153
|
}
|
101
154
|
|
155
|
+
/**
|
156
|
+
* Checks whether the given value is a valid XRPL number string.
|
157
|
+
* Accepts integer, decimal, or scientific notation strings.
|
158
|
+
*
|
159
|
+
* Examples of valid input:
|
160
|
+
* - "123"
|
161
|
+
* - "-987.654"
|
162
|
+
* - "+3.14e10"
|
163
|
+
* - "-7.2e-9"
|
164
|
+
*
|
165
|
+
* @param value - The value to check.
|
166
|
+
* @returns True if value is a string that matches the XRPL number format, false otherwise.
|
167
|
+
*/
|
168
|
+
export function isXRPLNumber(value: unknown): value is XRPLNumber {
|
169
|
+
// Matches optional sign, digits, optional decimal, optional exponent (scientific)
|
170
|
+
// Allows leading zeros, but not empty string, lone sign, or missing digits
|
171
|
+
return (
|
172
|
+
typeof value === 'string' &&
|
173
|
+
/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?$/u.test(value.trim())
|
174
|
+
)
|
175
|
+
}
|
176
|
+
|
177
|
+
/**
|
178
|
+
* Verify the form and type of a Currency at runtime.
|
179
|
+
*
|
180
|
+
* @param input - The input to check the form and type of.
|
181
|
+
* @returns Whether the Currency is properly formed.
|
182
|
+
*/
|
183
|
+
export function isCurrency(input: unknown): input is Currency {
|
184
|
+
return isString(input) || isIssuedCurrency(input)
|
185
|
+
}
|
186
|
+
|
102
187
|
/**
|
103
188
|
* Verify the form and type of an IssuedCurrency at runtime.
|
104
189
|
*
|
105
190
|
* @param input - The input to check the form and type of.
|
106
191
|
* @returns Whether the IssuedCurrency is properly formed.
|
107
192
|
*/
|
108
|
-
export function
|
193
|
+
export function isIssuedCurrency(input: unknown): input is IssuedCurrency {
|
109
194
|
return (
|
110
195
|
isRecord(input) &&
|
111
196
|
((Object.keys(input).length === ISSUE_SIZE &&
|
112
|
-
|
113
|
-
|
197
|
+
isString(input.issuer) &&
|
198
|
+
isString(input.currency)) ||
|
114
199
|
(Object.keys(input).length === XRP_CURRENCY_SIZE &&
|
115
200
|
input.currency === 'XRP'))
|
116
201
|
)
|
@@ -122,15 +207,15 @@ export function isCurrency(input: unknown): input is Currency {
|
|
122
207
|
* @param input - The input to check the form and type of.
|
123
208
|
* @returns Whether the IssuedCurrencyAmount is properly formed.
|
124
209
|
*/
|
125
|
-
export function
|
210
|
+
export function isIssuedCurrencyAmount(
|
126
211
|
input: unknown,
|
127
212
|
): input is IssuedCurrencyAmount {
|
128
213
|
return (
|
129
214
|
isRecord(input) &&
|
130
215
|
Object.keys(input).length === ISSUED_CURRENCY_SIZE &&
|
131
|
-
|
132
|
-
|
133
|
-
|
216
|
+
isString(input.value) &&
|
217
|
+
isString(input.issuer) &&
|
218
|
+
isString(input.currency)
|
134
219
|
)
|
135
220
|
}
|
136
221
|
|
@@ -167,11 +252,33 @@ export function isMPTAmount(input: unknown): input is MPTAmount {
|
|
167
252
|
)
|
168
253
|
}
|
169
254
|
|
255
|
+
/**
|
256
|
+
* Type guard to verify if the input is a valid ClawbackAmount.
|
257
|
+
*
|
258
|
+
* A ClawbackAmount can be either an {@link IssuedCurrencyAmount} or an {@link MPTAmount}.
|
259
|
+
* This function checks if the input matches either type.
|
260
|
+
*
|
261
|
+
* @param input - The value to check for ClawbackAmount structure.
|
262
|
+
* @returns True if the input is an IssuedCurrencyAmount or MPTAmount, otherwise false.
|
263
|
+
*/
|
264
|
+
export function isClawbackAmount(input: unknown): input is ClawbackAmount {
|
265
|
+
return isIssuedCurrencyAmount(input) || isMPTAmount(input)
|
266
|
+
}
|
267
|
+
|
170
268
|
/**
|
171
269
|
* Must be a valid account address
|
172
270
|
*/
|
173
271
|
export type Account = string
|
174
272
|
|
273
|
+
/**
|
274
|
+
* XRPL Number type represented as a string.
|
275
|
+
*
|
276
|
+
* This string can be an integer (e.g., "123"), a decimal (e.g., "123.45"),
|
277
|
+
* or in scientific notation (e.g., "1.23e5", "-4.56e-7").
|
278
|
+
* Used for fields that accept arbitrary-precision numbers in XRPL transactions and ledger objects.
|
279
|
+
*/
|
280
|
+
export type XRPLNumber = string
|
281
|
+
|
175
282
|
/**
|
176
283
|
* Verify a string is in fact a valid account address.
|
177
284
|
*
|
@@ -194,7 +301,7 @@ export function isAccount(account: unknown): account is Account {
|
|
194
301
|
export function isAmount(amount: unknown): amount is Amount {
|
195
302
|
return (
|
196
303
|
typeof amount === 'string' ||
|
197
|
-
|
304
|
+
isIssuedCurrencyAmount(amount) ||
|
198
305
|
isMPTAmount(amount)
|
199
306
|
)
|
200
307
|
}
|
@@ -210,9 +317,9 @@ export function isXChainBridge(input: unknown): input is XChainBridge {
|
|
210
317
|
isRecord(input) &&
|
211
318
|
Object.keys(input).length === XCHAIN_BRIDGE_SIZE &&
|
212
319
|
typeof input.LockingChainDoor === 'string' &&
|
213
|
-
|
320
|
+
isIssuedCurrency(input.LockingChainIssue) &&
|
214
321
|
typeof input.IssuingChainDoor === 'string' &&
|
215
|
-
|
322
|
+
isIssuedCurrency(input.IssuingChainIssue)
|
216
323
|
)
|
217
324
|
}
|
218
325
|
|
@@ -223,7 +330,7 @@ export function isXChainBridge(input: unknown): input is XChainBridge {
|
|
223
330
|
* @returns Whether the Array is properly formed.
|
224
331
|
*/
|
225
332
|
export function isArray<T = unknown>(input: unknown): input is T[] {
|
226
|
-
return Array.isArray(input)
|
333
|
+
return input != null && Array.isArray(input)
|
227
334
|
}
|
228
335
|
|
229
336
|
/* eslint-disable @typescript-eslint/restrict-template-expressions -- tx.TransactionType is checked before any calls */
|
@@ -402,8 +509,14 @@ export interface BaseTransaction extends Record<string, unknown> {
|
|
402
509
|
*/
|
403
510
|
// eslint-disable-next-line max-statements, max-lines-per-function -- lines required for validation
|
404
511
|
export function validateBaseTransaction(
|
405
|
-
common:
|
512
|
+
common: unknown,
|
406
513
|
): asserts common is BaseTransaction {
|
514
|
+
if (!isRecord(common)) {
|
515
|
+
throw new ValidationError(
|
516
|
+
'BaseTransaction: invalid, expected a valid object',
|
517
|
+
)
|
518
|
+
}
|
519
|
+
|
407
520
|
if (common.TransactionType === undefined) {
|
408
521
|
throw new ValidationError('BaseTransaction: missing field TransactionType')
|
409
522
|
}
|
@@ -428,18 +541,16 @@ export function validateBaseTransaction(
|
|
428
541
|
|
429
542
|
validateOptionalField(common, 'LastLedgerSequence', isNumber)
|
430
543
|
|
431
|
-
|
432
|
-
|
433
|
-
if (memos !== undefined && !memos.every(isMemo)) {
|
544
|
+
const memos = common.Memos
|
545
|
+
if (memos != null && (!isArray(memos) || !memos.every(isMemo))) {
|
434
546
|
throw new ValidationError('BaseTransaction: invalid Memos')
|
435
547
|
}
|
436
548
|
|
437
|
-
|
438
|
-
const signers = common.Signers as Array<Record<string, unknown>> | undefined
|
549
|
+
const signers = common.Signers
|
439
550
|
|
440
551
|
if (
|
441
|
-
signers
|
442
|
-
(signers.length === 0 || !signers.every(isSigner))
|
552
|
+
signers != null &&
|
553
|
+
(!isArray(signers) || signers.length === 0 || !signers.every(isSigner))
|
443
554
|
) {
|
444
555
|
throw new ValidationError('BaseTransaction: invalid Signers')
|
445
556
|
}
|
@@ -486,7 +597,9 @@ export function parseAmountValue(amount: unknown): number {
|
|
486
597
|
* @param tx A CredentialType Transaction.
|
487
598
|
* @throws when the CredentialType is malformed.
|
488
599
|
*/
|
489
|
-
export function validateCredentialType
|
600
|
+
export function validateCredentialType<
|
601
|
+
T extends BaseTransaction & Record<string, unknown>,
|
602
|
+
>(tx: T): void {
|
490
603
|
if (typeof tx.TransactionType !== 'string') {
|
491
604
|
throw new ValidationError('Invalid TransactionType')
|
492
605
|
}
|
@@ -528,7 +641,7 @@ export function validateCredentialType(tx: Record<string, unknown>): void {
|
|
528
641
|
* PermissionedDomainSet transaction uses 10, other transactions use 8.
|
529
642
|
* @throws Validation Error if the formatting is incorrect
|
530
643
|
*/
|
531
|
-
// eslint-disable-next-line max-lines-per-function
|
644
|
+
// eslint-disable-next-line max-params, max-lines-per-function -- separating logic further will add unnecessary complexity
|
532
645
|
export function validateCredentialsList(
|
533
646
|
credentials: unknown,
|
534
647
|
transactionType: string,
|
@@ -538,7 +651,7 @@ export function validateCredentialsList(
|
|
538
651
|
if (credentials == null) {
|
539
652
|
return
|
540
653
|
}
|
541
|
-
if (!
|
654
|
+
if (!isArray(credentials)) {
|
542
655
|
throw new ValidationError(
|
543
656
|
`${transactionType}: Credentials must be an array`,
|
544
657
|
)
|
@@ -565,7 +678,8 @@ export function validateCredentialsList(
|
|
565
678
|
)
|
566
679
|
}
|
567
680
|
})
|
568
|
-
|
681
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- checked above
|
682
|
+
if (containsDuplicates(credentials as string[] | AuthorizeCredential[])) {
|
569
683
|
throw new ValidationError(
|
570
684
|
`${transactionType}: Credentials cannot contain duplicate elements`,
|
571
685
|
)
|
@@ -610,3 +724,197 @@ export function containsDuplicates(
|
|
610
724
|
|
611
725
|
return false
|
612
726
|
}
|
727
|
+
|
728
|
+
const _DOMAIN_ID_LENGTH = 64
|
729
|
+
|
730
|
+
/**
|
731
|
+
* Utility method used across OfferCreate and Payment transactions to validate the DomainID.
|
732
|
+
*
|
733
|
+
* @param domainID - The domainID is a 64-character string that is used to identify a domain.
|
734
|
+
*
|
735
|
+
* @returns true if the domainID is a valid 64-character string, false otherwise
|
736
|
+
*/
|
737
|
+
export function isDomainID(domainID: unknown): domainID is string {
|
738
|
+
return (
|
739
|
+
isString(domainID) &&
|
740
|
+
domainID.length === _DOMAIN_ID_LENGTH &&
|
741
|
+
isHex(domainID)
|
742
|
+
)
|
743
|
+
}
|
744
|
+
|
745
|
+
/* eslint-disable max-lines-per-function -- Required here as structure validation is verbose. */
|
746
|
+
/* eslint-disable max-statements -- Required here as structure validation is verbose. */
|
747
|
+
|
748
|
+
/**
|
749
|
+
* Validates if MPTokenMetadata adheres to XLS-89d standard.
|
750
|
+
*
|
751
|
+
* @param input - Hex encoded MPTokenMetadata.
|
752
|
+
* @returns Validation messages if MPTokenMetadata does not adheres to XLS-89d standard.
|
753
|
+
*/
|
754
|
+
export function validateMPTokenMetadata(input: string): string[] {
|
755
|
+
const validationMessages: string[] = []
|
756
|
+
|
757
|
+
if (!isHex(input)) {
|
758
|
+
validationMessages.push(`MPTokenMetadata must be in hex format.`)
|
759
|
+
return validationMessages
|
760
|
+
}
|
761
|
+
|
762
|
+
if (input.length / 2 > MAX_MPT_META_BYTE_LENGTH) {
|
763
|
+
validationMessages.push(
|
764
|
+
`MPTokenMetadata must be max ${MAX_MPT_META_BYTE_LENGTH} bytes.`,
|
765
|
+
)
|
766
|
+
return validationMessages
|
767
|
+
}
|
768
|
+
|
769
|
+
let jsonMetaData: unknown
|
770
|
+
|
771
|
+
try {
|
772
|
+
jsonMetaData = JSON.parse(hexToString(input))
|
773
|
+
} catch (err) {
|
774
|
+
validationMessages.push(
|
775
|
+
`MPTokenMetadata is not properly formatted as JSON - ${String(err)}`,
|
776
|
+
)
|
777
|
+
return validationMessages
|
778
|
+
}
|
779
|
+
|
780
|
+
if (
|
781
|
+
jsonMetaData == null ||
|
782
|
+
typeof jsonMetaData !== 'object' ||
|
783
|
+
Array.isArray(jsonMetaData)
|
784
|
+
) {
|
785
|
+
validationMessages.push(
|
786
|
+
'MPTokenMetadata is not properly formatted as per XLS-89d.',
|
787
|
+
)
|
788
|
+
return validationMessages
|
789
|
+
}
|
790
|
+
|
791
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- It must be some JSON object.
|
792
|
+
const obj = jsonMetaData as Record<string, unknown>
|
793
|
+
|
794
|
+
// validating structure
|
795
|
+
|
796
|
+
// check for maximum number of fields
|
797
|
+
const fieldCount = Object.keys(obj).length
|
798
|
+
if (fieldCount > MAX_MPT_META_TOP_LEVEL_FIELD_COUNT) {
|
799
|
+
validationMessages.push(
|
800
|
+
`MPTokenMetadata must not contain more than ${MAX_MPT_META_TOP_LEVEL_FIELD_COUNT} top-level fields (found ${fieldCount}).`,
|
801
|
+
)
|
802
|
+
return validationMessages
|
803
|
+
}
|
804
|
+
|
805
|
+
const incorrectRequiredFields = MPT_META_REQUIRED_FIELDS.filter(
|
806
|
+
(field) => !isString(obj[field]),
|
807
|
+
)
|
808
|
+
|
809
|
+
if (incorrectRequiredFields.length > 0) {
|
810
|
+
incorrectRequiredFields.forEach((field) =>
|
811
|
+
validationMessages.push(`${field} is required and must be string.`),
|
812
|
+
)
|
813
|
+
return validationMessages
|
814
|
+
}
|
815
|
+
|
816
|
+
if (obj.desc != null && !isString(obj.desc)) {
|
817
|
+
validationMessages.push(`desc must be a string.`)
|
818
|
+
return validationMessages
|
819
|
+
}
|
820
|
+
|
821
|
+
if (obj.asset_subclass != null && !isString(obj.asset_subclass)) {
|
822
|
+
validationMessages.push(`asset_subclass must be a string.`)
|
823
|
+
return validationMessages
|
824
|
+
}
|
825
|
+
|
826
|
+
if (
|
827
|
+
obj.additional_info != null &&
|
828
|
+
!isString(obj.additional_info) &&
|
829
|
+
!isRecord(obj.additional_info)
|
830
|
+
) {
|
831
|
+
validationMessages.push(`additional_info must be a string or JSON object.`)
|
832
|
+
return validationMessages
|
833
|
+
}
|
834
|
+
|
835
|
+
if (obj.urls != null) {
|
836
|
+
if (!Array.isArray(obj.urls)) {
|
837
|
+
validationMessages.push('urls must be an array as per XLS-89d.')
|
838
|
+
return validationMessages
|
839
|
+
}
|
840
|
+
if (!obj.urls.every(isValidMPTokenMetadataUrlStructure)) {
|
841
|
+
validationMessages.push(
|
842
|
+
'One or more urls are not structured per XLS-89d.',
|
843
|
+
)
|
844
|
+
return validationMessages
|
845
|
+
}
|
846
|
+
}
|
847
|
+
|
848
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- Required here.
|
849
|
+
const mptMPTokenMetadata = obj as unknown as MPTokenMetadata
|
850
|
+
|
851
|
+
// validating content
|
852
|
+
if (!TICKER_REGEX.test(mptMPTokenMetadata.ticker)) {
|
853
|
+
validationMessages.push(
|
854
|
+
`ticker should have uppercase letters (A-Z) and digits (0-9) only. Max 6 characters recommended.`,
|
855
|
+
)
|
856
|
+
}
|
857
|
+
|
858
|
+
if (!mptMPTokenMetadata.icon.startsWith('https://')) {
|
859
|
+
validationMessages.push(`icon should be a valid https url.`)
|
860
|
+
}
|
861
|
+
|
862
|
+
if (
|
863
|
+
!MPT_META_ASSET_CLASSES.includes(
|
864
|
+
mptMPTokenMetadata.asset_class.toLowerCase(),
|
865
|
+
)
|
866
|
+
) {
|
867
|
+
validationMessages.push(
|
868
|
+
`asset_class should be one of ${MPT_META_ASSET_CLASSES.join(', ')}.`,
|
869
|
+
)
|
870
|
+
}
|
871
|
+
|
872
|
+
if (
|
873
|
+
mptMPTokenMetadata.asset_subclass != null &&
|
874
|
+
!MPT_META_ASSET_SUB_CLASSES.includes(
|
875
|
+
mptMPTokenMetadata.asset_subclass.toLowerCase(),
|
876
|
+
)
|
877
|
+
) {
|
878
|
+
validationMessages.push(
|
879
|
+
`asset_subclass should be one of ${MPT_META_ASSET_SUB_CLASSES.join(
|
880
|
+
', ',
|
881
|
+
)}.`,
|
882
|
+
)
|
883
|
+
}
|
884
|
+
|
885
|
+
if (
|
886
|
+
mptMPTokenMetadata.asset_class.toLowerCase() === 'rwa' &&
|
887
|
+
mptMPTokenMetadata.asset_subclass == null
|
888
|
+
) {
|
889
|
+
validationMessages.push(
|
890
|
+
`asset_subclass is required when asset_class is rwa.`,
|
891
|
+
)
|
892
|
+
}
|
893
|
+
|
894
|
+
if (
|
895
|
+
mptMPTokenMetadata.urls != null &&
|
896
|
+
!mptMPTokenMetadata.urls.every((ele) => ele.url.startsWith('https://'))
|
897
|
+
) {
|
898
|
+
validationMessages.push(`url should be a valid https url.`)
|
899
|
+
}
|
900
|
+
|
901
|
+
return validationMessages
|
902
|
+
}
|
903
|
+
/* eslint-enable max-lines-per-function */
|
904
|
+
/* eslint-enable max-statements */
|
905
|
+
|
906
|
+
function isValidMPTokenMetadataUrlStructure(input: unknown): boolean {
|
907
|
+
if (input == null) {
|
908
|
+
return false
|
909
|
+
}
|
910
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- Required here.
|
911
|
+
const obj = input as Record<string, unknown>
|
912
|
+
|
913
|
+
return (
|
914
|
+
typeof obj === 'object' &&
|
915
|
+
isString(obj.url) &&
|
916
|
+
isString(obj.type) &&
|
917
|
+
isString(obj.title) &&
|
918
|
+
Object.keys(obj).length === MPT_META_URL_FIELD_COUNT
|
919
|
+
)
|
920
|
+
}
|
@@ -1,9 +1,11 @@
|
|
1
1
|
import { ValidationError } from '../../errors'
|
2
|
+
import { Amount, MPTAmount } from '../common'
|
2
3
|
|
3
4
|
import {
|
4
5
|
Account,
|
5
6
|
BaseTransaction,
|
6
7
|
isAccount,
|
8
|
+
isAmount,
|
7
9
|
isNumber,
|
8
10
|
validateBaseTransaction,
|
9
11
|
validateOptionalField,
|
@@ -18,11 +20,12 @@ import {
|
|
18
20
|
export interface EscrowCreate extends BaseTransaction {
|
19
21
|
TransactionType: 'EscrowCreate'
|
20
22
|
/**
|
21
|
-
*
|
22
|
-
* Once escrowed,
|
23
|
-
*
|
23
|
+
* The amount to deduct from the sender's balance and and set aside in escrow.
|
24
|
+
* Once escrowed, this amount can either go to the Destination address (after any Finish times/conditions)
|
25
|
+
* or returned to the sender (after any cancellation times/conditions). Can represent XRP, in drops,
|
26
|
+
* an IOU token, or an MPT. Must always be a positive value.
|
24
27
|
*/
|
25
|
-
Amount:
|
28
|
+
Amount: Amount | MPTAmount
|
26
29
|
/** Address to receive escrowed XRP. */
|
27
30
|
Destination: Account
|
28
31
|
/**
|
@@ -58,14 +61,7 @@ export interface EscrowCreate extends BaseTransaction {
|
|
58
61
|
export function validateEscrowCreate(tx: Record<string, unknown>): void {
|
59
62
|
validateBaseTransaction(tx)
|
60
63
|
|
61
|
-
|
62
|
-
throw new ValidationError('EscrowCreate: missing field Amount')
|
63
|
-
}
|
64
|
-
|
65
|
-
if (typeof tx.Amount !== 'string') {
|
66
|
-
throw new ValidationError('EscrowCreate: Amount must be a string')
|
67
|
-
}
|
68
|
-
|
64
|
+
validateRequiredField(tx, 'Amount', isAmount)
|
69
65
|
validateRequiredField(tx, 'Destination', isAccount)
|
70
66
|
validateOptionalField(tx, 'DestinationTag', isNumber)
|
71
67
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
export { BaseTransaction, isMPTAmount } from './common'
|
1
|
+
export { BaseTransaction, isMPTAmount, validateMPTokenMetadata } from './common'
|
2
2
|
export {
|
3
3
|
validate,
|
4
4
|
PseudoTransaction,
|
@@ -95,14 +95,25 @@ export {
|
|
95
95
|
} from './paymentChannelClaim'
|
96
96
|
export { PaymentChannelCreate } from './paymentChannelCreate'
|
97
97
|
export { PaymentChannelFund } from './paymentChannelFund'
|
98
|
+
export { PermissionedDomainSet } from './permissionedDomainSet'
|
99
|
+
export { PermissionedDomainDelete } from './permissionedDomainDelete'
|
98
100
|
export { SetFee, SetFeePreAmendment, SetFeePostAmendment } from './setFee'
|
99
101
|
export { SetRegularKey } from './setRegularKey'
|
100
102
|
export { SignerListSet } from './signerListSet'
|
101
103
|
export { TicketCreate } from './ticketCreate'
|
102
104
|
export { TrustSetFlagsInterface, TrustSetFlags, TrustSet } from './trustSet'
|
103
105
|
export { UNLModify } from './UNLModify'
|
104
|
-
export {
|
105
|
-
export {
|
106
|
+
export { VaultClawback } from './vaultClawback'
|
107
|
+
export {
|
108
|
+
VaultCreate,
|
109
|
+
VaultCreateFlags,
|
110
|
+
VaultCreateFlagsInterface,
|
111
|
+
VaultWithdrawalPolicy,
|
112
|
+
} from './vaultCreate'
|
113
|
+
export { VaultDelete } from './vaultDelete'
|
114
|
+
export { VaultDeposit } from './vaultDeposit'
|
115
|
+
export { VaultSet } from './vaultSet'
|
116
|
+
export { VaultWithdraw } from './vaultWithdraw'
|
106
117
|
export { XChainAddAccountCreateAttestation } from './XChainAddAccountCreateAttestation'
|
107
118
|
export { XChainAddClaimAttestation } from './XChainAddClaimAttestation'
|
108
119
|
export { XChainClaim } from './XChainClaim'
|
@@ -1,11 +1,14 @@
|
|
1
1
|
import { ValidationError } from '../../errors'
|
2
2
|
import { Amount } from '../common'
|
3
|
+
import { hasFlag } from '../utils'
|
3
4
|
|
4
5
|
import {
|
5
6
|
BaseTransaction,
|
6
7
|
GlobalFlagsInterface,
|
7
8
|
validateBaseTransaction,
|
8
9
|
isAmount,
|
10
|
+
validateOptionalField,
|
11
|
+
isDomainID,
|
9
12
|
} from './common'
|
10
13
|
|
11
14
|
/**
|
@@ -42,6 +45,11 @@ export enum OfferCreateFlags {
|
|
42
45
|
* the TakerPays amount in exchange.
|
43
46
|
*/
|
44
47
|
tfSell = 0x00080000,
|
48
|
+
/**
|
49
|
+
* Indicates the offer is hybrid. (meaning it is part of both a domain and open order book)
|
50
|
+
* This flag cannot be set if the offer doesn't have a DomainID
|
51
|
+
*/
|
52
|
+
tfHybrid = 0x00100000,
|
45
53
|
}
|
46
54
|
|
47
55
|
/**
|
@@ -83,6 +91,7 @@ export interface OfferCreateFlagsInterface extends GlobalFlagsInterface {
|
|
83
91
|
tfImmediateOrCancel?: boolean
|
84
92
|
tfFillOrKill?: boolean
|
85
93
|
tfSell?: boolean
|
94
|
+
tfHybrid?: boolean
|
86
95
|
}
|
87
96
|
|
88
97
|
/**
|
@@ -106,6 +115,8 @@ export interface OfferCreate extends BaseTransaction {
|
|
106
115
|
TakerGets: Amount
|
107
116
|
/** The amount and type of currency being requested by the offer creator. */
|
108
117
|
TakerPays: Amount
|
118
|
+
/** The domain that the offer must be a part of. */
|
119
|
+
DomainID?: string
|
109
120
|
}
|
110
121
|
|
111
122
|
/**
|
@@ -140,4 +151,18 @@ export function validateOfferCreate(tx: Record<string, unknown>): void {
|
|
140
151
|
if (tx.OfferSequence !== undefined && typeof tx.OfferSequence !== 'number') {
|
141
152
|
throw new ValidationError('OfferCreate: invalid OfferSequence')
|
142
153
|
}
|
154
|
+
|
155
|
+
validateOptionalField(tx, 'DomainID', isDomainID, {
|
156
|
+
txType: 'OfferCreate',
|
157
|
+
paramName: 'DomainID',
|
158
|
+
})
|
159
|
+
|
160
|
+
if (
|
161
|
+
tx.DomainID == null &&
|
162
|
+
hasFlag(tx, OfferCreateFlags.tfHybrid, 'tfHybrid')
|
163
|
+
) {
|
164
|
+
throw new ValidationError(
|
165
|
+
'OfferCreate: tfHybrid flag cannot be set if DomainID is not present',
|
166
|
+
)
|
167
|
+
}
|
143
168
|
}
|