@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,179 @@
|
|
|
1
|
+
// Copyright © Move Industries
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { AccountAddress } from "../core/accountAddress";
|
|
5
|
+
import { getIssAudAndUidVal, Groth16VerificationKey, KeylessPublicKey, ZeroKnowledgeSig } from "../core/crypto";
|
|
6
|
+
import { HexInput } from "../types";
|
|
7
|
+
|
|
8
|
+
import { Deserializer, Serializer } from "../bcs";
|
|
9
|
+
import { Hex } from "../core/hex";
|
|
10
|
+
import { AbstractKeylessAccount, ProofFetchCallback } from "./AbstractKeylessAccount";
|
|
11
|
+
import { EphemeralKeyPair } from "./EphemeralKeyPair";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Account implementation for the Keyless authentication scheme.
|
|
15
|
+
*
|
|
16
|
+
* Used to represent a Keyless based account and sign transactions with it.
|
|
17
|
+
*
|
|
18
|
+
* Use `KeylessAccount.create()` to instantiate a KeylessAccount with a JWT, proof and EphemeralKeyPair.
|
|
19
|
+
*
|
|
20
|
+
* When the proof expires or the JWT becomes invalid, the KeylessAccount must be instantiated again with a new JWT,
|
|
21
|
+
* EphemeralKeyPair, and corresponding proof.
|
|
22
|
+
* @group Implementation
|
|
23
|
+
* @category Account (On-Chain Model)
|
|
24
|
+
*/
|
|
25
|
+
export class KeylessAccount extends AbstractKeylessAccount {
|
|
26
|
+
/**
|
|
27
|
+
* The KeylessPublicKey associated with the account
|
|
28
|
+
* @group Implementation
|
|
29
|
+
* @category Account (On-Chain Model)
|
|
30
|
+
*/
|
|
31
|
+
readonly publicKey: KeylessPublicKey;
|
|
32
|
+
|
|
33
|
+
// Use the static constructor 'create' instead.
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Use the static generator `create(...)` instead.
|
|
37
|
+
* Creates an instance of the KeylessAccount with an optional proof.
|
|
38
|
+
*
|
|
39
|
+
* @param args - The parameters for creating a KeylessAccount.
|
|
40
|
+
* @param args.address - Optional account address associated with the KeylessAccount.
|
|
41
|
+
* @param args.ephemeralKeyPair - The ephemeral key pair used in the account creation.
|
|
42
|
+
* @param args.iss - A JWT issuer.
|
|
43
|
+
* @param args.uidKey - The claim on the JWT to identify a user. This is typically 'sub' or 'email'.
|
|
44
|
+
* @param args.uidVal - The unique id for this user, intended to be a stable user identifier.
|
|
45
|
+
* @param args.aud - The value of the 'aud' claim on the JWT, also known as client ID. This is the identifier for the dApp's
|
|
46
|
+
* OIDC registration with the identity provider.
|
|
47
|
+
* @param args.pepper - A hexadecimal input used for additional security.
|
|
48
|
+
* @param args.proof - A Zero Knowledge Signature or a promise that resolves to one.
|
|
49
|
+
* @param args.proofFetchCallback - Optional callback function for fetching proof.
|
|
50
|
+
* @param args.jwt - A JSON Web Token used for authentication.
|
|
51
|
+
* @group Implementation
|
|
52
|
+
* @category Account (On-Chain Model)
|
|
53
|
+
*/
|
|
54
|
+
constructor(args: {
|
|
55
|
+
address?: AccountAddress;
|
|
56
|
+
ephemeralKeyPair: EphemeralKeyPair;
|
|
57
|
+
iss: string;
|
|
58
|
+
uidKey: string;
|
|
59
|
+
uidVal: string;
|
|
60
|
+
aud: string;
|
|
61
|
+
pepper: HexInput;
|
|
62
|
+
proof: ZeroKnowledgeSig | Promise<ZeroKnowledgeSig>;
|
|
63
|
+
proofFetchCallback?: ProofFetchCallback;
|
|
64
|
+
jwt: string;
|
|
65
|
+
verificationKeyHash?: HexInput;
|
|
66
|
+
}) {
|
|
67
|
+
const publicKey = KeylessPublicKey.create(args);
|
|
68
|
+
super({ publicKey, ...args });
|
|
69
|
+
this.publicKey = publicKey;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Serializes the transaction data into a format suitable for transmission or storage.
|
|
74
|
+
* This function ensures that both the transaction bytes and the proof are properly serialized.
|
|
75
|
+
*
|
|
76
|
+
* @param serializer - The serializer instance used to convert the transaction data into bytes.
|
|
77
|
+
* @group Implementation
|
|
78
|
+
* @category Account (On-Chain Model)
|
|
79
|
+
*/
|
|
80
|
+
serialize(serializer: Serializer): void {
|
|
81
|
+
super.serialize(serializer);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Deserializes the provided deserializer to create a KeylessAccount instance.
|
|
86
|
+
* This function extracts necessary components such as the JWT, UID key, pepper, ephemeral key pair, and proof from the deserializer.
|
|
87
|
+
*
|
|
88
|
+
* @param deserializer - The deserializer instance used to retrieve the serialized data.
|
|
89
|
+
* @returns A KeylessAccount instance created from the deserialized data.
|
|
90
|
+
* @group Implementation
|
|
91
|
+
* @category Account (On-Chain Model)
|
|
92
|
+
*/
|
|
93
|
+
static deserialize(deserializer: Deserializer): KeylessAccount {
|
|
94
|
+
const { address, proof, ephemeralKeyPair, jwt, uidKey, pepper, verificationKeyHash } =
|
|
95
|
+
AbstractKeylessAccount.partialDeserialize(deserializer);
|
|
96
|
+
const { iss, aud, uidVal } = getIssAudAndUidVal({ jwt, uidKey });
|
|
97
|
+
return new KeylessAccount({
|
|
98
|
+
address,
|
|
99
|
+
proof,
|
|
100
|
+
ephemeralKeyPair,
|
|
101
|
+
iss,
|
|
102
|
+
uidKey,
|
|
103
|
+
uidVal,
|
|
104
|
+
aud,
|
|
105
|
+
pepper,
|
|
106
|
+
jwt,
|
|
107
|
+
verificationKeyHash,
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Deserialize bytes using this account's information.
|
|
113
|
+
*
|
|
114
|
+
* @param bytes The bytes being interpreted.
|
|
115
|
+
* @returns
|
|
116
|
+
*/
|
|
117
|
+
static fromBytes(bytes: HexInput): KeylessAccount {
|
|
118
|
+
return KeylessAccount.deserialize(new Deserializer(Hex.hexInputToUint8Array(bytes)));
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Creates a KeylessAccount instance using the provided parameters.
|
|
123
|
+
* This function allows you to set up a KeylessAccount with specific attributes such as address, proof, and JWT.
|
|
124
|
+
* This is used instead of the KeylessAccount constructor.
|
|
125
|
+
*
|
|
126
|
+
* @param args - The parameters for creating a KeylessAccount.
|
|
127
|
+
* @param args.address - Optional account address associated with the KeylessAccount.
|
|
128
|
+
* @param args.proof - A Zero Knowledge Signature or a promise that resolves to one.
|
|
129
|
+
* @param args.jwt - A JSON Web Token used for authentication.
|
|
130
|
+
* @param args.ephemeralKeyPair - The ephemeral key pair used in the account creation.
|
|
131
|
+
* @param args.pepper - A hexadecimal input used for additional security.
|
|
132
|
+
* @param args.uidKey - Optional key for user identification, defaults to "sub".
|
|
133
|
+
* @param args.proofFetchCallback - Optional callback function for fetching proof.
|
|
134
|
+
* @group Implementation
|
|
135
|
+
* @category Account (On-Chain Model)
|
|
136
|
+
*/
|
|
137
|
+
static create(args: {
|
|
138
|
+
address?: AccountAddress;
|
|
139
|
+
proof: ZeroKnowledgeSig | Promise<ZeroKnowledgeSig>;
|
|
140
|
+
jwt: string;
|
|
141
|
+
ephemeralKeyPair: EphemeralKeyPair;
|
|
142
|
+
pepper: HexInput;
|
|
143
|
+
uidKey?: string;
|
|
144
|
+
proofFetchCallback?: ProofFetchCallback;
|
|
145
|
+
verificationKey?: Groth16VerificationKey;
|
|
146
|
+
verificationKeyHash?: Uint8Array;
|
|
147
|
+
}): KeylessAccount {
|
|
148
|
+
const {
|
|
149
|
+
address,
|
|
150
|
+
proof,
|
|
151
|
+
jwt,
|
|
152
|
+
ephemeralKeyPair,
|
|
153
|
+
pepper,
|
|
154
|
+
uidKey = "sub",
|
|
155
|
+
proofFetchCallback,
|
|
156
|
+
verificationKey,
|
|
157
|
+
verificationKeyHash,
|
|
158
|
+
} = args;
|
|
159
|
+
|
|
160
|
+
if (verificationKeyHash && verificationKey) {
|
|
161
|
+
throw new Error("Cannot provide both verificationKey and verificationKeyHash");
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
const { iss, aud, uidVal } = getIssAudAndUidVal({ jwt, uidKey });
|
|
165
|
+
return new KeylessAccount({
|
|
166
|
+
address,
|
|
167
|
+
proof,
|
|
168
|
+
ephemeralKeyPair,
|
|
169
|
+
iss,
|
|
170
|
+
uidKey,
|
|
171
|
+
uidVal,
|
|
172
|
+
aud,
|
|
173
|
+
pepper,
|
|
174
|
+
jwt,
|
|
175
|
+
proofFetchCallback,
|
|
176
|
+
verificationKeyHash: verificationKeyHash ?? (verificationKey ? verificationKey.hash() : undefined),
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import type { MovementConfig } from "../api";
|
|
2
|
+
import { AccountAddress, AccountAddressInput } from "../core/accountAddress";
|
|
3
|
+
import { Ed25519PrivateKey, Signature } from "../core/crypto";
|
|
4
|
+
import { MultiEd25519PublicKey, MultiEd25519Signature } from "../core/crypto/multiEd25519";
|
|
5
|
+
import { AccountAuthenticatorMultiEd25519 } from "../transactions/authenticator/account";
|
|
6
|
+
import { generateSigningMessageForTransaction } from "../transactions/transactionBuilder/signingMessage";
|
|
7
|
+
import { AnyRawTransaction } from "../transactions/types";
|
|
8
|
+
import { HexInput, SigningScheme } from "../types";
|
|
9
|
+
import type { Account } from "./Account";
|
|
10
|
+
|
|
11
|
+
export interface MultiEd25519SignerConstructorArgs {
|
|
12
|
+
publicKey: MultiEd25519PublicKey;
|
|
13
|
+
signers: Ed25519PrivateKey[];
|
|
14
|
+
address?: AccountAddressInput;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface VerifyMultiEd25519SignatureArgs {
|
|
18
|
+
message: HexInput;
|
|
19
|
+
signature: MultiEd25519Signature;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Signer implementation for the Multi-Ed25519 authentication scheme.
|
|
24
|
+
*
|
|
25
|
+
* Note: This authentication scheme is a legacy authentication scheme. Prefer using MultiKeyAccounts as a
|
|
26
|
+
* MultiKeyAccount can support any type of signer, not just Ed25519. Generating a signer instance does not
|
|
27
|
+
* create the account on-chain.
|
|
28
|
+
*/
|
|
29
|
+
export class MultiEd25519Account implements Account {
|
|
30
|
+
readonly publicKey: MultiEd25519PublicKey;
|
|
31
|
+
|
|
32
|
+
readonly accountAddress: AccountAddress;
|
|
33
|
+
|
|
34
|
+
readonly signingScheme = SigningScheme.MultiEd25519;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* The signers used to sign messages. These signers should correspond to public keys in the
|
|
38
|
+
* MultiEd25519Account. The number of signers should be equal to this.publicKey.threshold.
|
|
39
|
+
* @group Implementation
|
|
40
|
+
* @category Account (On-Chain Model)
|
|
41
|
+
*/
|
|
42
|
+
readonly signers: Ed25519PrivateKey[];
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* An array of indices where for signer[i], signerIndicies[i] is the index of the corresponding public key in
|
|
46
|
+
* publicKey.publicKeys. Used to derive the right public key to use for verification.
|
|
47
|
+
* @group Implementation
|
|
48
|
+
* @category Account (On-Chain Model)
|
|
49
|
+
*/
|
|
50
|
+
readonly signerIndices: number[];
|
|
51
|
+
|
|
52
|
+
readonly signaturesBitmap: Uint8Array;
|
|
53
|
+
|
|
54
|
+
// region Constructors
|
|
55
|
+
|
|
56
|
+
constructor(args: MultiEd25519SignerConstructorArgs) {
|
|
57
|
+
const { signers, publicKey, address } = args;
|
|
58
|
+
this.publicKey = publicKey;
|
|
59
|
+
this.accountAddress = address ? AccountAddress.from(address) : this.publicKey.authKey().derivedAddress();
|
|
60
|
+
|
|
61
|
+
if (publicKey.threshold > signers.length) {
|
|
62
|
+
throw new Error(
|
|
63
|
+
// eslint-disable-next-line max-len
|
|
64
|
+
`Not enough signers provided to satisfy the required signatures. Need ${publicKey.threshold} signers, but only ${signers.length} provided`,
|
|
65
|
+
);
|
|
66
|
+
} else if (publicKey.threshold < signers.length) {
|
|
67
|
+
throw new Error(
|
|
68
|
+
// eslint-disable-next-line max-len
|
|
69
|
+
`More signers provided than required. Need ${publicKey.threshold} signers, but ${signers.length} provided`,
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// For each signer, find its corresponding position in the public keys array
|
|
74
|
+
const bitPositions: number[] = [];
|
|
75
|
+
for (const signer of signers) {
|
|
76
|
+
bitPositions.push(this.publicKey.getIndex(signer.publicKey()));
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// Create pairs of [signer, position] and sort them by position
|
|
80
|
+
// This sorting is critical because:
|
|
81
|
+
// 1. The on-chain verification expects signatures to be in ascending order by bit position
|
|
82
|
+
// 2. The bitmap must match the order of signatures when verifying
|
|
83
|
+
const signersAndBitPosition: [Ed25519PrivateKey, number][] = signers.map((signer, index) => [
|
|
84
|
+
signer,
|
|
85
|
+
bitPositions[index],
|
|
86
|
+
]);
|
|
87
|
+
signersAndBitPosition.sort((a, b) => a[1] - b[1]);
|
|
88
|
+
|
|
89
|
+
// Extract the sorted signers and their positions into separate arrays
|
|
90
|
+
this.signers = signersAndBitPosition.map((value) => value[0]);
|
|
91
|
+
this.signerIndices = signersAndBitPosition.map((value) => value[1]);
|
|
92
|
+
|
|
93
|
+
// Create a bitmap representing which public keys from the MultiEd25519PublicKey are being used
|
|
94
|
+
// This bitmap is used during signature verification to identify which public keys
|
|
95
|
+
// should be used to verify each signature
|
|
96
|
+
this.signaturesBitmap = this.publicKey.createBitmap({ bits: bitPositions });
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// endregion
|
|
100
|
+
|
|
101
|
+
// region Account
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Verify the given message and signature with the public key.
|
|
105
|
+
*
|
|
106
|
+
* @param args.message raw message data in HexInput format
|
|
107
|
+
* @param args.signature signed message Signature
|
|
108
|
+
* @returns
|
|
109
|
+
*/
|
|
110
|
+
verifySignature(args: VerifyMultiEd25519SignatureArgs): boolean {
|
|
111
|
+
return this.publicKey.verifySignature(args);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Verify the given message and signature with the public key.
|
|
116
|
+
*
|
|
117
|
+
* MultiEd25519 signatures do not depend on chain state, so this function is
|
|
118
|
+
* equivalent to the synchronous verifySignature method.
|
|
119
|
+
*
|
|
120
|
+
* @param args - The arguments for verifying the signature.
|
|
121
|
+
* @param args.movementConfig - The configuration object for connecting to the Movement network
|
|
122
|
+
* @param args.message - Raw message data in HexInput format.
|
|
123
|
+
* @param args.signature - Signed message signature.
|
|
124
|
+
* @returns A boolean indicating whether the signature is valid.
|
|
125
|
+
* @group Implementation
|
|
126
|
+
* @category Account (On-Chain Model)
|
|
127
|
+
*/
|
|
128
|
+
async verifySignatureAsync(args: {
|
|
129
|
+
movementConfig: MovementConfig;
|
|
130
|
+
message: HexInput;
|
|
131
|
+
signature: Signature;
|
|
132
|
+
options?: { throwErrorWithReason?: boolean };
|
|
133
|
+
}): Promise<boolean> {
|
|
134
|
+
return this.publicKey.verifySignatureAsync({
|
|
135
|
+
...args,
|
|
136
|
+
signature: args.signature,
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Sign a message using the account's Ed25519 private key.
|
|
142
|
+
* @param message the signing message, as binary input
|
|
143
|
+
* @return the AccountAuthenticator containing the signature, together with the account's public key
|
|
144
|
+
*/
|
|
145
|
+
signWithAuthenticator(message: HexInput): AccountAuthenticatorMultiEd25519 {
|
|
146
|
+
return new AccountAuthenticatorMultiEd25519(this.publicKey, this.sign(message));
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Sign a transaction using the account's Ed25519 private keys.
|
|
151
|
+
* @param transaction the raw transaction
|
|
152
|
+
* @return the AccountAuthenticator containing the signature of the transaction, together with the account's public key
|
|
153
|
+
*/
|
|
154
|
+
signTransactionWithAuthenticator(transaction: AnyRawTransaction): AccountAuthenticatorMultiEd25519 {
|
|
155
|
+
return new AccountAuthenticatorMultiEd25519(this.publicKey, this.signTransaction(transaction));
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Sign the given message using the account's Ed25519 private keys.
|
|
160
|
+
* @param message in HexInput format
|
|
161
|
+
* @returns MultiEd25519Signature
|
|
162
|
+
*/
|
|
163
|
+
sign(message: HexInput): MultiEd25519Signature {
|
|
164
|
+
const signatures = [];
|
|
165
|
+
for (const signer of this.signers) {
|
|
166
|
+
signatures.push(signer.sign(message));
|
|
167
|
+
}
|
|
168
|
+
return new MultiEd25519Signature({ signatures, bitmap: this.signaturesBitmap });
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Sign the given transaction using the available signing capabilities.
|
|
173
|
+
* @param transaction the transaction to be signed
|
|
174
|
+
* @returns Signature
|
|
175
|
+
*/
|
|
176
|
+
signTransaction(transaction: AnyRawTransaction): MultiEd25519Signature {
|
|
177
|
+
return this.sign(generateSigningMessageForTransaction(transaction));
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// endregion
|
|
181
|
+
}
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
// Copyright © Move Industries
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import type { MovementConfig } from "../api/movementConfig";
|
|
5
|
+
import { AccountAddress, AccountAddressInput } from "../core/accountAddress";
|
|
6
|
+
import { MultiKey, MultiKeySignature, PublicKey } from "../core/crypto";
|
|
7
|
+
import { AccountAuthenticatorMultiKey } from "../transactions/authenticator/account";
|
|
8
|
+
import { AnyRawTransaction } from "../transactions/types";
|
|
9
|
+
import { HexInput, SigningScheme } from "../types";
|
|
10
|
+
import { AbstractKeylessAccount, KeylessSigner } from "./AbstractKeylessAccount";
|
|
11
|
+
import type { Account } from "./Account";
|
|
12
|
+
import { Ed25519Account } from "./Ed25519Account";
|
|
13
|
+
import { SingleKeyAccount, SingleKeySigner, SingleKeySignerOrLegacyEd25519Account } from "./SingleKeyAccount";
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Arguments required to verify a multi-key signature against a given message.
|
|
17
|
+
*
|
|
18
|
+
* @param message - The original message that was signed.
|
|
19
|
+
* @param signature - The multi-key signature to be verified.
|
|
20
|
+
* @group Implementation
|
|
21
|
+
* @category Account (On-Chain Model)
|
|
22
|
+
*/
|
|
23
|
+
export interface VerifyMultiKeySignatureArgs {
|
|
24
|
+
message: HexInput;
|
|
25
|
+
signature: MultiKeySignature;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Signer implementation for the MultiKey authentication scheme.
|
|
30
|
+
*
|
|
31
|
+
* This account utilizes an M of N signing scheme, where M and N are specified in the {@link MultiKey}.
|
|
32
|
+
* It signs messages using an array of M accounts, each corresponding to a public key in the {@link MultiKey}.
|
|
33
|
+
*
|
|
34
|
+
* Note: Generating a signer instance does not create the account on-chain.
|
|
35
|
+
* @group Implementation
|
|
36
|
+
* @category Account (On-Chain Model)
|
|
37
|
+
*/
|
|
38
|
+
export class MultiKeyAccount implements Account, KeylessSigner {
|
|
39
|
+
/**
|
|
40
|
+
* Public key associated with the account
|
|
41
|
+
* @group Implementation
|
|
42
|
+
* @category Account (On-Chain Model)
|
|
43
|
+
*/
|
|
44
|
+
readonly publicKey: MultiKey;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Account address associated with the account
|
|
48
|
+
* @group Implementation
|
|
49
|
+
* @category Account (On-Chain Model)
|
|
50
|
+
*/
|
|
51
|
+
readonly accountAddress: AccountAddress;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Signing scheme used to sign transactions
|
|
55
|
+
* @group Implementation
|
|
56
|
+
* @category Account (On-Chain Model)
|
|
57
|
+
*/
|
|
58
|
+
readonly signingScheme: SigningScheme = SigningScheme.MultiKey;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* The signers used to sign messages. These signers should correspond to public keys in the
|
|
62
|
+
* MultiKeyAccount's public key. The number of signers should be equal to this.publicKey.signaturesRequired.
|
|
63
|
+
* @group Implementation
|
|
64
|
+
* @category Account (On-Chain Model)
|
|
65
|
+
*/
|
|
66
|
+
readonly signers: Account[];
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* An array of indices where for signer[i], signerIndicies[i] is the index of the corresponding public key in
|
|
70
|
+
* publicKey.publicKeys. Used to derive the right public key to use for verification.
|
|
71
|
+
* @group Implementation
|
|
72
|
+
* @category Account (On-Chain Model)
|
|
73
|
+
*/
|
|
74
|
+
// TODO: Rename Indicies to Indices
|
|
75
|
+
readonly signerIndicies: number[];
|
|
76
|
+
|
|
77
|
+
readonly signaturesBitmap: Uint8Array;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Constructs a MultiKeyAccount instance, which requires multiple signatures for transactions.
|
|
81
|
+
*
|
|
82
|
+
* @param args - The arguments for creating a MultiKeyAccount.
|
|
83
|
+
* @param args.multiKey - The multikey of the account consisting of N public keys and a number M representing the required signatures.
|
|
84
|
+
* @param args.signers - An array of M signers that will be used to sign the transaction.
|
|
85
|
+
* @param args.address - An optional account address input. If not provided, the derived address from the public key will be used.
|
|
86
|
+
* @group Implementation
|
|
87
|
+
* @category Account (On-Chain Model)
|
|
88
|
+
*/
|
|
89
|
+
constructor(args: {
|
|
90
|
+
multiKey: MultiKey;
|
|
91
|
+
signers: SingleKeySignerOrLegacyEd25519Account[];
|
|
92
|
+
address?: AccountAddressInput;
|
|
93
|
+
}) {
|
|
94
|
+
const { multiKey, address } = args;
|
|
95
|
+
|
|
96
|
+
const signers: SingleKeySigner[] = args.signers.map((signer) =>
|
|
97
|
+
signer instanceof Ed25519Account ? SingleKeyAccount.fromEd25519Account(signer) : signer,
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
if (multiKey.signaturesRequired > signers.length) {
|
|
101
|
+
throw new Error(
|
|
102
|
+
// eslint-disable-next-line max-len
|
|
103
|
+
`Not enough signers provided to satisfy the required signatures. Need ${multiKey.signaturesRequired} signers, but only ${signers.length} provided`,
|
|
104
|
+
);
|
|
105
|
+
} else if (multiKey.signaturesRequired < signers.length) {
|
|
106
|
+
throw new Error(
|
|
107
|
+
// eslint-disable-next-line max-len
|
|
108
|
+
`More signers provided than required. Need ${multiKey.signaturesRequired} signers, but ${signers.length} provided`,
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
this.publicKey = multiKey;
|
|
113
|
+
|
|
114
|
+
this.accountAddress = address ? AccountAddress.from(address) : this.publicKey.authKey().derivedAddress();
|
|
115
|
+
|
|
116
|
+
// For each signer, find its corresponding position in the MultiKey's public keys array
|
|
117
|
+
const bitPositions: number[] = [];
|
|
118
|
+
for (const signer of signers) {
|
|
119
|
+
bitPositions.push(this.publicKey.getIndex(signer.getAnyPublicKey()));
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// Create pairs of [signer, position] and sort them by position
|
|
123
|
+
// This sorting is critical because:
|
|
124
|
+
// 1. The on-chain verification expects signatures to be in ascending order by bit position
|
|
125
|
+
// 2. The bitmap must match the order of signatures when verifying
|
|
126
|
+
const signersAndBitPosition: [Account, number][] = signers.map((signer, index) => [signer, bitPositions[index]]);
|
|
127
|
+
signersAndBitPosition.sort((a, b) => a[1] - b[1]);
|
|
128
|
+
|
|
129
|
+
// Extract the sorted signers and their positions into separate arrays
|
|
130
|
+
this.signers = signersAndBitPosition.map((value) => value[0]);
|
|
131
|
+
this.signerIndicies = signersAndBitPosition.map((value) => value[1]);
|
|
132
|
+
|
|
133
|
+
// Create a bitmap representing which public keys from the MultiKey are being used
|
|
134
|
+
// This bitmap is used during signature verification to identify which public keys
|
|
135
|
+
// should be used to verify each signature
|
|
136
|
+
this.signaturesBitmap = this.publicKey.createBitmap({ bits: bitPositions });
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Static constructor to create a MultiKeyAccount using the provided public keys and signers.
|
|
141
|
+
*
|
|
142
|
+
* @param args - The arguments for creating a MultiKeyAccount.
|
|
143
|
+
* @param args.publicKeys - The N public keys of the MultiKeyAccount.
|
|
144
|
+
* @param args.signaturesRequired - The number of signatures required to authorize a transaction.
|
|
145
|
+
* @param args.signers - An array of M signers that will be used to sign the transaction.
|
|
146
|
+
* @returns MultiKeyAccount - The newly created MultiKeyAccount.
|
|
147
|
+
* @group Implementation
|
|
148
|
+
* @category Account (On-Chain Model)
|
|
149
|
+
*/
|
|
150
|
+
static fromPublicKeysAndSigners(args: {
|
|
151
|
+
address?: AccountAddressInput;
|
|
152
|
+
publicKeys: PublicKey[];
|
|
153
|
+
signaturesRequired: number;
|
|
154
|
+
signers: SingleKeySignerOrLegacyEd25519Account[];
|
|
155
|
+
}): MultiKeyAccount {
|
|
156
|
+
const { address, publicKeys, signaturesRequired, signers } = args;
|
|
157
|
+
const multiKey = new MultiKey({ publicKeys, signaturesRequired });
|
|
158
|
+
return new MultiKeyAccount({ multiKey, signers, address });
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Determines if the provided account is a multi-key account.
|
|
163
|
+
*
|
|
164
|
+
* @param account - The account to check.
|
|
165
|
+
* @returns A boolean indicating whether the account is a multi-key account.
|
|
166
|
+
* @group Implementation
|
|
167
|
+
* @category Account (On-Chain Model)
|
|
168
|
+
*/
|
|
169
|
+
static isMultiKeySigner(account: Account): account is MultiKeyAccount {
|
|
170
|
+
return account instanceof MultiKeyAccount;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Sign a message using the account's signers and return an AccountAuthenticator containing the signature along with the
|
|
175
|
+
* account's public key.
|
|
176
|
+
* @param message - The signing message, represented as binary input in hexadecimal format.
|
|
177
|
+
* @returns An instance of AccountAuthenticatorMultiKey that includes the signature and the public key.
|
|
178
|
+
* @group Implementation
|
|
179
|
+
* @category Account (On-Chain Model)
|
|
180
|
+
*/
|
|
181
|
+
signWithAuthenticator(message: HexInput): AccountAuthenticatorMultiKey {
|
|
182
|
+
return new AccountAuthenticatorMultiKey(this.publicKey, this.sign(message));
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Sign a transaction using the account's signers, returning an AccountAuthenticator that contains the signature and the
|
|
187
|
+
* account's public key.
|
|
188
|
+
* @param transaction - The raw transaction to be signed.
|
|
189
|
+
* @returns An AccountAuthenticatorMultiKey containing the signature of the transaction along with the account's public key.
|
|
190
|
+
* @group Implementation
|
|
191
|
+
* @category Account (On-Chain Model)
|
|
192
|
+
*/
|
|
193
|
+
signTransactionWithAuthenticator(transaction: AnyRawTransaction): AccountAuthenticatorMultiKey {
|
|
194
|
+
return new AccountAuthenticatorMultiKey(this.publicKey, this.signTransaction(transaction));
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Waits for any proofs on KeylessAccount signers to be fetched. This ensures that signing with the KeylessAccount does not
|
|
199
|
+
* fail due to missing proofs.
|
|
200
|
+
* @return {Promise<void>} A promise that resolves when all proofs have been fetched.
|
|
201
|
+
* @group Implementation
|
|
202
|
+
* @category Account (On-Chain Model)
|
|
203
|
+
*/
|
|
204
|
+
async waitForProofFetch(): Promise<void> {
|
|
205
|
+
const keylessSigners = this.signers.filter(
|
|
206
|
+
(signer) => signer instanceof AbstractKeylessAccount,
|
|
207
|
+
) as AbstractKeylessAccount[];
|
|
208
|
+
const promises = keylessSigners.map(async (signer) => signer.waitForProofFetch());
|
|
209
|
+
await Promise.all(promises);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Validates that the Keyless Account can be used to sign transactions.
|
|
214
|
+
* @return
|
|
215
|
+
* @group Implementation
|
|
216
|
+
* @category Account (On-Chain Model)
|
|
217
|
+
*/
|
|
218
|
+
async checkKeylessAccountValidity(movementConfig: MovementConfig): Promise<void> {
|
|
219
|
+
const keylessSigners = this.signers.filter(
|
|
220
|
+
(signer) => signer instanceof AbstractKeylessAccount,
|
|
221
|
+
) as AbstractKeylessAccount[];
|
|
222
|
+
const promises = keylessSigners.map((signer) => signer.checkKeylessAccountValidity(movementConfig));
|
|
223
|
+
await Promise.all(promises);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Sign the given message using the MultiKeyAccount's signers
|
|
228
|
+
* @param data - The data to be signed in HexInput format.
|
|
229
|
+
* @returns MultiKeySignature
|
|
230
|
+
* @group Implementation
|
|
231
|
+
* @category Account (On-Chain Model)
|
|
232
|
+
*/
|
|
233
|
+
sign(data: HexInput): MultiKeySignature {
|
|
234
|
+
const signatures = [];
|
|
235
|
+
for (const signer of this.signers) {
|
|
236
|
+
signatures.push(signer.sign(data));
|
|
237
|
+
}
|
|
238
|
+
return new MultiKeySignature({ signatures, bitmap: this.signaturesBitmap });
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Sign the given transaction using the MultiKeyAccount's signers.
|
|
243
|
+
* This function aggregates signatures from all signers associated with the MultiKeyAccount.
|
|
244
|
+
*
|
|
245
|
+
* @param transaction - The transaction to be signed.
|
|
246
|
+
* @returns MultiKeySignature - An object containing the aggregated signatures and a bitmap of the signatures.
|
|
247
|
+
* @group Implementation
|
|
248
|
+
* @category Account (On-Chain Model)
|
|
249
|
+
*/
|
|
250
|
+
signTransaction(transaction: AnyRawTransaction): MultiKeySignature {
|
|
251
|
+
const signatures = [];
|
|
252
|
+
for (const signer of this.signers) {
|
|
253
|
+
signatures.push(signer.signTransaction(transaction));
|
|
254
|
+
}
|
|
255
|
+
return new MultiKeySignature({ signatures, bitmap: this.signaturesBitmap });
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Verify the given message and signature with the public keys.
|
|
260
|
+
*
|
|
261
|
+
* This function checks if the provided signatures are valid for the given message using the corresponding public keys.
|
|
262
|
+
* Note: If you are using KeylessAccounts, you must use `verifySignatureAsync` instead.
|
|
263
|
+
*
|
|
264
|
+
* @param args - The arguments for verifying the signature.
|
|
265
|
+
* @param args.message - The raw message data in HexInput format.
|
|
266
|
+
* @param args.signature - The signed message MultiKeySignature containing multiple signatures.
|
|
267
|
+
* @returns A boolean indicating whether the signatures are valid for the message.
|
|
268
|
+
* @group Implementation
|
|
269
|
+
* @category Account (On-Chain Model)
|
|
270
|
+
*/
|
|
271
|
+
verifySignature(args: { message: HexInput; signature: MultiKeySignature }): boolean {
|
|
272
|
+
return this.publicKey.verifySignature(args);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Verify the given message and signature with the public keys.
|
|
277
|
+
*
|
|
278
|
+
* This function checks if the provided signatures are valid for the given message using the corresponding public keys.
|
|
279
|
+
*
|
|
280
|
+
* @param args - The arguments for verifying the signature.
|
|
281
|
+
* @param args.message - The raw message data in HexInput format.
|
|
282
|
+
* @param args.signature - The signed message MultiKeySignature containing multiple signatures.
|
|
283
|
+
* @param args.options.throwErrorWithReason - Whether to throw an error with the reason for the verification failure.
|
|
284
|
+
* @returns A boolean indicating whether the signatures are valid for the message.
|
|
285
|
+
* @group Implementation
|
|
286
|
+
* @category Account (On-Chain Model)
|
|
287
|
+
*/
|
|
288
|
+
async verifySignatureAsync(args: {
|
|
289
|
+
movementConfig: MovementConfig;
|
|
290
|
+
message: HexInput;
|
|
291
|
+
signature: MultiKeySignature;
|
|
292
|
+
options?: { throwErrorWithReason?: boolean };
|
|
293
|
+
}): Promise<boolean> {
|
|
294
|
+
return await this.publicKey.verifySignatureAsync(args);
|
|
295
|
+
}
|
|
296
|
+
}
|