@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,1128 @@
|
|
|
1
|
+
// Copyright © Move Industries
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { Account as AccountModule } from "../account";
|
|
5
|
+
import {
|
|
6
|
+
AccountAddress,
|
|
7
|
+
AccountAddressInput,
|
|
8
|
+
BaseAccountPublicKey,
|
|
9
|
+
createObjectAddress,
|
|
10
|
+
PrivateKeyInput,
|
|
11
|
+
} from "../core";
|
|
12
|
+
import {
|
|
13
|
+
AccountInfo,
|
|
14
|
+
deriveAccountFromPrivateKey,
|
|
15
|
+
deriveOwnedAccountsFromSigner,
|
|
16
|
+
getAccountCoinsCount,
|
|
17
|
+
getAccountCoinsData,
|
|
18
|
+
getAccountCollectionsWithOwnedTokens,
|
|
19
|
+
getAccountOwnedObjects,
|
|
20
|
+
getAccountOwnedTokens,
|
|
21
|
+
getAccountOwnedTokensFromCollectionAddress,
|
|
22
|
+
getAccountsForPublicKey,
|
|
23
|
+
getAccountTokensCount,
|
|
24
|
+
getAccountTransactionsCount,
|
|
25
|
+
getBalance,
|
|
26
|
+
getInfo,
|
|
27
|
+
getModule,
|
|
28
|
+
getModules,
|
|
29
|
+
getModulesPage,
|
|
30
|
+
getResource,
|
|
31
|
+
getResources,
|
|
32
|
+
getResourcesPage,
|
|
33
|
+
getTransactions,
|
|
34
|
+
lookupOriginalAccountAddress,
|
|
35
|
+
} from "../internal/account";
|
|
36
|
+
import { view } from "../internal/view";
|
|
37
|
+
import {
|
|
38
|
+
AccountData,
|
|
39
|
+
AnyNumber,
|
|
40
|
+
CursorPaginationArgs,
|
|
41
|
+
GetAccountCoinsDataResponse,
|
|
42
|
+
GetAccountCollectionsWithOwnedTokenResponse,
|
|
43
|
+
GetAccountOwnedTokensFromCollectionResponse,
|
|
44
|
+
GetAccountOwnedTokensQueryResponse,
|
|
45
|
+
GetObjectDataQueryResponse,
|
|
46
|
+
LedgerVersionArg,
|
|
47
|
+
MoveModuleBytecode,
|
|
48
|
+
MoveResource,
|
|
49
|
+
MoveStructId,
|
|
50
|
+
OrderByArg,
|
|
51
|
+
PaginationArgs,
|
|
52
|
+
TokenStandardArg,
|
|
53
|
+
TransactionResponse,
|
|
54
|
+
WhereArg
|
|
55
|
+
} from "../types";
|
|
56
|
+
import { CurrentFungibleAssetBalancesBoolExp } from "../types/generated/types";
|
|
57
|
+
import { isEncodedStruct, parseEncodedStruct } from "../utils";
|
|
58
|
+
import { MOVEMENT_COIN, MOVEMENT_FA, ProcessorType } from "../utils/const";
|
|
59
|
+
import { memoizeAsync } from "../utils/memoize";
|
|
60
|
+
import { AccountAbstraction } from "./account/abstraction";
|
|
61
|
+
import { MovementConfig } from "./movementConfig";
|
|
62
|
+
import { waitForIndexerOnVersion } from "./utils";
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* A class to query all `Account` related queries on Movement.
|
|
66
|
+
* @group Account
|
|
67
|
+
*/
|
|
68
|
+
export class Account {
|
|
69
|
+
abstraction: AccountAbstraction;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Creates an instance of the Movement client with the provided configuration.
|
|
73
|
+
*
|
|
74
|
+
* @param config - The configuration settings for the Movement client.
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```typescript
|
|
78
|
+
* import { Movement, MovementConfig, Network } from "@moveindustries/ts-sdk";
|
|
79
|
+
*
|
|
80
|
+
* async function runExample() {
|
|
81
|
+
* // Initialize the Movement client with testnet configuration
|
|
82
|
+
* const config = new MovementConfig({ network: Network.TESTNET }); // specify your own network if needed
|
|
83
|
+
* const movement = new Movement(config);
|
|
84
|
+
*
|
|
85
|
+
* console.log("Movement client initialized:", aptos);
|
|
86
|
+
* }
|
|
87
|
+
* runExample().catch(console.error);
|
|
88
|
+
* ```
|
|
89
|
+
* @group Account
|
|
90
|
+
*/
|
|
91
|
+
constructor(readonly config: MovementConfig) {
|
|
92
|
+
this.abstraction = new AccountAbstraction(config);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Queries the current state for an Movement account given its account address.
|
|
97
|
+
*
|
|
98
|
+
* @param args - The arguments for retrieving account information.
|
|
99
|
+
* @param args.accountAddress - The Movement account address to query.
|
|
100
|
+
* @returns The account data.
|
|
101
|
+
*
|
|
102
|
+
* @example
|
|
103
|
+
* ```typescript
|
|
104
|
+
* import { Movement, MovementConfig, Network } from "@moveindustries/ts-sdk";
|
|
105
|
+
*
|
|
106
|
+
* const config = new MovementConfig({ network: Network.TESTNET });
|
|
107
|
+
* const movement = new Movement(config);
|
|
108
|
+
*
|
|
109
|
+
* async function runExample() {
|
|
110
|
+
* // Retrieve account information for a specific address
|
|
111
|
+
* const accountInfo = await movement.getAccountInfo({ accountAddress: "0x1" }); // replace with a real account address
|
|
112
|
+
* console.log(accountInfo);
|
|
113
|
+
* }
|
|
114
|
+
* runExample().catch(console.error);
|
|
115
|
+
* ```
|
|
116
|
+
* @group Account
|
|
117
|
+
*/
|
|
118
|
+
async getAccountInfo(args: { accountAddress: AccountAddressInput }): Promise<AccountData> {
|
|
119
|
+
return getInfo({ movementConfig: this.config, ...args });
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Queries for all modules in an account given an account address.
|
|
124
|
+
* This function may call the API multiple times to auto paginate through results.
|
|
125
|
+
*
|
|
126
|
+
* @param args.accountAddress - The Movement account address to query modules for.
|
|
127
|
+
* @param args.options.limit - The maximum number of results to return.
|
|
128
|
+
* @param args.options.ledgerVersion - The ledger version to query; if not provided, it retrieves the latest version.
|
|
129
|
+
*
|
|
130
|
+
* @returns - The account modules associated with the specified address.
|
|
131
|
+
*
|
|
132
|
+
* @example
|
|
133
|
+
* ```typescript
|
|
134
|
+
* import { Movement, MovementConfig, Network } from "@moveindustries/ts-sdk";
|
|
135
|
+
*
|
|
136
|
+
* const config = new MovementConfig({ network: Network.TESTNET });
|
|
137
|
+
* const movement = new Movement(config);
|
|
138
|
+
*
|
|
139
|
+
* async function runExample() {
|
|
140
|
+
* // Fetching account modules for a specific account
|
|
141
|
+
* const accountModules = await movement.getAccountModules({
|
|
142
|
+
* accountAddress: "0x1", // replace with a real account address
|
|
143
|
+
* options: {
|
|
144
|
+
* limit: 10, // limiting to 10 modules
|
|
145
|
+
* },
|
|
146
|
+
* });
|
|
147
|
+
*
|
|
148
|
+
* console.log(accountModules);
|
|
149
|
+
* }
|
|
150
|
+
* runExample().catch(console.error);
|
|
151
|
+
* ```
|
|
152
|
+
* @group Account
|
|
153
|
+
*/
|
|
154
|
+
async getAccountModules(args: {
|
|
155
|
+
accountAddress: AccountAddressInput;
|
|
156
|
+
options?: { limit?: number } & LedgerVersionArg;
|
|
157
|
+
}): Promise<MoveModuleBytecode[]> {
|
|
158
|
+
return getModules({ movementConfig: this.config, ...args });
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Queries for a page of modules in an account given an account address.
|
|
163
|
+
*
|
|
164
|
+
* @param args.accountAddress - The Movement account address to query modules for.
|
|
165
|
+
* @param args.options.cursor - The cursor to start returning results from. Note, this is obfuscated and is not an index.
|
|
166
|
+
* @param args.options.limit - The maximum number of results to return.
|
|
167
|
+
* @param args.options.ledgerVersion - The ledger version to query; if not provided, it retrieves the latest version.
|
|
168
|
+
*
|
|
169
|
+
* @returns - The account modules associated with the specified address. Along with a cursor for future pagination. If the cursor is undefined, it means there are no more modules to fetch.
|
|
170
|
+
*
|
|
171
|
+
* @example
|
|
172
|
+
* ```typescript
|
|
173
|
+
* import { Movement, MovementConfig, Network } from "@moveindustries/ts-sdk";
|
|
174
|
+
*
|
|
175
|
+
* const config = new MovementConfig({ network: Network.TESTNET });
|
|
176
|
+
* const movement = new Movement(config);
|
|
177
|
+
*
|
|
178
|
+
* async function runExample() {
|
|
179
|
+
* // Fetching account modules for a specific account
|
|
180
|
+
* const {modules, cursor} = await movement.getAccountModulesPage({
|
|
181
|
+
* accountAddress: "0x1", // replace with a real account address
|
|
182
|
+
* options: {
|
|
183
|
+
* cursor: undefined, // starting from the first module
|
|
184
|
+
* limit: 10, // limiting to 10 modules
|
|
185
|
+
* },
|
|
186
|
+
* });
|
|
187
|
+
*
|
|
188
|
+
* console.log(modules);
|
|
189
|
+
* console.log(`More to fetch: ${cursor !== undefined}`);
|
|
190
|
+
* }
|
|
191
|
+
* runExample().catch(console.error);
|
|
192
|
+
* ```
|
|
193
|
+
* @group Account
|
|
194
|
+
*/
|
|
195
|
+
async getAccountModulesPage(args: {
|
|
196
|
+
accountAddress: AccountAddressInput;
|
|
197
|
+
options?: CursorPaginationArgs & LedgerVersionArg;
|
|
198
|
+
}): Promise<{ modules: MoveModuleBytecode[]; cursor: string | undefined }> {
|
|
199
|
+
return getModulesPage({ movementConfig: this.config, ...args });
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Queries for a specific account module given an account address and module name.
|
|
204
|
+
*
|
|
205
|
+
* @param args.accountAddress - The Movement account address.
|
|
206
|
+
* @param args.moduleName - The name of the module.
|
|
207
|
+
* @param args.options.ledgerVersion - The ledger version to query; if not provided, it will get the latest version.
|
|
208
|
+
*
|
|
209
|
+
* @returns The account module associated with the specified account address and module name.
|
|
210
|
+
*
|
|
211
|
+
* @example
|
|
212
|
+
* ```typescript
|
|
213
|
+
* import { Movement, MovementConfig, Network } from "@moveindustries/ts-sdk";
|
|
214
|
+
*
|
|
215
|
+
* const config = new MovementConfig({ network: Network.TESTNET });
|
|
216
|
+
* const movement = new Movement(config);
|
|
217
|
+
*
|
|
218
|
+
* async function runExample() {
|
|
219
|
+
* // Get the account module for a specific account address and module name
|
|
220
|
+
* const module = await movement.getAccountModule({
|
|
221
|
+
* accountAddress: "0x1", // replace with a real account address
|
|
222
|
+
* moduleName: "MyModule" // specify the module name
|
|
223
|
+
* });
|
|
224
|
+
*
|
|
225
|
+
* console.log(module);
|
|
226
|
+
* }
|
|
227
|
+
* runExample().catch(console.error);
|
|
228
|
+
* ```
|
|
229
|
+
* @group Account
|
|
230
|
+
*/
|
|
231
|
+
async getAccountModule(args: {
|
|
232
|
+
accountAddress: AccountAddressInput;
|
|
233
|
+
moduleName: string;
|
|
234
|
+
options?: LedgerVersionArg;
|
|
235
|
+
}): Promise<MoveModuleBytecode> {
|
|
236
|
+
return getModule({ movementConfig: this.config, ...args });
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Queries account transactions given an account address.
|
|
241
|
+
* This function may call the API multiple times to auto paginate and retrieve all account transactions.
|
|
242
|
+
*
|
|
243
|
+
* @param args.accountAddress - The Movement account address to query transactions for.
|
|
244
|
+
* @param args.options - Optional pagination arguments.
|
|
245
|
+
* @param args.options.offset - The number of transactions to start returning results from.
|
|
246
|
+
* @param args.options.limit - The maximum number of results to return.
|
|
247
|
+
*
|
|
248
|
+
* @returns The account transactions.
|
|
249
|
+
*
|
|
250
|
+
* @example
|
|
251
|
+
* ```typescript
|
|
252
|
+
* import { Movement, MovementConfig, Network } from "@moveindustries/ts-sdk";
|
|
253
|
+
*
|
|
254
|
+
* const config = new MovementConfig({ network: Network.TESTNET });
|
|
255
|
+
* const movement = new Movement(config);
|
|
256
|
+
*
|
|
257
|
+
* async function runExample() {
|
|
258
|
+
* // Fetch transactions for a specific account
|
|
259
|
+
* const transactions = await movement.getAccountTransactions({
|
|
260
|
+
* accountAddress: "0x1", // replace with a real account address
|
|
261
|
+
* options: {
|
|
262
|
+
* offset: 0, // starting from the first transaction
|
|
263
|
+
* limit: 10, // limiting to 10 transactions
|
|
264
|
+
* },
|
|
265
|
+
* });
|
|
266
|
+
*
|
|
267
|
+
* console.log(transactions);
|
|
268
|
+
* }
|
|
269
|
+
* runExample().catch(console.error);
|
|
270
|
+
* ```
|
|
271
|
+
* @group Account
|
|
272
|
+
*/
|
|
273
|
+
async getAccountTransactions(args: {
|
|
274
|
+
accountAddress: AccountAddressInput;
|
|
275
|
+
options?: PaginationArgs;
|
|
276
|
+
}): Promise<TransactionResponse[]> {
|
|
277
|
+
return getTransactions({
|
|
278
|
+
movementConfig: this.config,
|
|
279
|
+
...args,
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Queries all account resources given an account address.
|
|
285
|
+
* This function may call the API multiple times to auto paginate through results.
|
|
286
|
+
*
|
|
287
|
+
* @param args.accountAddress - The Movement account address to query resources for.
|
|
288
|
+
* @param args.options.limit - The maximum number of results to return.
|
|
289
|
+
* @param args.options.ledgerVersion - The ledger version to query; if not provided, it will get the latest version.
|
|
290
|
+
* @returns Account resources.
|
|
291
|
+
*
|
|
292
|
+
* @example
|
|
293
|
+
* ```typescript
|
|
294
|
+
* import { Movement, MovementConfig, Network } from "@moveindustries/ts-sdk";
|
|
295
|
+
*
|
|
296
|
+
* const config = new MovementConfig({ network: Network.TESTNET });
|
|
297
|
+
* const movement = new Movement(config);
|
|
298
|
+
*
|
|
299
|
+
* async function runExample() {
|
|
300
|
+
* // Fetching account resources for a specific account address
|
|
301
|
+
* const resources = await movement.getAccountResources({ accountAddress: "0x1" }); // replace with a real account address
|
|
302
|
+
* console.log(resources);
|
|
303
|
+
* }
|
|
304
|
+
* runExample().catch(console.error);
|
|
305
|
+
* ```
|
|
306
|
+
* @group Account
|
|
307
|
+
*/
|
|
308
|
+
async getAccountResources(args: {
|
|
309
|
+
accountAddress: AccountAddressInput;
|
|
310
|
+
options?: PaginationArgs & LedgerVersionArg;
|
|
311
|
+
}): Promise<MoveResource[]> {
|
|
312
|
+
return getResources({ movementConfig: this.config, ...args });
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Queries a page of account resources given an account address.
|
|
317
|
+
*
|
|
318
|
+
* @param args.accountAddress - The Movement account address to query resources for.
|
|
319
|
+
* @param args.options.cursor - The cursor to start returning results from. Note, this is obfuscated and is not an index.
|
|
320
|
+
* @param args.options.limit - The maximum number of results to return.
|
|
321
|
+
* @param args.options.ledgerVersion - The ledger version to query; if not provided, it will get the latest version.
|
|
322
|
+
* @returns Account resources.
|
|
323
|
+
*
|
|
324
|
+
* @example
|
|
325
|
+
* ```typescript
|
|
326
|
+
* import { Movement, MovementConfig, Network } from "@moveindustries/ts-sdk";
|
|
327
|
+
*
|
|
328
|
+
* const config = new MovementConfig({ network: Network.TESTNET });
|
|
329
|
+
* const movement = new Movement(config);
|
|
330
|
+
*
|
|
331
|
+
* async function runExample() {
|
|
332
|
+
* // Fetching account resources for a specific account address
|
|
333
|
+
* const resources = await movement.getAccountResourcesPage({
|
|
334
|
+
* accountAddress: "0x1", // replace with a real account address
|
|
335
|
+
* options: {
|
|
336
|
+
* cursor: undefined, // starting from the first resource
|
|
337
|
+
* limit: 10, // limiting to 10 resources
|
|
338
|
+
* },
|
|
339
|
+
* });
|
|
340
|
+
* console.log(resources);
|
|
341
|
+
* console.log(`More to fetch: ${resources.cursor !== undefined}`);
|
|
342
|
+
* }
|
|
343
|
+
* runExample().catch(console.error);
|
|
344
|
+
* ```
|
|
345
|
+
* @group Account
|
|
346
|
+
*/
|
|
347
|
+
async getAccountResourcesPage(args: {
|
|
348
|
+
accountAddress: AccountAddressInput;
|
|
349
|
+
options?: CursorPaginationArgs & LedgerVersionArg;
|
|
350
|
+
}): Promise<{ resources: MoveResource[]; cursor: string | undefined }> {
|
|
351
|
+
return getResourcesPage({ movementConfig: this.config, ...args });
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* Queries a specific account resource given an account address and resource type.
|
|
356
|
+
*
|
|
357
|
+
* @template T - The typed output of the resource.
|
|
358
|
+
* @param args.accountAddress - The Movement account address to query.
|
|
359
|
+
* @param args.resourceType - The string representation of an on-chain Move struct type, e.g., "0x1::aptos_coin::AptosCoin".
|
|
360
|
+
* @param args.options.ledgerVersion - The ledger version to query; if not provided, it will get the latest version.
|
|
361
|
+
* @returns The account resource of the specified type.
|
|
362
|
+
*
|
|
363
|
+
* @example
|
|
364
|
+
* ```typescript
|
|
365
|
+
* import { Movement, MovementConfig, Network } from "@moveindustries/ts-sdk";
|
|
366
|
+
*
|
|
367
|
+
* const config = new MovementConfig({ network: Network.TESTNET });
|
|
368
|
+
* const movement = new Movement(config);
|
|
369
|
+
*
|
|
370
|
+
* async function runExample() {
|
|
371
|
+
* // Get the account resource for a specific account address and resource type
|
|
372
|
+
* const resource = await movement.getAccountResource({
|
|
373
|
+
* accountAddress: "0x1", // replace with a real account address
|
|
374
|
+
* resourceType: "0x1::aptos_coin::AptosCoin"
|
|
375
|
+
* });
|
|
376
|
+
*
|
|
377
|
+
* console.log(resource);
|
|
378
|
+
* }
|
|
379
|
+
* runExample().catch(console.error);
|
|
380
|
+
* ```
|
|
381
|
+
* @group Account
|
|
382
|
+
*/
|
|
383
|
+
async getAccountResource<T extends {} = any>(args: {
|
|
384
|
+
accountAddress: AccountAddressInput;
|
|
385
|
+
resourceType: MoveStructId;
|
|
386
|
+
options?: LedgerVersionArg;
|
|
387
|
+
}): Promise<T> {
|
|
388
|
+
return getResource<T>({ movementConfig: this.config, ...args });
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* Looks up the account address for a given authentication key, handling both rotated and non-rotated keys.
|
|
393
|
+
*
|
|
394
|
+
* @param args.authenticationKey - The authentication key for which to look up the account address.
|
|
395
|
+
* @param args.minimumLedgerVersion - Optional ledger version to sync up to before querying.
|
|
396
|
+
* @param args.options.ledgerVersion - The ledger version to query; if not provided, it will get the latest version.
|
|
397
|
+
* @returns Promise<AccountAddress> - The account address associated with the authentication key.
|
|
398
|
+
*
|
|
399
|
+
* @example
|
|
400
|
+
* ```typescript
|
|
401
|
+
* import { Movement, MovementConfig, Network } from "@moveindustries/ts-sdk";
|
|
402
|
+
*
|
|
403
|
+
* const config = new MovementConfig({ network: Network.TESTNET });
|
|
404
|
+
* const movement = new Movement(config);
|
|
405
|
+
*
|
|
406
|
+
* async function runExample() {
|
|
407
|
+
* // Look up the original account address for a given authentication key
|
|
408
|
+
* const accountAddress = await movement.lookupOriginalAccountAddress({
|
|
409
|
+
* authenticationKey: "0x1", // replace with a real authentication key
|
|
410
|
+
* });
|
|
411
|
+
*
|
|
412
|
+
* console.log("Original Account Address:", accountAddress);
|
|
413
|
+
* }
|
|
414
|
+
* runExample().catch(console.error);
|
|
415
|
+
* ```
|
|
416
|
+
* @group Account
|
|
417
|
+
*/
|
|
418
|
+
async lookupOriginalAccountAddress(args: {
|
|
419
|
+
authenticationKey: AccountAddressInput;
|
|
420
|
+
minimumLedgerVersion?: AnyNumber;
|
|
421
|
+
options?: LedgerVersionArg;
|
|
422
|
+
}): Promise<AccountAddress> {
|
|
423
|
+
return lookupOriginalAccountAddress({ movementConfig: this.config, ...args });
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
/**
|
|
427
|
+
* Queries the current count of tokens owned by a specified account.
|
|
428
|
+
*
|
|
429
|
+
* @param args - The parameters for the query.
|
|
430
|
+
* @param args.accountAddress - The account address to query the token count for.
|
|
431
|
+
* @param args.minimumLedgerVersion - Optional ledger version to sync up to before querying.
|
|
432
|
+
* @returns The current count of tokens owned by the account.
|
|
433
|
+
*
|
|
434
|
+
* @example
|
|
435
|
+
* ```typescript
|
|
436
|
+
* import { Movement, MovementConfig, Network } from "@moveindustries/ts-sdk";
|
|
437
|
+
*
|
|
438
|
+
* const config = new MovementConfig({ network: Network.TESTNET });
|
|
439
|
+
* const movement = new Movement(config);
|
|
440
|
+
*
|
|
441
|
+
* async function runExample() {
|
|
442
|
+
* // Get the count of tokens owned by the account
|
|
443
|
+
* const tokensCount = await movement.getAccountTokensCount({ accountAddress: "0x1" }); // replace with a real account address
|
|
444
|
+
* console.log(`Tokens Count: ${tokensCount}`);
|
|
445
|
+
* }
|
|
446
|
+
* runExample().catch(console.error);
|
|
447
|
+
* ```
|
|
448
|
+
* @group Account
|
|
449
|
+
*/
|
|
450
|
+
async getAccountTokensCount(args: {
|
|
451
|
+
accountAddress: AccountAddressInput;
|
|
452
|
+
minimumLedgerVersion?: AnyNumber;
|
|
453
|
+
}): Promise<number> {
|
|
454
|
+
await waitForIndexerOnVersion({
|
|
455
|
+
config: this.config,
|
|
456
|
+
minimumLedgerVersion: args.minimumLedgerVersion,
|
|
457
|
+
processorType: ProcessorType.ACCOUNT_TRANSACTION_PROCESSOR,
|
|
458
|
+
});
|
|
459
|
+
return getAccountTokensCount({
|
|
460
|
+
movementConfig: this.config,
|
|
461
|
+
...args,
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
/**
|
|
466
|
+
* Queries the tokens currently owned by a specified account, including NFTs and fungible tokens.
|
|
467
|
+
* If desired, you can filter the results by a specific token standard.
|
|
468
|
+
*
|
|
469
|
+
* @param args.accountAddress The account address for which to retrieve owned tokens.
|
|
470
|
+
* @param args.minimumLedgerVersion Optional ledger version to sync up to before querying.
|
|
471
|
+
* @param args.options.tokenStandard Optional filter for the NFT standard to query for.
|
|
472
|
+
* @param args.options.offset Optional number to start returning results from.
|
|
473
|
+
* @param args.options.limit Optional number of results to return.
|
|
474
|
+
* @param args.options.orderBy Optional order to sort the tokens by.
|
|
475
|
+
* @returns An array of tokens with their respective data.
|
|
476
|
+
*
|
|
477
|
+
* @example
|
|
478
|
+
* ```typescript
|
|
479
|
+
* import { Movement, MovementConfig, Network } from "@moveindustries/ts-sdk";
|
|
480
|
+
*
|
|
481
|
+
* const config = new MovementConfig({ network: Network.TESTNET });
|
|
482
|
+
* const movement = new Movement(config);
|
|
483
|
+
*
|
|
484
|
+
* async function runExample() {
|
|
485
|
+
* // Get the tokens owned by a specific account
|
|
486
|
+
* const accountOwnedTokens = await movement.getAccountOwnedTokens({
|
|
487
|
+
* accountAddress: "0x1", // replace with a real account address
|
|
488
|
+
* options: {
|
|
489
|
+
* limit: 10, // specify how many tokens to return
|
|
490
|
+
* orderBy: "created_at", // specify the order of the results
|
|
491
|
+
* },
|
|
492
|
+
* });
|
|
493
|
+
*
|
|
494
|
+
* console.log(accountOwnedTokens);
|
|
495
|
+
* }
|
|
496
|
+
* runExample().catch(console.error);
|
|
497
|
+
* ```
|
|
498
|
+
* @group Account
|
|
499
|
+
*/
|
|
500
|
+
async getAccountOwnedTokens(args: {
|
|
501
|
+
accountAddress: AccountAddressInput;
|
|
502
|
+
minimumLedgerVersion?: AnyNumber;
|
|
503
|
+
options?: TokenStandardArg & PaginationArgs & OrderByArg<GetAccountOwnedTokensQueryResponse[0]>;
|
|
504
|
+
}): Promise<GetAccountOwnedTokensQueryResponse> {
|
|
505
|
+
await waitForIndexerOnVersion({
|
|
506
|
+
config: this.config,
|
|
507
|
+
minimumLedgerVersion: args.minimumLedgerVersion,
|
|
508
|
+
processorType: ProcessorType.TOKEN_V2_PROCESSOR,
|
|
509
|
+
});
|
|
510
|
+
return getAccountOwnedTokens({
|
|
511
|
+
movementConfig: this.config,
|
|
512
|
+
...args,
|
|
513
|
+
});
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
/**
|
|
517
|
+
* Queries all current tokens of a specific collection that an account owns by the collection address.
|
|
518
|
+
* This query returns all tokens (v1 and v2 standards) an account owns, including NFTs, fungible, soulbound, etc.
|
|
519
|
+
* If you want to get only the token from a specific standard, you can pass an optional tokenStandard parameter.
|
|
520
|
+
*
|
|
521
|
+
* @param args.accountAddress - The account address we want to get the tokens for.
|
|
522
|
+
* @param args.collectionAddress - The address of the collection being queried.
|
|
523
|
+
* @param args.minimumLedgerVersion - Optional ledger version to sync up to, before querying.
|
|
524
|
+
* @param args.options.tokenStandard - The NFT standard to query for.
|
|
525
|
+
* @param args.options.offset - The number token to start returning results from.
|
|
526
|
+
* @param args.options.limit - The number of results to return.
|
|
527
|
+
* @param args.options.orderBy - The order to sort the tokens by.
|
|
528
|
+
* @returns Tokens array with the token data.
|
|
529
|
+
*
|
|
530
|
+
* @example
|
|
531
|
+
* ```typescript
|
|
532
|
+
* import { Movement, MovementConfig, Network } from "@moveindustries/ts-sdk";
|
|
533
|
+
*
|
|
534
|
+
* const config = new MovementConfig({ network: Network.TESTNET });
|
|
535
|
+
* const movement = new Movement(config);
|
|
536
|
+
*
|
|
537
|
+
* async function runExample() {
|
|
538
|
+
* // Get tokens owned by a specific account in a specific collection
|
|
539
|
+
* const accountOwnedTokens = await movement.getAccountOwnedTokensFromCollectionAddress({
|
|
540
|
+
* accountAddress: "0x1", // replace with a real account address
|
|
541
|
+
* collectionAddress: "0x2", // replace with a real collection address
|
|
542
|
+
* });
|
|
543
|
+
*
|
|
544
|
+
* console.log(accountOwnedTokens);
|
|
545
|
+
* }
|
|
546
|
+
* runExample().catch(console.error);
|
|
547
|
+
* ```
|
|
548
|
+
* @group Account
|
|
549
|
+
*/
|
|
550
|
+
async getAccountOwnedTokensFromCollectionAddress(args: {
|
|
551
|
+
accountAddress: AccountAddressInput;
|
|
552
|
+
collectionAddress: AccountAddressInput;
|
|
553
|
+
minimumLedgerVersion?: AnyNumber;
|
|
554
|
+
options?: TokenStandardArg & PaginationArgs & OrderByArg<GetAccountOwnedTokensFromCollectionResponse[0]>;
|
|
555
|
+
}): Promise<GetAccountOwnedTokensFromCollectionResponse> {
|
|
556
|
+
await waitForIndexerOnVersion({
|
|
557
|
+
config: this.config,
|
|
558
|
+
minimumLedgerVersion: args.minimumLedgerVersion,
|
|
559
|
+
processorType: ProcessorType.TOKEN_V2_PROCESSOR,
|
|
560
|
+
});
|
|
561
|
+
return getAccountOwnedTokensFromCollectionAddress({
|
|
562
|
+
movementConfig: this.config,
|
|
563
|
+
...args,
|
|
564
|
+
});
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
/**
|
|
568
|
+
* Queries for all collections that an account currently has tokens for, including NFTs, fungible tokens, and soulbound tokens.
|
|
569
|
+
* If you want to filter by a specific token standard, you can pass an optional tokenStandard parameter.
|
|
570
|
+
*
|
|
571
|
+
* @param args.accountAddress - The account address we want to get the collections for.
|
|
572
|
+
* @param args.minimumLedgerVersion - Optional ledger version to sync up to before querying.
|
|
573
|
+
* @param args.options.tokenStandard - The NFT standard to query for.
|
|
574
|
+
* @param args.options.offset - The number of the collection to start returning results from.
|
|
575
|
+
* @param args.options.limit - The number of results to return.
|
|
576
|
+
* @param args.options.orderBy - The order to sort the tokens by.
|
|
577
|
+
* @returns Collections array with the collections data.
|
|
578
|
+
*
|
|
579
|
+
* @example
|
|
580
|
+
* ```typescript
|
|
581
|
+
* import { Movement, MovementConfig, Network } from "@moveindustries/ts-sdk";
|
|
582
|
+
*
|
|
583
|
+
* const config = new MovementConfig({ network: Network.TESTNET });
|
|
584
|
+
* const movement = new Movement(config);
|
|
585
|
+
*
|
|
586
|
+
* async function runExample() {
|
|
587
|
+
* // Get account collections with owned tokens for a specific account
|
|
588
|
+
* const accountCollectionsWithOwnedTokens = await movement.getAccountCollectionsWithOwnedTokens({
|
|
589
|
+
* accountAddress: "0x1", // replace with a real account address
|
|
590
|
+
* options: {
|
|
591
|
+
* tokenStandard: "NFT", // specify the token standard if needed
|
|
592
|
+
* limit: 10, // specify the number of results to return
|
|
593
|
+
* },
|
|
594
|
+
* });
|
|
595
|
+
*
|
|
596
|
+
* console.log(accountCollectionsWithOwnedTokens);
|
|
597
|
+
* }
|
|
598
|
+
* runExample().catch(console.error);
|
|
599
|
+
* ```
|
|
600
|
+
* @group Account
|
|
601
|
+
*/
|
|
602
|
+
async getAccountCollectionsWithOwnedTokens(args: {
|
|
603
|
+
accountAddress: AccountAddressInput;
|
|
604
|
+
minimumLedgerVersion?: AnyNumber;
|
|
605
|
+
options?: TokenStandardArg & PaginationArgs & OrderByArg<GetAccountCollectionsWithOwnedTokenResponse[0]>;
|
|
606
|
+
}): Promise<GetAccountCollectionsWithOwnedTokenResponse> {
|
|
607
|
+
await waitForIndexerOnVersion({
|
|
608
|
+
config: this.config,
|
|
609
|
+
minimumLedgerVersion: args.minimumLedgerVersion,
|
|
610
|
+
processorType: ProcessorType.TOKEN_V2_PROCESSOR,
|
|
611
|
+
});
|
|
612
|
+
return getAccountCollectionsWithOwnedTokens({
|
|
613
|
+
movementConfig: this.config,
|
|
614
|
+
...args,
|
|
615
|
+
});
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
/**
|
|
619
|
+
* Queries the current count of transactions submitted by an account.
|
|
620
|
+
*
|
|
621
|
+
* @param args - The parameters for the query.
|
|
622
|
+
* @param args.accountAddress - The account address we want to get the total count for.
|
|
623
|
+
* @param args.minimumLedgerVersion - Optional ledger version to sync up to before querying.
|
|
624
|
+
* @returns Current count of transactions made by an account.
|
|
625
|
+
*
|
|
626
|
+
* @example
|
|
627
|
+
* ```typescript
|
|
628
|
+
* import { Movement, MovementConfig, Network } from "@moveindustries/ts-sdk";
|
|
629
|
+
*
|
|
630
|
+
* const config = new MovementConfig({ network: Network.TESTNET });
|
|
631
|
+
* const movement = new Movement(config);
|
|
632
|
+
*
|
|
633
|
+
* async function runExample() {
|
|
634
|
+
* // Get the count of transactions for a specific account
|
|
635
|
+
* const accountTransactionsCount = await movement.getAccountTransactionsCount({
|
|
636
|
+
* accountAddress: "0x1", // replace with a real account address
|
|
637
|
+
* minimumLedgerVersion: 1, // specify your own minimum ledger version if needed
|
|
638
|
+
* });
|
|
639
|
+
*
|
|
640
|
+
* console.log(accountTransactionsCount);
|
|
641
|
+
* }
|
|
642
|
+
* runExample().catch(console.error);
|
|
643
|
+
* ```
|
|
644
|
+
* @group Account
|
|
645
|
+
*/
|
|
646
|
+
async getAccountTransactionsCount(args: {
|
|
647
|
+
accountAddress: AccountAddressInput;
|
|
648
|
+
minimumLedgerVersion?: AnyNumber;
|
|
649
|
+
}): Promise<number> {
|
|
650
|
+
await waitForIndexerOnVersion({
|
|
651
|
+
config: this.config,
|
|
652
|
+
minimumLedgerVersion: args.minimumLedgerVersion,
|
|
653
|
+
processorType: ProcessorType.ACCOUNT_TRANSACTION_PROCESSOR,
|
|
654
|
+
});
|
|
655
|
+
return getAccountTransactionsCount({
|
|
656
|
+
movementConfig: this.config,
|
|
657
|
+
...args,
|
|
658
|
+
});
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
/**
|
|
662
|
+
* Retrieves the coins data for a specified account.
|
|
663
|
+
*
|
|
664
|
+
* @param args.accountAddress - The account address for which to retrieve the coin's data.
|
|
665
|
+
* @param args.minimumLedgerVersion - Optional ledger version to sync up to before querying.
|
|
666
|
+
* @param args.options.offset - Optional. The number of coins to start returning results from.
|
|
667
|
+
* @param args.options.limit - Optional. The number of results to return.
|
|
668
|
+
* @param args.options.orderBy - Optional. The order to sort the coins by.
|
|
669
|
+
* @param args.options.where - Optional. Filter the results by specific criteria.
|
|
670
|
+
* @returns An array containing the coins data for the specified account.
|
|
671
|
+
*
|
|
672
|
+
* @example
|
|
673
|
+
* ```typescript
|
|
674
|
+
* import { Movement, MovementConfig, Network } from "@moveindustries/ts-sdk";
|
|
675
|
+
*
|
|
676
|
+
* const config = new MovementConfig({ network: Network.TESTNET });
|
|
677
|
+
* const movement = new Movement(config);
|
|
678
|
+
*
|
|
679
|
+
* async function runExample() {
|
|
680
|
+
* // Fetching coins data for a specific account
|
|
681
|
+
* const accountCoinsData = await movement.getAccountCoinsData({
|
|
682
|
+
* accountAddress: "0x1", // replace with a real account address
|
|
683
|
+
* options: {
|
|
684
|
+
* limit: 10, // specify the number of results to return
|
|
685
|
+
* orderBy: { asset_type: "asc" }, // specify the order of results
|
|
686
|
+
* },
|
|
687
|
+
* });
|
|
688
|
+
*
|
|
689
|
+
* console.log(accountCoinsData);
|
|
690
|
+
* }
|
|
691
|
+
* runExample().catch(console.error);
|
|
692
|
+
* ```
|
|
693
|
+
* @group Account
|
|
694
|
+
*/
|
|
695
|
+
async getAccountCoinsData(args: {
|
|
696
|
+
accountAddress: AccountAddressInput;
|
|
697
|
+
minimumLedgerVersion?: AnyNumber;
|
|
698
|
+
options?: PaginationArgs &
|
|
699
|
+
OrderByArg<GetAccountCoinsDataResponse[0]> &
|
|
700
|
+
WhereArg<CurrentFungibleAssetBalancesBoolExp>;
|
|
701
|
+
}): Promise<GetAccountCoinsDataResponse> {
|
|
702
|
+
await waitForIndexerOnVersion({
|
|
703
|
+
config: this.config,
|
|
704
|
+
minimumLedgerVersion: args.minimumLedgerVersion,
|
|
705
|
+
processorType: ProcessorType.FUNGIBLE_ASSET_PROCESSOR,
|
|
706
|
+
});
|
|
707
|
+
return getAccountCoinsData({
|
|
708
|
+
movementConfig: this.config,
|
|
709
|
+
...args,
|
|
710
|
+
});
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
/**
|
|
714
|
+
* Retrieves the current count of an account's coins aggregated across all types.
|
|
715
|
+
*
|
|
716
|
+
* @param args The parameters for the account coins count query.
|
|
717
|
+
* @param args.accountAddress The account address we want to get the total count for.
|
|
718
|
+
* @param args.minimumLedgerVersion Optional ledger version to sync up to before querying.
|
|
719
|
+
* @returns The current count of the aggregated coins for the specified account.
|
|
720
|
+
*
|
|
721
|
+
* @example
|
|
722
|
+
* ```typescript
|
|
723
|
+
* import { Movement, MovementConfig, Network } from "@moveindustries/ts-sdk";
|
|
724
|
+
*
|
|
725
|
+
* const config = new MovementConfig({ network: Network.TESTNET });
|
|
726
|
+
* const movement = new Movement(config);
|
|
727
|
+
*
|
|
728
|
+
* async function runExample() {
|
|
729
|
+
* // Getting the account coins count for a specific account
|
|
730
|
+
* const accountCoinsCount = await movement.getAccountCoinsCount({ accountAddress: "0x1" }); // replace with a real account address
|
|
731
|
+
* console.log("Account Coins Count:", accountCoinsCount);
|
|
732
|
+
* }
|
|
733
|
+
* runExample().catch(console.error);
|
|
734
|
+
* ```
|
|
735
|
+
* @group Account
|
|
736
|
+
*/
|
|
737
|
+
async getAccountCoinsCount(args: {
|
|
738
|
+
accountAddress: AccountAddressInput;
|
|
739
|
+
minimumLedgerVersion?: AnyNumber;
|
|
740
|
+
}): Promise<number> {
|
|
741
|
+
await waitForIndexerOnVersion({
|
|
742
|
+
config: this.config,
|
|
743
|
+
minimumLedgerVersion: args.minimumLedgerVersion,
|
|
744
|
+
processorType: ProcessorType.FUNGIBLE_ASSET_PROCESSOR,
|
|
745
|
+
});
|
|
746
|
+
return getAccountCoinsCount({ movementConfig: this.config, ...args });
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
/**
|
|
750
|
+
* Retrieves the current amount of MOVE for a specified account. If the account does not exist, it will return 0.
|
|
751
|
+
*
|
|
752
|
+
* @param args The arguments for the account query.
|
|
753
|
+
* @param args.accountAddress The account address for which to retrieve the MOVE amount.
|
|
754
|
+
* @param args.minimumLedgerVersion Optional ledger version to sync up to before querying.
|
|
755
|
+
* @returns The current amount of MOVE for the specified account.
|
|
756
|
+
*
|
|
757
|
+
* @example
|
|
758
|
+
* ```typescript
|
|
759
|
+
* import { Movement, MovementConfig, Network } from "@moveindustries/ts-sdk";
|
|
760
|
+
*
|
|
761
|
+
* const config = new MovementConfig({ network: Network.TESTNET });
|
|
762
|
+
* const movement = new Movement(config);
|
|
763
|
+
*
|
|
764
|
+
* async function runExample() {
|
|
765
|
+
* // Get the MOVE amount for a specific account
|
|
766
|
+
* const accountMOVEAmount = await movement.getAccountMOVEAmount({ accountAddress: "0x1" }); // replace with a real account address
|
|
767
|
+
* console.log("Account MOVE Amount:", accountMOVEAmount);
|
|
768
|
+
* }
|
|
769
|
+
* runExample().catch(console.error);
|
|
770
|
+
* ```
|
|
771
|
+
* @group Account
|
|
772
|
+
*/
|
|
773
|
+
async getAccountMOVEAmount(args: {
|
|
774
|
+
accountAddress: AccountAddressInput;
|
|
775
|
+
minimumLedgerVersion?: AnyNumber;
|
|
776
|
+
}): Promise<number> {
|
|
777
|
+
return this.getAccountCoinAmount({ coinType: MOVEMENT_COIN, faMetadataAddress: MOVEMENT_FA, ...args });
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
/**
|
|
781
|
+
* Queries the current amount of a specified coin held by an account.
|
|
782
|
+
*
|
|
783
|
+
* @deprecated Use `getBalance({ accountAddress, asset })` instead.
|
|
784
|
+
* This method is slated for removal in a future release.
|
|
785
|
+
*
|
|
786
|
+
* @param args The parameters for querying the account's coin amount.
|
|
787
|
+
* @param args.accountAddress The account address to query for the coin amount.
|
|
788
|
+
* @param args.coinType The coin type to query. Note: If not provided, it may be automatically populated if `faMetadataAddress`
|
|
789
|
+
* is specified.
|
|
790
|
+
* @param args.faMetadataAddress The fungible asset metadata address to query. Note: If not provided, it may be automatically
|
|
791
|
+
* populated if `coinType` is specified.
|
|
792
|
+
* @returns The current amount of the specified coin held by the account.
|
|
793
|
+
*
|
|
794
|
+
* @example
|
|
795
|
+
* ```typescript
|
|
796
|
+
* import { Movement, MovementConfig, Network } from "@moveindustries/ts-sdk";
|
|
797
|
+
*
|
|
798
|
+
* const config = new MovementConfig({ network: Network.TESTNET });
|
|
799
|
+
* const movement = new Movement(config);
|
|
800
|
+
*
|
|
801
|
+
* async function runExample() {
|
|
802
|
+
* // Prefer the new API
|
|
803
|
+
* const amount = await movement.getBalance({ accountAddress: "0x1", asset: "0x1::aptos_coin::AptosCoin" });
|
|
804
|
+
* console.log(`Balance: ${amount}`);
|
|
805
|
+
* }
|
|
806
|
+
* runExample().catch(console.error);
|
|
807
|
+
* ```
|
|
808
|
+
* @group Account
|
|
809
|
+
*/
|
|
810
|
+
async getAccountCoinAmount(args: {
|
|
811
|
+
accountAddress: AccountAddressInput;
|
|
812
|
+
coinType?: MoveStructId;
|
|
813
|
+
faMetadataAddress?: AccountAddressInput;
|
|
814
|
+
}): Promise<number> {
|
|
815
|
+
const { accountAddress, coinType, faMetadataAddress } = args;
|
|
816
|
+
|
|
817
|
+
// Attempt to populate the CoinType field if the FA address is provided.
|
|
818
|
+
// We cannot do this internally due to dependency cycles issue.
|
|
819
|
+
let coinAssetType: MoveStructId | undefined = coinType;
|
|
820
|
+
if (coinType === undefined && faMetadataAddress !== undefined) {
|
|
821
|
+
coinAssetType = await memoizeAsync(
|
|
822
|
+
async () => {
|
|
823
|
+
try {
|
|
824
|
+
const pairedCoinTypeStruct = (
|
|
825
|
+
await view<[{ vec: [MoveStructId] }]>({
|
|
826
|
+
movementConfig: this.config,
|
|
827
|
+
payload: { function: "0x1::coin::paired_coin", functionArguments: [faMetadataAddress] },
|
|
828
|
+
})
|
|
829
|
+
)[0];
|
|
830
|
+
|
|
831
|
+
// Check if the Option has a value, and if so, parse the struct
|
|
832
|
+
if (pairedCoinTypeStruct.vec.length > 0 && isEncodedStruct(pairedCoinTypeStruct.vec[0])) {
|
|
833
|
+
return parseEncodedStruct(pairedCoinTypeStruct.vec[0]);
|
|
834
|
+
}
|
|
835
|
+
} catch (error) {
|
|
836
|
+
/* No paired coin type found */
|
|
837
|
+
}
|
|
838
|
+
return undefined;
|
|
839
|
+
},
|
|
840
|
+
`coin-mapping-${faMetadataAddress.toString()}`,
|
|
841
|
+
1000 * 60 * 5, // 5 minutes
|
|
842
|
+
)();
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
let faAddress: string;
|
|
846
|
+
|
|
847
|
+
if (coinType !== undefined && faMetadataAddress !== undefined) {
|
|
848
|
+
faAddress = AccountAddress.from(faMetadataAddress).toStringLong();
|
|
849
|
+
} else if (coinType !== undefined && faMetadataAddress === undefined) {
|
|
850
|
+
// TODO Move to a separate function as defined in the AIP for coin migration
|
|
851
|
+
if (coinType === MOVEMENT_COIN) {
|
|
852
|
+
faAddress = AccountAddress.A.toStringLong();
|
|
853
|
+
} else {
|
|
854
|
+
faAddress = createObjectAddress(AccountAddress.A, coinType).toStringLong();
|
|
855
|
+
}
|
|
856
|
+
} else if (coinType === undefined && faMetadataAddress !== undefined) {
|
|
857
|
+
const addr = AccountAddress.from(faMetadataAddress);
|
|
858
|
+
faAddress = addr.toStringLong();
|
|
859
|
+
if (addr === AccountAddress.A) {
|
|
860
|
+
coinAssetType = MOVEMENT_COIN;
|
|
861
|
+
}
|
|
862
|
+
// The paired CoinType should be populated outside of this function in another
|
|
863
|
+
// async call. We cannot do this internally due to dependency cycles issue.
|
|
864
|
+
} else {
|
|
865
|
+
throw new Error("Either coinType, faMetadataAddress, or both must be provided");
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
// When there is a coin mapping, use that first, otherwise use the fungible asset address
|
|
869
|
+
// TODO: This function's signature at the top, returns number, but it could be greater than can be represented
|
|
870
|
+
if (coinAssetType !== undefined) {
|
|
871
|
+
const [balanceStr] = await view<[string]>({
|
|
872
|
+
movementConfig: this.config,
|
|
873
|
+
payload: {
|
|
874
|
+
function: "0x1::coin::balance",
|
|
875
|
+
typeArguments: [coinAssetType],
|
|
876
|
+
functionArguments: [accountAddress],
|
|
877
|
+
},
|
|
878
|
+
});
|
|
879
|
+
return parseInt(balanceStr, 10);
|
|
880
|
+
}
|
|
881
|
+
const [balanceStr] = await view<[string]>({
|
|
882
|
+
movementConfig: this.config,
|
|
883
|
+
payload: {
|
|
884
|
+
function: "0x1::primary_fungible_store::balance",
|
|
885
|
+
typeArguments: ["0x1::object::ObjectCore"],
|
|
886
|
+
functionArguments: [accountAddress, faAddress],
|
|
887
|
+
},
|
|
888
|
+
});
|
|
889
|
+
return parseInt(balanceStr, 10);
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
/**
|
|
893
|
+
* Retrieves the balance for an account and asset.
|
|
894
|
+
*
|
|
895
|
+
* @param args The parameters for the balance query.
|
|
896
|
+
* @param args.accountAddress The account address to query.
|
|
897
|
+
* @param args.asset The asset to query: Move struct ID (e.g., `0x1::aptos_coin::AptosCoin`) or FA metadata address.
|
|
898
|
+
* @returns The balance as a number.
|
|
899
|
+
*
|
|
900
|
+
* @example
|
|
901
|
+
* ```ts
|
|
902
|
+
* const movement = new Movement(new MovementConfig());
|
|
903
|
+
* // MOVE coin by type
|
|
904
|
+
* const apt = await movement.getBalance({ accountAddress: "0x1", asset: "0x1::aptos_coin::AptosCoin" });
|
|
905
|
+
* // Some FA by metadata address
|
|
906
|
+
* const fa = await movement.getBalance({ accountAddress: "0x1", asset: "0xa" });
|
|
907
|
+
* ```
|
|
908
|
+
* @group Account
|
|
909
|
+
*/
|
|
910
|
+
async getBalance(args: {
|
|
911
|
+
accountAddress: AccountAddressInput;
|
|
912
|
+
asset: MoveStructId | AccountAddressInput;
|
|
913
|
+
}): Promise<number> {
|
|
914
|
+
return getBalance({ movementConfig: this.config, ...args });
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
/**
|
|
918
|
+
* Queries an account's owned objects.
|
|
919
|
+
*
|
|
920
|
+
* @param args.accountAddress The account address we want to get the objects for.
|
|
921
|
+
* @param args.minimumLedgerVersion Optional ledger version to sync up to before querying.
|
|
922
|
+
* @param args.options.offset The starting position to start returning results from.
|
|
923
|
+
* @param args.options.limit The number of results to return.
|
|
924
|
+
* @param args.options.orderBy The order to sort the objects by.
|
|
925
|
+
* @returns Objects array with the object data.
|
|
926
|
+
*
|
|
927
|
+
* @example
|
|
928
|
+
* ```typescript
|
|
929
|
+
* import { Movement, MovementConfig, Network } from "@moveindustries/ts-sdk";
|
|
930
|
+
*
|
|
931
|
+
* const config = new MovementConfig({ network: Network.TESTNET });
|
|
932
|
+
* const movement = new Movement(config);
|
|
933
|
+
*
|
|
934
|
+
* async function runExample() {
|
|
935
|
+
* // Get the objects owned by the specified account
|
|
936
|
+
* const accountOwnedObjects = await movement.getAccountOwnedObjects({
|
|
937
|
+
* accountAddress: "0x1", // replace with a real account address
|
|
938
|
+
* minimumLedgerVersion: 1, // optional, specify if needed
|
|
939
|
+
* options: {
|
|
940
|
+
* offset: 0, // optional, specify if needed
|
|
941
|
+
* limit: 10, // optional, specify if needed
|
|
942
|
+
* orderBy: "created_at", // optional, specify if needed
|
|
943
|
+
* },
|
|
944
|
+
* });
|
|
945
|
+
*
|
|
946
|
+
* console.log(accountOwnedObjects);
|
|
947
|
+
* }
|
|
948
|
+
* runExample().catch(console.error);
|
|
949
|
+
* ```
|
|
950
|
+
* @group Account
|
|
951
|
+
*/
|
|
952
|
+
async getAccountOwnedObjects(args: {
|
|
953
|
+
accountAddress: AccountAddressInput;
|
|
954
|
+
minimumLedgerVersion?: AnyNumber;
|
|
955
|
+
options?: PaginationArgs & OrderByArg<GetObjectDataQueryResponse[0]>;
|
|
956
|
+
}): Promise<GetObjectDataQueryResponse> {
|
|
957
|
+
await waitForIndexerOnVersion({
|
|
958
|
+
config: this.config,
|
|
959
|
+
minimumLedgerVersion: args.minimumLedgerVersion,
|
|
960
|
+
processorType: ProcessorType.DEFAULT,
|
|
961
|
+
});
|
|
962
|
+
return getAccountOwnedObjects({
|
|
963
|
+
movementConfig: this.config,
|
|
964
|
+
...args,
|
|
965
|
+
});
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
/**
|
|
969
|
+
* Derives an account by providing a private key. This function resolves the provided private key type and derives the public
|
|
970
|
+
* key from it.
|
|
971
|
+
*
|
|
972
|
+
* If the privateKey is a Secp256k1 type, it derives the account using the derived public key and auth key using the SingleKey
|
|
973
|
+
* scheme locally.
|
|
974
|
+
* If the privateKey is an ED25519 type, it looks up the authentication key on chain to determine whether it is a Legacy ED25519
|
|
975
|
+
* key or a Unified ED25519 key, and then derives the account based on that.
|
|
976
|
+
*
|
|
977
|
+
* @param args - The arguments for deriving the account.
|
|
978
|
+
* @param args.privateKey - An account private key.
|
|
979
|
+
* @returns The derived Account type.
|
|
980
|
+
*
|
|
981
|
+
* @example
|
|
982
|
+
* ```typescript
|
|
983
|
+
* import { Movement, MovementConfig, Network, Ed25519PrivateKey } from "@moveindustries/ts-sdk";
|
|
984
|
+
*
|
|
985
|
+
* const config = new MovementConfig({ network: Network.TESTNET });
|
|
986
|
+
* const movement = new Movement(config);
|
|
987
|
+
*
|
|
988
|
+
* async function runExample() {
|
|
989
|
+
* // Deriving an account from a private key
|
|
990
|
+
* const account = await movement.deriveAccountFromPrivateKey({
|
|
991
|
+
* privateKey: new Ed25519PrivateKey("0x123") // replace with a real private key
|
|
992
|
+
* });
|
|
993
|
+
*
|
|
994
|
+
* console.log(account);
|
|
995
|
+
* }
|
|
996
|
+
* runExample().catch(console.error);
|
|
997
|
+
* ```
|
|
998
|
+
* @group Account
|
|
999
|
+
* @deprecated Note that more inspection is needed by the user to determine which account exists on-chain
|
|
1000
|
+
*/
|
|
1001
|
+
async deriveAccountFromPrivateKey(args: {
|
|
1002
|
+
privateKey: PrivateKeyInput;
|
|
1003
|
+
minimumLedgerVersion?: AnyNumber;
|
|
1004
|
+
options?: {
|
|
1005
|
+
throwIfNoAccountFound?: boolean;
|
|
1006
|
+
};
|
|
1007
|
+
}): Promise<AccountModule> {
|
|
1008
|
+
await waitForIndexerOnVersion({
|
|
1009
|
+
config: this.config,
|
|
1010
|
+
minimumLedgerVersion: args.minimumLedgerVersion,
|
|
1011
|
+
processorType: ProcessorType.ACCOUNT_RESTORATION_PROCESSOR,
|
|
1012
|
+
});
|
|
1013
|
+
await waitForIndexerOnVersion({
|
|
1014
|
+
config: this.config,
|
|
1015
|
+
minimumLedgerVersion: args.minimumLedgerVersion,
|
|
1016
|
+
processorType: ProcessorType.OBJECT_PROCESSOR,
|
|
1017
|
+
});
|
|
1018
|
+
return deriveAccountFromPrivateKey({ movementConfig: this.config, ...args });
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
/**
|
|
1022
|
+
* Derives all accounts owned by a signer. This function takes a signer (either an Account or PrivateKey)
|
|
1023
|
+
* and returns all accounts that can be derived from it, ordered by the most recently used account first.
|
|
1024
|
+
*
|
|
1025
|
+
* Note, this function will not return accounts that require more than one signer to be used.
|
|
1026
|
+
*
|
|
1027
|
+
* @param args - The arguments for deriving owned accounts
|
|
1028
|
+
* @param args.signer - The signer to derive accounts from (Account or PrivateKey)
|
|
1029
|
+
* @param args.minimumLedgerVersion - The minimum ledger version to wait for before querying
|
|
1030
|
+
* @param args.options.includeUnverified - Whether to include unverified accounts in the results. Unverified accounts
|
|
1031
|
+
* are accounts that can be authenticated with the signer, but there is no history of the signer using the account.
|
|
1032
|
+
* Default is false.
|
|
1033
|
+
* @param args.options.noMultiKey - If true, do not include multi-key accounts in the results. Default is false.
|
|
1034
|
+
* @returns Promise resolving to an array of derived Account objects
|
|
1035
|
+
*
|
|
1036
|
+
* @example
|
|
1037
|
+
* ```typescript
|
|
1038
|
+
* import { Movement, MovementConfig, Network, Ed25519Account } from "@moveindustries/ts-sdk";
|
|
1039
|
+
*
|
|
1040
|
+
* const config = new MovementConfig({ network: Network.TESTNET });
|
|
1041
|
+
* const movement = new Movement(config);
|
|
1042
|
+
*
|
|
1043
|
+
* async function getOwnedAccounts() {
|
|
1044
|
+
* const signer = Ed25519Account.generate();
|
|
1045
|
+
* const accounts = await movement.deriveOwnedAccountsFromSigner({
|
|
1046
|
+
* signer
|
|
1047
|
+
* });
|
|
1048
|
+
* const account = accounts[0];
|
|
1049
|
+
* console.log(account);
|
|
1050
|
+
* }
|
|
1051
|
+
* ```
|
|
1052
|
+
* @group Account
|
|
1053
|
+
*/
|
|
1054
|
+
async deriveOwnedAccountsFromSigner(args: {
|
|
1055
|
+
signer: AccountModule | PrivateKeyInput;
|
|
1056
|
+
minimumLedgerVersion?: AnyNumber;
|
|
1057
|
+
options?: { includeUnverified?: boolean; noMultiKey?: boolean };
|
|
1058
|
+
}): Promise<AccountModule[]> {
|
|
1059
|
+
await waitForIndexerOnVersion({
|
|
1060
|
+
config: this.config,
|
|
1061
|
+
minimumLedgerVersion: args.minimumLedgerVersion,
|
|
1062
|
+
processorType: ProcessorType.ACCOUNT_RESTORATION_PROCESSOR,
|
|
1063
|
+
});
|
|
1064
|
+
await waitForIndexerOnVersion({
|
|
1065
|
+
config: this.config,
|
|
1066
|
+
minimumLedgerVersion: args.minimumLedgerVersion,
|
|
1067
|
+
processorType: ProcessorType.OBJECT_PROCESSOR,
|
|
1068
|
+
});
|
|
1069
|
+
return deriveOwnedAccountsFromSigner({ movementConfig: this.config, ...args });
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
/**
|
|
1073
|
+
* Gets all account info (address, account public key, last transaction version) that have are associated with a public key and **related public keys**
|
|
1074
|
+
*
|
|
1075
|
+
* For a given public key, it will query all multikeys that the public key is part of. Then for the provided public key and
|
|
1076
|
+
* any multikeys found in the previous step, it will query for any accounts that have an auth key that matches any of the
|
|
1077
|
+
* public keys.
|
|
1078
|
+
*
|
|
1079
|
+
* Note: If an Ed25519PublicKey or an AnyPublicKey that wraps Ed25519PublicKey is passed in, it will query for both legacy and single singer cases.
|
|
1080
|
+
*
|
|
1081
|
+
* @param args - The arguments for getting accounts for a public key
|
|
1082
|
+
* @param args.publicKey - The public key to look up accounts for
|
|
1083
|
+
* @param args.minimumLedgerVersion - The minimum ledger version to wait for before querying
|
|
1084
|
+
* @param args.options.includeUnverified - Whether to include unverified accounts in the results. Unverified accounts
|
|
1085
|
+
* are accounts that can be authenticated with the signer, but there is no history of the signer using the account. Default
|
|
1086
|
+
* is false.
|
|
1087
|
+
* @param args.options.noMultiKey - Whether to exclude multi-key accounts in the results. Default is false.
|
|
1088
|
+
* @returns Promise resolving to an array of account addresses and their associated public keys
|
|
1089
|
+
*
|
|
1090
|
+
* @example
|
|
1091
|
+
* ```typescript
|
|
1092
|
+
* import { Movement, MovementConfig, Network, Ed25519PrivateKey } from "@moveindustries/ts-sdk";
|
|
1093
|
+
*
|
|
1094
|
+
* const config = new MovementConfig({ network: Network.TESTNET });
|
|
1095
|
+
* const movement = new Movement(config);
|
|
1096
|
+
*
|
|
1097
|
+
* async function getAccounts() {
|
|
1098
|
+
* const privateKey = Ed25519PrivateKey.generate();
|
|
1099
|
+
* const publicKey = privateKey.publicKey();
|
|
1100
|
+
* const accounts = await movement.getAccountsForPublicKey({
|
|
1101
|
+
* publicKey
|
|
1102
|
+
* });
|
|
1103
|
+
* console.log(accounts);
|
|
1104
|
+
* }
|
|
1105
|
+
* ```
|
|
1106
|
+
* @group Account
|
|
1107
|
+
*/
|
|
1108
|
+
async getAccountsForPublicKey(args: {
|
|
1109
|
+
publicKey: BaseAccountPublicKey;
|
|
1110
|
+
minimumLedgerVersion?: AnyNumber;
|
|
1111
|
+
options?: { includeUnverified?: boolean; noMultiKey?: boolean };
|
|
1112
|
+
}): Promise<AccountInfo[]> {
|
|
1113
|
+
await waitForIndexerOnVersion({
|
|
1114
|
+
config: this.config,
|
|
1115
|
+
minimumLedgerVersion: args.minimumLedgerVersion,
|
|
1116
|
+
processorType: ProcessorType.ACCOUNT_RESTORATION_PROCESSOR,
|
|
1117
|
+
});
|
|
1118
|
+
await waitForIndexerOnVersion({
|
|
1119
|
+
config: this.config,
|
|
1120
|
+
minimumLedgerVersion: args.minimumLedgerVersion,
|
|
1121
|
+
processorType: ProcessorType.OBJECT_PROCESSOR,
|
|
1122
|
+
});
|
|
1123
|
+
return getAccountsForPublicKey({
|
|
1124
|
+
movementConfig: this.config,
|
|
1125
|
+
...args,
|
|
1126
|
+
});
|
|
1127
|
+
}
|
|
1128
|
+
}
|