xrpl 4.0.1-mpt-beta → 4.2.0-batch.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/README.md +1 -1
- package/build/xrpl-latest-min.js +1 -1
- package/build/xrpl-latest-min.js.map +1 -1
- package/build/xrpl-latest.js +2986 -824
- package/build/xrpl-latest.js.map +1 -1
- package/dist/npm/Wallet/batchSigner.d.ts +8 -0
- package/dist/npm/Wallet/batchSigner.d.ts.map +1 -0
- package/dist/npm/Wallet/batchSigner.js +124 -0
- package/dist/npm/Wallet/batchSigner.js.map +1 -0
- package/dist/npm/Wallet/defaultFaucets.d.ts +2 -1
- package/dist/npm/Wallet/defaultFaucets.d.ts.map +1 -1
- package/dist/npm/Wallet/defaultFaucets.js +5 -0
- package/dist/npm/Wallet/defaultFaucets.js.map +1 -1
- package/dist/npm/Wallet/index.d.ts.map +1 -1
- package/dist/npm/Wallet/index.js +8 -2
- package/dist/npm/Wallet/index.js.map +1 -1
- package/dist/npm/client/RequestManager.d.ts.map +1 -1
- package/dist/npm/client/RequestManager.js +3 -3
- package/dist/npm/client/RequestManager.js.map +1 -1
- package/dist/npm/client/connection.d.ts.map +1 -1
- package/dist/npm/client/connection.js.map +1 -1
- package/dist/npm/client/index.d.ts +4 -0
- package/dist/npm/client/index.d.ts.map +1 -1
- package/dist/npm/client/index.js +16 -9
- package/dist/npm/client/index.js.map +1 -1
- package/dist/npm/client/partialPayment.d.ts +2 -2
- package/dist/npm/client/partialPayment.d.ts.map +1 -1
- package/dist/npm/client/partialPayment.js +4 -5
- package/dist/npm/client/partialPayment.js.map +1 -1
- package/dist/npm/models/common/index.d.ts +6 -0
- package/dist/npm/models/common/index.d.ts.map +1 -1
- package/dist/npm/models/index.d.ts +1 -1
- package/dist/npm/models/index.d.ts.map +1 -1
- package/dist/npm/models/index.js +3 -2
- package/dist/npm/models/index.js.map +1 -1
- package/dist/npm/models/ledger/Credential.d.ts +17 -0
- package/dist/npm/models/ledger/Credential.d.ts.map +1 -0
- package/dist/npm/models/ledger/Credential.js +3 -0
- package/dist/npm/models/ledger/Credential.js.map +1 -0
- package/dist/npm/models/ledger/DepositPreauth.d.ts +3 -1
- package/dist/npm/models/ledger/DepositPreauth.d.ts.map +1 -1
- package/dist/npm/models/ledger/Ledger.d.ts +1 -0
- package/dist/npm/models/ledger/Ledger.d.ts.map +1 -1
- package/dist/npm/models/ledger/LedgerEntry.d.ts +4 -2
- package/dist/npm/models/ledger/LedgerEntry.d.ts.map +1 -1
- package/dist/npm/models/ledger/MPToken.d.ts +1 -2
- package/dist/npm/models/ledger/MPToken.d.ts.map +1 -1
- package/dist/npm/models/ledger/MPTokenIssuance.d.ts +0 -1
- package/dist/npm/models/ledger/MPTokenIssuance.d.ts.map +1 -1
- package/dist/npm/models/ledger/PermissionedDomain.d.ts +11 -0
- package/dist/npm/models/ledger/PermissionedDomain.d.ts.map +1 -0
- package/dist/npm/models/ledger/PermissionedDomain.js +3 -0
- package/dist/npm/models/ledger/PermissionedDomain.js.map +1 -0
- package/dist/npm/models/ledger/RippleState.d.ts +3 -1
- package/dist/npm/models/ledger/RippleState.d.ts.map +1 -1
- package/dist/npm/models/ledger/RippleState.js +2 -0
- package/dist/npm/models/ledger/RippleState.js.map +1 -1
- package/dist/npm/models/ledger/index.d.ts +4 -3
- 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/baseMethod.d.ts +1 -0
- package/dist/npm/models/methods/baseMethod.d.ts.map +1 -1
- package/dist/npm/models/methods/depositAuthorized.d.ts +2 -0
- package/dist/npm/models/methods/depositAuthorized.d.ts.map +1 -1
- package/dist/npm/models/methods/index.d.ts +6 -5
- package/dist/npm/models/methods/index.d.ts.map +1 -1
- package/dist/npm/models/methods/ledger.d.ts +2 -2
- package/dist/npm/models/methods/ledger.d.ts.map +1 -1
- package/dist/npm/models/methods/ledgerEntry.d.ts +7 -0
- package/dist/npm/models/methods/ledgerEntry.d.ts.map +1 -1
- package/dist/npm/models/methods/serverState.d.ts +1 -0
- package/dist/npm/models/methods/serverState.d.ts.map +1 -1
- package/dist/npm/models/methods/simulate.d.ts +42 -0
- package/dist/npm/models/methods/simulate.d.ts.map +1 -0
- package/dist/npm/models/methods/simulate.js +3 -0
- package/dist/npm/models/methods/simulate.js.map +1 -0
- package/dist/npm/models/methods/subscribe.d.ts +7 -3
- package/dist/npm/models/methods/subscribe.d.ts.map +1 -1
- package/dist/npm/models/transactions/AMMClawback.d.ts +17 -0
- package/dist/npm/models/transactions/AMMClawback.d.ts.map +1 -0
- package/dist/npm/models/transactions/AMMClawback.js +34 -0
- package/dist/npm/models/transactions/AMMClawback.js.map +1 -0
- package/dist/npm/models/transactions/AMMDeposit.d.ts +2 -2
- package/dist/npm/models/transactions/AMMDeposit.d.ts.map +1 -1
- package/dist/npm/models/transactions/AMMWithdraw.d.ts +2 -2
- package/dist/npm/models/transactions/AMMWithdraw.d.ts.map +1 -1
- package/dist/npm/models/transactions/CredentialAccept.d.ts +9 -0
- package/dist/npm/models/transactions/CredentialAccept.d.ts.map +1 -0
- package/dist/npm/models/transactions/CredentialAccept.js +12 -0
- package/dist/npm/models/transactions/CredentialAccept.js.map +1 -0
- package/dist/npm/models/transactions/CredentialCreate.d.ts +11 -0
- package/dist/npm/models/transactions/CredentialCreate.d.ts.map +1 -0
- package/dist/npm/models/transactions/CredentialCreate.js +34 -0
- package/dist/npm/models/transactions/CredentialCreate.js.map +1 -0
- package/dist/npm/models/transactions/CredentialDelete.d.ts +10 -0
- package/dist/npm/models/transactions/CredentialDelete.d.ts.map +1 -0
- package/dist/npm/models/transactions/CredentialDelete.js +17 -0
- package/dist/npm/models/transactions/CredentialDelete.js.map +1 -0
- package/dist/npm/models/transactions/MPTokenAuthorize.d.ts +3 -3
- package/dist/npm/models/transactions/MPTokenAuthorize.d.ts.map +1 -1
- package/dist/npm/models/transactions/MPTokenAuthorize.js +1 -1
- package/dist/npm/models/transactions/MPTokenAuthorize.js.map +1 -1
- package/dist/npm/models/transactions/MPTokenIssuanceCreate.d.ts +2 -2
- package/dist/npm/models/transactions/MPTokenIssuanceCreate.d.ts.map +1 -1
- package/dist/npm/models/transactions/MPTokenIssuanceCreate.js +28 -0
- package/dist/npm/models/transactions/MPTokenIssuanceCreate.js.map +1 -1
- package/dist/npm/models/transactions/MPTokenIssuanceSet.d.ts +3 -3
- package/dist/npm/models/transactions/MPTokenIssuanceSet.d.ts.map +1 -1
- package/dist/npm/models/transactions/MPTokenIssuanceSet.js +11 -4
- package/dist/npm/models/transactions/MPTokenIssuanceSet.js.map +1 -1
- package/dist/npm/models/transactions/NFTokenCreateOffer.d.ts +2 -2
- package/dist/npm/models/transactions/NFTokenCreateOffer.d.ts.map +1 -1
- package/dist/npm/models/transactions/NFTokenMint.d.ts +5 -3
- package/dist/npm/models/transactions/NFTokenMint.d.ts.map +1 -1
- package/dist/npm/models/transactions/NFTokenMint.js +1 -0
- package/dist/npm/models/transactions/NFTokenMint.js.map +1 -1
- package/dist/npm/models/transactions/NFTokenModify.d.ts +9 -0
- package/dist/npm/models/transactions/NFTokenModify.d.ts.map +1 -0
- package/dist/npm/models/transactions/NFTokenModify.js +22 -0
- package/dist/npm/models/transactions/NFTokenModify.js.map +1 -0
- package/dist/npm/models/transactions/XChainModifyBridge.d.ts +2 -2
- package/dist/npm/models/transactions/XChainModifyBridge.d.ts.map +1 -1
- package/dist/npm/models/transactions/accountDelete.d.ts +1 -0
- package/dist/npm/models/transactions/accountDelete.d.ts.map +1 -1
- package/dist/npm/models/transactions/accountDelete.js +1 -0
- package/dist/npm/models/transactions/accountDelete.js.map +1 -1
- package/dist/npm/models/transactions/accountSet.d.ts +2 -2
- 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/batch.d.ts +39 -0
- package/dist/npm/models/transactions/batch.d.ts.map +1 -0
- package/dist/npm/models/transactions/batch.js +62 -0
- package/dist/npm/models/transactions/batch.js.map +1 -0
- package/dist/npm/models/transactions/clawback.d.ts +1 -1
- package/dist/npm/models/transactions/clawback.d.ts.map +1 -1
- package/dist/npm/models/transactions/clawback.js +6 -6
- package/dist/npm/models/transactions/clawback.js.map +1 -1
- package/dist/npm/models/transactions/common.d.ts +22 -5
- package/dist/npm/models/transactions/common.d.ts.map +1 -1
- package/dist/npm/models/transactions/common.js +113 -12
- package/dist/npm/models/transactions/common.js.map +1 -1
- package/dist/npm/models/transactions/depositPreauth.d.ts +3 -0
- package/dist/npm/models/transactions/depositPreauth.d.ts.map +1 -1
- package/dist/npm/models/transactions/depositPreauth.js +20 -7
- package/dist/npm/models/transactions/depositPreauth.js.map +1 -1
- package/dist/npm/models/transactions/escrowFinish.d.ts +1 -0
- package/dist/npm/models/transactions/escrowFinish.d.ts.map +1 -1
- package/dist/npm/models/transactions/escrowFinish.js +1 -0
- 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 +5 -1
- package/dist/npm/models/transactions/index.js.map +1 -1
- package/dist/npm/models/transactions/metadata.d.ts +2 -1
- package/dist/npm/models/transactions/metadata.d.ts.map +1 -1
- package/dist/npm/models/transactions/offerCreate.d.ts +2 -2
- package/dist/npm/models/transactions/offerCreate.d.ts.map +1 -1
- package/dist/npm/models/transactions/payment.d.ts +5 -4
- package/dist/npm/models/transactions/payment.d.ts.map +1 -1
- package/dist/npm/models/transactions/payment.js +1 -0
- package/dist/npm/models/transactions/payment.js.map +1 -1
- package/dist/npm/models/transactions/paymentChannelClaim.d.ts +3 -2
- package/dist/npm/models/transactions/paymentChannelClaim.d.ts.map +1 -1
- package/dist/npm/models/transactions/paymentChannelClaim.js +1 -0
- package/dist/npm/models/transactions/paymentChannelClaim.js.map +1 -1
- package/dist/npm/models/transactions/permissionedDomainDelete.d.ts +7 -0
- package/dist/npm/models/transactions/permissionedDomainDelete.d.ts.map +1 -0
- package/dist/npm/models/transactions/permissionedDomainDelete.js +10 -0
- package/dist/npm/models/transactions/permissionedDomainDelete.js.map +1 -0
- package/dist/npm/models/transactions/permissionedDomainSet.d.ts +9 -0
- package/dist/npm/models/transactions/permissionedDomainSet.d.ts.map +1 -0
- package/dist/npm/models/transactions/permissionedDomainSet.js +13 -0
- package/dist/npm/models/transactions/permissionedDomainSet.js.map +1 -0
- package/dist/npm/models/transactions/transaction.d.ts +13 -5
- package/dist/npm/models/transactions/transaction.d.ts.map +1 -1
- package/dist/npm/models/transactions/transaction.js +40 -5
- package/dist/npm/models/transactions/transaction.js.map +1 -1
- package/dist/npm/models/transactions/trustSet.d.ts +7 -3
- package/dist/npm/models/transactions/trustSet.d.ts.map +1 -1
- package/dist/npm/models/transactions/trustSet.js +2 -0
- package/dist/npm/models/transactions/trustSet.js.map +1 -1
- package/dist/npm/models/utils/flags.d.ts +2 -0
- package/dist/npm/models/utils/flags.d.ts.map +1 -1
- package/dist/npm/models/utils/flags.js +62 -29
- package/dist/npm/models/utils/flags.js.map +1 -1
- package/dist/npm/models/utils/index.d.ts +1 -0
- package/dist/npm/models/utils/index.d.ts.map +1 -1
- package/dist/npm/models/utils/index.js +2 -1
- package/dist/npm/models/utils/index.js.map +1 -1
- package/dist/npm/snippets/src/paths.js +5 -9
- package/dist/npm/snippets/src/paths.js.map +1 -1
- package/dist/npm/snippets/tsconfig.tsbuildinfo +1 -1
- package/dist/npm/src/Wallet/batchSigner.d.ts +8 -0
- package/dist/npm/src/Wallet/batchSigner.d.ts.map +1 -0
- package/dist/npm/src/Wallet/batchSigner.js +124 -0
- package/dist/npm/src/Wallet/batchSigner.js.map +1 -0
- package/dist/npm/src/Wallet/defaultFaucets.d.ts +2 -1
- package/dist/npm/src/Wallet/defaultFaucets.d.ts.map +1 -1
- package/dist/npm/src/Wallet/defaultFaucets.js +5 -0
- package/dist/npm/src/Wallet/defaultFaucets.js.map +1 -1
- package/dist/npm/src/Wallet/index.d.ts.map +1 -1
- package/dist/npm/src/Wallet/index.js +8 -2
- package/dist/npm/src/Wallet/index.js.map +1 -1
- package/dist/npm/src/client/RequestManager.d.ts.map +1 -1
- package/dist/npm/src/client/RequestManager.js +3 -3
- package/dist/npm/src/client/RequestManager.js.map +1 -1
- package/dist/npm/src/client/connection.d.ts.map +1 -1
- package/dist/npm/src/client/connection.js.map +1 -1
- package/dist/npm/src/client/index.d.ts +4 -0
- package/dist/npm/src/client/index.d.ts.map +1 -1
- package/dist/npm/src/client/index.js +16 -9
- package/dist/npm/src/client/index.js.map +1 -1
- package/dist/npm/src/client/partialPayment.d.ts +2 -2
- package/dist/npm/src/client/partialPayment.d.ts.map +1 -1
- package/dist/npm/src/client/partialPayment.js +4 -5
- package/dist/npm/src/client/partialPayment.js.map +1 -1
- package/dist/npm/src/models/common/index.d.ts +6 -0
- package/dist/npm/src/models/common/index.d.ts.map +1 -1
- package/dist/npm/src/models/index.d.ts +1 -1
- package/dist/npm/src/models/index.d.ts.map +1 -1
- package/dist/npm/src/models/index.js +3 -2
- package/dist/npm/src/models/index.js.map +1 -1
- package/dist/npm/src/models/ledger/Credential.d.ts +17 -0
- package/dist/npm/src/models/ledger/Credential.d.ts.map +1 -0
- package/dist/npm/src/models/ledger/Credential.js +3 -0
- package/dist/npm/src/models/ledger/Credential.js.map +1 -0
- package/dist/npm/src/models/ledger/DepositPreauth.d.ts +3 -1
- package/dist/npm/src/models/ledger/DepositPreauth.d.ts.map +1 -1
- package/dist/npm/src/models/ledger/Ledger.d.ts +1 -0
- package/dist/npm/src/models/ledger/Ledger.d.ts.map +1 -1
- package/dist/npm/src/models/ledger/LedgerEntry.d.ts +4 -2
- package/dist/npm/src/models/ledger/LedgerEntry.d.ts.map +1 -1
- package/dist/npm/src/models/ledger/MPToken.d.ts +1 -2
- package/dist/npm/src/models/ledger/MPToken.d.ts.map +1 -1
- package/dist/npm/src/models/ledger/MPTokenIssuance.d.ts +0 -1
- package/dist/npm/src/models/ledger/MPTokenIssuance.d.ts.map +1 -1
- package/dist/npm/src/models/ledger/PermissionedDomain.d.ts +11 -0
- package/dist/npm/src/models/ledger/PermissionedDomain.d.ts.map +1 -0
- package/dist/npm/src/models/ledger/PermissionedDomain.js +3 -0
- package/dist/npm/src/models/ledger/PermissionedDomain.js.map +1 -0
- package/dist/npm/src/models/ledger/RippleState.d.ts +3 -1
- package/dist/npm/src/models/ledger/RippleState.d.ts.map +1 -1
- package/dist/npm/src/models/ledger/RippleState.js +2 -0
- package/dist/npm/src/models/ledger/RippleState.js.map +1 -1
- package/dist/npm/src/models/ledger/index.d.ts +4 -3
- 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/baseMethod.d.ts +1 -0
- package/dist/npm/src/models/methods/baseMethod.d.ts.map +1 -1
- package/dist/npm/src/models/methods/depositAuthorized.d.ts +2 -0
- package/dist/npm/src/models/methods/depositAuthorized.d.ts.map +1 -1
- package/dist/npm/src/models/methods/index.d.ts +6 -5
- package/dist/npm/src/models/methods/index.d.ts.map +1 -1
- package/dist/npm/src/models/methods/ledger.d.ts +2 -2
- package/dist/npm/src/models/methods/ledger.d.ts.map +1 -1
- package/dist/npm/src/models/methods/ledgerEntry.d.ts +7 -0
- package/dist/npm/src/models/methods/ledgerEntry.d.ts.map +1 -1
- package/dist/npm/src/models/methods/serverState.d.ts +1 -0
- package/dist/npm/src/models/methods/serverState.d.ts.map +1 -1
- package/dist/npm/src/models/methods/simulate.d.ts +42 -0
- package/dist/npm/src/models/methods/simulate.d.ts.map +1 -0
- package/dist/npm/src/models/methods/simulate.js +3 -0
- package/dist/npm/src/models/methods/simulate.js.map +1 -0
- package/dist/npm/src/models/methods/subscribe.d.ts +7 -3
- package/dist/npm/src/models/methods/subscribe.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/AMMClawback.d.ts +17 -0
- package/dist/npm/src/models/transactions/AMMClawback.d.ts.map +1 -0
- package/dist/npm/src/models/transactions/AMMClawback.js +34 -0
- package/dist/npm/src/models/transactions/AMMClawback.js.map +1 -0
- package/dist/npm/src/models/transactions/AMMDeposit.d.ts +2 -2
- package/dist/npm/src/models/transactions/AMMDeposit.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/AMMWithdraw.d.ts +2 -2
- package/dist/npm/src/models/transactions/AMMWithdraw.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/CredentialAccept.d.ts +9 -0
- package/dist/npm/src/models/transactions/CredentialAccept.d.ts.map +1 -0
- package/dist/npm/src/models/transactions/CredentialAccept.js +12 -0
- package/dist/npm/src/models/transactions/CredentialAccept.js.map +1 -0
- package/dist/npm/src/models/transactions/CredentialCreate.d.ts +11 -0
- package/dist/npm/src/models/transactions/CredentialCreate.d.ts.map +1 -0
- package/dist/npm/src/models/transactions/CredentialCreate.js +34 -0
- package/dist/npm/src/models/transactions/CredentialCreate.js.map +1 -0
- package/dist/npm/src/models/transactions/CredentialDelete.d.ts +10 -0
- package/dist/npm/src/models/transactions/CredentialDelete.d.ts.map +1 -0
- package/dist/npm/src/models/transactions/CredentialDelete.js +17 -0
- package/dist/npm/src/models/transactions/CredentialDelete.js.map +1 -0
- package/dist/npm/src/models/transactions/MPTokenAuthorize.d.ts +3 -3
- package/dist/npm/src/models/transactions/MPTokenAuthorize.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/MPTokenAuthorize.js +1 -1
- package/dist/npm/src/models/transactions/MPTokenAuthorize.js.map +1 -1
- package/dist/npm/src/models/transactions/MPTokenIssuanceCreate.d.ts +2 -2
- package/dist/npm/src/models/transactions/MPTokenIssuanceCreate.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/MPTokenIssuanceCreate.js +28 -0
- package/dist/npm/src/models/transactions/MPTokenIssuanceCreate.js.map +1 -1
- package/dist/npm/src/models/transactions/MPTokenIssuanceSet.d.ts +3 -3
- package/dist/npm/src/models/transactions/MPTokenIssuanceSet.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/MPTokenIssuanceSet.js +11 -4
- package/dist/npm/src/models/transactions/MPTokenIssuanceSet.js.map +1 -1
- package/dist/npm/src/models/transactions/NFTokenCreateOffer.d.ts +2 -2
- package/dist/npm/src/models/transactions/NFTokenCreateOffer.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/NFTokenMint.d.ts +5 -3
- package/dist/npm/src/models/transactions/NFTokenMint.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/NFTokenMint.js +1 -0
- package/dist/npm/src/models/transactions/NFTokenMint.js.map +1 -1
- package/dist/npm/src/models/transactions/NFTokenModify.d.ts +9 -0
- package/dist/npm/src/models/transactions/NFTokenModify.d.ts.map +1 -0
- package/dist/npm/src/models/transactions/NFTokenModify.js +22 -0
- package/dist/npm/src/models/transactions/NFTokenModify.js.map +1 -0
- package/dist/npm/src/models/transactions/XChainModifyBridge.d.ts +2 -2
- package/dist/npm/src/models/transactions/XChainModifyBridge.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/accountDelete.d.ts +1 -0
- package/dist/npm/src/models/transactions/accountDelete.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/accountDelete.js +1 -0
- package/dist/npm/src/models/transactions/accountDelete.js.map +1 -1
- package/dist/npm/src/models/transactions/accountSet.d.ts +2 -2
- 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/batch.d.ts +39 -0
- package/dist/npm/src/models/transactions/batch.d.ts.map +1 -0
- package/dist/npm/src/models/transactions/batch.js +62 -0
- package/dist/npm/src/models/transactions/batch.js.map +1 -0
- package/dist/npm/src/models/transactions/clawback.d.ts +1 -1
- package/dist/npm/src/models/transactions/clawback.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/clawback.js +6 -6
- package/dist/npm/src/models/transactions/clawback.js.map +1 -1
- package/dist/npm/src/models/transactions/common.d.ts +22 -5
- package/dist/npm/src/models/transactions/common.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/common.js +113 -12
- package/dist/npm/src/models/transactions/common.js.map +1 -1
- package/dist/npm/src/models/transactions/depositPreauth.d.ts +3 -0
- package/dist/npm/src/models/transactions/depositPreauth.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/depositPreauth.js +20 -7
- package/dist/npm/src/models/transactions/depositPreauth.js.map +1 -1
- package/dist/npm/src/models/transactions/escrowFinish.d.ts +1 -0
- package/dist/npm/src/models/transactions/escrowFinish.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/escrowFinish.js +1 -0
- 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 +5 -1
- package/dist/npm/src/models/transactions/index.js.map +1 -1
- package/dist/npm/src/models/transactions/metadata.d.ts +2 -1
- package/dist/npm/src/models/transactions/metadata.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/offerCreate.d.ts +2 -2
- package/dist/npm/src/models/transactions/offerCreate.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/payment.d.ts +5 -4
- package/dist/npm/src/models/transactions/payment.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/payment.js +1 -0
- package/dist/npm/src/models/transactions/payment.js.map +1 -1
- package/dist/npm/src/models/transactions/paymentChannelClaim.d.ts +3 -2
- package/dist/npm/src/models/transactions/paymentChannelClaim.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/paymentChannelClaim.js +1 -0
- package/dist/npm/src/models/transactions/paymentChannelClaim.js.map +1 -1
- package/dist/npm/src/models/transactions/permissionedDomainDelete.d.ts +7 -0
- package/dist/npm/src/models/transactions/permissionedDomainDelete.d.ts.map +1 -0
- package/dist/npm/src/models/transactions/permissionedDomainDelete.js +10 -0
- package/dist/npm/src/models/transactions/permissionedDomainDelete.js.map +1 -0
- package/dist/npm/src/models/transactions/permissionedDomainSet.d.ts +9 -0
- package/dist/npm/src/models/transactions/permissionedDomainSet.d.ts.map +1 -0
- package/dist/npm/src/models/transactions/permissionedDomainSet.js +13 -0
- package/dist/npm/src/models/transactions/permissionedDomainSet.js.map +1 -0
- package/dist/npm/src/models/transactions/transaction.d.ts +13 -5
- package/dist/npm/src/models/transactions/transaction.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/transaction.js +40 -5
- package/dist/npm/src/models/transactions/transaction.js.map +1 -1
- package/dist/npm/src/models/transactions/trustSet.d.ts +7 -3
- package/dist/npm/src/models/transactions/trustSet.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/trustSet.js +2 -0
- package/dist/npm/src/models/transactions/trustSet.js.map +1 -1
- package/dist/npm/src/models/utils/flags.d.ts +2 -0
- package/dist/npm/src/models/utils/flags.d.ts.map +1 -1
- package/dist/npm/src/models/utils/flags.js +62 -29
- package/dist/npm/src/models/utils/flags.js.map +1 -1
- package/dist/npm/src/models/utils/index.d.ts +1 -0
- package/dist/npm/src/models/utils/index.d.ts.map +1 -1
- package/dist/npm/src/models/utils/index.js +2 -1
- package/dist/npm/src/models/utils/index.js.map +1 -1
- package/dist/npm/src/sugar/autofill.d.ts +3 -1
- package/dist/npm/src/sugar/autofill.d.ts.map +1 -1
- package/dist/npm/src/sugar/autofill.js +100 -5
- package/dist/npm/src/sugar/autofill.js.map +1 -1
- package/dist/npm/src/sugar/submit.d.ts.map +1 -1
- package/dist/npm/src/sugar/submit.js +7 -7
- package/dist/npm/src/sugar/submit.js.map +1 -1
- package/dist/npm/src/utils/hashes/hashLedger.d.ts.map +1 -1
- package/dist/npm/src/utils/hashes/hashLedger.js +4 -1
- package/dist/npm/src/utils/hashes/hashLedger.js.map +1 -1
- package/dist/npm/src/utils/index.d.ts +1 -2
- package/dist/npm/src/utils/index.d.ts.map +1 -1
- package/dist/npm/src/utils/index.js +1 -3
- package/dist/npm/src/utils/index.js.map +1 -1
- package/dist/npm/sugar/autofill.d.ts +3 -1
- package/dist/npm/sugar/autofill.d.ts.map +1 -1
- package/dist/npm/sugar/autofill.js +100 -5
- package/dist/npm/sugar/autofill.js.map +1 -1
- package/dist/npm/sugar/submit.d.ts.map +1 -1
- package/dist/npm/sugar/submit.js +7 -7
- package/dist/npm/sugar/submit.js.map +1 -1
- package/dist/npm/utils/hashes/hashLedger.d.ts.map +1 -1
- package/dist/npm/utils/hashes/hashLedger.js +4 -1
- package/dist/npm/utils/hashes/hashLedger.js.map +1 -1
- package/dist/npm/utils/index.d.ts +1 -2
- package/dist/npm/utils/index.d.ts.map +1 -1
- package/dist/npm/utils/index.js +1 -3
- package/dist/npm/utils/index.js.map +1 -1
- package/package.json +6 -6
- package/src/Wallet/batchSigner.ts +222 -0
- package/src/Wallet/defaultFaucets.ts +6 -0
- package/src/Wallet/index.ts +9 -3
- package/src/client/RequestManager.ts +4 -1
- package/src/client/connection.ts +0 -1
- package/src/client/index.ts +49 -30
- package/src/client/partialPayment.ts +18 -5
- package/src/models/common/index.ts +10 -0
- package/src/models/index.ts +2 -1
- package/src/models/ledger/Credential.ts +47 -0
- package/src/models/ledger/DepositPreauth.ts +6 -2
- package/src/models/ledger/Ledger.ts +5 -0
- package/src/models/ledger/LedgerEntry.ts +6 -0
- package/src/models/ledger/MPToken.ts +1 -2
- package/src/models/ledger/MPTokenIssuance.ts +0 -1
- package/src/models/ledger/PermissionedDomain.ts +29 -0
- package/src/models/ledger/RippleState.ts +4 -0
- package/src/models/ledger/index.ts +4 -2
- package/src/models/methods/baseMethod.ts +1 -0
- package/src/models/methods/depositAuthorized.ts +10 -0
- package/src/models/methods/index.ts +20 -0
- package/src/models/methods/ledger.ts +2 -2
- package/src/models/methods/ledgerEntry.ts +29 -1
- package/src/models/methods/serverState.ts +1 -0
- package/src/models/methods/simulate.ts +88 -0
- package/src/models/methods/subscribe.ts +34 -3
- package/src/models/transactions/AMMClawback.ts +120 -0
- package/src/models/transactions/AMMDeposit.ts +2 -2
- package/src/models/transactions/AMMWithdraw.ts +2 -2
- package/src/models/transactions/CredentialAccept.ts +44 -0
- package/src/models/transactions/CredentialCreate.ts +81 -0
- package/src/models/transactions/CredentialDelete.ts +55 -0
- package/src/models/transactions/MPTokenAuthorize.ts +4 -4
- package/src/models/transactions/MPTokenIssuanceCreate.ts +60 -12
- package/src/models/transactions/MPTokenIssuanceSet.ts +20 -10
- package/src/models/transactions/NFTokenCreateOffer.ts +2 -2
- package/src/models/transactions/NFTokenMint.ts +7 -2
- package/src/models/transactions/NFTokenModify.ts +67 -0
- package/src/models/transactions/XChainModifyBridge.ts +2 -2
- package/src/models/transactions/accountDelete.ts +16 -0
- package/src/models/transactions/accountSet.ts +2 -1
- package/src/models/transactions/batch.ts +147 -0
- package/src/models/transactions/clawback.ts +7 -9
- package/src/models/transactions/common.ts +219 -22
- package/src/models/transactions/depositPreauth.ts +54 -15
- package/src/models/transactions/escrowFinish.ts +14 -0
- package/src/models/transactions/index.ts +13 -1
- package/src/models/transactions/metadata.ts +6 -4
- package/src/models/transactions/offerCreate.ts +2 -2
- package/src/models/transactions/payment.ts +19 -4
- package/src/models/transactions/paymentChannelClaim.ts +22 -2
- package/src/models/transactions/permissionedDomainDelete.ts +28 -0
- package/src/models/transactions/permissionedDomainSet.ts +54 -0
- package/src/models/transactions/transaction.ts +78 -15
- package/src/models/transactions/trustSet.ts +12 -2
- package/src/models/utils/flags.ts +88 -33
- package/src/models/utils/index.ts +1 -0
- package/src/sugar/autofill.ts +140 -11
- package/src/sugar/submit.ts +3 -5
- package/src/utils/hashes/hashLedger.ts +5 -2
- package/src/utils/index.ts +0 -2
- package/dist/npm/snippets/src/bridgeTransfer.d.ts +0 -2
- package/dist/npm/snippets/src/bridgeTransfer.d.ts.map +0 -1
- package/dist/npm/snippets/src/bridgeTransfer.js +0 -126
- package/dist/npm/snippets/src/bridgeTransfer.js.map +0 -1
- package/dist/npm/src/utils/mptConversion.d.ts +0 -2
- package/dist/npm/src/utils/mptConversion.d.ts.map +0 -1
- package/dist/npm/src/utils/mptConversion.js +0 -31
- package/dist/npm/src/utils/mptConversion.js.map +0 -1
- package/dist/npm/utils/mptConversion.d.ts +0 -2
- package/dist/npm/utils/mptConversion.d.ts.map +0 -1
- package/dist/npm/utils/mptConversion.js +0 -31
- package/dist/npm/utils/mptConversion.js.map +0 -1
- package/src/utils/mptConversion.ts +0 -61
@@ -0,0 +1,147 @@
|
|
1
|
+
import { ValidationError } from '../../errors'
|
2
|
+
import { Signer } from '../common'
|
3
|
+
|
4
|
+
import {
|
5
|
+
BaseTransaction,
|
6
|
+
GlobalFlagsInterface,
|
7
|
+
isArray,
|
8
|
+
isObject,
|
9
|
+
isString,
|
10
|
+
validateBaseTransaction,
|
11
|
+
validateOptionalField,
|
12
|
+
validateRequiredField,
|
13
|
+
} from './common'
|
14
|
+
import type { SubmittableTransaction } from './transaction'
|
15
|
+
|
16
|
+
/**
|
17
|
+
* Enum representing values of {@link Batch} transaction flags.
|
18
|
+
*
|
19
|
+
* @category Transaction Flags
|
20
|
+
*/
|
21
|
+
export enum BatchFlags {
|
22
|
+
tfAllOrNothing = 0x00010000,
|
23
|
+
tfOnlyOne = 0x00020000,
|
24
|
+
tfUntilFailure = 0x00040000,
|
25
|
+
tfIndependent = 0x00080000,
|
26
|
+
}
|
27
|
+
|
28
|
+
/**
|
29
|
+
* Map of flags to boolean values representing {@link Batch} transaction
|
30
|
+
* flags.
|
31
|
+
*
|
32
|
+
* @category Transaction Flags
|
33
|
+
*/
|
34
|
+
export interface BatchFlagsInterface extends GlobalFlagsInterface {
|
35
|
+
tfAllOrNothing?: boolean
|
36
|
+
tfOnlyOne?: boolean
|
37
|
+
tfUntilFailure?: boolean
|
38
|
+
tfIndependent?: boolean
|
39
|
+
}
|
40
|
+
|
41
|
+
export type BatchInnerTransaction = SubmittableTransaction & {
|
42
|
+
Fee?: '0'
|
43
|
+
|
44
|
+
SigningPubKey?: ''
|
45
|
+
|
46
|
+
TxnSignature?: never
|
47
|
+
|
48
|
+
Signers?: never
|
49
|
+
|
50
|
+
LastLedgerSequence?: never
|
51
|
+
}
|
52
|
+
|
53
|
+
export interface BatchSigner {
|
54
|
+
BatchSigner: {
|
55
|
+
Account: string
|
56
|
+
|
57
|
+
SigningPubKey?: string
|
58
|
+
|
59
|
+
TxnSignature?: string
|
60
|
+
|
61
|
+
Signers?: Signer[]
|
62
|
+
}
|
63
|
+
}
|
64
|
+
|
65
|
+
/**
|
66
|
+
* @category Transaction Models
|
67
|
+
*/
|
68
|
+
export interface Batch extends BaseTransaction {
|
69
|
+
TransactionType: 'Batch'
|
70
|
+
|
71
|
+
BatchSigners?: BatchSigner[]
|
72
|
+
|
73
|
+
RawTransactions: Array<{
|
74
|
+
RawTransaction: BatchInnerTransaction
|
75
|
+
}>
|
76
|
+
}
|
77
|
+
|
78
|
+
/**
|
79
|
+
* Verify the form and type of a Batch at runtime.
|
80
|
+
*
|
81
|
+
* @param tx - A Batch Transaction.
|
82
|
+
* @throws When the Batch is malformed.
|
83
|
+
*/
|
84
|
+
// eslint-disable-next-line max-lines-per-function -- needed here due to the complexity
|
85
|
+
export function validateBatch(tx: Record<string, unknown>): void {
|
86
|
+
validateBaseTransaction(tx)
|
87
|
+
|
88
|
+
validateRequiredField(tx, 'RawTransactions', isArray)
|
89
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- checked above
|
90
|
+
const rawTransactions = tx.RawTransactions as unknown[]
|
91
|
+
rawTransactions.forEach((rawTxObj, index) => {
|
92
|
+
if (!isObject(rawTxObj)) {
|
93
|
+
throw new ValidationError(
|
94
|
+
`Batch: RawTransactions[${index}] is not object.`,
|
95
|
+
)
|
96
|
+
}
|
97
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- checked above
|
98
|
+
const rawTxRecord = rawTxObj as Record<string, unknown>
|
99
|
+
validateRequiredField(rawTxRecord, 'RawTransaction', isObject, {
|
100
|
+
paramName: `RawTransactions[${index}].RawTransaction`,
|
101
|
+
txType: 'Batch',
|
102
|
+
})
|
103
|
+
|
104
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- checked above
|
105
|
+
const rawTx = rawTxRecord.RawTransaction as Record<string, unknown>
|
106
|
+
if (rawTx.TransactionType === 'Batch') {
|
107
|
+
throw new ValidationError(
|
108
|
+
`Batch: RawTransactions[${index}] is a Batch transaction. Cannot nest Batch transactions.`,
|
109
|
+
)
|
110
|
+
}
|
111
|
+
})
|
112
|
+
// Full validation of each `RawTransaction` object is done in `validate` to avoid dependency cycles
|
113
|
+
|
114
|
+
validateOptionalField(tx, 'BatchSigners', isArray)
|
115
|
+
|
116
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- checked above
|
117
|
+
const batchSigners = tx.BatchSigners as unknown[] | undefined
|
118
|
+
batchSigners?.forEach((signerObj, index) => {
|
119
|
+
if (!isObject(signerObj)) {
|
120
|
+
throw new ValidationError(`Batch: BatchSigners[${index}] is not object.`)
|
121
|
+
}
|
122
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- checked above
|
123
|
+
const signerRecord = signerObj as Record<string, unknown>
|
124
|
+
validateRequiredField(signerRecord, 'BatchSigner', isObject, {
|
125
|
+
paramName: `BatchSigners[${index}].BatchSigner`,
|
126
|
+
txType: 'Batch',
|
127
|
+
})
|
128
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- checked above
|
129
|
+
const signer = signerRecord.BatchSigner as Record<string, unknown>
|
130
|
+
validateRequiredField(signer, 'Account', isString, {
|
131
|
+
paramName: `BatchSigners[${index}].Account`,
|
132
|
+
txType: 'Batch',
|
133
|
+
})
|
134
|
+
validateOptionalField(signer, 'SigningPubKey', isString, {
|
135
|
+
paramName: `BatchSigners[${index}].SigningPubKey`,
|
136
|
+
txType: 'Batch',
|
137
|
+
})
|
138
|
+
validateOptionalField(signer, 'TxnSignature', isString, {
|
139
|
+
paramName: `BatchSigners[${index}].TxnSignature`,
|
140
|
+
txType: 'Batch',
|
141
|
+
})
|
142
|
+
validateOptionalField(signer, 'Signers', isArray, {
|
143
|
+
paramName: `BatchSigners[${index}].Signers`,
|
144
|
+
txType: 'Batch',
|
145
|
+
})
|
146
|
+
})
|
147
|
+
}
|
@@ -31,7 +31,7 @@ export interface Clawback extends BaseTransaction {
|
|
31
31
|
* Indicates the AccountID that the issuer wants to clawback. This field is only valid for clawing back
|
32
32
|
* MPTs.
|
33
33
|
*/
|
34
|
-
|
34
|
+
Holder?: string
|
35
35
|
}
|
36
36
|
|
37
37
|
/**
|
@@ -42,7 +42,7 @@ export interface Clawback extends BaseTransaction {
|
|
42
42
|
*/
|
43
43
|
export function validateClawback(tx: Record<string, unknown>): void {
|
44
44
|
validateBaseTransaction(tx)
|
45
|
-
validateOptionalField(tx, '
|
45
|
+
validateOptionalField(tx, 'Holder', isAccount)
|
46
46
|
|
47
47
|
if (tx.Amount == null) {
|
48
48
|
throw new ValidationError('Clawback: missing field Amount')
|
@@ -56,17 +56,15 @@ export function validateClawback(tx: Record<string, unknown>): void {
|
|
56
56
|
throw new ValidationError('Clawback: invalid holder Account')
|
57
57
|
}
|
58
58
|
|
59
|
-
if (isMPTAmount(tx.Amount) && tx.Account === tx.
|
59
|
+
if (isMPTAmount(tx.Amount) && tx.Account === tx.Holder) {
|
60
60
|
throw new ValidationError('Clawback: invalid holder Account')
|
61
61
|
}
|
62
62
|
|
63
|
-
if (isIssuedCurrency(tx.Amount) && tx.
|
64
|
-
throw new ValidationError(
|
65
|
-
'Clawback: cannot have MPTokenHolder for currency',
|
66
|
-
)
|
63
|
+
if (isIssuedCurrency(tx.Amount) && tx.Holder) {
|
64
|
+
throw new ValidationError('Clawback: cannot have Holder for currency')
|
67
65
|
}
|
68
66
|
|
69
|
-
if (isMPTAmount(tx.Amount) && !tx.
|
70
|
-
throw new ValidationError('Clawback: missing
|
67
|
+
if (isMPTAmount(tx.Amount) && !tx.Holder) {
|
68
|
+
throw new ValidationError('Clawback: missing Holder')
|
71
69
|
}
|
72
70
|
}
|
@@ -1,19 +1,25 @@
|
|
1
|
+
/* eslint-disable max-lines -- common utility file */
|
2
|
+
import { HEX_REGEX } from '@xrplf/isomorphic/utils'
|
1
3
|
import { isValidClassicAddress, isValidXAddress } from 'ripple-address-codec'
|
2
4
|
import { TRANSACTION_TYPES } from 'ripple-binary-codec'
|
3
5
|
|
4
6
|
import { ValidationError } from '../../errors'
|
5
7
|
import {
|
6
8
|
Amount,
|
9
|
+
AuthorizeCredential,
|
7
10
|
Currency,
|
8
11
|
IssuedCurrencyAmount,
|
12
|
+
MPTAmount,
|
9
13
|
Memo,
|
10
14
|
Signer,
|
11
15
|
XChainBridge,
|
12
|
-
MPTAmount,
|
13
16
|
} from '../common'
|
14
17
|
import { onlyHasFields } from '../utils'
|
15
18
|
|
16
19
|
const MEMO_SIZE = 3
|
20
|
+
export const MAX_AUTHORIZED_CREDENTIALS = 8
|
21
|
+
const MAX_CREDENTIAL_BYTE_LENGTH = 64
|
22
|
+
const MAX_CREDENTIAL_TYPE_LENGTH = MAX_CREDENTIAL_BYTE_LENGTH * 2
|
17
23
|
|
18
24
|
function isMemo(obj: { Memo?: unknown }): boolean {
|
19
25
|
if (obj.Memo == null) {
|
@@ -61,6 +67,7 @@ const ISSUE_SIZE = 2
|
|
61
67
|
const ISSUED_CURRENCY_SIZE = 3
|
62
68
|
const XCHAIN_BRIDGE_SIZE = 4
|
63
69
|
const MPTOKEN_SIZE = 2
|
70
|
+
const AUTHORIZE_CREDENTIAL_SIZE = 1
|
64
71
|
|
65
72
|
function isRecord(value: unknown): value is Record<string, unknown> {
|
66
73
|
return value !== null && typeof value === 'object'
|
@@ -121,6 +128,24 @@ export function isIssuedCurrency(
|
|
121
128
|
)
|
122
129
|
}
|
123
130
|
|
131
|
+
/**
|
132
|
+
* Verify the form and type of an AuthorizeCredential at runtime
|
133
|
+
*
|
134
|
+
* @param input - The input to check the form and type of
|
135
|
+
* @returns Whether the AuthorizeCredential is properly formed
|
136
|
+
*/
|
137
|
+
export function isAuthorizeCredential(
|
138
|
+
input: unknown,
|
139
|
+
): input is AuthorizeCredential {
|
140
|
+
return (
|
141
|
+
isRecord(input) &&
|
142
|
+
isRecord(input.Credential) &&
|
143
|
+
Object.keys(input).length === AUTHORIZE_CREDENTIAL_SIZE &&
|
144
|
+
typeof input.Credential.CredentialType === 'string' &&
|
145
|
+
typeof input.Credential.Issuer === 'string'
|
146
|
+
)
|
147
|
+
}
|
148
|
+
|
124
149
|
/**
|
125
150
|
* Verify the form and type of an MPT at runtime.
|
126
151
|
*
|
@@ -185,31 +210,57 @@ export function isXChainBridge(input: unknown): input is XChainBridge {
|
|
185
210
|
)
|
186
211
|
}
|
187
212
|
|
213
|
+
/**
|
214
|
+
* Verify the form and type of an Object at runtime.
|
215
|
+
*
|
216
|
+
* @param input - The object to check the form and type of.
|
217
|
+
* @returns Whether the Object is properly formed.
|
218
|
+
*/
|
219
|
+
export function isObject(input: unknown): input is object {
|
220
|
+
return typeof input === 'object'
|
221
|
+
}
|
222
|
+
|
223
|
+
/**
|
224
|
+
* Verify the form and type of an Array at runtime.
|
225
|
+
*
|
226
|
+
* @param input - The object to check the form and type of.
|
227
|
+
* @returns Whether the Array is properly formed.
|
228
|
+
*/
|
229
|
+
export function isArray(input: unknown): boolean {
|
230
|
+
return Array.isArray(input)
|
231
|
+
}
|
232
|
+
|
188
233
|
/* eslint-disable @typescript-eslint/restrict-template-expressions -- tx.TransactionType is checked before any calls */
|
189
234
|
|
190
235
|
/**
|
191
236
|
* Verify the form and type of a required type for a transaction at runtime.
|
192
237
|
*
|
193
|
-
* @param tx - The
|
194
|
-
* @param
|
238
|
+
* @param tx - The object input to check the form and type of.
|
239
|
+
* @param param - The object parameter.
|
195
240
|
* @param checkValidity - The function to use to check the type.
|
241
|
+
* @param errorOpts - Extra values to make the error message easier to understand.
|
242
|
+
* @param errorOpts.txType - The transaction type throwing the error.
|
243
|
+
* @param errorOpts.paramName - The name of the parameter in the transaction with the error.
|
196
244
|
* @throws
|
197
245
|
*/
|
246
|
+
// eslint-disable-next-line max-params -- helper function
|
198
247
|
export function validateRequiredField(
|
199
248
|
tx: Record<string, unknown>,
|
200
|
-
|
249
|
+
param: string,
|
201
250
|
checkValidity: (inp: unknown) => boolean,
|
251
|
+
errorOpts: {
|
252
|
+
txType?: string
|
253
|
+
paramName?: string
|
254
|
+
} = {},
|
202
255
|
): void {
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
)
|
256
|
+
const paramNameStr = errorOpts.paramName ?? param
|
257
|
+
const txType = errorOpts.txType ?? tx.TransactionType
|
258
|
+
if (tx[param] == null) {
|
259
|
+
throw new ValidationError(`${txType}: missing field ${paramNameStr}`)
|
207
260
|
}
|
208
261
|
|
209
|
-
if (!checkValidity(tx[
|
210
|
-
throw new ValidationError(
|
211
|
-
`${tx.TransactionType}: invalid field ${paramName}`,
|
212
|
-
)
|
262
|
+
if (!checkValidity(tx[param])) {
|
263
|
+
throw new ValidationError(`${txType}: invalid field ${paramNameStr}`)
|
213
264
|
}
|
214
265
|
}
|
215
266
|
|
@@ -217,26 +268,39 @@ export function validateRequiredField(
|
|
217
268
|
* Verify the form and type of an optional type for a transaction at runtime.
|
218
269
|
*
|
219
270
|
* @param tx - The transaction input to check the form and type of.
|
220
|
-
* @param
|
271
|
+
* @param param - The object parameter.
|
221
272
|
* @param checkValidity - The function to use to check the type.
|
273
|
+
* @param errorOpts - Extra values to make the error message easier to understand.
|
274
|
+
* @param errorOpts.txType - The transaction type throwing the error.
|
275
|
+
* @param errorOpts.paramName - The name of the parameter in the transaction with the error.
|
222
276
|
* @throws
|
223
277
|
*/
|
278
|
+
// eslint-disable-next-line max-params -- helper function
|
224
279
|
export function validateOptionalField(
|
225
280
|
tx: Record<string, unknown>,
|
226
|
-
|
281
|
+
param: string,
|
227
282
|
checkValidity: (inp: unknown) => boolean,
|
283
|
+
errorOpts: {
|
284
|
+
txType?: string
|
285
|
+
paramName?: string
|
286
|
+
} = {},
|
228
287
|
): void {
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
)
|
288
|
+
const paramNameStr = errorOpts.paramName ?? param
|
289
|
+
const txType = errorOpts.txType ?? tx.TransactionType
|
290
|
+
if (tx[param] !== undefined && !checkValidity(tx[param])) {
|
291
|
+
throw new ValidationError(`${txType}: invalid field ${paramNameStr}`)
|
233
292
|
}
|
234
293
|
}
|
235
294
|
|
236
295
|
/* eslint-enable @typescript-eslint/restrict-template-expressions -- checked before */
|
237
296
|
|
238
|
-
|
239
|
-
|
297
|
+
export enum GlobalFlags {
|
298
|
+
tfInnerBatchTxn = 0x40000000,
|
299
|
+
}
|
300
|
+
|
301
|
+
export interface GlobalFlagsInterface {
|
302
|
+
tfInnerBatchTxn?: boolean
|
303
|
+
}
|
240
304
|
|
241
305
|
/**
|
242
306
|
* Every transaction has the same set of common fields.
|
@@ -269,7 +333,7 @@ export interface BaseTransaction {
|
|
269
333
|
*/
|
270
334
|
AccountTxnID?: string
|
271
335
|
/** Set of bit-flags for this transaction. */
|
272
|
-
Flags?: number |
|
336
|
+
Flags?: number | GlobalFlagsInterface
|
273
337
|
/**
|
274
338
|
* Highest ledger index this transaction can appear in. Specifying this field
|
275
339
|
* places a strict upper limit on how long the transaction can wait to be
|
@@ -332,7 +396,9 @@ export function validateBaseTransaction(common: Record<string, unknown>): void {
|
|
332
396
|
}
|
333
397
|
|
334
398
|
if (!TRANSACTION_TYPES.includes(common.TransactionType)) {
|
335
|
-
throw new ValidationError(
|
399
|
+
throw new ValidationError(
|
400
|
+
`BaseTransaction: Unknown TransactionType ${common.TransactionType}`,
|
401
|
+
)
|
336
402
|
}
|
337
403
|
|
338
404
|
validateRequiredField(common, 'Account', isString)
|
@@ -387,3 +453,134 @@ export function parseAmountValue(amount: unknown): number {
|
|
387
453
|
}
|
388
454
|
return parseFloat(amount.value)
|
389
455
|
}
|
456
|
+
|
457
|
+
/**
|
458
|
+
* Verify the form and type of a CredentialType at runtime.
|
459
|
+
*
|
460
|
+
* @param tx A CredentialType Transaction.
|
461
|
+
* @throws when the CredentialType is malformed.
|
462
|
+
*/
|
463
|
+
export function validateCredentialType(tx: Record<string, unknown>): void {
|
464
|
+
if (typeof tx.TransactionType !== 'string') {
|
465
|
+
throw new ValidationError('Invalid TransactionType')
|
466
|
+
}
|
467
|
+
if (tx.CredentialType === undefined) {
|
468
|
+
throw new ValidationError(
|
469
|
+
`${tx.TransactionType}: missing field CredentialType`,
|
470
|
+
)
|
471
|
+
}
|
472
|
+
|
473
|
+
if (!isString(tx.CredentialType)) {
|
474
|
+
throw new ValidationError(
|
475
|
+
`${tx.TransactionType}: CredentialType must be a string`,
|
476
|
+
)
|
477
|
+
}
|
478
|
+
if (tx.CredentialType.length === 0) {
|
479
|
+
throw new ValidationError(
|
480
|
+
`${tx.TransactionType}: CredentialType cannot be an empty string`,
|
481
|
+
)
|
482
|
+
} else if (tx.CredentialType.length > MAX_CREDENTIAL_TYPE_LENGTH) {
|
483
|
+
throw new ValidationError(
|
484
|
+
`${tx.TransactionType}: CredentialType length cannot be > ${MAX_CREDENTIAL_TYPE_LENGTH}`,
|
485
|
+
)
|
486
|
+
}
|
487
|
+
|
488
|
+
if (!HEX_REGEX.test(tx.CredentialType)) {
|
489
|
+
throw new ValidationError(
|
490
|
+
`${tx.TransactionType}: CredentialType must be encoded in hex`,
|
491
|
+
)
|
492
|
+
}
|
493
|
+
}
|
494
|
+
|
495
|
+
/**
|
496
|
+
* Check a CredentialAuthorize array for parameter errors
|
497
|
+
*
|
498
|
+
* @param credentials An array of credential IDs to check for errors
|
499
|
+
* @param transactionType The transaction type to include in error messages
|
500
|
+
* @param isStringID Toggle for if array contains IDs instead of AuthorizeCredential objects
|
501
|
+
* @param maxCredentials The maximum length of the credentials array.
|
502
|
+
* PermissionedDomainSet transaction uses 10, other transactions use 8.
|
503
|
+
* @throws Validation Error if the formatting is incorrect
|
504
|
+
*/
|
505
|
+
// eslint-disable-next-line max-lines-per-function, max-params -- separating logic further will add unnecessary complexity
|
506
|
+
export function validateCredentialsList(
|
507
|
+
credentials: unknown,
|
508
|
+
transactionType: string,
|
509
|
+
isStringID: boolean,
|
510
|
+
maxCredentials: number,
|
511
|
+
): void {
|
512
|
+
if (credentials == null) {
|
513
|
+
return
|
514
|
+
}
|
515
|
+
if (!Array.isArray(credentials)) {
|
516
|
+
throw new ValidationError(
|
517
|
+
`${transactionType}: Credentials must be an array`,
|
518
|
+
)
|
519
|
+
}
|
520
|
+
if (credentials.length > maxCredentials) {
|
521
|
+
throw new ValidationError(
|
522
|
+
`${transactionType}: Credentials length cannot exceed ${maxCredentials} elements`,
|
523
|
+
)
|
524
|
+
} else if (credentials.length === 0) {
|
525
|
+
throw new ValidationError(
|
526
|
+
`${transactionType}: Credentials cannot be an empty array`,
|
527
|
+
)
|
528
|
+
}
|
529
|
+
credentials.forEach((credential) => {
|
530
|
+
if (isStringID) {
|
531
|
+
if (!isString(credential)) {
|
532
|
+
throw new ValidationError(
|
533
|
+
`${transactionType}: Invalid Credentials ID list format`,
|
534
|
+
)
|
535
|
+
}
|
536
|
+
} else if (!isAuthorizeCredential(credential)) {
|
537
|
+
throw new ValidationError(
|
538
|
+
`${transactionType}: Invalid Credentials format`,
|
539
|
+
)
|
540
|
+
}
|
541
|
+
})
|
542
|
+
if (containsDuplicates(credentials)) {
|
543
|
+
throw new ValidationError(
|
544
|
+
`${transactionType}: Credentials cannot contain duplicate elements`,
|
545
|
+
)
|
546
|
+
}
|
547
|
+
}
|
548
|
+
|
549
|
+
// Type guard to ensure we're working with AuthorizeCredential[]
|
550
|
+
// Note: This is not a rigorous type-guard. A more thorough solution would be to iterate over the array and check each item.
|
551
|
+
function isAuthorizeCredentialArray(
|
552
|
+
list: AuthorizeCredential[] | string[],
|
553
|
+
): list is AuthorizeCredential[] {
|
554
|
+
return typeof list[0] !== 'string'
|
555
|
+
}
|
556
|
+
|
557
|
+
/**
|
558
|
+
* Check if an array of objects contains any duplicates.
|
559
|
+
*
|
560
|
+
* @param objectList - Array of objects to check for duplicates
|
561
|
+
* @returns True if duplicates exist, false otherwise
|
562
|
+
*/
|
563
|
+
export function containsDuplicates(
|
564
|
+
objectList: AuthorizeCredential[] | string[],
|
565
|
+
): boolean {
|
566
|
+
// Case-1: Process a list of string-IDs
|
567
|
+
if (typeof objectList[0] === 'string') {
|
568
|
+
const objSet = new Set(objectList.map((obj) => JSON.stringify(obj)))
|
569
|
+
return objSet.size !== objectList.length
|
570
|
+
}
|
571
|
+
|
572
|
+
// Case-2: Process a list of nested objects
|
573
|
+
const seen = new Set<string>()
|
574
|
+
|
575
|
+
if (isAuthorizeCredentialArray(objectList)) {
|
576
|
+
for (const item of objectList) {
|
577
|
+
const key = `${item.Credential.Issuer}-${item.Credential.CredentialType}`
|
578
|
+
if (seen.has(key)) {
|
579
|
+
return true
|
580
|
+
}
|
581
|
+
seen.add(key)
|
582
|
+
}
|
583
|
+
}
|
584
|
+
|
585
|
+
return false
|
586
|
+
}
|
@@ -1,6 +1,12 @@
|
|
1
1
|
import { ValidationError } from '../../errors'
|
2
|
+
import { AuthorizeCredential } from '../common'
|
2
3
|
|
3
|
-
import {
|
4
|
+
import {
|
5
|
+
BaseTransaction,
|
6
|
+
validateBaseTransaction,
|
7
|
+
validateCredentialsList,
|
8
|
+
MAX_AUTHORIZED_CREDENTIALS,
|
9
|
+
} from './common'
|
4
10
|
|
5
11
|
/**
|
6
12
|
* A DepositPreauth transaction gives another account pre-approval to deliver
|
@@ -18,6 +24,16 @@ export interface DepositPreauth extends BaseTransaction {
|
|
18
24
|
* revoked.
|
19
25
|
*/
|
20
26
|
Unauthorize?: string
|
27
|
+
|
28
|
+
/**
|
29
|
+
* The credential(s) to preauthorize.
|
30
|
+
*/
|
31
|
+
AuthorizeCredentials?: AuthorizeCredential[]
|
32
|
+
|
33
|
+
/**
|
34
|
+
* The credential(s) whose preauthorization should be revoked.
|
35
|
+
*/
|
36
|
+
UnauthorizeCredentials?: AuthorizeCredential[]
|
21
37
|
}
|
22
38
|
|
23
39
|
/**
|
@@ -29,17 +45,7 @@ export interface DepositPreauth extends BaseTransaction {
|
|
29
45
|
export function validateDepositPreauth(tx: Record<string, unknown>): void {
|
30
46
|
validateBaseTransaction(tx)
|
31
47
|
|
32
|
-
|
33
|
-
throw new ValidationError(
|
34
|
-
"DepositPreauth: can't provide both Authorize and Unauthorize fields",
|
35
|
-
)
|
36
|
-
}
|
37
|
-
|
38
|
-
if (tx.Authorize === undefined && tx.Unauthorize === undefined) {
|
39
|
-
throw new ValidationError(
|
40
|
-
'DepositPreauth: must provide either Authorize or Unauthorize field',
|
41
|
-
)
|
42
|
-
}
|
48
|
+
validateSingleAuthorizationFieldProvided(tx)
|
43
49
|
|
44
50
|
if (tx.Authorize !== undefined) {
|
45
51
|
if (typeof tx.Authorize !== 'string') {
|
@@ -51,9 +57,7 @@ export function validateDepositPreauth(tx: Record<string, unknown>): void {
|
|
51
57
|
"DepositPreauth: Account can't preauthorize its own address",
|
52
58
|
)
|
53
59
|
}
|
54
|
-
}
|
55
|
-
|
56
|
-
if (tx.Unauthorize !== undefined) {
|
60
|
+
} else if (tx.Unauthorize !== undefined) {
|
57
61
|
if (typeof tx.Unauthorize !== 'string') {
|
58
62
|
throw new ValidationError('DepositPreauth: Unauthorize must be a string')
|
59
63
|
}
|
@@ -63,5 +67,40 @@ export function validateDepositPreauth(tx: Record<string, unknown>): void {
|
|
63
67
|
"DepositPreauth: Account can't unauthorize its own address",
|
64
68
|
)
|
65
69
|
}
|
70
|
+
} else if (tx.AuthorizeCredentials !== undefined) {
|
71
|
+
validateCredentialsList(
|
72
|
+
tx.AuthorizeCredentials,
|
73
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- confirmed in base transaction check
|
74
|
+
tx.TransactionType as string,
|
75
|
+
false,
|
76
|
+
MAX_AUTHORIZED_CREDENTIALS,
|
77
|
+
)
|
78
|
+
} else if (tx.UnauthorizeCredentials !== undefined) {
|
79
|
+
validateCredentialsList(
|
80
|
+
tx.UnauthorizeCredentials,
|
81
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- confirmed in base transaction check
|
82
|
+
tx.TransactionType as string,
|
83
|
+
false,
|
84
|
+
MAX_AUTHORIZED_CREDENTIALS,
|
85
|
+
)
|
86
|
+
}
|
87
|
+
}
|
88
|
+
|
89
|
+
// Boolean logic to ensure exactly one of 4 inputs was provided
|
90
|
+
function validateSingleAuthorizationFieldProvided(
|
91
|
+
tx: Record<string, unknown>,
|
92
|
+
): void {
|
93
|
+
const fields = [
|
94
|
+
'Authorize',
|
95
|
+
'Unauthorize',
|
96
|
+
'AuthorizeCredentials',
|
97
|
+
'UnauthorizeCredentials',
|
98
|
+
]
|
99
|
+
const countProvided = fields.filter((key) => tx[key] !== undefined).length
|
100
|
+
|
101
|
+
if (countProvided !== 1) {
|
102
|
+
throw new ValidationError(
|
103
|
+
'DepositPreauth: Requires exactly one field of the following: Authorize, Unauthorize, AuthorizeCredentials, UnauthorizeCredentials.',
|
104
|
+
)
|
66
105
|
}
|
67
106
|
}
|
@@ -5,7 +5,9 @@ import {
|
|
5
5
|
BaseTransaction,
|
6
6
|
isAccount,
|
7
7
|
validateBaseTransaction,
|
8
|
+
validateCredentialsList,
|
8
9
|
validateRequiredField,
|
10
|
+
MAX_AUTHORIZED_CREDENTIALS,
|
9
11
|
} from './common'
|
10
12
|
|
11
13
|
/**
|
@@ -32,6 +34,10 @@ export interface EscrowFinish extends BaseTransaction {
|
|
32
34
|
* the held payment's Condition.
|
33
35
|
*/
|
34
36
|
Fulfillment?: string
|
37
|
+
/** Credentials associated with the sender of this transaction.
|
38
|
+
* The credentials included must not be expired.
|
39
|
+
*/
|
40
|
+
CredentialIDs?: string[]
|
35
41
|
}
|
36
42
|
|
37
43
|
/**
|
@@ -45,6 +51,14 @@ export function validateEscrowFinish(tx: Record<string, unknown>): void {
|
|
45
51
|
|
46
52
|
validateRequiredField(tx, 'Owner', isAccount)
|
47
53
|
|
54
|
+
validateCredentialsList(
|
55
|
+
tx.CredentialIDs,
|
56
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- known from base check
|
57
|
+
tx.TransactionType as string,
|
58
|
+
true,
|
59
|
+
MAX_AUTHORIZED_CREDENTIALS,
|
60
|
+
)
|
61
|
+
|
48
62
|
if (tx.OfferSequence == null) {
|
49
63
|
throw new ValidationError('EscrowFinish: missing field OfferSequence')
|
50
64
|
}
|