@aptos-labs/ts-sdk 1.13.3-zeta.3 → 1.14.0-zeta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common/accountAddress-NPQwRmxn.d.ts +2121 -0
- package/dist/common/cli/index.d.ts +94 -1
- package/dist/common/cli/index.js +1 -1
- package/dist/common/cli/index.js.map +1 -1
- package/dist/common/index.d.ts +243 -2236
- package/dist/common/index.js +25 -25
- package/dist/common/index.js.map +1 -1
- package/dist/esm/{Ed25519Account-8gJF5t3F.d.mts → Ed25519Account-9zBaZEnp.d.mts} +76 -7
- package/dist/esm/account/Account.d.mts +1 -1
- package/dist/esm/account/Account.mjs +1 -1
- package/dist/esm/account/Ed25519Account.d.mts +1 -1
- package/dist/esm/account/Ed25519Account.mjs +1 -1
- package/dist/esm/account/EphemeralKeyPair.mjs +1 -1
- package/dist/esm/account/KeylessAccount.d.mts +5 -4
- package/dist/esm/account/KeylessAccount.mjs +1 -1
- package/dist/esm/account/MultiKeyAccount.d.mts +67 -32
- package/dist/esm/account/MultiKeyAccount.mjs +1 -1
- package/dist/esm/account/SingleKeyAccount.d.mts +1 -1
- package/dist/esm/account/SingleKeyAccount.mjs +1 -1
- package/dist/esm/account/index.d.mts +4 -4
- package/dist/esm/account/index.mjs +1 -1
- package/dist/esm/api/account.d.mts +1 -1
- package/dist/esm/api/account.mjs +1 -1
- package/dist/esm/api/ans.d.mts +1 -1
- package/dist/esm/api/ans.mjs +1 -1
- package/dist/esm/api/aptos.d.mts +3 -3
- package/dist/esm/api/aptos.mjs +1 -1
- package/dist/esm/api/aptosConfig.mjs +1 -1
- package/dist/esm/api/coin.mjs +1 -1
- package/dist/esm/api/digitalAsset.d.mts +1 -1
- package/dist/esm/api/digitalAsset.mjs +1 -1
- package/dist/esm/api/event.mjs +1 -1
- package/dist/esm/api/faucet.mjs +1 -1
- package/dist/esm/api/fungibleAsset.d.mts +1 -1
- package/dist/esm/api/fungibleAsset.mjs +1 -1
- package/dist/esm/api/general.mjs +1 -1
- package/dist/esm/api/index.d.mts +3 -3
- package/dist/esm/api/index.mjs +1 -1
- package/dist/esm/api/keyless.d.mts +8 -8
- package/dist/esm/api/keyless.mjs +1 -1
- package/dist/esm/api/staking.mjs +1 -1
- package/dist/esm/api/transaction.d.mts +1 -1
- package/dist/esm/api/transaction.mjs +1 -1
- package/dist/esm/api/transactionSubmission/build.mjs +1 -1
- package/dist/esm/api/transactionSubmission/management.d.mts +1 -1
- package/dist/esm/api/transactionSubmission/management.mjs +1 -1
- package/dist/esm/api/transactionSubmission/sign.d.mts +1 -1
- package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
- package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
- package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
- package/dist/esm/api/utils.mjs +1 -1
- package/dist/esm/{chunk-5U2HUO5I.mjs → chunk-25N7RLBW.mjs} +2 -2
- package/dist/esm/{chunk-5U2HUO5I.mjs.map → chunk-25N7RLBW.mjs.map} +1 -1
- package/dist/esm/chunk-32355KGV.mjs +2 -0
- package/dist/esm/chunk-32355KGV.mjs.map +1 -0
- package/dist/esm/{chunk-DBHUQJV6.mjs → chunk-3OELNIC6.mjs} +2 -2
- package/dist/esm/chunk-3U5VRZLS.mjs +2 -0
- package/dist/esm/{chunk-S5HG2QUD.mjs.map → chunk-3U5VRZLS.mjs.map} +1 -1
- package/dist/esm/chunk-43WARVT3.mjs +2 -0
- package/dist/esm/{chunk-PGN46FRK.mjs.map → chunk-43WARVT3.mjs.map} +1 -1
- package/dist/esm/chunk-56NB52W6.mjs +2 -0
- package/dist/esm/chunk-56NB52W6.mjs.map +1 -0
- package/dist/esm/{chunk-ZB4QCXPI.mjs → chunk-5DW2AJPI.mjs} +2 -2
- package/dist/esm/{chunk-ID5XEMNJ.mjs → chunk-5QWUIVAQ.mjs} +2 -2
- package/dist/esm/{chunk-WTVN3XGK.mjs → chunk-6456EI2E.mjs} +2 -2
- package/dist/esm/{chunk-DCALFAYP.mjs → chunk-65UZZNN2.mjs} +2 -2
- package/dist/esm/{chunk-EEZ7W4FY.mjs → chunk-6LOTZ4GY.mjs} +2 -2
- package/dist/esm/{chunk-DFWISQYQ.mjs → chunk-6SHLLRJA.mjs} +2 -2
- package/dist/esm/{chunk-NJAV2RSI.mjs → chunk-73Y4NTDU.mjs} +2 -2
- package/dist/esm/chunk-7PSX4LCV.mjs +2 -0
- package/dist/esm/{chunk-IY76OUEM.mjs.map → chunk-7PSX4LCV.mjs.map} +1 -1
- package/dist/esm/chunk-7Q2NVO5M.mjs +2 -0
- package/dist/esm/chunk-7Q2NVO5M.mjs.map +1 -0
- package/dist/esm/chunk-C5UVSNZW.mjs +2 -0
- package/dist/esm/chunk-C5UVSNZW.mjs.map +1 -0
- package/dist/esm/{chunk-JDYILQSI.mjs → chunk-CLVAGDXO.mjs} +2 -2
- package/dist/esm/{chunk-Q5YW4VKH.mjs → chunk-D22EMNIY.mjs} +2 -2
- package/dist/esm/{chunk-X5HARDBD.mjs → chunk-DLTC6PJP.mjs} +2 -2
- package/dist/esm/{chunk-UIHUFI4D.mjs → chunk-EKABTHUZ.mjs} +2 -2
- package/dist/esm/chunk-EOMDZYSJ.mjs +2 -0
- package/dist/esm/chunk-EOMDZYSJ.mjs.map +1 -0
- package/dist/esm/{chunk-OEGY3D5Z.mjs → chunk-FKSACFCB.mjs} +2 -2
- package/dist/esm/{chunk-7NX7LTJJ.mjs → chunk-G4XSNSOT.mjs} +2 -2
- package/dist/esm/{chunk-I5NLKA3M.mjs → chunk-H3TFQ7K4.mjs} +2 -2
- package/dist/esm/{chunk-6M6XXPQQ.mjs → chunk-H6LYW7HG.mjs} +2 -2
- package/dist/esm/{chunk-R7BAM2G6.mjs → chunk-HCGWCB5E.mjs} +2 -2
- package/dist/esm/{chunk-XHPLLMR5.mjs → chunk-HXSW6X7K.mjs} +2 -2
- package/dist/esm/{chunk-QW55WEXU.mjs → chunk-IXYXFDJZ.mjs} +2 -2
- package/dist/esm/{chunk-J7BN4K72.mjs → chunk-J7J7ZTBF.mjs} +2 -2
- package/dist/esm/chunk-JVKMQ64G.mjs +2 -0
- package/dist/esm/{chunk-ALPPGXXW.mjs.map → chunk-JVKMQ64G.mjs.map} +1 -1
- package/dist/esm/{chunk-TISS3UCO.mjs → chunk-KWNBC5MF.mjs} +2 -2
- package/dist/esm/chunk-LDQ6JFEF.mjs +2 -0
- package/dist/esm/chunk-LDQ6JFEF.mjs.map +1 -0
- package/dist/esm/chunk-NGNETNK2.mjs +2 -0
- package/dist/esm/chunk-NGNETNK2.mjs.map +1 -0
- package/dist/esm/{chunk-EJPL4WP3.mjs → chunk-NKCZ4KGO.mjs} +2 -2
- package/dist/esm/chunk-NMECYE3D.mjs +2 -0
- package/dist/esm/chunk-NMECYE3D.mjs.map +1 -0
- package/dist/esm/{chunk-IERPDC22.mjs → chunk-NNW6HWIO.mjs} +2 -2
- package/dist/esm/{chunk-ZGTJMNZG.mjs → chunk-O34EOOVF.mjs} +2 -2
- package/dist/esm/{chunk-7JNPSNL6.mjs → chunk-OBEVVLF7.mjs} +2 -2
- package/dist/esm/{chunk-Z2ZV7SJI.mjs → chunk-OLGSIKFB.mjs} +2 -2
- package/dist/esm/{chunk-3X7RN4TM.mjs → chunk-OZC3FCJP.mjs} +2 -2
- package/dist/esm/{chunk-XQ2CSNQG.mjs → chunk-PINF6ZWP.mjs} +2 -2
- package/dist/esm/{chunk-DMKFITUM.mjs → chunk-PJXRQBF6.mjs} +2 -2
- package/dist/esm/{chunk-VIJBWYHD.mjs → chunk-QHVZL3LZ.mjs} +2 -2
- package/dist/esm/{chunk-MHANMSFM.mjs → chunk-QNHDS64I.mjs} +2 -2
- package/dist/esm/{chunk-5UDWQC3F.mjs → chunk-RBPGL6YB.mjs} +2 -2
- package/dist/esm/{chunk-4Z22B5FW.mjs → chunk-RTSEMQCK.mjs} +2 -2
- package/dist/esm/{chunk-5CY6DMOC.mjs → chunk-SRPTQ4VV.mjs} +2 -2
- package/dist/esm/{chunk-FEXAWES4.mjs → chunk-TXMPXZBG.mjs} +2 -2
- package/dist/esm/{chunk-H7A56KXV.mjs → chunk-UGIJHLL3.mjs} +2 -2
- package/dist/esm/{chunk-PTIZKRON.mjs → chunk-UVOU6BW2.mjs} +2 -2
- package/dist/esm/{chunk-C7ZUHEPR.mjs → chunk-V7P6MLSY.mjs} +2 -2
- package/dist/esm/{chunk-XVHMGCDZ.mjs → chunk-VJJN3GFD.mjs} +2 -2
- package/dist/esm/{chunk-FJTNAGMR.mjs → chunk-WOLIXKOK.mjs} +2 -2
- package/dist/esm/{chunk-YXRZEUT6.mjs → chunk-WVIPPU2C.mjs} +2 -2
- package/dist/esm/chunk-XCR3YNHW.mjs +2 -0
- package/dist/esm/chunk-XCR3YNHW.mjs.map +1 -0
- package/dist/esm/{chunk-SWIHAMDH.mjs → chunk-XMFPKHB5.mjs} +2 -2
- package/dist/esm/{chunk-WPVBC4JS.mjs → chunk-XN4SQWI5.mjs} +2 -2
- package/dist/esm/chunk-XN4SQWI5.mjs.map +1 -0
- package/dist/esm/{chunk-PEUK5XJE.mjs → chunk-Z5KKUXYI.mjs} +2 -2
- package/dist/esm/chunk-ZM436N3W.mjs +2 -0
- package/dist/esm/chunk-ZM436N3W.mjs.map +1 -0
- package/dist/esm/cli/index.d.mts +12 -0
- package/dist/esm/cli/index.mjs +1 -1
- package/dist/esm/cli/move.d.mts +105 -0
- package/dist/esm/cli/move.mjs +2 -0
- package/dist/esm/cli/move.mjs.map +1 -0
- package/dist/esm/client/core.mjs +1 -1
- package/dist/esm/client/get.mjs +1 -1
- package/dist/esm/client/index.mjs +1 -1
- package/dist/esm/client/post.mjs +1 -1
- package/dist/esm/core/crypto/ed25519.mjs +1 -1
- package/dist/esm/core/crypto/ephemeral.mjs +1 -1
- package/dist/esm/core/crypto/hdKey.mjs +1 -1
- package/dist/esm/core/crypto/index.d.mts +1 -1
- package/dist/esm/core/crypto/index.mjs +1 -1
- package/dist/esm/core/crypto/keyless.mjs +1 -1
- package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
- package/dist/esm/core/crypto/multiKey.d.mts +9 -3
- package/dist/esm/core/crypto/multiKey.mjs +1 -1
- package/dist/esm/core/crypto/secp256k1.mjs +1 -1
- package/dist/esm/core/crypto/singleKey.mjs +1 -1
- package/dist/esm/core/index.d.mts +1 -1
- package/dist/esm/core/index.mjs +1 -1
- package/dist/esm/index.d.mts +5 -5
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/internal/account.d.mts +1 -1
- package/dist/esm/internal/account.mjs +1 -1
- package/dist/esm/internal/ans.d.mts +1 -1
- package/dist/esm/internal/ans.mjs +1 -1
- package/dist/esm/internal/coin.mjs +1 -1
- package/dist/esm/internal/digitalAsset.d.mts +1 -1
- package/dist/esm/internal/digitalAsset.mjs +1 -1
- package/dist/esm/internal/event.mjs +1 -1
- package/dist/esm/internal/faucet.mjs +1 -1
- package/dist/esm/internal/fungibleAsset.d.mts +1 -1
- package/dist/esm/internal/fungibleAsset.mjs +1 -1
- package/dist/esm/internal/general.mjs +1 -1
- package/dist/esm/internal/keyless.d.mts +2 -2
- package/dist/esm/internal/keyless.mjs +1 -1
- package/dist/esm/internal/staking.mjs +1 -1
- package/dist/esm/internal/transaction.mjs +1 -1
- package/dist/esm/internal/transactionSubmission.d.mts +1 -1
- package/dist/esm/internal/transactionSubmission.mjs +1 -1
- package/dist/esm/internal/view.mjs +1 -1
- package/dist/esm/transactions/authenticator/account.d.mts +3 -3
- package/dist/esm/transactions/authenticator/account.mjs +1 -1
- package/dist/esm/transactions/authenticator/index.mjs +1 -1
- package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
- package/dist/esm/transactions/index.d.mts +1 -1
- package/dist/esm/transactions/index.mjs +1 -1
- package/dist/esm/transactions/instances/index.mjs +1 -1
- package/dist/esm/transactions/instances/moduleId.mjs +1 -1
- package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
- package/dist/esm/transactions/management/accountSequenceNumber.d.mts +1 -1
- package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
- package/dist/esm/transactions/management/index.d.mts +1 -1
- package/dist/esm/transactions/management/index.mjs +1 -1
- package/dist/esm/transactions/management/transactionWorker.d.mts +1 -1
- package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/index.d.mts +1 -1
- package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/signingMessage.d.mts +26 -1
- package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +3 -13
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
- package/dist/esm/transactions/typeTag/index.mjs +1 -1
- package/dist/esm/transactions/typeTag/parser.mjs +1 -1
- package/dist/esm/utils/apiEndpoints.d.mts +0 -1
- package/dist/esm/utils/apiEndpoints.mjs +1 -1
- package/dist/esm/utils/index.mjs +1 -1
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/src/account/Account.ts +19 -5
- package/src/account/Ed25519Account.ts +35 -5
- package/src/account/KeylessAccount.ts +11 -7
- package/src/account/MultiKeyAccount.ts +95 -32
- package/src/account/SingleKeyAccount.ts +35 -5
- package/src/account/index.ts +1 -1
- package/src/cli/index.ts +1 -0
- package/src/cli/move.ts +183 -0
- package/src/core/crypto/hdKey.ts +5 -5
- package/src/core/crypto/multiKey.ts +18 -17
- package/src/internal/ans.ts +0 -1
- package/src/internal/fungibleAsset.ts +1 -1
- package/src/internal/transactionSubmission.ts +1 -1
- package/src/transactions/authenticator/account.ts +4 -4
- package/src/transactions/transactionBuilder/signingMessage.ts +33 -10
- package/src/transactions/transactionBuilder/transactionBuilder.ts +7 -51
- package/src/utils/apiEndpoints.ts +0 -6
- package/src/version.ts +1 -1
- package/dist/esm/chunk-5RBI4QWR.mjs +0 -2
- package/dist/esm/chunk-5RBI4QWR.mjs.map +0 -1
- package/dist/esm/chunk-ALPPGXXW.mjs +0 -2
- package/dist/esm/chunk-CHBG3GY5.mjs +0 -2
- package/dist/esm/chunk-CHBG3GY5.mjs.map +0 -1
- package/dist/esm/chunk-HHYQZBJO.mjs +0 -2
- package/dist/esm/chunk-HHYQZBJO.mjs.map +0 -1
- package/dist/esm/chunk-IY76OUEM.mjs +0 -2
- package/dist/esm/chunk-KGJITNRZ.mjs +0 -2
- package/dist/esm/chunk-KGJITNRZ.mjs.map +0 -1
- package/dist/esm/chunk-LIPZPOQG.mjs +0 -2
- package/dist/esm/chunk-LIPZPOQG.mjs.map +0 -1
- package/dist/esm/chunk-PGN46FRK.mjs +0 -2
- package/dist/esm/chunk-PXIIS7JA.mjs +0 -2
- package/dist/esm/chunk-PXIIS7JA.mjs.map +0 -1
- package/dist/esm/chunk-S5HG2QUD.mjs +0 -2
- package/dist/esm/chunk-UQ65W433.mjs +0 -2
- package/dist/esm/chunk-UQ65W433.mjs.map +0 -1
- package/dist/esm/chunk-WPVBC4JS.mjs.map +0 -1
- package/dist/esm/chunk-XS4XZVGH.mjs +0 -2
- package/dist/esm/chunk-XS4XZVGH.mjs.map +0 -1
- package/dist/esm/chunk-ZADLGPN7.mjs +0 -2
- package/dist/esm/chunk-ZADLGPN7.mjs.map +0 -1
- /package/dist/esm/{chunk-DBHUQJV6.mjs.map → chunk-3OELNIC6.mjs.map} +0 -0
- /package/dist/esm/{chunk-ZB4QCXPI.mjs.map → chunk-5DW2AJPI.mjs.map} +0 -0
- /package/dist/esm/{chunk-ID5XEMNJ.mjs.map → chunk-5QWUIVAQ.mjs.map} +0 -0
- /package/dist/esm/{chunk-WTVN3XGK.mjs.map → chunk-6456EI2E.mjs.map} +0 -0
- /package/dist/esm/{chunk-DCALFAYP.mjs.map → chunk-65UZZNN2.mjs.map} +0 -0
- /package/dist/esm/{chunk-EEZ7W4FY.mjs.map → chunk-6LOTZ4GY.mjs.map} +0 -0
- /package/dist/esm/{chunk-DFWISQYQ.mjs.map → chunk-6SHLLRJA.mjs.map} +0 -0
- /package/dist/esm/{chunk-NJAV2RSI.mjs.map → chunk-73Y4NTDU.mjs.map} +0 -0
- /package/dist/esm/{chunk-JDYILQSI.mjs.map → chunk-CLVAGDXO.mjs.map} +0 -0
- /package/dist/esm/{chunk-Q5YW4VKH.mjs.map → chunk-D22EMNIY.mjs.map} +0 -0
- /package/dist/esm/{chunk-X5HARDBD.mjs.map → chunk-DLTC6PJP.mjs.map} +0 -0
- /package/dist/esm/{chunk-UIHUFI4D.mjs.map → chunk-EKABTHUZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-OEGY3D5Z.mjs.map → chunk-FKSACFCB.mjs.map} +0 -0
- /package/dist/esm/{chunk-7NX7LTJJ.mjs.map → chunk-G4XSNSOT.mjs.map} +0 -0
- /package/dist/esm/{chunk-I5NLKA3M.mjs.map → chunk-H3TFQ7K4.mjs.map} +0 -0
- /package/dist/esm/{chunk-6M6XXPQQ.mjs.map → chunk-H6LYW7HG.mjs.map} +0 -0
- /package/dist/esm/{chunk-R7BAM2G6.mjs.map → chunk-HCGWCB5E.mjs.map} +0 -0
- /package/dist/esm/{chunk-XHPLLMR5.mjs.map → chunk-HXSW6X7K.mjs.map} +0 -0
- /package/dist/esm/{chunk-QW55WEXU.mjs.map → chunk-IXYXFDJZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-J7BN4K72.mjs.map → chunk-J7J7ZTBF.mjs.map} +0 -0
- /package/dist/esm/{chunk-TISS3UCO.mjs.map → chunk-KWNBC5MF.mjs.map} +0 -0
- /package/dist/esm/{chunk-EJPL4WP3.mjs.map → chunk-NKCZ4KGO.mjs.map} +0 -0
- /package/dist/esm/{chunk-IERPDC22.mjs.map → chunk-NNW6HWIO.mjs.map} +0 -0
- /package/dist/esm/{chunk-ZGTJMNZG.mjs.map → chunk-O34EOOVF.mjs.map} +0 -0
- /package/dist/esm/{chunk-7JNPSNL6.mjs.map → chunk-OBEVVLF7.mjs.map} +0 -0
- /package/dist/esm/{chunk-Z2ZV7SJI.mjs.map → chunk-OLGSIKFB.mjs.map} +0 -0
- /package/dist/esm/{chunk-3X7RN4TM.mjs.map → chunk-OZC3FCJP.mjs.map} +0 -0
- /package/dist/esm/{chunk-XQ2CSNQG.mjs.map → chunk-PINF6ZWP.mjs.map} +0 -0
- /package/dist/esm/{chunk-DMKFITUM.mjs.map → chunk-PJXRQBF6.mjs.map} +0 -0
- /package/dist/esm/{chunk-VIJBWYHD.mjs.map → chunk-QHVZL3LZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-MHANMSFM.mjs.map → chunk-QNHDS64I.mjs.map} +0 -0
- /package/dist/esm/{chunk-5UDWQC3F.mjs.map → chunk-RBPGL6YB.mjs.map} +0 -0
- /package/dist/esm/{chunk-4Z22B5FW.mjs.map → chunk-RTSEMQCK.mjs.map} +0 -0
- /package/dist/esm/{chunk-5CY6DMOC.mjs.map → chunk-SRPTQ4VV.mjs.map} +0 -0
- /package/dist/esm/{chunk-FEXAWES4.mjs.map → chunk-TXMPXZBG.mjs.map} +0 -0
- /package/dist/esm/{chunk-H7A56KXV.mjs.map → chunk-UGIJHLL3.mjs.map} +0 -0
- /package/dist/esm/{chunk-PTIZKRON.mjs.map → chunk-UVOU6BW2.mjs.map} +0 -0
- /package/dist/esm/{chunk-C7ZUHEPR.mjs.map → chunk-V7P6MLSY.mjs.map} +0 -0
- /package/dist/esm/{chunk-XVHMGCDZ.mjs.map → chunk-VJJN3GFD.mjs.map} +0 -0
- /package/dist/esm/{chunk-FJTNAGMR.mjs.map → chunk-WOLIXKOK.mjs.map} +0 -0
- /package/dist/esm/{chunk-YXRZEUT6.mjs.map → chunk-WVIPPU2C.mjs.map} +0 -0
- /package/dist/esm/{chunk-SWIHAMDH.mjs.map → chunk-XMFPKHB5.mjs.map} +0 -0
- /package/dist/esm/{chunk-PEUK5XJE.mjs.map → chunk-Z5KKUXYI.mjs.map} +0 -0
|
@@ -2,13 +2,26 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
4
|
import { Account } from "./Account";
|
|
5
|
-
import { MultiKey,
|
|
5
|
+
import { MultiKey, MultiKeySignature, PublicKey } from "../core/crypto";
|
|
6
6
|
import { AccountAddress } from "../core/accountAddress";
|
|
7
7
|
import { HexInput, SigningScheme } from "../types";
|
|
8
8
|
import { AccountAuthenticatorMultiKey } from "../transactions/authenticator/account";
|
|
9
9
|
import { AnyRawTransaction } from "../transactions/types";
|
|
10
10
|
import { KeylessAccount } from "./KeylessAccount";
|
|
11
11
|
|
|
12
|
+
export interface VerifyMultiKeySignatureArgs {
|
|
13
|
+
message: HexInput;
|
|
14
|
+
signature: MultiKeySignature;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Signer implementation for the MultiKey authentication scheme.
|
|
19
|
+
*
|
|
20
|
+
* This accounts to use a M of N signing scheme. M and N are specified in the {@link MultiKey}
|
|
21
|
+
* It signs messages via the array of M number of Accounts that individually correspond to a public key in the {@link MultiKey}.
|
|
22
|
+
*
|
|
23
|
+
* Note: Generating a signer instance does not create the account on-chain.
|
|
24
|
+
*/
|
|
12
25
|
export class MultiKeyAccount implements Account {
|
|
13
26
|
/**
|
|
14
27
|
* Public key associated with the account
|
|
@@ -25,39 +38,60 @@ export class MultiKeyAccount implements Account {
|
|
|
25
38
|
*/
|
|
26
39
|
readonly signingScheme: SigningScheme;
|
|
27
40
|
|
|
28
|
-
|
|
41
|
+
/**
|
|
42
|
+
* The signers used to sign messages. These signers should correspond to public keys in the
|
|
43
|
+
* MultiKeyAccount's public key. The number of signers should be equal or greater
|
|
44
|
+
* than this.publicKey.signaturesRequired
|
|
45
|
+
*/
|
|
46
|
+
readonly signers: Account[];
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* An array of indicies where for signer[i], signerIndicies[i] is the index of the corresponding public key in
|
|
50
|
+
* publicKey.publicKeys. Used to derive the right public key to use for verification.
|
|
51
|
+
*/
|
|
52
|
+
readonly signerIndicies: number[];
|
|
29
53
|
|
|
30
|
-
signaturesBitmap: Uint8Array;
|
|
54
|
+
readonly signaturesBitmap: Uint8Array;
|
|
31
55
|
|
|
32
56
|
/**
|
|
33
|
-
* constructor for
|
|
34
|
-
*
|
|
35
|
-
* Need to update this to use the new crypto library if new schemes are added.
|
|
36
|
-
*
|
|
37
|
-
* @param args.privateKey PrivateKey - private key of the account
|
|
38
|
-
* @param args.address AccountAddress - address of the account
|
|
39
|
-
* @param args.legacy optional. If set to false, the keypair authentication keys will be derived with a unified scheme.
|
|
40
|
-
* Defaults to deriving an authentication key with the legacy scheme.
|
|
57
|
+
* constructor for MultiKeyAccount
|
|
41
58
|
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
59
|
+
* @param args.multiKey the multikey of the account which consists of N public keys and a number M which is
|
|
60
|
+
* the number of required signatures.
|
|
61
|
+
* @param args.signers an array of M signers that will be used to sign the transaction
|
|
62
|
+
* @returns MultiKeyAccount
|
|
44
63
|
*/
|
|
45
64
|
constructor(args: { multiKey: MultiKey; signers: Account[] }) {
|
|
46
65
|
const { multiKey, signers } = args;
|
|
47
66
|
|
|
48
67
|
this.publicKey = multiKey;
|
|
49
|
-
this.signers = signers;
|
|
50
68
|
this.signingScheme = SigningScheme.MultiKey;
|
|
51
69
|
|
|
52
70
|
this.accountAddress = this.publicKey.authKey().derivedAddress();
|
|
53
71
|
|
|
54
|
-
|
|
72
|
+
// Get the index of each respective signer in the bitmap
|
|
73
|
+
const bitPositions: number[] = [];
|
|
55
74
|
for (const signer of signers) {
|
|
56
|
-
|
|
75
|
+
bitPositions.push(this.publicKey.getIndex(signer.publicKey));
|
|
57
76
|
}
|
|
58
|
-
|
|
77
|
+
// Zip signers and bit positions and sort signers by bit positions in order
|
|
78
|
+
// to ensure the signature is signed in ascending order according to the bitmap.
|
|
79
|
+
// Authentication on chain will fail otherwise.
|
|
80
|
+
const signersAndBitPosition: [Account, number][] = signers.map((signer, index) => [signer, bitPositions[index]]);
|
|
81
|
+
signersAndBitPosition.sort((a, b) => a[1] - b[1]);
|
|
82
|
+
this.signers = signersAndBitPosition.map((value) => value[0]);
|
|
83
|
+
this.signerIndicies = signersAndBitPosition.map((value) => value[1]);
|
|
84
|
+
this.signaturesBitmap = this.publicKey.createBitmap({ bits: bitPositions });
|
|
59
85
|
}
|
|
60
86
|
|
|
87
|
+
/**
|
|
88
|
+
* Static constructor for MultiKeyAccount
|
|
89
|
+
*
|
|
90
|
+
* @param args.publicKeys the N public keys of the MultiKeyAccount
|
|
91
|
+
* @param args.signaturesRequired the number of signatures required
|
|
92
|
+
* @param args.signers an array of M signers that will be used to sign the transaction
|
|
93
|
+
* @returns MultiKeyAccount
|
|
94
|
+
*/
|
|
61
95
|
static fromPublicKeysAndSigners(args: {
|
|
62
96
|
publicKeys: PublicKey[];
|
|
63
97
|
signaturesRequired: number;
|
|
@@ -72,7 +106,21 @@ export class MultiKeyAccount implements Account {
|
|
|
72
106
|
return account instanceof MultiKeyAccount;
|
|
73
107
|
}
|
|
74
108
|
|
|
75
|
-
|
|
109
|
+
/**
|
|
110
|
+
* Sign a message using the account's signers.
|
|
111
|
+
* @param message the signing message, as binary input
|
|
112
|
+
* @return the AccountAuthenticator containing the signature, together with the account's public key
|
|
113
|
+
*/
|
|
114
|
+
signWithAuthenticator(message: HexInput): AccountAuthenticatorMultiKey {
|
|
115
|
+
return new AccountAuthenticatorMultiKey(this.publicKey, this.sign(message));
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Sign a transaction using the account's signers.
|
|
120
|
+
* @param transaction the raw transaction
|
|
121
|
+
* @return the AccountAuthenticator containing the signature of the transaction, together with the account's public key
|
|
122
|
+
*/
|
|
123
|
+
signTransactionWithAuthenticator(transaction: AnyRawTransaction): AccountAuthenticatorMultiKey {
|
|
76
124
|
return new AccountAuthenticatorMultiKey(this.publicKey, this.signTransaction(transaction));
|
|
77
125
|
}
|
|
78
126
|
|
|
@@ -82,38 +130,53 @@ export class MultiKeyAccount implements Account {
|
|
|
82
130
|
}
|
|
83
131
|
|
|
84
132
|
/**
|
|
85
|
-
* Sign the given message
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
* @param data in HexInput format
|
|
90
|
-
* @returns Signature
|
|
133
|
+
* Sign the given message using the MultiKeyAccount's signers
|
|
134
|
+
* @param message in HexInput format
|
|
135
|
+
* @returns MultiKeySignature
|
|
91
136
|
*/
|
|
92
|
-
sign(data: HexInput):
|
|
137
|
+
sign(data: HexInput): MultiKeySignature {
|
|
93
138
|
const signatures = [];
|
|
94
139
|
for (const signer of this.signers) {
|
|
95
140
|
signatures.push(signer.sign(data));
|
|
96
141
|
}
|
|
97
|
-
return new
|
|
142
|
+
return new MultiKeySignature({ signatures, bitmap: this.signaturesBitmap });
|
|
98
143
|
}
|
|
99
144
|
|
|
100
|
-
|
|
145
|
+
/**
|
|
146
|
+
* Sign the given transaction using the MultiKeyAccount's signers
|
|
147
|
+
* @param transaction the transaction to be signed
|
|
148
|
+
* @returns MultiKeySignature
|
|
149
|
+
*/
|
|
150
|
+
signTransaction(transaction: AnyRawTransaction): MultiKeySignature {
|
|
101
151
|
const signatures = [];
|
|
102
152
|
for (const signer of this.signers) {
|
|
103
153
|
signatures.push(signer.signTransaction(transaction));
|
|
104
154
|
}
|
|
105
|
-
return new
|
|
155
|
+
return new MultiKeySignature({ signatures, bitmap: this.signaturesBitmap });
|
|
106
156
|
}
|
|
107
157
|
|
|
108
158
|
/**
|
|
109
159
|
* Verify the given message and signature with the public key.
|
|
110
160
|
*
|
|
111
161
|
* @param args.message raw message data in HexInput format
|
|
112
|
-
* @param args.
|
|
113
|
-
* @returns
|
|
162
|
+
* @param args.signatures signed message MultiKeySignature
|
|
163
|
+
* @returns boolean
|
|
114
164
|
*/
|
|
115
|
-
|
|
116
|
-
|
|
165
|
+
verifySignature(args: VerifyMultiKeySignatureArgs): boolean {
|
|
166
|
+
const { message, signature } = args;
|
|
167
|
+
const isSignerIndiciesSorted = this.signerIndicies.every(
|
|
168
|
+
(value, i) => i === 0 || value >= this.signerIndicies[i - 1],
|
|
169
|
+
);
|
|
170
|
+
if (!isSignerIndiciesSorted) {
|
|
171
|
+
return false;
|
|
172
|
+
}
|
|
173
|
+
for (let i = 0; i < signature.signatures.length; i += 1) {
|
|
174
|
+
const singleSignature = signature.signatures[i];
|
|
175
|
+
const publicKey = this.publicKey.publicKeys[this.signerIndicies[i]];
|
|
176
|
+
if (!publicKey.verifySignature({ message, signature: singleSignature })) {
|
|
177
|
+
return false;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
117
180
|
return true;
|
|
118
181
|
}
|
|
119
182
|
}
|
|
@@ -104,20 +104,50 @@ export class SingleKeyAccount implements Account {
|
|
|
104
104
|
|
|
105
105
|
// region Account
|
|
106
106
|
|
|
107
|
+
/**
|
|
108
|
+
* Verify the given message and signature with the public key.
|
|
109
|
+
*
|
|
110
|
+
* @param args.message raw message data in HexInput format
|
|
111
|
+
* @param args.signature signed message Signature
|
|
112
|
+
* @returns
|
|
113
|
+
*/
|
|
107
114
|
verifySignature(args: VerifySingleKeySignatureArgs): boolean {
|
|
108
115
|
return this.publicKey.verifySignature(args);
|
|
109
116
|
}
|
|
110
117
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
118
|
+
/**
|
|
119
|
+
* Sign a message using the account's private key.
|
|
120
|
+
* @param message the signing message, as binary input
|
|
121
|
+
* @return the AccountAuthenticator containing the signature, together with the account's public key
|
|
122
|
+
*/
|
|
123
|
+
signWithAuthenticator(message: HexInput): AccountAuthenticatorSingleKey {
|
|
124
|
+
return new AccountAuthenticatorSingleKey(this.publicKey, this.sign(message));
|
|
114
125
|
}
|
|
115
126
|
|
|
116
|
-
|
|
127
|
+
/**
|
|
128
|
+
* Sign a transaction using the account's private key.
|
|
129
|
+
* @param transaction the raw transaction
|
|
130
|
+
* @return the AccountAuthenticator containing the signature of the transaction, together with the account's public key
|
|
131
|
+
*/
|
|
132
|
+
signTransactionWithAuthenticator(transaction: AnyRawTransaction): AccountAuthenticatorSingleKey {
|
|
133
|
+
return new AccountAuthenticatorSingleKey(this.publicKey, this.signTransaction(transaction));
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Sign the given message using the account's private key.
|
|
138
|
+
* @param message in HexInput format
|
|
139
|
+
* @returns Signature
|
|
140
|
+
*/
|
|
141
|
+
sign(message: HexInput): AnySignature {
|
|
117
142
|
return new AnySignature(this.privateKey.sign(message));
|
|
118
143
|
}
|
|
119
144
|
|
|
120
|
-
|
|
145
|
+
/**
|
|
146
|
+
* Sign the given transaction using the account's private key.
|
|
147
|
+
* @param transaction the transaction to be signed
|
|
148
|
+
* @returns Signature
|
|
149
|
+
*/
|
|
150
|
+
signTransaction(transaction: AnyRawTransaction): AnySignature {
|
|
121
151
|
return this.sign(generateSigningMessageForTransaction(transaction));
|
|
122
152
|
}
|
|
123
153
|
|
package/src/account/index.ts
CHANGED
package/src/cli/index.ts
CHANGED
package/src/cli/move.ts
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { spawn } from "child_process";
|
|
2
|
+
import { AccountAddress } from "../core";
|
|
3
|
+
import { Network } from "../utils";
|
|
4
|
+
|
|
5
|
+
export class Move {
|
|
6
|
+
/**
|
|
7
|
+
* Function to initialize current directory for Aptos
|
|
8
|
+
*
|
|
9
|
+
* Configuration will be pushed into .aptos/config.yaml
|
|
10
|
+
* @param args.network optional Netowrk type argument to use for default settings, default is local
|
|
11
|
+
* @param args.profile optional Profile to use from the config file, default is 'default'
|
|
12
|
+
* This will be used to override associated settings such as the REST URL, the Faucet URL, and the private key arguments.
|
|
13
|
+
*
|
|
14
|
+
* @returns
|
|
15
|
+
*/
|
|
16
|
+
async init(args: { network?: Network; profile?: string }): Promise<boolean> {
|
|
17
|
+
const { network, profile } = args;
|
|
18
|
+
const cliArgs = ["aptos", "init", `--network=${network ?? "local"}`, `--profile=${profile ?? "default"}`];
|
|
19
|
+
|
|
20
|
+
return this.runCommand(cliArgs);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Function to compile a package
|
|
25
|
+
*
|
|
26
|
+
* @param args.packageDirectoryPath Path to a move package (the folder with a Move.toml file)
|
|
27
|
+
* @param args.namedAddresses Named addresses for the move binary
|
|
28
|
+
* @example
|
|
29
|
+
* {
|
|
30
|
+
* alice:0x1234, bob:0x5678
|
|
31
|
+
* }
|
|
32
|
+
*
|
|
33
|
+
* @returns
|
|
34
|
+
*/
|
|
35
|
+
async compile(args: {
|
|
36
|
+
packageDirectoryPath: string;
|
|
37
|
+
namedAddresses: Record<string, AccountAddress>;
|
|
38
|
+
}): Promise<boolean> {
|
|
39
|
+
const { packageDirectoryPath, namedAddresses } = args;
|
|
40
|
+
const cliArgs = ["aptos", "move", "compile", "--package-dir", packageDirectoryPath, "--skip-fetch-latest-git-deps"];
|
|
41
|
+
|
|
42
|
+
const addressesMap = this.parseNamedAddresses(namedAddresses);
|
|
43
|
+
|
|
44
|
+
cliArgs.push(...this.prepareNamedAddresses(addressesMap));
|
|
45
|
+
|
|
46
|
+
return this.runCommand(cliArgs);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Function to run Move unit tests for a package
|
|
51
|
+
*
|
|
52
|
+
* @param args.packageDirectoryPath Path to a move package (the folder with a Move.toml file)
|
|
53
|
+
* @param args.namedAddresses Named addresses for the move binary
|
|
54
|
+
* @example
|
|
55
|
+
* {
|
|
56
|
+
* alice:0x1234, bob:0x5678
|
|
57
|
+
* }
|
|
58
|
+
*
|
|
59
|
+
* @returns
|
|
60
|
+
*/
|
|
61
|
+
async test(args: { packageDirectoryPath: string; namedAddresses: Record<string, AccountAddress> }): Promise<boolean> {
|
|
62
|
+
const { packageDirectoryPath, namedAddresses } = args;
|
|
63
|
+
const cliArgs = ["aptos", "move", "test", "--package-dir", packageDirectoryPath, "--skip-fetch-latest-git-deps"];
|
|
64
|
+
|
|
65
|
+
const addressesMap = this.parseNamedAddresses(namedAddresses);
|
|
66
|
+
|
|
67
|
+
cliArgs.push(...this.prepareNamedAddresses(addressesMap));
|
|
68
|
+
|
|
69
|
+
return this.runCommand(cliArgs);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Function to publishe the modules in a Move package to the Aptos blockchain
|
|
74
|
+
*
|
|
75
|
+
* @param args.packageDirectoryPath Path to a move package (the folder with a Move.toml file)
|
|
76
|
+
* @param args.namedAddresses Named addresses for the move binary
|
|
77
|
+
* @example
|
|
78
|
+
* {
|
|
79
|
+
* alice:0x1234, bob:0x5678
|
|
80
|
+
* }
|
|
81
|
+
* @param args.profile optional Profile to use from the config file.
|
|
82
|
+
*
|
|
83
|
+
* @returns
|
|
84
|
+
*/
|
|
85
|
+
async publish(args: {
|
|
86
|
+
packageDirectoryPath: string;
|
|
87
|
+
namedAddresses: Record<string, AccountAddress>;
|
|
88
|
+
profile?: string;
|
|
89
|
+
}): Promise<boolean> {
|
|
90
|
+
const { packageDirectoryPath, namedAddresses, profile } = args;
|
|
91
|
+
const cliArgs = [
|
|
92
|
+
"aptos",
|
|
93
|
+
"move",
|
|
94
|
+
"publish",
|
|
95
|
+
"--package-dir",
|
|
96
|
+
packageDirectoryPath,
|
|
97
|
+
"--skip-fetch-latest-git-deps",
|
|
98
|
+
`--profile=${profile ?? "default"}`,
|
|
99
|
+
];
|
|
100
|
+
|
|
101
|
+
const addressesMap = this.parseNamedAddresses(namedAddresses);
|
|
102
|
+
|
|
103
|
+
cliArgs.push(...this.prepareNamedAddresses(addressesMap));
|
|
104
|
+
|
|
105
|
+
return this.runCommand(cliArgs);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Run a move command
|
|
110
|
+
*
|
|
111
|
+
* @param args
|
|
112
|
+
* @returns
|
|
113
|
+
*/
|
|
114
|
+
// eslint-disable-next-line class-methods-use-this
|
|
115
|
+
private async runCommand(args: Array<string>): Promise<boolean> {
|
|
116
|
+
return new Promise((resolve, reject) => {
|
|
117
|
+
const childProcess = spawn("npx", args);
|
|
118
|
+
|
|
119
|
+
childProcess.stdout.pipe(process.stdout);
|
|
120
|
+
childProcess.stderr.pipe(process.stderr);
|
|
121
|
+
process.stdin.pipe(childProcess.stdin);
|
|
122
|
+
|
|
123
|
+
childProcess.on("close", (code) => {
|
|
124
|
+
if (code === 0) {
|
|
125
|
+
resolve(true); // Resolve with true if the child process exits successfully
|
|
126
|
+
} else {
|
|
127
|
+
reject(new Error(`Child process exited with code ${code}`)); // Reject with an error if the child process exits with an error code
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Convert named addresses from a Map into an array seperated by a comma
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* input: {'alice' => '0x123', 'bob' => '0x456'}
|
|
138
|
+
* output: "alice=0x123,bob=0x456"
|
|
139
|
+
*
|
|
140
|
+
* @param namedAddresses
|
|
141
|
+
* @returns An array of names addresses seperated by a comma
|
|
142
|
+
*/
|
|
143
|
+
// eslint-disable-next-line class-methods-use-this
|
|
144
|
+
private prepareNamedAddresses(namedAddresses: Map<string, AccountAddress>): Array<string> {
|
|
145
|
+
const totalNames = namedAddresses.size;
|
|
146
|
+
const newArgs: Array<string> = [];
|
|
147
|
+
|
|
148
|
+
if (totalNames === 0) {
|
|
149
|
+
return newArgs;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
newArgs.push("--named-addresses");
|
|
153
|
+
|
|
154
|
+
let idx = 0;
|
|
155
|
+
namedAddresses.forEach((value, key) => {
|
|
156
|
+
idx += 1;
|
|
157
|
+
let toAppend = `${key}=${value.toString()}`;
|
|
158
|
+
if (idx < totalNames - 1) {
|
|
159
|
+
toAppend += ",";
|
|
160
|
+
}
|
|
161
|
+
newArgs.push(toAppend);
|
|
162
|
+
});
|
|
163
|
+
return newArgs;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Parse named addresses from a Record type into a Map
|
|
168
|
+
*
|
|
169
|
+
* @param namedAddresses
|
|
170
|
+
* @returns Map<name,address>
|
|
171
|
+
*/
|
|
172
|
+
// eslint-disable-next-line class-methods-use-this
|
|
173
|
+
private parseNamedAddresses(namedAddresses: Record<string, AccountAddress>): Map<string, AccountAddress> {
|
|
174
|
+
const addressesMap = new Map();
|
|
175
|
+
|
|
176
|
+
Object.keys(namedAddresses).forEach((key) => {
|
|
177
|
+
const address = namedAddresses[key];
|
|
178
|
+
addressesMap.set(key, address);
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
return addressesMap;
|
|
182
|
+
}
|
|
183
|
+
}
|
package/src/core/crypto/hdKey.ts
CHANGED
|
@@ -105,11 +105,11 @@ export function fromDerivationPath(
|
|
|
105
105
|
seed: Uint8Array,
|
|
106
106
|
offset = HARDENED_OFFSET,
|
|
107
107
|
): Uint8Array {
|
|
108
|
-
if (offset === HARDENED_OFFSET && !isValidHardenedPath(path)) {
|
|
109
|
-
|
|
110
|
-
} else if (offset !== HARDENED_OFFSET && !isValidBIP44Path(path)) {
|
|
111
|
-
|
|
112
|
-
}
|
|
108
|
+
// if (offset === HARDENED_OFFSET && !isValidHardenedPath(path)) {
|
|
109
|
+
// throw new Error(`Invalid hardened derivation path ${path}`);
|
|
110
|
+
// } else if (offset !== HARDENED_OFFSET && !isValidBIP44Path(path)) {
|
|
111
|
+
// throw new Error(`Invalid derivation path ${path}`);
|
|
112
|
+
// }
|
|
113
113
|
const { key, chainCode } = deriveKey(hashSeed, seed);
|
|
114
114
|
|
|
115
115
|
const segments = splitPath(path).map((el) => parseInt(el, 10));
|
|
@@ -140,6 +140,12 @@ export class MultiKey extends AccountPublicKey {
|
|
|
140
140
|
return bitmap;
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
+
/**
|
|
144
|
+
* Get the index of the provided public key.
|
|
145
|
+
*
|
|
146
|
+
* @param publicKey array of the index mapping to the matching public keys
|
|
147
|
+
* @returns the corresponding index of the publicKey, if it exists
|
|
148
|
+
*/
|
|
143
149
|
getIndex(publicKey: PublicKey): number {
|
|
144
150
|
const anyPublicKey = publicKey instanceof AnyPublicKey ? publicKey : new AnyPublicKey(publicKey);
|
|
145
151
|
const index = this.publicKeys.findIndex((pk) => pk.toString() === anyPublicKey.toString());
|
|
@@ -151,7 +157,7 @@ export class MultiKey extends AccountPublicKey {
|
|
|
151
157
|
}
|
|
152
158
|
}
|
|
153
159
|
|
|
154
|
-
export class
|
|
160
|
+
export class MultiKeySignature extends Signature {
|
|
155
161
|
/**
|
|
156
162
|
* Number of bytes in the bitmap representing who signed the transaction (32-bits)
|
|
157
163
|
*/
|
|
@@ -160,7 +166,7 @@ export class MultiSignature extends Signature {
|
|
|
160
166
|
/**
|
|
161
167
|
* Maximum number of Ed25519 signatures supported
|
|
162
168
|
*/
|
|
163
|
-
static MAX_SIGNATURES_SUPPORTED =
|
|
169
|
+
static MAX_SIGNATURES_SUPPORTED = MultiKeySignature.BITMAP_LEN * 8;
|
|
164
170
|
|
|
165
171
|
/**
|
|
166
172
|
* The list of underlying Ed25519 signatures
|
|
@@ -188,8 +194,8 @@ export class MultiSignature extends Signature {
|
|
|
188
194
|
super();
|
|
189
195
|
const { signatures, bitmap } = args;
|
|
190
196
|
|
|
191
|
-
if (signatures.length >
|
|
192
|
-
throw new Error(`The number of signatures cannot be greater than ${
|
|
197
|
+
if (signatures.length > MultiKeySignature.MAX_SIGNATURES_SUPPORTED) {
|
|
198
|
+
throw new Error(`The number of signatures cannot be greater than ${MultiKeySignature.MAX_SIGNATURES_SUPPORTED}`);
|
|
193
199
|
}
|
|
194
200
|
|
|
195
201
|
// Make sure that all signatures are normalized to the SingleKey authentication scheme
|
|
@@ -198,9 +204,9 @@ export class MultiSignature extends Signature {
|
|
|
198
204
|
);
|
|
199
205
|
|
|
200
206
|
if (!(bitmap instanceof Uint8Array)) {
|
|
201
|
-
this.bitmap =
|
|
202
|
-
} else if (bitmap.length !==
|
|
203
|
-
throw new Error(`"bitmap" length should be ${
|
|
207
|
+
this.bitmap = MultiKeySignature.createBitmap({ bits: bitmap });
|
|
208
|
+
} else if (bitmap.length !== MultiKeySignature.BITMAP_LEN) {
|
|
209
|
+
throw new Error(`"bitmap" length should be ${MultiKeySignature.BITMAP_LEN}`);
|
|
204
210
|
} else {
|
|
205
211
|
this.bitmap = bitmap;
|
|
206
212
|
}
|
|
@@ -236,8 +242,8 @@ export class MultiSignature extends Signature {
|
|
|
236
242
|
const dupCheckSet = new Set();
|
|
237
243
|
|
|
238
244
|
bits.forEach((bit: number) => {
|
|
239
|
-
if (bit >=
|
|
240
|
-
throw new Error(`Cannot have a signature larger than ${
|
|
245
|
+
if (bit >= MultiKeySignature.MAX_SIGNATURES_SUPPORTED) {
|
|
246
|
+
throw new Error(`Cannot have a signature larger than ${MultiKeySignature.MAX_SIGNATURES_SUPPORTED - 1}.`);
|
|
241
247
|
}
|
|
242
248
|
|
|
243
249
|
if (dupCheckSet.has(bit)) {
|
|
@@ -275,15 +281,10 @@ export class MultiSignature extends Signature {
|
|
|
275
281
|
serializer.serializeBytes(this.bitmap);
|
|
276
282
|
}
|
|
277
283
|
|
|
278
|
-
static deserialize(deserializer: Deserializer):
|
|
284
|
+
static deserialize(deserializer: Deserializer): MultiKeySignature {
|
|
285
|
+
const signatures = deserializer.deserializeVector(AnySignature);
|
|
279
286
|
const bitmap = deserializer.deserializeBytes();
|
|
280
|
-
|
|
281
|
-
const signatures: AnySignature[] = [];
|
|
282
|
-
for (let i = 0; i < nSignatures; i += 1) {
|
|
283
|
-
const signature = AnySignature.deserialize(deserializer);
|
|
284
|
-
signatures.push(signature);
|
|
285
|
-
}
|
|
286
|
-
return new MultiSignature({ signatures, bitmap });
|
|
287
|
+
return new MultiKeySignature({ signatures, bitmap });
|
|
287
288
|
}
|
|
288
289
|
|
|
289
290
|
// endregion
|
package/src/internal/ans.ts
CHANGED
|
@@ -79,7 +79,6 @@ const NetworkToAnsContract: Record<Network, string | null> = {
|
|
|
79
79
|
[Network.LOCAL]: LOCAL_ANS_ACCOUNT_ADDRESS,
|
|
80
80
|
[Network.CUSTOM]: null,
|
|
81
81
|
[Network.DEVNET]: null,
|
|
82
|
-
[Network.RANDOMNET]: null,
|
|
83
82
|
};
|
|
84
83
|
|
|
85
84
|
function getRouterAddress(aptosConfig: AptosConfig): string {
|
|
@@ -118,7 +118,7 @@ export async function getCurrentFungibleAssetBalances(args: {
|
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
const faTransferAbi: EntryFunctionABI = {
|
|
121
|
-
typeParameters: [],
|
|
121
|
+
typeParameters: [{ constraints: [] }],
|
|
122
122
|
parameters: [parseTypeTag("0x1::object::Object"), new TypeTagAddress(), new TypeTagU64()],
|
|
123
123
|
};
|
|
124
124
|
|
|
@@ -203,7 +203,7 @@ export function getSigningMessage(args: { transaction: AnyRawTransaction }): Uin
|
|
|
203
203
|
*/
|
|
204
204
|
export function signTransaction(args: { signer: Account; transaction: AnyRawTransaction }): AccountAuthenticator {
|
|
205
205
|
const { signer, transaction } = args;
|
|
206
|
-
return signer.
|
|
206
|
+
return signer.signTransactionWithAuthenticator(transaction);
|
|
207
207
|
}
|
|
208
208
|
|
|
209
209
|
/**
|
|
@@ -7,7 +7,7 @@ import { Serializer, Deserializer, Serializable } from "../../bcs";
|
|
|
7
7
|
import { AnyPublicKey, AnySignature } from "../../core/crypto";
|
|
8
8
|
import { Ed25519PublicKey, Ed25519Signature } from "../../core/crypto/ed25519";
|
|
9
9
|
import { MultiEd25519PublicKey, MultiEd25519Signature } from "../../core/crypto/multiEd25519";
|
|
10
|
-
import { MultiKey,
|
|
10
|
+
import { MultiKey, MultiKeySignature } from "../../core/crypto/multiKey";
|
|
11
11
|
import { AccountAuthenticatorVariant } from "../../types";
|
|
12
12
|
|
|
13
13
|
export abstract class AccountAuthenticator extends Serializable {
|
|
@@ -149,9 +149,9 @@ export class AccountAuthenticatorSingleKey extends AccountAuthenticator {
|
|
|
149
149
|
export class AccountAuthenticatorMultiKey extends AccountAuthenticator {
|
|
150
150
|
public readonly public_keys: MultiKey;
|
|
151
151
|
|
|
152
|
-
public readonly signatures:
|
|
152
|
+
public readonly signatures: MultiKeySignature;
|
|
153
153
|
|
|
154
|
-
constructor(public_keys: MultiKey, signatures:
|
|
154
|
+
constructor(public_keys: MultiKey, signatures: MultiKeySignature) {
|
|
155
155
|
super();
|
|
156
156
|
this.public_keys = public_keys;
|
|
157
157
|
this.signatures = signatures;
|
|
@@ -165,7 +165,7 @@ export class AccountAuthenticatorMultiKey extends AccountAuthenticator {
|
|
|
165
165
|
|
|
166
166
|
static load(deserializer: Deserializer): AccountAuthenticatorMultiKey {
|
|
167
167
|
const public_keys = MultiKey.deserialize(deserializer);
|
|
168
|
-
const signatures =
|
|
168
|
+
const signatures = MultiKeySignature.deserialize(deserializer);
|
|
169
169
|
return new AccountAuthenticatorMultiKey(public_keys, signatures);
|
|
170
170
|
}
|
|
171
171
|
}
|