@moveindustries/ts-sdk 5.1.4
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/LICENSE +201 -0
- package/README.md +66 -0
- package/dist/common/accountAddress-DoqkxUqw.d.ts +7769 -0
- package/dist/common/chunk-56DGDNEY.js +4 -0
- package/dist/common/chunk-56DGDNEY.js.map +1 -0
- package/dist/common/cli/index.d.ts +316 -0
- package/dist/common/cli/index.js +2 -0
- package/dist/common/cli/index.js.map +1 -0
- package/dist/common/index.d.ts +10643 -0
- package/dist/common/index.js +482 -0
- package/dist/common/index.js.map +1 -0
- package/dist/esm/Ed25519Account-DsqenvLJ.d.mts +628 -0
- package/dist/esm/account/AbstractKeylessAccount.d.mts +336 -0
- package/dist/esm/account/AbstractKeylessAccount.mjs +2 -0
- package/dist/esm/account/AbstractKeylessAccount.mjs.map +1 -0
- package/dist/esm/account/AbstractedAccount.d.mts +64 -0
- package/dist/esm/account/AbstractedAccount.mjs +2 -0
- package/dist/esm/account/AbstractedAccount.mjs.map +1 -0
- package/dist/esm/account/Account.d.mts +8 -0
- package/dist/esm/account/Account.mjs +2 -0
- package/dist/esm/account/Account.mjs.map +1 -0
- package/dist/esm/account/AccountUtils.d.mts +38 -0
- package/dist/esm/account/AccountUtils.mjs +2 -0
- package/dist/esm/account/AccountUtils.mjs.map +1 -0
- package/dist/esm/account/DerivableAbstractedAccount.d.mts +59 -0
- package/dist/esm/account/DerivableAbstractedAccount.mjs +2 -0
- package/dist/esm/account/DerivableAbstractedAccount.mjs.map +1 -0
- package/dist/esm/account/Ed25519Account.d.mts +8 -0
- package/dist/esm/account/Ed25519Account.mjs +2 -0
- package/dist/esm/account/Ed25519Account.mjs.map +1 -0
- package/dist/esm/account/EphemeralKeyPair.d.mts +141 -0
- package/dist/esm/account/EphemeralKeyPair.mjs +2 -0
- package/dist/esm/account/EphemeralKeyPair.mjs.map +1 -0
- package/dist/esm/account/FederatedKeylessAccount.d.mts +118 -0
- package/dist/esm/account/FederatedKeylessAccount.mjs +2 -0
- package/dist/esm/account/FederatedKeylessAccount.mjs.map +1 -0
- package/dist/esm/account/KeylessAccount.d.mts +124 -0
- package/dist/esm/account/KeylessAccount.mjs +2 -0
- package/dist/esm/account/KeylessAccount.mjs.map +1 -0
- package/dist/esm/account/MultiEd25519Account.d.mts +102 -0
- package/dist/esm/account/MultiEd25519Account.mjs +2 -0
- package/dist/esm/account/MultiEd25519Account.mjs.map +1 -0
- package/dist/esm/account/MultiKeyAccount.d.mts +206 -0
- package/dist/esm/account/MultiKeyAccount.mjs +2 -0
- package/dist/esm/account/MultiKeyAccount.mjs.map +1 -0
- package/dist/esm/account/SingleKeyAccount.d.mts +8 -0
- package/dist/esm/account/SingleKeyAccount.mjs +2 -0
- package/dist/esm/account/SingleKeyAccount.mjs.map +1 -0
- package/dist/esm/account/index.d.mts +24 -0
- package/dist/esm/account/index.mjs +2 -0
- package/dist/esm/account/index.mjs.map +1 -0
- package/dist/esm/account/utils.d.mts +14 -0
- package/dist/esm/account/utils.mjs +2 -0
- package/dist/esm/account/utils.mjs.map +1 -0
- package/dist/esm/accountAddress-CNXtapt1.d.mts +6979 -0
- package/dist/esm/api/account/abstraction.d.mts +181 -0
- package/dist/esm/api/account/abstraction.mjs +2 -0
- package/dist/esm/api/account/abstraction.mjs.map +1 -0
- package/dist/esm/api/account.d.mts +852 -0
- package/dist/esm/api/account.mjs +2 -0
- package/dist/esm/api/account.mjs.map +1 -0
- package/dist/esm/api/ans.d.mts +504 -0
- package/dist/esm/api/ans.mjs +2 -0
- package/dist/esm/api/ans.mjs.map +1 -0
- package/dist/esm/api/coin.d.mts +81 -0
- package/dist/esm/api/coin.mjs +2 -0
- package/dist/esm/api/coin.mjs.map +1 -0
- package/dist/esm/api/digitalAsset.d.mts +1030 -0
- package/dist/esm/api/digitalAsset.mjs +2 -0
- package/dist/esm/api/digitalAsset.mjs.map +1 -0
- package/dist/esm/api/faucet.d.mts +80 -0
- package/dist/esm/api/faucet.mjs +2 -0
- package/dist/esm/api/faucet.mjs.map +1 -0
- package/dist/esm/api/fungibleAsset.d.mts +288 -0
- package/dist/esm/api/fungibleAsset.mjs +2 -0
- package/dist/esm/api/fungibleAsset.mjs.map +1 -0
- package/dist/esm/api/general.d.mts +303 -0
- package/dist/esm/api/general.mjs +2 -0
- package/dist/esm/api/general.mjs.map +1 -0
- package/dist/esm/api/index.d.mts +46 -0
- package/dist/esm/api/index.mjs +2 -0
- package/dist/esm/api/index.mjs.map +1 -0
- package/dist/esm/api/keyless.d.mts +170 -0
- package/dist/esm/api/keyless.mjs +2 -0
- package/dist/esm/api/keyless.mjs.map +1 -0
- package/dist/esm/api/movement.d.mts +113 -0
- package/dist/esm/api/movement.mjs +2 -0
- package/dist/esm/api/movement.mjs.map +1 -0
- package/dist/esm/api/movementConfig.d.mts +7 -0
- package/dist/esm/api/movementConfig.mjs +2 -0
- package/dist/esm/api/movementConfig.mjs.map +1 -0
- package/dist/esm/api/object.d.mts +80 -0
- package/dist/esm/api/object.mjs +2 -0
- package/dist/esm/api/object.mjs.map +1 -0
- package/dist/esm/api/staking.d.mts +134 -0
- package/dist/esm/api/staking.mjs +2 -0
- package/dist/esm/api/staking.mjs.map +1 -0
- package/dist/esm/api/table.d.mts +169 -0
- package/dist/esm/api/table.mjs +2 -0
- package/dist/esm/api/table.mjs.map +1 -0
- package/dist/esm/api/transaction.d.mts +679 -0
- package/dist/esm/api/transaction.mjs +2 -0
- package/dist/esm/api/transaction.mjs.map +1 -0
- package/dist/esm/api/transactionSubmission/build.d.mts +141 -0
- package/dist/esm/api/transactionSubmission/build.mjs +2 -0
- package/dist/esm/api/transactionSubmission/build.mjs.map +1 -0
- package/dist/esm/api/transactionSubmission/helpers.d.mts +98 -0
- package/dist/esm/api/transactionSubmission/helpers.mjs +2 -0
- package/dist/esm/api/transactionSubmission/helpers.mjs.map +1 -0
- package/dist/esm/api/transactionSubmission/management.d.mts +168 -0
- package/dist/esm/api/transactionSubmission/management.mjs +2 -0
- package/dist/esm/api/transactionSubmission/management.mjs.map +1 -0
- package/dist/esm/api/transactionSubmission/sign.d.mts +124 -0
- package/dist/esm/api/transactionSubmission/sign.mjs +2 -0
- package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -0
- package/dist/esm/api/transactionSubmission/simulate.d.mts +181 -0
- package/dist/esm/api/transactionSubmission/simulate.mjs +2 -0
- package/dist/esm/api/transactionSubmission/simulate.mjs.map +1 -0
- package/dist/esm/api/transactionSubmission/submit.d.mts +142 -0
- package/dist/esm/api/transactionSubmission/submit.mjs +2 -0
- package/dist/esm/api/transactionSubmission/submit.mjs.map +1 -0
- package/dist/esm/api/utils.d.mts +45 -0
- package/dist/esm/api/utils.mjs +2 -0
- package/dist/esm/api/utils.mjs.map +1 -0
- package/dist/esm/bcs/consts.d.mts +28 -0
- package/dist/esm/bcs/consts.mjs +2 -0
- package/dist/esm/bcs/consts.mjs.map +1 -0
- package/dist/esm/bcs/deserializer.d.mts +7 -0
- package/dist/esm/bcs/deserializer.mjs +2 -0
- package/dist/esm/bcs/deserializer.mjs.map +1 -0
- package/dist/esm/bcs/index.d.mts +8 -0
- package/dist/esm/bcs/index.mjs +2 -0
- package/dist/esm/bcs/index.mjs.map +1 -0
- package/dist/esm/bcs/serializable/entryFunctionBytes.d.mts +65 -0
- package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +2 -0
- package/dist/esm/bcs/serializable/entryFunctionBytes.mjs.map +1 -0
- package/dist/esm/bcs/serializable/fixedBytes.d.mts +7 -0
- package/dist/esm/bcs/serializable/fixedBytes.mjs +2 -0
- package/dist/esm/bcs/serializable/fixedBytes.mjs.map +1 -0
- package/dist/esm/bcs/serializable/movePrimitives.d.mts +7 -0
- package/dist/esm/bcs/serializable/movePrimitives.mjs +2 -0
- package/dist/esm/bcs/serializable/movePrimitives.mjs.map +1 -0
- package/dist/esm/bcs/serializable/moveStructs.d.mts +7 -0
- package/dist/esm/bcs/serializable/moveStructs.mjs +2 -0
- package/dist/esm/bcs/serializable/moveStructs.mjs.map +1 -0
- package/dist/esm/bcs/serializer.d.mts +7 -0
- package/dist/esm/bcs/serializer.mjs +2 -0
- package/dist/esm/bcs/serializer.mjs.map +1 -0
- package/dist/esm/chunk-2KDUIZKB.mjs +2 -0
- package/dist/esm/chunk-2KDUIZKB.mjs.map +1 -0
- package/dist/esm/chunk-2QTV4AOE.mjs +2 -0
- package/dist/esm/chunk-2QTV4AOE.mjs.map +1 -0
- package/dist/esm/chunk-47V7UGV5.mjs +4 -0
- package/dist/esm/chunk-47V7UGV5.mjs.map +1 -0
- package/dist/esm/chunk-4QMXOWHP.mjs +1 -0
- package/dist/esm/chunk-4QMXOWHP.mjs.map +1 -0
- package/dist/esm/chunk-4WPQQPUF.mjs +1 -0
- package/dist/esm/chunk-4WPQQPUF.mjs.map +1 -0
- package/dist/esm/chunk-5HXLZHDW.mjs +1 -0
- package/dist/esm/chunk-5HXLZHDW.mjs.map +1 -0
- package/dist/esm/chunk-5IMQPJ6J.mjs +2 -0
- package/dist/esm/chunk-5IMQPJ6J.mjs.map +1 -0
- package/dist/esm/chunk-5ZKA765G.mjs +2 -0
- package/dist/esm/chunk-5ZKA765G.mjs.map +1 -0
- package/dist/esm/chunk-6NO4QKAO.mjs +2 -0
- package/dist/esm/chunk-6NO4QKAO.mjs.map +1 -0
- package/dist/esm/chunk-7ECCT6PK.mjs +1 -0
- package/dist/esm/chunk-7ECCT6PK.mjs.map +1 -0
- package/dist/esm/chunk-7TTTMBAK.mjs +2 -0
- package/dist/esm/chunk-7TTTMBAK.mjs.map +1 -0
- package/dist/esm/chunk-A5L76YP7.mjs +2 -0
- package/dist/esm/chunk-A5L76YP7.mjs.map +1 -0
- package/dist/esm/chunk-ANTEUWH6.mjs +2 -0
- package/dist/esm/chunk-ANTEUWH6.mjs.map +1 -0
- package/dist/esm/chunk-CHWDP6AR.mjs +2 -0
- package/dist/esm/chunk-CHWDP6AR.mjs.map +1 -0
- package/dist/esm/chunk-CRCE7R4D.mjs +2 -0
- package/dist/esm/chunk-CRCE7R4D.mjs.map +1 -0
- package/dist/esm/chunk-D6HPXGEP.mjs +2 -0
- package/dist/esm/chunk-D6HPXGEP.mjs.map +1 -0
- package/dist/esm/chunk-DS6QB6HG.mjs +4 -0
- package/dist/esm/chunk-DS6QB6HG.mjs.map +1 -0
- package/dist/esm/chunk-FD6FGKYY.mjs +1 -0
- package/dist/esm/chunk-FD6FGKYY.mjs.map +1 -0
- package/dist/esm/chunk-FJRPU2NH.mjs +2 -0
- package/dist/esm/chunk-FJRPU2NH.mjs.map +1 -0
- package/dist/esm/chunk-FS5ZJKO7.mjs +2 -0
- package/dist/esm/chunk-FS5ZJKO7.mjs.map +1 -0
- package/dist/esm/chunk-FZY4PMEE.mjs +1 -0
- package/dist/esm/chunk-FZY4PMEE.mjs.map +1 -0
- package/dist/esm/chunk-G3MHXDYA.mjs +1 -0
- package/dist/esm/chunk-G3MHXDYA.mjs.map +1 -0
- package/dist/esm/chunk-GOXRBEIJ.mjs +2 -0
- package/dist/esm/chunk-GOXRBEIJ.mjs.map +1 -0
- package/dist/esm/chunk-HGLO5LDS.mjs +1 -0
- package/dist/esm/chunk-HGLO5LDS.mjs.map +1 -0
- package/dist/esm/chunk-HL2JMZ7N.mjs +2 -0
- package/dist/esm/chunk-HL2JMZ7N.mjs.map +1 -0
- package/dist/esm/chunk-I6YGBK5S.mjs +2 -0
- package/dist/esm/chunk-I6YGBK5S.mjs.map +1 -0
- package/dist/esm/chunk-K4NT6TTN.mjs +2 -0
- package/dist/esm/chunk-K4NT6TTN.mjs.map +1 -0
- package/dist/esm/chunk-KDMSOCZY.mjs +2 -0
- package/dist/esm/chunk-KDMSOCZY.mjs.map +1 -0
- package/dist/esm/chunk-KPJGWDSQ.mjs +7 -0
- package/dist/esm/chunk-KPJGWDSQ.mjs.map +1 -0
- package/dist/esm/chunk-MEWW7VTQ.mjs +2 -0
- package/dist/esm/chunk-MEWW7VTQ.mjs.map +1 -0
- package/dist/esm/chunk-NECL5FCQ.mjs +1 -0
- package/dist/esm/chunk-NECL5FCQ.mjs.map +1 -0
- package/dist/esm/chunk-NMFJJOGW.mjs +2 -0
- package/dist/esm/chunk-NMFJJOGW.mjs.map +1 -0
- package/dist/esm/chunk-NQUZ4UHR.mjs +2 -0
- package/dist/esm/chunk-NQUZ4UHR.mjs.map +1 -0
- package/dist/esm/chunk-NUB6KE73.mjs +2 -0
- package/dist/esm/chunk-NUB6KE73.mjs.map +1 -0
- package/dist/esm/chunk-OOOAVIMQ.mjs +2 -0
- package/dist/esm/chunk-OOOAVIMQ.mjs.map +1 -0
- package/dist/esm/chunk-PCESRJYO.mjs +2 -0
- package/dist/esm/chunk-PCESRJYO.mjs.map +1 -0
- package/dist/esm/chunk-PHRRBT44.mjs +2 -0
- package/dist/esm/chunk-PHRRBT44.mjs.map +1 -0
- package/dist/esm/chunk-PZ233FIY.mjs +2 -0
- package/dist/esm/chunk-PZ233FIY.mjs.map +1 -0
- package/dist/esm/chunk-R2G23RIY.mjs +2 -0
- package/dist/esm/chunk-R2G23RIY.mjs.map +1 -0
- package/dist/esm/chunk-RL4YPMN4.mjs +2 -0
- package/dist/esm/chunk-RL4YPMN4.mjs.map +1 -0
- package/dist/esm/chunk-RUIFVDWM.mjs +2 -0
- package/dist/esm/chunk-RUIFVDWM.mjs.map +1 -0
- package/dist/esm/chunk-RXHPS4IU.mjs +2 -0
- package/dist/esm/chunk-RXHPS4IU.mjs.map +1 -0
- package/dist/esm/chunk-S4D2KBYN.mjs +2 -0
- package/dist/esm/chunk-S4D2KBYN.mjs.map +1 -0
- package/dist/esm/chunk-SRXFRTHK.mjs +2 -0
- package/dist/esm/chunk-SRXFRTHK.mjs.map +1 -0
- package/dist/esm/chunk-SYXDZA4K.mjs +2 -0
- package/dist/esm/chunk-SYXDZA4K.mjs.map +1 -0
- package/dist/esm/chunk-UI4OF6CP.mjs +2 -0
- package/dist/esm/chunk-UI4OF6CP.mjs.map +1 -0
- package/dist/esm/chunk-UL777LTI.mjs +494 -0
- package/dist/esm/chunk-UL777LTI.mjs.map +1 -0
- package/dist/esm/chunk-UVP74ONT.mjs +2 -0
- package/dist/esm/chunk-UVP74ONT.mjs.map +1 -0
- package/dist/esm/chunk-UYVPNUH3.mjs +1 -0
- package/dist/esm/chunk-UYVPNUH3.mjs.map +1 -0
- package/dist/esm/chunk-V3MBJJTL.mjs +1 -0
- package/dist/esm/chunk-V3MBJJTL.mjs.map +1 -0
- package/dist/esm/chunk-V3O2SBO4.mjs +2 -0
- package/dist/esm/chunk-V3O2SBO4.mjs.map +1 -0
- package/dist/esm/chunk-VEZCMPUG.mjs +2 -0
- package/dist/esm/chunk-VEZCMPUG.mjs.map +1 -0
- package/dist/esm/chunk-VW3WBAAD.mjs +2 -0
- package/dist/esm/chunk-VW3WBAAD.mjs.map +1 -0
- package/dist/esm/chunk-WFAH73WN.mjs +2 -0
- package/dist/esm/chunk-WFAH73WN.mjs.map +1 -0
- package/dist/esm/chunk-WVDICMU4.mjs +2 -0
- package/dist/esm/chunk-WVDICMU4.mjs.map +1 -0
- package/dist/esm/chunk-XCURF77K.mjs +2 -0
- package/dist/esm/chunk-XCURF77K.mjs.map +1 -0
- package/dist/esm/chunk-Y6YW4BAZ.mjs +2 -0
- package/dist/esm/chunk-Y6YW4BAZ.mjs.map +1 -0
- package/dist/esm/chunk-YFFYA5U3.mjs +2 -0
- package/dist/esm/chunk-YFFYA5U3.mjs.map +1 -0
- package/dist/esm/chunk-YOHEYPDP.mjs +2 -0
- package/dist/esm/chunk-YOHEYPDP.mjs.map +1 -0
- package/dist/esm/chunk-ZP4DWSQA.mjs +2 -0
- package/dist/esm/chunk-ZP4DWSQA.mjs.map +1 -0
- package/dist/esm/cli/index.d.mts +10 -0
- package/dist/esm/cli/index.mjs +2 -0
- package/dist/esm/cli/index.mjs.map +1 -0
- package/dist/esm/cli/localNode.d.mts +67 -0
- package/dist/esm/cli/localNode.mjs +2 -0
- package/dist/esm/cli/localNode.mjs.map +1 -0
- package/dist/esm/cli/move.d.mts +257 -0
- package/dist/esm/cli/move.mjs +2 -0
- package/dist/esm/cli/move.mjs.map +1 -0
- package/dist/esm/client/core.d.mts +42 -0
- package/dist/esm/client/core.mjs +2 -0
- package/dist/esm/client/core.mjs.map +1 -0
- package/dist/esm/client/get.d.mts +125 -0
- package/dist/esm/client/get.mjs +2 -0
- package/dist/esm/client/get.mjs.map +1 -0
- package/dist/esm/client/index.d.mts +10 -0
- package/dist/esm/client/index.mjs +2 -0
- package/dist/esm/client/index.mjs.map +1 -0
- package/dist/esm/client/post.d.mts +158 -0
- package/dist/esm/client/post.mjs +2 -0
- package/dist/esm/client/post.mjs.map +1 -0
- package/dist/esm/core/account/index.d.mts +8 -0
- package/dist/esm/core/account/index.mjs +2 -0
- package/dist/esm/core/account/index.mjs.map +1 -0
- package/dist/esm/core/account/utils/address.d.mts +55 -0
- package/dist/esm/core/account/utils/address.mjs +2 -0
- package/dist/esm/core/account/utils/address.mjs.map +1 -0
- package/dist/esm/core/account/utils/index.d.mts +8 -0
- package/dist/esm/core/account/utils/index.mjs +2 -0
- package/dist/esm/core/account/utils/index.mjs.map +1 -0
- package/dist/esm/core/accountAddress.d.mts +7 -0
- package/dist/esm/core/accountAddress.mjs +2 -0
- package/dist/esm/core/accountAddress.mjs.map +1 -0
- package/dist/esm/core/authenticationKey.d.mts +7 -0
- package/dist/esm/core/authenticationKey.mjs +2 -0
- package/dist/esm/core/authenticationKey.mjs.map +1 -0
- package/dist/esm/core/common.d.mts +52 -0
- package/dist/esm/core/common.mjs +2 -0
- package/dist/esm/core/common.mjs.map +1 -0
- package/dist/esm/core/crypto/abstraction.d.mts +24 -0
- package/dist/esm/core/crypto/abstraction.mjs +2 -0
- package/dist/esm/core/crypto/abstraction.mjs.map +1 -0
- package/dist/esm/core/crypto/deserializationUtils.d.mts +28 -0
- package/dist/esm/core/crypto/deserializationUtils.mjs +2 -0
- package/dist/esm/core/crypto/deserializationUtils.mjs.map +1 -0
- package/dist/esm/core/crypto/ed25519.d.mts +7 -0
- package/dist/esm/core/crypto/ed25519.mjs +2 -0
- package/dist/esm/core/crypto/ed25519.mjs.map +1 -0
- package/dist/esm/core/crypto/ephemeral.d.mts +116 -0
- package/dist/esm/core/crypto/ephemeral.mjs +2 -0
- package/dist/esm/core/crypto/ephemeral.mjs.map +1 -0
- package/dist/esm/core/crypto/federatedKeyless.d.mts +13 -0
- package/dist/esm/core/crypto/federatedKeyless.mjs +2 -0
- package/dist/esm/core/crypto/federatedKeyless.mjs.map +1 -0
- package/dist/esm/core/crypto/hdKey.d.mts +95 -0
- package/dist/esm/core/crypto/hdKey.mjs +2 -0
- package/dist/esm/core/crypto/hdKey.mjs.map +1 -0
- package/dist/esm/core/crypto/index.d.mts +19 -0
- package/dist/esm/core/crypto/index.mjs +2 -0
- package/dist/esm/core/crypto/index.mjs.map +1 -0
- package/dist/esm/core/crypto/keyless.d.mts +13 -0
- package/dist/esm/core/crypto/keyless.mjs +2 -0
- package/dist/esm/core/crypto/keyless.mjs.map +1 -0
- package/dist/esm/core/crypto/multiEd25519.d.mts +7 -0
- package/dist/esm/core/crypto/multiEd25519.mjs +2 -0
- package/dist/esm/core/crypto/multiEd25519.mjs.map +1 -0
- package/dist/esm/core/crypto/multiKey.d.mts +7 -0
- package/dist/esm/core/crypto/multiKey.mjs +2 -0
- package/dist/esm/core/crypto/multiKey.mjs.map +1 -0
- package/dist/esm/core/crypto/poseidon.d.mts +59 -0
- package/dist/esm/core/crypto/poseidon.mjs +2 -0
- package/dist/esm/core/crypto/poseidon.mjs.map +1 -0
- package/dist/esm/core/crypto/privateKey.d.mts +7 -0
- package/dist/esm/core/crypto/privateKey.mjs +2 -0
- package/dist/esm/core/crypto/privateKey.mjs.map +1 -0
- package/dist/esm/core/crypto/proof.d.mts +18 -0
- package/dist/esm/core/crypto/proof.mjs +2 -0
- package/dist/esm/core/crypto/proof.mjs.map +1 -0
- package/dist/esm/core/crypto/publicKey.d.mts +7 -0
- package/dist/esm/core/crypto/publicKey.mjs +2 -0
- package/dist/esm/core/crypto/publicKey.mjs.map +1 -0
- package/dist/esm/core/crypto/secp256k1.d.mts +7 -0
- package/dist/esm/core/crypto/secp256k1.mjs +2 -0
- package/dist/esm/core/crypto/secp256k1.mjs.map +1 -0
- package/dist/esm/core/crypto/secp256r1.d.mts +306 -0
- package/dist/esm/core/crypto/secp256r1.mjs +2 -0
- package/dist/esm/core/crypto/secp256r1.mjs.map +1 -0
- package/dist/esm/core/crypto/signature.d.mts +7 -0
- package/dist/esm/core/crypto/signature.mjs +2 -0
- package/dist/esm/core/crypto/signature.mjs.map +1 -0
- package/dist/esm/core/crypto/singleKey.d.mts +7 -0
- package/dist/esm/core/crypto/singleKey.mjs +2 -0
- package/dist/esm/core/crypto/singleKey.mjs.map +1 -0
- package/dist/esm/core/crypto/types.d.mts +11 -0
- package/dist/esm/core/crypto/types.mjs +2 -0
- package/dist/esm/core/crypto/types.mjs.map +1 -0
- package/dist/esm/core/crypto/utils.d.mts +23 -0
- package/dist/esm/core/crypto/utils.mjs +2 -0
- package/dist/esm/core/crypto/utils.mjs.map +1 -0
- package/dist/esm/core/hex.d.mts +7 -0
- package/dist/esm/core/hex.mjs +2 -0
- package/dist/esm/core/hex.mjs.map +1 -0
- package/dist/esm/core/index.d.mts +20 -0
- package/dist/esm/core/index.mjs +2 -0
- package/dist/esm/core/index.mjs.map +1 -0
- package/dist/esm/errors/index.d.mts +131 -0
- package/dist/esm/errors/index.mjs +2 -0
- package/dist/esm/errors/index.mjs.map +1 -0
- package/dist/esm/federatedKeyless-D-d9d5aC.d.mts +869 -0
- package/dist/esm/index.d.mts +71 -0
- package/dist/esm/index.mjs +2 -0
- package/dist/esm/index.mjs.map +1 -0
- package/dist/esm/internal/abstraction.d.mts +27 -0
- package/dist/esm/internal/abstraction.mjs +2 -0
- package/dist/esm/internal/abstraction.mjs.map +1 -0
- package/dist/esm/internal/account.d.mts +453 -0
- package/dist/esm/internal/account.mjs +2 -0
- package/dist/esm/internal/account.mjs.map +1 -0
- package/dist/esm/internal/ans.d.mts +365 -0
- package/dist/esm/internal/ans.mjs +2 -0
- package/dist/esm/internal/ans.mjs.map +1 -0
- package/dist/esm/internal/coin.d.mts +31 -0
- package/dist/esm/internal/coin.mjs +2 -0
- package/dist/esm/internal/coin.mjs.map +1 -0
- package/dist/esm/internal/digitalAsset.d.mts +580 -0
- package/dist/esm/internal/digitalAsset.mjs +2 -0
- package/dist/esm/internal/digitalAsset.mjs.map +1 -0
- package/dist/esm/internal/faucet.d.mts +39 -0
- package/dist/esm/internal/faucet.mjs +2 -0
- package/dist/esm/internal/faucet.mjs.map +1 -0
- package/dist/esm/internal/fungibleAsset.d.mts +112 -0
- package/dist/esm/internal/fungibleAsset.mjs +2 -0
- package/dist/esm/internal/fungibleAsset.mjs.map +1 -0
- package/dist/esm/internal/general.d.mts +92 -0
- package/dist/esm/internal/general.mjs +2 -0
- package/dist/esm/internal/general.mjs.map +1 -0
- package/dist/esm/internal/keyless.d.mts +111 -0
- package/dist/esm/internal/keyless.mjs +2 -0
- package/dist/esm/internal/keyless.mjs.map +1 -0
- package/dist/esm/internal/object.d.mts +42 -0
- package/dist/esm/internal/object.mjs +2 -0
- package/dist/esm/internal/object.mjs.map +1 -0
- package/dist/esm/internal/staking.d.mts +60 -0
- package/dist/esm/internal/staking.mjs +2 -0
- package/dist/esm/internal/staking.mjs.map +1 -0
- package/dist/esm/internal/table.d.mts +66 -0
- package/dist/esm/internal/table.mjs +2 -0
- package/dist/esm/internal/table.mjs.map +1 -0
- package/dist/esm/internal/transaction.d.mts +199 -0
- package/dist/esm/internal/transaction.mjs +2 -0
- package/dist/esm/internal/transaction.mjs.map +1 -0
- package/dist/esm/internal/transactionSubmission.d.mts +165 -0
- package/dist/esm/internal/transactionSubmission.mjs +2 -0
- package/dist/esm/internal/transactionSubmission.mjs.map +1 -0
- package/dist/esm/internal/utils/index.d.mts +8 -0
- package/dist/esm/internal/utils/index.mjs +2 -0
- package/dist/esm/internal/utils/index.mjs.map +1 -0
- package/dist/esm/internal/utils/utils.d.mts +41 -0
- package/dist/esm/internal/utils/utils.mjs +2 -0
- package/dist/esm/internal/utils/utils.mjs.map +1 -0
- package/dist/esm/internal/view.d.mts +20 -0
- package/dist/esm/internal/view.mjs +2 -0
- package/dist/esm/internal/view.mjs.map +1 -0
- package/dist/esm/transactions/authenticator/account.d.mts +7 -0
- package/dist/esm/transactions/authenticator/account.mjs +2 -0
- package/dist/esm/transactions/authenticator/account.mjs.map +1 -0
- package/dist/esm/transactions/authenticator/index.d.mts +8 -0
- package/dist/esm/transactions/authenticator/index.mjs +2 -0
- package/dist/esm/transactions/authenticator/index.mjs.map +1 -0
- package/dist/esm/transactions/authenticator/transaction.d.mts +152 -0
- package/dist/esm/transactions/authenticator/transaction.mjs +2 -0
- package/dist/esm/transactions/authenticator/transaction.mjs.map +1 -0
- package/dist/esm/transactions/index.d.mts +15 -0
- package/dist/esm/transactions/index.mjs +2 -0
- package/dist/esm/transactions/index.mjs.map +1 -0
- package/dist/esm/transactions/instances/chainId.d.mts +7 -0
- package/dist/esm/transactions/instances/chainId.mjs +2 -0
- package/dist/esm/transactions/instances/chainId.mjs.map +1 -0
- package/dist/esm/transactions/instances/identifier.d.mts +7 -0
- package/dist/esm/transactions/instances/identifier.mjs +2 -0
- package/dist/esm/transactions/instances/identifier.mjs.map +1 -0
- package/dist/esm/transactions/instances/index.d.mts +10 -0
- package/dist/esm/transactions/instances/index.mjs +2 -0
- package/dist/esm/transactions/instances/index.mjs.map +1 -0
- package/dist/esm/transactions/instances/moduleId.d.mts +7 -0
- package/dist/esm/transactions/instances/moduleId.mjs +2 -0
- package/dist/esm/transactions/instances/moduleId.mjs.map +1 -0
- package/dist/esm/transactions/instances/multiAgentTransaction.d.mts +7 -0
- package/dist/esm/transactions/instances/multiAgentTransaction.mjs +2 -0
- package/dist/esm/transactions/instances/multiAgentTransaction.mjs.map +1 -0
- package/dist/esm/transactions/instances/rawTransaction.d.mts +7 -0
- package/dist/esm/transactions/instances/rawTransaction.mjs +2 -0
- package/dist/esm/transactions/instances/rawTransaction.mjs.map +1 -0
- package/dist/esm/transactions/instances/rotationProofChallenge.d.mts +58 -0
- package/dist/esm/transactions/instances/rotationProofChallenge.mjs +2 -0
- package/dist/esm/transactions/instances/rotationProofChallenge.mjs.map +1 -0
- package/dist/esm/transactions/instances/signedTransaction.d.mts +59 -0
- package/dist/esm/transactions/instances/signedTransaction.mjs +2 -0
- package/dist/esm/transactions/instances/signedTransaction.mjs.map +1 -0
- package/dist/esm/transactions/instances/simpleTransaction.d.mts +7 -0
- package/dist/esm/transactions/instances/simpleTransaction.mjs +2 -0
- package/dist/esm/transactions/instances/simpleTransaction.mjs.map +1 -0
- package/dist/esm/transactions/instances/transactionArgument.d.mts +7 -0
- package/dist/esm/transactions/instances/transactionArgument.mjs +2 -0
- package/dist/esm/transactions/instances/transactionArgument.mjs.map +1 -0
- package/dist/esm/transactions/instances/transactionPayload.d.mts +7 -0
- package/dist/esm/transactions/instances/transactionPayload.mjs +2 -0
- package/dist/esm/transactions/instances/transactionPayload.mjs.map +1 -0
- package/dist/esm/transactions/management/accountSequenceNumber.d.mts +123 -0
- package/dist/esm/transactions/management/accountSequenceNumber.mjs +2 -0
- package/dist/esm/transactions/management/accountSequenceNumber.mjs.map +1 -0
- package/dist/esm/transactions/management/asyncQueue.d.mts +77 -0
- package/dist/esm/transactions/management/asyncQueue.mjs +2 -0
- package/dist/esm/transactions/management/asyncQueue.mjs.map +1 -0
- package/dist/esm/transactions/management/index.d.mts +12 -0
- package/dist/esm/transactions/management/index.mjs +2 -0
- package/dist/esm/transactions/management/index.mjs.map +1 -0
- package/dist/esm/transactions/management/transactionWorker.d.mts +210 -0
- package/dist/esm/transactions/management/transactionWorker.mjs +2 -0
- package/dist/esm/transactions/management/transactionWorker.mjs.map +1 -0
- package/dist/esm/transactions/transactionBuilder/helpers.d.mts +159 -0
- package/dist/esm/transactions/transactionBuilder/helpers.mjs +2 -0
- package/dist/esm/transactions/transactionBuilder/helpers.mjs.map +1 -0
- package/dist/esm/transactions/transactionBuilder/index.d.mts +11 -0
- package/dist/esm/transactions/transactionBuilder/index.mjs +2 -0
- package/dist/esm/transactions/transactionBuilder/index.mjs.map +1 -0
- package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +104 -0
- package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +2 -0
- package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs.map +1 -0
- package/dist/esm/transactions/transactionBuilder/signingMessage.d.mts +62 -0
- package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +2 -0
- package/dist/esm/transactions/transactionBuilder/signingMessage.mjs.map +1 -0
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +192 -0
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +2 -0
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs.map +1 -0
- package/dist/esm/transactions/typeTag/index.d.mts +7 -0
- package/dist/esm/transactions/typeTag/index.mjs +2 -0
- package/dist/esm/transactions/typeTag/index.mjs.map +1 -0
- package/dist/esm/transactions/typeTag/parser.d.mts +81 -0
- package/dist/esm/transactions/typeTag/parser.mjs +2 -0
- package/dist/esm/transactions/typeTag/parser.mjs.map +1 -0
- package/dist/esm/transactions/types.d.mts +7 -0
- package/dist/esm/transactions/types.mjs +2 -0
- package/dist/esm/transactions/types.mjs.map +1 -0
- package/dist/esm/types/abstraction.d.mts +15 -0
- package/dist/esm/types/abstraction.mjs +2 -0
- package/dist/esm/types/abstraction.mjs.map +1 -0
- package/dist/esm/types/generated/operations.d.mts +709 -0
- package/dist/esm/types/generated/operations.mjs +1 -0
- package/dist/esm/types/generated/operations.mjs.map +1 -0
- package/dist/esm/types/generated/queries.d.mts +66 -0
- package/dist/esm/types/generated/queries.mjs +2 -0
- package/dist/esm/types/generated/queries.mjs.map +1 -0
- package/dist/esm/types/generated/types.d.mts +9495 -0
- package/dist/esm/types/generated/types.mjs +2 -0
- package/dist/esm/types/generated/types.mjs.map +1 -0
- package/dist/esm/types/index.d.mts +7 -0
- package/dist/esm/types/index.mjs +2 -0
- package/dist/esm/types/index.mjs.map +1 -0
- package/dist/esm/types/indexer.d.mts +186 -0
- package/dist/esm/types/indexer.mjs +2 -0
- package/dist/esm/types/indexer.mjs.map +1 -0
- package/dist/esm/types/keyless.d.mts +102 -0
- package/dist/esm/types/keyless.mjs +1 -0
- package/dist/esm/types/keyless.mjs.map +1 -0
- package/dist/esm/types/types.d.mts +7 -0
- package/dist/esm/types/types.mjs +2 -0
- package/dist/esm/types/types.mjs.map +1 -0
- package/dist/esm/utils/apiEndpoints.d.mts +51 -0
- package/dist/esm/utils/apiEndpoints.mjs +2 -0
- package/dist/esm/utils/apiEndpoints.mjs.map +1 -0
- package/dist/esm/utils/const.d.mts +90 -0
- package/dist/esm/utils/const.mjs +2 -0
- package/dist/esm/utils/const.mjs.map +1 -0
- package/dist/esm/utils/helpers.d.mts +174 -0
- package/dist/esm/utils/helpers.mjs +2 -0
- package/dist/esm/utils/helpers.mjs.map +1 -0
- package/dist/esm/utils/index.d.mts +9 -0
- package/dist/esm/utils/index.mjs +2 -0
- package/dist/esm/utils/index.mjs.map +1 -0
- package/dist/esm/utils/memoize.d.mts +26 -0
- package/dist/esm/utils/memoize.mjs +2 -0
- package/dist/esm/utils/memoize.mjs.map +1 -0
- package/dist/esm/utils/normalizeBundle.d.mts +35 -0
- package/dist/esm/utils/normalizeBundle.mjs +2 -0
- package/dist/esm/utils/normalizeBundle.mjs.map +1 -0
- package/dist/esm/version.d.mts +8 -0
- package/dist/esm/version.mjs +2 -0
- package/dist/esm/version.mjs.map +1 -0
- package/package.json +98 -0
- package/src/account/AbstractKeylessAccount.ts +579 -0
- package/src/account/AbstractedAccount.ts +124 -0
- package/src/account/Account.ts +354 -0
- package/src/account/AccountUtils.ts +216 -0
- package/src/account/DerivableAbstractedAccount.ts +103 -0
- package/src/account/Ed25519Account.ts +210 -0
- package/src/account/EphemeralKeyPair.ts +222 -0
- package/src/account/FederatedKeylessAccount.ts +178 -0
- package/src/account/KeylessAccount.ts +179 -0
- package/src/account/MultiEd25519Account.ts +181 -0
- package/src/account/MultiKeyAccount.ts +296 -0
- package/src/account/SingleKeyAccount.ts +277 -0
- package/src/account/index.ts +12 -0
- package/src/account/utils.ts +16 -0
- package/src/api/account/abstraction.ts +239 -0
- package/src/api/account.ts +1128 -0
- package/src/api/ans.ts +550 -0
- package/src/api/coin.ts +83 -0
- package/src/api/digitalAsset.ts +1203 -0
- package/src/api/faucet.ts +94 -0
- package/src/api/fungibleAsset.ts +371 -0
- package/src/api/general.ts +351 -0
- package/src/api/index.ts +6 -0
- package/src/api/keyless.ts +227 -0
- package/src/api/movement.ts +171 -0
- package/src/api/movementConfig.ts +334 -0
- package/src/api/object.ts +90 -0
- package/src/api/staking.ts +161 -0
- package/src/api/table.ts +193 -0
- package/src/api/transaction.ts +784 -0
- package/src/api/transactionSubmission/build.ts +153 -0
- package/src/api/transactionSubmission/helpers.ts +112 -0
- package/src/api/transactionSubmission/management.ts +211 -0
- package/src/api/transactionSubmission/sign.ts +142 -0
- package/src/api/transactionSubmission/simulate.ts +192 -0
- package/src/api/transactionSubmission/submit.ts +156 -0
- package/src/api/utils.ts +48 -0
- package/src/bcs/consts.ts +28 -0
- package/src/bcs/deserializer.ts +550 -0
- package/src/bcs/index.ts +10 -0
- package/src/bcs/serializable/entryFunctionBytes.ts +92 -0
- package/src/bcs/serializable/fixedBytes.ts +107 -0
- package/src/bcs/serializable/movePrimitives.ts +564 -0
- package/src/bcs/serializable/moveStructs.ts +619 -0
- package/src/bcs/serializer.ts +641 -0
- package/src/cli/index.ts +2 -0
- package/src/cli/localNode.ts +169 -0
- package/src/cli/move.ts +474 -0
- package/src/client/core.ts +120 -0
- package/src/client/get.ts +262 -0
- package/src/client/index.ts +7 -0
- package/src/client/post.ts +245 -0
- package/src/core/account/index.ts +1 -0
- package/src/core/account/utils/address.ts +85 -0
- package/src/core/account/utils/index.ts +1 -0
- package/src/core/accountAddress.ts +524 -0
- package/src/core/authenticationKey.ts +157 -0
- package/src/core/common.ts +60 -0
- package/src/core/crypto/abstraction.ts +52 -0
- package/src/core/crypto/deserializationUtils.ts +106 -0
- package/src/core/crypto/ed25519.ts +493 -0
- package/src/core/crypto/ephemeral.ts +185 -0
- package/src/core/crypto/federatedKeyless.ts +169 -0
- package/src/core/crypto/hdKey.ts +136 -0
- package/src/core/crypto/index.ts +21 -0
- package/src/core/crypto/keyless.ts +1700 -0
- package/src/core/crypto/multiEd25519.ts +434 -0
- package/src/core/crypto/multiKey.ts +498 -0
- package/src/core/crypto/poseidon.ts +231 -0
- package/src/core/crypto/privateKey.ts +115 -0
- package/src/core/crypto/proof.ts +9 -0
- package/src/core/crypto/publicKey.ts +106 -0
- package/src/core/crypto/secp256k1.ts +451 -0
- package/src/core/crypto/secp256r1.ts +495 -0
- package/src/core/crypto/signature.ts +57 -0
- package/src/core/crypto/singleKey.ts +351 -0
- package/src/core/crypto/types.ts +9 -0
- package/src/core/crypto/utils.ts +63 -0
- package/src/core/hex.ts +241 -0
- package/src/core/index.ts +10 -0
- package/src/errors/index.ts +457 -0
- package/src/index.ts +14 -0
- package/src/internal/abstraction.ts +79 -0
- package/src/internal/account.ts +1484 -0
- package/src/internal/ans.ts +853 -0
- package/src/internal/coin.ts +49 -0
- package/src/internal/digitalAsset.ts +1291 -0
- package/src/internal/faucet.ts +71 -0
- package/src/internal/fungibleAsset.ts +233 -0
- package/src/internal/general.ts +161 -0
- package/src/internal/keyless.ts +297 -0
- package/src/internal/object.ts +68 -0
- package/src/internal/queries/TokenActivitiesFieldsFragment.graphql +17 -0
- package/src/internal/queries/ansTokenFragment.graphql +11 -0
- package/src/internal/queries/currentTokenOwnershipFieldsFragment.graphql +46 -0
- package/src/internal/queries/getAccountAddressesForAuthKey.graphql +8 -0
- package/src/internal/queries/getAccountCoinCount.graphql +7 -0
- package/src/internal/queries/getAccountCoinsData.graphql +32 -0
- package/src/internal/queries/getAccountCollectionsWithOwnedTokens.graphql +33 -0
- package/src/internal/queries/getAccountOwnedTokens.graphql +11 -0
- package/src/internal/queries/getAccountOwnedTokensByTokenData.graphql +11 -0
- package/src/internal/queries/getAccountOwnedTokensFromCollectionAddress.graphql +11 -0
- package/src/internal/queries/getAccountTokensCount.graphql +7 -0
- package/src/internal/queries/getAccountTransactionsCount.graphql +7 -0
- package/src/internal/queries/getAuthKeysForPublicKey.graphql +11 -0
- package/src/internal/queries/getChainTopUserTransactions.graphql +5 -0
- package/src/internal/queries/getCollectionData.graphql +29 -0
- package/src/internal/queries/getCurrentFungibleAssetBalances.graphql +17 -0
- package/src/internal/queries/getDelegatedStakingActivities.graphql +12 -0
- package/src/internal/queries/getEvents.graphql +13 -0
- package/src/internal/queries/getFungibleAssetActivities.graphql +20 -0
- package/src/internal/queries/getFungibleAssetMetadata.graphql +18 -0
- package/src/internal/queries/getNames.graphql +11 -0
- package/src/internal/queries/getNumberOfDelegatorsQuery.graphql +9 -0
- package/src/internal/queries/getObjectData.graphql +16 -0
- package/src/internal/queries/getProcessorStatus.graphql +7 -0
- package/src/internal/queries/getTableItemsData.graphql +15 -0
- package/src/internal/queries/getTableItemsMetadata.graphql +12 -0
- package/src/internal/queries/getTokenActivity.graphql +11 -0
- package/src/internal/queries/getTokenCurrentOwner.graphql +11 -0
- package/src/internal/queries/getTokenData.graphql +39 -0
- package/src/internal/staking.ts +96 -0
- package/src/internal/table.ts +117 -0
- package/src/internal/transaction.ts +503 -0
- package/src/internal/transactionSubmission.ts +454 -0
- package/src/internal/utils/index.ts +4 -0
- package/src/internal/utils/utils.ts +86 -0
- package/src/internal/view.ts +61 -0
- package/src/transactions/authenticator/account.ts +405 -0
- package/src/transactions/authenticator/index.ts +6 -0
- package/src/transactions/authenticator/transaction.ts +288 -0
- package/src/transactions/index.ts +10 -0
- package/src/transactions/instances/chainId.ts +53 -0
- package/src/transactions/instances/identifier.ts +54 -0
- package/src/transactions/instances/index.ts +14 -0
- package/src/transactions/instances/moduleId.ts +77 -0
- package/src/transactions/instances/multiAgentTransaction.ts +92 -0
- package/src/transactions/instances/rawTransaction.ts +256 -0
- package/src/transactions/instances/rotationProofChallenge.ts +86 -0
- package/src/transactions/instances/signedTransaction.ts +73 -0
- package/src/transactions/instances/simpleTransaction.ts +83 -0
- package/src/transactions/instances/transactionArgument.ts +79 -0
- package/src/transactions/instances/transactionPayload.ts +676 -0
- package/src/transactions/management/accountSequenceNumber.ts +226 -0
- package/src/transactions/management/asyncQueue.ts +126 -0
- package/src/transactions/management/index.ts +2 -0
- package/src/transactions/management/transactionWorker.ts +396 -0
- package/src/transactions/transactionBuilder/helpers.ts +319 -0
- package/src/transactions/transactionBuilder/index.ts +8 -0
- package/src/transactions/transactionBuilder/remoteAbi.ts +655 -0
- package/src/transactions/transactionBuilder/signingMessage.ts +111 -0
- package/src/transactions/transactionBuilder/transactionBuilder.ts +863 -0
- package/src/transactions/typeTag/index.ts +926 -0
- package/src/transactions/typeTag/parser.ts +434 -0
- package/src/transactions/types.ts +518 -0
- package/src/types/abstraction.ts +14 -0
- package/src/types/codegen.yaml +33 -0
- package/src/types/generated/operations.ts +738 -0
- package/src/types/generated/queries.ts +926 -0
- package/src/types/generated/types.ts +10421 -0
- package/src/types/index.ts +2 -0
- package/src/types/indexer.ts +240 -0
- package/src/types/keyless.ts +94 -0
- package/src/types/types.ts +1713 -0
- package/src/utils/apiEndpoints.ts +107 -0
- package/src/utils/const.ts +100 -0
- package/src/utils/helpers.ts +287 -0
- package/src/utils/index.ts +4 -0
- package/src/utils/memoize.ts +76 -0
- package/src/utils/normalizeBundle.ts +34 -0
- package/src/version.ts +9 -0
|
@@ -0,0 +1,863 @@
|
|
|
1
|
+
// Copyright © Move Industries
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* This file handles the transaction creation lifecycle.
|
|
6
|
+
* It holds different operations to generate a transaction payload, a raw transaction,
|
|
7
|
+
* and a signed transaction that can be simulated, signed and submitted to chain.
|
|
8
|
+
*/
|
|
9
|
+
import { sha3_256 as sha3Hash } from "@noble/hashes/sha3";
|
|
10
|
+
import { MovementConfig } from "../../api/movementConfig";
|
|
11
|
+
import { AccountAddress, AccountAddressInput, Hex, PublicKey } from "../../core";
|
|
12
|
+
import {
|
|
13
|
+
AnyPublicKey,
|
|
14
|
+
AnySignature,
|
|
15
|
+
FederatedKeylessPublicKey,
|
|
16
|
+
KeylessPublicKey,
|
|
17
|
+
KeylessSignature,
|
|
18
|
+
MultiKey,
|
|
19
|
+
MultiKeySignature,
|
|
20
|
+
Secp256k1PublicKey,
|
|
21
|
+
} from "../../core/crypto";
|
|
22
|
+
import { Ed25519PublicKey, Ed25519Signature } from "../../core/crypto/ed25519";
|
|
23
|
+
import { getLedgerInfo } from "../../internal/general";
|
|
24
|
+
import { getGasPriceEstimation } from "../../internal/transaction";
|
|
25
|
+
import { getInfo } from "../../internal/utils";
|
|
26
|
+
import { NetworkToChainId } from "../../utils/apiEndpoints";
|
|
27
|
+
import { getFunctionParts } from "../../utils/helpers";
|
|
28
|
+
import { memoizeAsync } from "../../utils/memoize";
|
|
29
|
+
import { normalizeBundle } from "../../utils/normalizeBundle";
|
|
30
|
+
import {
|
|
31
|
+
AccountAuthenticator,
|
|
32
|
+
AccountAuthenticatorEd25519,
|
|
33
|
+
AccountAuthenticatorMultiEd25519,
|
|
34
|
+
AccountAuthenticatorMultiKey,
|
|
35
|
+
AccountAuthenticatorNoAccountAuthenticator,
|
|
36
|
+
AccountAuthenticatorSingleKey,
|
|
37
|
+
} from "../authenticator/account";
|
|
38
|
+
import {
|
|
39
|
+
TransactionAuthenticator,
|
|
40
|
+
TransactionAuthenticatorEd25519,
|
|
41
|
+
TransactionAuthenticatorFeePayer,
|
|
42
|
+
TransactionAuthenticatorMultiAgent,
|
|
43
|
+
TransactionAuthenticatorMultiEd25519,
|
|
44
|
+
TransactionAuthenticatorSingleSender,
|
|
45
|
+
} from "../authenticator/transaction";
|
|
46
|
+
import {
|
|
47
|
+
ChainId,
|
|
48
|
+
EntryFunction,
|
|
49
|
+
FeePayerRawTransaction,
|
|
50
|
+
MultiAgentRawTransaction,
|
|
51
|
+
MultiSig,
|
|
52
|
+
MultiSigTransactionPayload,
|
|
53
|
+
RawTransaction,
|
|
54
|
+
Script,
|
|
55
|
+
TransactionInnerPayload,
|
|
56
|
+
TransactionPayloadEntryFunction,
|
|
57
|
+
TransactionPayloadMultiSig,
|
|
58
|
+
TransactionPayloadScript,
|
|
59
|
+
} from "../instances";
|
|
60
|
+
import { MultiAgentTransaction } from "../instances/multiAgentTransaction";
|
|
61
|
+
import { SignedTransaction } from "../instances/signedTransaction";
|
|
62
|
+
import { SimpleTransaction } from "../instances/simpleTransaction";
|
|
63
|
+
import {
|
|
64
|
+
TransactionExecutable,
|
|
65
|
+
TransactionExecutableEmpty,
|
|
66
|
+
TransactionExecutableEntryFunction,
|
|
67
|
+
TransactionExecutableScript,
|
|
68
|
+
TransactionExtraConfigV1,
|
|
69
|
+
TransactionInnerPayloadV1,
|
|
70
|
+
} from "../instances/transactionPayload";
|
|
71
|
+
import {
|
|
72
|
+
AnyRawTransaction,
|
|
73
|
+
AnyTransactionPayloadInstance,
|
|
74
|
+
EntryFunctionArgumentTypes,
|
|
75
|
+
FunctionABI,
|
|
76
|
+
InputEntryFunctionDataWithABI,
|
|
77
|
+
InputEntryFunctionDataWithRemoteABI,
|
|
78
|
+
InputGenerateMultiAgentRawTransactionArgs,
|
|
79
|
+
InputGenerateRawTransactionArgs,
|
|
80
|
+
InputGenerateSingleSignerRawTransactionArgs,
|
|
81
|
+
InputGenerateTransactionOptions,
|
|
82
|
+
InputGenerateTransactionPayloadDataWithABI,
|
|
83
|
+
InputGenerateTransactionPayloadDataWithRemoteABI,
|
|
84
|
+
InputMultiSigDataWithABI,
|
|
85
|
+
InputMultiSigDataWithRemoteABI,
|
|
86
|
+
InputScriptData,
|
|
87
|
+
InputSimulateTransactionData,
|
|
88
|
+
InputSubmitTransactionData,
|
|
89
|
+
InputViewFunctionDataWithABI,
|
|
90
|
+
InputViewFunctionDataWithRemoteABI,
|
|
91
|
+
} from "../types";
|
|
92
|
+
import { isScriptDataInput } from "./helpers";
|
|
93
|
+
import { convertArgument, fetchEntryFunctionAbi, fetchViewFunctionAbi, standardizeTypeTags } from "./remoteAbi";
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Builds a transaction payload based on the provided arguments and returns a transaction payload.
|
|
97
|
+
* This function uses the RemoteABI by default, but can also utilize a specified ABI.
|
|
98
|
+
* When we call our `generateTransactionPayload` function with the relevant type properties,
|
|
99
|
+
* Typescript can infer the return type based on the appropriate function overload.
|
|
100
|
+
* @param args - The input data for generating the transaction payload.
|
|
101
|
+
* @param args.function - The function to be called, specified in the format "moduleAddress::moduleName::functionName".
|
|
102
|
+
* @param args.functionArguments - The arguments to pass to the function.
|
|
103
|
+
* @param args.typeArguments - The type arguments for the function.
|
|
104
|
+
* @param args.movementConfig - The configuration settings for Movement.
|
|
105
|
+
* @param args.abi - The ABI to use for the transaction, if not using the RemoteABI.
|
|
106
|
+
*
|
|
107
|
+
* @returns TransactionPayload - The generated transaction payload, which can be of type TransactionPayloadScript,
|
|
108
|
+
* TransactionPayloadMultiSig, or TransactionPayloadEntryFunction.
|
|
109
|
+
* @group Implementation
|
|
110
|
+
* @category Transactions
|
|
111
|
+
*/
|
|
112
|
+
export async function generateTransactionPayload(args: InputScriptData): Promise<TransactionPayloadScript>;
|
|
113
|
+
/**
|
|
114
|
+
* @group Implementation
|
|
115
|
+
* @category Transactions
|
|
116
|
+
*/
|
|
117
|
+
export async function generateTransactionPayload(
|
|
118
|
+
args: InputEntryFunctionDataWithRemoteABI,
|
|
119
|
+
): Promise<TransactionPayloadEntryFunction>;
|
|
120
|
+
/**
|
|
121
|
+
* @group Implementation
|
|
122
|
+
* @category Transactions
|
|
123
|
+
*/
|
|
124
|
+
export async function generateTransactionPayload(
|
|
125
|
+
args: InputMultiSigDataWithRemoteABI,
|
|
126
|
+
): Promise<TransactionPayloadMultiSig>;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Builds a transaction payload based on the data argument and returns
|
|
130
|
+
* a transaction payload - TransactionPayloadScript | TransactionPayloadMultiSig | TransactionPayloadEntryFunction
|
|
131
|
+
*
|
|
132
|
+
* This uses the RemoteABI by default, and the remote ABI can be skipped by using generateTransactionPayloadWithABI
|
|
133
|
+
*
|
|
134
|
+
* @param args.data GenerateTransactionPayloadData
|
|
135
|
+
*
|
|
136
|
+
* @return TransactionPayload
|
|
137
|
+
* @group Implementation
|
|
138
|
+
* @category Transactions
|
|
139
|
+
*/
|
|
140
|
+
export async function generateTransactionPayload(
|
|
141
|
+
args: InputGenerateTransactionPayloadDataWithRemoteABI,
|
|
142
|
+
): Promise<AnyTransactionPayloadInstance> {
|
|
143
|
+
if (isScriptDataInput(args)) {
|
|
144
|
+
return generateTransactionPayloadScript(args);
|
|
145
|
+
}
|
|
146
|
+
const { moduleAddress, moduleName, functionName } = getFunctionParts(args.function);
|
|
147
|
+
|
|
148
|
+
const functionAbi = await fetchAbi({
|
|
149
|
+
key: "entry-function",
|
|
150
|
+
moduleAddress,
|
|
151
|
+
moduleName,
|
|
152
|
+
functionName,
|
|
153
|
+
movementConfig: args.movementConfig,
|
|
154
|
+
abi: args.abi,
|
|
155
|
+
fetch: fetchEntryFunctionAbi,
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
// Fill in the ABI
|
|
159
|
+
return generateTransactionPayloadWithABI({ ...args, abi: functionAbi });
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Generates a transaction payload using the provided ABI and function details.
|
|
164
|
+
* This function helps create a properly structured transaction payload for executing a specific function on a module.
|
|
165
|
+
*
|
|
166
|
+
* @param args - The input data required to generate the transaction payload.
|
|
167
|
+
* @param args.abi - The ABI of the function to be executed.
|
|
168
|
+
* @param args.function - The fully qualified name of the function in the format `moduleAddress::moduleName::functionName`.
|
|
169
|
+
* @param args.typeArguments - An array of type arguments that correspond to the function's type parameters.
|
|
170
|
+
* @param args.functionArguments - An array of arguments to be passed to the function.
|
|
171
|
+
* @param args.multisigAddress - (Optional) The address for a multisig transaction if applicable.
|
|
172
|
+
*
|
|
173
|
+
* @throws Error if the type argument count does not match the ABI or if the number of function arguments is incorrect.
|
|
174
|
+
* @group Implementation
|
|
175
|
+
* @category Transactions
|
|
176
|
+
*/
|
|
177
|
+
export function generateTransactionPayloadWithABI(args: InputEntryFunctionDataWithABI): TransactionPayloadEntryFunction;
|
|
178
|
+
/**
|
|
179
|
+
* @group Implementation
|
|
180
|
+
* @category Transactions
|
|
181
|
+
*/
|
|
182
|
+
export function generateTransactionPayloadWithABI(args: InputMultiSigDataWithABI): TransactionPayloadMultiSig;
|
|
183
|
+
/**
|
|
184
|
+
* @group Implementation
|
|
185
|
+
* @category Transactions
|
|
186
|
+
*/
|
|
187
|
+
export function generateTransactionPayloadWithABI(
|
|
188
|
+
args: InputGenerateTransactionPayloadDataWithABI,
|
|
189
|
+
): AnyTransactionPayloadInstance {
|
|
190
|
+
const functionAbi = args.abi;
|
|
191
|
+
const { moduleAddress, moduleName, functionName } = getFunctionParts(args.function);
|
|
192
|
+
|
|
193
|
+
// Ensure that all type arguments are typed properly
|
|
194
|
+
const typeArguments = standardizeTypeTags(args.typeArguments);
|
|
195
|
+
|
|
196
|
+
// Check the type argument count against the ABI
|
|
197
|
+
if (typeArguments.length !== functionAbi.typeParameters.length) {
|
|
198
|
+
throw new Error(
|
|
199
|
+
`Type argument count mismatch, expected ${functionAbi.typeParameters.length}, received ${typeArguments.length}`,
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// Check all BCS types, and convert any non-BCS types
|
|
204
|
+
const functionArguments: Array<EntryFunctionArgumentTypes> = args.functionArguments.map((arg, i) =>
|
|
205
|
+
/**
|
|
206
|
+
* Converts the argument for a specified function using its ABI and type arguments.
|
|
207
|
+
* This function helps ensure that the correct number of arguments is provided for the function call.
|
|
208
|
+
*
|
|
209
|
+
* @param args - The arguments for the function call.
|
|
210
|
+
* @param args.function - The specific function to be invoked.
|
|
211
|
+
* @param functionAbi - The ABI (Application Binary Interface) of the function, which includes parameter details.
|
|
212
|
+
* @param arg - The argument to be converted.
|
|
213
|
+
* @param i - The index of the argument in the function call.
|
|
214
|
+
* @param typeArguments - Additional type arguments that may be required for the conversion.
|
|
215
|
+
* @group Implementation
|
|
216
|
+
* @category Transactions
|
|
217
|
+
*/
|
|
218
|
+
// TODO: Fix JSDoc
|
|
219
|
+
convertArgument(args.function, functionAbi, arg, i, typeArguments),
|
|
220
|
+
);
|
|
221
|
+
|
|
222
|
+
// Check that all arguments are accounted for
|
|
223
|
+
if (functionArguments.length !== functionAbi.parameters.length) {
|
|
224
|
+
throw new Error(
|
|
225
|
+
// eslint-disable-next-line max-len
|
|
226
|
+
`Too few arguments for '${moduleAddress}::${moduleName}::${functionName}', expected ${functionAbi.parameters.length} but got ${functionArguments.length}`,
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
// Generate entry function payload
|
|
231
|
+
const entryFunctionPayload = EntryFunction.build(
|
|
232
|
+
`${moduleAddress}::${moduleName}`,
|
|
233
|
+
functionName,
|
|
234
|
+
typeArguments,
|
|
235
|
+
functionArguments,
|
|
236
|
+
);
|
|
237
|
+
|
|
238
|
+
// Send it as multi sig if it's a multisig payload
|
|
239
|
+
if ("multisigAddress" in args) {
|
|
240
|
+
const multisigAddress = AccountAddress.from(args.multisigAddress);
|
|
241
|
+
return new TransactionPayloadMultiSig(
|
|
242
|
+
new MultiSig(multisigAddress, new MultiSigTransactionPayload(entryFunctionPayload)),
|
|
243
|
+
);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// Otherwise send as an entry function
|
|
247
|
+
return new TransactionPayloadEntryFunction(entryFunctionPayload);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Generates the payload for a view function call using the provided arguments.
|
|
252
|
+
* This function helps in preparing the necessary data to interact with a specific view function on the blockchain.
|
|
253
|
+
*
|
|
254
|
+
* @param args - The input data required to generate the view function payload.
|
|
255
|
+
* @param args.function - The function identifier in the format "moduleAddress::moduleName::functionName".
|
|
256
|
+
* @param args.movementConfig - Configuration settings for the Movement client.
|
|
257
|
+
* @param args.abi - The ABI (Application Binary Interface) of the module.
|
|
258
|
+
*
|
|
259
|
+
* @returns The generated payload for the view function call.
|
|
260
|
+
* @group Implementation
|
|
261
|
+
* @category Transactions
|
|
262
|
+
*/
|
|
263
|
+
export async function generateViewFunctionPayload(args: InputViewFunctionDataWithRemoteABI): Promise<EntryFunction> {
|
|
264
|
+
const { moduleAddress, moduleName, functionName } = getFunctionParts(args.function);
|
|
265
|
+
|
|
266
|
+
const functionAbi = await fetchAbi({
|
|
267
|
+
key: "view-function",
|
|
268
|
+
moduleAddress,
|
|
269
|
+
moduleName,
|
|
270
|
+
functionName,
|
|
271
|
+
movementConfig: args.movementConfig,
|
|
272
|
+
abi: args.abi,
|
|
273
|
+
fetch: fetchViewFunctionAbi,
|
|
274
|
+
});
|
|
275
|
+
|
|
276
|
+
// Fill in the ABI
|
|
277
|
+
return generateViewFunctionPayloadWithABI({ abi: functionAbi, ...args });
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Generates a payload for a view function call using the provided ABI and arguments.
|
|
282
|
+
* This function ensures that the type arguments and function arguments are correctly formatted
|
|
283
|
+
* and match the expected counts as defined in the ABI.
|
|
284
|
+
*
|
|
285
|
+
* @param args - The input data for generating the view function payload.
|
|
286
|
+
* @param args.abi - The ABI of the function to be called.
|
|
287
|
+
* @param args.function - The full name of the function in the format "moduleAddress::moduleName::functionName".
|
|
288
|
+
* @param args.typeArguments - An array of type arguments to be used in the function call.
|
|
289
|
+
* @param args.functionArguments - An array of arguments to be passed to the function.
|
|
290
|
+
*
|
|
291
|
+
* @throws Error if the type argument count does not match the ABI or if the function arguments
|
|
292
|
+
* do not match the expected parameters defined in the ABI.
|
|
293
|
+
* @group Implementation
|
|
294
|
+
* @category Transactions
|
|
295
|
+
*/
|
|
296
|
+
export function generateViewFunctionPayloadWithABI(args: InputViewFunctionDataWithABI): EntryFunction {
|
|
297
|
+
const functionAbi = args.abi;
|
|
298
|
+
const { moduleAddress, moduleName, functionName } = getFunctionParts(args.function);
|
|
299
|
+
|
|
300
|
+
// Ensure that all type arguments are typed properly
|
|
301
|
+
const typeArguments = standardizeTypeTags(args.typeArguments);
|
|
302
|
+
|
|
303
|
+
// Check the type argument count against the ABI
|
|
304
|
+
if (typeArguments.length !== functionAbi.typeParameters.length) {
|
|
305
|
+
throw new Error(
|
|
306
|
+
`Type argument count mismatch, expected ${functionAbi.typeParameters.length}, received ${typeArguments.length}`,
|
|
307
|
+
);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
// Check all BCS types, and convert any non-BCS types
|
|
311
|
+
const functionArguments: Array<EntryFunctionArgumentTypes> =
|
|
312
|
+
args?.functionArguments?.map((arg, i) => convertArgument(args.function, functionAbi, arg, i, typeArguments)) ?? [];
|
|
313
|
+
|
|
314
|
+
// Check that all arguments are accounted for
|
|
315
|
+
if (functionArguments.length !== functionAbi.parameters.length) {
|
|
316
|
+
throw new Error(
|
|
317
|
+
// eslint-disable-next-line max-len
|
|
318
|
+
`Too few arguments for '${moduleAddress}::${moduleName}::${functionName}', expected ${functionAbi.parameters.length} but got ${functionArguments.length}`,
|
|
319
|
+
);
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
// Generate entry function payload
|
|
323
|
+
return EntryFunction.build(`${moduleAddress}::${moduleName}`, functionName, typeArguments, functionArguments);
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* Generates a transaction payload script based on the provided input data.
|
|
328
|
+
* This function helps in creating a structured script for transaction processing.
|
|
329
|
+
*
|
|
330
|
+
* @param args - The input data required to generate the transaction payload script.
|
|
331
|
+
* @param args.bytecode - The bytecode to be converted into a Uint8Array.
|
|
332
|
+
* @param args.typeArguments - The type arguments that will be standardized.
|
|
333
|
+
* @param args.functionArguments - The arguments for the function being called.
|
|
334
|
+
* @returns A new instance of TransactionPayloadScript.
|
|
335
|
+
* @group Implementation
|
|
336
|
+
* @category Transactions
|
|
337
|
+
*/
|
|
338
|
+
function generateTransactionPayloadScript(args: InputScriptData) {
|
|
339
|
+
return new TransactionPayloadScript(
|
|
340
|
+
new Script(
|
|
341
|
+
Hex.fromHexInput(args.bytecode).toUint8Array(),
|
|
342
|
+
standardizeTypeTags(args.typeArguments),
|
|
343
|
+
args.functionArguments,
|
|
344
|
+
),
|
|
345
|
+
);
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* Generates a raw transaction that can be sent to the Movement network.
|
|
350
|
+
*
|
|
351
|
+
* @param args - The arguments for generating the raw transaction.
|
|
352
|
+
* @param args.movementConfig - The configuration for the Movement network.
|
|
353
|
+
* @param args.sender - The transaction's sender account address as a hex input.
|
|
354
|
+
* @param args.payload - The transaction payload, which can be created using generateTransactionPayload().
|
|
355
|
+
* @param args.options - Optional parameters for transaction generation.
|
|
356
|
+
* @param args.feePayerAddress - The address of the fee payer for sponsored transactions.
|
|
357
|
+
*
|
|
358
|
+
* @returns RawTransaction - The generated raw transaction.
|
|
359
|
+
* @group Implementation
|
|
360
|
+
* @category Transactions
|
|
361
|
+
*/
|
|
362
|
+
export async function generateRawTransaction(args: {
|
|
363
|
+
movementConfig: MovementConfig;
|
|
364
|
+
sender: AccountAddressInput;
|
|
365
|
+
payload: AnyTransactionPayloadInstance;
|
|
366
|
+
options?: InputGenerateTransactionOptions;
|
|
367
|
+
feePayerAddress?: AccountAddressInput;
|
|
368
|
+
}): Promise<RawTransaction> {
|
|
369
|
+
const { movementConfig, sender, payload, options, feePayerAddress } = args;
|
|
370
|
+
|
|
371
|
+
if (options?.replayProtectionNonce !== undefined && options?.accountSequenceNumber !== undefined) {
|
|
372
|
+
throw new Error("Cannot specify both replayProtectionNonce and accountSequenceNumber in options.");
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
const getChainId = async () => {
|
|
376
|
+
if (NetworkToChainId[movementConfig.network]) {
|
|
377
|
+
return { chainId: NetworkToChainId[movementConfig.network] };
|
|
378
|
+
}
|
|
379
|
+
const info = await getLedgerInfo({ movementConfig });
|
|
380
|
+
return { chainId: info.chain_id };
|
|
381
|
+
};
|
|
382
|
+
|
|
383
|
+
const getGasUnitPrice = async () => {
|
|
384
|
+
if (options?.gasUnitPrice) {
|
|
385
|
+
return { gasEstimate: options.gasUnitPrice };
|
|
386
|
+
}
|
|
387
|
+
const estimation = await getGasPriceEstimation({ movementConfig });
|
|
388
|
+
return { gasEstimate: estimation.gas_estimate };
|
|
389
|
+
};
|
|
390
|
+
|
|
391
|
+
const getSequenceNumberForAny = async () => {
|
|
392
|
+
const getSequenceNumber = async () => {
|
|
393
|
+
if (options?.accountSequenceNumber !== undefined) {
|
|
394
|
+
return options.accountSequenceNumber;
|
|
395
|
+
} else if (options?.replayProtectionNonce !== undefined) {
|
|
396
|
+
// If replay nonce is provided, use it as the sequence number
|
|
397
|
+
// This is an unused value, so it's specifically to show that the sequence number is not used
|
|
398
|
+
return 0xdeadbeefn;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
return (await getInfo({ movementConfig, accountAddress: sender })).sequence_number;
|
|
402
|
+
};
|
|
403
|
+
|
|
404
|
+
/**
|
|
405
|
+
* Check if is sponsored transaction to honor AIP-52
|
|
406
|
+
* {@link https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-52.md}
|
|
407
|
+
* @group Implementation
|
|
408
|
+
* @category Transactions
|
|
409
|
+
*/
|
|
410
|
+
if (feePayerAddress && AccountAddress.from(feePayerAddress).equals(AccountAddress.ZERO)) {
|
|
411
|
+
// Handle sponsored transaction generation with the option that
|
|
412
|
+
// the main signer has not been created on chain
|
|
413
|
+
try {
|
|
414
|
+
// Check if main signer has been created on chain, if not assign sequence number 0
|
|
415
|
+
return await getSequenceNumber();
|
|
416
|
+
} catch (e: any) {
|
|
417
|
+
return 0;
|
|
418
|
+
}
|
|
419
|
+
} else {
|
|
420
|
+
return getSequenceNumber();
|
|
421
|
+
}
|
|
422
|
+
};
|
|
423
|
+
const [{ chainId }, { gasEstimate }, sequenceNumber] = await Promise.all([
|
|
424
|
+
getChainId(),
|
|
425
|
+
getGasUnitPrice(),
|
|
426
|
+
getSequenceNumberForAny(),
|
|
427
|
+
]);
|
|
428
|
+
|
|
429
|
+
const { maxGasAmount, gasUnitPrice, expireTimestamp, replayProtectionNonce } = {
|
|
430
|
+
maxGasAmount: options?.maxGasAmount ? BigInt(options.maxGasAmount) : BigInt(movementConfig.getDefaultMaxGasAmount()),
|
|
431
|
+
gasUnitPrice: options?.gasUnitPrice ?? BigInt(gasEstimate),
|
|
432
|
+
expireTimestamp:
|
|
433
|
+
options?.expireTimestamp ?? BigInt(Math.floor(Date.now() / 1000) + movementConfig.getDefaultTxnExpirySecFromNow()),
|
|
434
|
+
replayProtectionNonce: options?.replayProtectionNonce ? BigInt(options.replayProtectionNonce) : undefined,
|
|
435
|
+
};
|
|
436
|
+
|
|
437
|
+
// If we're using replay nonce, we must convert the original payload
|
|
438
|
+
let txnPayload = payload;
|
|
439
|
+
if (replayProtectionNonce !== undefined) {
|
|
440
|
+
txnPayload = convertPayloadToInnerPayload(payload, replayProtectionNonce);
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
return new RawTransaction(
|
|
444
|
+
AccountAddress.from(sender),
|
|
445
|
+
BigInt(sequenceNumber),
|
|
446
|
+
txnPayload,
|
|
447
|
+
BigInt(maxGasAmount),
|
|
448
|
+
BigInt(gasUnitPrice),
|
|
449
|
+
BigInt(expireTimestamp),
|
|
450
|
+
new ChainId(chainId),
|
|
451
|
+
);
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
export function convertPayloadToInnerPayload(
|
|
455
|
+
payload: AnyTransactionPayloadInstance,
|
|
456
|
+
replayProtectionNonce?: bigint,
|
|
457
|
+
): TransactionInnerPayload {
|
|
458
|
+
if (payload instanceof TransactionPayloadScript) {
|
|
459
|
+
return new TransactionInnerPayloadV1(
|
|
460
|
+
new TransactionExecutableScript(payload.script),
|
|
461
|
+
new TransactionExtraConfigV1(undefined, replayProtectionNonce),
|
|
462
|
+
);
|
|
463
|
+
} else if (payload instanceof TransactionPayloadEntryFunction) {
|
|
464
|
+
return new TransactionInnerPayloadV1(
|
|
465
|
+
new TransactionExecutableEntryFunction(payload.entryFunction),
|
|
466
|
+
new TransactionExtraConfigV1(undefined, replayProtectionNonce),
|
|
467
|
+
);
|
|
468
|
+
} else if (payload instanceof TransactionPayloadMultiSig) {
|
|
469
|
+
const innerPayload = payload.multiSig.transaction_payload;
|
|
470
|
+
let executable: TransactionExecutable;
|
|
471
|
+
if (innerPayload === undefined || innerPayload?.transaction_payload === undefined) {
|
|
472
|
+
executable = new TransactionExecutableEmpty();
|
|
473
|
+
} else if (innerPayload.transaction_payload instanceof EntryFunction) {
|
|
474
|
+
executable = new TransactionExecutableEntryFunction(innerPayload.transaction_payload);
|
|
475
|
+
} else {
|
|
476
|
+
// TODO For now, scripts are not supported in multi-sig transactions, so it's always entry function
|
|
477
|
+
throw new Error("Scripts are not supported in multi-sig transactions.");
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
return new TransactionInnerPayloadV1(
|
|
481
|
+
executable,
|
|
482
|
+
new TransactionExtraConfigV1(payload.multiSig.multisig_address, replayProtectionNonce),
|
|
483
|
+
);
|
|
484
|
+
} else {
|
|
485
|
+
throw new Error(`Unsupported payload type: ${payload}`);
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
/**
|
|
490
|
+
* Generates a transaction based on the provided arguments.
|
|
491
|
+
* This function can create both simple and multi-agent transactions, allowing for flexible transaction handling.
|
|
492
|
+
*
|
|
493
|
+
* @param args - The input arguments for generating the transaction.
|
|
494
|
+
* @param args.movementConfig - The configuration settings for Movement.
|
|
495
|
+
* @param args.sender - The transaction's sender account address as a hex input.
|
|
496
|
+
* @param args.payload - The transaction payload, which can be created using `generateTransactionPayload()`.
|
|
497
|
+
* @param args.options - Optional. Transaction options object.
|
|
498
|
+
* @param args.secondarySignerAddresses - Optional. An array of addresses for additional signers in a multi-signature transaction.
|
|
499
|
+
* @param args.feePayerAddress - Optional. The address of the fee payer for sponsored transactions.
|
|
500
|
+
* @returns An instance of a transaction, which may include secondary signer addresses and a fee payer address.
|
|
501
|
+
* @group Implementation
|
|
502
|
+
* @category Transactions
|
|
503
|
+
*/
|
|
504
|
+
export async function buildTransaction(args: InputGenerateSingleSignerRawTransactionArgs): Promise<SimpleTransaction>;
|
|
505
|
+
/**
|
|
506
|
+
* @group Implementation
|
|
507
|
+
* @category Transactions
|
|
508
|
+
*/
|
|
509
|
+
export async function buildTransaction(args: InputGenerateMultiAgentRawTransactionArgs): Promise<MultiAgentTransaction>;
|
|
510
|
+
|
|
511
|
+
/**
|
|
512
|
+
* Generates a transaction based on the provided arguments
|
|
513
|
+
*
|
|
514
|
+
* Note: we can start with one function to support all different payload/transaction types,
|
|
515
|
+
* and if to complex to use, we could have function for each type
|
|
516
|
+
*
|
|
517
|
+
* @param args.movementConfig MovementConfig
|
|
518
|
+
* @param args.sender The transaction's sender account address as a hex input
|
|
519
|
+
* @param args.payload The transaction payload - can create by using generateTransactionPayload()
|
|
520
|
+
* @param args.options optional. Transaction options object
|
|
521
|
+
* @param args.secondarySignerAddresses optional. For when want to create a multi signers transaction
|
|
522
|
+
* @param args.feePayerAddress optional. For when want to create a fee payer (aka sponsored) transaction
|
|
523
|
+
*
|
|
524
|
+
* @return An instance of a RawTransaction, plus optional secondary/fee payer addresses
|
|
525
|
+
* ```
|
|
526
|
+
* {
|
|
527
|
+
* rawTransaction: RawTransaction,
|
|
528
|
+
* secondarySignerAddresses?: Array<AccountAddress>,
|
|
529
|
+
* feePayerAddress?: AccountAddress
|
|
530
|
+
* }
|
|
531
|
+
* ```
|
|
532
|
+
* @group Implementation
|
|
533
|
+
* @category Transactions
|
|
534
|
+
*/
|
|
535
|
+
export async function buildTransaction(args: InputGenerateRawTransactionArgs): Promise<AnyRawTransaction> {
|
|
536
|
+
const { movementConfig, sender, payload, options, feePayerAddress } = args;
|
|
537
|
+
// generate raw transaction
|
|
538
|
+
const rawTxn = await generateRawTransaction({
|
|
539
|
+
movementConfig,
|
|
540
|
+
sender,
|
|
541
|
+
payload,
|
|
542
|
+
options,
|
|
543
|
+
feePayerAddress,
|
|
544
|
+
});
|
|
545
|
+
|
|
546
|
+
// if multi agent transaction
|
|
547
|
+
if ("secondarySignerAddresses" in args) {
|
|
548
|
+
const signers: Array<AccountAddress> =
|
|
549
|
+
args.secondarySignerAddresses?.map((signer) => AccountAddress.from(signer)) ?? [];
|
|
550
|
+
|
|
551
|
+
return new MultiAgentTransaction(
|
|
552
|
+
rawTxn,
|
|
553
|
+
signers,
|
|
554
|
+
args.feePayerAddress ? AccountAddress.from(args.feePayerAddress) : undefined,
|
|
555
|
+
);
|
|
556
|
+
}
|
|
557
|
+
// return the raw transaction
|
|
558
|
+
return new SimpleTransaction(rawTxn, args.feePayerAddress ? AccountAddress.from(args.feePayerAddress) : undefined);
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
/**
|
|
562
|
+
* Generate a signed transaction for simulation before submitting it to the chain.
|
|
563
|
+
* This function helps in preparing a transaction that can be simulated, allowing users to verify its validity and expected behavior.
|
|
564
|
+
*
|
|
565
|
+
* @param args - The input data required to generate the signed transaction for simulation.
|
|
566
|
+
* @param args.transaction - An Movement transaction type to sign.
|
|
567
|
+
* @param args.signerPublicKey - The public key of the signer.
|
|
568
|
+
* @param args.secondarySignersPublicKeys - Optional. The public keys of secondary signers if it is a multi-signer transaction.
|
|
569
|
+
* @param args.feePayerPublicKey - Optional. The public key of the fee payer in a sponsored transaction.
|
|
570
|
+
* @param args.options - Optional. Additional options for simulating the transaction.
|
|
571
|
+
*
|
|
572
|
+
* @returns A signed serialized transaction that can be simulated.
|
|
573
|
+
* @group Implementation
|
|
574
|
+
* @category Transactions
|
|
575
|
+
*/
|
|
576
|
+
export function generateSignedTransactionForSimulation(args: InputSimulateTransactionData): Uint8Array {
|
|
577
|
+
const { signerPublicKey, transaction, secondarySignersPublicKeys, feePayerPublicKey } = args;
|
|
578
|
+
|
|
579
|
+
const accountAuthenticator = getAuthenticatorForSimulation(signerPublicKey);
|
|
580
|
+
|
|
581
|
+
// fee payer transaction
|
|
582
|
+
if (transaction.feePayerAddress) {
|
|
583
|
+
const transactionToSign = new FeePayerRawTransaction(
|
|
584
|
+
transaction.rawTransaction,
|
|
585
|
+
transaction.secondarySignerAddresses ?? [],
|
|
586
|
+
transaction.feePayerAddress,
|
|
587
|
+
);
|
|
588
|
+
let secondaryAccountAuthenticators: Array<AccountAuthenticator> = [];
|
|
589
|
+
if (transaction.secondarySignerAddresses) {
|
|
590
|
+
if (secondarySignersPublicKeys) {
|
|
591
|
+
secondaryAccountAuthenticators = secondarySignersPublicKeys.map((publicKey) =>
|
|
592
|
+
getAuthenticatorForSimulation(publicKey),
|
|
593
|
+
);
|
|
594
|
+
} else {
|
|
595
|
+
secondaryAccountAuthenticators = Array.from({ length: transaction.secondarySignerAddresses.length }, () =>
|
|
596
|
+
getAuthenticatorForSimulation(undefined),
|
|
597
|
+
);
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
const feePayerAuthenticator = getAuthenticatorForSimulation(feePayerPublicKey);
|
|
601
|
+
|
|
602
|
+
const transactionAuthenticator = new TransactionAuthenticatorFeePayer(
|
|
603
|
+
accountAuthenticator,
|
|
604
|
+
transaction.secondarySignerAddresses ?? [],
|
|
605
|
+
secondaryAccountAuthenticators,
|
|
606
|
+
{
|
|
607
|
+
address: transaction.feePayerAddress,
|
|
608
|
+
authenticator: feePayerAuthenticator,
|
|
609
|
+
},
|
|
610
|
+
);
|
|
611
|
+
return new SignedTransaction(transactionToSign.raw_txn, transactionAuthenticator).bcsToBytes();
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
// multi agent transaction
|
|
615
|
+
if (transaction.secondarySignerAddresses) {
|
|
616
|
+
const transactionToSign = new MultiAgentRawTransaction(
|
|
617
|
+
transaction.rawTransaction,
|
|
618
|
+
transaction.secondarySignerAddresses,
|
|
619
|
+
);
|
|
620
|
+
|
|
621
|
+
let secondaryAccountAuthenticators: Array<AccountAuthenticator> = [];
|
|
622
|
+
|
|
623
|
+
if (secondarySignersPublicKeys) {
|
|
624
|
+
secondaryAccountAuthenticators = secondarySignersPublicKeys.map((publicKey) =>
|
|
625
|
+
getAuthenticatorForSimulation(publicKey),
|
|
626
|
+
);
|
|
627
|
+
} else {
|
|
628
|
+
secondaryAccountAuthenticators = Array.from({ length: transaction.secondarySignerAddresses.length }, () =>
|
|
629
|
+
getAuthenticatorForSimulation(undefined),
|
|
630
|
+
);
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
const transactionAuthenticator = new TransactionAuthenticatorMultiAgent(
|
|
634
|
+
accountAuthenticator,
|
|
635
|
+
transaction.secondarySignerAddresses,
|
|
636
|
+
secondaryAccountAuthenticators,
|
|
637
|
+
);
|
|
638
|
+
|
|
639
|
+
return new SignedTransaction(transactionToSign.raw_txn, transactionAuthenticator).bcsToBytes();
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
// single signer raw transaction
|
|
643
|
+
let transactionAuthenticator;
|
|
644
|
+
if (accountAuthenticator instanceof AccountAuthenticatorEd25519) {
|
|
645
|
+
transactionAuthenticator = new TransactionAuthenticatorEd25519(
|
|
646
|
+
accountAuthenticator.public_key,
|
|
647
|
+
accountAuthenticator.signature,
|
|
648
|
+
);
|
|
649
|
+
} else if (
|
|
650
|
+
accountAuthenticator instanceof AccountAuthenticatorSingleKey ||
|
|
651
|
+
accountAuthenticator instanceof AccountAuthenticatorMultiKey
|
|
652
|
+
) {
|
|
653
|
+
transactionAuthenticator = new TransactionAuthenticatorSingleSender(accountAuthenticator);
|
|
654
|
+
} else if (accountAuthenticator instanceof AccountAuthenticatorNoAccountAuthenticator) {
|
|
655
|
+
transactionAuthenticator = new TransactionAuthenticatorSingleSender(accountAuthenticator);
|
|
656
|
+
} else {
|
|
657
|
+
throw new Error("Invalid public key");
|
|
658
|
+
}
|
|
659
|
+
return new SignedTransaction(transaction.rawTransaction, transactionAuthenticator).bcsToBytes();
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
/**
|
|
663
|
+
* @group Implementation
|
|
664
|
+
* @category Transactions
|
|
665
|
+
*/
|
|
666
|
+
export function getAuthenticatorForSimulation(publicKey?: PublicKey) {
|
|
667
|
+
if (!publicKey) {
|
|
668
|
+
return new AccountAuthenticatorNoAccountAuthenticator();
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
// Wrap the public key types below with AnyPublicKey as they are only support through single sender.
|
|
672
|
+
// Learn more about AnyPublicKey here - https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-55.md
|
|
673
|
+
const convertToAnyPublicKey =
|
|
674
|
+
KeylessPublicKey.isInstance(publicKey) ||
|
|
675
|
+
FederatedKeylessPublicKey.isInstance(publicKey) ||
|
|
676
|
+
Secp256k1PublicKey.isInstance(publicKey);
|
|
677
|
+
const accountPublicKey = convertToAnyPublicKey ? new AnyPublicKey(publicKey) : publicKey;
|
|
678
|
+
|
|
679
|
+
// No need to for the signature to be matching in scheme. All that matters for simulations is that it's not valid
|
|
680
|
+
const invalidSignature = new Ed25519Signature(new Uint8Array(64));
|
|
681
|
+
|
|
682
|
+
if (Ed25519PublicKey.isInstance(accountPublicKey)) {
|
|
683
|
+
return new AccountAuthenticatorEd25519(accountPublicKey, invalidSignature);
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
if (AnyPublicKey.isInstance(accountPublicKey)) {
|
|
687
|
+
if (KeylessPublicKey.isInstance(accountPublicKey.publicKey)) {
|
|
688
|
+
return new AccountAuthenticatorSingleKey(
|
|
689
|
+
accountPublicKey,
|
|
690
|
+
new AnySignature(KeylessSignature.getSimulationSignature()),
|
|
691
|
+
);
|
|
692
|
+
}
|
|
693
|
+
return new AccountAuthenticatorSingleKey(accountPublicKey, new AnySignature(invalidSignature));
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
if (MultiKey.isInstance(accountPublicKey)) {
|
|
697
|
+
return new AccountAuthenticatorMultiKey(
|
|
698
|
+
accountPublicKey,
|
|
699
|
+
new MultiKeySignature({
|
|
700
|
+
signatures: accountPublicKey.publicKeys.map((pubKey) => {
|
|
701
|
+
if (KeylessPublicKey.isInstance(pubKey.publicKey) || FederatedKeylessPublicKey.isInstance(pubKey.publicKey)) {
|
|
702
|
+
return new AnySignature(KeylessSignature.getSimulationSignature());
|
|
703
|
+
}
|
|
704
|
+
return new AnySignature(invalidSignature);
|
|
705
|
+
}),
|
|
706
|
+
bitmap: accountPublicKey.createBitmap({
|
|
707
|
+
bits: Array(accountPublicKey.publicKeys.length)
|
|
708
|
+
.fill(0)
|
|
709
|
+
.map((_, i) => i),
|
|
710
|
+
}),
|
|
711
|
+
}),
|
|
712
|
+
);
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
throw new Error("Unsupported PublicKey used for simulations");
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
/**
|
|
719
|
+
* Generate a signed transaction ready for submission to the blockchain.
|
|
720
|
+
* This function prepares the transaction by authenticating the sender and any additional signers based on the provided arguments.
|
|
721
|
+
*
|
|
722
|
+
* @param args - The input data required to generate the signed transaction.
|
|
723
|
+
* @param args.transaction - An Movement transaction type containing the details of the transaction.
|
|
724
|
+
* @param args.senderAuthenticator - The account authenticator of the transaction sender.
|
|
725
|
+
* @param args.feePayerAuthenticator - The authenticator for the fee payer, required if the transaction has a fee payer address.
|
|
726
|
+
* @param args.additionalSignersAuthenticators - Optional authenticators for additional signers in a multi-signer transaction.
|
|
727
|
+
*
|
|
728
|
+
* @returns A Uint8Array representing the signed transaction in bytes.
|
|
729
|
+
*
|
|
730
|
+
* @throws Error if the feePayerAuthenticator is not provided for a fee payer transaction.
|
|
731
|
+
* @throws Error if additionalSignersAuthenticators are not provided for a multi-signer transaction.
|
|
732
|
+
* @group Implementation
|
|
733
|
+
* @category Transactions
|
|
734
|
+
*/
|
|
735
|
+
export function generateSignedTransaction(args: InputSubmitTransactionData): Uint8Array {
|
|
736
|
+
const { transaction, feePayerAuthenticator, additionalSignersAuthenticators } = args;
|
|
737
|
+
const senderAuthenticator = normalizeBundle(AccountAuthenticator, args.senderAuthenticator);
|
|
738
|
+
|
|
739
|
+
let txnAuthenticator: TransactionAuthenticator;
|
|
740
|
+
if (transaction.feePayerAddress) {
|
|
741
|
+
if (!feePayerAuthenticator) {
|
|
742
|
+
throw new Error("Must provide a feePayerAuthenticator argument to generate a signed fee payer transaction");
|
|
743
|
+
}
|
|
744
|
+
txnAuthenticator = new TransactionAuthenticatorFeePayer(
|
|
745
|
+
senderAuthenticator,
|
|
746
|
+
transaction.secondarySignerAddresses ?? [],
|
|
747
|
+
additionalSignersAuthenticators ?? [],
|
|
748
|
+
{
|
|
749
|
+
address: transaction.feePayerAddress,
|
|
750
|
+
authenticator: feePayerAuthenticator,
|
|
751
|
+
},
|
|
752
|
+
);
|
|
753
|
+
} else if (transaction.secondarySignerAddresses) {
|
|
754
|
+
if (!additionalSignersAuthenticators) {
|
|
755
|
+
throw new Error(
|
|
756
|
+
"Must provide a additionalSignersAuthenticators argument to generate a signed multi agent transaction",
|
|
757
|
+
);
|
|
758
|
+
}
|
|
759
|
+
txnAuthenticator = new TransactionAuthenticatorMultiAgent(
|
|
760
|
+
senderAuthenticator,
|
|
761
|
+
transaction.secondarySignerAddresses,
|
|
762
|
+
additionalSignersAuthenticators,
|
|
763
|
+
);
|
|
764
|
+
} else if (senderAuthenticator instanceof AccountAuthenticatorEd25519) {
|
|
765
|
+
txnAuthenticator = new TransactionAuthenticatorEd25519(
|
|
766
|
+
senderAuthenticator.public_key,
|
|
767
|
+
senderAuthenticator.signature,
|
|
768
|
+
);
|
|
769
|
+
} else if (senderAuthenticator instanceof AccountAuthenticatorMultiEd25519) {
|
|
770
|
+
txnAuthenticator = new TransactionAuthenticatorMultiEd25519(
|
|
771
|
+
senderAuthenticator.public_key,
|
|
772
|
+
senderAuthenticator.signature,
|
|
773
|
+
);
|
|
774
|
+
} else {
|
|
775
|
+
txnAuthenticator = new TransactionAuthenticatorSingleSender(senderAuthenticator);
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
return new SignedTransaction(transaction.rawTransaction, txnAuthenticator).bcsToBytes();
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
/**
|
|
782
|
+
* Hashes the set of values using a SHA-3 256 hash algorithm.
|
|
783
|
+
* @param input - An array of UTF-8 strings or Uint8Array byte arrays to be hashed.
|
|
784
|
+
* @group Implementation
|
|
785
|
+
* @category Transactions
|
|
786
|
+
*/
|
|
787
|
+
export function hashValues(input: (Uint8Array | string)[]): Uint8Array {
|
|
788
|
+
const hash = sha3Hash.create();
|
|
789
|
+
for (const item of input) {
|
|
790
|
+
hash.update(item);
|
|
791
|
+
}
|
|
792
|
+
return hash.digest();
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
/**
|
|
796
|
+
* The domain separated prefix for hashing transactions
|
|
797
|
+
* @group Implementation
|
|
798
|
+
* @category Transactions
|
|
799
|
+
*/
|
|
800
|
+
const TRANSACTION_PREFIX = hashValues(["APTOS::Transaction"]);
|
|
801
|
+
|
|
802
|
+
/**
|
|
803
|
+
* Generates a user transaction hash for the provided transaction payload, which must already have an authenticator.
|
|
804
|
+
* This function helps ensure the integrity and uniqueness of the transaction by producing a hash based on the signed transaction data.
|
|
805
|
+
*
|
|
806
|
+
* @param args - The input data required to submit the transaction.
|
|
807
|
+
* @param args.authenticator - The authenticator for the transaction.
|
|
808
|
+
* @param args.payload - The payload containing the transaction details.
|
|
809
|
+
* @param args.sender - The address of the sender initiating the transaction.
|
|
810
|
+
* @param args.sequenceNumber - The sequence number of the transaction for the sender.
|
|
811
|
+
* @group Implementation
|
|
812
|
+
* @category Transactions
|
|
813
|
+
*/
|
|
814
|
+
export function generateUserTransactionHash(args: InputSubmitTransactionData): string {
|
|
815
|
+
const signedTransaction = generateSignedTransaction(args);
|
|
816
|
+
|
|
817
|
+
// Transaction signature is defined as, the domain separated prefix based on struct (Transaction)
|
|
818
|
+
// Then followed by the type of the transaction for the enum, UserTransaction is 0
|
|
819
|
+
// Then followed by BCS encoded bytes of the signed transaction
|
|
820
|
+
return new Hex(hashValues([TRANSACTION_PREFIX, new Uint8Array([0]), signedTransaction])).toString();
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
/**
|
|
824
|
+
* Fetches and caches ABIs while allowing for pass-through on provided ABIs.
|
|
825
|
+
*
|
|
826
|
+
* @param key - A unique identifier for the cached ABI.
|
|
827
|
+
* @param moduleAddress - The address of the module from which to fetch the ABI.
|
|
828
|
+
* @param moduleName - The name of the module containing the function.
|
|
829
|
+
* @param functionName - The name of the function whose ABI is being fetched.
|
|
830
|
+
* @param movementConfig - Configuration settings for Movement.
|
|
831
|
+
* @param abi - An optional ABI to use if already available.
|
|
832
|
+
* @param fetch - A function to fetch the ABI if it is not provided.
|
|
833
|
+
* @group Implementation
|
|
834
|
+
* @category Transactions
|
|
835
|
+
*/
|
|
836
|
+
async function fetchAbi<T extends FunctionABI>({
|
|
837
|
+
key,
|
|
838
|
+
moduleAddress,
|
|
839
|
+
moduleName,
|
|
840
|
+
functionName,
|
|
841
|
+
movementConfig,
|
|
842
|
+
abi,
|
|
843
|
+
fetch,
|
|
844
|
+
}: {
|
|
845
|
+
key: string;
|
|
846
|
+
moduleAddress: string;
|
|
847
|
+
moduleName: string;
|
|
848
|
+
functionName: string;
|
|
849
|
+
movementConfig: MovementConfig;
|
|
850
|
+
abi?: T;
|
|
851
|
+
fetch: (moduleAddress: string, moduleName: string, functionName: string, movementConfig: MovementConfig) => Promise<T>;
|
|
852
|
+
}): Promise<T> {
|
|
853
|
+
if (abi !== undefined) {
|
|
854
|
+
return abi;
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
// We fetch the entry function ABI, and then pretend that we already had the ABI
|
|
858
|
+
return memoizeAsync(
|
|
859
|
+
async () => fetch(moduleAddress, moduleName, functionName, movementConfig),
|
|
860
|
+
`${key}-${movementConfig.network}-${moduleAddress}-${moduleName}-${functionName}`,
|
|
861
|
+
1000 * 60 * 5, // 5 minutes
|
|
862
|
+
)();
|
|
863
|
+
}
|