@aptos-labs/ts-sdk 5.0.0 → 5.1.1-side-effect-free.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/dist/common/{account-BDwBREvt.d.ts → account-Dr4y1uZG.d.ts} +8 -2
- package/dist/common/chunk-AWFAHZSB.js +4 -0
- package/dist/common/{chunk-6MMUUJHX.js.map → chunk-AWFAHZSB.js.map} +1 -1
- package/dist/common/cli/index.d.ts +1 -1
- package/dist/common/cli/index.js +1 -1
- package/dist/common/cli/index.js.map +1 -1
- package/dist/common/index.d.ts +339 -10
- package/dist/common/index.js +33 -33
- package/dist/common/index.js.map +1 -1
- package/dist/esm/{Ed25519Account-8ETkcAk_.d.mts → Ed25519Account-CPwej6wB.d.mts} +1 -1
- package/dist/esm/account/AbstractKeylessAccount.d.mts +3 -3
- package/dist/esm/account/AbstractKeylessAccount.mjs +1 -1
- package/dist/esm/account/AbstractKeylessAccount.mjs.map +1 -1
- package/dist/esm/account/AbstractedAccount.d.mts +2 -2
- package/dist/esm/account/AbstractedAccount.mjs +1 -1
- package/dist/esm/account/AbstractedAccount.mjs.map +1 -1
- package/dist/esm/account/Account.d.mts +2 -2
- package/dist/esm/account/Account.mjs +1 -1
- package/dist/esm/account/Account.mjs.map +1 -1
- package/dist/esm/account/AccountUtils.d.mts +3 -3
- package/dist/esm/account/AccountUtils.mjs +1 -1
- package/dist/esm/account/AccountUtils.mjs.map +1 -1
- package/dist/esm/account/DerivableAbstractedAccount.d.mts +2 -2
- package/dist/esm/account/DerivableAbstractedAccount.mjs +1 -1
- package/dist/esm/account/DerivableAbstractedAccount.mjs.map +1 -1
- package/dist/esm/account/Ed25519Account.d.mts +2 -2
- package/dist/esm/account/Ed25519Account.mjs +1 -1
- package/dist/esm/account/Ed25519Account.mjs.map +1 -1
- package/dist/esm/account/EphemeralKeyPair.d.mts +1 -1
- package/dist/esm/account/EphemeralKeyPair.mjs +1 -1
- package/dist/esm/account/EphemeralKeyPair.mjs.map +1 -1
- package/dist/esm/account/FederatedKeylessAccount.d.mts +3 -3
- package/dist/esm/account/FederatedKeylessAccount.mjs +1 -1
- package/dist/esm/account/FederatedKeylessAccount.mjs.map +1 -1
- package/dist/esm/account/KeylessAccount.d.mts +3 -3
- package/dist/esm/account/KeylessAccount.mjs +1 -1
- package/dist/esm/account/KeylessAccount.mjs.map +1 -1
- package/dist/esm/account/MultiEd25519Account.d.mts +2 -2
- package/dist/esm/account/MultiEd25519Account.mjs +1 -1
- package/dist/esm/account/MultiEd25519Account.mjs.map +1 -1
- package/dist/esm/account/MultiKeyAccount.d.mts +3 -3
- package/dist/esm/account/MultiKeyAccount.mjs +1 -1
- package/dist/esm/account/MultiKeyAccount.mjs.map +1 -1
- package/dist/esm/account/SingleKeyAccount.d.mts +2 -2
- package/dist/esm/account/SingleKeyAccount.mjs +1 -1
- package/dist/esm/account/SingleKeyAccount.mjs.map +1 -1
- package/dist/esm/account/index.d.mts +3 -3
- package/dist/esm/account/index.mjs +1 -1
- package/dist/esm/account/index.mjs.map +1 -1
- package/dist/esm/account/utils.d.mts +1 -1
- package/dist/esm/account/utils.mjs +1 -1
- package/dist/esm/account/utils.mjs.map +1 -1
- package/dist/esm/{account-ClxOwjdh.d.mts → account-BortO8g2.d.mts} +6 -1
- package/dist/esm/api/account/abstraction.d.mts +1 -1
- package/dist/esm/api/account/abstraction.mjs +1 -1
- package/dist/esm/api/account/abstraction.mjs.map +1 -1
- package/dist/esm/api/account.d.mts +30 -9
- package/dist/esm/api/account.mjs +1 -1
- package/dist/esm/api/account.mjs.map +1 -1
- package/dist/esm/api/ans.d.mts +2 -2
- package/dist/esm/api/ans.mjs +1 -1
- package/dist/esm/api/ans.mjs.map +1 -1
- package/dist/esm/api/aptos.d.mts +3 -3
- package/dist/esm/api/aptos.mjs +1 -1
- package/dist/esm/api/aptos.mjs.map +1 -1
- package/dist/esm/api/aptosConfig.d.mts +1 -1
- package/dist/esm/api/aptosConfig.mjs +1 -1
- package/dist/esm/api/aptosConfig.mjs.map +1 -1
- package/dist/esm/api/coin.d.mts +1 -1
- package/dist/esm/api/coin.mjs +1 -1
- package/dist/esm/api/coin.mjs.map +1 -1
- package/dist/esm/api/digitalAsset.d.mts +2 -2
- package/dist/esm/api/digitalAsset.mjs +1 -1
- package/dist/esm/api/digitalAsset.mjs.map +1 -1
- package/dist/esm/api/faucet.d.mts +1 -1
- package/dist/esm/api/faucet.mjs +1 -1
- package/dist/esm/api/faucet.mjs.map +1 -1
- package/dist/esm/api/fungibleAsset.d.mts +2 -2
- package/dist/esm/api/fungibleAsset.mjs +1 -1
- package/dist/esm/api/fungibleAsset.mjs.map +1 -1
- package/dist/esm/api/general.d.mts +1 -1
- package/dist/esm/api/general.mjs +1 -1
- package/dist/esm/api/general.mjs.map +1 -1
- package/dist/esm/api/index.d.mts +3 -3
- package/dist/esm/api/index.mjs +1 -1
- package/dist/esm/api/index.mjs.map +1 -1
- package/dist/esm/api/keyless.d.mts +3 -3
- package/dist/esm/api/keyless.mjs +1 -1
- package/dist/esm/api/keyless.mjs.map +1 -1
- package/dist/esm/api/object.d.mts +1 -1
- package/dist/esm/api/object.mjs +1 -1
- package/dist/esm/api/object.mjs.map +1 -1
- package/dist/esm/api/staking.d.mts +1 -1
- package/dist/esm/api/staking.mjs +1 -1
- package/dist/esm/api/staking.mjs.map +1 -1
- package/dist/esm/api/table.d.mts +1 -1
- package/dist/esm/api/table.mjs +1 -1
- package/dist/esm/api/table.mjs.map +1 -1
- package/dist/esm/api/transaction.d.mts +2 -2
- package/dist/esm/api/transaction.mjs +1 -1
- package/dist/esm/api/transaction.mjs.map +1 -1
- package/dist/esm/api/transactionSubmission/build.d.mts +1 -1
- package/dist/esm/api/transactionSubmission/build.mjs +1 -1
- package/dist/esm/api/transactionSubmission/build.mjs.map +1 -1
- package/dist/esm/api/transactionSubmission/helpers.d.mts +1 -1
- package/dist/esm/api/transactionSubmission/helpers.mjs +1 -1
- package/dist/esm/api/transactionSubmission/helpers.mjs.map +1 -1
- package/dist/esm/api/transactionSubmission/management.d.mts +2 -2
- package/dist/esm/api/transactionSubmission/management.mjs +1 -1
- package/dist/esm/api/transactionSubmission/management.mjs.map +1 -1
- package/dist/esm/api/transactionSubmission/sign.d.mts +2 -2
- package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
- package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -1
- package/dist/esm/api/transactionSubmission/simulate.d.mts +1 -1
- package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
- package/dist/esm/api/transactionSubmission/simulate.mjs.map +1 -1
- package/dist/esm/api/transactionSubmission/submit.d.mts +1 -1
- package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
- package/dist/esm/api/transactionSubmission/submit.mjs.map +1 -1
- package/dist/esm/api/utils.d.mts +1 -1
- package/dist/esm/api/utils.mjs +1 -1
- package/dist/esm/api/utils.mjs.map +1 -1
- package/dist/esm/bcs/consts.d.mts +1 -1
- package/dist/esm/bcs/consts.mjs +1 -1
- package/dist/esm/bcs/consts.mjs.map +1 -1
- package/dist/esm/bcs/deserializer.d.mts +1 -1
- package/dist/esm/bcs/deserializer.mjs +1 -1
- package/dist/esm/bcs/deserializer.mjs.map +1 -1
- package/dist/esm/bcs/index.d.mts +1 -1
- package/dist/esm/bcs/index.mjs +1 -1
- package/dist/esm/bcs/index.mjs.map +1 -1
- package/dist/esm/bcs/serializable/entryFunctionBytes.d.mts +1 -1
- package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +1 -1
- package/dist/esm/bcs/serializable/entryFunctionBytes.mjs.map +1 -1
- package/dist/esm/bcs/serializable/fixedBytes.d.mts +1 -1
- package/dist/esm/bcs/serializable/fixedBytes.mjs +1 -1
- package/dist/esm/bcs/serializable/fixedBytes.mjs.map +1 -1
- package/dist/esm/bcs/serializable/movePrimitives.d.mts +1 -1
- package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
- package/dist/esm/bcs/serializable/movePrimitives.mjs.map +1 -1
- package/dist/esm/bcs/serializable/moveStructs.d.mts +1 -1
- package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
- package/dist/esm/bcs/serializable/moveStructs.mjs.map +1 -1
- package/dist/esm/bcs/serializer.d.mts +1 -1
- package/dist/esm/bcs/serializer.mjs +1 -1
- package/dist/esm/bcs/serializer.mjs.map +1 -1
- package/dist/esm/cli/index.d.mts +1 -1
- package/dist/esm/cli/index.mjs +1 -1
- package/dist/esm/cli/index.mjs.map +1 -1
- package/dist/esm/cli/localNode.mjs +1 -1
- package/dist/esm/cli/localNode.mjs.map +1 -1
- package/dist/esm/cli/move.d.mts +1 -1
- package/dist/esm/cli/move.mjs +1 -1
- package/dist/esm/cli/move.mjs.map +1 -1
- package/dist/esm/client/core.d.mts +1 -1
- package/dist/esm/client/core.mjs +1 -1
- package/dist/esm/client/core.mjs.map +1 -1
- package/dist/esm/client/get.d.mts +1 -1
- package/dist/esm/client/get.mjs +1 -1
- package/dist/esm/client/get.mjs.map +1 -1
- package/dist/esm/client/index.d.mts +1 -1
- package/dist/esm/client/index.mjs +1 -1
- package/dist/esm/client/index.mjs.map +1 -1
- package/dist/esm/client/post.d.mts +1 -1
- package/dist/esm/client/post.mjs +1 -1
- package/dist/esm/client/post.mjs.map +1 -1
- package/dist/esm/core/account/index.d.mts +2 -2
- package/dist/esm/core/account/index.mjs +1 -1
- package/dist/esm/core/account/index.mjs.map +1 -1
- package/dist/esm/core/account/utils/address.d.mts +13 -2
- package/dist/esm/core/account/utils/address.mjs +1 -1
- package/dist/esm/core/account/utils/address.mjs.map +1 -1
- package/dist/esm/core/account/utils/index.d.mts +2 -2
- package/dist/esm/core/account/utils/index.mjs +1 -1
- package/dist/esm/core/account/utils/index.mjs.map +1 -1
- package/dist/esm/core/accountAddress.d.mts +1 -1
- package/dist/esm/core/accountAddress.mjs +3 -1
- package/dist/esm/core/accountAddress.mjs.map +1 -1
- package/dist/esm/core/authenticationKey.d.mts +1 -1
- package/dist/esm/core/authenticationKey.mjs +1 -1
- package/dist/esm/core/authenticationKey.mjs.map +1 -1
- package/dist/esm/core/common.mjs +1 -1
- package/dist/esm/core/common.mjs.map +1 -1
- package/dist/esm/core/crypto/abstraction.d.mts +1 -1
- package/dist/esm/core/crypto/abstraction.mjs +1 -1
- package/dist/esm/core/crypto/abstraction.mjs.map +1 -1
- package/dist/esm/core/crypto/deserializationUtils.d.mts +1 -1
- package/dist/esm/core/crypto/deserializationUtils.mjs +1 -1
- package/dist/esm/core/crypto/deserializationUtils.mjs.map +1 -1
- package/dist/esm/core/crypto/ed25519.d.mts +1 -1
- package/dist/esm/core/crypto/ed25519.mjs +1 -1
- package/dist/esm/core/crypto/ed25519.mjs.map +1 -1
- package/dist/esm/core/crypto/ephemeral.d.mts +1 -1
- package/dist/esm/core/crypto/ephemeral.mjs +1 -1
- package/dist/esm/core/crypto/ephemeral.mjs.map +1 -1
- package/dist/esm/core/crypto/federatedKeyless.d.mts +2 -2
- package/dist/esm/core/crypto/federatedKeyless.mjs +1 -1
- package/dist/esm/core/crypto/federatedKeyless.mjs.map +1 -1
- package/dist/esm/core/crypto/hdKey.mjs +1 -1
- package/dist/esm/core/crypto/hdKey.mjs.map +1 -1
- package/dist/esm/core/crypto/index.d.mts +3 -2
- package/dist/esm/core/crypto/index.mjs +1 -1
- package/dist/esm/core/crypto/index.mjs.map +1 -1
- package/dist/esm/core/crypto/keyless.d.mts +2 -2
- package/dist/esm/core/crypto/keyless.mjs +1 -1
- package/dist/esm/core/crypto/keyless.mjs.map +1 -1
- package/dist/esm/core/crypto/multiEd25519.d.mts +1 -1
- package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
- package/dist/esm/core/crypto/multiEd25519.mjs.map +1 -1
- package/dist/esm/core/crypto/multiKey.d.mts +1 -1
- package/dist/esm/core/crypto/multiKey.mjs +3 -1
- package/dist/esm/core/crypto/multiKey.mjs.map +1 -1
- package/dist/esm/core/crypto/poseidon.mjs +1 -1
- package/dist/esm/core/crypto/poseidon.mjs.map +1 -1
- package/dist/esm/core/crypto/privateKey.d.mts +1 -1
- package/dist/esm/core/crypto/privateKey.mjs +1 -1
- package/dist/esm/core/crypto/privateKey.mjs.map +1 -1
- package/dist/esm/core/crypto/proof.d.mts +1 -1
- package/dist/esm/core/crypto/proof.mjs +1 -1
- package/dist/esm/core/crypto/proof.mjs.map +1 -1
- package/dist/esm/core/crypto/publicKey.d.mts +1 -1
- package/dist/esm/core/crypto/publicKey.mjs +1 -1
- package/dist/esm/core/crypto/publicKey.mjs.map +1 -1
- package/dist/esm/core/crypto/secp256k1.d.mts +1 -1
- package/dist/esm/core/crypto/secp256k1.mjs +1 -1
- package/dist/esm/core/crypto/secp256k1.mjs.map +1 -1
- package/dist/esm/core/crypto/secp256r1.d.mts +306 -0
- package/dist/esm/core/crypto/secp256r1.mjs +2 -0
- package/dist/esm/core/crypto/secp256r1.mjs.map +1 -0
- package/dist/esm/core/crypto/signature.d.mts +1 -1
- package/dist/esm/core/crypto/signature.mjs +1 -1
- package/dist/esm/core/crypto/signature.mjs.map +1 -1
- package/dist/esm/core/crypto/singleKey.d.mts +1 -1
- package/dist/esm/core/crypto/singleKey.mjs +1 -1
- package/dist/esm/core/crypto/singleKey.mjs.map +1 -1
- package/dist/esm/core/crypto/types.d.mts +1 -1
- package/dist/esm/core/crypto/types.mjs +0 -1
- package/dist/esm/core/crypto/utils.d.mts +1 -1
- package/dist/esm/core/crypto/utils.mjs +1 -1
- package/dist/esm/core/crypto/utils.mjs.map +1 -1
- package/dist/esm/core/hex.d.mts +1 -1
- package/dist/esm/core/hex.mjs +1 -1
- package/dist/esm/core/hex.mjs.map +1 -1
- package/dist/esm/core/index.d.mts +4 -3
- package/dist/esm/core/index.mjs +1 -1
- package/dist/esm/core/index.mjs.map +1 -1
- package/dist/esm/errors/index.d.mts +1 -1
- package/dist/esm/errors/index.mjs +6 -1
- package/dist/esm/errors/index.mjs.map +1 -1
- package/dist/esm/{federatedKeyless-CUPEnP-W.d.mts → federatedKeyless-CTzDAQTu.d.mts} +1 -1
- package/dist/esm/index.d.mts +5 -4
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/internal/abstraction.d.mts +1 -1
- package/dist/esm/internal/abstraction.mjs +1 -1
- package/dist/esm/internal/abstraction.mjs.map +1 -1
- package/dist/esm/internal/account.d.mts +21 -3
- package/dist/esm/internal/account.mjs +1 -1
- package/dist/esm/internal/account.mjs.map +1 -1
- package/dist/esm/internal/ans.d.mts +2 -2
- package/dist/esm/internal/ans.mjs +1 -1
- package/dist/esm/internal/ans.mjs.map +1 -1
- package/dist/esm/internal/coin.d.mts +1 -1
- package/dist/esm/internal/coin.mjs +1 -1
- package/dist/esm/internal/coin.mjs.map +1 -1
- package/dist/esm/internal/digitalAsset.d.mts +2 -2
- package/dist/esm/internal/digitalAsset.mjs +1 -1
- package/dist/esm/internal/digitalAsset.mjs.map +1 -1
- package/dist/esm/internal/faucet.d.mts +1 -1
- package/dist/esm/internal/faucet.mjs +1 -1
- package/dist/esm/internal/faucet.mjs.map +1 -1
- package/dist/esm/internal/fungibleAsset.d.mts +2 -2
- package/dist/esm/internal/fungibleAsset.mjs +1 -1
- package/dist/esm/internal/fungibleAsset.mjs.map +1 -1
- package/dist/esm/internal/general.d.mts +1 -1
- package/dist/esm/internal/general.mjs +1 -1
- package/dist/esm/internal/general.mjs.map +1 -1
- package/dist/esm/internal/keyless.d.mts +3 -3
- package/dist/esm/internal/keyless.mjs +1 -1
- package/dist/esm/internal/keyless.mjs.map +1 -1
- package/dist/esm/internal/object.d.mts +1 -1
- package/dist/esm/internal/object.mjs +1 -1
- package/dist/esm/internal/object.mjs.map +1 -1
- package/dist/esm/internal/staking.d.mts +1 -1
- package/dist/esm/internal/staking.mjs +1 -1
- package/dist/esm/internal/staking.mjs.map +1 -1
- package/dist/esm/internal/table.d.mts +1 -1
- package/dist/esm/internal/table.mjs +1 -1
- package/dist/esm/internal/table.mjs.map +1 -1
- package/dist/esm/internal/transaction.d.mts +1 -1
- package/dist/esm/internal/transaction.mjs +1 -1
- package/dist/esm/internal/transaction.mjs.map +1 -1
- package/dist/esm/internal/transactionSubmission.d.mts +2 -2
- package/dist/esm/internal/transactionSubmission.mjs +1 -1
- package/dist/esm/internal/transactionSubmission.mjs.map +1 -1
- package/dist/esm/internal/utils/index.d.mts +1 -1
- package/dist/esm/internal/utils/index.mjs +1 -1
- package/dist/esm/internal/utils/index.mjs.map +1 -1
- package/dist/esm/internal/utils/utils.d.mts +1 -1
- package/dist/esm/internal/utils/utils.mjs +1 -1
- package/dist/esm/internal/utils/utils.mjs.map +1 -1
- package/dist/esm/internal/view.d.mts +1 -1
- package/dist/esm/internal/view.mjs +1 -1
- package/dist/esm/internal/view.mjs.map +1 -1
- package/dist/esm/transactions/authenticator/account.d.mts +1 -1
- package/dist/esm/transactions/authenticator/account.mjs +1 -1
- package/dist/esm/transactions/authenticator/account.mjs.map +1 -1
- package/dist/esm/transactions/authenticator/index.d.mts +1 -1
- package/dist/esm/transactions/authenticator/index.mjs +1 -1
- package/dist/esm/transactions/authenticator/index.mjs.map +1 -1
- package/dist/esm/transactions/authenticator/transaction.d.mts +1 -1
- package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
- package/dist/esm/transactions/authenticator/transaction.mjs.map +1 -1
- package/dist/esm/transactions/index.d.mts +1 -1
- package/dist/esm/transactions/index.mjs +1 -1
- package/dist/esm/transactions/index.mjs.map +1 -1
- package/dist/esm/transactions/instances/chainId.d.mts +1 -1
- package/dist/esm/transactions/instances/chainId.mjs +1 -1
- package/dist/esm/transactions/instances/chainId.mjs.map +1 -1
- package/dist/esm/transactions/instances/identifier.d.mts +1 -1
- package/dist/esm/transactions/instances/identifier.mjs +1 -1
- package/dist/esm/transactions/instances/identifier.mjs.map +1 -1
- package/dist/esm/transactions/instances/index.d.mts +1 -1
- package/dist/esm/transactions/instances/index.mjs +1 -1
- package/dist/esm/transactions/instances/index.mjs.map +1 -1
- package/dist/esm/transactions/instances/moduleId.d.mts +1 -1
- package/dist/esm/transactions/instances/moduleId.mjs +1 -1
- package/dist/esm/transactions/instances/moduleId.mjs.map +1 -1
- package/dist/esm/transactions/instances/multiAgentTransaction.d.mts +1 -1
- package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/multiAgentTransaction.mjs.map +1 -1
- package/dist/esm/transactions/instances/rawTransaction.d.mts +1 -1
- package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/rawTransaction.mjs.map +1 -1
- package/dist/esm/transactions/instances/rotationProofChallenge.d.mts +1 -1
- package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
- package/dist/esm/transactions/instances/rotationProofChallenge.mjs.map +1 -1
- package/dist/esm/transactions/instances/signedTransaction.d.mts +1 -1
- package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/signedTransaction.mjs.map +1 -1
- package/dist/esm/transactions/instances/simpleTransaction.d.mts +1 -1
- package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/simpleTransaction.mjs.map +1 -1
- package/dist/esm/transactions/instances/transactionArgument.d.mts +1 -1
- package/dist/esm/transactions/instances/transactionArgument.mjs +0 -1
- package/dist/esm/transactions/instances/transactionPayload.d.mts +1 -1
- package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
- package/dist/esm/transactions/instances/transactionPayload.mjs.map +1 -1
- package/dist/esm/transactions/management/accountSequenceNumber.d.mts +2 -2
- package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
- package/dist/esm/transactions/management/accountSequenceNumber.mjs.map +1 -1
- package/dist/esm/transactions/management/asyncQueue.mjs +1 -1
- package/dist/esm/transactions/management/asyncQueue.mjs.map +1 -1
- package/dist/esm/transactions/management/index.d.mts +2 -2
- package/dist/esm/transactions/management/index.mjs +1 -1
- package/dist/esm/transactions/management/index.mjs.map +1 -1
- package/dist/esm/transactions/management/transactionWorker.d.mts +2 -2
- package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
- package/dist/esm/transactions/management/transactionWorker.mjs.map +1 -1
- package/dist/esm/transactions/transactionBuilder/helpers.d.mts +1 -1
- package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/helpers.mjs.map +1 -1
- package/dist/esm/transactions/transactionBuilder/index.d.mts +1 -1
- package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/index.mjs.map +1 -1
- package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +1 -1
- package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs.map +1 -1
- package/dist/esm/transactions/transactionBuilder/signingMessage.d.mts +1 -1
- package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/signingMessage.mjs.map +1 -1
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +1 -1
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs.map +1 -1
- package/dist/esm/transactions/typeTag/index.d.mts +1 -1
- package/dist/esm/transactions/typeTag/index.mjs +1 -1
- package/dist/esm/transactions/typeTag/index.mjs.map +1 -1
- package/dist/esm/transactions/typeTag/parser.d.mts +1 -1
- package/dist/esm/transactions/typeTag/parser.mjs +1 -1
- package/dist/esm/transactions/typeTag/parser.mjs.map +1 -1
- package/dist/esm/transactions/types.d.mts +1 -1
- package/dist/esm/transactions/types.mjs +0 -1
- package/dist/esm/types/abstraction.mjs +1 -1
- package/dist/esm/types/abstraction.mjs.map +1 -1
- package/dist/esm/types/generated/queries.mjs +493 -1
- package/dist/esm/types/generated/queries.mjs.map +1 -1
- package/dist/esm/types/generated/types.mjs +1 -1
- package/dist/esm/types/generated/types.mjs.map +1 -1
- package/dist/esm/types/index.d.mts +1 -1
- package/dist/esm/types/index.mjs +1 -1
- package/dist/esm/types/index.mjs.map +1 -1
- package/dist/esm/types/indexer.mjs +0 -1
- package/dist/esm/types/types.d.mts +1 -1
- package/dist/esm/types/types.mjs +1 -1
- package/dist/esm/types/types.mjs.map +1 -1
- package/dist/esm/utils/apiEndpoints.d.mts +1 -0
- package/dist/esm/utils/apiEndpoints.mjs +1 -1
- package/dist/esm/utils/apiEndpoints.mjs.map +1 -1
- package/dist/esm/utils/const.mjs +1 -1
- package/dist/esm/utils/const.mjs.map +1 -1
- package/dist/esm/utils/helpers.d.mts +1 -1
- package/dist/esm/utils/helpers.mjs +1 -1
- package/dist/esm/utils/helpers.mjs.map +1 -1
- package/dist/esm/utils/index.d.mts +1 -1
- package/dist/esm/utils/index.mjs +1 -1
- package/dist/esm/utils/index.mjs.map +1 -1
- package/dist/esm/utils/memoize.mjs +1 -1
- package/dist/esm/utils/memoize.mjs.map +1 -1
- package/dist/esm/utils/normalizeBundle.d.mts +1 -1
- package/dist/esm/utils/normalizeBundle.mjs +1 -1
- package/dist/esm/utils/normalizeBundle.mjs.map +1 -1
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/dist/esm/version.mjs.map +1 -1
- package/package.json +40 -22
- package/src/api/account.ts +32 -7
- package/src/api/aptos.ts +25 -14
- package/src/core/account/utils/address.ts +22 -0
- package/src/core/crypto/index.ts +1 -0
- package/src/core/crypto/privateKey.ts +1 -0
- package/src/core/crypto/secp256k1.ts +9 -1
- package/src/core/crypto/secp256r1.ts +495 -0
- package/src/core/crypto/singleKey.ts +11 -0
- package/src/internal/account.ts +33 -0
- package/src/internal/ans.ts +1 -0
- package/src/types/types.ts +5 -0
- package/src/utils/apiEndpoints.ts +7 -0
- package/src/version.ts +1 -1
- package/dist/common/chunk-6MMUUJHX.js +0 -4
- package/dist/esm/chunk-35DKMW7Q.mjs +0 -2
- package/dist/esm/chunk-35DKMW7Q.mjs.map +0 -1
- package/dist/esm/chunk-4QMXOWHP.mjs +0 -1
- package/dist/esm/chunk-4QMXOWHP.mjs.map +0 -1
- package/dist/esm/chunk-4RXKALLC.mjs +0 -2
- package/dist/esm/chunk-4RXKALLC.mjs.map +0 -1
- package/dist/esm/chunk-4WPQQPUF.mjs +0 -1
- package/dist/esm/chunk-4WPQQPUF.mjs.map +0 -1
- package/dist/esm/chunk-56CNRT2K.mjs +0 -2
- package/dist/esm/chunk-56CNRT2K.mjs.map +0 -1
- package/dist/esm/chunk-5FI4545P.mjs +0 -2
- package/dist/esm/chunk-5FI4545P.mjs.map +0 -1
- package/dist/esm/chunk-5HXLZHDW.mjs +0 -1
- package/dist/esm/chunk-5HXLZHDW.mjs.map +0 -1
- package/dist/esm/chunk-6WDVDEQZ.mjs +0 -7
- package/dist/esm/chunk-6WDVDEQZ.mjs.map +0 -1
- package/dist/esm/chunk-7DQDJ2SA.mjs +0 -2
- package/dist/esm/chunk-7DQDJ2SA.mjs.map +0 -1
- package/dist/esm/chunk-7ECCT6PK.mjs +0 -1
- package/dist/esm/chunk-7ECCT6PK.mjs.map +0 -1
- package/dist/esm/chunk-A5L76YP7.mjs +0 -2
- package/dist/esm/chunk-A5L76YP7.mjs.map +0 -1
- package/dist/esm/chunk-B563XRSZ.mjs +0 -2
- package/dist/esm/chunk-B563XRSZ.mjs.map +0 -1
- package/dist/esm/chunk-C3Q23D22.mjs +0 -2
- package/dist/esm/chunk-C3Q23D22.mjs.map +0 -1
- package/dist/esm/chunk-CW35YAMN.mjs +0 -2
- package/dist/esm/chunk-CW35YAMN.mjs.map +0 -1
- package/dist/esm/chunk-DIGP2ALY.mjs +0 -4
- package/dist/esm/chunk-DIGP2ALY.mjs.map +0 -1
- package/dist/esm/chunk-DNRUDMMV.mjs +0 -2
- package/dist/esm/chunk-DNRUDMMV.mjs.map +0 -1
- package/dist/esm/chunk-EBMEXURY.mjs +0 -2
- package/dist/esm/chunk-EBMEXURY.mjs.map +0 -1
- package/dist/esm/chunk-EM52Z7T7.mjs +0 -2
- package/dist/esm/chunk-EM52Z7T7.mjs.map +0 -1
- package/dist/esm/chunk-ES2KP6BS.mjs +0 -2
- package/dist/esm/chunk-ES2KP6BS.mjs.map +0 -1
- package/dist/esm/chunk-FD6FGKYY.mjs +0 -1
- package/dist/esm/chunk-FD6FGKYY.mjs.map +0 -1
- package/dist/esm/chunk-FGFLPH5K.mjs +0 -2
- package/dist/esm/chunk-FGFLPH5K.mjs.map +0 -1
- package/dist/esm/chunk-FLZPUYXQ.mjs +0 -2
- package/dist/esm/chunk-FLZPUYXQ.mjs.map +0 -1
- package/dist/esm/chunk-FZY4PMEE.mjs +0 -1
- package/dist/esm/chunk-FZY4PMEE.mjs.map +0 -1
- package/dist/esm/chunk-G3MHXDYA.mjs +0 -1
- package/dist/esm/chunk-G3MHXDYA.mjs.map +0 -1
- package/dist/esm/chunk-GFFKEZ56.mjs +0 -2
- package/dist/esm/chunk-GFFKEZ56.mjs.map +0 -1
- package/dist/esm/chunk-GMQCQDW4.mjs +0 -2
- package/dist/esm/chunk-GMQCQDW4.mjs.map +0 -1
- package/dist/esm/chunk-GOXRBEIJ.mjs +0 -2
- package/dist/esm/chunk-GOXRBEIJ.mjs.map +0 -1
- package/dist/esm/chunk-HGLO5LDS.mjs +0 -1
- package/dist/esm/chunk-HGLO5LDS.mjs.map +0 -1
- package/dist/esm/chunk-HNBKTJPN.mjs +0 -2
- package/dist/esm/chunk-HNBKTJPN.mjs.map +0 -1
- package/dist/esm/chunk-HNBVYE3N.mjs +0 -2
- package/dist/esm/chunk-HNBVYE3N.mjs.map +0 -1
- package/dist/esm/chunk-IF4UU2MT.mjs +0 -2
- package/dist/esm/chunk-IF4UU2MT.mjs.map +0 -1
- package/dist/esm/chunk-IJE2LVZG.mjs +0 -2
- package/dist/esm/chunk-IJE2LVZG.mjs.map +0 -1
- package/dist/esm/chunk-KDMSOCZY.mjs +0 -2
- package/dist/esm/chunk-KDMSOCZY.mjs.map +0 -1
- package/dist/esm/chunk-LWL57YFU.mjs +0 -2
- package/dist/esm/chunk-LWL57YFU.mjs.map +0 -1
- package/dist/esm/chunk-MT2RJ7H3.mjs +0 -2
- package/dist/esm/chunk-MT2RJ7H3.mjs.map +0 -1
- package/dist/esm/chunk-N3O3ULF7.mjs +0 -2
- package/dist/esm/chunk-N3O3ULF7.mjs.map +0 -1
- package/dist/esm/chunk-N6YTF76Q.mjs +0 -2
- package/dist/esm/chunk-N6YTF76Q.mjs.map +0 -1
- package/dist/esm/chunk-NECL5FCQ.mjs +0 -1
- package/dist/esm/chunk-NECL5FCQ.mjs.map +0 -1
- package/dist/esm/chunk-OLILO7VD.mjs +0 -2
- package/dist/esm/chunk-OLILO7VD.mjs.map +0 -1
- package/dist/esm/chunk-ORMOQWWH.mjs +0 -2
- package/dist/esm/chunk-ORMOQWWH.mjs.map +0 -1
- package/dist/esm/chunk-Q4W3WJ2U.mjs +0 -2
- package/dist/esm/chunk-Q4W3WJ2U.mjs.map +0 -1
- package/dist/esm/chunk-QREVMGQZ.mjs +0 -2
- package/dist/esm/chunk-QREVMGQZ.mjs.map +0 -1
- package/dist/esm/chunk-RCSJFTST.mjs +0 -2
- package/dist/esm/chunk-RCSJFTST.mjs.map +0 -1
- package/dist/esm/chunk-RGKRCZ36.mjs +0 -4
- package/dist/esm/chunk-RGKRCZ36.mjs.map +0 -1
- package/dist/esm/chunk-ROT6S6BM.mjs +0 -2
- package/dist/esm/chunk-ROT6S6BM.mjs.map +0 -1
- package/dist/esm/chunk-RQX6JOEN.mjs +0 -2
- package/dist/esm/chunk-RQX6JOEN.mjs.map +0 -1
- package/dist/esm/chunk-STY74NUA.mjs +0 -2
- package/dist/esm/chunk-STY74NUA.mjs.map +0 -1
- package/dist/esm/chunk-TGRLDWXV.mjs +0 -2
- package/dist/esm/chunk-TGRLDWXV.mjs.map +0 -1
- package/dist/esm/chunk-TOBQ5UE6.mjs +0 -2
- package/dist/esm/chunk-TOBQ5UE6.mjs.map +0 -1
- package/dist/esm/chunk-UL777LTI.mjs +0 -494
- package/dist/esm/chunk-UL777LTI.mjs.map +0 -1
- package/dist/esm/chunk-UYVPNUH3.mjs +0 -1
- package/dist/esm/chunk-UYVPNUH3.mjs.map +0 -1
- package/dist/esm/chunk-V3MBJJTL.mjs +0 -1
- package/dist/esm/chunk-V3MBJJTL.mjs.map +0 -1
- package/dist/esm/chunk-V74WPKSY.mjs +0 -2
- package/dist/esm/chunk-V74WPKSY.mjs.map +0 -1
- package/dist/esm/chunk-WCMW2L3P.mjs +0 -2
- package/dist/esm/chunk-WCMW2L3P.mjs.map +0 -1
- package/dist/esm/chunk-WSR5EBJM.mjs +0 -2
- package/dist/esm/chunk-WSR5EBJM.mjs.map +0 -1
- package/dist/esm/chunk-XJJVJOX5.mjs +0 -2
- package/dist/esm/chunk-XJJVJOX5.mjs.map +0 -1
- package/dist/esm/chunk-XKUIMGKU.mjs +0 -2
- package/dist/esm/chunk-XKUIMGKU.mjs.map +0 -1
- package/dist/esm/chunk-YOZBVVKL.mjs +0 -2
- package/dist/esm/chunk-YOZBVVKL.mjs.map +0 -1
- package/dist/esm/chunk-ZP4DWSQA.mjs +0 -2
- package/dist/esm/chunk-ZP4DWSQA.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/transactions/management/asyncQueue.ts"],"sourcesContent":["/**\n * The AsyncQueue class is an async-aware data structure that provides a queue-like\n * behavior for managing asynchronous tasks or operations.\n * It allows to enqueue items and dequeue them asynchronously.\n * This is not thread-safe, but it is async concurrency safe, and\n * it does not guarantee ordering for those that call into and await on enqueue.\n * @group Implementation\n * @category Transactions\n */\n\ninterface PendingDequeue<T> {\n resolve: (value: T) => void;\n reject: (reason?: AsyncQueueCancelledError) => void;\n}\n\nexport class AsyncQueue<T> {\n readonly queue: T[] = [];\n\n // The pendingDequeue is used to handle the resolution of promises when items are enqueued and dequeued.\n private pendingDequeue: PendingDequeue<T>[] = [];\n\n private cancelled: boolean = false;\n\n /**\n * Adds an item to the queue. If there are pending dequeued promises, it resolves the oldest promise with the enqueued item\n * immediately; otherwise, it adds the item to the queue.\n *\n * @param item - The item to be added to the queue.\n * @group Implementation\n * @category Transactions\n */\n enqueue(item: T): void {\n this.cancelled = false;\n\n if (this.pendingDequeue.length > 0) {\n const promise = this.pendingDequeue.shift();\n\n promise?.resolve(item);\n\n return;\n }\n\n this.queue.push(item);\n }\n\n /**\n * Dequeues the next item from the queue and returns a promise that resolves to it.\n * If the queue is empty, it creates a new promise that will be resolved when an item is enqueued.\n *\n * @returns Promise<T>\n * @group Implementation\n * @category Transactions\n */\n async dequeue(): Promise<T> {\n if (this.queue.length > 0) {\n return Promise.resolve(this.queue.shift()!);\n }\n\n return new Promise<T>((resolve, reject) => {\n this.pendingDequeue.push({ resolve, reject });\n });\n }\n\n /**\n * Determine whether the queue is empty.\n *\n * @returns boolean - Returns true if the queue has no elements, otherwise false.\n * @group Implementation\n * @category Transactions\n */\n isEmpty(): boolean {\n return this.queue.length === 0;\n }\n\n /**\n * Cancels all pending promises in the queue and rejects them with an AsyncQueueCancelledError.\n * This ensures that any awaiting code can handle the cancellation appropriately.\n *\n * @returns {void}\n * @group Implementation\n * @category Transactions\n */\n cancel(): void {\n this.cancelled = true;\n\n this.pendingDequeue.forEach(async ({ reject }) => {\n reject(new AsyncQueueCancelledError(\"Task cancelled\"));\n });\n\n this.pendingDequeue = [];\n\n this.queue.length = 0;\n }\n\n /**\n * Determine whether the queue has been cancelled.\n *\n * @returns boolean - Returns true if the queue is cancelled, otherwise false.\n * @group Implementation\n * @category Transactions\n */\n isCancelled(): boolean {\n return this.cancelled;\n }\n\n /**\n * Retrieve the length of the pending dequeue.\n *\n * @returns number - The number of items currently in the pending dequeue.\n * @group Implementation\n * @category Transactions\n */\n pendingDequeueLength(): number {\n return this.pendingDequeue.length;\n }\n}\n\n/**\n * Represents an error that occurs when an asynchronous queue operation is cancelled.\n * This error extends the built-in Error class to provide additional context for cancellation events.\n *\n * @extends Error\n * @group Implementation\n * @category Transactions\n */\nexport class AsyncQueueCancelledError extends Error {}\n"],"mappings":"AAeO,MAAMA,CAAc,CAApB,cACL,KAAS,MAAa,CAAC,EAGvB,KAAQ,eAAsC,CAAC,EAE/C,KAAQ,UAAqB,GAU7B,QAAQC,EAAe,CAGrB,GAFA,KAAK,UAAY,GAEb,KAAK,eAAe,OAAS,EAAG,CAClB,KAAK,eAAe,MAAM,GAEjC,QAAQA,CAAI,EAErB,MACF,CAEA,KAAK,MAAM,KAAKA,CAAI,CACtB,CAUA,MAAM,SAAsB,CAC1B,OAAI,KAAK,MAAM,OAAS,EACf,QAAQ,QAAQ,KAAK,MAAM,MAAM,CAAE,EAGrC,IAAI,QAAW,CAACC,EAASC,IAAW,CACzC,KAAK,eAAe,KAAK,CAAE,QAAAD,EAAS,OAAAC,CAAO,CAAC,CAC9C,CAAC,CACH,CASA,SAAmB,CACjB,OAAO,KAAK,MAAM,SAAW,CAC/B,CAUA,QAAe,CACb,KAAK,UAAY,GAEjB,KAAK,eAAe,QAAQ,MAAO,CAAE,OAAAA,CAAO,IAAM,CAChDA,EAAO,IAAIC,EAAyB,gBAAgB,CAAC,CACvD,CAAC,EAED,KAAK,eAAiB,CAAC,EAEvB,KAAK,MAAM,OAAS,CACtB,CASA,aAAuB,CACrB,OAAO,KAAK,SACd,CASA,sBAA+B,CAC7B,OAAO,KAAK,eAAe,MAC7B,CACF,CAUO,MAAMA,UAAiC,KAAM,CAAC","names":["AsyncQueue","item","resolve","reject","AsyncQueueCancelledError"]}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export { AccountSequenceNumber } from './accountSequenceNumber.mjs';
|
|
2
2
|
export { ExecutionFinishEventData, FailureEventData, SuccessEventData, TransactionWorker, TransactionWorkerEvents, TransactionWorkerEventsEnum, promiseFulfilledStatus } from './transactionWorker.mjs';
|
|
3
|
-
import '../../account-
|
|
3
|
+
import '../../account-BortO8g2.mjs';
|
|
4
4
|
import '../../types/indexer.mjs';
|
|
5
5
|
import '../../types/generated/operations.mjs';
|
|
6
6
|
import '../../types/generated/types.mjs';
|
|
7
7
|
import '../../utils/apiEndpoints.mjs';
|
|
8
8
|
import '../../utils/const.mjs';
|
|
9
9
|
import '../../core/common.mjs';
|
|
10
|
-
import '../../Ed25519Account-
|
|
10
|
+
import '../../Ed25519Account-CPwej6wB.mjs';
|
|
11
11
|
import 'eventemitter3';
|
|
12
12
|
import './asyncQueue.mjs';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
export*from"./accountSequenceNumber";export*from"./transactionWorker";
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/transactions/management/index.ts"],"sourcesContent":["export * from \"./accountSequenceNumber\";\nexport * from \"./transactionWorker\";\n"],"mappings":"AAAA,WAAc,0BACd,WAAc","names":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AccountSequenceNumber } from './accountSequenceNumber.mjs';
|
|
2
2
|
import EventEmitter from 'eventemitter3';
|
|
3
|
-
import { A as AptosConfig, aX as InputGenerateTransactionPayloadData, aT as InputGenerateTransactionOptions, cl as PendingTransactionResponse, at as SimpleTransaction } from '../../account-
|
|
4
|
-
import { A as Account } from '../../Ed25519Account-
|
|
3
|
+
import { A as AptosConfig, aX as InputGenerateTransactionPayloadData, aT as InputGenerateTransactionOptions, cl as PendingTransactionResponse, at as SimpleTransaction } from '../../account-BortO8g2.mjs';
|
|
4
|
+
import { A as Account } from '../../Ed25519Account-CPwej6wB.mjs';
|
|
5
5
|
import { AsyncQueue } from './asyncQueue.mjs';
|
|
6
6
|
import '../../types/indexer.mjs';
|
|
7
7
|
import '../../types/generated/operations.mjs';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import h from"eventemitter3";import{waitForTransaction as d}from"../../internal/transaction";import{generateTransaction as l,signAndSubmitTransaction as p}from"../../internal/transactionSubmission";import{AccountSequenceNumber as m}from"./accountSequenceNumber";import{AsyncQueue as o,AsyncQueueCancelledError as c}from"./asyncQueue";const u="fulfilled";var g=(n=>(n.TransactionSent="transactionSent",n.TransactionSendFailed="transactionSendFailed",n.TransactionExecuted="transactionExecuted",n.TransactionExecutionFailed="transactionExecutionFailed",n.ExecutionFinish="executionFinish",n))(g||{});class G extends h{constructor(t,e,a=30,n=100,i=10){super();this.taskQueue=new o;this.transactionsQueue=new o;this.outstandingTransactions=new o;this.sentTransactions=[];this.executedTransactions=[];this.aptosConfig=t,this.account=e,this.started=!1,this.accountSequnceNumber=new m(t,e,a,n,i)}async submitNextTransaction(){try{for(;;){const t=await this.accountSequnceNumber.nextSequenceNumber();if(t===null)return;const e=await this.generateNextTransaction(this.account,t);if(!e)return;const a=p({aptosConfig:this.aptosConfig,transaction:e,signer:this.account});await this.outstandingTransactions.enqueue([a,t])}}catch(t){if(t instanceof c)return;throw new Error(`Submit transaction failed for ${this.account.accountAddress.toString()} with error ${t}`)}}async processTransactions(){try{for(;;){const t=[],e=[];let[a,n]=await this.outstandingTransactions.dequeue();for(t.push(a),e.push(n);!this.outstandingTransactions.isEmpty();)[a,n]=await this.outstandingTransactions.dequeue(),t.push(a),e.push(n);const i=await Promise.allSettled(t);for(let s=0;s<i.length&&s<e.length;s+=1){const r=i[s];n=e[s],r.status===u?(this.sentTransactions.push([r.value.hash,n,null]),this.emit("transactionSent",{message:`transaction hash ${r.value.hash} has been committed to chain`,transactionHash:r.value.hash}),await this.checkTransaction(r,n)):(this.sentTransactions.push([r.status,n,r.reason]),this.emit("transactionSendFailed",{message:`failed to commit transaction ${this.sentTransactions.length} with error ${r.reason}`,error:r.reason}))}this.emit("executionFinish",{message:`execute ${i.length} transactions finished`})}}catch(t){if(t instanceof c)return;throw new Error(`Process execution failed for ${this.account.accountAddress.toString()} with error ${t}`)}}async checkTransaction(t,e){try{const a=[];a.push(d({aptosConfig:this.aptosConfig,transactionHash:t.value.hash}));const n=await Promise.allSettled(a);for(let i=0;i<n.length;i+=1){const s=n[i];s.status===u?(this.executedTransactions.push([s.value.hash,e,null]),this.emit("transactionExecuted",{message:`transaction hash ${s.value.hash} has been executed on chain`,transactionHash:t.value.hash})):(this.executedTransactions.push([s.status,e,s.reason]),this.emit("transactionExecutionFailed",{message:`failed to execute transaction ${this.executedTransactions.length} with error ${s.reason}`,error:s.reason}))}}catch(a){throw new Error(`Check transaction failed for ${this.account.accountAddress.toString()} with error ${a}`)}}async push(t,e){this.transactionsQueue.enqueue([t,e])}async generateNextTransaction(t,e){if(this.transactionsQueue.isEmpty())return;const[a,n]=await this.transactionsQueue.dequeue();return l({aptosConfig:this.aptosConfig,sender:t.accountAddress,data:a,options:{...n,accountSequenceNumber:e,replayProtectionNonce:void 0}})}async run(){try{for(;!this.taskQueue.isCancelled();)await(await this.taskQueue.dequeue())()}catch(t){throw new Error(`Unable to start transaction batching: ${t}`)}}start(){if(this.started)throw new Error("worker has already started");this.started=!0,this.taskQueue.enqueue(()=>this.submitNextTransaction()),this.taskQueue.enqueue(()=>this.processTransactions()),this.run()}stop(){if(this.taskQueue.isCancelled())throw new Error("worker has already stopped");this.started=!1,this.taskQueue.cancel()}}export{G as TransactionWorker,g as TransactionWorkerEventsEnum,u as promiseFulfilledStatus};
|
|
2
2
|
//# sourceMappingURL=transactionWorker.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/transactions/management/transactionWorker.ts"],"sourcesContent":["/* eslint-disable no-await-in-loop */\n\nimport EventEmitter from \"eventemitter3\";\nimport { AptosConfig } from \"../../api/aptosConfig\";\nimport { Account } from \"../../account\";\nimport { waitForTransaction } from \"../../internal/transaction\";\nimport { generateTransaction, signAndSubmitTransaction } from \"../../internal/transactionSubmission\";\nimport { PendingTransactionResponse, TransactionResponse } from \"../../types\";\nimport { InputGenerateTransactionOptions, InputGenerateTransactionPayloadData } from \"../types\";\nimport { AccountSequenceNumber } from \"./accountSequenceNumber\";\nimport { AsyncQueue, AsyncQueueCancelledError } from \"./asyncQueue\";\nimport { SimpleTransaction } from \"../instances/simpleTransaction\";\n\n/**\n * @group Implementation\n * @category Transactions\n */\nexport const promiseFulfilledStatus = \"fulfilled\";\n\n/**\n * Events emitted by the transaction worker during its operation, allowing the dapp to respond to various transaction states.\n * @group Implementation\n * @category Transactions\n */\nexport enum TransactionWorkerEventsEnum {\n // fired after a transaction gets sent to the chain\n TransactionSent = \"transactionSent\",\n // fired if there is an error sending the transaction to the chain\n TransactionSendFailed = \"transactionSendFailed\",\n // fired when a single transaction has executed successfully\n TransactionExecuted = \"transactionExecuted\",\n // fired if a single transaction fails in execution\n TransactionExecutionFailed = \"transactionExecutionFailed\",\n // fired when the worker has finished its job / when the queue has been emptied\n ExecutionFinish = \"executionFinish\",\n}\n\n/**\n * Defines the events emitted by the transaction worker during various stages of transaction processing. *\n * @group Implementation\n * @category Transactions\n */\nexport interface TransactionWorkerEvents {\n transactionSent: (data: SuccessEventData) => void;\n transactionSendFailed: (data: FailureEventData) => void;\n transactionExecuted: (data: SuccessEventData) => void;\n transactionExecutionFailed: (data: FailureEventData) => void;\n executionFinish: (data: ExecutionFinishEventData) => void;\n}\n\n/**\n * The payload for when the worker has finished its job.\n * @group Implementation\n * @category Transactions\n */\nexport type ExecutionFinishEventData = {\n message: string;\n};\n\n/**\n * The payload for a success event.\n * @group Implementation\n * @category Transactions\n */\nexport type SuccessEventData = {\n message: string;\n transactionHash: string;\n};\n\n/**\n * The payload for a failure event.\n * @group Implementation\n * @category Transactions\n */\nexport type FailureEventData = {\n message: string;\n error: string;\n};\n\n/**\n * TransactionWorker provides a simple framework for receiving payloads to be processed.\n *\n * Once one `start()` the process and pushes a new transaction, the worker acquires\n * the current account's next sequence number (by using the AccountSequenceNumber class),\n * generates a signed transaction and pushes an async submission process into the `outstandingTransactions` queue.\n * At the same time, the worker processes transactions by reading the `outstandingTransactions` queue\n * and submits the next transaction to chain, it\n * 1) waits for resolution of the submission process or get pre-execution validation error\n * and 2) waits for the resolution of the execution process or get an execution error.\n * The worker fires events for any submission and/or execution success and/or failure.\n * @group Implementation\n * @category Transactions\n */\nexport class TransactionWorker extends EventEmitter<TransactionWorkerEvents> {\n readonly aptosConfig: AptosConfig;\n\n readonly account: Account;\n\n // current account sequence number\n // TODO: Rename Sequnce -> Sequence\n readonly accountSequnceNumber: AccountSequenceNumber;\n\n readonly taskQueue: AsyncQueue<() => Promise<void>> = new AsyncQueue<() => Promise<void>>();\n\n // process has started\n started: boolean;\n\n /**\n * transactions payloads waiting to be generated and signed\n *\n * TODO support entry function payload from ABI builder\n * @group Implementation\n * @category Transactions\n */\n transactionsQueue = new AsyncQueue<\n [InputGenerateTransactionPayloadData, InputGenerateTransactionOptions | undefined]\n >();\n\n /**\n * signed transactions waiting to be submitted\n * @group Implementation\n * @category Transactions\n */\n outstandingTransactions = new AsyncQueue<[Promise<PendingTransactionResponse>, bigint]>();\n\n /**\n * transactions that have been submitted to chain\n * @group Implementation\n * @category Transactions\n */\n sentTransactions: Array<[string, bigint, any]> = [];\n\n /**\n * transactions that have been committed to chain\n * @group Implementation\n * @category Transactions\n */\n executedTransactions: Array<[string, bigint, any]> = [];\n\n /**\n * Initializes a new instance of the class, providing a framework for receiving payloads to be processed.\n *\n * @param aptosConfig - A configuration object for Aptos.\n * @param account - The account that will be used for sending transactions.\n * @param maxWaitTime - The maximum wait time to wait before re-syncing the sequence number to the current on-chain state,\n * default is 30 seconds.\n * @param maximumInFlight - The maximum number of transactions that can be submitted per account, default is 100.\n * @param sleepTime - The time to wait in seconds before re-evaluating if the maximum number of transactions are in flight,\n * default is 10 seconds.\n * @group Implementation\n * @category Transactions\n */\n constructor(\n aptosConfig: AptosConfig,\n account: Account,\n maxWaitTime: number = 30,\n maximumInFlight: number = 100,\n sleepTime: number = 10,\n ) {\n super();\n this.aptosConfig = aptosConfig;\n this.account = account;\n this.started = false;\n this.accountSequnceNumber = new AccountSequenceNumber(\n aptosConfig,\n account,\n maxWaitTime,\n maximumInFlight,\n sleepTime,\n );\n }\n\n /**\n * Submits the next transaction for the account by generating it with the current sequence number\n * and adding it to the outstanding transaction queue for processing.\n * This function continues to submit transactions until there are no more to process.\n *\n * @throws {Error} Throws an error if the transaction submission fails.\n * @group Implementation\n * @category Transactions\n */\n async submitNextTransaction() {\n try {\n /* eslint-disable no-constant-condition */\n while (true) {\n const sequenceNumber = await this.accountSequnceNumber.nextSequenceNumber();\n if (sequenceNumber === null) return;\n const transaction = await this.generateNextTransaction(this.account, sequenceNumber);\n if (!transaction) return;\n const pendingTransaction = signAndSubmitTransaction({\n aptosConfig: this.aptosConfig,\n transaction,\n signer: this.account,\n });\n await this.outstandingTransactions.enqueue([pendingTransaction, sequenceNumber]);\n }\n } catch (error: any) {\n if (error instanceof AsyncQueueCancelledError) {\n return;\n }\n throw new Error(`Submit transaction failed for ${this.account.accountAddress.toString()} with error ${error}`);\n }\n }\n\n /**\n * Reads the outstanding transaction queue and submits the transactions to the chain.\n * This function processes each transaction, checking their status and emitting events based on whether they were successfully\n * sent or failed.\n *\n * @throws {Error} Throws an error if the process execution fails.\n * @event TransactionWorkerEventsEnum.TransactionSent - Emitted when a transaction has been successfully committed to the chain.\n * @event TransactionWorkerEventsEnum.TransactionSendFailed - Emitted when a transaction fails to commit, along with the error\n * reason.\n * @event TransactionWorkerEventsEnum.ExecutionFinish - Emitted when the execution of transactions is complete.\n * @group Implementation\n * @category Transactions\n */\n async processTransactions() {\n try {\n /* eslint-disable no-constant-condition */\n while (true) {\n const awaitingTransactions = [];\n const sequenceNumbers = [];\n let [pendingTransaction, sequenceNumber] = await this.outstandingTransactions.dequeue();\n\n awaitingTransactions.push(pendingTransaction);\n sequenceNumbers.push(sequenceNumber);\n\n while (!this.outstandingTransactions.isEmpty()) {\n [pendingTransaction, sequenceNumber] = await this.outstandingTransactions.dequeue();\n\n awaitingTransactions.push(pendingTransaction);\n sequenceNumbers.push(sequenceNumber);\n }\n // send awaiting transactions to chain\n const sentTransactions = await Promise.allSettled(awaitingTransactions);\n for (let i = 0; i < sentTransactions.length && i < sequenceNumbers.length; i += 1) {\n // check sent transaction status\n const sentTransaction = sentTransactions[i];\n sequenceNumber = sequenceNumbers[i];\n if (sentTransaction.status === promiseFulfilledStatus) {\n // transaction sent to chain\n this.sentTransactions.push([sentTransaction.value.hash, sequenceNumber, null]);\n // check sent transaction execution\n this.emit(TransactionWorkerEventsEnum.TransactionSent, {\n message: `transaction hash ${sentTransaction.value.hash} has been committed to chain`,\n transactionHash: sentTransaction.value.hash,\n });\n await this.checkTransaction(sentTransaction, sequenceNumber);\n } else {\n // send transaction failed\n this.sentTransactions.push([sentTransaction.status, sequenceNumber, sentTransaction.reason]);\n this.emit(TransactionWorkerEventsEnum.TransactionSendFailed, {\n message: `failed to commit transaction ${this.sentTransactions.length} with error ${sentTransaction.reason}`,\n error: sentTransaction.reason,\n });\n }\n }\n this.emit(TransactionWorkerEventsEnum.ExecutionFinish, {\n message: `execute ${sentTransactions.length} transactions finished`,\n });\n }\n } catch (error: any) {\n if (error instanceof AsyncQueueCancelledError) {\n return;\n }\n throw new Error(`Process execution failed for ${this.account.accountAddress.toString()} with error ${error}`);\n }\n }\n\n /**\n * Once a transaction has been sent to the chain, this function checks for its execution status.\n * @param sentTransaction - The transaction that was sent to the chain and is now waiting to be executed.\n * @param sequenceNumber - The account's sequence number that was sent with the transaction.\n * @group Implementation\n * @category Transactions\n */\n async checkTransaction(sentTransaction: PromiseFulfilledResult<PendingTransactionResponse>, sequenceNumber: bigint) {\n try {\n const waitFor: Array<Promise<TransactionResponse>> = [];\n waitFor.push(waitForTransaction({ aptosConfig: this.aptosConfig, transactionHash: sentTransaction.value.hash }));\n const sentTransactions = await Promise.allSettled(waitFor);\n\n for (let i = 0; i < sentTransactions.length; i += 1) {\n const executedTransaction = sentTransactions[i];\n if (executedTransaction.status === promiseFulfilledStatus) {\n // transaction executed to chain\n this.executedTransactions.push([executedTransaction.value.hash, sequenceNumber, null]);\n this.emit(TransactionWorkerEventsEnum.TransactionExecuted, {\n message: `transaction hash ${executedTransaction.value.hash} has been executed on chain`,\n transactionHash: sentTransaction.value.hash,\n });\n } else {\n // transaction execution failed\n this.executedTransactions.push([executedTransaction.status, sequenceNumber, executedTransaction.reason]);\n this.emit(TransactionWorkerEventsEnum.TransactionExecutionFailed, {\n message: `failed to execute transaction ${this.executedTransactions.length} with error ${executedTransaction.reason}`,\n error: executedTransaction.reason,\n });\n }\n }\n } catch (error: any) {\n throw new Error(`Check transaction failed for ${this.account.accountAddress.toString()} with error ${error}`);\n }\n }\n\n /**\n * Pushes a transaction to the transactions queue for processing.\n *\n * @param transactionData - The transaction payload containing necessary details.\n * @param transactionData.abi - For all entry function payloads, the ABI to skip remote ABI lookups.\n * @param options - Optional parameters for transaction configuration.\n * @param options.maxGasAmount - Maximum gas amount for the transaction.\n * @param options.gasUnitPrice - Gas unit price for the transaction.\n * @param options.expireTimestamp - Expiration timestamp on the transaction.\n * @param options.accountSequenceNumber - The sequence number for the transaction.\n * @group Implementation\n * @category Transactions\n */\n async push(\n transactionData: InputGenerateTransactionPayloadData,\n options?: InputGenerateTransactionOptions,\n ): Promise<void> {\n this.transactionsQueue.enqueue([transactionData, options]);\n }\n\n /**\n * Generates a signed transaction that can be submitted to the chain.\n *\n * @param account - An Aptos account used as the sender of the transaction.\n * @param sequenceNumber - A sequence number the transaction will be generated with.\n * @returns A signed transaction object or undefined if the transaction queue is empty.\n * @group Implementation\n * @category Transactions\n */\n async generateNextTransaction(account: Account, sequenceNumber: bigint): Promise<SimpleTransaction | undefined> {\n if (this.transactionsQueue.isEmpty()) return undefined;\n const [transactionData, options] = await this.transactionsQueue.dequeue();\n return generateTransaction({\n aptosConfig: this.aptosConfig,\n sender: account.accountAddress,\n data: transactionData,\n options: { ...options, accountSequenceNumber: sequenceNumber, replayProtectionNonce: undefined },\n });\n }\n\n /**\n * Starts transaction submission and processing by executing tasks from the queue until it is cancelled.\n *\n * @throws {Error} Throws an error if unable to start transaction batching.\n * @group Implementation\n * @category Transactions\n */\n async run() {\n try {\n while (!this.taskQueue.isCancelled()) {\n const task = await this.taskQueue.dequeue();\n await task();\n }\n } catch (error: any) {\n throw new Error(`Unable to start transaction batching: ${error}`);\n }\n }\n\n /**\n * Starts the transaction management process.\n *\n * @throws {Error} Throws an error if the worker has already started.\n * @group Implementation\n * @category Transactions\n */\n start() {\n if (this.started) {\n throw new Error(\"worker has already started\");\n }\n this.started = true;\n this.taskQueue.enqueue(() => this.submitNextTransaction());\n this.taskQueue.enqueue(() => this.processTransactions());\n this.run();\n }\n\n /**\n * Stops the transaction management process.\n *\n * @throws {Error} Throws an error if the worker has already stopped.\n * @group Implementation\n * @category Transactions\n */\n stop() {\n if (this.taskQueue.isCancelled()) {\n throw new Error(\"worker has already stopped\");\n }\n this.started = false;\n this.taskQueue.cancel();\n }\n}\n"],"mappings":"AAEA,OAAOA,MAAkB,gBAGzB,OAAS,sBAAAC,MAA0B,6BACnC,OAAS,uBAAAC,EAAqB,4BAAAC,MAAgC,uCAG9D,OAAS,yBAAAC,MAA6B,0BACtC,OAAS,cAAAC,EAAY,4BAAAC,MAAgC,eAO9C,MAAMC,EAAyB,YAO/B,IAAKC,OAEVA,EAAA,gBAAkB,kBAElBA,EAAA,sBAAwB,wBAExBA,EAAA,oBAAsB,sBAEtBA,EAAA,2BAA6B,6BAE7BA,EAAA,gBAAkB,kBAVRA,OAAA,IAqEL,MAAMC,UAA0BT,CAAsC,CA2D3E,YACEU,EACAC,EACAC,EAAsB,GACtBC,EAA0B,IAC1BC,EAAoB,GACpB,CACA,MAAM,EAzDR,KAAS,UAA6C,IAAIT,EAY1D,uBAAoB,IAAIA,EASxB,6BAA0B,IAAIA,EAO9B,sBAAiD,CAAC,EAOlD,0BAAqD,CAAC,EAuBpD,KAAK,YAAcK,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AAK,6BAAwD,CAChE,QAAS,iCAAiC,KAAK,qBAAqB,MAAM,eAAeA,EAAoB,MAAM,GACnH,MAAOA,EAAoB,MAC7B,CAAC,EAEL,CACF,OAASP,EAAY,CACnB,MAAM,IAAI,MAAM,gCAAgC,KAAK,QAAQ,eAAe,SAAS,CAAC,eAAeA,CAAK,EAAE,CAC9G,CACF,CAeA,MAAM,KACJQ,EACAC,EACe,CACf,KAAK,kBAAkB,QAAQ,CAACD,EAAiBC,CAAO,CAAC,CAC3D,CAWA,MAAM,wBAAwBhB,EAAkBI,EAAgE,CAC9G,GAAI,KAAK,kBAAkB,QAAQ,EAAG,OACtC,KAAM,CAACW,EAAiBC,CAAO,EAAI,MAAM,KAAK,kBAAkB,QAAQ,EACxE,OAAOzB,EAAoB,CACzB,YAAa,KAAK,YAClB,OAAQS,EAAQ,eAChB,KAAMe,EACN,QAAS,CAAE,GAAGC,EAAS,sBAAuBZ,EAAgB,sBAAuB,MAAU,CACjG,CAAC,CACH,CASA,MAAM,KAAM,CACV,GAAI,CACF,KAAO,CAAC,KAAK,UAAU,YAAY,GAEjC,MADa,MAAM,KAAK,UAAU,QAAQ,GAC/B,CAEf,OAASG,EAAY,CACnB,MAAM,IAAI,MAAM,yCAAyCA,CAAK,EAAE,CAClE,CACF,CASA,OAAQ,CACN,GAAI,KAAK,QACP,MAAM,IAAI,MAAM,4BAA4B,EAE9C,KAAK,QAAU,GACf,KAAK,UAAU,QAAQ,IAAM,KAAK,sBAAsB,CAAC,EACzD,KAAK,UAAU,QAAQ,IAAM,KAAK,oBAAoB,CAAC,EACvD,KAAK,IAAI,CACX,CASA,MAAO,CACL,GAAI,KAAK,UAAU,YAAY,EAC7B,MAAM,IAAI,MAAM,4BAA4B,EAE9C,KAAK,QAAU,GACf,KAAK,UAAU,OAAO,CACxB,CACF","names":["EventEmitter","waitForTransaction","generateTransaction","signAndSubmitTransaction","AccountSequenceNumber","AsyncQueue","AsyncQueueCancelledError","promiseFulfilledStatus","TransactionWorkerEventsEnum","TransactionWorker","aptosConfig","account","maxWaitTime","maximumInFlight","sleepTime","sequenceNumber","transaction","pendingTransaction","error","awaitingTransactions","sequenceNumbers","sentTransactions","i","sentTransaction","waitFor","executedTransaction","transactionData","options"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { aO as SimpleEntryFunctionArgumentTypes, aP as EntryFunctionArgumentTypes, B as Bool, n as AccountAddress, j as MoveString, F as FixedBytes, U as U8, c as U16, d as U32, f as U64, g as U128, h as U256, aY as InputGenerateTransactionPayloadDataWithRemoteABI, aX as InputGenerateTransactionPayloadData, b4 as InputScriptData, dk as MoveFunction } from '../../account-
|
|
1
|
+
import { aO as SimpleEntryFunctionArgumentTypes, aP as EntryFunctionArgumentTypes, B as Bool, n as AccountAddress, j as MoveString, F as FixedBytes, U as U8, c as U16, d as U32, f as U64, g as U128, h as U256, aY as InputGenerateTransactionPayloadDataWithRemoteABI, aX as InputGenerateTransactionPayloadData, b4 as InputScriptData, dk as MoveFunction } from '../../account-BortO8g2.mjs';
|
|
2
2
|
import '../../types/indexer.mjs';
|
|
3
3
|
import '../../types/generated/operations.mjs';
|
|
4
4
|
import '../../types/generated/types.mjs';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Bool as r,FixedBytes as i,MoveOption as o,MoveString as u,MoveVector as s,U128 as p,U16 as c,U256 as y,U32 as m,U64 as a,U8 as f}from"../../bcs";import{AccountAddress as g}from"../../core";function W(n){return typeof n=="boolean"}function A(n){return typeof n=="string"}function F(n){return typeof n=="number"}function $(n){if(F(n))return n;if(A(n)&&n!=="")return Number.parseInt(n,10)}function L(n){return typeof n=="number"||typeof n=="bigint"||typeof n=="string"}function V(n){return n==null}function j(n){return T(n)||x(n)||S(n)||B(n)||U(n)||b(n)||I(n)||E(n)||l(n)||d(n)||n instanceof s||n instanceof o}function T(n){return n instanceof r}function E(n){return n instanceof g}function l(n){return n instanceof u}function d(n){return n instanceof i}function x(n){return n instanceof f}function S(n){return n instanceof c}function B(n){return n instanceof m}function U(n){return n instanceof a}function b(n){return n instanceof p}function I(n){return n instanceof y}function k(n){return"bytecode"in n}function q(n,t){throw new Error(`Type mismatch for argument ${t}, expected '${n}'`)}function z(n){const t=n.params.findIndex(e=>e!=="signer"&&e!=="&signer");return t<0?n.params.length:t}export{$ as convertNumber,z as findFirstNonSignerArg,E as isBcsAddress,T as isBcsBool,d as isBcsFixedBytes,l as isBcsString,b as isBcsU128,S as isBcsU16,I as isBcsU256,B as isBcsU32,U as isBcsU64,x as isBcsU8,W as isBool,V as isEmptyOption,j as isEncodedEntryFunctionArgument,L as isLargeNumber,F as isNumber,k as isScriptDataInput,A as isString,q as throwTypeMismatch};
|
|
2
2
|
//# sourceMappingURL=helpers.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/transactions/transactionBuilder/helpers.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport {\n EntryFunctionArgumentTypes,\n InputGenerateTransactionPayloadData,\n InputGenerateTransactionPayloadDataWithRemoteABI,\n InputScriptData,\n SimpleEntryFunctionArgumentTypes,\n} from \"../types\";\nimport { Bool, FixedBytes, MoveOption, MoveString, MoveVector, U128, U16, U256, U32, U64, U8 } from \"../../bcs\";\nimport { AccountAddress } from \"../../core\";\nimport { MoveFunction } from \"../../types\";\n\n/**\n * Determines if the provided argument is of type boolean.\n * This can help in validating input types before processing them further.\n *\n * @param arg - The argument to check, which can be of various types.\n * @returns A boolean indicating whether the argument is a boolean.\n * @group Implementation\n * @category Transactions\n */\nexport function isBool(arg: SimpleEntryFunctionArgumentTypes): arg is boolean {\n return typeof arg === \"boolean\";\n}\n\n/**\n * Checks if the provided argument is of type string.\n *\n * @param arg - The value to be checked for string type.\n * @returns A boolean indicating whether the argument is a string.\n * @group Implementation\n * @category Transactions\n */\nexport function isString(arg: any): arg is string {\n return typeof arg === \"string\";\n}\n\n/**\n * Determines if the provided argument is of type number.\n *\n * @param arg - The argument to check, which can be of various types.\n * @returns A boolean indicating whether the argument is a number.\n * @group Implementation\n * @category Transactions\n */\nexport function isNumber(arg: SimpleEntryFunctionArgumentTypes): arg is number {\n return typeof arg === \"number\";\n}\n\n/**\n * Converts a number or a string representation of a number into a number type.\n * This function is useful for ensuring that the input is in a consistent numeric format,\n * which can help prevent type mismatches in further processing.\n *\n * @param arg - The input value to be converted. This can be a number, a string representing a number, or any other type.\n * @returns Returns the converted number if the input is valid; otherwise, it returns undefined.\n * @group Implementation\n * @category Transactions\n */\nexport function convertNumber(arg: SimpleEntryFunctionArgumentTypes): number | undefined {\n if (isNumber(arg)) {\n return arg;\n }\n if (isString(arg) && arg !== \"\") {\n return Number.parseInt(arg, 10);\n }\n\n return undefined;\n}\n\n/**\n * Determines if the provided argument is a large number, which can be a number, bigint, or string representation of a number.\n *\n * @param arg - The argument to check, which can be of type number, bigint, or string.\n * @group Implementation\n * @category Transactions\n */\nexport function isLargeNumber(arg: SimpleEntryFunctionArgumentTypes): arg is number | bigint | string {\n return typeof arg === \"number\" || typeof arg === \"bigint\" || typeof arg === \"string\";\n}\n\n/**\n * Checks if the provided argument is empty, meaning it is either null or undefined.\n *\n * @param arg - The argument to check for emptiness.\n * @returns A boolean indicating whether the argument is empty.\n * @group Implementation\n * @category Transactions\n */\nexport function isEmptyOption(arg: SimpleEntryFunctionArgumentTypes): arg is null | undefined {\n return arg === null || arg === undefined;\n}\n\n/**\n * Determines if the provided argument is a valid encoded entry function argument type.\n * This function helps validate that the argument conforms to the expected types for entry function parameters.\n *\n * @param arg - The argument to check, which can be of type EntryFunctionArgumentTypes or SimpleEntryFunctionArgumentTypes.\n * @group Implementation\n * @category Transactions\n */\nexport function isEncodedEntryFunctionArgument(\n arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes,\n): arg is EntryFunctionArgumentTypes {\n return (\n /**\n * Determines if the provided argument is an instance of the Bool class.\n *\n * @param arg - The argument to check, which can be of type EntryFunctionArgumentTypes or SimpleEntryFunctionArgumentTypes.\n * @group Implementation\n * @category Transactions\n */\n isBcsBool(arg) ||\n /**\n * Determines if the provided argument is an instance of U8.\n * This function helps validate the type of the argument passed to ensure it is a U8 type.\n *\n * @param arg - The argument to be checked, which can be of type EntryFunctionArgumentTypes or SimpleEntryFunctionArgumentTypes.\n * @group Implementation\n * @category Transactions\n */\n isBcsU8(arg) ||\n /**\n * Determines if the provided argument is an instance of U16.\n *\n * @param arg - The argument to check, which can be of type EntryFunctionArgumentTypes or SimpleEntryFunctionArgumentTypes.\n * @group Implementation\n * @category Transactions\n */\n isBcsU16(arg) ||\n /**\n * Determines if the provided argument is an instance of U32.\n *\n * @param arg - The argument to check, which can be of type EntryFunctionArgumentTypes or SimpleEntryFunctionArgumentTypes.\n * @returns A boolean indicating whether the argument is a U32 instance.\n * @group Implementation\n * @category Transactions\n */\n isBcsU32(arg) ||\n /**\n * Determine if the provided argument is an instance of U64.\n * This function helps validate that the argument conforms to the expected U64 type.\n *\n * @param arg - The argument to check, which can be of type EntryFunctionArgumentTypes or SimpleEntryFunctionArgumentTypes.\n * @group Implementation\n * @category Transactions\n */\n isBcsU64(arg) ||\n /**\n * Determines if the provided argument is an instance of U128.\n * This function helps validate the type of the argument passed to ensure it is a U128 type.\n *\n * @param arg - The argument to be checked, which can be of type EntryFunctionArgumentTypes or SimpleEntryFunctionArgumentTypes.\n * @group Implementation\n * @category Transactions\n */\n isBcsU128(arg) ||\n /**\n * Determines if the provided argument is an instance of U256.\n *\n * @param arg - The argument to check, which can be of type EntryFunctionArgumentTypes or SimpleEntryFunctionArgumentTypes.\n * @returns A boolean indicating whether the argument is a U256 instance.\n * @group Implementation\n * @category Transactions\n */\n isBcsU256(arg) ||\n /**\n * Determines if the provided argument is an instance of AccountAddress.\n * This function helps validate whether a given input corresponds to a valid BCS address type.\n *\n * @param arg - The argument to check, which can be of type EntryFunctionArgumentTypes or SimpleEntryFunctionArgumentTypes.\n * @group Implementation\n * @category Transactions\n */\n isBcsAddress(arg) ||\n /**\n * Determine if the provided argument is an instance of MoveString.\n *\n * @param arg - The argument to check, which can be of types EntryFunctionArgumentTypes or SimpleEntryFunctionArgumentTypes.\n * @group Implementation\n * @category Transactions\n */\n isBcsString(arg) ||\n /**\n * Determine if the provided argument is an instance of FixedBytes.\n * This function helps to validate the type of the argument being passed.\n *\n * @param arg - The argument to check, which can be of type EntryFunctionArgumentTypes or SimpleEntryFunctionArgumentTypes.\n * @group Implementation\n * @category Transactions\n */\n isBcsFixedBytes(arg) ||\n arg instanceof MoveVector ||\n arg instanceof MoveOption\n );\n}\n/**\n * @group Implementation\n * @category Transactions\n */\nexport function isBcsBool(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is Bool {\n return arg instanceof Bool;\n}\n/**\n * @group Implementation\n * @category Transactions\n */\nexport function isBcsAddress(\n arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes,\n): arg is AccountAddress {\n return arg instanceof AccountAddress;\n}\n/**\n * @group Implementation\n * @category Transactions\n */\nexport function isBcsString(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is MoveString {\n return arg instanceof MoveString;\n}\n/**\n * @group Implementation\n * @category Transactions\n */\nexport function isBcsFixedBytes(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is FixedBytes {\n return arg instanceof FixedBytes;\n}\n/**\n * @group Implementation\n * @category Transactions\n */\nexport function isBcsU8(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is U8 {\n return arg instanceof U8;\n}\n/**\n * @group Implementation\n * @category Transactions\n */\nexport function isBcsU16(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is U16 {\n return arg instanceof U16;\n}\n/**\n * @group Implementation\n * @category Transactions\n */\nexport function isBcsU32(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is U32 {\n return arg instanceof U32;\n}\n/**\n * @group Implementation\n * @category Transactions\n */\nexport function isBcsU64(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is U64 {\n return arg instanceof U64;\n}\n/**\n * @group Implementation\n * @category Transactions\n */\nexport function isBcsU128(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is U128 {\n return arg instanceof U128;\n}\n/**\n * @group Implementation\n * @category Transactions\n */\nexport function isBcsU256(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is U256 {\n return arg instanceof U256;\n}\n\n/**\n * Determines if the provided argument contains script data input by checking for the presence of bytecode.\n *\n * @param arg - The input data to be checked, which can either be a payload with remote ABI or a standard payload.\n * @param arg.bytecode - The bytecode of the script, present if the input is script data.\n * @param arg.function - The function associated with the transaction, which is relevant for standard payloads.\n * @param arg.args - The arguments for the function, applicable in the context of standard payloads.\n * @group Implementation\n * @category Transactions\n */\nexport function isScriptDataInput(\n arg: InputGenerateTransactionPayloadDataWithRemoteABI | InputGenerateTransactionPayloadData,\n): arg is InputScriptData {\n return \"bytecode\" in arg;\n}\n\n/**\n * Throws an error indicating a type mismatch for a specified argument position.\n * This function helps in debugging by providing clear feedback on expected types.\n *\n * @param expectedType - The type that was expected for the argument.\n * @param position - The position of the argument that caused the type mismatch.\n * @group Implementation\n * @category Transactions\n */\nexport function throwTypeMismatch(expectedType: string, position: number) {\n throw new Error(`Type mismatch for argument ${position}, expected '${expectedType}'`);\n}\n\n/**\n * Finds the index of the first non-signer argument in the function ABI parameters.\n *\n * A function is often defined with a `signer` or `&signer` arguments at the start, which are filled in\n * by signatures and not by the caller. This function helps identify the position of the first argument that\n * can be provided by the caller, allowing for easier handling of function parameters.\n *\n * @param functionAbi - The ABI of the function to analyze.\n * @returns The index of the first non-signer argument, or the length of the parameters array if none are found.\n * @group Implementation\n * @category Transactions\n */\nexport function findFirstNonSignerArg(functionAbi: MoveFunction): number {\n const index = functionAbi.params.findIndex((param) => param !== \"signer\" && param !== \"&signer\");\n if (index < 0) {\n return functionAbi.params.length;\n }\n return index;\n}\n"],"mappings":"AAUA,OAAS,QAAAA,EAAM,cAAAC,EAAY,cAAAC,EAAY,cAAAC,EAAY,cAAAC,EAAY,QAAAC,EAAM,OAAAC,EAAK,QAAAC,EAAM,OAAAC,EAAK,OAAAC,EAAK,MAAAC,MAAU,YACpG,OAAS,kBAAAC,MAAsB,aAYxB,SAASC,EAAOC,EAAuD,CAC5E,OAAO,OAAOA,GAAQ,SACxB,CAUO,SAASC,EAASD,EAAyB,CAChD,OAAO,OAAOA,GAAQ,QACxB,CAUO,SAASE,EAASF,EAAsD,CAC7E,OAAO,OAAOA,GAAQ,QACxB,CAYO,SAASG,EAAcH,EAA2D,CACvF,GAAIE,EAASF,CAAG,EACd,OAAOA,EAET,GAAIC,EAASD,CAAG,GAAKA,IAAQ,GAC3B,OAAO,OAAO,SAASA,EAAK,EAAE,CAIlC,CASO,SAASI,EAAcJ,EAAwE,CACpG,OAAO,OAAOA,GAAQ,UAAY,OAAOA,GAAQ,UAAY,OAAOA,GAAQ,QAC9E,CAUO,SAASK,EAAcL,EAAgE,CAC5F,OAAOA,GAAQ,IACjB,CAUO,SAASM,EACdN,EACmC,CACnC,OAQEO,EAAUP,CAAG,GASbQ,EAAQR,CAAG,GAQXS,EAAST,CAAG,GASZU,EAASV,CAAG,GASZW,EAASX,CAAG,GASZY,EAAUZ,CAAG,GASba,EAAUb,CAAG,GASbc,EAAad,CAAG,GAQhBe,EAAYf,CAAG,GASfgB,EAAgBhB,CAAG,GACnBA,aAAeT,GACfS,aAAeX,CAEnB,CAKO,SAASkB,EAAUP,EAAiF,CACzG,OAAOA,aAAeb,CACxB,CAKO,SAAS2B,EACdd,EACuB,CACvB,OAAOA,aAAeF,CACxB,CAKO,SAASiB,EAAYf,EAAuF,CACjH,OAAOA,aAAeV,CACxB,CAKO,SAAS0B,EAAgBhB,EAAuF,CACrH,OAAOA,aAAeZ,CACxB,CAKO,SAASoB,EAAQR,EAA+E,CACrG,OAAOA,aAAeH,CACxB,CAKO,SAASY,EAAST,EAAgF,CACvG,OAAOA,aAAeP,CACxB,CAKO,SAASiB,EAASV,EAAgF,CACvG,OAAOA,aAAeL,CACxB,CAKO,SAASgB,EAASX,EAAgF,CACvG,OAAOA,aAAeJ,CACxB,CAKO,SAASgB,EAAUZ,EAAiF,CACzG,OAAOA,aAAeR,CACxB,CAKO,SAASqB,EAAUb,EAAiF,CACzG,OAAOA,aAAeN,CACxB,CAYO,SAASuB,EACdjB,EACwB,CACxB,MAAO,aAAcA,CACvB,CAWO,SAASkB,EAAkBC,EAAsBC,EAAkB,CACxE,MAAM,IAAI,MAAM,8BAA8BA,CAAQ,eAAeD,CAAY,GAAG,CACtF,CAcO,SAASE,EAAsBC,EAAmC,CACvE,MAAMC,EAAQD,EAAY,OAAO,UAAWE,GAAUA,IAAU,UAAYA,IAAU,SAAS,EAC/F,OAAID,EAAQ,EACHD,EAAY,OAAO,OAErBC,CACT","names":["Bool","FixedBytes","MoveOption","MoveString","MoveVector","U128","U16","U256","U32","U64","U8","AccountAddress","isBool","arg","isString","isNumber","convertNumber","isLargeNumber","isEmptyOption","isEncodedEntryFunctionArgument","isBcsBool","isBcsU8","isBcsU16","isBcsU32","isBcsU64","isBcsU128","isBcsU256","isBcsAddress","isBcsString","isBcsFixedBytes","isScriptDataInput","throwTypeMismatch","expectedType","position","findFirstNonSignerArg","functionAbi","index","param"]}
|
|
@@ -2,7 +2,7 @@ export { convertNumber, findFirstNonSignerArg, isBcsAddress, isBcsBool, isBcsFix
|
|
|
2
2
|
export { buildTransaction, convertPayloadToInnerPayload, generateRawTransaction, generateSignedTransaction, generateSignedTransactionForSimulation, generateTransactionPayload, generateTransactionPayloadWithABI, generateUserTransactionHash, generateViewFunctionPayload, generateViewFunctionPayloadWithABI, getAuthenticatorForSimulation, hashValues } from './transactionBuilder.mjs';
|
|
3
3
|
export { checkOrConvertArgument, convertArgument, fetchEntryFunctionAbi, fetchFunctionAbi, fetchModuleAbi, fetchMoveFunctionAbi, fetchViewFunctionAbi, standardizeTypeTags } from './remoteAbi.mjs';
|
|
4
4
|
export { deriveTransactionType, generateSigningMessage, generateSigningMessageForSerializable, generateSigningMessageForTransaction } from './signingMessage.mjs';
|
|
5
|
-
import '../../account-
|
|
5
|
+
import '../../account-BortO8g2.mjs';
|
|
6
6
|
import '../../types/indexer.mjs';
|
|
7
7
|
import '../../types/generated/operations.mjs';
|
|
8
8
|
import '../../types/generated/types.mjs';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
export*from"./helpers";export*from"./transactionBuilder";export*from"./remoteAbi";export*from"./signingMessage";
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/transactions/transactionBuilder/index.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nexport * from \"./helpers\";\nexport * from \"./transactionBuilder\";\nexport * from \"./remoteAbi\";\nexport * from \"./signingMessage\";\n"],"mappings":"AAGA,WAAc,YACd,WAAc,uBACd,WAAc,cACd,WAAc","names":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { aR as TypeArgument, av as TypeTag, A as AptosConfig, di as MoveModule, dk as MoveFunction, ba as FunctionABI, bb as EntryFunctionABI, bc as ViewFunctionABI, aP as EntryFunctionArgumentTypes, aO as SimpleEntryFunctionArgumentTypes } from '../../account-
|
|
1
|
+
import { aR as TypeArgument, av as TypeTag, A as AptosConfig, di as MoveModule, dk as MoveFunction, ba as FunctionABI, bb as EntryFunctionABI, bc as ViewFunctionABI, aP as EntryFunctionArgumentTypes, aO as SimpleEntryFunctionArgumentTypes } from '../../account-BortO8g2.mjs';
|
|
2
2
|
import '../../types/indexer.mjs';
|
|
3
3
|
import '../../types/generated/operations.mjs';
|
|
4
4
|
import '../../types/generated/types.mjs';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{parseTypeTag as w}from"../typeTag/parser";import{TypeTagAddress as v,TypeTagBool as E,TypeTagStruct as a,TypeTagU128 as S,TypeTagU16 as F,TypeTagU256 as x,TypeTagU32 as b,TypeTagU64 as I,TypeTagU8 as M}from"../typeTag";import{Bool as d,FixedBytes as A,MoveOption as c,MoveString as C,MoveVector as l,U128 as _,U16 as k,U256 as G,U32 as V,U64 as j,U8 as D}from"../../bcs";import{AccountAddress as U}from"../../core";import{getModule as P}from"../../internal/account";import{findFirstNonSignerArg as L,isBcsAddress as B,isBcsBool as O,isBcsString as R,isBcsU128 as z,isBcsU16 as J,isBcsU256 as K,isBcsU32 as W,isBcsU64 as X,isBcsU8 as q,isBool as H,isEncodedEntryFunctionArgument as Q,isLargeNumber as g,isEmptyOption as Y,isString as y,throwTypeMismatch as o,convertNumber as p}from"./helpers";const Z=new TextEncoder;function Bn(n){return n?.map(e=>y(e)?w(e):e)??[]}async function N(n,e,t){return(await P({aptosConfig:t,accountAddress:n,moduleName:e})).abi}async function h(n,e,t,u){const r=await N(n,e,u);if(!r)throw new Error(`Could not find module ABI for '${n}::${e}'`);return r.exposed_functions.find(f=>f.name===t)}async function $n(n,e,t,u){const r=await h(n,e,t,u);if(!r)throw new Error(`Could not find function ABI for '${n}::${e}::${t}'`);const f=[];for(let i=0;i<r.params.length;i+=1)f.push(w(r.params[i],{allowGenerics:!0}));return{typeParameters:r.generic_type_params,parameters:f}}async function vn(n,e,t,u){const r=await h(n,e,t,u);if(!r)throw new Error(`Could not find entry function ABI for '${n}::${e}::${t}'`);if(!r.is_entry)throw new Error(`'${n}::${e}::${t}' is not an entry function`);const f=L(r),i=[];for(let s=f;s<r.params.length;s+=1)i.push(w(r.params[s],{allowGenerics:!0}));return{signers:f,typeParameters:r.generic_type_params,parameters:i}}async function En(n,e,t,u){const r=await h(n,e,t,u);if(!r)throw new Error(`Could not find view function ABI for '${n}::${e}::${t}'`);if(!r.is_view)throw new Error(`'${n}::${e}::${t}' is not an view function`);const f=[];for(let s=0;s<r.params.length;s+=1)f.push(w(r.params[s],{allowGenerics:!0}));const i=[];for(let s=0;s<r.return.length;s+=1)i.push(w(r.return[s],{allowGenerics:!0}));return{typeParameters:r.generic_type_params,parameters:f,returnTypes:i}}function an(n,e,t,u,r,f){let i;if("exposed_functions"in e){const s=e.exposed_functions.find($=>$.name===n);if(!s)throw new Error(`Could not find function ABI for '${e.address}::${e.name}::${n}'`);if(u>=s.params.length)throw new Error(`Too many arguments for '${n}', expected ${s.params.length}`);i=w(s.params[u],{allowGenerics:!0})}else{if(u>=e.parameters.length)throw new Error(`Too many arguments for '${n}', expected ${e.parameters.length}`);i=e.parameters[u]}return T(t,i,u,r,"exposed_functions"in e?e:void 0,f)}function T(n,e,t,u,r,f){return Q(n)?(m(e,n,t),n):nn(n,e,t,u,r,f)}function nn(n,e,t,u,r,f){if(e.isBool()){if(H(n))return new d(n);if(y(n)){if(n==="true")return new d(!0);if(n==="false")return new d(!1)}o("boolean",t)}if(e.isAddress()){if(y(n))return U.fromString(n);if(n&&typeof n=="object"&&"data"in n&&n.data instanceof Uint8Array)return new U(n.data);o("string | AccountAddress",t)}if(e.isU8()){const i=p(n);if(i!==void 0)return new D(i);o("number | string",t)}if(e.isU16()){const i=p(n);if(i!==void 0)return new k(i);o("number | string",t)}if(e.isU32()){const i=p(n);if(i!==void 0)return new V(i);o("number | string",t)}if(e.isU64()){if(g(n))return new j(BigInt(n));o("bigint | number | string",t)}if(e.isU128()){if(g(n))return new _(BigInt(n));o("bigint | number | string",t)}if(e.isU256()){if(g(n))return new G(BigInt(n));o("bigint | number | string",t)}if(e.isGeneric()){const i=e.value;if(i<0||i>=u.length)throw new Error(`Generic argument ${e.toString()} is invalid for argument ${t}`);return T(n,u[i],t,u,r)}if(e.isVector()){if(e.value.isU8()){if(y(n))return l.U8(Z.encode(n));if(n instanceof Uint8Array)return l.U8(n);if(n instanceof ArrayBuffer)return l.U8(new Uint8Array(n))}if(y(n)&&n.startsWith("["))return T(JSON.parse(n),e,t,u);if(Array.isArray(n))return new l(n.map(i=>T(i,e.value,t,u,r)));throw new Error(`Type mismatch for argument ${t}, type '${e.toString()}'`)}if(e.isStruct()){if(e.isString()){if(y(n))return new C(n);o("string",t)}if(e.isObject()){if(y(n))return U.fromString(n);if(n&&typeof n=="object"&&"data"in n&&n.data instanceof Uint8Array)return new U(n.data);o("string | AccountAddress",t)}if(e.isDelegationKey()||e.isRateLimiter()){if(n instanceof Uint8Array)return new A(n);o("Uint8Array",t)}if(e.isOption()){if(Y(n)){const s=e.value.typeArgs[0];return s instanceof E?new c(null):s instanceof v?new c(null):s instanceof M?new c(null):s instanceof F?new c(null):s instanceof b?new c(null):s instanceof I?new c(null):s instanceof S?new c(null):s instanceof x?new c(null):new c(null)}return new c(T(n,e.value.typeArgs[0],t,u,r))}if(r?.structs.find(s=>s.name===e.value.name.identifier)?.fields.length===0&&n instanceof Uint8Array)return new A(n);if(n instanceof Uint8Array&&f?.allowUnknownStructs)return console.warn(`Unsupported struct input type for argument ${t}. Continuing since 'allowUnknownStructs' is enabled.`),new A(n);throw new Error(`Unsupported struct input type for argument ${t}, type '${e.toString()}'`)}throw new Error(`Type mismatch for argument ${t}, type '${e.toString()}'`)}function m(n,e,t){if(n.isBool()){if(O(e))return;o("Bool",t)}if(n.isAddress()){if(B(e))return;o("AccountAddress",t)}if(n.isU8()){if(q(e))return;o("U8",t)}if(n.isU16()){if(J(e))return;o("U16",t)}if(n.isU32()){if(W(e))return;o("U32",t)}if(n.isU64()){if(X(e))return;o("U64",t)}if(n.isU128()){if(z(e))return;o("U128",t)}if(n.isU256()){if(K(e))return;o("U256",t)}if(n.isVector()){if(e instanceof l){e.values.length>0&&m(n.value,e.values[0],t);return}o("MoveVector",t)}if(n instanceof a){if(n.isString()){if(R(e))return;o("MoveString",t)}if(n.isObject()){if(B(e))return;o("AccountAddress",t)}if(n.isOption()){if(e instanceof c){e.value!==void 0&&m(n.value.typeArgs[0],e.value,t);return}o("MoveOption",t)}}throw new Error(`Type mismatch for argument ${t}, expected '${n.toString()}'`)}export{T as checkOrConvertArgument,an as convertArgument,vn as fetchEntryFunctionAbi,h as fetchFunctionAbi,N as fetchModuleAbi,$n as fetchMoveFunctionAbi,En as fetchViewFunctionAbi,Bn as standardizeTypeTags};
|
|
2
2
|
//# sourceMappingURL=remoteAbi.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/transactions/transactionBuilder/remoteAbi.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { parseTypeTag } from \"../typeTag/parser\";\nimport {\n TypeTag,\n TypeTagAddress,\n TypeTagBool,\n TypeTagStruct,\n TypeTagU128,\n TypeTagU16,\n TypeTagU256,\n TypeTagU32,\n TypeTagU64,\n TypeTagU8,\n} from \"../typeTag\";\nimport { AptosConfig } from \"../../api/aptosConfig\";\nimport {\n EntryFunctionArgumentTypes,\n SimpleEntryFunctionArgumentTypes,\n EntryFunctionABI,\n ViewFunctionABI,\n FunctionABI,\n TypeArgument,\n} from \"../types\";\nimport { Bool, FixedBytes, MoveOption, MoveString, MoveVector, U128, U16, U256, U32, U64, U8 } from \"../../bcs\";\nimport { AccountAddress } from \"../../core\";\nimport { getModule } from \"../../internal/account\";\nimport {\n findFirstNonSignerArg,\n isBcsAddress,\n isBcsBool,\n isBcsString,\n isBcsU128,\n isBcsU16,\n isBcsU256,\n isBcsU32,\n isBcsU64,\n isBcsU8,\n isBool,\n isEncodedEntryFunctionArgument,\n isLargeNumber,\n isEmptyOption,\n isString,\n throwTypeMismatch,\n convertNumber,\n} from \"./helpers\";\nimport { MoveFunction, MoveModule } from \"../../types\";\n\nconst TEXT_ENCODER = new TextEncoder();\n\n/**\n * Convert type arguments to only type tags, allowing for string representations of type tags.\n *\n * @param typeArguments - An optional array of type arguments that may include string representations.\n * @returns An array of TypeTag objects derived from the provided type arguments.\n * @group Implementation\n * @category Transactions\n */\nexport function standardizeTypeTags(typeArguments?: Array<TypeArgument>): Array<TypeTag> {\n return (\n typeArguments?.map((typeArg: TypeArgument): TypeTag => {\n // Convert to TypeTag if it's a string representation\n if (isString(typeArg)) {\n return parseTypeTag(typeArg);\n }\n return typeArg;\n }) ?? []\n );\n}\n\n/**\n * Fetches the ABI of a specified module from the on-chain module ABI.\n *\n * @param moduleAddress - The address of the module from which to fetch the ABI.\n * @param moduleName - The name of the module containing the ABI.\n * @param aptosConfig - The configuration settings for Aptos.\n * @group Implementation\n * @category Transactions\n */\nexport async function fetchModuleAbi(\n moduleAddress: string,\n moduleName: string,\n aptosConfig: AptosConfig,\n): Promise<MoveModule | undefined> {\n const moduleBytecode = await getModule({ aptosConfig, accountAddress: moduleAddress, moduleName });\n return moduleBytecode.abi;\n}\n\n/**\n * Fetches the ABI of a specified function from the on-chain module ABI. This function allows you to access the details of a\n * specific function within a module.\n *\n * @param moduleAddress - The address of the module from which to fetch the function ABI.\n * @param moduleName - The name of the module containing the function.\n * @param functionName - The name of the function whose ABI is to be fetched.\n * @param aptosConfig - The configuration settings for Aptos.\n * @group Implementation\n * @category Transactions\n */\nexport async function fetchFunctionAbi(\n moduleAddress: string,\n moduleName: string,\n functionName: string,\n aptosConfig: AptosConfig,\n): Promise<MoveFunction | undefined> {\n const moduleAbi = await fetchModuleAbi(moduleAddress, moduleName, aptosConfig);\n if (!moduleAbi) throw new Error(`Could not find module ABI for '${moduleAddress}::${moduleName}'`);\n return moduleAbi.exposed_functions.find((func) => func.name === functionName);\n}\n\n/**\n * @deprecated Use `fetchFunctionAbi` instead and manually parse the type tags.\n */\nexport async function fetchMoveFunctionAbi(\n moduleAddress: string,\n moduleName: string,\n functionName: string,\n aptosConfig: AptosConfig,\n): Promise<FunctionABI> {\n const functionAbi = await fetchFunctionAbi(moduleAddress, moduleName, functionName, aptosConfig);\n if (!functionAbi) {\n throw new Error(`Could not find function ABI for '${moduleAddress}::${moduleName}::${functionName}'`);\n }\n const params: TypeTag[] = [];\n for (let i = 0; i < functionAbi.params.length; i += 1) {\n params.push(parseTypeTag(functionAbi.params[i], { allowGenerics: true }));\n }\n\n return {\n typeParameters: functionAbi.generic_type_params,\n parameters: params,\n };\n}\n\n/**\n * Fetches the ABI for an entry function from the specified module address.\n * This function validates if the ABI corresponds to an entry function and retrieves its parameters.\n *\n * @param moduleAddress - The address of the module containing the entry function.\n * @param moduleName - The name of the module containing the entry function.\n * @param functionName - The name of the entry function to fetch the ABI for.\n * @param aptosConfig - The configuration settings for Aptos.\n * @returns An object containing the number of signers, type parameters, and function parameters.\n * @throws Error if the ABI cannot be found or if the function is not an entry function.\n * @group Implementation\n * @category Transactions\n */\nexport async function fetchEntryFunctionAbi(\n moduleAddress: string,\n moduleName: string,\n functionName: string,\n aptosConfig: AptosConfig,\n): Promise<EntryFunctionABI> {\n const functionAbi = await fetchFunctionAbi(moduleAddress, moduleName, functionName, aptosConfig);\n\n // If there's no ABI, then the function is invalid\n if (!functionAbi) {\n throw new Error(`Could not find entry function ABI for '${moduleAddress}::${moduleName}::${functionName}'`);\n }\n\n // Non-entry functions also can't be used\n if (!functionAbi.is_entry) {\n throw new Error(`'${moduleAddress}::${moduleName}::${functionName}' is not an entry function`);\n }\n\n // Remove the signer arguments\n const numSigners = findFirstNonSignerArg(functionAbi);\n const params: TypeTag[] = [];\n for (let i = numSigners; i < functionAbi.params.length; i += 1) {\n params.push(parseTypeTag(functionAbi.params[i], { allowGenerics: true }));\n }\n\n return {\n signers: numSigners,\n typeParameters: functionAbi.generic_type_params,\n parameters: params,\n };\n}\n\n/**\n * Fetches the ABI for a view function from the specified module address.\n * This function ensures that the ABI is valid and retrieves the type parameters, parameters, and return types for the view function.\n *\n * @param moduleAddress - The address of the module containing the view function.\n * @param moduleName - The name of the module containing the view function.\n * @param functionName - The name of the view function for which to fetch the ABI.\n * @param aptosConfig - The configuration settings for Aptos.\n * @returns An object containing the type parameters, parameters, and return types of the view function.\n * @throws Error if the ABI cannot be found or if the function is not a view function.\n * @group Implementation\n * @category Transactions\n */\nexport async function fetchViewFunctionAbi(\n moduleAddress: string,\n moduleName: string,\n functionName: string,\n aptosConfig: AptosConfig,\n): Promise<ViewFunctionABI> {\n const functionAbi = await fetchFunctionAbi(moduleAddress, moduleName, functionName, aptosConfig);\n\n // If there's no ABI, then the function is invalid\n if (!functionAbi) {\n throw new Error(`Could not find view function ABI for '${moduleAddress}::${moduleName}::${functionName}'`);\n }\n\n // Non-view functions can't be used\n if (!functionAbi.is_view) {\n throw new Error(`'${moduleAddress}::${moduleName}::${functionName}' is not an view function`);\n }\n\n // Type tag parameters for the function\n const params: TypeTag[] = [];\n for (let i = 0; i < functionAbi.params.length; i += 1) {\n params.push(parseTypeTag(functionAbi.params[i], { allowGenerics: true }));\n }\n\n // The return types of the view function\n const returnTypes: TypeTag[] = [];\n for (let i = 0; i < functionAbi.return.length; i += 1) {\n returnTypes.push(parseTypeTag(functionAbi.return[i], { allowGenerics: true }));\n }\n\n return {\n typeParameters: functionAbi.generic_type_params,\n parameters: params,\n returnTypes,\n };\n}\n\n/**\n * Converts a non-BCS encoded argument into BCS encoded, if necessary.\n * This function checks the provided argument against the expected parameter type and converts it accordingly.\n *\n * @param functionName - The name of the function for which the argument is being converted.\n * @param functionAbiOrModuleAbi - The ABI (Application Binary Interface) of the function, which defines its parameters.\n * @param arg - The argument to be converted, which can be of various types.\n * @param position - The index of the argument in the function's parameter list.\n * @param genericTypeParams - An array of type tags for any generic type parameters.\n * @param options - Options for the conversion process.\n * @param options.allowUnknownStructs - If true, unknown structs will be allowed and converted to a `FixedBytes`.\n * @group Implementation\n * @category Transactions\n */\nexport function convertArgument(\n functionName: string,\n functionAbiOrModuleAbi: MoveModule | FunctionABI,\n arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes,\n position: number,\n genericTypeParams: Array<TypeTag>,\n options?: { allowUnknownStructs?: boolean },\n) {\n let param: TypeTag;\n\n if (\"exposed_functions\" in functionAbiOrModuleAbi) {\n const functionAbi = functionAbiOrModuleAbi.exposed_functions.find((func) => func.name === functionName);\n if (!functionAbi) {\n throw new Error(\n `Could not find function ABI for '${functionAbiOrModuleAbi.address}::${functionAbiOrModuleAbi.name}::${functionName}'`,\n );\n }\n\n if (position >= functionAbi.params.length) {\n throw new Error(`Too many arguments for '${functionName}', expected ${functionAbi.params.length}`);\n }\n\n param = parseTypeTag(functionAbi.params[position], { allowGenerics: true });\n } else {\n if (position >= functionAbiOrModuleAbi.parameters.length) {\n throw new Error(`Too many arguments for '${functionName}', expected ${functionAbiOrModuleAbi.parameters.length}`);\n }\n\n param = functionAbiOrModuleAbi.parameters[position];\n }\n\n return checkOrConvertArgument(\n arg,\n param,\n position,\n genericTypeParams,\n \"exposed_functions\" in functionAbiOrModuleAbi ? functionAbiOrModuleAbi : undefined,\n options,\n );\n}\n\n/**\n * Checks if the provided argument is BCS encoded and converts it if necessary, ensuring type compatibility with the ABI.\n * This function helps in validating and converting arguments for entry functions based on their expected types.\n *\n * @param arg - The argument to check or convert, which can be either a simple or entry function argument type.\n * @param param - The expected type tag for the argument.\n * @param position - The position of the argument in the function call.\n * @param genericTypeParams - An array of generic type parameters that may be used for conversion.\n * @group Implementation\n * @category Transactions\n */\nexport function checkOrConvertArgument(\n arg: SimpleEntryFunctionArgumentTypes | EntryFunctionArgumentTypes,\n param: TypeTag,\n position: number,\n genericTypeParams: Array<TypeTag>,\n moduleAbi?: MoveModule,\n options?: { allowUnknownStructs?: boolean },\n) {\n // If the argument is bcs encoded, we can just use it directly\n if (isEncodedEntryFunctionArgument(arg)) {\n // Ensure the type matches the ABI\n\n /**\n * Checks the type of the provided argument against the expected type.\n * This function helps validate that the argument conforms to the specified type requirements.\n *\n * @param typeArgs - The expected type arguments.\n * @param arg - The argument to be checked.\n * @param position - The position of the argument in the context of the check.\n * @param moduleAbi - The ABI of the module containing the function, used for type checking.\n * This will typically have information about structs, enums, and other types.\n * @group Implementation\n * @category Transactions\n */\n checkType(param, arg, position);\n return arg;\n }\n\n // If it is not BCS encoded, we will need to convert it with the ABI\n return parseArg(arg, param, position, genericTypeParams, moduleAbi, options);\n}\n\n/**\n * Parses a non-BCS encoded argument into a BCS encoded argument recursively.\n * This function helps convert various types of input arguments into their corresponding BCS encoded formats based on the\n * specified parameter type.\n *\n * @param arg - The argument to be parsed, which can be of various types.\n * @param param - The type tag that defines the expected type of the argument.\n * @param position - The position of the argument in the function call, used for error reporting.\n * @param genericTypeParams - An array of type tags for generic type parameters, used when the parameter type is generic.\n * @param moduleAbi - The ABI of the module containing the function, used for type checking.\n * This will typically have information about structs, enums, and other types.\n * @param options - Options for the conversion process.\n * @param options.allowUnknownStructs - If true, unknown structs will be allowed and converted to a `FixedBytes`.\n * @group Implementation\n * @category Transactions\n */\nfunction parseArg(\n arg: SimpleEntryFunctionArgumentTypes,\n param: TypeTag,\n position: number,\n genericTypeParams: Array<TypeTag>,\n moduleAbi?: MoveModule,\n options?: { allowUnknownStructs?: boolean },\n): EntryFunctionArgumentTypes {\n if (param.isBool()) {\n if (isBool(arg)) {\n return new Bool(arg);\n }\n if (isString(arg)) {\n if (arg === \"true\") return new Bool(true);\n if (arg === \"false\") return new Bool(false);\n }\n\n /**\n * Throws a type mismatch error for the specified move option.\n *\n * @param moveOption - The name of the move option that caused the type mismatch.\n * @param position - The position where the error occurred.\n * @group Implementation\n * @category Transactions\n */\n throwTypeMismatch(\"boolean\", position);\n }\n if (param.isAddress()) {\n if (isString(arg)) {\n return AccountAddress.fromString(arg);\n }\n // Support for Uint8Array coming from external sources\n // Usually, dapps will be getting the account address as a Uint8Array from the wallet (following\n // the wallet standard).\n if (arg && typeof arg === \"object\" && \"data\" in arg && arg.data instanceof Uint8Array) {\n return new AccountAddress(arg.data);\n }\n throwTypeMismatch(\"string | AccountAddress\", position);\n }\n if (param.isU8()) {\n const num = convertNumber(arg);\n if (num !== undefined) {\n return new U8(num);\n }\n throwTypeMismatch(\"number | string\", position);\n }\n if (param.isU16()) {\n const num = convertNumber(arg);\n if (num !== undefined) {\n return new U16(num);\n }\n throwTypeMismatch(\"number | string\", position);\n }\n if (param.isU32()) {\n const num = convertNumber(arg);\n if (num !== undefined) {\n return new U32(num);\n }\n throwTypeMismatch(\"number | string\", position);\n }\n if (param.isU64()) {\n if (isLargeNumber(arg)) {\n return new U64(BigInt(arg));\n }\n throwTypeMismatch(\"bigint | number | string\", position);\n }\n if (param.isU128()) {\n if (isLargeNumber(arg)) {\n return new U128(BigInt(arg));\n }\n throwTypeMismatch(\"bigint | number | string\", position);\n }\n if (param.isU256()) {\n if (isLargeNumber(arg)) {\n return new U256(BigInt(arg));\n }\n throwTypeMismatch(\"bigint | number | string\", position);\n }\n\n // Generic needs to use the subtype\n if (param.isGeneric()) {\n const genericIndex = param.value;\n if (genericIndex < 0 || genericIndex >= genericTypeParams.length) {\n throw new Error(`Generic argument ${param.toString()} is invalid for argument ${position}`);\n }\n\n return checkOrConvertArgument(arg, genericTypeParams[genericIndex], position, genericTypeParams, moduleAbi);\n }\n\n // We have to special case some vectors for Vector<u8>\n if (param.isVector()) {\n // Check special case for Vector<u8>\n if (param.value.isU8()) {\n // We don't allow vector<u8>, but we convert strings to UTF8 Uint8Array\n // This is legacy behavior from the original SDK\n if (isString(arg)) {\n return MoveVector.U8(TEXT_ENCODER.encode(arg));\n }\n if (arg instanceof Uint8Array) {\n return MoveVector.U8(arg);\n }\n if (arg instanceof ArrayBuffer) {\n return MoveVector.U8(new Uint8Array(arg));\n }\n }\n\n if (isString(arg)) {\n // In a web env, arguments are passing as strings\n if (arg.startsWith(\"[\")) {\n return checkOrConvertArgument(JSON.parse(arg), param, position, genericTypeParams);\n }\n }\n\n // TODO: Support Uint16Array, Uint32Array, BigUint64Array?\n\n if (Array.isArray(arg)) {\n return new MoveVector(\n arg.map((item) => checkOrConvertArgument(item, param.value, position, genericTypeParams, moduleAbi)),\n );\n }\n\n throw new Error(`Type mismatch for argument ${position}, type '${param.toString()}'`);\n }\n\n // Handle structs as they're more complex\n if (param.isStruct()) {\n if (param.isString()) {\n if (isString(arg)) {\n return new MoveString(arg);\n }\n throwTypeMismatch(\"string\", position);\n }\n if (param.isObject()) {\n // The inner type of Object doesn't matter, since it's just syntactic sugar\n if (isString(arg)) {\n return AccountAddress.fromString(arg);\n }\n // Support for Uint8Array coming from external sources\n if (arg && typeof arg === \"object\" && \"data\" in arg && arg.data instanceof Uint8Array) {\n return new AccountAddress(arg.data);\n }\n throwTypeMismatch(\"string | AccountAddress\", position);\n }\n // Handle known enum types from Aptos framework\n if (param.isDelegationKey() || param.isRateLimiter()) {\n if (arg instanceof Uint8Array) {\n return new FixedBytes(arg);\n }\n throwTypeMismatch(\"Uint8Array\", position);\n }\n\n if (param.isOption()) {\n if (isEmptyOption(arg)) {\n // Here we attempt to reconstruct the underlying type\n // Note, for some reason the `isBool` etc. does not work with the compiler\n const innerParam = param.value.typeArgs[0];\n if (innerParam instanceof TypeTagBool) {\n return new MoveOption<Bool>(null);\n }\n if (innerParam instanceof TypeTagAddress) {\n return new MoveOption<AccountAddress>(null);\n }\n if (innerParam instanceof TypeTagU8) {\n return new MoveOption<U8>(null);\n }\n if (innerParam instanceof TypeTagU16) {\n return new MoveOption<U16>(null);\n }\n if (innerParam instanceof TypeTagU32) {\n return new MoveOption<U32>(null);\n }\n if (innerParam instanceof TypeTagU64) {\n return new MoveOption<U64>(null);\n }\n if (innerParam instanceof TypeTagU128) {\n return new MoveOption<U128>(null);\n }\n if (innerParam instanceof TypeTagU256) {\n return new MoveOption<U256>(null);\n }\n\n // In all other cases, we will use a placeholder, it doesn't actually matter what the type is, but it will be obvious\n // Note: This is a placeholder U8 type, and does not match the actual type, as that can't be dynamically grabbed\n return new MoveOption<MoveString>(null);\n }\n\n return new MoveOption(\n checkOrConvertArgument(arg, param.value.typeArgs[0], position, genericTypeParams, moduleAbi),\n );\n }\n\n // We are assuming that fieldless structs are enums, and therefore we cannot typecheck any further due\n // to limited information from the ABI. This does not work for structs on other modules.\n const structDefinition = moduleAbi?.structs.find((s) => s.name === param.value.name.identifier);\n if (structDefinition?.fields.length === 0 && arg instanceof Uint8Array) {\n return new FixedBytes(arg);\n }\n\n if (arg instanceof Uint8Array && options?.allowUnknownStructs) {\n // eslint-disable-next-line no-console\n console.warn(\n // eslint-disable-next-line max-len\n `Unsupported struct input type for argument ${position}. Continuing since 'allowUnknownStructs' is enabled.`,\n );\n return new FixedBytes(arg);\n }\n\n throw new Error(`Unsupported struct input type for argument ${position}, type '${param.toString()}'`);\n }\n\n throw new Error(`Type mismatch for argument ${position}, type '${param.toString()}'`);\n}\n\n/**\n * Checks that the type of the BCS encoded argument matches the ABI\n * @param param\n * @param arg\n * @param position\n * @group Implementation\n * @category Transactions\n */\nfunction checkType(param: TypeTag, arg: EntryFunctionArgumentTypes, position: number) {\n if (param.isBool()) {\n if (isBcsBool(arg)) {\n return;\n }\n throwTypeMismatch(\"Bool\", position);\n }\n if (param.isAddress()) {\n if (isBcsAddress(arg)) {\n return;\n }\n throwTypeMismatch(\"AccountAddress\", position);\n }\n if (param.isU8()) {\n if (isBcsU8(arg)) {\n return;\n }\n throwTypeMismatch(\"U8\", position);\n }\n if (param.isU16()) {\n if (isBcsU16(arg)) {\n return;\n }\n throwTypeMismatch(\"U16\", position);\n }\n if (param.isU32()) {\n if (isBcsU32(arg)) {\n return;\n }\n throwTypeMismatch(\"U32\", position);\n }\n if (param.isU64()) {\n if (isBcsU64(arg)) {\n return;\n }\n throwTypeMismatch(\"U64\", position);\n }\n if (param.isU128()) {\n if (isBcsU128(arg)) {\n return;\n }\n throwTypeMismatch(\"U128\", position);\n }\n if (param.isU256()) {\n if (isBcsU256(arg)) {\n return;\n }\n throwTypeMismatch(\"U256\", position);\n }\n if (param.isVector()) {\n if (arg instanceof MoveVector) {\n // If there's anything in it, check that the inner types match\n // Note that since it's typed, the first item should be the same as the rest\n if (arg.values.length > 0) {\n checkType(param.value, arg.values[0], position);\n }\n\n return;\n }\n throwTypeMismatch(\"MoveVector\", position);\n }\n\n // Handle structs as they're more complex\n if (param instanceof TypeTagStruct) {\n if (param.isString()) {\n if (isBcsString(arg)) {\n return;\n }\n throwTypeMismatch(\"MoveString\", position);\n }\n if (param.isObject()) {\n if (isBcsAddress(arg)) {\n return;\n }\n throwTypeMismatch(\"AccountAddress\", position);\n }\n if (param.isOption()) {\n if (arg instanceof MoveOption) {\n // If there's a value, we can check the inner type (otherwise it doesn't really matter)\n if (arg.value !== undefined) {\n checkType(param.value.typeArgs[0], arg.value, position);\n }\n return;\n }\n throwTypeMismatch(\"MoveOption\", position);\n }\n }\n\n throw new Error(`Type mismatch for argument ${position}, expected '${param.toString()}'`);\n}\n"],"mappings":"AAGA,OAAS,gBAAAA,MAAoB,oBAC7B,OAEE,kBAAAC,EACA,eAAAC,EACA,iBAAAC,EACA,eAAAC,EACA,cAAAC,EACA,eAAAC,EACA,cAAAC,EACA,cAAAC,EACA,aAAAC,MACK,aAUP,OAAS,QAAAC,EAAM,cAAAC,EAAY,cAAAC,EAAY,cAAAC,EAAY,cAAAC,EAAY,QAAAC,EAAM,OAAAC,EAAK,QAAAC,EAAM,OAAAC,EAAK,OAAAC,EAAK,MAAAC,MAAU,YACpG,OAAS,kBAAAC,MAAsB,aAC/B,OAAS,aAAAC,MAAiB,yBAC1B,OACE,yBAAAC,EACA,gBAAAC,EACA,aAAAC,EACA,eAAAC,EACA,aAAAC,EACA,YAAAC,EACA,aAAAC,EACA,YAAAC,EACA,YAAAC,EACA,WAAAC,EACA,UAAAC,EACA,kCAAAC,EACA,iBAAAC,EACA,iBAAAC,EACA,YAAAC,EACA,qBAAAC,EACA,iBAAAC,MACK,YAGP,MAAMC,EAAe,IAAI,YAUlB,SAASC,GAAoBC,EAAqD,CACvF,OACEA,GAAe,IAAKC,GAEdN,EAASM,CAAO,EACX3C,EAAa2C,CAAO,E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ypeTagU32","TypeTagU64","TypeTagU8","Bool","FixedBytes","MoveOption","MoveString","MoveVector","U128","U16","U256","U32","U64","U8","AccountAddress","getModule","findFirstNonSignerArg","isBcsAddress","isBcsBool","isBcsString","isBcsU128","isBcsU16","isBcsU256","isBcsU32","isBcsU64","isBcsU8","isBool","isEncodedEntryFunctionArgument","isLargeNumber","isEmptyOption","isString","throwTypeMismatch","convertNumber","TEXT_ENCODER","standardizeTypeTags","typeArguments","typeArg","fetchModuleAbi","moduleAddress","moduleName","aptosConfig","fetchFunctionAbi","functionName","moduleAbi","func","fetchMoveFunctionAbi","functionAbi","params","fetchEntryFunctionAbi","numSigners","i","fetchViewFunctionAbi","returnTypes","convertArgument","functionAbiOrModuleAbi","arg","position","genericTypeParams","options","param","checkOrConvertArgument","checkType","parseArg","num","genericIndex","item","innerParam"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { bg as AnyRawTransaction, aS as AnyRawTransactionInstance, S as Serializable } from '../../account-
|
|
1
|
+
import { bg as AnyRawTransaction, aS as AnyRawTransactionInstance, S as Serializable } from '../../account-BortO8g2.mjs';
|
|
2
2
|
import '../../types/indexer.mjs';
|
|
3
3
|
import '../../types/generated/operations.mjs';
|
|
4
4
|
import '../../types/generated/types.mjs';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{sha3_256 as A}from"@noble/hashes/sha3";import{RAW_TRANSACTION_SALT as T,RAW_TRANSACTION_WITH_DATA_SALT as o}from"../../utils/const";import{FeePayerRawTransaction as c,MultiAgentRawTransaction as y}from"../instances";function d(e){return e.feePayerAddress?new c(e.rawTransaction,e.secondarySignerAddresses??[],e.feePayerAddress):e.secondarySignerAddresses?new y(e.rawTransaction,e.secondarySignerAddresses):e.rawTransaction}function n(e,r){const a=A.create();if(!r.startsWith("APTOS::"))throw new Error(`Domain separator needs to start with 'APTOS::'. Provided - ${r}`);a.update(r);const s=a.digest(),i=e,t=new Uint8Array(s.length+i.length);return t.set(s),t.set(i,s.length),t}function R(e){return n(e.bcsToBytes(),`APTOS::${e.constructor.name}`)}function l(e){const r=d(e);return e.feePayerAddress?n(r.bcsToBytes(),o):e.secondarySignerAddresses?n(r.bcsToBytes(),o):n(r.bcsToBytes(),T)}export{d as deriveTransactionType,n as generateSigningMessage,R as generateSigningMessageForSerializable,l as generateSigningMessageForTransaction};
|
|
2
2
|
//# sourceMappingURL=signingMessage.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/transactions/transactionBuilder/signingMessage.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * This file handles the generation of the signing message.\n * @group Implementation\n * @category Transactions\n */\nimport { sha3_256 as sha3Hash } from \"@noble/hashes/sha3\";\nimport { RAW_TRANSACTION_SALT, RAW_TRANSACTION_WITH_DATA_SALT } from \"../../utils/const\";\nimport { FeePayerRawTransaction, MultiAgentRawTransaction } from \"../instances\";\nimport { AnyRawTransaction, AnyRawTransactionInstance } from \"../types\";\nimport { Serializable } from \"../../bcs\";\n\n/**\n * Derives the appropriate raw transaction type based on the provided transaction details.\n * This function helps in identifying whether the transaction is a FeePayerRawTransaction,\n * MultiAgentRawTransaction, or a standard RawTransaction.\n *\n * @param transaction - An object representing an Aptos transaction, which may include:\n * - feePayerAddress - The address of the fee payer (optional).\n * - secondarySignerAddresses - An array of secondary signer addresses (optional).\n * - rawTransaction - The raw transaction data.\n *\n * @returns FeePayerRawTransaction | MultiAgentRawTransaction | RawTransaction\n * @group Implementation\n * @category Transactions\n */\nexport function deriveTransactionType(transaction: AnyRawTransaction): AnyRawTransactionInstance {\n if (transaction.feePayerAddress) {\n return new FeePayerRawTransaction(\n transaction.rawTransaction,\n transaction.secondarySignerAddresses ?? [],\n transaction.feePayerAddress,\n );\n }\n if (transaction.secondarySignerAddresses) {\n return new MultiAgentRawTransaction(transaction.rawTransaction, transaction.secondarySignerAddresses);\n }\n\n return transaction.rawTransaction;\n}\n\n/**\n * Generates the 'signing message' form of a message to be signed.\n * This function combines a domain separator with the byte representation of the message to create a signing message.\n *\n * @param bytes - The byte representation of the message to be signed and sent to the chain.\n * @param domainSeparator - A domain separator that starts with 'APTOS::'.\n *\n * @returns The Uint8Array of the signing message.\n * @group Implementation\n * @category Transactions\n */\nexport function generateSigningMessage(bytes: Uint8Array, domainSeparator: string): Uint8Array {\n const hash = sha3Hash.create();\n\n if (!domainSeparator.startsWith(\"APTOS::\")) {\n throw new Error(`Domain separator needs to start with 'APTOS::'. Provided - ${domainSeparator}`);\n }\n\n hash.update(domainSeparator);\n\n const prefix = hash.digest();\n\n const body = bytes;\n\n const mergedArray = new Uint8Array(prefix.length + body.length);\n mergedArray.set(prefix);\n mergedArray.set(body, prefix.length);\n\n return mergedArray;\n}\n\n/**\n * @deprecated\n * Use CryptoHashable instead by having your class implement it and call hash() to get the signing message.\n *\n * Generates the 'signing message' form of a serializable value by serializing it and using the constructor name as the domain\n * separator.\n *\n * @param serializable - An object that has a BCS serialized form.\n *\n * @returns The Uint8Array of the signing message.\n * @group Implementation\n * @category Transactions\n */\nexport function generateSigningMessageForSerializable(serializable: Serializable): Uint8Array {\n return generateSigningMessage(serializable.bcsToBytes(), `APTOS::${serializable.constructor.name}`);\n}\n\n/**\n * Generates the 'signing message' form of a transaction by deriving the type of transaction and applying the appropriate domain\n * separator based on the presence of a fee payer or secondary signers.\n *\n * @param transaction - A transaction that is to be signed, which can include a fee payer address or secondary signer addresses.\n *\n * @returns The Uint8Array of the signing message.\n * @group Implementation\n * @category Transactions\n */\nexport function generateSigningMessageForTransaction(transaction: AnyRawTransaction): Uint8Array {\n const rawTxn = deriveTransactionType(transaction);\n if (transaction.feePayerAddress) {\n return generateSigningMessage(rawTxn.bcsToBytes(), RAW_TRANSACTION_WITH_DATA_SALT);\n }\n if (transaction.secondarySignerAddresses) {\n return generateSigningMessage(rawTxn.bcsToBytes(), RAW_TRANSACTION_WITH_DATA_SALT);\n }\n return generateSigningMessage(rawTxn.bcsToBytes(), RAW_TRANSACTION_SALT);\n}\n"],"mappings":"AAQA,OAAS,YAAYA,MAAgB,qBACrC,OAAS,wBAAAC,EAAsB,kCAAAC,MAAsC,oBACrE,OAAS,0BAAAC,EAAwB,4BAAAC,MAAgC,eAkB1D,SAASC,EAAsBC,EAA2D,CAC/F,OAAIA,EAAY,gBACP,IAAIH,EACTG,EAAY,eACZA,EAAY,0BAA4B,CAAC,EACzCA,EAAY,eACd,EAEEA,EAAY,yBACP,IAAIF,EAAyBE,EAAY,eAAgBA,EAAY,wBAAwB,EAG/FA,EAAY,cACrB,CAaO,SAASC,EAAuBC,EAAmBC,EAAqC,CAC7F,MAAMC,EAAOV,EAAS,OAAO,EAE7B,GAAI,CAACS,EAAgB,WAAW,SAAS,EACvC,MAAM,IAAI,MAAM,+DAA+DA,CAAe,EAAE,EAGlGC,EAAK,OAAOD,CAAe,EAE3B,MAAME,EAASD,EAAK,OAAO,EAErBE,EAAOJ,EAEPK,EAAc,IAAI,WAAWF,EAAO,OAASC,EAAK,MAAM,EAC9D,OAAAC,EAAY,IAAIF,CAAM,EACtBE,EAAY,IAAID,EAAMD,EAAO,MAAM,EAE5BE,CACT,CAeO,SAASC,EAAsCC,EAAwC,CAC5F,OAAOR,EAAuBQ,EAAa,WAAW,EAAG,UAAUA,EAAa,YAAY,IAAI,EAAE,CACpG,CAYO,SAASC,EAAqCV,EAA4C,CAC/F,MAAMW,EAASZ,EAAsBC,CAAW,EAChD,OAAIA,EAAY,gBACPC,EAAuBU,EAAO,WAAW,EAAGf,CAA8B,EAE/EI,EAAY,yBACPC,EAAuBU,EAAO,WAAW,EAAGf,CAA8B,EAE5EK,EAAuBU,EAAO,WAAW,EAAGhB,CAAoB,CACzE","names":["sha3Hash","RAW_TRANSACTION_SALT","RAW_TRANSACTION_WITH_DATA_SALT","FeePayerRawTransaction","MultiAgentRawTransaction","deriveTransactionType","transaction","generateSigningMessage","bytes","domainSeparator","hash","prefix","body","mergedArray","generateSigningMessageForSerializable","serializable","generateSigningMessageForTransaction","rawTxn"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b4 as InputScriptData, ae as TransactionPayloadScript, b1 as InputEntryFunctionDataWithRemoteABI, af as TransactionPayloadEntryFunction, b3 as InputMultiSigDataWithRemoteABI, ag as TransactionPayloadMultiSig, a$ as InputEntryFunctionDataWithABI, b0 as InputMultiSigDataWithABI, b8 as InputViewFunctionDataWithRemoteABI, ah as EntryFunction, b9 as InputViewFunctionDataWithABI, A as AptosConfig, m as AccountAddressInput, aW as AnyTransactionPayloadInstance, aT as InputGenerateTransactionOptions, a5 as RawTransaction, al as TransactionInnerPayload, bd as InputGenerateSingleSignerRawTransactionArgs, at as SimpleTransaction, be as InputGenerateMultiAgentRawTransactionArgs, au as MultiAgentTransaction, bh as InputSimulateTransactionData, C as PublicKey, $ as AccountAuthenticatorNoAccountAuthenticator, X as AccountAuthenticatorEd25519, Z as AccountAuthenticatorSingleKey, _ as AccountAuthenticatorMultiKey, bn as InputSubmitTransactionData } from '../../account-
|
|
1
|
+
import { b4 as InputScriptData, ae as TransactionPayloadScript, b1 as InputEntryFunctionDataWithRemoteABI, af as TransactionPayloadEntryFunction, b3 as InputMultiSigDataWithRemoteABI, ag as TransactionPayloadMultiSig, a$ as InputEntryFunctionDataWithABI, b0 as InputMultiSigDataWithABI, b8 as InputViewFunctionDataWithRemoteABI, ah as EntryFunction, b9 as InputViewFunctionDataWithABI, A as AptosConfig, m as AccountAddressInput, aW as AnyTransactionPayloadInstance, aT as InputGenerateTransactionOptions, a5 as RawTransaction, al as TransactionInnerPayload, bd as InputGenerateSingleSignerRawTransactionArgs, at as SimpleTransaction, be as InputGenerateMultiAgentRawTransactionArgs, au as MultiAgentTransaction, bh as InputSimulateTransactionData, C as PublicKey, $ as AccountAuthenticatorNoAccountAuthenticator, X as AccountAuthenticatorEd25519, Z as AccountAuthenticatorSingleKey, _ as AccountAuthenticatorMultiKey, bn as InputSubmitTransactionData } from '../../account-BortO8g2.mjs';
|
|
2
2
|
import '../../types/indexer.mjs';
|
|
3
3
|
import '../../types/generated/operations.mjs';
|
|
4
4
|
import '../../types/generated/types.mjs';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{sha3_256 as X}from"@noble/hashes/sha3";import{AccountAddress as d,Hex as F}from"../../core";import{AnyPublicKey as D,AnySignature as l,KeylessPublicKey as w,KeylessSignature as N,Secp256k1PublicKey as Z,FederatedKeylessPublicKey as M,MultiKey as j,MultiKeySignature as J}from"../../core/crypto";import{Ed25519PublicKey as Q,Ed25519Signature as Y}from"../../core/crypto/ed25519";import{getInfo as nn}from"../../internal/utils";import{getLedgerInfo as tn}from"../../internal/general";import{getGasPriceEstimation as en}from"../../internal/transaction";import{NetworkToChainId as R}from"../../utils/apiEndpoints";import{normalizeBundle as an}from"../../utils/normalizeBundle";import{AccountAuthenticator as rn,AccountAuthenticatorEd25519 as h,AccountAuthenticatorMultiEd25519 as on,AccountAuthenticatorMultiKey as $,AccountAuthenticatorNoAccountAuthenticator as K,AccountAuthenticatorSingleKey as T}from"../authenticator/account";import{TransactionAuthenticatorEd25519 as W,TransactionAuthenticatorFeePayer as G,TransactionAuthenticatorMultiAgent as C,TransactionAuthenticatorMultiEd25519 as sn,TransactionAuthenticatorSingleSender as P}from"../authenticator/transaction";import{ChainId as cn,EntryFunction as I,FeePayerRawTransaction as un,MultiAgentRawTransaction as dn,MultiSig as fn,MultiSigTransactionPayload as yn,RawTransaction as mn,Script as ln,TransactionPayloadEntryFunction as U,TransactionPayloadMultiSig as _,TransactionPayloadScript as k}from"../instances";import{SignedTransaction as A}from"../instances/signedTransaction";import{convertArgument as v,fetchEntryFunctionAbi as An,fetchViewFunctionAbi as pn,standardizeTypeTags as S}from"./remoteAbi";import{memoizeAsync as gn}from"../../utils/memoize";import{isScriptDataInput as wn}from"./helpers";import{SimpleTransaction as hn}from"../instances/simpleTransaction";import{MultiAgentTransaction as Tn}from"../instances/multiAgentTransaction";import{getFunctionParts as p}from"../../utils/helpers";import{TransactionExecutableEmpty as Pn,TransactionExecutableEntryFunction as V,TransactionExecutableScript as In,TransactionExtraConfigV1 as b,TransactionInnerPayloadV1 as x}from"../instances/transactionPayload";async function bt(n){if(wn(n))return xn(n);const{moduleAddress:e,moduleName:t,functionName:i}=p(n.function),a=await O({key:"entry-function",moduleAddress:e,moduleName:t,functionName:i,aptosConfig:n.aptosConfig,abi:n.abi,fetch:An});return Sn({...n,abi:a})}function Sn(n){const e=n.abi,{moduleAddress:t,moduleName:i,functionName:a}=p(n.function),r=S(n.typeArguments);if(r.length!==e.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${e.typeParameters.length}, received ${r.length}`);const o=n.functionArguments.map((s,u)=>v(n.function,e,s,u,r));if(o.length!==e.parameters.length)throw new Error(`Too few arguments for '${t}::${i}::${a}', expected ${e.parameters.length} but got ${o.length}`);const c=I.build(`${t}::${i}`,a,r,o);if("multisigAddress"in n){const s=d.from(n.multisigAddress);return new _(new fn(s,new yn(c)))}return new U(c)}async function xt(n){const{moduleAddress:e,moduleName:t,functionName:i}=p(n.function),a=await O({key:"view-function",moduleAddress:e,moduleName:t,functionName:i,aptosConfig:n.aptosConfig,abi:n.abi,fetch:pn});return bn({abi:a,...n})}function bn(n){const e=n.abi,{moduleAddress:t,moduleName:i,functionName:a}=p(n.function),r=S(n.typeArguments);if(r.length!==e.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${e.typeParameters.length}, received ${r.length}`);const o=n?.functionArguments?.map((c,s)=>v(n.function,e,c,s,r))??[];if(o.length!==e.parameters.length)throw new Error(`Too few arguments for '${t}::${i}::${a}', expected ${e.parameters.length} but got ${o.length}`);return I.build(`${t}::${i}`,a,r,o)}function xn(n){return new k(new ln(F.fromHexInput(n.bytecode).toUint8Array(),S(n.typeArguments),n.functionArguments))}async function En(n){const{aptosConfig:e,sender:t,payload:i,options:a,feePayerAddress:r}=n;if(a?.replayProtectionNonce!==void 0&&a?.accountSequenceNumber!==void 0)throw new Error("Cannot specify both replayProtectionNonce and accountSequenceNumber in options.");const o=async()=>R[e.network]?{chainId:R[e.network]}:{chainId:(await tn({aptosConfig:e})).chain_id},c=async()=>a?.gasUnitPrice?{gasEstimate:a.gasUnitPrice}:{gasEstimate:(await en({aptosConfig:e})).gas_estimate},s=async()=>{const m=async()=>a?.accountSequenceNumber!==void 0?a.accountSequenceNumber:a?.replayProtectionNonce!==void 0?0xdeadbeefn:(await nn({aptosConfig:e,accountAddress:t})).sequence_number;if(r&&d.from(r).equals(d.ZERO))try{return await m()}catch{return 0}else return m()},[{chainId:u},{gasEstimate:y},g]=await Promise.all([o(),c(),s()]),{maxGasAmount:H,gasUnitPrice:z,expireTimestamp:L,replayProtectionNonce:E}={maxGasAmount:a?.maxGasAmount?BigInt(a.maxGasAmount):BigInt(e.getDefaultMaxGasAmount()),gasUnitPrice:a?.gasUnitPrice??BigInt(y),expireTimestamp:a?.expireTimestamp??BigInt(Math.floor(Date.now()/1e3)+e.getDefaultTxnExpirySecFromNow()),replayProtectionNonce:a?.replayProtectionNonce?BigInt(a.replayProtectionNonce):void 0};let B=i;return E!==void 0&&(B=Bn(i,E)),new mn(d.from(t),BigInt(g),B,BigInt(H),BigInt(z),BigInt(L),new cn(u))}function Bn(n,e){if(n instanceof k)return new x(new In(n.script),new b(void 0,e));if(n instanceof U)return new x(new V(n.entryFunction),new b(void 0,e));if(n instanceof _){const t=n.multiSig.transaction_payload;let i;if(t===void 0||t?.transaction_payload===void 0)i=new Pn;else if(t.transaction_payload instanceof I)i=new V(t.transaction_payload);else throw new Error("Scripts are not supported in multi-sig transactions.");return new x(i,new b(n.multiSig.multisig_address,e))}else throw new Error(`Unsupported payload type: ${n}`)}async function Et(n){const{aptosConfig:e,sender:t,payload:i,options:a,feePayerAddress:r}=n,o=await En({aptosConfig:e,sender:t,payload:i,options:a,feePayerAddress:r});if("secondarySignerAddresses"in n){const c=n.secondarySignerAddresses?.map(s=>d.from(s))??[];return new Tn(o,c,n.feePayerAddress?d.from(n.feePayerAddress):void 0)}return new hn(o,n.feePayerAddress?d.from(n.feePayerAddress):void 0)}function Bt(n){const{signerPublicKey:e,transaction:t,secondarySignersPublicKeys:i,feePayerPublicKey:a}=n,r=f(e);if(t.feePayerAddress){const c=new un(t.rawTransaction,t.secondarySignerAddresses??[],t.feePayerAddress);let s=[];t.secondarySignerAddresses&&(i?s=i.map(g=>f(g)):s=Array.from({length:t.secondarySignerAddresses.length},()=>f(void 0)));const u=f(a),y=new G(r,t.secondarySignerAddresses??[],s,{address:t.feePayerAddress,authenticator:u});return new A(c.raw_txn,y).bcsToBytes()}if(t.secondarySignerAddresses){const c=new dn(t.rawTransaction,t.secondarySignerAddresses);let s=[];i?s=i.map(y=>f(y)):s=Array.from({length:t.secondarySignerAddresses.length},()=>f(void 0));const u=new C(r,t.secondarySignerAddresses,s);return new A(c.raw_txn,u).bcsToBytes()}let o;if(r instanceof h)o=new W(r.public_key,r.signature);else if(r instanceof T||r instanceof $)o=new P(r);else if(r instanceof K)o=new P(r);else throw new Error("Invalid public key");return new A(t.rawTransaction,o).bcsToBytes()}function f(n){if(!n)return new K;const t=w.isInstance(n)||M.isInstance(n)||Z.isInstance(n)?new D(n):n,i=new Y(new Uint8Array(64));if(Q.isInstance(t))return new h(t,i);if(D.isInstance(t))return w.isInstance(t.publicKey)?new T(t,new l(N.getSimulationSignature())):new T(t,new l(i));if(j.isInstance(t))return new $(t,new J({signatures:t.publicKeys.map(a=>w.isInstance(a.publicKey)||M.isInstance(a.publicKey)?new l(N.getSimulationSignature()):new l(i)),bitmap:t.createBitmap({bits:Array(t.publicKeys.length).fill(0).map((a,r)=>r)})}));throw new Error("Unsupported PublicKey used for simulations")}function Fn(n){const{transaction:e,feePayerAuthenticator:t,additionalSignersAuthenticators:i}=n,a=an(rn,n.senderAuthenticator);let r;if(e.feePayerAddress){if(!t)throw new Error("Must provide a feePayerAuthenticator argument to generate a signed fee payer transaction");r=new G(a,e.secondarySignerAddresses??[],i??[],{address:e.feePayerAddress,authenticator:t})}else if(e.secondarySignerAddresses){if(!i)throw new Error("Must provide a additionalSignersAuthenticators argument to generate a signed multi agent transaction");r=new C(a,e.secondarySignerAddresses,i)}else a instanceof h?r=new W(a.public_key,a.signature):a instanceof on?r=new sn(a.public_key,a.signature):r=new P(a);return new A(e.rawTransaction,r).bcsToBytes()}function q(n){const e=X.create();for(const t of n)e.update(t);return e.digest()}const Dn=q(["APTOS::Transaction"]);function Ft(n){const e=Fn(n);return new F(q([Dn,new Uint8Array([0]),e])).toString()}async function O({key:n,moduleAddress:e,moduleName:t,functionName:i,aptosConfig:a,abi:r,fetch:o}){return r!==void 0?r:gn(async()=>o(e,t,i,a),`${n}-${a.network}-${e}-${t}-${i}`,1e3*60*5)()}export{Et as buildTransaction,Bn as convertPayloadToInnerPayload,En as generateRawTransaction,Fn as generateSignedTransaction,Bt as generateSignedTransactionForSimulation,bt as generateTransactionPayload,Sn as generateTransactionPayloadWithABI,Ft as generateUserTransactionHash,xt as generateViewFunctionPayload,bn as generateViewFunctionPayloadWithABI,f as getAuthenticatorForSimulation,q as hashValues};
|
|
2
2
|
//# sourceMappingURL=transactionBuilder.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/transactions/transactionBuilder/transactionBuilder.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * This file handles the transaction creation lifecycle.\n * It holds different operations to generate a transaction payload, a raw transaction,\n * and a signed transaction that can be simulated, signed and submitted to chain.\n */\nimport { sha3_256 as sha3Hash } from \"@noble/hashes/sha3\";\nimport { AptosConfig } from \"../../api/aptosConfig\";\nimport { AccountAddress, AccountAddressInput, Hex, PublicKey } from \"../../core\";\nimport {\n AnyPublicKey,\n AnySignature,\n KeylessPublicKey,\n KeylessSignature,\n Secp256k1PublicKey,\n FederatedKeylessPublicKey,\n MultiKey,\n MultiKeySignature,\n} from \"../../core/crypto\";\nimport { Ed25519PublicKey, Ed25519Signature } from \"../../core/crypto/ed25519\";\nimport { getInfo } from \"../../internal/utils\";\nimport { getLedgerInfo } from \"../../internal/general\";\nimport { getGasPriceEstimation } from \"../../internal/transaction\";\nimport { NetworkToChainId } from \"../../utils/apiEndpoints\";\nimport { normalizeBundle } from \"../../utils/normalizeBundle\";\nimport {\n AccountAuthenticator,\n AccountAuthenticatorEd25519,\n AccountAuthenticatorMultiEd25519,\n AccountAuthenticatorMultiKey,\n AccountAuthenticatorNoAccountAuthenticator,\n AccountAuthenticatorSingleKey,\n} from \"../authenticator/account\";\nimport {\n TransactionAuthenticator,\n TransactionAuthenticatorEd25519,\n TransactionAuthenticatorFeePayer,\n TransactionAuthenticatorMultiAgent,\n TransactionAuthenticatorMultiEd25519,\n TransactionAuthenticatorSingleSender,\n} from \"../authenticator/transaction\";\nimport {\n ChainId,\n EntryFunction,\n FeePayerRawTransaction,\n MultiAgentRawTransaction,\n MultiSig,\n MultiSigTransactionPayload,\n RawTransaction,\n Script,\n TransactionInnerPayload,\n TransactionPayloadEntryFunction,\n TransactionPayloadMultiSig,\n TransactionPayloadScript,\n} from \"../instances\";\nimport { SignedTransaction } from \"../instances/signedTransaction\";\nimport {\n AnyRawTransaction,\n AnyTransactionPayloadInstance,\n EntryFunctionArgumentTypes,\n InputGenerateMultiAgentRawTransactionArgs,\n InputGenerateRawTransactionArgs,\n InputGenerateSingleSignerRawTransactionArgs,\n InputGenerateTransactionOptions,\n InputScriptData,\n InputSimulateTransactionData,\n InputMultiSigDataWithRemoteABI,\n InputEntryFunctionDataWithRemoteABI,\n InputGenerateTransactionPayloadDataWithRemoteABI,\n InputSubmitTransactionData,\n InputGenerateTransactionPayloadDataWithABI,\n InputEntryFunctionDataWithABI,\n InputMultiSigDataWithABI,\n InputViewFunctionDataWithRemoteABI,\n InputViewFunctionDataWithABI,\n FunctionABI,\n} from \"../types\";\nimport { convertArgument, fetchEntryFunctionAbi, fetchViewFunctionAbi, standardizeTypeTags } from \"./remoteAbi\";\nimport { memoizeAsync } from \"../../utils/memoize\";\nimport { isScriptDataInput } from \"./helpers\";\nimport { SimpleTransaction } from \"../instances/simpleTransaction\";\nimport { MultiAgentTransaction } from \"../instances/multiAgentTransaction\";\nimport { getFunctionParts } from \"../../utils/helpers\";\nimport {\n TransactionExecutable,\n TransactionExecutableEmpty,\n TransactionExecutableEntryFunction,\n TransactionExecutableScript,\n TransactionExtraConfigV1,\n TransactionInnerPayloadV1,\n} from \"../instances/transactionPayload\";\n\n/**\n * Builds a transaction payload based on the provided arguments and returns a transaction payload.\n * This function uses the RemoteABI by default, but can also utilize a specified ABI.\n * When we call our `generateTransactionPayload` function with the relevant type properties,\n * Typescript can infer the return type based on the appropriate function overload.\n * @param args - The input data for generating the transaction payload.\n * @param args.function - The function to be called, specified in the format \"moduleAddress::moduleName::functionName\".\n * @param args.functionArguments - The arguments to pass to the function.\n * @param args.typeArguments - The type arguments for the function.\n * @param args.aptosConfig - The configuration settings for Aptos.\n * @param args.abi - The ABI to use for the transaction, if not using the RemoteABI.\n *\n * @returns TransactionPayload - The generated transaction payload, which can be of type TransactionPayloadScript,\n * TransactionPayloadMultiSig, or TransactionPayloadEntryFunction.\n * @group Implementation\n * @category Transactions\n */\nexport async function generateTransactionPayload(args: InputScriptData): Promise<TransactionPayloadScript>;\n/**\n * @group Implementation\n * @category Transactions\n */\nexport async function generateTransactionPayload(\n args: InputEntryFunctionDataWithRemoteABI,\n): Promise<TransactionPayloadEntryFunction>;\n/**\n * @group Implementation\n * @category Transactions\n */\nexport async function generateTransactionPayload(\n args: InputMultiSigDataWithRemoteABI,\n): Promise<TransactionPayloadMultiSig>;\n\n/**\n * Builds a transaction payload based on the data argument and returns\n * a transaction payload - TransactionPayloadScript | TransactionPayloadMultiSig | TransactionPayloadEntryFunction\n *\n * This uses the RemoteABI by default, and the remote ABI can be skipped by using generateTransactionPayloadWithABI\n *\n * @param args.data GenerateTransactionPayloadData\n *\n * @return TransactionPayload\n * @group Implementation\n * @category Transactions\n */\nexport async function generateTransactionPayload(\n args: InputGenerateTransactionPayloadDataWithRemoteABI,\n): Promise<AnyTransactionPayloadInstance> {\n if (isScriptDataInput(args)) {\n return generateTransactionPayloadScript(args);\n }\n const { moduleAddress, moduleName, functionName } = getFunctionParts(args.function);\n\n const functionAbi = await fetchAbi({\n key: \"entry-function\",\n moduleAddress,\n moduleName,\n functionName,\n aptosConfig: args.aptosConfig,\n abi: args.abi,\n fetch: fetchEntryFunctionAbi,\n });\n\n // Fill in the ABI\n return generateTransactionPayloadWithABI({ ...args, abi: functionAbi });\n}\n\n/**\n * Generates a transaction payload using the provided ABI and function details.\n * This function helps create a properly structured transaction payload for executing a specific function on a module.\n *\n * @param args - The input data required to generate the transaction payload.\n * @param args.abi - The ABI of the function to be executed.\n * @param args.function - The fully qualified name of the function in the format `moduleAddress::moduleName::functionName`.\n * @param args.typeArguments - An array of type arguments that correspond to the function's type parameters.\n * @param args.functionArguments - An array of arguments to be passed to the function.\n * @param args.multisigAddress - (Optional) The address for a multisig transaction if applicable.\n *\n * @throws Error if the type argument count does not match the ABI or if the number of function arguments is incorrect.\n * @group Implementation\n * @category Transactions\n */\nexport function generateTransactionPayloadWithABI(args: InputEntryFunctionDataWithABI): TransactionPayloadEntryFunction;\n/**\n * @group Implementation\n * @category Transactions\n */\nexport function generateTransactionPayloadWithABI(args: InputMultiSigDataWithABI): TransactionPayloadMultiSig;\n/**\n * @group Implementation\n * @category Transactions\n */\nexport function generateTransactionPayloadWithABI(\n args: InputGenerateTransactionPayloadDataWithABI,\n): AnyTransactionPayloadInstance {\n const functionAbi = args.abi;\n const { moduleAddress, moduleName, functionName } = getFunctionParts(args.function);\n\n // Ensure that all type arguments are typed properly\n const typeArguments = standardizeTypeTags(args.typeArguments);\n\n // Check the type argument count against the ABI\n if (typeArguments.length !== functionAbi.typeParameters.length) {\n throw new Error(\n `Type argument count mismatch, expected ${functionAbi.typeParameters.length}, received ${typeArguments.length}`,\n );\n }\n\n // Check all BCS types, and convert any non-BCS types\n const functionArguments: Array<EntryFunctionArgumentTypes> = args.functionArguments.map((arg, i) =>\n /**\n * Converts the argument for a specified function using its ABI and type arguments.\n * This function helps ensure that the correct number of arguments is provided for the function call.\n *\n * @param args - The arguments for the function call.\n * @param args.function - The specific function to be invoked.\n * @param functionAbi - The ABI (Application Binary Interface) of the function, which includes parameter details.\n * @param arg - The argument to be converted.\n * @param i - The index of the argument in the function call.\n * @param typeArguments - Additional type arguments that may be required for the conversion.\n * @group Implementation\n * @category Transactions\n */\n // TODO: Fix JSDoc\n convertArgument(args.function, functionAbi, arg, i, typeArguments),\n );\n\n // Check that all arguments are accounted for\n if (functionArguments.length !== functionAbi.parameters.length) {\n throw new Error(\n // eslint-disable-next-line max-len\n `Too few arguments for '${moduleAddress}::${moduleName}::${functionName}', expected ${functionAbi.parameters.length} but got ${functionArguments.length}`,\n );\n }\n\n // Generate entry function payload\n const entryFunctionPayload = EntryFunction.build(\n `${moduleAddress}::${moduleName}`,\n functionName,\n typeArguments,\n functionArguments,\n );\n\n // Send it as multi sig if it's a multisig payload\n if (\"multisigAddress\" in args) {\n const multisigAddress = AccountAddress.from(args.multisigAddress);\n return new TransactionPayloadMultiSig(\n new MultiSig(multisigAddress, new MultiSigTransactionPayload(entryFunctionPayload)),\n );\n }\n\n // Otherwise send as an entry function\n return new TransactionPayloadEntryFunction(entryFunctionPayload);\n}\n\n/**\n * Generates the payload for a view function call using the provided arguments.\n * This function helps in preparing the necessary data to interact with a specific view function on the blockchain.\n *\n * @param args - The input data required to generate the view function payload.\n * @param args.function - The function identifier in the format \"moduleAddress::moduleName::functionName\".\n * @param args.aptosConfig - Configuration settings for the Aptos client.\n * @param args.abi - The ABI (Application Binary Interface) of the module.\n *\n * @returns The generated payload for the view function call.\n * @group Implementation\n * @category Transactions\n */\nexport async function generateViewFunctionPayload(args: InputViewFunctionDataWithRemoteABI): Promise<EntryFunction> {\n const { moduleAddress, moduleName, functionName } = getFunctionParts(args.function);\n\n const functionAbi = await fetchAbi({\n key: \"view-function\",\n moduleAddress,\n moduleName,\n functionName,\n aptosConfig: args.aptosConfig,\n abi: args.abi,\n fetch: fetchViewFunctionAbi,\n });\n\n // Fill in the ABI\n return generateViewFunctionPayloadWithABI({ abi: functionAbi, ...args });\n}\n\n/**\n * Generates a payload for a view function call using the provided ABI and arguments.\n * This function ensures that the type arguments and function arguments are correctly formatted\n * and match the expected counts as defined in the ABI.\n *\n * @param args - The input data for generating the view function payload.\n * @param args.abi - The ABI of the function to be called.\n * @param args.function - The full name of the function in the format \"moduleAddress::moduleName::functionName\".\n * @param args.typeArguments - An array of type arguments to be used in the function call.\n * @param args.functionArguments - An array of arguments to be passed to the function.\n *\n * @throws Error if the type argument count does not match the ABI or if the function arguments\n * do not match the expected parameters defined in the ABI.\n * @group Implementation\n * @category Transactions\n */\nexport function generateViewFunctionPayloadWithABI(args: InputViewFunctionDataWithABI): EntryFunction {\n const functionAbi = args.abi;\n const { moduleAddress, moduleName, functionName } = getFunctionParts(args.function);\n\n // Ensure that all type arguments are typed properly\n const typeArguments = standardizeTypeTags(args.typeArguments);\n\n // Check the type argument count against the ABI\n if (typeArguments.length !== functionAbi.typeParameters.length) {\n throw new Error(\n `Type argument count mismatch, expected ${functionAbi.typeParameters.length}, received ${typeArguments.length}`,\n );\n }\n\n // Check all BCS types, and convert any non-BCS types\n const functionArguments: Array<EntryFunctionArgumentTypes> =\n args?.functionArguments?.map((arg, i) => convertArgument(args.function, functionAbi, arg, i, typeArguments)) ?? [];\n\n // Check that all arguments are accounted for\n if (functionArguments.length !== functionAbi.parameters.length) {\n throw new Error(\n // eslint-disable-next-line max-len\n `Too few arguments for '${moduleAddress}::${moduleName}::${functionName}', expected ${functionAbi.parameters.length} but got ${functionArguments.length}`,\n );\n }\n\n // Generate entry function payload\n return EntryFunction.build(`${moduleAddress}::${moduleName}`, functionName, typeArguments, functionArguments);\n}\n\n/**\n * Generates a transaction payload script based on the provided input data.\n * This function helps in creating a structured script for transaction processing.\n *\n * @param args - The input data required to generate the transaction payload script.\n * @param args.bytecode - The bytecode to be converted into a Uint8Array.\n * @param args.typeArguments - The type arguments that will be standardized.\n * @param args.functionArguments - The arguments for the function being called.\n * @returns A new instance of TransactionPayloadScript.\n * @group Implementation\n * @category Transactions\n */\nfunction generateTransactionPayloadScript(args: InputScriptData) {\n return new TransactionPayloadScript(\n new Script(\n Hex.fromHexInput(args.bytecode).toUint8Array(),\n standardizeTypeTags(args.typeArguments),\n args.functionArguments,\n ),\n );\n}\n\n/**\n * Generates a raw transaction that can be sent to the Aptos network.\n *\n * @param args - The arguments for generating the raw transaction.\n * @param args.aptosConfig - The configuration for the Aptos network.\n * @param args.sender - The transaction's sender account address as a hex input.\n * @param args.payload - The transaction payload, which can be created using generateTransactionPayload().\n * @param args.options - Optional parameters for transaction generation.\n * @param args.feePayerAddress - The address of the fee payer for sponsored transactions.\n *\n * @returns RawTransaction - The generated raw transaction.\n * @group Implementation\n * @category Transactions\n */\nexport async function generateRawTransaction(args: {\n aptosConfig: AptosConfig;\n sender: AccountAddressInput;\n payload: AnyTransactionPayloadInstance;\n options?: InputGenerateTransactionOptions;\n feePayerAddress?: AccountAddressInput;\n}): Promise<RawTransaction> {\n const { aptosConfig, sender, payload, options, feePayerAddress } = args;\n\n if (options?.replayProtectionNonce !== undefined && options?.accountSequenceNumber !== undefined) {\n throw new Error(\"Cannot specify both replayProtectionNonce and accountSequenceNumber in options.\");\n }\n\n const getChainId = async () => {\n if (NetworkToChainId[aptosConfig.network]) {\n return { chainId: NetworkToChainId[aptosConfig.network] };\n }\n const info = await getLedgerInfo({ aptosConfig });\n return { chainId: info.chain_id };\n };\n\n const getGasUnitPrice = async () => {\n if (options?.gasUnitPrice) {\n return { gasEstimate: options.gasUnitPrice };\n }\n const estimation = await getGasPriceEstimation({ aptosConfig });\n return { gasEstimate: estimation.gas_estimate };\n };\n\n const getSequenceNumberForAny = async () => {\n const getSequenceNumber = async () => {\n if (options?.accountSequenceNumber !== undefined) {\n return options.accountSequenceNumber;\n } else if (options?.replayProtectionNonce !== undefined) {\n // If replay nonce is provided, use it as the sequence number\n // This is an unused value, so it's specifically to show that the sequence number is not used\n return 0xdeadbeefn;\n }\n\n return (await getInfo({ aptosConfig, accountAddress: sender })).sequence_number;\n };\n\n /**\n * Check if is sponsored transaction to honor AIP-52\n * {@link https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-52.md}\n * @group Implementation\n * @category Transactions\n */\n if (feePayerAddress && AccountAddress.from(feePayerAddress).equals(AccountAddress.ZERO)) {\n // Handle sponsored transaction generation with the option that\n // the main signer has not been created on chain\n try {\n // Check if main signer has been created on chain, if not assign sequence number 0\n return await getSequenceNumber();\n } catch (e: any) {\n return 0;\n }\n } else {\n return getSequenceNumber();\n }\n };\n const [{ chainId }, { gasEstimate }, sequenceNumber] = await Promise.all([\n getChainId(),\n getGasUnitPrice(),\n getSequenceNumberForAny(),\n ]);\n\n const { maxGasAmount, gasUnitPrice, expireTimestamp, replayProtectionNonce } = {\n maxGasAmount: options?.maxGasAmount ? BigInt(options.maxGasAmount) : BigInt(aptosConfig.getDefaultMaxGasAmount()),\n gasUnitPrice: options?.gasUnitPrice ?? BigInt(gasEstimate),\n expireTimestamp:\n options?.expireTimestamp ?? BigInt(Math.floor(Date.now() / 1000) + aptosConfig.getDefaultTxnExpirySecFromNow()),\n replayProtectionNonce: options?.replayProtectionNonce ? BigInt(options.replayProtectionNonce) : undefined,\n };\n\n // If we're using replay nonce, we must convert the original payload\n let txnPayload = payload;\n if (replayProtectionNonce !== undefined) {\n txnPayload = convertPayloadToInnerPayload(payload, replayProtectionNonce);\n }\n\n return new RawTransaction(\n AccountAddress.from(sender),\n BigInt(sequenceNumber),\n txnPayload,\n BigInt(maxGasAmount),\n BigInt(gasUnitPrice),\n BigInt(expireTimestamp),\n new ChainId(chainId),\n );\n}\n\nexport function convertPayloadToInnerPayload(\n payload: AnyTransactionPayloadInstance,\n replayProtectionNonce?: bigint,\n): TransactionInnerPayload {\n if (payload instanceof TransactionPayloadScript) {\n return new TransactionInnerPayloadV1(\n new TransactionExecutableScript(payload.script),\n new TransactionExtraConfigV1(undefined, replayProtectionNonce),\n );\n } else if (payload instanceof TransactionPayloadEntryFunction) {\n return new TransactionInnerPayloadV1(\n new TransactionExecutableEntryFunction(payload.entryFunction),\n new TransactionExtraConfigV1(undefined, replayProtectionNonce),\n );\n } else if (payload instanceof TransactionPayloadMultiSig) {\n const innerPayload = payload.multiSig.transaction_payload;\n let executable: TransactionExecutable;\n if (innerPayload === undefined || innerPayload?.transaction_payload === undefined) {\n executable = new TransactionExecutableEmpty();\n } else if (innerPayload.transaction_payload instanceof EntryFunction) {\n executable = new TransactionExecutableEntryFunction(innerPayload.transaction_payload);\n } else {\n // TODO For now, scripts are not supported in multi-sig transactions, so it's always entry function\n throw new Error(\"Scripts are not supported in multi-sig transactions.\");\n }\n\n return new TransactionInnerPayloadV1(\n executable,\n new TransactionExtraConfigV1(payload.multiSig.multisig_address, replayProtectionNonce),\n );\n } else {\n throw new Error(`Unsupported payload type: ${payload}`);\n }\n}\n\n/**\n * Generates a transaction based on the provided arguments.\n * This function can create both simple and multi-agent transactions, allowing for flexible transaction handling.\n *\n * @param args - The input arguments for generating the transaction.\n * @param args.aptosConfig - The configuration settings for Aptos.\n * @param args.sender - The transaction's sender account address as a hex input.\n * @param args.payload - The transaction payload, which can be created using `generateTransactionPayload()`.\n * @param args.options - Optional. Transaction options object.\n * @param args.secondarySignerAddresses - Optional. An array of addresses for additional signers in a multi-signature transaction.\n * @param args.feePayerAddress - Optional. The address of the fee payer for sponsored transactions.\n * @returns An instance of a transaction, which may include secondary signer addresses and a fee payer address.\n * @group Implementation\n * @category Transactions\n */\nexport async function buildTransaction(args: InputGenerateSingleSignerRawTransactionArgs): Promise<SimpleTransaction>;\n/**\n * @group Implementation\n * @category Transactions\n */\nexport async function buildTransaction(args: InputGenerateMultiAgentRawTransactionArgs): Promise<MultiAgentTransaction>;\n\n/**\n * Generates a transaction based on the provided arguments\n *\n * Note: we can start with one function to support all different payload/transaction types,\n * and if to complex to use, we could have function for each type\n *\n * @param args.aptosConfig AptosConfig\n * @param args.sender The transaction's sender account address as a hex input\n * @param args.payload The transaction payload - can create by using generateTransactionPayload()\n * @param args.options optional. Transaction options object\n * @param args.secondarySignerAddresses optional. For when want to create a multi signers transaction\n * @param args.feePayerAddress optional. For when want to create a fee payer (aka sponsored) transaction\n *\n * @return An instance of a RawTransaction, plus optional secondary/fee payer addresses\n * ```\n * {\n * rawTransaction: RawTransaction,\n * secondarySignerAddresses?: Array<AccountAddress>,\n * feePayerAddress?: AccountAddress\n * }\n * ```\n * @group Implementation\n * @category Transactions\n */\nexport async function buildTransaction(args: InputGenerateRawTransactionArgs): Promise<AnyRawTransaction> {\n const { aptosConfig, sender, payload, options, feePayerAddress } = args;\n // generate raw transaction\n const rawTxn = await generateRawTransaction({\n aptosConfig,\n sender,\n payload,\n options,\n feePayerAddress,\n });\n\n // if multi agent transaction\n if (\"secondarySignerAddresses\" in args) {\n const signers: Array<AccountAddress> =\n args.secondarySignerAddresses?.map((signer) => AccountAddress.from(signer)) ?? [];\n\n return new MultiAgentTransaction(\n rawTxn,\n signers,\n args.feePayerAddress ? AccountAddress.from(args.feePayerAddress) : undefined,\n );\n }\n // return the raw transaction\n return new SimpleTransaction(rawTxn, args.feePayerAddress ? AccountAddress.from(args.feePayerAddress) : undefined);\n}\n\n/**\n * Generate a signed transaction for simulation before submitting it to the chain.\n * This function helps in preparing a transaction that can be simulated, allowing users to verify its validity and expected behavior.\n *\n * @param args - The input data required to generate the signed transaction for simulation.\n * @param args.transaction - An Aptos transaction type to sign.\n * @param args.signerPublicKey - The public key of the signer.\n * @param args.secondarySignersPublicKeys - Optional. The public keys of secondary signers if it is a multi-signer transaction.\n * @param args.feePayerPublicKey - Optional. The public key of the fee payer in a sponsored transaction.\n * @param args.options - Optional. Additional options for simulating the transaction.\n *\n * @returns A signed serialized transaction that can be simulated.\n * @group Implementation\n * @category Transactions\n */\nexport function generateSignedTransactionForSimulation(args: InputSimulateTransactionData): Uint8Array {\n const { signerPublicKey, transaction, secondarySignersPublicKeys, feePayerPublicKey } = args;\n\n const accountAuthenticator = getAuthenticatorForSimulation(signerPublicKey);\n\n // fee payer transaction\n if (transaction.feePayerAddress) {\n const transactionToSign = new FeePayerRawTransaction(\n transaction.rawTransaction,\n transaction.secondarySignerAddresses ?? [],\n transaction.feePayerAddress,\n );\n let secondaryAccountAuthenticators: Array<AccountAuthenticator> = [];\n if (transaction.secondarySignerAddresses) {\n if (secondarySignersPublicKeys) {\n secondaryAccountAuthenticators = secondarySignersPublicKeys.map((publicKey) =>\n getAuthenticatorForSimulation(publicKey),\n );\n } else {\n secondaryAccountAuthenticators = Array.from({ length: transaction.secondarySignerAddresses.length }, () =>\n getAuthenticatorForSimulation(undefined),\n );\n }\n }\n const feePayerAuthenticator = getAuthenticatorForSimulation(feePayerPublicKey);\n\n const transactionAuthenticator = new TransactionAuthenticatorFeePayer(\n accountAuthenticator,\n transaction.secondarySignerAddresses ?? [],\n secondaryAccountAuthenticators,\n {\n address: transaction.feePayerAddress,\n authenticator: feePayerAuthenticator,\n },\n );\n return new SignedTransaction(transactionToSign.raw_txn, transactionAuthenticator).bcsToBytes();\n }\n\n // multi agent transaction\n if (transaction.secondarySignerAddresses) {\n const transactionToSign = new MultiAgentRawTransaction(\n transaction.rawTransaction,\n transaction.secondarySignerAddresses,\n );\n\n let secondaryAccountAuthenticators: Array<AccountAuthenticator> = [];\n\n if (secondarySignersPublicKeys) {\n secondaryAccountAuthenticators = secondarySignersPublicKeys.map((publicKey) =>\n getAuthenticatorForSimulation(publicKey),\n );\n } else {\n secondaryAccountAuthenticators = Array.from({ length: transaction.secondarySignerAddresses.length }, () =>\n getAuthenticatorForSimulation(undefined),\n );\n }\n\n const transactionAuthenticator = new TransactionAuthenticatorMultiAgent(\n accountAuthenticator,\n transaction.secondarySignerAddresses,\n secondaryAccountAuthenticators,\n );\n\n return new SignedTransaction(transactionToSign.raw_txn, transactionAuthenticator).bcsToBytes();\n }\n\n // single signer raw transaction\n let transactionAuthenticator;\n if (accountAuthenticator instanceof AccountAuthenticatorEd25519) {\n transactionAuthenticator = new TransactionAuthenticatorEd25519(\n accountAuthenticator.public_key,\n accountAuthenticator.signature,\n );\n } else if (\n accountAuthenticator instanceof AccountAuthenticatorSingleKey ||\n accountAuthenticator instanceof AccountAuthenticatorMultiKey\n ) {\n transactionAuthenticator = new TransactionAuthenticatorSingleSender(accountAuthenticator);\n } else if (accountAuthenticator instanceof AccountAuthenticatorNoAccountAuthenticator) {\n transactionAuthenticator = new TransactionAuthenticatorSingleSender(accountAuthenticator);\n } else {\n throw new Error(\"Invalid public key\");\n }\n return new SignedTransaction(transaction.rawTransaction, transactionAuthenticator).bcsToBytes();\n}\n\n/**\n * @group Implementation\n * @category Transactions\n */\nexport function getAuthenticatorForSimulation(publicKey?: PublicKey) {\n if (!publicKey) {\n return new AccountAuthenticatorNoAccountAuthenticator();\n }\n\n // Wrap the public key types below with AnyPublicKey as they are only support through single sender.\n // Learn more about AnyPublicKey here - https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-55.md\n const convertToAnyPublicKey =\n KeylessPublicKey.isInstance(publicKey) ||\n FederatedKeylessPublicKey.isInstance(publicKey) ||\n Secp256k1PublicKey.isInstance(publicKey);\n const accountPublicKey = convertToAnyPublicKey ? new AnyPublicKey(publicKey) : publicKey;\n\n // No need to for the signature to be matching in scheme. All that matters for simulations is that it's not valid\n const invalidSignature = new Ed25519Signature(new Uint8Array(64));\n\n if (Ed25519PublicKey.isInstance(accountPublicKey)) {\n return new AccountAuthenticatorEd25519(accountPublicKey, invalidSignature);\n }\n\n if (AnyPublicKey.isInstance(accountPublicKey)) {\n if (KeylessPublicKey.isInstance(accountPublicKey.publicKey)) {\n return new AccountAuthenticatorSingleKey(\n accountPublicKey,\n new AnySignature(KeylessSignature.getSimulationSignature()),\n );\n }\n return new AccountAuthenticatorSingleKey(accountPublicKey, new AnySignature(invalidSignature));\n }\n\n if (MultiKey.isInstance(accountPublicKey)) {\n return new AccountAuthenticatorMultiKey(\n accountPublicKey,\n new MultiKeySignature({\n signatures: accountPublicKey.publicKeys.map((pubKey) => {\n if (KeylessPublicKey.isInstance(pubKey.publicKey) || FederatedKeylessPublicKey.isInstance(pubKey.publicKey)) {\n return new AnySignature(KeylessSignature.getSimulationSignature());\n }\n return new AnySignature(invalidSignature);\n }),\n bitmap: accountPublicKey.createBitmap({\n bits: Array(accountPublicKey.publicKeys.length)\n .fill(0)\n .map((_, i) => i),\n }),\n }),\n );\n }\n\n throw new Error(\"Unsupported PublicKey used for simulations\");\n}\n\n/**\n * Generate a signed transaction ready for submission to the blockchain.\n * This function prepares the transaction by authenticating the sender and any additional signers based on the provided arguments.\n *\n * @param args - The input data required to generate the signed transaction.\n * @param args.transaction - An Aptos transaction type containing the details of the transaction.\n * @param args.senderAuthenticator - The account authenticator of the transaction sender.\n * @param args.feePayerAuthenticator - The authenticator for the fee payer, required if the transaction has a fee payer address.\n * @param args.additionalSignersAuthenticators - Optional authenticators for additional signers in a multi-signer transaction.\n *\n * @returns A Uint8Array representing the signed transaction in bytes.\n *\n * @throws Error if the feePayerAuthenticator is not provided for a fee payer transaction.\n * @throws Error if additionalSignersAuthenticators are not provided for a multi-signer transaction.\n * @group Implementation\n * @category Transactions\n */\nexport function generateSignedTransaction(args: InputSubmitTransactionData): Uint8Array {\n const { transaction, feePayerAuthenticator, additionalSignersAuthenticators } = args;\n const senderAuthenticator = normalizeBundle(AccountAuthenticator, args.senderAuthenticator);\n\n let txnAuthenticator: TransactionAuthenticator;\n if (transaction.feePayerAddress) {\n if (!feePayerAuthenticator) {\n throw new Error(\"Must provide a feePayerAuthenticator argument to generate a signed fee payer transaction\");\n }\n txnAuthenticator = new TransactionAuthenticatorFeePayer(\n senderAuthenticator,\n transaction.secondarySignerAddresses ?? [],\n additionalSignersAuthenticators ?? [],\n {\n address: transaction.feePayerAddress,\n authenticator: feePayerAuthenticator,\n },\n );\n } else if (transaction.secondarySignerAddresses) {\n if (!additionalSignersAuthenticators) {\n throw new Error(\n \"Must provide a additionalSignersAuthenticators argument to generate a signed multi agent transaction\",\n );\n }\n txnAuthenticator = new TransactionAuthenticatorMultiAgent(\n senderAuthenticator,\n transaction.secondarySignerAddresses,\n additionalSignersAuthenticators,\n );\n } else if (senderAuthenticator instanceof AccountAuthenticatorEd25519) {\n txnAuthenticator = new TransactionAuthenticatorEd25519(\n senderAuthenticator.public_key,\n senderAuthenticator.signature,\n );\n } else if (senderAuthenticator instanceof AccountAuthenticatorMultiEd25519) {\n txnAuthenticator = new TransactionAuthenticatorMultiEd25519(\n senderAuthenticator.public_key,\n senderAuthenticator.signature,\n );\n } else {\n txnAuthenticator = new TransactionAuthenticatorSingleSender(senderAuthenticator);\n }\n\n return new SignedTransaction(transaction.rawTransaction, txnAuthenticator).bcsToBytes();\n}\n\n/**\n * Hashes the set of values using a SHA-3 256 hash algorithm.\n * @param input - An array of UTF-8 strings or Uint8Array byte arrays to be hashed.\n * @group Implementation\n * @category Transactions\n */\nexport function hashValues(input: (Uint8Array | string)[]): Uint8Array {\n const hash = sha3Hash.create();\n for (const item of input) {\n hash.update(item);\n }\n return hash.digest();\n}\n\n/**\n * The domain separated prefix for hashing transactions\n * @group Implementation\n * @category Transactions\n */\nconst TRANSACTION_PREFIX = hashValues([\"APTOS::Transaction\"]);\n\n/**\n * Generates a user transaction hash for the provided transaction payload, which must already have an authenticator.\n * This function helps ensure the integrity and uniqueness of the transaction by producing a hash based on the signed transaction data.\n *\n * @param args - The input data required to submit the transaction.\n * @param args.authenticator - The authenticator for the transaction.\n * @param args.payload - The payload containing the transaction details.\n * @param args.sender - The address of the sender initiating the transaction.\n * @param args.sequenceNumber - The sequence number of the transaction for the sender.\n * @group Implementation\n * @category Transactions\n */\nexport function generateUserTransactionHash(args: InputSubmitTransactionData): string {\n const signedTransaction = generateSignedTransaction(args);\n\n // Transaction signature is defined as, the domain separated prefix based on struct (Transaction)\n // Then followed by the type of the transaction for the enum, UserTransaction is 0\n // Then followed by BCS encoded bytes of the signed transaction\n return new Hex(hashValues([TRANSACTION_PREFIX, new Uint8Array([0]), signedTransaction])).toString();\n}\n\n/**\n * Fetches and caches ABIs while allowing for pass-through on provided ABIs.\n *\n * @param key - A unique identifier for the cached ABI.\n * @param moduleAddress - The address of the module from which to fetch the ABI.\n * @param moduleName - The name of the module containing the function.\n * @param functionName - The name of the function whose ABI is being fetched.\n * @param aptosConfig - Configuration settings for Aptos.\n * @param abi - An optional ABI to use if already available.\n * @param fetch - A function to fetch the ABI if it is not provided.\n * @group Implementation\n * @category Transactions\n */\nasync function fetchAbi<T extends FunctionABI>({\n key,\n moduleAddress,\n moduleName,\n functionName,\n aptosConfig,\n abi,\n fetch,\n}: {\n key: string;\n moduleAddress: string;\n moduleName: string;\n functionName: string;\n aptosConfig: AptosConfig;\n abi?: T;\n fetch: (moduleAddress: string, moduleName: string, functionName: string, aptosConfig: AptosConfig) => Promise<T>;\n}): Promise<T> {\n if (abi !== undefined) {\n return abi;\n }\n\n // We fetch the entry function ABI, and then pretend that we already had the ABI\n return memoizeAsync(\n async () => fetch(moduleAddress, moduleName, functionName, aptosConfig),\n `${key}-${aptosConfig.network}-${moduleAddress}-${moduleName}-${functionName}`,\n 1000 * 60 * 5, // 5 minutes\n )();\n}\n"],"mappings":"AAQA,OAAS,YAAYA,MAAgB,qBAErC,OAAS,kBAAAC,EAAqC,OAAAC,MAAsB,aACpE,OACE,gBAAAC,EACA,gBAAAC,EACA,oBAAAC,EACA,oBAAAC,EACA,sBAAAC,EACA,6BAAAC,EACA,YAAAC,EACA,qBAAAC,MACK,oBACP,OAAS,oBAAAC,EAAkB,oBAAAC,MAAwB,4BACnD,OAAS,WAAAC,OAAe,uBACxB,OAAS,iBAAAC,OAAqB,y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C,CAAU,IAAIC,CAAY,GAC5E,IAAO,GAAK,CACd,EAAE,CACJ","names":["sha3Hash","AccountAddress","Hex","AnyPublicKey","AnySignature","KeylessPublicKey","KeylessSignature","Secp256k1PublicKey","FederatedKeylessPublicKey","MultiKey","MultiKeySignature","Ed25519PublicKey","Ed25519Signature","getInfo","getLedgerInfo","getGasPriceEstimation","NetworkToChainId","normalizeBundle","AccountAuthenticator","AccountAuthenticatorEd25519","AccountAuthenticatorMultiEd25519","AccountAuthenticatorMultiKey","AccountAuthenticatorNoAccountAuthenticator","AccountAuthenticatorSingleKey","TransactionAuthenticatorEd25519","TransactionAuthenticatorFeePayer","TransactionAuthenticatorMultiAgent","TransactionAuthenticatorMultiEd25519","TransactionAuthenticatorSingleSender","ChainId","EntryFunction","FeePayerRawTransaction","MultiAgentRawTransaction","MultiSig","MultiSigTransactionPayload","RawTransaction","Script","TransactionPayloadEntryFunction","TransactionPayloadMultiSig","TransactionPayloadScript","SignedTransaction","convertArgument","fetchEntryFunctionAbi","fetchViewFunctionAbi","standardizeTypeTags","memoizeAsync","isScriptDataInput","SimpleTransaction","MultiAgentTransaction","getFunctionParts","TransactionExecutableEmpty","TransactionExecutableEntryFunction","TransactionExecutableScript","TransactionExtraConfigV1","TransactionInnerPayloadV1","generateTransactionPayload","args","generateTransactionPayloadScript","moduleAddress","moduleName","functionName","functionAbi","fetchAbi","generateTransactionPayloadWithABI","typeArguments","functionArguments","arg","i","entryFunctionPayload","multisigAddress","generateViewFunctionPayload","generateViewFunctionPayloadWithABI","generateRawTransaction","aptosConfig","sender","payload","options","feePayerAddress","getChainId","getGasUnitPrice","getSequenceNumberForAny","getSequenceNumber","chainId","gasEstimate","sequenceNumber","maxGasAmount","gasUnitPrice","expireTimestamp","replayProtectionNonce","txnPayload","convertPayloadToInnerPayload","innerPayload","executable","buildTransaction","rawTxn","signers","signer","generateSignedTransactionForSimulation","signerPublicKey","transaction","secondarySignersPublicKeys","feePayerPublicKey","accountAuthenticator","getAuthenticatorForSimulation","transactionToSign","secondaryAccountAuthenticators","publicKey","feePayerAuthenticator","transactionAuthenticator","accountPublicKey","invalidSignature","pubKey","_","generateSignedTransaction","additionalSignersAuthenticators","senderAuthenticator","txnAuthenticator","hashValues","input","hash","item","TRANSACTION_PREFIX","generateUserTransactionHash","signedTransaction","key","abi","fetch"]}
|