xrpl 4.1.0 → 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/build/xrpl-latest-min.js +3 -0
- package/build/xrpl-latest-min.js.map +1 -0
- package/build/xrpl-latest.js +528 -83
- 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/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 +2 -2
- package/dist/npm/models/ledger/Credential.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/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/methods/baseMethod.d.ts +1 -0
- package/dist/npm/models/methods/baseMethod.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/ledger.d.ts +2 -2
- package/dist/npm/models/methods/ledger.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/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/MPTokenAuthorize.d.ts +2 -2
- package/dist/npm/models/transactions/MPTokenAuthorize.d.ts.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.map +1 -1
- package/dist/npm/models/transactions/MPTokenIssuanceSet.d.ts +2 -2
- package/dist/npm/models/transactions/MPTokenIssuanceSet.d.ts.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.map +1 -1
- package/dist/npm/models/transactions/accountDelete.js +1 -1
- 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/common.d.ts +21 -6
- package/dist/npm/models/transactions/common.d.ts.map +1 -1
- package/dist/npm/models/transactions/common.js +52 -16
- package/dist/npm/models/transactions/common.js.map +1 -1
- package/dist/npm/models/transactions/depositPreauth.d.ts.map +1 -1
- package/dist/npm/models/transactions/depositPreauth.js +2 -2
- package/dist/npm/models/transactions/depositPreauth.js.map +1 -1
- package/dist/npm/models/transactions/escrowFinish.d.ts.map +1 -1
- package/dist/npm/models/transactions/escrowFinish.js +1 -1
- package/dist/npm/models/transactions/escrowFinish.js.map +1 -1
- package/dist/npm/models/transactions/index.d.ts +6 -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 +1 -0
- 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 +2 -2
- package/dist/npm/models/transactions/payment.d.ts.map +1 -1
- package/dist/npm/models/transactions/payment.js +1 -1
- package/dist/npm/models/transactions/payment.js.map +1 -1
- package/dist/npm/models/transactions/paymentChannelClaim.d.ts +2 -2
- package/dist/npm/models/transactions/paymentChannelClaim.d.ts.map +1 -1
- package/dist/npm/models/transactions/paymentChannelClaim.js +1 -1
- 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 +6 -1
- package/dist/npm/models/transactions/transaction.d.ts.map +1 -1
- package/dist/npm/models/transactions/transaction.js +24 -1
- 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 +59 -26
- package/dist/npm/models/utils/flags.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/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 +2 -2
- package/dist/npm/src/models/ledger/Credential.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/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/methods/baseMethod.d.ts +1 -0
- package/dist/npm/src/models/methods/baseMethod.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/ledger.d.ts +2 -2
- package/dist/npm/src/models/methods/ledger.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/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/MPTokenAuthorize.d.ts +2 -2
- package/dist/npm/src/models/transactions/MPTokenAuthorize.d.ts.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.map +1 -1
- package/dist/npm/src/models/transactions/MPTokenIssuanceSet.d.ts +2 -2
- package/dist/npm/src/models/transactions/MPTokenIssuanceSet.d.ts.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.map +1 -1
- package/dist/npm/src/models/transactions/accountDelete.js +1 -1
- 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/common.d.ts +21 -6
- package/dist/npm/src/models/transactions/common.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/common.js +52 -16
- package/dist/npm/src/models/transactions/common.js.map +1 -1
- package/dist/npm/src/models/transactions/depositPreauth.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/depositPreauth.js +2 -2
- package/dist/npm/src/models/transactions/depositPreauth.js.map +1 -1
- package/dist/npm/src/models/transactions/escrowFinish.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/escrowFinish.js +1 -1
- package/dist/npm/src/models/transactions/escrowFinish.js.map +1 -1
- package/dist/npm/src/models/transactions/index.d.ts +6 -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 +1 -0
- 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 +2 -2
- package/dist/npm/src/models/transactions/payment.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/payment.js +1 -1
- package/dist/npm/src/models/transactions/payment.js.map +1 -1
- package/dist/npm/src/models/transactions/paymentChannelClaim.d.ts +2 -2
- package/dist/npm/src/models/transactions/paymentChannelClaim.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/paymentChannelClaim.js +1 -1
- 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 +6 -1
- package/dist/npm/src/models/transactions/transaction.d.ts.map +1 -1
- package/dist/npm/src/models/transactions/transaction.js +24 -1
- 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 +59 -26
- package/dist/npm/src/models/utils/flags.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/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/package.json +5 -5
- 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/models/index.ts +2 -1
- package/src/models/ledger/Credential.ts +2 -2
- package/src/models/ledger/LedgerEntry.ts +3 -0
- package/src/models/ledger/PermissionedDomain.ts +29 -0
- package/src/models/ledger/RippleState.ts +4 -0
- package/src/models/methods/baseMethod.ts +1 -0
- package/src/models/methods/index.ts +18 -0
- package/src/models/methods/ledger.ts +2 -2
- package/src/models/methods/serverState.ts +1 -0
- package/src/models/methods/simulate.ts +88 -0
- 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/MPTokenAuthorize.ts +2 -2
- package/src/models/transactions/MPTokenIssuanceCreate.ts +3 -2
- package/src/models/transactions/MPTokenIssuanceSet.ts +2 -2
- 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 +2 -0
- package/src/models/transactions/accountSet.ts +2 -1
- package/src/models/transactions/batch.ts +147 -0
- package/src/models/transactions/common.ts +110 -30
- package/src/models/transactions/depositPreauth.ts +3 -0
- package/src/models/transactions/escrowFinish.ts +2 -0
- package/src/models/transactions/index.ts +10 -1
- package/src/models/transactions/metadata.ts +2 -0
- package/src/models/transactions/offerCreate.ts +2 -2
- package/src/models/transactions/payment.ts +4 -2
- package/src/models/transactions/paymentChannelClaim.ts +5 -2
- package/src/models/transactions/permissionedDomainDelete.ts +28 -0
- package/src/models/transactions/permissionedDomainSet.ts +54 -0
- package/src/models/transactions/transaction.ts +47 -2
- package/src/models/transactions/trustSet.ts +12 -2
- package/src/models/utils/flags.ts +85 -30
- package/src/sugar/autofill.ts +140 -11
- package/src/sugar/submit.ts +3 -5
- package/src/utils/hashes/hashLedger.ts +5 -2
@@ -148,6 +148,14 @@ import {
|
|
148
148
|
StateAccountingFinal,
|
149
149
|
} from './serverInfo'
|
150
150
|
import { ServerStateRequest, ServerStateResponse } from './serverState'
|
151
|
+
import {
|
152
|
+
SimulateBinaryRequest,
|
153
|
+
SimulateBinaryResponse,
|
154
|
+
SimulateJsonRequest,
|
155
|
+
SimulateJsonResponse,
|
156
|
+
SimulateRequest,
|
157
|
+
SimulateResponse,
|
158
|
+
} from './simulate'
|
151
159
|
import { SubmitRequest, SubmitResponse } from './submit'
|
152
160
|
import {
|
153
161
|
SubmitMultisignedRequest,
|
@@ -203,6 +211,7 @@ type Request =
|
|
203
211
|
| LedgerDataRequest
|
204
212
|
| LedgerEntryRequest
|
205
213
|
// transaction methods
|
214
|
+
| SimulateRequest
|
206
215
|
| SubmitRequest
|
207
216
|
| SubmitMultisignedRequest
|
208
217
|
| TransactionEntryRequest
|
@@ -261,6 +270,7 @@ type Response<Version extends APIVersion = typeof DEFAULT_API_VERSION> =
|
|
261
270
|
| LedgerDataResponse
|
262
271
|
| LedgerEntryResponse
|
263
272
|
// transaction methods
|
273
|
+
| SimulateResponse
|
264
274
|
| SubmitResponse
|
265
275
|
| SubmitMultisignedVersionResponseMap<Version>
|
266
276
|
| TransactionEntryResponse
|
@@ -398,6 +408,12 @@ export type RequestResponseMap<
|
|
398
408
|
? LedgerDataResponse
|
399
409
|
: T extends LedgerEntryRequest
|
400
410
|
? LedgerEntryResponse
|
411
|
+
: T extends SimulateBinaryRequest
|
412
|
+
? SimulateBinaryResponse
|
413
|
+
: T extends SimulateJsonRequest
|
414
|
+
? SimulateJsonResponse
|
415
|
+
: T extends SimulateRequest
|
416
|
+
? SimulateJsonResponse
|
401
417
|
: T extends SubmitRequest
|
402
418
|
? SubmitResponse
|
403
419
|
: T extends SubmitMultisignedRequest
|
@@ -544,6 +560,8 @@ export {
|
|
544
560
|
LedgerEntryRequest,
|
545
561
|
LedgerEntryResponse,
|
546
562
|
// transaction methods with types
|
563
|
+
SimulateRequest,
|
564
|
+
SimulateResponse,
|
547
565
|
SubmitRequest,
|
548
566
|
SubmitResponse,
|
549
567
|
SubmitMultisignedRequest,
|
@@ -203,13 +203,13 @@ export interface LedgerQueueData {
|
|
203
203
|
}
|
204
204
|
|
205
205
|
export interface LedgerBinary
|
206
|
-
extends Omit<
|
206
|
+
extends Omit<Ledger, 'transactions' | 'accountState'> {
|
207
207
|
accountState?: string[]
|
208
208
|
transactions?: string[]
|
209
209
|
}
|
210
210
|
|
211
211
|
export interface LedgerBinaryV1
|
212
|
-
extends Omit<
|
212
|
+
extends Omit<LedgerV1, 'transactions' | 'accountState'> {
|
213
213
|
accountState?: string[]
|
214
214
|
transactions?: string[]
|
215
215
|
}
|
@@ -51,6 +51,7 @@ export interface ServerStateResponse extends BaseResponse {
|
|
51
51
|
load_factor_fee_queue?: number
|
52
52
|
load_factor_fee_reference?: number
|
53
53
|
load_factor_server?: number
|
54
|
+
network_id: number
|
54
55
|
peer_disconnects?: string
|
55
56
|
peer_disconnects_resources?: string
|
56
57
|
peers: number
|
@@ -0,0 +1,88 @@
|
|
1
|
+
import {
|
2
|
+
BaseTransaction,
|
3
|
+
Transaction,
|
4
|
+
TransactionMetadata,
|
5
|
+
} from '../transactions'
|
6
|
+
|
7
|
+
import { BaseRequest, BaseResponse } from './baseMethod'
|
8
|
+
|
9
|
+
/**
|
10
|
+
* The `simulate` method simulates a transaction without submitting it to the network.
|
11
|
+
* Returns a {@link SimulateResponse}.
|
12
|
+
*
|
13
|
+
* @category Requests
|
14
|
+
*/
|
15
|
+
export type SimulateRequest = BaseRequest & {
|
16
|
+
command: 'simulate'
|
17
|
+
|
18
|
+
binary?: boolean
|
19
|
+
} & (
|
20
|
+
| {
|
21
|
+
tx_blob: string
|
22
|
+
tx_json?: never
|
23
|
+
}
|
24
|
+
| {
|
25
|
+
tx_json: Transaction
|
26
|
+
tx_blob?: never
|
27
|
+
}
|
28
|
+
)
|
29
|
+
|
30
|
+
export type SimulateBinaryRequest = SimulateRequest & {
|
31
|
+
binary: true
|
32
|
+
}
|
33
|
+
|
34
|
+
export type SimulateJsonRequest = SimulateRequest & {
|
35
|
+
binary?: false
|
36
|
+
}
|
37
|
+
|
38
|
+
/**
|
39
|
+
* Response expected from an {@link SimulateRequest}.
|
40
|
+
*
|
41
|
+
* @category Responses
|
42
|
+
*/
|
43
|
+
export type SimulateResponse = SimulateJsonResponse | SimulateBinaryResponse
|
44
|
+
|
45
|
+
export interface SimulateBinaryResponse extends BaseResponse {
|
46
|
+
result: {
|
47
|
+
applied: false
|
48
|
+
|
49
|
+
engine_result: string
|
50
|
+
|
51
|
+
engine_result_code: number
|
52
|
+
|
53
|
+
engine_result_message: string
|
54
|
+
|
55
|
+
tx_blob: string
|
56
|
+
|
57
|
+
meta_blob: string
|
58
|
+
|
59
|
+
/**
|
60
|
+
* The ledger index of the ledger version that was used to generate this
|
61
|
+
* response.
|
62
|
+
*/
|
63
|
+
ledger_index: number
|
64
|
+
}
|
65
|
+
}
|
66
|
+
|
67
|
+
export interface SimulateJsonResponse<T extends BaseTransaction = Transaction>
|
68
|
+
extends BaseResponse {
|
69
|
+
result: {
|
70
|
+
applied: false
|
71
|
+
|
72
|
+
engine_result: string
|
73
|
+
|
74
|
+
engine_result_code: number
|
75
|
+
|
76
|
+
engine_result_message: string
|
77
|
+
|
78
|
+
/**
|
79
|
+
* The ledger index of the ledger version that was used to generate this
|
80
|
+
* response.
|
81
|
+
*/
|
82
|
+
ledger_index: number
|
83
|
+
|
84
|
+
tx_json: T
|
85
|
+
|
86
|
+
meta?: TransactionMetadata<T>
|
87
|
+
}
|
88
|
+
}
|
@@ -0,0 +1,120 @@
|
|
1
|
+
import { ValidationError } from '../../errors'
|
2
|
+
import { Currency, IssuedCurrency, IssuedCurrencyAmount } from '../common'
|
3
|
+
|
4
|
+
import {
|
5
|
+
Account,
|
6
|
+
BaseTransaction,
|
7
|
+
GlobalFlagsInterface,
|
8
|
+
isAccount,
|
9
|
+
isAmount,
|
10
|
+
isCurrency,
|
11
|
+
validateBaseTransaction,
|
12
|
+
validateOptionalField,
|
13
|
+
validateRequiredField,
|
14
|
+
} from './common'
|
15
|
+
|
16
|
+
/**
|
17
|
+
* Enum representing values for AMMClawback Transaction Flags.
|
18
|
+
*
|
19
|
+
* @category Transaction Flags
|
20
|
+
*/
|
21
|
+
export enum AMMClawbackFlags {
|
22
|
+
tfClawTwoAssets = 0x00000001,
|
23
|
+
}
|
24
|
+
|
25
|
+
/**
|
26
|
+
* Map of flags to boolean values representing {@link AMMClawback} transaction
|
27
|
+
* flags.
|
28
|
+
*
|
29
|
+
* @category Transaction Flags
|
30
|
+
*/
|
31
|
+
export interface AMMClawbackFlagsInterface extends GlobalFlagsInterface {
|
32
|
+
tfClawTwoAssets?: boolean
|
33
|
+
}
|
34
|
+
|
35
|
+
/**
|
36
|
+
* Claw back tokens from a holder that has deposited your issued tokens into an AMM pool.
|
37
|
+
*
|
38
|
+
* Clawback is disabled by default. To use clawback, you must send an AccountSet transaction to enable the
|
39
|
+
* Allow Trust Line Clawback setting. An issuer with any existing tokens cannot enable clawback. You can
|
40
|
+
* only enable Allow Trust Line Clawback if you have a completely empty owner directory, meaning you must
|
41
|
+
* do so before you set up any trust lines, offers, escrows, payment channels, checks, or signer lists.
|
42
|
+
* After you enable clawback, it cannot reverted: the account permanently gains the ability to claw back
|
43
|
+
* issued assets on trust lines.
|
44
|
+
*/
|
45
|
+
export interface AMMClawback extends BaseTransaction {
|
46
|
+
TransactionType: 'AMMClawback'
|
47
|
+
|
48
|
+
/**
|
49
|
+
* The account holding the asset to be clawed back.
|
50
|
+
*/
|
51
|
+
Holder: Account
|
52
|
+
|
53
|
+
/**
|
54
|
+
* Specifies the asset that the issuer wants to claw back from the AMM pool.
|
55
|
+
* In JSON, this is an object with currency and issuer fields. The issuer field must match with Account.
|
56
|
+
*/
|
57
|
+
Asset: IssuedCurrency
|
58
|
+
|
59
|
+
/**
|
60
|
+
* Specifies the other asset in the AMM's pool. In JSON, this is an object with currency and
|
61
|
+
* issuer fields (omit issuer for XRP).
|
62
|
+
*/
|
63
|
+
Asset2: Currency
|
64
|
+
|
65
|
+
/**
|
66
|
+
* The maximum amount to claw back from the AMM account. The currency and issuer subfields should match
|
67
|
+
* the Asset subfields. If this field isn't specified, or the value subfield exceeds the holder's available
|
68
|
+
* tokens in the AMM, all of the holder's tokens will be clawed back.
|
69
|
+
*/
|
70
|
+
Amount?: IssuedCurrencyAmount
|
71
|
+
}
|
72
|
+
|
73
|
+
/**
|
74
|
+
* Verify the form and type of an AMMClawback at runtime.
|
75
|
+
*
|
76
|
+
* @param tx - An AMMClawback Transaction.
|
77
|
+
* @throws {ValidationError} When the transaction is malformed.
|
78
|
+
*/
|
79
|
+
export function validateAMMClawback(tx: Record<string, unknown>): void {
|
80
|
+
validateBaseTransaction(tx)
|
81
|
+
|
82
|
+
validateRequiredField(tx, 'Holder', isAccount)
|
83
|
+
|
84
|
+
validateRequiredField(tx, 'Asset', isCurrency)
|
85
|
+
|
86
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- required
|
87
|
+
const asset = tx.Asset as IssuedCurrency
|
88
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- required
|
89
|
+
const amount = tx.Amount as IssuedCurrencyAmount
|
90
|
+
|
91
|
+
if (tx.Holder === asset.issuer) {
|
92
|
+
throw new ValidationError(
|
93
|
+
'AMMClawback: Holder and Asset.issuer must be distinct',
|
94
|
+
)
|
95
|
+
}
|
96
|
+
|
97
|
+
if (tx.Account !== asset.issuer) {
|
98
|
+
throw new ValidationError(
|
99
|
+
'AMMClawback: Account must be the same as Asset.issuer',
|
100
|
+
)
|
101
|
+
}
|
102
|
+
|
103
|
+
validateRequiredField(tx, 'Asset2', isCurrency)
|
104
|
+
|
105
|
+
validateOptionalField(tx, 'Amount', isAmount)
|
106
|
+
|
107
|
+
if (tx.Amount != null) {
|
108
|
+
if (amount.currency !== asset.currency) {
|
109
|
+
throw new ValidationError(
|
110
|
+
'AMMClawback: Amount.currency must match Asset.currency',
|
111
|
+
)
|
112
|
+
}
|
113
|
+
|
114
|
+
if (amount.issuer !== asset.issuer) {
|
115
|
+
throw new ValidationError(
|
116
|
+
'AMMClawback: Amount.issuer must match Amount.issuer',
|
117
|
+
)
|
118
|
+
}
|
119
|
+
}
|
120
|
+
}
|
@@ -3,7 +3,7 @@ import { Amount, Currency, IssuedCurrencyAmount } from '../common'
|
|
3
3
|
|
4
4
|
import {
|
5
5
|
BaseTransaction,
|
6
|
-
|
6
|
+
GlobalFlagsInterface,
|
7
7
|
isAmount,
|
8
8
|
isCurrency,
|
9
9
|
isIssuedCurrency,
|
@@ -24,7 +24,7 @@ export enum AMMDepositFlags {
|
|
24
24
|
tfTwoAssetIfEmpty = 0x00800000,
|
25
25
|
}
|
26
26
|
|
27
|
-
export interface AMMDepositFlagsInterface extends
|
27
|
+
export interface AMMDepositFlagsInterface extends GlobalFlagsInterface {
|
28
28
|
tfLPToken?: boolean
|
29
29
|
tfSingleAsset?: boolean
|
30
30
|
tfTwoAsset?: boolean
|
@@ -3,7 +3,7 @@ import { Amount, Currency, IssuedCurrencyAmount } from '../common'
|
|
3
3
|
|
4
4
|
import {
|
5
5
|
BaseTransaction,
|
6
|
-
|
6
|
+
GlobalFlagsInterface,
|
7
7
|
isAmount,
|
8
8
|
isCurrency,
|
9
9
|
isIssuedCurrency,
|
@@ -25,7 +25,7 @@ export enum AMMWithdrawFlags {
|
|
25
25
|
tfLimitLPToken = 0x00400000,
|
26
26
|
}
|
27
27
|
|
28
|
-
export interface AMMWithdrawFlagsInterface extends
|
28
|
+
export interface AMMWithdrawFlagsInterface extends GlobalFlagsInterface {
|
29
29
|
tfLPToken?: boolean
|
30
30
|
tfWithdrawAll?: boolean
|
31
31
|
tfOneAssetWithdrawAll?: boolean
|
@@ -6,7 +6,7 @@ import {
|
|
6
6
|
Account,
|
7
7
|
validateOptionalField,
|
8
8
|
isAccount,
|
9
|
-
|
9
|
+
GlobalFlagsInterface,
|
10
10
|
} from './common'
|
11
11
|
|
12
12
|
/**
|
@@ -32,7 +32,7 @@ export enum MPTokenAuthorizeFlags {
|
|
32
32
|
*
|
33
33
|
* @category Transaction Flags
|
34
34
|
*/
|
35
|
-
export interface MPTokenAuthorizeFlagsInterface extends
|
35
|
+
export interface MPTokenAuthorizeFlagsInterface extends GlobalFlagsInterface {
|
36
36
|
tfMPTUnauthorize?: boolean
|
37
37
|
}
|
38
38
|
|
@@ -3,7 +3,7 @@ import { isHex, INTEGER_SANITY_CHECK, isFlagEnabled } from '../utils'
|
|
3
3
|
|
4
4
|
import {
|
5
5
|
BaseTransaction,
|
6
|
-
|
6
|
+
GlobalFlagsInterface,
|
7
7
|
validateBaseTransaction,
|
8
8
|
validateOptionalField,
|
9
9
|
isString,
|
@@ -58,7 +58,8 @@ export enum MPTokenIssuanceCreateFlags {
|
|
58
58
|
*
|
59
59
|
* @category Transaction Flags
|
60
60
|
*/
|
61
|
-
export interface MPTokenIssuanceCreateFlagsInterface
|
61
|
+
export interface MPTokenIssuanceCreateFlagsInterface
|
62
|
+
extends GlobalFlagsInterface {
|
62
63
|
tfMPTCanLock?: boolean
|
63
64
|
tfMPTRequireAuth?: boolean
|
64
65
|
tfMPTCanEscrow?: boolean
|
@@ -9,7 +9,7 @@ import {
|
|
9
9
|
Account,
|
10
10
|
validateOptionalField,
|
11
11
|
isAccount,
|
12
|
-
|
12
|
+
GlobalFlagsInterface,
|
13
13
|
} from './common'
|
14
14
|
|
15
15
|
/**
|
@@ -34,7 +34,7 @@ export enum MPTokenIssuanceSetFlags {
|
|
34
34
|
*
|
35
35
|
* @category Transaction Flags
|
36
36
|
*/
|
37
|
-
export interface MPTokenIssuanceSetFlagsInterface extends
|
37
|
+
export interface MPTokenIssuanceSetFlagsInterface extends GlobalFlagsInterface {
|
38
38
|
tfMPTLock?: boolean
|
39
39
|
tfMPTUnlock?: boolean
|
40
40
|
}
|
@@ -4,7 +4,7 @@ import { isFlagEnabled } from '../utils'
|
|
4
4
|
|
5
5
|
import {
|
6
6
|
BaseTransaction,
|
7
|
-
|
7
|
+
GlobalFlagsInterface,
|
8
8
|
validateBaseTransaction,
|
9
9
|
isAmount,
|
10
10
|
parseAmountValue,
|
@@ -33,7 +33,7 @@ export enum NFTokenCreateOfferFlags {
|
|
33
33
|
*
|
34
34
|
* @category Transaction Flags
|
35
35
|
*/
|
36
|
-
export interface NFTokenCreateOfferFlagsInterface extends
|
36
|
+
export interface NFTokenCreateOfferFlagsInterface extends GlobalFlagsInterface {
|
37
37
|
tfSellNFToken?: boolean
|
38
38
|
}
|
39
39
|
|
@@ -4,7 +4,7 @@ import { isHex } from '../utils'
|
|
4
4
|
import {
|
5
5
|
Account,
|
6
6
|
BaseTransaction,
|
7
|
-
|
7
|
+
GlobalFlagsInterface,
|
8
8
|
isAccount,
|
9
9
|
validateBaseTransaction,
|
10
10
|
validateOptionalField,
|
@@ -38,6 +38,10 @@ export enum NFTokenMintFlags {
|
|
38
38
|
* issuer.
|
39
39
|
*/
|
40
40
|
tfTransferable = 0x00000008,
|
41
|
+
/**
|
42
|
+
* If set, indicates that this NFT's URI can be modified.
|
43
|
+
*/
|
44
|
+
tfMutable = 0x00000010,
|
41
45
|
}
|
42
46
|
|
43
47
|
/**
|
@@ -46,11 +50,12 @@ export enum NFTokenMintFlags {
|
|
46
50
|
*
|
47
51
|
* @category Transaction Flags
|
48
52
|
*/
|
49
|
-
export interface NFTokenMintFlagsInterface extends
|
53
|
+
export interface NFTokenMintFlagsInterface extends GlobalFlagsInterface {
|
50
54
|
tfBurnable?: boolean
|
51
55
|
tfOnlyXRP?: boolean
|
52
56
|
tfTrustLine?: boolean
|
53
57
|
tfTransferable?: boolean
|
58
|
+
tfMutable?: boolean
|
54
59
|
}
|
55
60
|
|
56
61
|
/**
|
@@ -0,0 +1,67 @@
|
|
1
|
+
import { ValidationError } from '../../errors'
|
2
|
+
import { isHex } from '../utils'
|
3
|
+
|
4
|
+
import {
|
5
|
+
BaseTransaction,
|
6
|
+
validateBaseTransaction,
|
7
|
+
isAccount,
|
8
|
+
isString,
|
9
|
+
validateOptionalField,
|
10
|
+
Account,
|
11
|
+
validateRequiredField,
|
12
|
+
} from './common'
|
13
|
+
|
14
|
+
/**
|
15
|
+
* The NFTokenModify transaction modifies an NFToken's URI
|
16
|
+
* if its tfMutable is set to true.
|
17
|
+
*/
|
18
|
+
export interface NFTokenModify extends BaseTransaction {
|
19
|
+
TransactionType: 'NFTokenModify'
|
20
|
+
/**
|
21
|
+
* Identifies the NFTokenID of the NFToken object that the
|
22
|
+
* offer references.
|
23
|
+
*/
|
24
|
+
NFTokenID: string
|
25
|
+
/**
|
26
|
+
* Indicates the AccountID of the account that owns the corresponding NFToken.
|
27
|
+
* Can be omitted if the owner is the account submitting this transaction
|
28
|
+
*/
|
29
|
+
Owner?: Account
|
30
|
+
/**
|
31
|
+
* URI that points to the data and/or metadata associated with the NFT.
|
32
|
+
* This field need not be an HTTP or HTTPS URL; it could be an IPFS URI, a
|
33
|
+
* magnet link, immediate data encoded as an RFC2379 "data" URL, or even an
|
34
|
+
* opaque issuer-specific encoding. The URI is NOT checked for validity, but
|
35
|
+
* the field is limited to a maximum length of 256 bytes.
|
36
|
+
*
|
37
|
+
* This field must be hex-encoded. You can use `convertStringToHex` to
|
38
|
+
* convert this field to the proper encoding.
|
39
|
+
*
|
40
|
+
* This field must not be an empty string. Omit it from the transaction or
|
41
|
+
* set to `null` if you do not use it.
|
42
|
+
*/
|
43
|
+
URI?: string | null
|
44
|
+
}
|
45
|
+
|
46
|
+
/**
|
47
|
+
* Verify the form and type of an NFTokenModify at runtime.
|
48
|
+
*
|
49
|
+
* @param tx - An NFTokenModify Transaction.
|
50
|
+
* @throws When the NFTokenModify is Malformed.
|
51
|
+
*/
|
52
|
+
export function validateNFTokenModify(tx: Record<string, unknown>): void {
|
53
|
+
validateBaseTransaction(tx)
|
54
|
+
|
55
|
+
validateRequiredField(tx, 'NFTokenID', isString)
|
56
|
+
validateOptionalField(tx, 'Owner', isAccount)
|
57
|
+
validateOptionalField(tx, 'URI', isString)
|
58
|
+
|
59
|
+
if (tx.URI !== undefined && typeof tx.URI === 'string') {
|
60
|
+
if (tx.URI === '') {
|
61
|
+
throw new ValidationError('NFTokenModify: URI must not be empty string')
|
62
|
+
}
|
63
|
+
if (!isHex(tx.URI)) {
|
64
|
+
throw new ValidationError('NFTokenModify: URI must be in hex format')
|
65
|
+
}
|
66
|
+
}
|
67
|
+
}
|
@@ -2,7 +2,7 @@ import { Amount, XChainBridge } from '../common'
|
|
2
2
|
|
3
3
|
import {
|
4
4
|
BaseTransaction,
|
5
|
-
|
5
|
+
GlobalFlagsInterface,
|
6
6
|
isAmount,
|
7
7
|
isXChainBridge,
|
8
8
|
validateBaseTransaction,
|
@@ -26,7 +26,7 @@ export enum XChainModifyBridgeFlags {
|
|
26
26
|
*
|
27
27
|
* @category Transaction Flags
|
28
28
|
*/
|
29
|
-
export interface XChainModifyBridgeFlagsInterface extends
|
29
|
+
export interface XChainModifyBridgeFlagsInterface extends GlobalFlagsInterface {
|
30
30
|
/** Clears the MinAccountCreateAmount of the bridge. */
|
31
31
|
tfClearAccountCreateAmount?: boolean
|
32
32
|
}
|
@@ -7,6 +7,7 @@ import {
|
|
7
7
|
validateCredentialsList,
|
8
8
|
validateOptionalField,
|
9
9
|
validateRequiredField,
|
10
|
+
MAX_AUTHORIZED_CREDENTIALS,
|
10
11
|
} from './common'
|
11
12
|
|
12
13
|
/**
|
@@ -54,5 +55,6 @@ export function validateAccountDelete(tx: Record<string, unknown>): void {
|
|
54
55
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- known from base check
|
55
56
|
tx.TransactionType as string,
|
56
57
|
true,
|
58
|
+
MAX_AUTHORIZED_CREDENTIALS,
|
57
59
|
)
|
58
60
|
}
|
@@ -3,6 +3,7 @@ import { ValidationError } from '../../errors'
|
|
3
3
|
import {
|
4
4
|
Account,
|
5
5
|
BaseTransaction,
|
6
|
+
GlobalFlagsInterface,
|
6
7
|
isAccount,
|
7
8
|
validateBaseTransaction,
|
8
9
|
validateOptionalField,
|
@@ -112,7 +113,7 @@ export enum AccountSetTfFlags {
|
|
112
113
|
* // }
|
113
114
|
* ```
|
114
115
|
*/
|
115
|
-
export interface AccountSetFlagsInterface {
|
116
|
+
export interface AccountSetFlagsInterface extends GlobalFlagsInterface {
|
116
117
|
tfRequireDestTag?: boolean
|
117
118
|
tfOptionalDestTag?: boolean
|
118
119
|
tfRequireAuth?: boolean
|
@@ -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
|
+
}
|