@aptos-labs/ts-sdk 6.3.1 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +125 -24
- package/dist/account/AbstractKeylessAccount.d.ts +326 -0
- package/dist/account/AbstractKeylessAccount.d.ts.map +1 -0
- package/dist/account/AbstractKeylessAccount.js +440 -0
- package/dist/account/AbstractKeylessAccount.js.map +1 -0
- package/dist/account/AbstractedAccount.d.ts +61 -0
- package/dist/account/AbstractedAccount.d.ts.map +1 -0
- package/dist/account/AbstractedAccount.js +71 -0
- package/dist/account/AbstractedAccount.js.map +1 -0
- package/dist/account/Account.d.ts +302 -0
- package/dist/account/Account.d.ts.map +1 -0
- package/dist/account/Account.js +104 -0
- package/dist/account/Account.js.map +1 -0
- package/dist/account/AccountUtils.d.ts +25 -0
- package/dist/account/AccountUtils.d.ts.map +1 -0
- package/dist/account/AccountUtils.js +202 -0
- package/dist/account/AccountUtils.js.map +1 -0
- package/dist/account/DerivableAbstractedAccount.d.ts +51 -0
- package/dist/account/DerivableAbstractedAccount.d.ts.map +1 -0
- package/dist/account/DerivableAbstractedAccount.js +61 -0
- package/dist/account/DerivableAbstractedAccount.js.map +1 -0
- package/dist/account/Ed25519Account.d.ts +161 -0
- package/dist/account/Ed25519Account.d.ts.map +1 -0
- package/dist/account/Ed25519Account.js +149 -0
- package/dist/account/Ed25519Account.js.map +1 -0
- package/dist/account/EphemeralKeyPair.d.ts +159 -0
- package/dist/account/EphemeralKeyPair.d.ts.map +1 -0
- package/dist/account/EphemeralKeyPair.js +246 -0
- package/dist/account/EphemeralKeyPair.js.map +1 -0
- package/dist/account/FederatedKeylessAccount.d.ts +107 -0
- package/dist/account/FederatedKeylessAccount.d.ts.map +1 -0
- package/dist/account/FederatedKeylessAccount.js +129 -0
- package/dist/account/FederatedKeylessAccount.js.map +1 -0
- package/dist/account/KeylessAccount.d.ts +112 -0
- package/dist/account/KeylessAccount.d.ts.map +1 -0
- package/dist/account/KeylessAccount.js +133 -0
- package/dist/account/KeylessAccount.js.map +1 -0
- package/dist/account/MultiEd25519Account.d.ts +100 -0
- package/dist/account/MultiEd25519Account.d.ts.map +1 -0
- package/dist/account/MultiEd25519Account.js +134 -0
- package/dist/account/MultiEd25519Account.js.map +1 -0
- package/dist/account/MultiKeyAccount.d.ts +197 -0
- package/dist/account/MultiKeyAccount.d.ts.map +1 -0
- package/dist/account/MultiKeyAccount.js +233 -0
- package/dist/account/MultiKeyAccount.js.map +1 -0
- package/dist/account/SingleKeyAccount.d.ts +189 -0
- package/dist/account/SingleKeyAccount.d.ts.map +1 -0
- package/dist/account/SingleKeyAccount.js +182 -0
- package/dist/account/SingleKeyAccount.js.map +1 -0
- package/dist/account/index.d.ts +9 -0
- package/dist/account/index.d.ts.map +1 -0
- package/dist/account/index.js +17 -0
- package/dist/account/index.js.map +1 -0
- package/dist/account/keylessSigner.d.ts +22 -0
- package/dist/account/keylessSigner.d.ts.map +1 -0
- package/dist/account/keylessSigner.js +9 -0
- package/dist/account/keylessSigner.js.map +1 -0
- package/dist/account/utils.d.ts +8 -0
- package/dist/account/utils.d.ts.map +1 -0
- package/dist/account/utils.js +12 -0
- package/dist/account/utils.js.map +1 -0
- package/dist/api/account/abstraction.d.ts +176 -0
- package/dist/api/account/abstraction.d.ts.map +1 -0
- package/dist/api/account/abstraction.js +203 -0
- package/dist/api/account/abstraction.js.map +1 -0
- package/dist/api/account.d.ts +845 -0
- package/dist/api/account.d.ts.map +1 -0
- package/dist/api/account.js +965 -0
- package/dist/api/account.js.map +1 -0
- package/dist/api/ans.d.ts +565 -0
- package/dist/api/ans.d.ts.map +1 -0
- package/dist/api/ans.js +537 -0
- package/dist/api/ans.js.map +1 -0
- package/dist/api/aptos.d.ts +73 -0
- package/dist/api/aptos.d.ts.map +1 -0
- package/dist/api/aptos.js +162 -0
- package/dist/api/aptos.js.map +1 -0
- package/dist/api/aptosConfig.d.ts +215 -0
- package/dist/api/aptosConfig.d.ts.map +1 -0
- package/dist/api/aptosConfig.js +316 -0
- package/dist/api/aptosConfig.js.map +1 -0
- package/dist/api/coin.d.ts +77 -0
- package/dist/api/coin.d.ts.map +1 -0
- package/dist/api/coin.js +73 -0
- package/dist/api/coin.js.map +1 -0
- package/dist/api/digitalAsset.d.ts +1026 -0
- package/dist/api/digitalAsset.d.ts.map +1 -0
- package/dist/api/digitalAsset.js +987 -0
- package/dist/api/digitalAsset.js.map +1 -0
- package/dist/api/faucet.d.ts +74 -0
- package/dist/api/faucet.d.ts.map +1 -0
- package/dist/api/faucet.js +86 -0
- package/dist/api/faucet.js.map +1 -0
- package/dist/api/fungibleAsset.d.ts +285 -0
- package/dist/api/fungibleAsset.d.ts.map +1 -0
- package/dist/api/fungibleAsset.js +314 -0
- package/dist/api/fungibleAsset.js.map +1 -0
- package/dist/api/general.d.ts +298 -0
- package/dist/api/general.d.ts.map +1 -0
- package/dist/api/general.js +311 -0
- package/dist/api/general.js.map +1 -0
- package/dist/api/index.d.ts +3 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +5 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/keyless.d.ts +160 -0
- package/dist/api/keyless.d.ts.map +1 -0
- package/dist/api/keyless.js +176 -0
- package/dist/api/keyless.js.map +1 -0
- package/dist/api/object.d.ts +74 -0
- package/dist/api/object.d.ts.map +1 -0
- package/dist/api/object.js +84 -0
- package/dist/api/object.js.map +1 -0
- package/dist/api/staking.d.ts +128 -0
- package/dist/api/staking.d.ts.map +1 -0
- package/dist/api/staking.js +143 -0
- package/dist/api/staking.js.map +1 -0
- package/dist/api/table.d.ts +163 -0
- package/dist/api/table.d.ts.map +1 -0
- package/dist/api/table.js +171 -0
- package/dist/api/table.js.map +1 -0
- package/dist/api/transaction.d.ts +672 -0
- package/dist/api/transaction.d.ts.map +1 -0
- package/dist/api/transaction.js +694 -0
- package/dist/api/transaction.js.map +1 -0
- package/dist/api/transactionSubmission/build.d.ts +137 -0
- package/dist/api/transactionSubmission/build.d.ts.map +1 -0
- package/dist/api/transactionSubmission/build.js +130 -0
- package/dist/api/transactionSubmission/build.js.map +1 -0
- package/dist/api/transactionSubmission/helpers.d.ts +91 -0
- package/dist/api/transactionSubmission/helpers.d.ts.map +1 -0
- package/dist/api/transactionSubmission/helpers.js +99 -0
- package/dist/api/transactionSubmission/helpers.js.map +1 -0
- package/dist/api/transactionSubmission/management.d.ts +159 -0
- package/dist/api/transactionSubmission/management.d.ts.map +1 -0
- package/dist/api/transactionSubmission/management.js +192 -0
- package/dist/api/transactionSubmission/management.js.map +1 -0
- package/dist/api/transactionSubmission/sign.d.ts +117 -0
- package/dist/api/transactionSubmission/sign.d.ts.map +1 -0
- package/dist/api/transactionSubmission/sign.js +130 -0
- package/dist/api/transactionSubmission/sign.js.map +1 -0
- package/dist/api/transactionSubmission/simulate.d.ts +176 -0
- package/dist/api/transactionSubmission/simulate.d.ts.map +1 -0
- package/dist/api/transactionSubmission/simulate.js +183 -0
- package/dist/api/transactionSubmission/simulate.js.map +1 -0
- package/dist/api/transactionSubmission/submit.d.ts +136 -0
- package/dist/api/transactionSubmission/submit.d.ts.map +1 -0
- package/dist/api/transactionSubmission/submit.js +136 -0
- package/dist/api/transactionSubmission/submit.js.map +1 -0
- package/dist/api/utils.d.ts +39 -0
- package/dist/api/utils.d.ts.map +1 -0
- package/dist/api/utils.js +41 -0
- package/dist/api/utils.js.map +1 -0
- package/dist/bcs/consts.d.ts +20 -0
- package/dist/bcs/consts.d.ts.map +1 -0
- package/dist/bcs/consts.js +24 -0
- package/dist/bcs/consts.js.map +1 -0
- package/dist/bcs/deserializer.d.ts +365 -0
- package/dist/bcs/deserializer.d.ts.map +1 -0
- package/dist/bcs/deserializer.js +470 -0
- package/dist/bcs/deserializer.js.map +1 -0
- package/dist/bcs/index.d.ts +7 -0
- package/dist/bcs/index.d.ts.map +1 -0
- package/dist/bcs/index.js +9 -0
- package/dist/bcs/index.js.map +1 -0
- package/dist/bcs/serializable/entryFunctionBytes.d.ts +60 -0
- package/dist/bcs/serializable/entryFunctionBytes.d.ts.map +1 -0
- package/dist/bcs/serializable/entryFunctionBytes.js +82 -0
- package/dist/bcs/serializable/entryFunctionBytes.js.map +1 -0
- package/dist/bcs/serializable/fixedBytes.d.ts +86 -0
- package/dist/bcs/serializable/fixedBytes.d.ts.map +1 -0
- package/dist/bcs/serializable/fixedBytes.js +98 -0
- package/dist/bcs/serializable/fixedBytes.js.map +1 -0
- package/dist/bcs/serializable/movePrimitives.d.ts +267 -0
- package/dist/bcs/serializable/movePrimitives.d.ts.map +1 -0
- package/dist/bcs/serializable/movePrimitives.js +448 -0
- package/dist/bcs/serializable/movePrimitives.js.map +1 -0
- package/dist/bcs/serializable/moveStructs.d.ts +596 -0
- package/dist/bcs/serializable/moveStructs.d.ts.map +1 -0
- package/dist/bcs/serializable/moveStructs.js +748 -0
- package/dist/bcs/serializable/moveStructs.js.map +1 -0
- package/dist/bcs/serializer.d.ts +442 -0
- package/dist/bcs/serializer.d.ts.map +1 -0
- package/dist/bcs/serializer.js +747 -0
- package/dist/bcs/serializer.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +3 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/localNode.d.ts +65 -0
- package/dist/cli/localNode.d.ts.map +1 -0
- package/dist/cli/localNode.js +149 -0
- package/dist/cli/localNode.js.map +1 -0
- package/dist/cli/move.d.ts +250 -0
- package/dist/cli/move.d.ts.map +1 -0
- package/dist/cli/move.js +364 -0
- package/dist/cli/move.js.map +1 -0
- package/dist/client/core.d.ts +37 -0
- package/dist/client/core.d.ts.map +1 -0
- package/dist/client/core.js +116 -0
- package/dist/client/core.js.map +1 -0
- package/dist/client/get.d.ts +119 -0
- package/dist/client/get.d.ts.map +1 -0
- package/dist/client/get.js +165 -0
- package/dist/client/get.js.map +1 -0
- package/dist/client/index.d.ts +4 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +6 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/post.d.ts +155 -0
- package/dist/client/post.d.ts.map +1 -0
- package/dist/client/post.js +151 -0
- package/dist/client/post.js.map +1 -0
- package/dist/core/account/index.d.ts +2 -0
- package/dist/core/account/index.d.ts.map +1 -0
- package/dist/core/account/index.js +2 -0
- package/dist/core/account/index.js.map +1 -0
- package/dist/core/account/utils/address.d.ts +47 -0
- package/dist/core/account/utils/address.d.ts.map +1 -0
- package/dist/core/account/utils/address.js +68 -0
- package/dist/core/account/utils/address.js.map +1 -0
- package/dist/core/account/utils/index.d.ts +2 -0
- package/dist/core/account/utils/index.d.ts.map +1 -0
- package/dist/core/account/utils/index.js +2 -0
- package/dist/core/account/utils/index.js.map +1 -0
- package/dist/core/accountAddress.d.ts +327 -0
- package/dist/core/accountAddress.d.ts.map +1 -0
- package/dist/core/accountAddress.js +457 -0
- package/dist/core/accountAddress.js.map +1 -0
- package/dist/core/authenticationKey.d.ts +129 -0
- package/dist/core/authenticationKey.d.ts.map +1 -0
- package/dist/core/authenticationKey.js +155 -0
- package/dist/core/authenticationKey.js.map +1 -0
- package/dist/core/common.d.ts +51 -0
- package/dist/core/common.d.ts.map +1 -0
- package/dist/core/common.js +30 -0
- package/dist/core/common.js.map +1 -0
- package/dist/core/crypto/abstraction.d.ts +21 -0
- package/dist/core/crypto/abstraction.d.ts.map +1 -0
- package/dist/core/crypto/abstraction.js +37 -0
- package/dist/core/crypto/abstraction.js.map +1 -0
- package/dist/core/crypto/anyKeyRegistry.d.ts +45 -0
- package/dist/core/crypto/anyKeyRegistry.d.ts.map +1 -0
- package/dist/core/crypto/anyKeyRegistry.js +59 -0
- package/dist/core/crypto/anyKeyRegistry.js.map +1 -0
- package/dist/core/crypto/deserializationUtils.d.ts +22 -0
- package/dist/core/crypto/deserializationUtils.d.ts.map +1 -0
- package/dist/core/crypto/deserializationUtils.js +89 -0
- package/dist/core/crypto/deserializationUtils.js.map +1 -0
- package/dist/core/crypto/ed25519.d.ts +330 -0
- package/dist/core/crypto/ed25519.d.ts.map +1 -0
- package/dist/core/crypto/ed25519.js +502 -0
- package/dist/core/crypto/ed25519.js.map +1 -0
- package/dist/core/crypto/encryption/ciphertext.d.ts +49 -0
- package/dist/core/crypto/encryption/ciphertext.d.ts.map +1 -0
- package/dist/core/crypto/encryption/ciphertext.js +166 -0
- package/dist/core/crypto/encryption/ciphertext.js.map +1 -0
- package/dist/core/crypto/encryption/curveSerialization.d.ts +17 -0
- package/dist/core/crypto/encryption/curveSerialization.d.ts.map +1 -0
- package/dist/core/crypto/encryption/curveSerialization.js +38 -0
- package/dist/core/crypto/encryption/curveSerialization.js.map +1 -0
- package/dist/core/crypto/encryption/fieldSerialization.d.ts +12 -0
- package/dist/core/crypto/encryption/fieldSerialization.d.ts.map +1 -0
- package/dist/core/crypto/encryption/fieldSerialization.js +70 -0
- package/dist/core/crypto/encryption/fieldSerialization.js.map +1 -0
- package/dist/core/crypto/encryption/index.d.ts +11 -0
- package/dist/core/crypto/encryption/index.d.ts.map +1 -0
- package/dist/core/crypto/encryption/index.js +13 -0
- package/dist/core/crypto/encryption/index.js.map +1 -0
- package/dist/core/crypto/encryption/symmetric.d.ts +38 -0
- package/dist/core/crypto/encryption/symmetric.d.ts.map +1 -0
- package/dist/core/crypto/encryption/symmetric.js +124 -0
- package/dist/core/crypto/encryption/symmetric.js.map +1 -0
- package/dist/core/crypto/ephemeral.d.ts +112 -0
- package/dist/core/crypto/ephemeral.d.ts.map +1 -0
- package/dist/core/crypto/ephemeral.js +170 -0
- package/dist/core/crypto/ephemeral.js.map +1 -0
- package/dist/core/crypto/federatedKeyless.d.ts +106 -0
- package/dist/core/crypto/federatedKeyless.d.ts.map +1 -0
- package/dist/core/crypto/federatedKeyless.js +125 -0
- package/dist/core/crypto/federatedKeyless.js.map +1 -0
- package/dist/core/crypto/hdKey.d.ts +90 -0
- package/dist/core/crypto/hdKey.d.ts.map +1 -0
- package/dist/core/crypto/hdKey.js +118 -0
- package/dist/core/crypto/hdKey.js.map +1 -0
- package/dist/core/crypto/index.d.ts +13 -0
- package/dist/core/crypto/index.d.ts.map +1 -0
- package/dist/core/crypto/index.js +26 -0
- package/dist/core/crypto/index.js.map +1 -0
- package/dist/core/crypto/keyless.d.ts +788 -0
- package/dist/core/crypto/keyless.d.ts.map +1 -0
- package/dist/core/crypto/keyless.js +1482 -0
- package/dist/core/crypto/keyless.js.map +1 -0
- package/dist/core/crypto/keylessRegistration.d.ts +2 -0
- package/dist/core/crypto/keylessRegistration.d.ts.map +1 -0
- package/dist/core/crypto/keylessRegistration.js +16 -0
- package/dist/core/crypto/keylessRegistration.js.map +1 -0
- package/dist/core/crypto/multiEd25519.d.ts +228 -0
- package/dist/core/crypto/multiEd25519.d.ts.map +1 -0
- package/dist/core/crypto/multiEd25519.js +361 -0
- package/dist/core/crypto/multiEd25519.js.map +1 -0
- package/dist/core/crypto/multiKey.d.ts +248 -0
- package/dist/core/crypto/multiKey.d.ts.map +1 -0
- package/dist/core/crypto/multiKey.js +417 -0
- package/dist/core/crypto/multiKey.js.map +1 -0
- package/dist/core/crypto/poseidon.d.ts +58 -0
- package/dist/core/crypto/poseidon.d.ts.map +1 -0
- package/dist/core/crypto/poseidon.js +196 -0
- package/dist/core/crypto/poseidon.js.map +1 -0
- package/dist/core/crypto/privateKey.d.ts +64 -0
- package/dist/core/crypto/privateKey.d.ts.map +1 -0
- package/dist/core/crypto/privateKey.js +74 -0
- package/dist/core/crypto/privateKey.js.map +1 -0
- package/dist/core/crypto/proof.d.ts +10 -0
- package/dist/core/crypto/proof.d.ts.map +1 -0
- package/dist/core/crypto/proof.js +10 -0
- package/dist/core/crypto/proof.js.map +1 -0
- package/dist/core/crypto/publicKey.d.ts +92 -0
- package/dist/core/crypto/publicKey.d.ts.map +1 -0
- package/dist/core/crypto/publicKey.js +54 -0
- package/dist/core/crypto/publicKey.js.map +1 -0
- package/dist/core/crypto/secp256k1.d.ts +303 -0
- package/dist/core/crypto/secp256k1.d.ts.map +1 -0
- package/dist/core/crypto/secp256k1.js +455 -0
- package/dist/core/crypto/secp256k1.js.map +1 -0
- package/dist/core/crypto/secp256r1.d.ts +304 -0
- package/dist/core/crypto/secp256r1.d.ts.map +1 -0
- package/dist/core/crypto/secp256r1.js +444 -0
- package/dist/core/crypto/secp256r1.js.map +1 -0
- package/dist/core/crypto/signature.d.ts +35 -0
- package/dist/core/crypto/signature.d.ts.map +1 -0
- package/dist/core/crypto/signature.js +55 -0
- package/dist/core/crypto/signature.js.map +1 -0
- package/dist/core/crypto/singleKey.d.ts +175 -0
- package/dist/core/crypto/singleKey.d.ts.map +1 -0
- package/dist/core/crypto/singleKey.js +324 -0
- package/dist/core/crypto/singleKey.js.map +1 -0
- package/dist/core/crypto/types.d.ts +6 -0
- package/dist/core/crypto/types.d.ts.map +1 -0
- package/dist/core/crypto/types.js +2 -0
- package/dist/core/crypto/types.js.map +1 -0
- package/dist/core/crypto/utils.d.ts +16 -0
- package/dist/core/crypto/utils.d.ts.map +1 -0
- package/dist/core/crypto/utils.js +64 -0
- package/dist/core/crypto/utils.js.map +1 -0
- package/dist/core/hex.d.ts +154 -0
- package/dist/core/hex.d.ts.map +1 -0
- package/dist/core/hex.js +219 -0
- package/dist/core/hex.js.map +1 -0
- package/dist/core/index.d.ts +7 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +9 -0
- package/dist/core/index.js.map +1 -0
- package/dist/errors/index.d.ts +125 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +367 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/functions/abstraction.d.ts +4 -0
- package/dist/functions/abstraction.d.ts.map +1 -0
- package/dist/functions/abstraction.js +6 -0
- package/dist/functions/abstraction.js.map +1 -0
- package/dist/functions/account.d.ts +8 -0
- package/dist/functions/account.d.ts.map +1 -0
- package/dist/functions/account.js +10 -0
- package/dist/functions/account.js.map +1 -0
- package/dist/functions/ans.d.ts +4 -0
- package/dist/functions/ans.d.ts.map +1 -0
- package/dist/functions/ans.js +6 -0
- package/dist/functions/ans.js.map +1 -0
- package/dist/functions/coin.d.ts +4 -0
- package/dist/functions/coin.d.ts.map +1 -0
- package/dist/functions/coin.js +6 -0
- package/dist/functions/coin.js.map +1 -0
- package/dist/functions/digitalAsset.d.ts +4 -0
- package/dist/functions/digitalAsset.d.ts.map +1 -0
- package/dist/functions/digitalAsset.js +6 -0
- package/dist/functions/digitalAsset.js.map +1 -0
- package/dist/functions/faucet.d.ts +4 -0
- package/dist/functions/faucet.d.ts.map +1 -0
- package/dist/functions/faucet.js +6 -0
- package/dist/functions/faucet.js.map +1 -0
- package/dist/functions/fungibleAsset.d.ts +4 -0
- package/dist/functions/fungibleAsset.d.ts.map +1 -0
- package/dist/functions/fungibleAsset.js +6 -0
- package/dist/functions/fungibleAsset.js.map +1 -0
- package/dist/functions/general.d.ts +4 -0
- package/dist/functions/general.d.ts.map +1 -0
- package/dist/functions/general.js +6 -0
- package/dist/functions/general.js.map +1 -0
- package/dist/functions/index.d.ts +18 -0
- package/dist/functions/index.d.ts.map +1 -0
- package/dist/functions/index.js +20 -0
- package/dist/functions/index.js.map +1 -0
- package/dist/functions/keyless.d.ts +16 -0
- package/dist/functions/keyless.d.ts.map +1 -0
- package/dist/functions/keyless.js +23 -0
- package/dist/functions/keyless.js.map +1 -0
- package/dist/functions/object.d.ts +4 -0
- package/dist/functions/object.d.ts.map +1 -0
- package/dist/functions/object.js +6 -0
- package/dist/functions/object.js.map +1 -0
- package/dist/functions/staking.d.ts +4 -0
- package/dist/functions/staking.d.ts.map +1 -0
- package/dist/functions/staking.js +6 -0
- package/dist/functions/staking.js.map +1 -0
- package/dist/functions/table.d.ts +4 -0
- package/dist/functions/table.d.ts.map +1 -0
- package/dist/functions/table.js +6 -0
- package/dist/functions/table.js.map +1 -0
- package/dist/functions/transaction.d.ts +5 -0
- package/dist/functions/transaction.d.ts.map +1 -0
- package/dist/functions/transaction.js +7 -0
- package/dist/functions/transaction.js.map +1 -0
- package/dist/functions/view.d.ts +3 -0
- package/dist/functions/view.d.ts.map +1 -0
- package/dist/functions/view.js +5 -0
- package/dist/functions/view.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +29 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/abstraction.d.ts +22 -0
- package/dist/internal/abstraction.d.ts.map +1 -0
- package/dist/internal/abstraction.js +54 -0
- package/dist/internal/abstraction.js.map +1 -0
- package/dist/internal/account.d.ts +457 -0
- package/dist/internal/account.d.ts.map +1 -0
- package/dist/internal/account.js +1164 -0
- package/dist/internal/account.js.map +1 -0
- package/dist/internal/ans.d.ts +414 -0
- package/dist/internal/ans.d.ts.map +1 -0
- package/dist/internal/ans.js +769 -0
- package/dist/internal/ans.js.map +1 -0
- package/dist/internal/coin.d.ts +27 -0
- package/dist/internal/coin.d.ts.map +1 -0
- package/dist/internal/coin.js +36 -0
- package/dist/internal/coin.js.map +1 -0
- package/dist/internal/digitalAsset.d.ts +577 -0
- package/dist/internal/digitalAsset.d.ts.map +1 -0
- package/dist/internal/digitalAsset.js +900 -0
- package/dist/internal/digitalAsset.js.map +1 -0
- package/dist/internal/encryptionKey.d.ts +20 -0
- package/dist/internal/encryptionKey.d.ts.map +1 -0
- package/dist/internal/encryptionKey.js +33 -0
- package/dist/internal/encryptionKey.js.map +1 -0
- package/dist/internal/faucet.d.ts +35 -0
- package/dist/internal/faucet.d.ts.map +1 -0
- package/dist/internal/faucet.js +53 -0
- package/dist/internal/faucet.js.map +1 -0
- package/dist/internal/fungibleAsset.d.ts +108 -0
- package/dist/internal/fungibleAsset.d.ts.map +1 -0
- package/dist/internal/fungibleAsset.js +155 -0
- package/dist/internal/fungibleAsset.js.map +1 -0
- package/dist/internal/general.d.ts +87 -0
- package/dist/internal/general.d.ts.map +1 -0
- package/dist/internal/general.js +136 -0
- package/dist/internal/general.js.map +1 -0
- package/dist/internal/keyless.d.ts +101 -0
- package/dist/internal/keyless.d.ts.map +1 -0
- package/dist/internal/keyless.js +191 -0
- package/dist/internal/keyless.js.map +1 -0
- package/dist/internal/object.d.ts +37 -0
- package/dist/internal/object.d.ts.map +1 -0
- package/dist/internal/object.js +53 -0
- package/dist/internal/object.js.map +1 -0
- package/dist/internal/staking.d.ts +53 -0
- package/dist/internal/staking.d.ts.map +1 -0
- package/dist/internal/staking.js +71 -0
- package/dist/internal/staking.js.map +1 -0
- package/dist/internal/table.d.ts +60 -0
- package/dist/internal/table.d.ts.map +1 -0
- package/dist/internal/table.js +86 -0
- package/dist/internal/table.js.map +1 -0
- package/dist/internal/transaction.d.ts +192 -0
- package/dist/internal/transaction.d.ts.map +1 -0
- package/dist/internal/transaction.js +399 -0
- package/dist/internal/transaction.js.map +1 -0
- package/dist/internal/transactionSubmission.d.ts +177 -0
- package/dist/internal/transactionSubmission.d.ts.map +1 -0
- package/dist/internal/transactionSubmission.js +411 -0
- package/dist/internal/transactionSubmission.js.map +1 -0
- package/dist/internal/utils/index.d.ts +2 -0
- package/dist/internal/utils/index.d.ts.map +1 -0
- package/dist/internal/utils/index.js +4 -0
- package/dist/internal/utils/index.js.map +1 -0
- package/dist/internal/utils/utils.d.ts +35 -0
- package/dist/internal/utils/utils.d.ts.map +1 -0
- package/dist/internal/utils/utils.js +63 -0
- package/dist/internal/utils/utils.js.map +1 -0
- package/dist/internal/view.d.ts +14 -0
- package/dist/internal/view.d.ts.map +1 -0
- package/dist/internal/view.js +41 -0
- package/dist/internal/view.js.map +1 -0
- package/dist/transactions/authenticator/account.d.ts +193 -0
- package/dist/transactions/authenticator/account.d.ts.map +1 -0
- package/dist/transactions/authenticator/account.js +346 -0
- package/dist/transactions/authenticator/account.js.map +1 -0
- package/dist/transactions/authenticator/index.d.ts +3 -0
- package/dist/transactions/authenticator/index.d.ts.map +1 -0
- package/dist/transactions/authenticator/index.js +5 -0
- package/dist/transactions/authenticator/index.js.map +1 -0
- package/dist/transactions/authenticator/transaction.d.ts +148 -0
- package/dist/transactions/authenticator/transaction.d.ts.map +1 -0
- package/dist/transactions/authenticator/transaction.js +239 -0
- package/dist/transactions/authenticator/transaction.js.map +1 -0
- package/dist/transactions/index.d.ts +7 -0
- package/dist/transactions/index.d.ts.map +1 -0
- package/dist/transactions/index.js +9 -0
- package/dist/transactions/index.js.map +1 -0
- package/dist/transactions/instances/chainId.d.ts +39 -0
- package/dist/transactions/instances/chainId.d.ts.map +1 -0
- package/dist/transactions/instances/chainId.js +48 -0
- package/dist/transactions/instances/chainId.js.map +1 -0
- package/dist/transactions/instances/encryptedPayload.d.ts +65 -0
- package/dist/transactions/instances/encryptedPayload.d.ts.map +1 -0
- package/dist/transactions/instances/encryptedPayload.js +122 -0
- package/dist/transactions/instances/encryptedPayload.js.map +1 -0
- package/dist/transactions/instances/identifier.d.ts +40 -0
- package/dist/transactions/instances/identifier.d.ts.map +1 -0
- package/dist/transactions/instances/identifier.js +49 -0
- package/dist/transactions/instances/identifier.js.map +1 -0
- package/dist/transactions/instances/index.d.ts +12 -0
- package/dist/transactions/instances/index.d.ts.map +1 -0
- package/dist/transactions/instances/index.js +14 -0
- package/dist/transactions/instances/index.js.map +1 -0
- package/dist/transactions/instances/moduleId.d.ts +52 -0
- package/dist/transactions/instances/moduleId.d.ts.map +1 -0
- package/dist/transactions/instances/moduleId.js +69 -0
- package/dist/transactions/instances/moduleId.js.map +1 -0
- package/dist/transactions/instances/multiAgentTransaction.d.ts +50 -0
- package/dist/transactions/instances/multiAgentTransaction.d.ts.map +1 -0
- package/dist/transactions/instances/multiAgentTransaction.js +75 -0
- package/dist/transactions/instances/multiAgentTransaction.js.map +1 -0
- package/dist/transactions/instances/rawTransaction.d.ts +142 -0
- package/dist/transactions/instances/rawTransaction.d.ts.map +1 -0
- package/dist/transactions/instances/rawTransaction.js +202 -0
- package/dist/transactions/instances/rawTransaction.js.map +1 -0
- package/dist/transactions/instances/rotationProofChallenge.d.ts +54 -0
- package/dist/transactions/instances/rotationProofChallenge.d.ts.map +1 -0
- package/dist/transactions/instances/rotationProofChallenge.js +70 -0
- package/dist/transactions/instances/rotationProofChallenge.js.map +1 -0
- package/dist/transactions/instances/signedTransaction.d.ts +53 -0
- package/dist/transactions/instances/signedTransaction.d.ts.map +1 -0
- package/dist/transactions/instances/signedTransaction.js +65 -0
- package/dist/transactions/instances/signedTransaction.js.map +1 -0
- package/dist/transactions/instances/simpleTransaction.d.ts +49 -0
- package/dist/transactions/instances/simpleTransaction.d.ts.map +1 -0
- package/dist/transactions/instances/simpleTransaction.js +73 -0
- package/dist/transactions/instances/simpleTransaction.js.map +1 -0
- package/dist/transactions/instances/transactionArgument.d.ts +71 -0
- package/dist/transactions/instances/transactionArgument.d.ts.map +1 -0
- package/dist/transactions/instances/transactionArgument.js +4 -0
- package/dist/transactions/instances/transactionArgument.js.map +1 -0
- package/dist/transactions/instances/transactionPayload.d.ts +369 -0
- package/dist/transactions/instances/transactionPayload.d.ts.map +1 -0
- package/dist/transactions/instances/transactionPayload.js +668 -0
- package/dist/transactions/instances/transactionPayload.js.map +1 -0
- package/dist/transactions/management/accountSequenceNumber.d.ts +114 -0
- package/dist/transactions/management/accountSequenceNumber.d.ts.map +1 -0
- package/dist/transactions/management/accountSequenceNumber.js +197 -0
- package/dist/transactions/management/accountSequenceNumber.js.map +1 -0
- package/dist/transactions/management/asyncQueue.d.ts +76 -0
- package/dist/transactions/management/asyncQueue.d.ts.map +1 -0
- package/dist/transactions/management/asyncQueue.js +105 -0
- package/dist/transactions/management/asyncQueue.js.map +1 -0
- package/dist/transactions/management/index.d.ts +3 -0
- package/dist/transactions/management/index.d.ts.map +1 -0
- package/dist/transactions/management/index.js +3 -0
- package/dist/transactions/management/index.js.map +1 -0
- package/dist/transactions/management/transactionWorker.d.ts +213 -0
- package/dist/transactions/management/transactionWorker.d.ts.map +1 -0
- package/dist/transactions/management/transactionWorker.js +347 -0
- package/dist/transactions/management/transactionWorker.js.map +1 -0
- package/dist/transactions/transactionBuilder/encryptPayload.d.ts +21 -0
- package/dist/transactions/transactionBuilder/encryptPayload.d.ts.map +1 -0
- package/dist/transactions/transactionBuilder/encryptPayload.js +157 -0
- package/dist/transactions/transactionBuilder/encryptPayload.js.map +1 -0
- package/dist/transactions/transactionBuilder/helpers.d.ts +184 -0
- package/dist/transactions/transactionBuilder/helpers.d.ts.map +1 -0
- package/dist/transactions/transactionBuilder/helpers.js +344 -0
- package/dist/transactions/transactionBuilder/helpers.js.map +1 -0
- package/dist/transactions/transactionBuilder/index.d.ts +6 -0
- package/dist/transactions/transactionBuilder/index.d.ts.map +1 -0
- package/dist/transactions/transactionBuilder/index.js +8 -0
- package/dist/transactions/transactionBuilder/index.js.map +1 -0
- package/dist/transactions/transactionBuilder/remoteAbi.d.ts +167 -0
- package/dist/transactions/transactionBuilder/remoteAbi.d.ts.map +1 -0
- package/dist/transactions/transactionBuilder/remoteAbi.js +1088 -0
- package/dist/transactions/transactionBuilder/remoteAbi.js.map +1 -0
- package/dist/transactions/transactionBuilder/signingMessage.d.ts +55 -0
- package/dist/transactions/transactionBuilder/signingMessage.d.ts.map +1 -0
- package/dist/transactions/transactionBuilder/signingMessage.js +94 -0
- package/dist/transactions/transactionBuilder/signingMessage.js.map +1 -0
- package/dist/transactions/transactionBuilder/structEnumParser.d.ts +225 -0
- package/dist/transactions/transactionBuilder/structEnumParser.d.ts.map +1 -0
- package/dist/transactions/transactionBuilder/structEnumParser.js +690 -0
- package/dist/transactions/transactionBuilder/structEnumParser.js.map +1 -0
- package/dist/transactions/transactionBuilder/transactionBuilder.d.ts +198 -0
- package/dist/transactions/transactionBuilder/transactionBuilder.d.ts.map +1 -0
- package/dist/transactions/transactionBuilder/transactionBuilder.js +586 -0
- package/dist/transactions/transactionBuilder/transactionBuilder.js.map +1 -0
- package/dist/transactions/typeTag/index.d.ts +544 -0
- package/dist/transactions/typeTag/index.d.ts.map +1 -0
- package/dist/transactions/typeTag/index.js +826 -0
- package/dist/transactions/typeTag/index.js.map +1 -0
- package/dist/transactions/typeTag/parser.d.ts +73 -0
- package/dist/transactions/typeTag/parser.d.ts.map +1 -0
- package/dist/transactions/typeTag/parser.js +368 -0
- package/dist/transactions/typeTag/parser.js.map +1 -0
- package/dist/transactions/types.d.ts +477 -0
- package/dist/transactions/types.d.ts.map +1 -0
- package/dist/transactions/types.js +4 -0
- package/dist/transactions/types.js.map +1 -0
- package/dist/types/abstraction.d.ts +14 -0
- package/dist/types/abstraction.d.ts.map +1 -0
- package/dist/types/abstraction.js +16 -0
- package/dist/types/abstraction.js.map +1 -0
- package/dist/types/ans.d.ts +113 -0
- package/dist/types/ans.d.ts.map +1 -0
- package/dist/types/ans.js +36 -0
- package/dist/types/ans.js.map +1 -0
- package/dist/types/generated/operations.d.ts +702 -0
- package/dist/types/generated/operations.d.ts.map +1 -0
- package/dist/types/generated/operations.js +2 -0
- package/dist/types/generated/operations.js.map +1 -0
- package/dist/types/generated/queries.d.ts +64 -0
- package/dist/types/generated/queries.d.ts.map +1 -0
- package/dist/types/generated/queries.js +729 -0
- package/dist/types/generated/queries.js.map +1 -0
- package/dist/types/generated/types.d.ts +9678 -0
- package/dist/types/generated/types.d.ts.map +1 -0
- package/dist/types/generated/types.js +1265 -0
- package/dist/types/generated/types.js.map +1 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +4 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/indexer.d.ts +182 -0
- package/dist/types/indexer.d.ts.map +1 -0
- package/dist/types/indexer.js +4 -0
- package/dist/types/indexer.js.map +1 -0
- package/dist/types/keyless.d.ts +101 -0
- package/dist/types/keyless.d.ts.map +1 -0
- package/dist/types/keyless.js +2 -0
- package/dist/types/keyless.js.map +1 -0
- package/dist/types/types.d.ts +1572 -0
- package/dist/types/types.d.ts.map +1 -0
- package/dist/types/types.js +464 -0
- package/dist/types/types.js.map +1 -0
- package/dist/utils/apiEndpoints.d.ts +50 -0
- package/dist/utils/apiEndpoints.d.ts.map +1 -0
- package/dist/utils/apiEndpoints.js +100 -0
- package/dist/utils/apiEndpoints.js.map +1 -0
- package/dist/utils/const.d.ts +117 -0
- package/dist/utils/const.d.ts.map +1 -0
- package/dist/utils/const.js +121 -0
- package/dist/utils/const.js.map +1 -0
- package/dist/utils/helpers.d.ts +203 -0
- package/dist/utils/helpers.d.ts.map +1 -0
- package/dist/utils/helpers.js +330 -0
- package/dist/utils/helpers.js.map +1 -0
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +5 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/memoize.d.ts +47 -0
- package/dist/utils/memoize.d.ts.map +1 -0
- package/dist/utils/memoize.js +195 -0
- package/dist/utils/memoize.js.map +1 -0
- package/dist/utils/normalizeBundle.d.ts +27 -0
- package/dist/utils/normalizeBundle.d.ts.map +1 -0
- package/dist/utils/normalizeBundle.js +18 -0
- package/dist/utils/normalizeBundle.js.map +1 -0
- package/dist/utils/runtime.d.ts +44 -0
- package/dist/utils/runtime.d.ts.map +1 -0
- package/dist/utils/runtime.js +71 -0
- package/dist/utils/runtime.js.map +1 -0
- package/dist/version.d.ts +7 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +9 -0
- package/dist/version.js.map +1 -0
- package/package.json +107 -47
- package/src/account/AbstractKeylessAccount.ts +24 -30
- package/src/account/AbstractedAccount.ts +18 -16
- package/src/account/Account.ts +12 -9
- package/src/account/AccountUtils.ts +17 -20
- package/src/account/DerivableAbstractedAccount.ts +12 -10
- package/src/account/Ed25519Account.ts +8 -8
- package/src/account/EphemeralKeyPair.ts +9 -14
- package/src/account/FederatedKeylessAccount.ts +7 -7
- package/src/account/KeylessAccount.ts +12 -7
- package/src/account/MultiEd25519Account.ts +9 -9
- package/src/account/MultiKeyAccount.ts +15 -16
- package/src/account/SingleKeyAccount.ts +10 -13
- package/src/account/index.ts +17 -12
- package/src/account/keylessSigner.ts +34 -0
- package/src/account/utils.ts +3 -3
- package/src/api/account/abstraction.ts +12 -12
- package/src/api/account.ts +12 -12
- package/src/api/ans.ts +6 -6
- package/src/api/aptos.ts +115 -88
- package/src/api/aptosConfig.ts +6 -4
- package/src/api/coin.ts +6 -6
- package/src/api/digitalAsset.ts +9 -9
- package/src/api/faucet.ts +6 -6
- package/src/api/fungibleAsset.ts +10 -10
- package/src/api/general.ts +7 -7
- package/src/api/index.ts +2 -2
- package/src/api/keyless.ts +11 -7
- package/src/api/object.ts +6 -6
- package/src/api/staking.ts +11 -6
- package/src/api/table.ts +6 -6
- package/src/api/transaction.ts +13 -13
- package/src/api/transactionSubmission/build.ts +6 -6
- package/src/api/transactionSubmission/helpers.ts +2 -2
- package/src/api/transactionSubmission/management.ts +9 -5
- package/src/api/transactionSubmission/sign.ts +4 -4
- package/src/api/transactionSubmission/simulate.ts +6 -6
- package/src/api/transactionSubmission/submit.ts +5 -5
- package/src/api/utils.ts +4 -4
- package/src/bcs/consts.ts +14 -1
- package/src/bcs/deserializer.ts +3 -3
- package/src/bcs/index.ts +6 -6
- package/src/bcs/serializable/entryFunctionBytes.ts +5 -5
- package/src/bcs/serializable/fixedBytes.ts +5 -5
- package/src/bcs/serializable/movePrimitives.ts +14 -5
- package/src/bcs/serializable/moveStructs.ts +8 -8
- package/src/bcs/serializer.ts +6 -6
- package/src/cli/index.ts +2 -2
- package/src/cli/localNode.ts +1 -1
- package/src/cli/move.ts +6 -10
- package/src/client/core.ts +30 -15
- package/src/client/get.ts +6 -8
- package/src/client/index.ts +3 -3
- package/src/client/post.ts +4 -4
- package/src/core/account/index.ts +1 -1
- package/src/core/account/utils/address.ts +4 -4
- package/src/core/account/utils/index.ts +1 -1
- package/src/core/accountAddress.ts +6 -6
- package/src/core/authenticationKey.ts +22 -10
- package/src/core/crypto/abstraction.ts +7 -7
- package/src/core/crypto/anyKeyRegistry.ts +90 -0
- package/src/core/crypto/deserializationUtils.ts +11 -19
- package/src/core/crypto/ed25519.ts +22 -13
- package/src/core/crypto/encryption/ciphertext.ts +210 -0
- package/src/core/crypto/encryption/curveSerialization.ts +46 -0
- package/src/core/crypto/encryption/fieldSerialization.ts +82 -0
- package/src/core/crypto/encryption/index.ts +14 -0
- package/src/core/crypto/encryption/symmetric.ts +148 -0
- package/src/core/crypto/ephemeral.ts +7 -7
- package/src/core/crypto/federatedKeyless.ts +8 -8
- package/src/core/crypto/hdKey.ts +7 -3
- package/src/core/crypto/index.ts +24 -17
- package/src/core/crypto/keyless.ts +33 -33
- package/src/core/crypto/keylessRegistration.ts +34 -0
- package/src/core/crypto/multiEd25519.ts +7 -7
- package/src/core/crypto/multiKey.ts +8 -8
- package/src/core/crypto/poseidon.ts +2 -2
- package/src/core/crypto/privateKey.ts +5 -5
- package/src/core/crypto/proof.ts +1 -1
- package/src/core/crypto/publicKey.ts +6 -6
- package/src/core/crypto/secp256k1.ts +26 -19
- package/src/core/crypto/secp256r1.ts +26 -19
- package/src/core/crypto/signature.ts +2 -2
- package/src/core/crypto/singleKey.ts +58 -39
- package/src/core/crypto/types.ts +4 -4
- package/src/core/crypto/utils.ts +16 -12
- package/src/core/hex.ts +3 -3
- package/src/core/index.ts +6 -6
- package/src/errors/index.ts +3 -3
- package/src/functions/abstraction.ts +11 -0
- package/src/functions/account.ts +38 -0
- package/src/functions/ans.ts +26 -0
- package/src/functions/coin.ts +7 -0
- package/src/functions/digitalAsset.ts +32 -0
- package/src/functions/faucet.ts +7 -0
- package/src/functions/fungibleAsset.ts +13 -0
- package/src/functions/general.ts +14 -0
- package/src/functions/index.ts +21 -0
- package/src/functions/keyless.ts +42 -0
- package/src/functions/object.ts +10 -0
- package/src/functions/staking.ts +11 -0
- package/src/functions/table.ts +11 -0
- package/src/functions/transaction.ts +32 -0
- package/src/functions/view.ts +6 -0
- package/src/index.ts +36 -10
- package/src/internal/abstraction.ts +10 -10
- package/src/internal/account.ts +79 -51
- package/src/internal/ans.ts +31 -24
- package/src/internal/coin.ts +8 -8
- package/src/internal/digitalAsset.ts +14 -15
- package/src/internal/encryptionKey.ts +53 -0
- package/src/internal/faucet.ts +6 -6
- package/src/internal/fungibleAsset.ts +11 -11
- package/src/internal/general.ts +12 -7
- package/src/internal/keyless.ts +21 -18
- package/src/internal/object.ts +7 -7
- package/src/internal/staking.ts +6 -6
- package/src/internal/table.ts +7 -7
- package/src/internal/transaction.ts +11 -10
- package/src/internal/transactionSubmission.ts +92 -32
- package/src/internal/utils/index.ts +1 -1
- package/src/internal/utils/utils.ts +5 -5
- package/src/internal/view.ts +5 -5
- package/src/transactions/authenticator/account.ts +12 -12
- package/src/transactions/authenticator/index.ts +2 -2
- package/src/transactions/authenticator/transaction.ts +6 -6
- package/src/transactions/index.ts +6 -6
- package/src/transactions/instances/chainId.ts +2 -2
- package/src/transactions/instances/encryptedPayload.ts +149 -0
- package/src/transactions/instances/identifier.ts +2 -2
- package/src/transactions/instances/index.ts +11 -10
- package/src/transactions/instances/moduleId.ts +5 -5
- package/src/transactions/instances/multiAgentTransaction.ts +4 -4
- package/src/transactions/instances/rawTransaction.ts +6 -6
- package/src/transactions/instances/rotationProofChallenge.ts +5 -5
- package/src/transactions/instances/signedTransaction.ts +4 -4
- package/src/transactions/instances/simpleTransaction.ts +4 -4
- package/src/transactions/instances/transactionArgument.ts +2 -2
- package/src/transactions/instances/transactionPayload.ts +127 -28
- package/src/transactions/management/accountSequenceNumber.ts +13 -14
- package/src/transactions/management/index.ts +2 -2
- package/src/transactions/management/transactionWorker.ts +10 -10
- package/src/transactions/transactionBuilder/encryptPayload.ts +235 -0
- package/src/transactions/transactionBuilder/helpers.ts +8 -5
- package/src/transactions/transactionBuilder/index.ts +5 -4
- package/src/transactions/transactionBuilder/remoteAbi.ts +664 -25
- package/src/transactions/transactionBuilder/signingMessage.ts +6 -6
- package/src/transactions/transactionBuilder/structEnumParser.ts +848 -0
- package/src/transactions/transactionBuilder/transactionBuilder.ts +130 -72
- package/src/transactions/typeTag/index.ts +5 -5
- package/src/transactions/typeTag/parser.ts +3 -3
- package/src/transactions/types.ts +103 -19
- package/src/types/ans.ts +13 -5
- package/src/types/generated/operations.ts +4 -3
- package/src/types/generated/queries.ts +1 -1
- package/src/types/index.ts +3 -3
- package/src/types/indexer.ts +1 -1
- package/src/types/types.ts +74 -6
- package/src/utils/const.ts +14 -1
- package/src/utils/helpers.ts +58 -18
- package/src/utils/index.ts +4 -4
- package/src/utils/normalizeBundle.ts +1 -1
- package/src/utils/runtime.ts +86 -0
- package/src/version.ts +1 -1
- package/dist/common/account-2FUAPVPW.d.ts +0 -8167
- package/dist/common/chunk-L5DUJTE3.js +0 -4
- package/dist/common/chunk-L5DUJTE3.js.map +0 -1
- package/dist/common/cli/index.d.ts +0 -316
- package/dist/common/cli/index.js +0 -2
- package/dist/common/cli/index.js.map +0 -1
- package/dist/common/index.d.ts +0 -10912
- package/dist/common/index.js +0 -476
- package/dist/common/index.js.map +0 -1
- package/dist/esm/Ed25519Account-DpZh3fRy.d.mts +0 -628
- package/dist/esm/account/AbstractKeylessAccount.d.mts +0 -336
- package/dist/esm/account/AbstractKeylessAccount.mjs +0 -2
- package/dist/esm/account/AbstractKeylessAccount.mjs.map +0 -1
- package/dist/esm/account/AbstractedAccount.d.mts +0 -64
- package/dist/esm/account/AbstractedAccount.mjs +0 -2
- package/dist/esm/account/AbstractedAccount.mjs.map +0 -1
- package/dist/esm/account/Account.d.mts +0 -8
- package/dist/esm/account/Account.mjs +0 -2
- package/dist/esm/account/Account.mjs.map +0 -1
- package/dist/esm/account/AccountUtils.d.mts +0 -38
- package/dist/esm/account/AccountUtils.mjs +0 -2
- package/dist/esm/account/AccountUtils.mjs.map +0 -1
- package/dist/esm/account/DerivableAbstractedAccount.d.mts +0 -59
- package/dist/esm/account/DerivableAbstractedAccount.mjs +0 -2
- package/dist/esm/account/DerivableAbstractedAccount.mjs.map +0 -1
- package/dist/esm/account/Ed25519Account.d.mts +0 -8
- package/dist/esm/account/Ed25519Account.mjs +0 -2
- package/dist/esm/account/Ed25519Account.mjs.map +0 -1
- package/dist/esm/account/EphemeralKeyPair.d.mts +0 -165
- package/dist/esm/account/EphemeralKeyPair.mjs +0 -2
- package/dist/esm/account/EphemeralKeyPair.mjs.map +0 -1
- package/dist/esm/account/FederatedKeylessAccount.d.mts +0 -118
- package/dist/esm/account/FederatedKeylessAccount.mjs +0 -2
- package/dist/esm/account/FederatedKeylessAccount.mjs.map +0 -1
- package/dist/esm/account/KeylessAccount.d.mts +0 -124
- package/dist/esm/account/KeylessAccount.mjs +0 -2
- package/dist/esm/account/KeylessAccount.mjs.map +0 -1
- package/dist/esm/account/MultiEd25519Account.d.mts +0 -102
- package/dist/esm/account/MultiEd25519Account.mjs +0 -2
- package/dist/esm/account/MultiEd25519Account.mjs.map +0 -1
- package/dist/esm/account/MultiKeyAccount.d.mts +0 -206
- package/dist/esm/account/MultiKeyAccount.mjs +0 -2
- package/dist/esm/account/MultiKeyAccount.mjs.map +0 -1
- package/dist/esm/account/SingleKeyAccount.d.mts +0 -8
- package/dist/esm/account/SingleKeyAccount.mjs +0 -2
- package/dist/esm/account/SingleKeyAccount.mjs.map +0 -1
- package/dist/esm/account/index.d.mts +0 -24
- package/dist/esm/account/index.mjs +0 -2
- package/dist/esm/account/index.mjs.map +0 -1
- package/dist/esm/account/utils.d.mts +0 -14
- package/dist/esm/account/utils.mjs +0 -2
- package/dist/esm/account/utils.mjs.map +0 -1
- package/dist/esm/account-sIOs_9XJ.d.mts +0 -7369
- package/dist/esm/api/account/abstraction.d.mts +0 -181
- package/dist/esm/api/account/abstraction.mjs +0 -2
- package/dist/esm/api/account/abstraction.mjs.map +0 -1
- package/dist/esm/api/account.d.mts +0 -852
- package/dist/esm/api/account.mjs +0 -2
- package/dist/esm/api/account.mjs.map +0 -1
- package/dist/esm/api/ans.d.mts +0 -570
- package/dist/esm/api/ans.mjs +0 -2
- package/dist/esm/api/ans.mjs.map +0 -1
- package/dist/esm/api/aptos.d.mts +0 -114
- package/dist/esm/api/aptos.mjs +0 -2
- package/dist/esm/api/aptos.mjs.map +0 -1
- package/dist/esm/api/aptosConfig.d.mts +0 -7
- package/dist/esm/api/aptosConfig.mjs +0 -2
- package/dist/esm/api/aptosConfig.mjs.map +0 -1
- package/dist/esm/api/coin.d.mts +0 -81
- package/dist/esm/api/coin.mjs +0 -2
- package/dist/esm/api/coin.mjs.map +0 -1
- package/dist/esm/api/digitalAsset.d.mts +0 -1030
- package/dist/esm/api/digitalAsset.mjs +0 -2
- package/dist/esm/api/digitalAsset.mjs.map +0 -1
- package/dist/esm/api/faucet.d.mts +0 -80
- package/dist/esm/api/faucet.mjs +0 -2
- package/dist/esm/api/faucet.mjs.map +0 -1
- package/dist/esm/api/fungibleAsset.d.mts +0 -288
- package/dist/esm/api/fungibleAsset.mjs +0 -2
- package/dist/esm/api/fungibleAsset.mjs.map +0 -1
- package/dist/esm/api/general.d.mts +0 -303
- package/dist/esm/api/general.mjs +0 -2
- package/dist/esm/api/general.mjs.map +0 -1
- package/dist/esm/api/index.d.mts +0 -47
- package/dist/esm/api/index.mjs +0 -2
- package/dist/esm/api/index.mjs.map +0 -1
- package/dist/esm/api/keyless.d.mts +0 -170
- package/dist/esm/api/keyless.mjs +0 -2
- package/dist/esm/api/keyless.mjs.map +0 -1
- package/dist/esm/api/object.d.mts +0 -80
- package/dist/esm/api/object.mjs +0 -2
- package/dist/esm/api/object.mjs.map +0 -1
- package/dist/esm/api/staking.d.mts +0 -134
- package/dist/esm/api/staking.mjs +0 -2
- package/dist/esm/api/staking.mjs.map +0 -1
- package/dist/esm/api/table.d.mts +0 -169
- package/dist/esm/api/table.mjs +0 -2
- package/dist/esm/api/table.mjs.map +0 -1
- package/dist/esm/api/transaction.d.mts +0 -681
- package/dist/esm/api/transaction.mjs +0 -2
- package/dist/esm/api/transaction.mjs.map +0 -1
- package/dist/esm/api/transactionSubmission/build.d.mts +0 -141
- package/dist/esm/api/transactionSubmission/build.mjs +0 -2
- package/dist/esm/api/transactionSubmission/build.mjs.map +0 -1
- package/dist/esm/api/transactionSubmission/helpers.d.mts +0 -98
- package/dist/esm/api/transactionSubmission/helpers.mjs +0 -2
- package/dist/esm/api/transactionSubmission/helpers.mjs.map +0 -1
- package/dist/esm/api/transactionSubmission/management.d.mts +0 -168
- package/dist/esm/api/transactionSubmission/management.mjs +0 -2
- package/dist/esm/api/transactionSubmission/management.mjs.map +0 -1
- package/dist/esm/api/transactionSubmission/sign.d.mts +0 -124
- package/dist/esm/api/transactionSubmission/sign.mjs +0 -2
- package/dist/esm/api/transactionSubmission/sign.mjs.map +0 -1
- package/dist/esm/api/transactionSubmission/simulate.d.mts +0 -181
- package/dist/esm/api/transactionSubmission/simulate.mjs +0 -2
- package/dist/esm/api/transactionSubmission/simulate.mjs.map +0 -1
- package/dist/esm/api/transactionSubmission/submit.d.mts +0 -142
- package/dist/esm/api/transactionSubmission/submit.mjs +0 -2
- package/dist/esm/api/transactionSubmission/submit.mjs.map +0 -1
- package/dist/esm/api/utils.d.mts +0 -45
- package/dist/esm/api/utils.mjs +0 -2
- package/dist/esm/api/utils.mjs.map +0 -1
- package/dist/esm/bcs/consts.d.mts +0 -28
- package/dist/esm/bcs/consts.mjs +0 -2
- package/dist/esm/bcs/consts.mjs.map +0 -1
- package/dist/esm/bcs/deserializer.d.mts +0 -7
- package/dist/esm/bcs/deserializer.mjs +0 -2
- package/dist/esm/bcs/deserializer.mjs.map +0 -1
- package/dist/esm/bcs/index.d.mts +0 -8
- package/dist/esm/bcs/index.mjs +0 -2
- package/dist/esm/bcs/index.mjs.map +0 -1
- package/dist/esm/bcs/serializable/entryFunctionBytes.d.mts +0 -65
- package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +0 -2
- package/dist/esm/bcs/serializable/entryFunctionBytes.mjs.map +0 -1
- package/dist/esm/bcs/serializable/fixedBytes.d.mts +0 -7
- package/dist/esm/bcs/serializable/fixedBytes.mjs +0 -2
- package/dist/esm/bcs/serializable/fixedBytes.mjs.map +0 -1
- package/dist/esm/bcs/serializable/movePrimitives.d.mts +0 -7
- package/dist/esm/bcs/serializable/movePrimitives.mjs +0 -2
- package/dist/esm/bcs/serializable/movePrimitives.mjs.map +0 -1
- package/dist/esm/bcs/serializable/moveStructs.d.mts +0 -7
- package/dist/esm/bcs/serializable/moveStructs.mjs +0 -2
- package/dist/esm/bcs/serializable/moveStructs.mjs.map +0 -1
- package/dist/esm/bcs/serializer.d.mts +0 -7
- package/dist/esm/bcs/serializer.mjs +0 -2
- package/dist/esm/bcs/serializer.mjs.map +0 -1
- package/dist/esm/chunk-226FBOWQ.mjs +0 -2
- package/dist/esm/chunk-226FBOWQ.mjs.map +0 -1
- package/dist/esm/chunk-2DQRUJUC.mjs +0 -2
- package/dist/esm/chunk-2DQRUJUC.mjs.map +0 -1
- package/dist/esm/chunk-2EBXCCLB.mjs +0 -2
- package/dist/esm/chunk-2EBXCCLB.mjs.map +0 -1
- package/dist/esm/chunk-2YA4KQUV.mjs +0 -2
- package/dist/esm/chunk-2YA4KQUV.mjs.map +0 -1
- package/dist/esm/chunk-3ZC6F5SJ.mjs +0 -2
- package/dist/esm/chunk-3ZC6F5SJ.mjs.map +0 -1
- package/dist/esm/chunk-44MMFX5F.mjs +0 -2
- package/dist/esm/chunk-44MMFX5F.mjs.map +0 -1
- package/dist/esm/chunk-4KEZEYCV.mjs +0 -2
- package/dist/esm/chunk-4KEZEYCV.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-4WPQQPUF.mjs +0 -1
- package/dist/esm/chunk-4WPQQPUF.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-6T2OBPIF.mjs +0 -4
- package/dist/esm/chunk-6T2OBPIF.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-A5H5VKUI.mjs +0 -2
- package/dist/esm/chunk-A5H5VKUI.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-C3Q23D22.mjs +0 -2
- package/dist/esm/chunk-C3Q23D22.mjs.map +0 -1
- package/dist/esm/chunk-DE5K76I2.mjs +0 -1
- package/dist/esm/chunk-DE5K76I2.mjs.map +0 -1
- package/dist/esm/chunk-DPHBSAZQ.mjs +0 -2
- package/dist/esm/chunk-DPHBSAZQ.mjs.map +0 -1
- package/dist/esm/chunk-F45HI7LU.mjs +0 -2
- package/dist/esm/chunk-F45HI7LU.mjs.map +0 -1
- package/dist/esm/chunk-F4RJMSAW.mjs +0 -2
- package/dist/esm/chunk-F4RJMSAW.mjs.map +0 -1
- package/dist/esm/chunk-FAOLAKLJ.mjs +0 -2
- package/dist/esm/chunk-FAOLAKLJ.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-G5OONGWS.mjs +0 -488
- package/dist/esm/chunk-G5OONGWS.mjs.map +0 -1
- package/dist/esm/chunk-GJYLYE6R.mjs +0 -2
- package/dist/esm/chunk-GJYLYE6R.mjs.map +0 -1
- package/dist/esm/chunk-GYYSHYO5.mjs +0 -2
- package/dist/esm/chunk-GYYSHYO5.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-IEW452EO.mjs +0 -7
- package/dist/esm/chunk-IEW452EO.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-ITZN23GU.mjs +0 -2
- package/dist/esm/chunk-ITZN23GU.mjs.map +0 -1
- package/dist/esm/chunk-IZF6POVR.mjs +0 -4
- package/dist/esm/chunk-IZF6POVR.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-KKPH2JUV.mjs +0 -2
- package/dist/esm/chunk-KKPH2JUV.mjs.map +0 -1
- package/dist/esm/chunk-LVZ7QMUH.mjs +0 -2
- package/dist/esm/chunk-LVZ7QMUH.mjs.map +0 -1
- package/dist/esm/chunk-M65PXVDO.mjs +0 -2
- package/dist/esm/chunk-M65PXVDO.mjs.map +0 -1
- package/dist/esm/chunk-MKTR4U2R.mjs +0 -2
- package/dist/esm/chunk-MKTR4U2R.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-NHRPXEUE.mjs +0 -2
- package/dist/esm/chunk-NHRPXEUE.mjs.map +0 -1
- package/dist/esm/chunk-NNXTS2GB.mjs +0 -2
- package/dist/esm/chunk-NNXTS2GB.mjs.map +0 -1
- package/dist/esm/chunk-NP2IAUME.mjs +0 -2
- package/dist/esm/chunk-NP2IAUME.mjs.map +0 -1
- package/dist/esm/chunk-NPWYZVHE.mjs +0 -2
- package/dist/esm/chunk-NPWYZVHE.mjs.map +0 -1
- package/dist/esm/chunk-NTMFADQ7.mjs +0 -2
- package/dist/esm/chunk-NTMFADQ7.mjs.map +0 -1
- package/dist/esm/chunk-ODNZJSOC.mjs +0 -2
- package/dist/esm/chunk-ODNZJSOC.mjs.map +0 -1
- package/dist/esm/chunk-P5HCJN3A.mjs +0 -2
- package/dist/esm/chunk-P5HCJN3A.mjs.map +0 -1
- package/dist/esm/chunk-Q5ESW36C.mjs +0 -2
- package/dist/esm/chunk-Q5ESW36C.mjs.map +0 -1
- package/dist/esm/chunk-QE5MOGUI.mjs +0 -2
- package/dist/esm/chunk-QE5MOGUI.mjs.map +0 -1
- package/dist/esm/chunk-RB2GC7FW.mjs +0 -2
- package/dist/esm/chunk-RB2GC7FW.mjs.map +0 -1
- package/dist/esm/chunk-RUKFK3OC.mjs +0 -2
- package/dist/esm/chunk-RUKFK3OC.mjs.map +0 -1
- package/dist/esm/chunk-RYCI4VKO.mjs +0 -2
- package/dist/esm/chunk-RYCI4VKO.mjs.map +0 -1
- package/dist/esm/chunk-RZNP3WG4.mjs +0 -2
- package/dist/esm/chunk-RZNP3WG4.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-TAHLOBRG.mjs +0 -2
- package/dist/esm/chunk-TAHLOBRG.mjs.map +0 -1
- package/dist/esm/chunk-TBIK7DML.mjs +0 -2
- package/dist/esm/chunk-TBIK7DML.mjs.map +0 -1
- package/dist/esm/chunk-UVJW4DPP.mjs +0 -2
- package/dist/esm/chunk-UVJW4DPP.mjs.map +0 -1
- package/dist/esm/chunk-UVNAHETD.mjs +0 -2
- package/dist/esm/chunk-UVNAHETD.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-WOPHK7LB.mjs +0 -2
- package/dist/esm/chunk-WOPHK7LB.mjs.map +0 -1
- package/dist/esm/chunk-WZZ7PJ3X.mjs +0 -2
- package/dist/esm/chunk-WZZ7PJ3X.mjs.map +0 -1
- package/dist/esm/chunk-X2TPNKLV.mjs +0 -2
- package/dist/esm/chunk-X2TPNKLV.mjs.map +0 -1
- package/dist/esm/chunk-ZOSOF6ST.mjs +0 -2
- package/dist/esm/chunk-ZOSOF6ST.mjs.map +0 -1
- package/dist/esm/chunk-ZP4DWSQA.mjs +0 -2
- package/dist/esm/chunk-ZP4DWSQA.mjs.map +0 -1
- package/dist/esm/cli/index.d.mts +0 -10
- package/dist/esm/cli/index.mjs +0 -2
- package/dist/esm/cli/index.mjs.map +0 -1
- package/dist/esm/cli/localNode.d.mts +0 -67
- package/dist/esm/cli/localNode.mjs +0 -2
- package/dist/esm/cli/localNode.mjs.map +0 -1
- package/dist/esm/cli/move.d.mts +0 -257
- package/dist/esm/cli/move.mjs +0 -2
- package/dist/esm/cli/move.mjs.map +0 -1
- package/dist/esm/client/core.d.mts +0 -43
- package/dist/esm/client/core.mjs +0 -2
- package/dist/esm/client/core.mjs.map +0 -1
- package/dist/esm/client/get.d.mts +0 -125
- package/dist/esm/client/get.mjs +0 -2
- package/dist/esm/client/get.mjs.map +0 -1
- package/dist/esm/client/index.d.mts +0 -10
- package/dist/esm/client/index.mjs +0 -2
- package/dist/esm/client/index.mjs.map +0 -1
- package/dist/esm/client/post.d.mts +0 -161
- package/dist/esm/client/post.mjs +0 -2
- package/dist/esm/client/post.mjs.map +0 -1
- package/dist/esm/core/account/index.d.mts +0 -8
- package/dist/esm/core/account/index.mjs +0 -2
- package/dist/esm/core/account/index.mjs.map +0 -1
- package/dist/esm/core/account/utils/address.d.mts +0 -55
- package/dist/esm/core/account/utils/address.mjs +0 -2
- package/dist/esm/core/account/utils/address.mjs.map +0 -1
- package/dist/esm/core/account/utils/index.d.mts +0 -8
- package/dist/esm/core/account/utils/index.mjs +0 -2
- package/dist/esm/core/account/utils/index.mjs.map +0 -1
- package/dist/esm/core/accountAddress.d.mts +0 -7
- package/dist/esm/core/accountAddress.mjs +0 -2
- package/dist/esm/core/accountAddress.mjs.map +0 -1
- package/dist/esm/core/authenticationKey.d.mts +0 -7
- package/dist/esm/core/authenticationKey.mjs +0 -2
- package/dist/esm/core/authenticationKey.mjs.map +0 -1
- package/dist/esm/core/common.d.mts +0 -52
- package/dist/esm/core/common.mjs +0 -2
- package/dist/esm/core/common.mjs.map +0 -1
- package/dist/esm/core/crypto/abstraction.d.mts +0 -24
- package/dist/esm/core/crypto/abstraction.mjs +0 -2
- package/dist/esm/core/crypto/abstraction.mjs.map +0 -1
- package/dist/esm/core/crypto/deserializationUtils.d.mts +0 -28
- package/dist/esm/core/crypto/deserializationUtils.mjs +0 -2
- package/dist/esm/core/crypto/deserializationUtils.mjs.map +0 -1
- package/dist/esm/core/crypto/ed25519.d.mts +0 -7
- package/dist/esm/core/crypto/ed25519.mjs +0 -2
- package/dist/esm/core/crypto/ed25519.mjs.map +0 -1
- package/dist/esm/core/crypto/ephemeral.d.mts +0 -116
- package/dist/esm/core/crypto/ephemeral.mjs +0 -2
- package/dist/esm/core/crypto/ephemeral.mjs.map +0 -1
- package/dist/esm/core/crypto/federatedKeyless.d.mts +0 -13
- package/dist/esm/core/crypto/federatedKeyless.mjs +0 -2
- package/dist/esm/core/crypto/federatedKeyless.mjs.map +0 -1
- package/dist/esm/core/crypto/hdKey.d.mts +0 -95
- package/dist/esm/core/crypto/hdKey.mjs +0 -2
- package/dist/esm/core/crypto/hdKey.mjs.map +0 -1
- package/dist/esm/core/crypto/index.d.mts +0 -19
- package/dist/esm/core/crypto/index.mjs +0 -2
- package/dist/esm/core/crypto/index.mjs.map +0 -1
- package/dist/esm/core/crypto/keyless.d.mts +0 -13
- package/dist/esm/core/crypto/keyless.mjs +0 -2
- package/dist/esm/core/crypto/keyless.mjs.map +0 -1
- package/dist/esm/core/crypto/multiEd25519.d.mts +0 -7
- package/dist/esm/core/crypto/multiEd25519.mjs +0 -2
- package/dist/esm/core/crypto/multiEd25519.mjs.map +0 -1
- package/dist/esm/core/crypto/multiKey.d.mts +0 -7
- package/dist/esm/core/crypto/multiKey.mjs +0 -2
- package/dist/esm/core/crypto/multiKey.mjs.map +0 -1
- package/dist/esm/core/crypto/poseidon.d.mts +0 -59
- package/dist/esm/core/crypto/poseidon.mjs +0 -2
- package/dist/esm/core/crypto/poseidon.mjs.map +0 -1
- package/dist/esm/core/crypto/privateKey.d.mts +0 -7
- package/dist/esm/core/crypto/privateKey.mjs +0 -2
- package/dist/esm/core/crypto/privateKey.mjs.map +0 -1
- package/dist/esm/core/crypto/proof.d.mts +0 -18
- package/dist/esm/core/crypto/proof.mjs +0 -2
- package/dist/esm/core/crypto/proof.mjs.map +0 -1
- package/dist/esm/core/crypto/publicKey.d.mts +0 -7
- package/dist/esm/core/crypto/publicKey.mjs +0 -2
- package/dist/esm/core/crypto/publicKey.mjs.map +0 -1
- package/dist/esm/core/crypto/secp256k1.d.mts +0 -7
- package/dist/esm/core/crypto/secp256k1.mjs +0 -2
- package/dist/esm/core/crypto/secp256k1.mjs.map +0 -1
- package/dist/esm/core/crypto/secp256r1.d.mts +0 -306
- package/dist/esm/core/crypto/secp256r1.mjs +0 -2
- package/dist/esm/core/crypto/secp256r1.mjs.map +0 -1
- package/dist/esm/core/crypto/signature.d.mts +0 -7
- package/dist/esm/core/crypto/signature.mjs +0 -2
- package/dist/esm/core/crypto/signature.mjs.map +0 -1
- package/dist/esm/core/crypto/singleKey.d.mts +0 -7
- package/dist/esm/core/crypto/singleKey.mjs +0 -2
- package/dist/esm/core/crypto/singleKey.mjs.map +0 -1
- package/dist/esm/core/crypto/types.d.mts +0 -11
- package/dist/esm/core/crypto/types.mjs +0 -2
- package/dist/esm/core/crypto/types.mjs.map +0 -1
- package/dist/esm/core/crypto/utils.d.mts +0 -23
- package/dist/esm/core/crypto/utils.mjs +0 -2
- package/dist/esm/core/crypto/utils.mjs.map +0 -1
- package/dist/esm/core/hex.d.mts +0 -7
- package/dist/esm/core/hex.mjs +0 -2
- package/dist/esm/core/hex.mjs.map +0 -1
- package/dist/esm/core/index.d.mts +0 -20
- package/dist/esm/core/index.mjs +0 -2
- package/dist/esm/core/index.mjs.map +0 -1
- package/dist/esm/errors/index.d.mts +0 -131
- package/dist/esm/errors/index.mjs +0 -2
- package/dist/esm/errors/index.mjs.map +0 -1
- package/dist/esm/federatedKeyless-Cuo0IGJ6.d.mts +0 -880
- package/dist/esm/index.d.mts +0 -72
- package/dist/esm/index.mjs +0 -2
- package/dist/esm/index.mjs.map +0 -1
- package/dist/esm/internal/abstraction.d.mts +0 -27
- package/dist/esm/internal/abstraction.mjs +0 -2
- package/dist/esm/internal/abstraction.mjs.map +0 -1
- package/dist/esm/internal/account.d.mts +0 -453
- package/dist/esm/internal/account.mjs +0 -2
- package/dist/esm/internal/account.mjs.map +0 -1
- package/dist/esm/internal/ans.d.mts +0 -417
- package/dist/esm/internal/ans.mjs +0 -2
- package/dist/esm/internal/ans.mjs.map +0 -1
- package/dist/esm/internal/coin.d.mts +0 -31
- package/dist/esm/internal/coin.mjs +0 -2
- package/dist/esm/internal/coin.mjs.map +0 -1
- package/dist/esm/internal/digitalAsset.d.mts +0 -580
- package/dist/esm/internal/digitalAsset.mjs +0 -2
- package/dist/esm/internal/digitalAsset.mjs.map +0 -1
- package/dist/esm/internal/faucet.d.mts +0 -42
- package/dist/esm/internal/faucet.mjs +0 -2
- package/dist/esm/internal/faucet.mjs.map +0 -1
- package/dist/esm/internal/fungibleAsset.d.mts +0 -112
- package/dist/esm/internal/fungibleAsset.mjs +0 -2
- package/dist/esm/internal/fungibleAsset.mjs.map +0 -1
- package/dist/esm/internal/general.d.mts +0 -94
- package/dist/esm/internal/general.mjs +0 -2
- package/dist/esm/internal/general.mjs.map +0 -1
- package/dist/esm/internal/keyless.d.mts +0 -111
- package/dist/esm/internal/keyless.mjs +0 -2
- package/dist/esm/internal/keyless.mjs.map +0 -1
- package/dist/esm/internal/object.d.mts +0 -42
- package/dist/esm/internal/object.mjs +0 -2
- package/dist/esm/internal/object.mjs.map +0 -1
- package/dist/esm/internal/staking.d.mts +0 -60
- package/dist/esm/internal/staking.mjs +0 -2
- package/dist/esm/internal/staking.mjs.map +0 -1
- package/dist/esm/internal/table.d.mts +0 -66
- package/dist/esm/internal/table.mjs +0 -2
- package/dist/esm/internal/table.mjs.map +0 -1
- package/dist/esm/internal/transaction.d.mts +0 -199
- package/dist/esm/internal/transaction.mjs +0 -2
- package/dist/esm/internal/transaction.mjs.map +0 -1
- package/dist/esm/internal/transactionSubmission.d.mts +0 -165
- package/dist/esm/internal/transactionSubmission.mjs +0 -2
- package/dist/esm/internal/transactionSubmission.mjs.map +0 -1
- package/dist/esm/internal/utils/index.d.mts +0 -8
- package/dist/esm/internal/utils/index.mjs +0 -2
- package/dist/esm/internal/utils/index.mjs.map +0 -1
- package/dist/esm/internal/utils/utils.d.mts +0 -41
- package/dist/esm/internal/utils/utils.mjs +0 -2
- package/dist/esm/internal/utils/utils.mjs.map +0 -1
- package/dist/esm/internal/view.d.mts +0 -20
- package/dist/esm/internal/view.mjs +0 -2
- package/dist/esm/internal/view.mjs.map +0 -1
- package/dist/esm/transactions/authenticator/account.d.mts +0 -7
- package/dist/esm/transactions/authenticator/account.mjs +0 -2
- package/dist/esm/transactions/authenticator/account.mjs.map +0 -1
- package/dist/esm/transactions/authenticator/index.d.mts +0 -8
- package/dist/esm/transactions/authenticator/index.mjs +0 -2
- package/dist/esm/transactions/authenticator/index.mjs.map +0 -1
- package/dist/esm/transactions/authenticator/transaction.d.mts +0 -152
- package/dist/esm/transactions/authenticator/transaction.mjs +0 -2
- package/dist/esm/transactions/authenticator/transaction.mjs.map +0 -1
- package/dist/esm/transactions/index.d.mts +0 -15
- package/dist/esm/transactions/index.mjs +0 -2
- package/dist/esm/transactions/index.mjs.map +0 -1
- package/dist/esm/transactions/instances/chainId.d.mts +0 -7
- package/dist/esm/transactions/instances/chainId.mjs +0 -2
- package/dist/esm/transactions/instances/chainId.mjs.map +0 -1
- package/dist/esm/transactions/instances/identifier.d.mts +0 -7
- package/dist/esm/transactions/instances/identifier.mjs +0 -2
- package/dist/esm/transactions/instances/identifier.mjs.map +0 -1
- package/dist/esm/transactions/instances/index.d.mts +0 -10
- package/dist/esm/transactions/instances/index.mjs +0 -2
- package/dist/esm/transactions/instances/index.mjs.map +0 -1
- package/dist/esm/transactions/instances/moduleId.d.mts +0 -7
- package/dist/esm/transactions/instances/moduleId.mjs +0 -2
- package/dist/esm/transactions/instances/moduleId.mjs.map +0 -1
- package/dist/esm/transactions/instances/multiAgentTransaction.d.mts +0 -7
- package/dist/esm/transactions/instances/multiAgentTransaction.mjs +0 -2
- package/dist/esm/transactions/instances/multiAgentTransaction.mjs.map +0 -1
- package/dist/esm/transactions/instances/rawTransaction.d.mts +0 -7
- package/dist/esm/transactions/instances/rawTransaction.mjs +0 -2
- package/dist/esm/transactions/instances/rawTransaction.mjs.map +0 -1
- package/dist/esm/transactions/instances/rotationProofChallenge.d.mts +0 -58
- package/dist/esm/transactions/instances/rotationProofChallenge.mjs +0 -2
- package/dist/esm/transactions/instances/rotationProofChallenge.mjs.map +0 -1
- package/dist/esm/transactions/instances/signedTransaction.d.mts +0 -59
- package/dist/esm/transactions/instances/signedTransaction.mjs +0 -2
- package/dist/esm/transactions/instances/signedTransaction.mjs.map +0 -1
- package/dist/esm/transactions/instances/simpleTransaction.d.mts +0 -7
- package/dist/esm/transactions/instances/simpleTransaction.mjs +0 -2
- package/dist/esm/transactions/instances/simpleTransaction.mjs.map +0 -1
- package/dist/esm/transactions/instances/transactionArgument.d.mts +0 -7
- package/dist/esm/transactions/instances/transactionArgument.mjs +0 -2
- package/dist/esm/transactions/instances/transactionArgument.mjs.map +0 -1
- package/dist/esm/transactions/instances/transactionPayload.d.mts +0 -7
- package/dist/esm/transactions/instances/transactionPayload.mjs +0 -2
- package/dist/esm/transactions/instances/transactionPayload.mjs.map +0 -1
- package/dist/esm/transactions/management/accountSequenceNumber.d.mts +0 -123
- package/dist/esm/transactions/management/accountSequenceNumber.mjs +0 -2
- package/dist/esm/transactions/management/accountSequenceNumber.mjs.map +0 -1
- package/dist/esm/transactions/management/asyncQueue.d.mts +0 -77
- package/dist/esm/transactions/management/asyncQueue.mjs +0 -2
- package/dist/esm/transactions/management/asyncQueue.mjs.map +0 -1
- package/dist/esm/transactions/management/index.d.mts +0 -12
- package/dist/esm/transactions/management/index.mjs +0 -2
- package/dist/esm/transactions/management/index.mjs.map +0 -1
- package/dist/esm/transactions/management/transactionWorker.d.mts +0 -218
- package/dist/esm/transactions/management/transactionWorker.mjs +0 -2
- package/dist/esm/transactions/management/transactionWorker.mjs.map +0 -1
- package/dist/esm/transactions/transactionBuilder/helpers.d.mts +0 -189
- package/dist/esm/transactions/transactionBuilder/helpers.mjs +0 -2
- package/dist/esm/transactions/transactionBuilder/helpers.mjs.map +0 -1
- package/dist/esm/transactions/transactionBuilder/index.d.mts +0 -11
- package/dist/esm/transactions/transactionBuilder/index.mjs +0 -2
- package/dist/esm/transactions/transactionBuilder/index.mjs.map +0 -1
- package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +0 -105
- package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +0 -2
- package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs.map +0 -1
- package/dist/esm/transactions/transactionBuilder/signingMessage.d.mts +0 -62
- package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +0 -2
- package/dist/esm/transactions/transactionBuilder/signingMessage.mjs.map +0 -1
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +0 -192
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +0 -2
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs.map +0 -1
- package/dist/esm/transactions/typeTag/index.d.mts +0 -7
- package/dist/esm/transactions/typeTag/index.mjs +0 -2
- package/dist/esm/transactions/typeTag/index.mjs.map +0 -1
- package/dist/esm/transactions/typeTag/parser.d.mts +0 -81
- package/dist/esm/transactions/typeTag/parser.mjs +0 -2
- package/dist/esm/transactions/typeTag/parser.mjs.map +0 -1
- package/dist/esm/transactions/types.d.mts +0 -7
- package/dist/esm/transactions/types.mjs +0 -2
- package/dist/esm/transactions/types.mjs.map +0 -1
- package/dist/esm/types/abstraction.d.mts +0 -15
- package/dist/esm/types/abstraction.mjs +0 -2
- package/dist/esm/types/abstraction.mjs.map +0 -1
- package/dist/esm/types/ans.d.mts +0 -109
- package/dist/esm/types/ans.mjs +0 -2
- package/dist/esm/types/ans.mjs.map +0 -1
- package/dist/esm/types/generated/operations.d.mts +0 -703
- package/dist/esm/types/generated/operations.mjs +0 -1
- package/dist/esm/types/generated/operations.mjs.map +0 -1
- package/dist/esm/types/generated/queries.d.mts +0 -66
- package/dist/esm/types/generated/queries.mjs +0 -2
- package/dist/esm/types/generated/queries.mjs.map +0 -1
- package/dist/esm/types/generated/types.d.mts +0 -9679
- package/dist/esm/types/generated/types.mjs +0 -2
- package/dist/esm/types/generated/types.mjs.map +0 -1
- package/dist/esm/types/index.d.mts +0 -8
- package/dist/esm/types/index.mjs +0 -2
- package/dist/esm/types/index.mjs.map +0 -1
- package/dist/esm/types/indexer.d.mts +0 -186
- package/dist/esm/types/indexer.mjs +0 -2
- package/dist/esm/types/indexer.mjs.map +0 -1
- package/dist/esm/types/keyless.d.mts +0 -102
- package/dist/esm/types/keyless.mjs +0 -1
- package/dist/esm/types/keyless.mjs.map +0 -1
- package/dist/esm/types/types.d.mts +0 -7
- package/dist/esm/types/types.mjs +0 -2
- package/dist/esm/types/types.mjs.map +0 -1
- package/dist/esm/utils/apiEndpoints.d.mts +0 -51
- package/dist/esm/utils/apiEndpoints.mjs +0 -2
- package/dist/esm/utils/apiEndpoints.mjs.map +0 -1
- package/dist/esm/utils/const.d.mts +0 -104
- package/dist/esm/utils/const.mjs +0 -2
- package/dist/esm/utils/const.mjs.map +0 -1
- package/dist/esm/utils/helpers.d.mts +0 -193
- package/dist/esm/utils/helpers.mjs +0 -2
- package/dist/esm/utils/helpers.mjs.map +0 -1
- package/dist/esm/utils/index.d.mts +0 -9
- package/dist/esm/utils/index.mjs +0 -2
- package/dist/esm/utils/index.mjs.map +0 -1
- package/dist/esm/utils/memoize.d.mts +0 -48
- package/dist/esm/utils/memoize.mjs +0 -2
- package/dist/esm/utils/memoize.mjs.map +0 -1
- package/dist/esm/utils/normalizeBundle.d.mts +0 -35
- package/dist/esm/utils/normalizeBundle.mjs +0 -2
- package/dist/esm/utils/normalizeBundle.mjs.map +0 -1
- package/dist/esm/version.d.mts +0 -8
- package/dist/esm/version.mjs +0 -2
- package/dist/esm/version.mjs.map +0 -1
|
@@ -0,0 +1,1088 @@
|
|
|
1
|
+
// Copyright © Aptos Foundation
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { parseTypeTag } from "../typeTag/parser.js";
|
|
4
|
+
import { TypeTagAddress, TypeTagBool, TypeTagI128, TypeTagI16, TypeTagI256, TypeTagI32, TypeTagI64, TypeTagI8, TypeTagStruct, TypeTagU128, TypeTagU16, TypeTagU256, TypeTagU32, TypeTagU64, TypeTagU8, } from "../typeTag/index.js";
|
|
5
|
+
import { Bool, FixedBytes, I128, I16, I256, I32, I64, I8, MoveOption, MoveString, MoveVector, U128, U16, U256, U32, U64, U8, } from "../../bcs/index.js";
|
|
6
|
+
import { AccountAddress } from "../../core/index.js";
|
|
7
|
+
import { getModule } from "../../internal/account.js";
|
|
8
|
+
import { findFirstNonSignerArg, isBcsAddress, isBcsBool, isBcsString, isBcsU128, isBcsU16, isBcsU256, isBcsU32, isBcsU64, isBcsU8, isBool, isEncodedEntryFunctionArgument, isLargeNumber, isEmptyOption, isString, throwTypeMismatch, convertNumber, isBcsI8, isBcsI16, isBcsI32, isBcsI64, isBcsI128, isBcsI256, } from "./helpers.js";
|
|
9
|
+
import { warnIfDevelopment } from "../../utils/helpers.js";
|
|
10
|
+
import { memoizeAsync } from "../../utils/memoize.js";
|
|
11
|
+
import { MoveEnumArgument, MoveStructArgument, StructEnumArgumentParser } from "./structEnumParser.js";
|
|
12
|
+
import { TEXT_ENCODER } from "../../utils/index.js";
|
|
13
|
+
/**
|
|
14
|
+
* Convert type arguments to only type tags, allowing for string representations of type tags.
|
|
15
|
+
*
|
|
16
|
+
* @param typeArguments - An optional array of type arguments that may include string representations.
|
|
17
|
+
* @returns An array of TypeTag objects derived from the provided type arguments.
|
|
18
|
+
* @group Implementation
|
|
19
|
+
* @category Transactions
|
|
20
|
+
*/
|
|
21
|
+
export function standardizeTypeTags(typeArguments) {
|
|
22
|
+
return (typeArguments?.map((typeArg) => {
|
|
23
|
+
// Convert to TypeTag if it's a string representation
|
|
24
|
+
if (isString(typeArg)) {
|
|
25
|
+
return parseTypeTag(typeArg);
|
|
26
|
+
}
|
|
27
|
+
return typeArg;
|
|
28
|
+
}) ?? []);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Cache TTL for module ABIs in milliseconds (5 minutes).
|
|
32
|
+
* ABIs rarely change, so a longer cache is acceptable.
|
|
33
|
+
*/
|
|
34
|
+
const MODULE_ABI_CACHE_TTL_MS = 5 * 60 * 1000;
|
|
35
|
+
/**
|
|
36
|
+
* Extracts all struct type references from a module's struct fields and function parameters.
|
|
37
|
+
* Returns a set of unique module identifiers (address::moduleName) that need to be fetched.
|
|
38
|
+
*
|
|
39
|
+
* @param module - The module to extract struct references from
|
|
40
|
+
* @returns Set of module IDs referenced by this module (e.g., "0x1::string", "0x123::my_module")
|
|
41
|
+
*/
|
|
42
|
+
function extractReferencedStructModules(module) {
|
|
43
|
+
const referencedModules = new Set();
|
|
44
|
+
const moduleId = `${module.address}::${module.name}`;
|
|
45
|
+
// Helper to parse a type string and extract struct references
|
|
46
|
+
const parseTypeForStructs = (typeStr) => {
|
|
47
|
+
// Match patterns like: 0x1::module::Struct, address::module::Struct<T>
|
|
48
|
+
// Handles generic types and vectors: vector<0x1::module::Struct<T>>
|
|
49
|
+
const structPattern = /(0x[a-fA-F0-9]+)::([\w_]+)::([\w_]+)/g;
|
|
50
|
+
let match = structPattern.exec(typeStr);
|
|
51
|
+
while (match !== null) {
|
|
52
|
+
const [, address, modName] = match;
|
|
53
|
+
const refModuleId = `${address}::${modName}`;
|
|
54
|
+
// Don't include self-references or standard library types that don't need fetching
|
|
55
|
+
if (refModuleId !== moduleId && !refModuleId.startsWith("0x1::")) {
|
|
56
|
+
referencedModules.add(refModuleId);
|
|
57
|
+
}
|
|
58
|
+
match = structPattern.exec(typeStr);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
// Extract from struct fields
|
|
62
|
+
for (const struct of module.structs) {
|
|
63
|
+
for (const field of struct.fields) {
|
|
64
|
+
parseTypeForStructs(field.type);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
// Extract from function parameters and return types
|
|
68
|
+
for (const func of module.exposed_functions) {
|
|
69
|
+
for (const param of func.params) {
|
|
70
|
+
parseTypeForStructs(param);
|
|
71
|
+
}
|
|
72
|
+
for (const ret of func.return) {
|
|
73
|
+
parseTypeForStructs(ret);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return referencedModules;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Fetches the ABI of a specified module from the on-chain module ABI.
|
|
80
|
+
* Results are cached for 5 minutes to reduce redundant network calls.
|
|
81
|
+
*
|
|
82
|
+
* @param moduleAddress - The address of the module from which to fetch the ABI.
|
|
83
|
+
* @param moduleName - The name of the module containing the ABI.
|
|
84
|
+
* @param aptosConfig - The configuration settings for Aptos.
|
|
85
|
+
* @group Implementation
|
|
86
|
+
* @category Transactions
|
|
87
|
+
*/
|
|
88
|
+
export async function fetchModuleAbi(moduleAddress, moduleName, aptosConfig) {
|
|
89
|
+
const cacheKey = `module-abi-${aptosConfig.network}-${moduleAddress}-${moduleName}`;
|
|
90
|
+
return memoizeAsync(async () => {
|
|
91
|
+
const moduleBytecode = await getModule({ aptosConfig, accountAddress: moduleAddress, moduleName });
|
|
92
|
+
return moduleBytecode.abi;
|
|
93
|
+
}, cacheKey, MODULE_ABI_CACHE_TTL_MS)();
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Fetches a module ABI along with all struct ABIs it references.
|
|
97
|
+
* This optimization minimizes nested network calls when encoding struct/enum arguments.
|
|
98
|
+
*
|
|
99
|
+
* Strategy:
|
|
100
|
+
* - Fetches the main module ABI
|
|
101
|
+
* - Parses all type references in struct fields and function parameters
|
|
102
|
+
* - Fetches ABIs for all referenced struct modules in parallel
|
|
103
|
+
* - Caches the complete bundle together
|
|
104
|
+
*
|
|
105
|
+
* @param moduleAddress - The address of the module from which to fetch the ABI.
|
|
106
|
+
* @param moduleName - The name of the module containing the ABI.
|
|
107
|
+
* @param aptosConfig - The configuration settings for Aptos.
|
|
108
|
+
* @returns ModuleAbiBundle containing the module and all referenced struct modules
|
|
109
|
+
* @group Implementation
|
|
110
|
+
* @category Transactions
|
|
111
|
+
*/
|
|
112
|
+
export async function fetchModuleAbiWithStructs(moduleAddress, moduleName, aptosConfig) {
|
|
113
|
+
const cacheKey = `module-abi-bundle-${aptosConfig.network}-${moduleAddress}-${moduleName}`;
|
|
114
|
+
return memoizeAsync(async () => {
|
|
115
|
+
// Fetch the main module ABI
|
|
116
|
+
const module = await fetchModuleAbi(moduleAddress, moduleName, aptosConfig);
|
|
117
|
+
if (!module) {
|
|
118
|
+
throw new Error(`Module not found: ${moduleAddress}::${moduleName}`);
|
|
119
|
+
}
|
|
120
|
+
// Extract all struct modules referenced by this module
|
|
121
|
+
const referencedModuleIds = extractReferencedStructModules(module);
|
|
122
|
+
const referencedStructModules = new Map();
|
|
123
|
+
// Fetch all referenced struct modules in parallel
|
|
124
|
+
if (referencedModuleIds.size > 0) {
|
|
125
|
+
const fetchPromises = Array.from(referencedModuleIds).map(async (moduleId) => {
|
|
126
|
+
const [addr, modName] = moduleId.split("::");
|
|
127
|
+
try {
|
|
128
|
+
const structModule = await fetchModuleAbi(addr, modName, aptosConfig);
|
|
129
|
+
if (structModule) {
|
|
130
|
+
referencedStructModules.set(moduleId, structModule);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
catch {
|
|
134
|
+
// Silently ignore fetch failures - the struct might not be used in this execution path
|
|
135
|
+
// If it's actually needed, the error will surface during encoding
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
await Promise.all(fetchPromises);
|
|
139
|
+
}
|
|
140
|
+
return {
|
|
141
|
+
module,
|
|
142
|
+
referencedStructModules,
|
|
143
|
+
};
|
|
144
|
+
}, cacheKey, MODULE_ABI_CACHE_TTL_MS)();
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Fetches the ABI of a specified function from the on-chain module ABI. This function allows you to access the details of a
|
|
148
|
+
* specific function within a module.
|
|
149
|
+
*
|
|
150
|
+
* @param moduleAddress - The address of the module from which to fetch the function ABI.
|
|
151
|
+
* @param moduleName - The name of the module containing the function.
|
|
152
|
+
* @param functionName - The name of the function whose ABI is to be fetched.
|
|
153
|
+
* @param aptosConfig - The configuration settings for Aptos.
|
|
154
|
+
* @group Implementation
|
|
155
|
+
* @category Transactions
|
|
156
|
+
*/
|
|
157
|
+
export async function fetchFunctionAbi(moduleAddress, moduleName, functionName, aptosConfig) {
|
|
158
|
+
const moduleAbi = await fetchModuleAbi(moduleAddress, moduleName, aptosConfig);
|
|
159
|
+
if (!moduleAbi)
|
|
160
|
+
throw new Error(`Could not find module ABI for '${moduleAddress}::${moduleName}'`);
|
|
161
|
+
return moduleAbi.exposed_functions.find((func) => func.name === functionName);
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* @deprecated Use `fetchFunctionAbi` instead and manually parse the type tags.
|
|
165
|
+
*/
|
|
166
|
+
export async function fetchMoveFunctionAbi(moduleAddress, moduleName, functionName, aptosConfig) {
|
|
167
|
+
const functionAbi = await fetchFunctionAbi(moduleAddress, moduleName, functionName, aptosConfig);
|
|
168
|
+
if (!functionAbi) {
|
|
169
|
+
throw new Error(`Could not find function ABI for '${moduleAddress}::${moduleName}::${functionName}'`);
|
|
170
|
+
}
|
|
171
|
+
const params = [];
|
|
172
|
+
for (let i = 0; i < functionAbi.params.length; i += 1) {
|
|
173
|
+
params.push(parseTypeTag(functionAbi.params[i], { allowGenerics: true }));
|
|
174
|
+
}
|
|
175
|
+
return {
|
|
176
|
+
typeParameters: functionAbi.generic_type_params,
|
|
177
|
+
parameters: params,
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Fetches the ABI for an entry function from the specified module address.
|
|
182
|
+
* This function validates if the ABI corresponds to an entry function and retrieves its parameters.
|
|
183
|
+
*
|
|
184
|
+
* @param moduleAddress - The address of the module containing the entry function.
|
|
185
|
+
* @param moduleName - The name of the module containing the entry function.
|
|
186
|
+
* @param functionName - The name of the entry function to fetch the ABI for.
|
|
187
|
+
* @param aptosConfig - The configuration settings for Aptos.
|
|
188
|
+
* @returns An object containing the number of signers, type parameters, and function parameters.
|
|
189
|
+
* @throws Error if the ABI cannot be found or if the function is not an entry function.
|
|
190
|
+
* @group Implementation
|
|
191
|
+
* @category Transactions
|
|
192
|
+
*/
|
|
193
|
+
export async function fetchEntryFunctionAbi(moduleAddress, moduleName, functionName, aptosConfig) {
|
|
194
|
+
const functionAbi = await fetchFunctionAbi(moduleAddress, moduleName, functionName, aptosConfig);
|
|
195
|
+
// If there's no ABI, then the function is invalid
|
|
196
|
+
if (!functionAbi) {
|
|
197
|
+
throw new Error(`Could not find entry function ABI for '${moduleAddress}::${moduleName}::${functionName}'`);
|
|
198
|
+
}
|
|
199
|
+
// Non-entry functions also can't be used
|
|
200
|
+
if (!functionAbi.is_entry) {
|
|
201
|
+
throw new Error(`'${moduleAddress}::${moduleName}::${functionName}' is not an entry function`);
|
|
202
|
+
}
|
|
203
|
+
// Remove the signer arguments
|
|
204
|
+
const numSigners = findFirstNonSignerArg(functionAbi);
|
|
205
|
+
const params = [];
|
|
206
|
+
for (let i = numSigners; i < functionAbi.params.length; i += 1) {
|
|
207
|
+
params.push(parseTypeTag(functionAbi.params[i], { allowGenerics: true }));
|
|
208
|
+
}
|
|
209
|
+
return {
|
|
210
|
+
signers: numSigners,
|
|
211
|
+
typeParameters: functionAbi.generic_type_params,
|
|
212
|
+
parameters: params,
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Fetches the ABI for a view function from the specified module address.
|
|
217
|
+
* This function ensures that the ABI is valid and retrieves the type parameters, parameters, and return types for the view function.
|
|
218
|
+
*
|
|
219
|
+
* @param moduleAddress - The address of the module containing the view function.
|
|
220
|
+
* @param moduleName - The name of the module containing the view function.
|
|
221
|
+
* @param functionName - The name of the view function for which to fetch the ABI.
|
|
222
|
+
* @param aptosConfig - The configuration settings for Aptos.
|
|
223
|
+
* @returns An object containing the type parameters, parameters, and return types of the view function.
|
|
224
|
+
* @throws Error if the ABI cannot be found or if the function is not a view function.
|
|
225
|
+
* @group Implementation
|
|
226
|
+
* @category Transactions
|
|
227
|
+
*/
|
|
228
|
+
export async function fetchViewFunctionAbi(moduleAddress, moduleName, functionName, aptosConfig) {
|
|
229
|
+
const functionAbi = await fetchFunctionAbi(moduleAddress, moduleName, functionName, aptosConfig);
|
|
230
|
+
// If there's no ABI, then the function is invalid
|
|
231
|
+
if (!functionAbi) {
|
|
232
|
+
throw new Error(`Could not find view function ABI for '${moduleAddress}::${moduleName}::${functionName}'`);
|
|
233
|
+
}
|
|
234
|
+
// Non-view functions can't be used
|
|
235
|
+
if (!functionAbi.is_view) {
|
|
236
|
+
throw new Error(`'${moduleAddress}::${moduleName}::${functionName}' is not an view function`);
|
|
237
|
+
}
|
|
238
|
+
// Type tag parameters for the function
|
|
239
|
+
const params = [];
|
|
240
|
+
for (let i = 0; i < functionAbi.params.length; i += 1) {
|
|
241
|
+
params.push(parseTypeTag(functionAbi.params[i], { allowGenerics: true }));
|
|
242
|
+
}
|
|
243
|
+
// The return types of the view function
|
|
244
|
+
const returnTypes = [];
|
|
245
|
+
for (let i = 0; i < functionAbi.return.length; i += 1) {
|
|
246
|
+
returnTypes.push(parseTypeTag(functionAbi.return[i], { allowGenerics: true }));
|
|
247
|
+
}
|
|
248
|
+
return {
|
|
249
|
+
typeParameters: functionAbi.generic_type_params,
|
|
250
|
+
parameters: params,
|
|
251
|
+
returnTypes,
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Converts a non-BCS encoded argument into BCS encoded, if necessary.
|
|
256
|
+
* This is the synchronous version that works offline with pre-fetched ABIs.
|
|
257
|
+
* Does NOT support struct/enum arguments - use convertArgumentWithABI for those.
|
|
258
|
+
*
|
|
259
|
+
* @param functionName - The name of the function for which the argument is being converted.
|
|
260
|
+
* @param functionAbiOrModuleAbi - The ABI (Application Binary Interface) of the function, which defines its parameters.
|
|
261
|
+
* @param arg - The argument to be converted, which can be of various types.
|
|
262
|
+
* @param position - The index of the argument in the function's parameter list.
|
|
263
|
+
* @param genericTypeParams - An array of type tags for any generic type parameters.
|
|
264
|
+
* @param options - Options for the conversion process.
|
|
265
|
+
* @param options.allowUnknownStructs - If true, unknown structs will be allowed and converted to a `FixedBytes`.
|
|
266
|
+
* @group Implementation
|
|
267
|
+
* @category Transactions
|
|
268
|
+
*/
|
|
269
|
+
export function convertArgument(functionName, functionAbiOrModuleAbi, arg, position, genericTypeParams, options) {
|
|
270
|
+
let param;
|
|
271
|
+
if ("exposed_functions" in functionAbiOrModuleAbi) {
|
|
272
|
+
const functionAbi = functionAbiOrModuleAbi.exposed_functions.find((func) => func.name === functionName);
|
|
273
|
+
if (!functionAbi) {
|
|
274
|
+
throw new Error(`Could not find function ABI for '${functionAbiOrModuleAbi.address}::${functionAbiOrModuleAbi.name}::${functionName}'`);
|
|
275
|
+
}
|
|
276
|
+
if (position >= functionAbi.params.length) {
|
|
277
|
+
throw new Error(`Too many arguments for '${functionName}', expected ${functionAbi.params.length}`);
|
|
278
|
+
}
|
|
279
|
+
param = parseTypeTag(functionAbi.params[position], { allowGenerics: true });
|
|
280
|
+
}
|
|
281
|
+
else {
|
|
282
|
+
if (position >= functionAbiOrModuleAbi.parameters.length) {
|
|
283
|
+
throw new Error(`Too many arguments for '${functionName}', expected ${functionAbiOrModuleAbi.parameters.length}`);
|
|
284
|
+
}
|
|
285
|
+
param = functionAbiOrModuleAbi.parameters[position];
|
|
286
|
+
}
|
|
287
|
+
return checkOrConvertArgument(arg, param, position, genericTypeParams, "exposed_functions" in functionAbiOrModuleAbi ? functionAbiOrModuleAbi : undefined, options);
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Converts a non-BCS encoded argument into BCS encoded, with support for struct/enum arguments.
|
|
291
|
+
* This is the asynchronous version that fetches module ABIs from the network as needed.
|
|
292
|
+
*
|
|
293
|
+
* @param functionName - The name of the function for which the argument is being converted.
|
|
294
|
+
* @param functionAbiOrModuleAbi - The ABI (Application Binary Interface) of the function, which defines its parameters.
|
|
295
|
+
* @param arg - The argument to be converted, which can be of various types.
|
|
296
|
+
* @param position - The index of the argument in the function's parameter list.
|
|
297
|
+
* @param genericTypeParams - An array of type tags for any generic type parameters.
|
|
298
|
+
* @param aptosConfig - Aptos configuration for fetching module ABIs (required for struct/enum arguments).
|
|
299
|
+
* @param options - Options for the conversion process.
|
|
300
|
+
* @param options.allowUnknownStructs - If true, unknown structs will be allowed and converted to a `FixedBytes`.
|
|
301
|
+
* @group Implementation
|
|
302
|
+
* @category Transactions
|
|
303
|
+
*/
|
|
304
|
+
export async function convertArgumentWithABI(functionName, functionAbiOrModuleAbi, arg, position, genericTypeParams, aptosConfig, options) {
|
|
305
|
+
let param;
|
|
306
|
+
if ("exposed_functions" in functionAbiOrModuleAbi) {
|
|
307
|
+
const functionAbi = functionAbiOrModuleAbi.exposed_functions.find((func) => func.name === functionName);
|
|
308
|
+
if (!functionAbi) {
|
|
309
|
+
throw new Error(`Could not find function ABI for '${functionAbiOrModuleAbi.address}::${functionAbiOrModuleAbi.name}::${functionName}'`);
|
|
310
|
+
}
|
|
311
|
+
if (position >= functionAbi.params.length) {
|
|
312
|
+
throw new Error(`Too many arguments for '${functionName}', expected ${functionAbi.params.length}`);
|
|
313
|
+
}
|
|
314
|
+
param = parseTypeTag(functionAbi.params[position], { allowGenerics: true });
|
|
315
|
+
}
|
|
316
|
+
else {
|
|
317
|
+
if (position >= functionAbiOrModuleAbi.parameters.length) {
|
|
318
|
+
throw new Error(`Too many arguments for '${functionName}', expected ${functionAbiOrModuleAbi.parameters.length}`);
|
|
319
|
+
}
|
|
320
|
+
param = functionAbiOrModuleAbi.parameters[position];
|
|
321
|
+
}
|
|
322
|
+
return checkOrConvertArgumentWithABI(arg, param, position, genericTypeParams, aptosConfig, "exposed_functions" in functionAbiOrModuleAbi ? functionAbiOrModuleAbi : undefined, options);
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Checks if the provided argument is BCS encoded and converts it if necessary, ensuring type compatibility with the ABI.
|
|
326
|
+
* This is the synchronous version that works offline with pre-fetched ABIs.
|
|
327
|
+
* Does NOT support struct/enum arguments - use checkOrConvertArgumentWithABI for those.
|
|
328
|
+
*
|
|
329
|
+
* @param arg - The argument to check or convert, which can be either a simple or entry function argument type.
|
|
330
|
+
* @param param - The expected type tag for the argument.
|
|
331
|
+
* @param position - The position of the argument in the function call.
|
|
332
|
+
* @param genericTypeParams - An array of generic type parameters that may be used for conversion.
|
|
333
|
+
* @param moduleAbi - The ABI of the module containing the function, used for type checking.
|
|
334
|
+
* @param options - Options for the conversion process.
|
|
335
|
+
* @group Implementation
|
|
336
|
+
* @category Transactions
|
|
337
|
+
*/
|
|
338
|
+
export function checkOrConvertArgument(arg, param, position, genericTypeParams, moduleAbi, options) {
|
|
339
|
+
// If the argument is bcs encoded, we can just use it directly
|
|
340
|
+
if (isEncodedEntryFunctionArgument(arg)) {
|
|
341
|
+
// If the expected type is Option but the arg is not already a MoveOption,
|
|
342
|
+
// wrap it after validating it matches the Option's inner type.
|
|
343
|
+
// This handles cases like Vector<Option<address>> where elements may be
|
|
344
|
+
// passed as AccountAddress instead of MoveOption<AccountAddress>.
|
|
345
|
+
if (param.isStruct() && param.isOption() && !(arg instanceof MoveOption)) {
|
|
346
|
+
return new MoveOption(checkOrConvertArgument(arg, param.value.typeArgs[0], position, genericTypeParams, moduleAbi, options));
|
|
347
|
+
}
|
|
348
|
+
// Ensure the type matches the ABI
|
|
349
|
+
checkType(param, arg, position);
|
|
350
|
+
return arg;
|
|
351
|
+
}
|
|
352
|
+
// If it is not BCS encoded, we will need to convert it with the ABI
|
|
353
|
+
return parseArgSync(arg, param, position, genericTypeParams, moduleAbi, options);
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* Checks if the provided argument is BCS encoded and converts it if necessary, with support for struct/enum arguments.
|
|
357
|
+
* This is the asynchronous version that fetches module ABIs from the network as needed.
|
|
358
|
+
*
|
|
359
|
+
* @param arg - The argument to check or convert, which can be either a simple or entry function argument type.
|
|
360
|
+
* @param param - The expected type tag for the argument.
|
|
361
|
+
* @param position - The position of the argument in the function call.
|
|
362
|
+
* @param genericTypeParams - An array of generic type parameters that may be used for conversion.
|
|
363
|
+
* @param aptosConfig - Aptos configuration for fetching module ABIs (required for struct/enum arguments).
|
|
364
|
+
* @param moduleAbi - The ABI of the module containing the function, used for type checking.
|
|
365
|
+
* @param options - Options for the conversion process.
|
|
366
|
+
* @group Implementation
|
|
367
|
+
* @category Transactions
|
|
368
|
+
*/
|
|
369
|
+
export async function checkOrConvertArgumentWithABI(arg, param, position, genericTypeParams, aptosConfig, moduleAbi, options) {
|
|
370
|
+
// If the argument is bcs encoded, we can just use it directly
|
|
371
|
+
if (isEncodedEntryFunctionArgument(arg)) {
|
|
372
|
+
// If the expected type is Option but the arg is not already a MoveOption,
|
|
373
|
+
// wrap it after validating it matches the Option's inner type. This mirrors
|
|
374
|
+
// the behavior of the synchronous `checkOrConvertArgument` path so that
|
|
375
|
+
// pre-encoded inner values (e.g. AccountAddress inside Vector<Option<address>>)
|
|
376
|
+
// can be passed through the async path as well.
|
|
377
|
+
if (param.isStruct() && param.isOption() && !(arg instanceof MoveOption)) {
|
|
378
|
+
const inner = await checkOrConvertArgumentWithABI(arg, param.value.typeArgs[0], position, genericTypeParams, aptosConfig, moduleAbi, options);
|
|
379
|
+
return new MoveOption(inner);
|
|
380
|
+
}
|
|
381
|
+
// Ensure the type matches the ABI
|
|
382
|
+
checkType(param, arg, position);
|
|
383
|
+
return arg;
|
|
384
|
+
}
|
|
385
|
+
// If it is not BCS encoded, we will need to convert it with the ABI
|
|
386
|
+
return parseArgAsync(arg, param, position, genericTypeParams, aptosConfig, moduleAbi, options);
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Parses a non-BCS encoded argument into a BCS encoded argument recursively.
|
|
390
|
+
* This is the synchronous version that works offline with pre-fetched ABIs.
|
|
391
|
+
* Does NOT support struct/enum arguments - throws error if encountered.
|
|
392
|
+
*
|
|
393
|
+
* @param arg - The argument to be parsed, which can be of various types.
|
|
394
|
+
* @param param - The type tag that defines the expected type of the argument.
|
|
395
|
+
* @param position - The position of the argument in the function call, used for error reporting.
|
|
396
|
+
* @param genericTypeParams - An array of type tags for generic type parameters, used when the parameter type is generic.
|
|
397
|
+
* @param moduleAbi - The ABI of the module containing the function, used for type checking.
|
|
398
|
+
* @param options - Options for the conversion process.
|
|
399
|
+
* @param options.allowUnknownStructs - If true, unknown structs will be allowed and converted to a `FixedBytes`.
|
|
400
|
+
* @group Implementation
|
|
401
|
+
* @category Transactions
|
|
402
|
+
*/
|
|
403
|
+
function parseArgSync(arg, param, position, genericTypeParams, moduleAbi, options) {
|
|
404
|
+
if (param.isBool()) {
|
|
405
|
+
if (isBool(arg)) {
|
|
406
|
+
return new Bool(arg);
|
|
407
|
+
}
|
|
408
|
+
if (isString(arg)) {
|
|
409
|
+
if (arg === "true")
|
|
410
|
+
return new Bool(true);
|
|
411
|
+
if (arg === "false")
|
|
412
|
+
return new Bool(false);
|
|
413
|
+
}
|
|
414
|
+
throwTypeMismatch("boolean", position);
|
|
415
|
+
}
|
|
416
|
+
if (param.isAddress()) {
|
|
417
|
+
if (isString(arg)) {
|
|
418
|
+
return AccountAddress.fromString(arg);
|
|
419
|
+
}
|
|
420
|
+
// Support for Uint8Array coming from external sources
|
|
421
|
+
if (arg && typeof arg === "object" && "data" in arg && arg.data instanceof Uint8Array) {
|
|
422
|
+
return new AccountAddress(arg.data);
|
|
423
|
+
}
|
|
424
|
+
throwTypeMismatch("string | AccountAddress", position);
|
|
425
|
+
}
|
|
426
|
+
if (param.isU8()) {
|
|
427
|
+
const num = convertNumber(arg);
|
|
428
|
+
if (num !== undefined) {
|
|
429
|
+
return new U8(num);
|
|
430
|
+
}
|
|
431
|
+
throwTypeMismatch("number | string", position);
|
|
432
|
+
}
|
|
433
|
+
if (param.isU16()) {
|
|
434
|
+
const num = convertNumber(arg);
|
|
435
|
+
if (num !== undefined) {
|
|
436
|
+
return new U16(num);
|
|
437
|
+
}
|
|
438
|
+
throwTypeMismatch("number | string", position);
|
|
439
|
+
}
|
|
440
|
+
if (param.isU32()) {
|
|
441
|
+
const num = convertNumber(arg);
|
|
442
|
+
if (num !== undefined) {
|
|
443
|
+
return new U32(num);
|
|
444
|
+
}
|
|
445
|
+
throwTypeMismatch("number | string", position);
|
|
446
|
+
}
|
|
447
|
+
if (param.isU64()) {
|
|
448
|
+
if (isLargeNumber(arg)) {
|
|
449
|
+
return new U64(BigInt(arg));
|
|
450
|
+
}
|
|
451
|
+
throwTypeMismatch("bigint | number | string", position);
|
|
452
|
+
}
|
|
453
|
+
if (param.isU128()) {
|
|
454
|
+
if (isLargeNumber(arg)) {
|
|
455
|
+
return new U128(BigInt(arg));
|
|
456
|
+
}
|
|
457
|
+
throwTypeMismatch("bigint | number | string", position);
|
|
458
|
+
}
|
|
459
|
+
if (param.isU256()) {
|
|
460
|
+
if (isLargeNumber(arg)) {
|
|
461
|
+
return new U256(BigInt(arg));
|
|
462
|
+
}
|
|
463
|
+
throwTypeMismatch("bigint | number | string", position);
|
|
464
|
+
}
|
|
465
|
+
if (param.isI8()) {
|
|
466
|
+
const num = convertNumber(arg);
|
|
467
|
+
if (num !== undefined) {
|
|
468
|
+
return new I8(num);
|
|
469
|
+
}
|
|
470
|
+
throwTypeMismatch("number | string", position);
|
|
471
|
+
}
|
|
472
|
+
if (param.isI16()) {
|
|
473
|
+
const num = convertNumber(arg);
|
|
474
|
+
if (num !== undefined) {
|
|
475
|
+
return new I16(num);
|
|
476
|
+
}
|
|
477
|
+
throwTypeMismatch("number | string", position);
|
|
478
|
+
}
|
|
479
|
+
if (param.isI32()) {
|
|
480
|
+
const num = convertNumber(arg);
|
|
481
|
+
if (num !== undefined) {
|
|
482
|
+
return new I32(num);
|
|
483
|
+
}
|
|
484
|
+
throwTypeMismatch("number | string", position);
|
|
485
|
+
}
|
|
486
|
+
if (param.isI64()) {
|
|
487
|
+
if (isLargeNumber(arg)) {
|
|
488
|
+
return new I64(BigInt(arg));
|
|
489
|
+
}
|
|
490
|
+
throwTypeMismatch("bigint | number | string", position);
|
|
491
|
+
}
|
|
492
|
+
if (param.isI128()) {
|
|
493
|
+
if (isLargeNumber(arg)) {
|
|
494
|
+
return new I128(BigInt(arg));
|
|
495
|
+
}
|
|
496
|
+
throwTypeMismatch("bigint | number | string", position);
|
|
497
|
+
}
|
|
498
|
+
if (param.isI256()) {
|
|
499
|
+
if (isLargeNumber(arg)) {
|
|
500
|
+
return new I256(BigInt(arg));
|
|
501
|
+
}
|
|
502
|
+
throwTypeMismatch("bigint | number | string", position);
|
|
503
|
+
}
|
|
504
|
+
// Generic needs to use the subtype
|
|
505
|
+
if (param.isGeneric()) {
|
|
506
|
+
const genericIndex = param.value;
|
|
507
|
+
if (genericIndex < 0 || genericIndex >= genericTypeParams.length) {
|
|
508
|
+
throw new Error(`Generic argument ${param.toString()} is invalid for argument ${position}`);
|
|
509
|
+
}
|
|
510
|
+
return checkOrConvertArgument(arg, genericTypeParams[genericIndex], position, genericTypeParams, moduleAbi, options);
|
|
511
|
+
}
|
|
512
|
+
// We have to special case some vectors for Vector<u8>
|
|
513
|
+
if (param.isVector()) {
|
|
514
|
+
// Check special case for Vector<u8>
|
|
515
|
+
if (param.value.isU8()) {
|
|
516
|
+
if (isString(arg)) {
|
|
517
|
+
return MoveVector.U8(TEXT_ENCODER.encode(arg));
|
|
518
|
+
}
|
|
519
|
+
if (arg instanceof Uint8Array) {
|
|
520
|
+
return MoveVector.U8(arg);
|
|
521
|
+
}
|
|
522
|
+
if (arg instanceof ArrayBuffer) {
|
|
523
|
+
return MoveVector.U8(new Uint8Array(arg));
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
if (isString(arg)) {
|
|
527
|
+
// In a web env, arguments are passing as strings
|
|
528
|
+
if (arg.startsWith("[")) {
|
|
529
|
+
return checkOrConvertArgument(JSON.parse(arg), param, position, genericTypeParams, moduleAbi, options);
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
if (Array.isArray(arg)) {
|
|
533
|
+
return new MoveVector(arg.map((item) => checkOrConvertArgument(item, param.value, position, genericTypeParams, moduleAbi, options)));
|
|
534
|
+
}
|
|
535
|
+
throw new Error(`Type mismatch for argument ${position}, type '${param.toString()}'`);
|
|
536
|
+
}
|
|
537
|
+
// Handle structs as they're more complex
|
|
538
|
+
if (param.isStruct()) {
|
|
539
|
+
if (param.isString()) {
|
|
540
|
+
if (isString(arg)) {
|
|
541
|
+
return new MoveString(arg);
|
|
542
|
+
}
|
|
543
|
+
throwTypeMismatch("string", position);
|
|
544
|
+
}
|
|
545
|
+
if (param.isObject()) {
|
|
546
|
+
// The inner type of Object doesn't matter, since it's just syntactic sugar
|
|
547
|
+
if (isString(arg)) {
|
|
548
|
+
return AccountAddress.fromString(arg);
|
|
549
|
+
}
|
|
550
|
+
// Support for Uint8Array coming from external sources
|
|
551
|
+
if (arg && typeof arg === "object" && "data" in arg && arg.data instanceof Uint8Array) {
|
|
552
|
+
return new AccountAddress(arg.data);
|
|
553
|
+
}
|
|
554
|
+
throwTypeMismatch("string | AccountAddress", position);
|
|
555
|
+
}
|
|
556
|
+
// Handle known enum types from Aptos framework
|
|
557
|
+
if (param.isDelegationKey() || param.isRateLimiter()) {
|
|
558
|
+
if (arg instanceof Uint8Array) {
|
|
559
|
+
return new FixedBytes(arg);
|
|
560
|
+
}
|
|
561
|
+
throwTypeMismatch("Uint8Array", position);
|
|
562
|
+
}
|
|
563
|
+
if (param.isOption()) {
|
|
564
|
+
if (isEmptyOption(arg)) {
|
|
565
|
+
// Here we attempt to reconstruct the underlying type
|
|
566
|
+
const innerParam = param.value.typeArgs[0];
|
|
567
|
+
if (innerParam instanceof TypeTagBool) {
|
|
568
|
+
return new MoveOption(null);
|
|
569
|
+
}
|
|
570
|
+
if (innerParam instanceof TypeTagAddress) {
|
|
571
|
+
return new MoveOption(null);
|
|
572
|
+
}
|
|
573
|
+
if (innerParam instanceof TypeTagU8) {
|
|
574
|
+
return new MoveOption(null);
|
|
575
|
+
}
|
|
576
|
+
if (innerParam instanceof TypeTagU16) {
|
|
577
|
+
return new MoveOption(null);
|
|
578
|
+
}
|
|
579
|
+
if (innerParam instanceof TypeTagU32) {
|
|
580
|
+
return new MoveOption(null);
|
|
581
|
+
}
|
|
582
|
+
if (innerParam instanceof TypeTagU64) {
|
|
583
|
+
return new MoveOption(null);
|
|
584
|
+
}
|
|
585
|
+
if (innerParam instanceof TypeTagU128) {
|
|
586
|
+
return new MoveOption(null);
|
|
587
|
+
}
|
|
588
|
+
if (innerParam instanceof TypeTagU256) {
|
|
589
|
+
return new MoveOption(null);
|
|
590
|
+
}
|
|
591
|
+
if (innerParam instanceof TypeTagI8) {
|
|
592
|
+
return new MoveOption(null);
|
|
593
|
+
}
|
|
594
|
+
if (innerParam instanceof TypeTagI16) {
|
|
595
|
+
return new MoveOption(null);
|
|
596
|
+
}
|
|
597
|
+
if (innerParam instanceof TypeTagI32) {
|
|
598
|
+
return new MoveOption(null);
|
|
599
|
+
}
|
|
600
|
+
if (innerParam instanceof TypeTagI64) {
|
|
601
|
+
return new MoveOption(null);
|
|
602
|
+
}
|
|
603
|
+
if (innerParam instanceof TypeTagI128) {
|
|
604
|
+
return new MoveOption(null);
|
|
605
|
+
}
|
|
606
|
+
if (innerParam instanceof TypeTagI256) {
|
|
607
|
+
return new MoveOption(null);
|
|
608
|
+
}
|
|
609
|
+
// In all other cases, we will use a placeholder
|
|
610
|
+
return new MoveOption(null);
|
|
611
|
+
}
|
|
612
|
+
return new MoveOption(checkOrConvertArgument(arg, param.value.typeArgs[0], position, genericTypeParams, moduleAbi));
|
|
613
|
+
}
|
|
614
|
+
// Check if this looks like a custom struct/enum argument
|
|
615
|
+
if (typeof arg === "object" &&
|
|
616
|
+
arg !== null &&
|
|
617
|
+
!(arg instanceof Uint8Array) &&
|
|
618
|
+
!(arg instanceof ArrayBuffer) &&
|
|
619
|
+
!Array.isArray(arg)) {
|
|
620
|
+
// Struct/enum arguments require async conversion
|
|
621
|
+
throw new Error(`Struct/enum arguments require async conversion. ` +
|
|
622
|
+
`Use checkOrConvertArgumentWithABI() instead, or pre-encode the argument with StructEnumArgumentParser. ` +
|
|
623
|
+
`Type: '${param.toString()}', position: ${position}`);
|
|
624
|
+
}
|
|
625
|
+
// We are assuming that fieldless structs are enums
|
|
626
|
+
const structDefinition = moduleAbi?.structs.find((s) => s.name === param.value.name.identifier);
|
|
627
|
+
if (structDefinition?.fields.length === 0 && arg instanceof Uint8Array) {
|
|
628
|
+
return new FixedBytes(arg);
|
|
629
|
+
}
|
|
630
|
+
if (arg instanceof Uint8Array && options?.allowUnknownStructs) {
|
|
631
|
+
warnIfDevelopment(`[Aptos SDK] Unsupported struct input type for argument ${position}. Continuing since 'allowUnknownStructs' is enabled.`);
|
|
632
|
+
return new FixedBytes(arg);
|
|
633
|
+
}
|
|
634
|
+
throw new Error(`Unsupported struct input type for argument ${position}, type '${param.toString()}'`);
|
|
635
|
+
}
|
|
636
|
+
throw new Error(`Type mismatch for argument ${position}, type '${param.toString()}'`);
|
|
637
|
+
}
|
|
638
|
+
/**
|
|
639
|
+
* Parses a non-BCS encoded argument into a BCS encoded argument recursively.
|
|
640
|
+
* This is the asynchronous version that supports struct/enum arguments via network calls.
|
|
641
|
+
*
|
|
642
|
+
* @param arg - The argument to be parsed, which can be of various types.
|
|
643
|
+
* @param param - The type tag that defines the expected type of the argument.
|
|
644
|
+
* @param position - The position of the argument in the function call, used for error reporting.
|
|
645
|
+
* @param genericTypeParams - An array of type tags for generic type parameters, used when the parameter type is generic.
|
|
646
|
+
* @param aptosConfig - Aptos configuration for fetching module ABIs (required for struct/enum arguments).
|
|
647
|
+
* @param moduleAbi - The ABI of the module containing the function, used for type checking.
|
|
648
|
+
* @param options - Options for the conversion process.
|
|
649
|
+
* @param options.allowUnknownStructs - If true, unknown structs will be allowed and converted to a `FixedBytes`.
|
|
650
|
+
* @group Implementation
|
|
651
|
+
* @category Transactions
|
|
652
|
+
*/
|
|
653
|
+
async function parseArgAsync(arg, param, position, genericTypeParams, aptosConfig, moduleAbi, options) {
|
|
654
|
+
if (param.isBool()) {
|
|
655
|
+
if (isBool(arg)) {
|
|
656
|
+
return new Bool(arg);
|
|
657
|
+
}
|
|
658
|
+
if (isString(arg)) {
|
|
659
|
+
if (arg === "true")
|
|
660
|
+
return new Bool(true);
|
|
661
|
+
if (arg === "false")
|
|
662
|
+
return new Bool(false);
|
|
663
|
+
}
|
|
664
|
+
/**
|
|
665
|
+
* Throws a type mismatch error for the specified move option.
|
|
666
|
+
*
|
|
667
|
+
* @param moveOption - The name of the move option that caused the type mismatch.
|
|
668
|
+
* @param position - The position where the error occurred.
|
|
669
|
+
* @group Implementation
|
|
670
|
+
* @category Transactions
|
|
671
|
+
*/
|
|
672
|
+
throwTypeMismatch("boolean", position);
|
|
673
|
+
}
|
|
674
|
+
if (param.isAddress()) {
|
|
675
|
+
if (isString(arg)) {
|
|
676
|
+
return AccountAddress.fromString(arg);
|
|
677
|
+
}
|
|
678
|
+
// Support for Uint8Array coming from external sources
|
|
679
|
+
// Usually, dapps will be getting the account address as a Uint8Array from the wallet (following
|
|
680
|
+
// the wallet standard).
|
|
681
|
+
if (arg && typeof arg === "object" && "data" in arg && arg.data instanceof Uint8Array) {
|
|
682
|
+
return new AccountAddress(arg.data);
|
|
683
|
+
}
|
|
684
|
+
throwTypeMismatch("string | AccountAddress", position);
|
|
685
|
+
}
|
|
686
|
+
if (param.isU8()) {
|
|
687
|
+
const num = convertNumber(arg);
|
|
688
|
+
if (num !== undefined) {
|
|
689
|
+
return new U8(num);
|
|
690
|
+
}
|
|
691
|
+
throwTypeMismatch("number | string", position);
|
|
692
|
+
}
|
|
693
|
+
if (param.isU16()) {
|
|
694
|
+
const num = convertNumber(arg);
|
|
695
|
+
if (num !== undefined) {
|
|
696
|
+
return new U16(num);
|
|
697
|
+
}
|
|
698
|
+
throwTypeMismatch("number | string", position);
|
|
699
|
+
}
|
|
700
|
+
if (param.isU32()) {
|
|
701
|
+
const num = convertNumber(arg);
|
|
702
|
+
if (num !== undefined) {
|
|
703
|
+
return new U32(num);
|
|
704
|
+
}
|
|
705
|
+
throwTypeMismatch("number | string", position);
|
|
706
|
+
}
|
|
707
|
+
if (param.isU64()) {
|
|
708
|
+
if (isLargeNumber(arg)) {
|
|
709
|
+
return new U64(BigInt(arg));
|
|
710
|
+
}
|
|
711
|
+
throwTypeMismatch("bigint | number | string", position);
|
|
712
|
+
}
|
|
713
|
+
if (param.isU128()) {
|
|
714
|
+
if (isLargeNumber(arg)) {
|
|
715
|
+
return new U128(BigInt(arg));
|
|
716
|
+
}
|
|
717
|
+
throwTypeMismatch("bigint | number | string", position);
|
|
718
|
+
}
|
|
719
|
+
if (param.isU256()) {
|
|
720
|
+
if (isLargeNumber(arg)) {
|
|
721
|
+
return new U256(BigInt(arg));
|
|
722
|
+
}
|
|
723
|
+
throwTypeMismatch("bigint | number | string", position);
|
|
724
|
+
}
|
|
725
|
+
if (param.isI8()) {
|
|
726
|
+
const num = convertNumber(arg);
|
|
727
|
+
if (num !== undefined) {
|
|
728
|
+
return new I8(num);
|
|
729
|
+
}
|
|
730
|
+
throwTypeMismatch("number | string", position);
|
|
731
|
+
}
|
|
732
|
+
if (param.isI16()) {
|
|
733
|
+
const num = convertNumber(arg);
|
|
734
|
+
if (num !== undefined) {
|
|
735
|
+
return new I16(num);
|
|
736
|
+
}
|
|
737
|
+
throwTypeMismatch("number | string", position);
|
|
738
|
+
}
|
|
739
|
+
if (param.isI32()) {
|
|
740
|
+
const num = convertNumber(arg);
|
|
741
|
+
if (num !== undefined) {
|
|
742
|
+
return new I32(num);
|
|
743
|
+
}
|
|
744
|
+
throwTypeMismatch("number | string", position);
|
|
745
|
+
}
|
|
746
|
+
if (param.isI64()) {
|
|
747
|
+
if (isLargeNumber(arg)) {
|
|
748
|
+
return new I64(BigInt(arg));
|
|
749
|
+
}
|
|
750
|
+
throwTypeMismatch("bigint | number | string", position);
|
|
751
|
+
}
|
|
752
|
+
if (param.isI128()) {
|
|
753
|
+
if (isLargeNumber(arg)) {
|
|
754
|
+
return new I128(BigInt(arg));
|
|
755
|
+
}
|
|
756
|
+
throwTypeMismatch("bigint | number | string", position);
|
|
757
|
+
}
|
|
758
|
+
if (param.isI256()) {
|
|
759
|
+
if (isLargeNumber(arg)) {
|
|
760
|
+
return new I256(BigInt(arg));
|
|
761
|
+
}
|
|
762
|
+
throwTypeMismatch("bigint | number | string", position);
|
|
763
|
+
}
|
|
764
|
+
// Generic needs to use the subtype
|
|
765
|
+
if (param.isGeneric()) {
|
|
766
|
+
const genericIndex = param.value;
|
|
767
|
+
if (genericIndex < 0 || genericIndex >= genericTypeParams.length) {
|
|
768
|
+
throw new Error(`Generic argument ${param.toString()} is invalid for argument ${position}`);
|
|
769
|
+
}
|
|
770
|
+
return checkOrConvertArgumentWithABI(arg, genericTypeParams[genericIndex], position, genericTypeParams, aptosConfig, moduleAbi, options);
|
|
771
|
+
}
|
|
772
|
+
// We have to special case some vectors for Vector<u8>
|
|
773
|
+
if (param.isVector()) {
|
|
774
|
+
// Check special case for Vector<u8>
|
|
775
|
+
if (param.value.isU8()) {
|
|
776
|
+
// We don't allow vector<u8>, but we convert strings to UTF8 Uint8Array
|
|
777
|
+
// This is legacy behavior from the original SDK
|
|
778
|
+
if (isString(arg)) {
|
|
779
|
+
return MoveVector.U8(TEXT_ENCODER.encode(arg));
|
|
780
|
+
}
|
|
781
|
+
if (arg instanceof Uint8Array) {
|
|
782
|
+
return MoveVector.U8(arg);
|
|
783
|
+
}
|
|
784
|
+
if (arg instanceof ArrayBuffer) {
|
|
785
|
+
return MoveVector.U8(new Uint8Array(arg));
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
if (isString(arg)) {
|
|
789
|
+
// In a web env, arguments are passing as strings
|
|
790
|
+
if (arg.startsWith("[")) {
|
|
791
|
+
return checkOrConvertArgumentWithABI(JSON.parse(arg), param, position, genericTypeParams, aptosConfig, moduleAbi, options);
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
// TODO: Support Uint16Array, Uint32Array, BigUint64Array?
|
|
795
|
+
if (Array.isArray(arg)) {
|
|
796
|
+
const elements = await Promise.all(arg.map((item) => checkOrConvertArgumentWithABI(item, param.value, position, genericTypeParams, aptosConfig, moduleAbi, options)));
|
|
797
|
+
return new MoveVector(elements);
|
|
798
|
+
}
|
|
799
|
+
throw new Error(`Type mismatch for argument ${position}, type '${param.toString()}'`);
|
|
800
|
+
}
|
|
801
|
+
// Handle structs as they're more complex
|
|
802
|
+
if (param.isStruct()) {
|
|
803
|
+
if (param.isString()) {
|
|
804
|
+
if (isString(arg)) {
|
|
805
|
+
return new MoveString(arg);
|
|
806
|
+
}
|
|
807
|
+
throwTypeMismatch("string", position);
|
|
808
|
+
}
|
|
809
|
+
if (param.isObject()) {
|
|
810
|
+
// The inner type of Object doesn't matter, since it's just syntactic sugar
|
|
811
|
+
if (isString(arg)) {
|
|
812
|
+
return AccountAddress.fromString(arg);
|
|
813
|
+
}
|
|
814
|
+
// Support for Uint8Array coming from external sources
|
|
815
|
+
if (arg && typeof arg === "object" && "data" in arg && arg.data instanceof Uint8Array) {
|
|
816
|
+
return new AccountAddress(arg.data);
|
|
817
|
+
}
|
|
818
|
+
throwTypeMismatch("string | AccountAddress", position);
|
|
819
|
+
}
|
|
820
|
+
// Handle known enum types from Aptos framework
|
|
821
|
+
if (param.isDelegationKey() || param.isRateLimiter()) {
|
|
822
|
+
if (arg instanceof Uint8Array) {
|
|
823
|
+
return new FixedBytes(arg);
|
|
824
|
+
}
|
|
825
|
+
throwTypeMismatch("Uint8Array", position);
|
|
826
|
+
}
|
|
827
|
+
if (param.isOption()) {
|
|
828
|
+
if (isEmptyOption(arg)) {
|
|
829
|
+
// Here we attempt to reconstruct the underlying type
|
|
830
|
+
// Note, for some reason the `isBool` etc. does not work with the compiler
|
|
831
|
+
const innerParam = param.value.typeArgs[0];
|
|
832
|
+
if (innerParam instanceof TypeTagBool) {
|
|
833
|
+
return new MoveOption(null);
|
|
834
|
+
}
|
|
835
|
+
if (innerParam instanceof TypeTagAddress) {
|
|
836
|
+
return new MoveOption(null);
|
|
837
|
+
}
|
|
838
|
+
if (innerParam instanceof TypeTagU8) {
|
|
839
|
+
return new MoveOption(null);
|
|
840
|
+
}
|
|
841
|
+
if (innerParam instanceof TypeTagU16) {
|
|
842
|
+
return new MoveOption(null);
|
|
843
|
+
}
|
|
844
|
+
if (innerParam instanceof TypeTagU32) {
|
|
845
|
+
return new MoveOption(null);
|
|
846
|
+
}
|
|
847
|
+
if (innerParam instanceof TypeTagU64) {
|
|
848
|
+
return new MoveOption(null);
|
|
849
|
+
}
|
|
850
|
+
if (innerParam instanceof TypeTagU128) {
|
|
851
|
+
return new MoveOption(null);
|
|
852
|
+
}
|
|
853
|
+
if (innerParam instanceof TypeTagU256) {
|
|
854
|
+
return new MoveOption(null);
|
|
855
|
+
}
|
|
856
|
+
if (innerParam instanceof TypeTagI8) {
|
|
857
|
+
return new MoveOption(null);
|
|
858
|
+
}
|
|
859
|
+
if (innerParam instanceof TypeTagI16) {
|
|
860
|
+
return new MoveOption(null);
|
|
861
|
+
}
|
|
862
|
+
if (innerParam instanceof TypeTagI32) {
|
|
863
|
+
return new MoveOption(null);
|
|
864
|
+
}
|
|
865
|
+
if (innerParam instanceof TypeTagI64) {
|
|
866
|
+
return new MoveOption(null);
|
|
867
|
+
}
|
|
868
|
+
if (innerParam instanceof TypeTagI128) {
|
|
869
|
+
return new MoveOption(null);
|
|
870
|
+
}
|
|
871
|
+
if (innerParam instanceof TypeTagI256) {
|
|
872
|
+
return new MoveOption(null);
|
|
873
|
+
}
|
|
874
|
+
// In all other cases, we will use a placeholder, it doesn't actually matter what the type is, but it will be obvious
|
|
875
|
+
// Note: This is a placeholder U8 type, and does not match the actual type, as that can't be dynamically grabbed
|
|
876
|
+
return new MoveOption(null);
|
|
877
|
+
}
|
|
878
|
+
const value = await checkOrConvertArgumentWithABI(arg, param.value.typeArgs[0], position, genericTypeParams, aptosConfig, moduleAbi);
|
|
879
|
+
return new MoveOption(value);
|
|
880
|
+
}
|
|
881
|
+
// Handle custom public copy structs and enums
|
|
882
|
+
if (typeof arg === "object" &&
|
|
883
|
+
arg !== null &&
|
|
884
|
+
!(arg instanceof Uint8Array) &&
|
|
885
|
+
!(arg instanceof ArrayBuffer) &&
|
|
886
|
+
!Array.isArray(arg)) {
|
|
887
|
+
// Check if aptosConfig is available for fetching module ABI
|
|
888
|
+
if (!aptosConfig) {
|
|
889
|
+
throw new Error(`AptosConfig required for struct/enum argument at position ${position}. ` +
|
|
890
|
+
`Type: '${param.toString()}'. ` +
|
|
891
|
+
`Either provide aptosConfig, or pre-encode the argument as a ` +
|
|
892
|
+
`MoveStructArgument / MoveEnumArgument (preferred) or as FixedBytes ` +
|
|
893
|
+
`containing the BCS-encoded value.`);
|
|
894
|
+
}
|
|
895
|
+
// Fetch the module ABI bundle with all referenced struct modules
|
|
896
|
+
// This optimization minimizes nested network calls
|
|
897
|
+
const moduleAddress = param.value.address.toString();
|
|
898
|
+
const moduleName = param.value.moduleName.identifier;
|
|
899
|
+
try {
|
|
900
|
+
const abiBundle = await fetchModuleAbiWithStructs(moduleAddress, moduleName, aptosConfig);
|
|
901
|
+
// Instantiate the parser and preload it with all referenced struct modules
|
|
902
|
+
const parser = new StructEnumArgumentParser(aptosConfig);
|
|
903
|
+
// Convert the bundle's modules to MoveModuleBytecode format for preloading
|
|
904
|
+
const modulesToPreload = new Map();
|
|
905
|
+
modulesToPreload.set(`${moduleAddress}::${moduleName}`, { abi: abiBundle.module });
|
|
906
|
+
for (const [moduleId, module] of abiBundle.referencedStructModules.entries()) {
|
|
907
|
+
modulesToPreload.set(moduleId, { abi: module });
|
|
908
|
+
}
|
|
909
|
+
parser.preloadModules(modulesToPreload);
|
|
910
|
+
// Check the ABI to determine if this is an enum or struct
|
|
911
|
+
const structDef = abiBundle.module.structs.find((s) => s.name === param.value.name.identifier);
|
|
912
|
+
let isEnumType;
|
|
913
|
+
if (structDef !== undefined) {
|
|
914
|
+
// Trust the ABI when available
|
|
915
|
+
isEnumType = structDef.is_enum;
|
|
916
|
+
}
|
|
917
|
+
else {
|
|
918
|
+
// Fallback heuristic when ABI is not available:
|
|
919
|
+
// Enums typically have format: { "VariantName": {...} } with a single key
|
|
920
|
+
const keys = Object.keys(arg);
|
|
921
|
+
isEnumType = keys.length === 1 && typeof arg[keys[0]] === "object";
|
|
922
|
+
}
|
|
923
|
+
if (isEnumType) {
|
|
924
|
+
// Encode as enum
|
|
925
|
+
return await parser.encodeEnumArgument(param, arg);
|
|
926
|
+
}
|
|
927
|
+
// Encode as struct
|
|
928
|
+
return await parser.encodeStructArgument(param, arg);
|
|
929
|
+
}
|
|
930
|
+
catch (e) {
|
|
931
|
+
throw new Error(`Failed to encode struct/enum argument at position ${position}, type '${param.toString()}': ${e.message}`);
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
// We are assuming that fieldless structs are enums, and therefore we cannot typecheck any further due
|
|
935
|
+
// to limited information from the ABI. This does not work for structs on other modules.
|
|
936
|
+
const structDefinition = moduleAbi?.structs.find((s) => s.name === param.value.name.identifier);
|
|
937
|
+
if (structDefinition?.fields.length === 0 && arg instanceof Uint8Array) {
|
|
938
|
+
return new FixedBytes(arg);
|
|
939
|
+
}
|
|
940
|
+
if (arg instanceof Uint8Array && options?.allowUnknownStructs) {
|
|
941
|
+
warnIfDevelopment(`[Aptos SDK] Unsupported struct input type for argument ${position}. Continuing since 'allowUnknownStructs' is enabled.`);
|
|
942
|
+
return new FixedBytes(arg);
|
|
943
|
+
}
|
|
944
|
+
throw new Error(`Unsupported struct input type for argument ${position}, type '${param.toString()}'`);
|
|
945
|
+
}
|
|
946
|
+
throw new Error(`Type mismatch for argument ${position}, type '${param.toString()}'`);
|
|
947
|
+
}
|
|
948
|
+
/**
|
|
949
|
+
* Checks that the type of the BCS encoded argument matches the ABI
|
|
950
|
+
* @param param
|
|
951
|
+
* @param arg
|
|
952
|
+
* @param position
|
|
953
|
+
* @group Implementation
|
|
954
|
+
* @category Transactions
|
|
955
|
+
*/
|
|
956
|
+
function checkType(param, arg, position) {
|
|
957
|
+
if (param.isBool()) {
|
|
958
|
+
if (isBcsBool(arg)) {
|
|
959
|
+
return;
|
|
960
|
+
}
|
|
961
|
+
throwTypeMismatch("Bool", position);
|
|
962
|
+
}
|
|
963
|
+
if (param.isAddress()) {
|
|
964
|
+
if (isBcsAddress(arg)) {
|
|
965
|
+
return;
|
|
966
|
+
}
|
|
967
|
+
throwTypeMismatch("AccountAddress", position);
|
|
968
|
+
}
|
|
969
|
+
if (param.isU8()) {
|
|
970
|
+
if (isBcsU8(arg)) {
|
|
971
|
+
return;
|
|
972
|
+
}
|
|
973
|
+
throwTypeMismatch("U8", position);
|
|
974
|
+
}
|
|
975
|
+
if (param.isU16()) {
|
|
976
|
+
if (isBcsU16(arg)) {
|
|
977
|
+
return;
|
|
978
|
+
}
|
|
979
|
+
throwTypeMismatch("U16", position);
|
|
980
|
+
}
|
|
981
|
+
if (param.isU32()) {
|
|
982
|
+
if (isBcsU32(arg)) {
|
|
983
|
+
return;
|
|
984
|
+
}
|
|
985
|
+
throwTypeMismatch("U32", position);
|
|
986
|
+
}
|
|
987
|
+
if (param.isU64()) {
|
|
988
|
+
if (isBcsU64(arg)) {
|
|
989
|
+
return;
|
|
990
|
+
}
|
|
991
|
+
throwTypeMismatch("U64", position);
|
|
992
|
+
}
|
|
993
|
+
if (param.isU128()) {
|
|
994
|
+
if (isBcsU128(arg)) {
|
|
995
|
+
return;
|
|
996
|
+
}
|
|
997
|
+
throwTypeMismatch("U128", position);
|
|
998
|
+
}
|
|
999
|
+
if (param.isU256()) {
|
|
1000
|
+
if (isBcsU256(arg)) {
|
|
1001
|
+
return;
|
|
1002
|
+
}
|
|
1003
|
+
throwTypeMismatch("U256", position);
|
|
1004
|
+
}
|
|
1005
|
+
if (param.isI8()) {
|
|
1006
|
+
if (isBcsI8(arg)) {
|
|
1007
|
+
return;
|
|
1008
|
+
}
|
|
1009
|
+
throwTypeMismatch("I8", position);
|
|
1010
|
+
}
|
|
1011
|
+
if (param.isI16()) {
|
|
1012
|
+
if (isBcsI16(arg)) {
|
|
1013
|
+
return;
|
|
1014
|
+
}
|
|
1015
|
+
throwTypeMismatch("I16", position);
|
|
1016
|
+
}
|
|
1017
|
+
if (param.isI32()) {
|
|
1018
|
+
if (isBcsI32(arg)) {
|
|
1019
|
+
return;
|
|
1020
|
+
}
|
|
1021
|
+
throwTypeMismatch("I32", position);
|
|
1022
|
+
}
|
|
1023
|
+
if (param.isI64()) {
|
|
1024
|
+
if (isBcsI64(arg)) {
|
|
1025
|
+
return;
|
|
1026
|
+
}
|
|
1027
|
+
throwTypeMismatch("I64", position);
|
|
1028
|
+
}
|
|
1029
|
+
if (param.isI128()) {
|
|
1030
|
+
if (isBcsI128(arg)) {
|
|
1031
|
+
return;
|
|
1032
|
+
}
|
|
1033
|
+
throwTypeMismatch("I128", position);
|
|
1034
|
+
}
|
|
1035
|
+
if (param.isI256()) {
|
|
1036
|
+
if (isBcsI256(arg)) {
|
|
1037
|
+
return;
|
|
1038
|
+
}
|
|
1039
|
+
throwTypeMismatch("I256", position);
|
|
1040
|
+
}
|
|
1041
|
+
if (param.isVector()) {
|
|
1042
|
+
if (arg instanceof MoveVector) {
|
|
1043
|
+
// If there's anything in it, check that the inner types match
|
|
1044
|
+
// Note that since it's typed, the first item should be the same as the rest
|
|
1045
|
+
if (arg.values.length > 0) {
|
|
1046
|
+
checkType(param.value, arg.values[0], position);
|
|
1047
|
+
}
|
|
1048
|
+
return;
|
|
1049
|
+
}
|
|
1050
|
+
throwTypeMismatch("MoveVector", position);
|
|
1051
|
+
}
|
|
1052
|
+
// Handle structs as they're more complex
|
|
1053
|
+
if (param instanceof TypeTagStruct) {
|
|
1054
|
+
if (param.isString()) {
|
|
1055
|
+
if (isBcsString(arg)) {
|
|
1056
|
+
return;
|
|
1057
|
+
}
|
|
1058
|
+
throwTypeMismatch("MoveString", position);
|
|
1059
|
+
}
|
|
1060
|
+
if (param.isObject()) {
|
|
1061
|
+
if (isBcsAddress(arg)) {
|
|
1062
|
+
return;
|
|
1063
|
+
}
|
|
1064
|
+
throwTypeMismatch("AccountAddress", position);
|
|
1065
|
+
}
|
|
1066
|
+
if (param.isOption()) {
|
|
1067
|
+
if (arg instanceof MoveOption) {
|
|
1068
|
+
// If there's a value, we can check the inner type (otherwise it doesn't really matter)
|
|
1069
|
+
if (arg.value !== undefined) {
|
|
1070
|
+
checkType(param.value.typeArgs[0], arg.value, position);
|
|
1071
|
+
}
|
|
1072
|
+
return;
|
|
1073
|
+
}
|
|
1074
|
+
throwTypeMismatch("MoveOption", position);
|
|
1075
|
+
}
|
|
1076
|
+
// For custom (non-framework) struct/enum params, accept the pre-encoded
|
|
1077
|
+
// argument types: MoveStructArgument, MoveEnumArgument, or FixedBytes.
|
|
1078
|
+
// We cannot fully verify the inner BCS bytes without the ABI, but accepting
|
|
1079
|
+
// these classes is safer than rejecting valid pre-encoded inputs and is
|
|
1080
|
+
// required for documented "pre-encode and pass" flows.
|
|
1081
|
+
if (arg instanceof MoveStructArgument || arg instanceof MoveEnumArgument || arg instanceof FixedBytes) {
|
|
1082
|
+
return;
|
|
1083
|
+
}
|
|
1084
|
+
throwTypeMismatch("MoveStructArgument | MoveEnumArgument | FixedBytes", position);
|
|
1085
|
+
}
|
|
1086
|
+
throw new Error(`Type mismatch for argument ${position}, expected '${param.toString()}'`);
|
|
1087
|
+
}
|
|
1088
|
+
//# sourceMappingURL=remoteAbi.js.map
|