@aptos-labs/ts-sdk 1.35.0 → 1.36.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-CuHovHdK.d.ts → accountAddress-jrha_M3l.d.ts} +1 -1
- package/dist/common/{chunk-RX5UBAME.js → chunk-PA2XFIP3.js} +3 -3
- package/dist/common/chunk-PA2XFIP3.js.map +1 -0
- package/dist/common/cli/index.d.ts +1 -1
- package/dist/common/cli/index.js +1 -1
- package/dist/common/cli/index.js.map +1 -1
- package/dist/common/index.d.ts +99 -31
- package/dist/common/index.js +31 -31
- package/dist/common/index.js.map +1 -1
- package/dist/esm/account/AbstractKeylessAccount.mjs +1 -1
- package/dist/esm/account/AbstractedAccount.mjs +1 -1
- package/dist/esm/account/Account.mjs +1 -1
- package/dist/esm/account/AccountUtils.mjs +1 -1
- package/dist/esm/account/Ed25519Account.mjs +1 -1
- package/dist/esm/account/EphemeralKeyPair.mjs +1 -1
- package/dist/esm/account/FederatedKeylessAccount.mjs +1 -1
- package/dist/esm/account/KeylessAccount.mjs +1 -1
- package/dist/esm/account/MultiEd25519Account.mjs +1 -1
- package/dist/esm/account/MultiKeyAccount.d.mts +1 -0
- package/dist/esm/account/MultiKeyAccount.mjs +1 -1
- package/dist/esm/account/SingleKeyAccount.mjs +1 -1
- package/dist/esm/account/index.mjs +1 -1
- package/dist/esm/account/utils.mjs +1 -1
- package/dist/esm/api/account/abstraction.mjs +1 -1
- package/dist/esm/api/account.mjs +1 -1
- package/dist/esm/api/ans.mjs +1 -1
- package/dist/esm/api/aptos.mjs +1 -1
- package/dist/esm/api/coin.mjs +1 -1
- package/dist/esm/api/digitalAsset.mjs +1 -1
- package/dist/esm/api/event.mjs +1 -1
- package/dist/esm/api/experimental.mjs +1 -1
- package/dist/esm/api/faucet.mjs +1 -1
- package/dist/esm/api/fungibleAsset.mjs +1 -1
- package/dist/esm/api/general.d.mts +2 -2
- package/dist/esm/api/general.mjs +1 -1
- package/dist/esm/api/index.mjs +1 -1
- package/dist/esm/api/keyless.mjs +1 -1
- package/dist/esm/api/object.mjs +1 -1
- package/dist/esm/api/staking.mjs +1 -1
- package/dist/esm/api/table.mjs +1 -1
- package/dist/esm/api/transaction.d.mts +34 -13
- package/dist/esm/api/transaction.mjs +1 -1
- package/dist/esm/api/transactionSubmission/build.mjs +1 -1
- package/dist/esm/api/transactionSubmission/management.mjs +1 -1
- package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
- package/dist/esm/api/transactionSubmission/sign.mjs.map +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-EGCL6KA6.mjs → chunk-2N4EPY2J.mjs} +2 -2
- package/dist/esm/{chunk-YAGIE4GN.mjs → chunk-2OBSQ2FK.mjs} +2 -2
- package/dist/esm/{chunk-752TOOCA.mjs → chunk-2P27DDVV.mjs} +2 -2
- package/dist/esm/{chunk-RDPWCN4B.mjs → chunk-2SAOCLIU.mjs} +2 -2
- package/dist/esm/{chunk-44EHAKKW.mjs → chunk-36H47QOE.mjs} +2 -2
- package/dist/esm/{chunk-AQWKKSRN.mjs → chunk-3DHWWNJ3.mjs} +2 -2
- package/dist/esm/{chunk-DAJFOJ3L.mjs → chunk-4KKJ36IO.mjs} +2 -2
- package/dist/esm/{chunk-UJJGIPOA.mjs → chunk-4PW3JKQZ.mjs} +2 -2
- package/dist/esm/chunk-4QK4SKAT.mjs +2 -0
- package/dist/esm/{chunk-OLGEN23M.mjs.map → chunk-4QK4SKAT.mjs.map} +1 -1
- package/dist/esm/{chunk-B23VO5TB.mjs → chunk-4SWK3JHQ.mjs} +2 -2
- package/dist/esm/{chunk-XW3BXTCZ.mjs → chunk-553ZRNUL.mjs} +2 -2
- package/dist/esm/{chunk-ZS2IVRHT.mjs → chunk-5AD7ZF6G.mjs} +2 -2
- package/dist/esm/{chunk-GTVMJJQQ.mjs → chunk-5MVHOQKD.mjs} +2 -2
- package/dist/esm/{chunk-HKL4MFNL.mjs → chunk-5W5XV63W.mjs} +2 -2
- package/dist/esm/{chunk-P5CM4C2G.mjs → chunk-5WWU3WSU.mjs} +2 -2
- package/dist/esm/{chunk-FOEPRHAC.mjs → chunk-6FQDCTMA.mjs} +2 -2
- package/dist/esm/{chunk-5H5D6QVX.mjs → chunk-6IULVNLQ.mjs} +2 -2
- package/dist/esm/{chunk-2TRQERBL.mjs → chunk-6KI24ZRR.mjs} +2 -2
- package/dist/esm/{chunk-BPHCRTHD.mjs → chunk-6VGLRQBT.mjs} +2 -2
- package/dist/esm/{chunk-HBTJN4RJ.mjs → chunk-6YPM7TK2.mjs} +2 -2
- package/dist/esm/{chunk-XSBUL2WP.mjs → chunk-7HC33TEX.mjs} +2 -2
- package/dist/esm/{chunk-PC25RPDV.mjs → chunk-7KHKP7DY.mjs} +2 -2
- package/dist/esm/{chunk-MFLHAVIW.mjs → chunk-ACE3NEV6.mjs} +2 -2
- package/dist/esm/{chunk-CPFQUFVD.mjs → chunk-APGCD5FH.mjs} +2 -2
- package/dist/esm/{chunk-BHVSIRNF.mjs → chunk-CU6HQJSE.mjs} +2 -2
- package/dist/esm/{chunk-BHVSIRNF.mjs.map → chunk-CU6HQJSE.mjs.map} +1 -1
- package/dist/esm/{chunk-W4SMZ6IW.mjs → chunk-DAR3R4UP.mjs} +2 -2
- package/dist/esm/{chunk-3LDVJ2YK.mjs → chunk-DUJJUR7O.mjs} +2 -2
- package/dist/esm/{chunk-GU4MD5ST.mjs → chunk-EHTTY7EF.mjs} +2 -2
- package/dist/esm/{chunk-K233I26C.mjs → chunk-FCHN3LT7.mjs} +2 -2
- package/dist/esm/chunk-G3MHXDYA.mjs +1 -0
- package/dist/esm/{chunk-YXYYII5S.mjs → chunk-GJOUTA7U.mjs} +2 -2
- package/dist/esm/{chunk-6IJZRG3U.mjs → chunk-HTP5ZVX5.mjs} +2 -2
- package/dist/esm/{chunk-6IJZRG3U.mjs.map → chunk-HTP5ZVX5.mjs.map} +1 -1
- package/dist/esm/{chunk-IOHESHLR.mjs → chunk-HWMMVLTP.mjs} +2 -2
- package/dist/esm/chunk-HWNPKEOJ.mjs +2 -0
- package/dist/esm/chunk-HWNPKEOJ.mjs.map +1 -0
- package/dist/esm/chunk-IM4O756A.mjs +2 -0
- package/dist/esm/chunk-IM4O756A.mjs.map +1 -0
- package/dist/esm/{chunk-VDYUMBOT.mjs → chunk-JA7CXAVY.mjs} +2 -2
- package/dist/esm/{chunk-YLUULY6G.mjs → chunk-JBARRS6K.mjs} +2 -2
- package/dist/esm/{chunk-SJDHW55X.mjs → chunk-JLZGYZBX.mjs} +2 -2
- package/dist/esm/{chunk-QYJKCRVA.mjs → chunk-JXHGJ3AA.mjs} +2 -2
- package/dist/esm/chunk-K4JUKMMY.mjs +2 -0
- package/dist/esm/{chunk-G5F5ZOH5.mjs.map → chunk-K4JUKMMY.mjs.map} +1 -1
- package/dist/esm/{chunk-KK5HUWF6.mjs → chunk-KBC4ECVP.mjs} +2 -2
- package/dist/esm/chunk-LET633ZK.mjs +2 -0
- package/dist/esm/{chunk-5W2ERBGY.mjs.map → chunk-LET633ZK.mjs.map} +1 -1
- package/dist/esm/{chunk-27ESCVVC.mjs → chunk-M2GGYCLU.mjs} +2 -2
- package/dist/esm/{chunk-2YKERRHD.mjs → chunk-MY2BEHYF.mjs} +2 -2
- package/dist/esm/{chunk-MAWGZICD.mjs → chunk-MZVVBJVV.mjs} +2 -2
- package/dist/esm/chunk-N73S2K2V.mjs +2 -0
- package/dist/esm/chunk-NIDF2LHF.mjs +2 -0
- package/dist/esm/chunk-NIDF2LHF.mjs.map +1 -0
- package/dist/esm/{chunk-YWSDONJJ.mjs → chunk-OSZWSLJA.mjs} +2 -2
- package/dist/esm/chunk-P265EC4T.mjs +2 -0
- package/dist/esm/{chunk-E5PAUR4N.mjs.map → chunk-P265EC4T.mjs.map} +1 -1
- package/dist/esm/{chunk-U4DEYWFT.mjs → chunk-PE7KT5ZB.mjs} +2 -2
- package/dist/esm/{chunk-WLDYBSOG.mjs → chunk-PICZWW35.mjs} +2 -2
- package/dist/esm/{chunk-US2HZFOM.mjs → chunk-Q3AVJUBL.mjs} +2 -2
- package/dist/esm/{chunk-GI4AR6DQ.mjs → chunk-QLEZDMIK.mjs} +2 -2
- package/dist/esm/{chunk-7A2KHJ3D.mjs → chunk-QXTQNFEQ.mjs} +2 -2
- package/dist/esm/{chunk-OPD5EKOA.mjs → chunk-R6I6Z3AA.mjs} +2 -2
- package/dist/esm/{chunk-T7X4GZDU.mjs → chunk-SCLWOTHD.mjs} +2 -2
- package/dist/esm/{chunk-HVIF6DW6.mjs → chunk-SZU5Q6CF.mjs} +2 -2
- package/dist/esm/{chunk-ONGH5DXZ.mjs → chunk-T3VLXADE.mjs} +2 -2
- package/dist/esm/{chunk-WHVCUVZP.mjs → chunk-TJICLFR2.mjs} +2 -2
- package/dist/esm/{chunk-PYY2RXFP.mjs → chunk-U6ZD22B5.mjs} +2 -2
- package/dist/esm/{chunk-WFKPVKU3.mjs → chunk-UOBDL2BZ.mjs} +2 -2
- package/dist/esm/chunk-UP36QQGG.mjs +4 -0
- package/dist/esm/{chunk-VWZEJTGP.mjs.map → chunk-UP36QQGG.mjs.map} +1 -1
- package/dist/esm/{chunk-2ZLFQBT2.mjs → chunk-VIXTXBYA.mjs} +2 -2
- package/dist/esm/{chunk-Y65PKZLK.mjs → chunk-WYV4W2IM.mjs} +2 -2
- package/dist/esm/{chunk-TH5JCPN2.mjs → chunk-X5ORWYVO.mjs} +2 -2
- package/dist/esm/{chunk-2SAYQUUX.mjs → chunk-X5UJYMJU.mjs} +2 -2
- package/dist/esm/chunk-X5YB74NB.mjs +2 -0
- package/dist/esm/{chunk-BY3XFRUM.mjs.map → chunk-X5YB74NB.mjs.map} +1 -1
- package/dist/esm/{chunk-QUJM5W4L.mjs → chunk-X6H4G6NE.mjs} +2 -2
- package/dist/esm/{chunk-BQYKFATL.mjs → chunk-XFL3B4WZ.mjs} +2 -2
- package/dist/esm/{chunk-67A5U2X6.mjs → chunk-XX4SFNZY.mjs} +2 -2
- package/dist/esm/{chunk-CPAAEEF4.mjs → chunk-YMXJ6GYE.mjs} +2 -2
- package/dist/esm/chunk-ZJCTELB4.mjs +2 -0
- package/dist/esm/chunk-ZJCTELB4.mjs.map +1 -0
- package/dist/esm/{chunk-GRRBXHVG.mjs → chunk-ZOY6N6UM.mjs} +2 -2
- package/dist/esm/{chunk-TWETGZ3W.mjs → chunk-ZVYTHOS5.mjs} +2 -2
- package/dist/esm/cli/index.mjs +1 -1
- package/dist/esm/cli/localNode.mjs +1 -1
- 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/federatedKeyless.mjs +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.mjs +1 -1
- package/dist/esm/core/crypto/singleKey.d.mts +2 -2
- package/dist/esm/core/crypto/singleKey.mjs +1 -1
- package/dist/esm/core/index.mjs +1 -1
- package/dist/esm/errors/index.mjs +1 -1
- package/dist/esm/index.d.mts +2 -2
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/internal/abstraction.mjs +1 -1
- package/dist/esm/internal/account.d.mts +43 -3
- package/dist/esm/internal/account.mjs +1 -1
- package/dist/esm/internal/ans.mjs +1 -1
- package/dist/esm/internal/coin.mjs +1 -1
- package/dist/esm/internal/digitalAsset.mjs +1 -1
- package/dist/esm/internal/event.mjs +1 -1
- package/dist/esm/internal/experimental.mjs +1 -1
- package/dist/esm/internal/faucet.mjs +1 -1
- package/dist/esm/internal/fungibleAsset.mjs +1 -1
- package/dist/esm/internal/general.mjs +1 -1
- package/dist/esm/internal/keyless.mjs +1 -1
- package/dist/esm/internal/object.mjs +1 -1
- package/dist/esm/internal/staking.mjs +1 -1
- package/dist/esm/internal/table.mjs +1 -1
- package/dist/esm/internal/transaction.mjs +1 -1
- package/dist/esm/internal/transactionSubmission.d.mts +3 -22
- package/dist/esm/internal/transactionSubmission.mjs +1 -1
- package/dist/esm/internal/utils/index.d.mts +15 -0
- package/dist/esm/internal/utils/index.mjs +2 -0
- package/dist/esm/internal/utils/utils.d.mts +65 -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.mjs +1 -1
- 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.mjs +1 -1
- package/dist/esm/transactions/management/index.mjs +1 -1
- package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
- package/dist/esm/transactions/scriptComposer/index.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.d.mts +29 -18
- package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
- package/dist/esm/transactions/typeTag/index.d.mts +16 -0
- package/dist/esm/transactions/typeTag/index.mjs +1 -1
- package/dist/esm/transactions/typeTag/parser.mjs +1 -1
- package/dist/esm/utils/helpers.d.mts +20 -1
- package/dist/esm/utils/helpers.mjs +1 -1
- package/dist/esm/utils/index.d.mts +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 +26 -25
- package/src/account/MultiKeyAccount.ts +3 -2
- package/src/api/general.ts +2 -2
- package/src/api/transaction.ts +30 -9
- package/src/internal/account.ts +201 -59
- package/src/internal/transactionSubmission.ts +4 -81
- package/src/internal/utils/index.ts +4 -0
- package/src/internal/utils/utils.ts +116 -0
- package/src/transactions/scriptComposer/index.ts +22 -7
- package/src/transactions/transactionBuilder/remoteAbi.ts +106 -34
- package/src/transactions/transactionBuilder/transactionBuilder.ts +7 -2
- package/src/transactions/typeTag/index.ts +22 -0
- package/src/utils/helpers.ts +22 -0
- package/src/version.ts +1 -1
- package/dist/common/chunk-RX5UBAME.js.map +0 -1
- package/dist/esm/chunk-53IBOHXB.mjs +0 -2
- package/dist/esm/chunk-53IBOHXB.mjs.map +0 -1
- package/dist/esm/chunk-5W2ERBGY.mjs +0 -2
- package/dist/esm/chunk-BY3XFRUM.mjs +0 -2
- package/dist/esm/chunk-CXLNTATW.mjs +0 -2
- package/dist/esm/chunk-E5PAUR4N.mjs +0 -2
- package/dist/esm/chunk-FJ5J7CVW.mjs +0 -2
- package/dist/esm/chunk-FJ5J7CVW.mjs.map +0 -1
- package/dist/esm/chunk-G5F5ZOH5.mjs +0 -2
- package/dist/esm/chunk-HYJQHVDZ.mjs +0 -2
- package/dist/esm/chunk-HYJQHVDZ.mjs.map +0 -1
- package/dist/esm/chunk-JXCZTOYC.mjs +0 -1
- package/dist/esm/chunk-L6KVC7CJ.mjs +0 -2
- package/dist/esm/chunk-L6KVC7CJ.mjs.map +0 -1
- package/dist/esm/chunk-OLGEN23M.mjs +0 -2
- package/dist/esm/chunk-PIPDQFL2.mjs +0 -2
- package/dist/esm/chunk-PIPDQFL2.mjs.map +0 -1
- package/dist/esm/chunk-UIRAXHDH.mjs +0 -1
- package/dist/esm/chunk-VWZEJTGP.mjs +0 -4
- package/dist/esm/chunk-W2C5KRUQ.mjs +0 -2
- package/dist/esm/chunk-W2C5KRUQ.mjs.map +0 -1
- package/dist/esm/chunk-XRVZAEQO.mjs +0 -2
- package/dist/esm/chunk-XRVZAEQO.mjs.map +0 -1
- /package/dist/esm/{chunk-EGCL6KA6.mjs.map → chunk-2N4EPY2J.mjs.map} +0 -0
- /package/dist/esm/{chunk-YAGIE4GN.mjs.map → chunk-2OBSQ2FK.mjs.map} +0 -0
- /package/dist/esm/{chunk-752TOOCA.mjs.map → chunk-2P27DDVV.mjs.map} +0 -0
- /package/dist/esm/{chunk-RDPWCN4B.mjs.map → chunk-2SAOCLIU.mjs.map} +0 -0
- /package/dist/esm/{chunk-44EHAKKW.mjs.map → chunk-36H47QOE.mjs.map} +0 -0
- /package/dist/esm/{chunk-AQWKKSRN.mjs.map → chunk-3DHWWNJ3.mjs.map} +0 -0
- /package/dist/esm/{chunk-DAJFOJ3L.mjs.map → chunk-4KKJ36IO.mjs.map} +0 -0
- /package/dist/esm/{chunk-UJJGIPOA.mjs.map → chunk-4PW3JKQZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-B23VO5TB.mjs.map → chunk-4SWK3JHQ.mjs.map} +0 -0
- /package/dist/esm/{chunk-XW3BXTCZ.mjs.map → chunk-553ZRNUL.mjs.map} +0 -0
- /package/dist/esm/{chunk-ZS2IVRHT.mjs.map → chunk-5AD7ZF6G.mjs.map} +0 -0
- /package/dist/esm/{chunk-GTVMJJQQ.mjs.map → chunk-5MVHOQKD.mjs.map} +0 -0
- /package/dist/esm/{chunk-HKL4MFNL.mjs.map → chunk-5W5XV63W.mjs.map} +0 -0
- /package/dist/esm/{chunk-P5CM4C2G.mjs.map → chunk-5WWU3WSU.mjs.map} +0 -0
- /package/dist/esm/{chunk-FOEPRHAC.mjs.map → chunk-6FQDCTMA.mjs.map} +0 -0
- /package/dist/esm/{chunk-5H5D6QVX.mjs.map → chunk-6IULVNLQ.mjs.map} +0 -0
- /package/dist/esm/{chunk-2TRQERBL.mjs.map → chunk-6KI24ZRR.mjs.map} +0 -0
- /package/dist/esm/{chunk-BPHCRTHD.mjs.map → chunk-6VGLRQBT.mjs.map} +0 -0
- /package/dist/esm/{chunk-HBTJN4RJ.mjs.map → chunk-6YPM7TK2.mjs.map} +0 -0
- /package/dist/esm/{chunk-XSBUL2WP.mjs.map → chunk-7HC33TEX.mjs.map} +0 -0
- /package/dist/esm/{chunk-PC25RPDV.mjs.map → chunk-7KHKP7DY.mjs.map} +0 -0
- /package/dist/esm/{chunk-MFLHAVIW.mjs.map → chunk-ACE3NEV6.mjs.map} +0 -0
- /package/dist/esm/{chunk-CPFQUFVD.mjs.map → chunk-APGCD5FH.mjs.map} +0 -0
- /package/dist/esm/{chunk-W4SMZ6IW.mjs.map → chunk-DAR3R4UP.mjs.map} +0 -0
- /package/dist/esm/{chunk-3LDVJ2YK.mjs.map → chunk-DUJJUR7O.mjs.map} +0 -0
- /package/dist/esm/{chunk-GU4MD5ST.mjs.map → chunk-EHTTY7EF.mjs.map} +0 -0
- /package/dist/esm/{chunk-K233I26C.mjs.map → chunk-FCHN3LT7.mjs.map} +0 -0
- /package/dist/esm/{chunk-JXCZTOYC.mjs.map → chunk-G3MHXDYA.mjs.map} +0 -0
- /package/dist/esm/{chunk-YXYYII5S.mjs.map → chunk-GJOUTA7U.mjs.map} +0 -0
- /package/dist/esm/{chunk-IOHESHLR.mjs.map → chunk-HWMMVLTP.mjs.map} +0 -0
- /package/dist/esm/{chunk-VDYUMBOT.mjs.map → chunk-JA7CXAVY.mjs.map} +0 -0
- /package/dist/esm/{chunk-YLUULY6G.mjs.map → chunk-JBARRS6K.mjs.map} +0 -0
- /package/dist/esm/{chunk-SJDHW55X.mjs.map → chunk-JLZGYZBX.mjs.map} +0 -0
- /package/dist/esm/{chunk-QYJKCRVA.mjs.map → chunk-JXHGJ3AA.mjs.map} +0 -0
- /package/dist/esm/{chunk-KK5HUWF6.mjs.map → chunk-KBC4ECVP.mjs.map} +0 -0
- /package/dist/esm/{chunk-27ESCVVC.mjs.map → chunk-M2GGYCLU.mjs.map} +0 -0
- /package/dist/esm/{chunk-2YKERRHD.mjs.map → chunk-MY2BEHYF.mjs.map} +0 -0
- /package/dist/esm/{chunk-MAWGZICD.mjs.map → chunk-MZVVBJVV.mjs.map} +0 -0
- /package/dist/esm/{chunk-CXLNTATW.mjs.map → chunk-N73S2K2V.mjs.map} +0 -0
- /package/dist/esm/{chunk-YWSDONJJ.mjs.map → chunk-OSZWSLJA.mjs.map} +0 -0
- /package/dist/esm/{chunk-U4DEYWFT.mjs.map → chunk-PE7KT5ZB.mjs.map} +0 -0
- /package/dist/esm/{chunk-WLDYBSOG.mjs.map → chunk-PICZWW35.mjs.map} +0 -0
- /package/dist/esm/{chunk-US2HZFOM.mjs.map → chunk-Q3AVJUBL.mjs.map} +0 -0
- /package/dist/esm/{chunk-GI4AR6DQ.mjs.map → chunk-QLEZDMIK.mjs.map} +0 -0
- /package/dist/esm/{chunk-7A2KHJ3D.mjs.map → chunk-QXTQNFEQ.mjs.map} +0 -0
- /package/dist/esm/{chunk-OPD5EKOA.mjs.map → chunk-R6I6Z3AA.mjs.map} +0 -0
- /package/dist/esm/{chunk-T7X4GZDU.mjs.map → chunk-SCLWOTHD.mjs.map} +0 -0
- /package/dist/esm/{chunk-HVIF6DW6.mjs.map → chunk-SZU5Q6CF.mjs.map} +0 -0
- /package/dist/esm/{chunk-ONGH5DXZ.mjs.map → chunk-T3VLXADE.mjs.map} +0 -0
- /package/dist/esm/{chunk-WHVCUVZP.mjs.map → chunk-TJICLFR2.mjs.map} +0 -0
- /package/dist/esm/{chunk-PYY2RXFP.mjs.map → chunk-U6ZD22B5.mjs.map} +0 -0
- /package/dist/esm/{chunk-WFKPVKU3.mjs.map → chunk-UOBDL2BZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-2ZLFQBT2.mjs.map → chunk-VIXTXBYA.mjs.map} +0 -0
- /package/dist/esm/{chunk-Y65PKZLK.mjs.map → chunk-WYV4W2IM.mjs.map} +0 -0
- /package/dist/esm/{chunk-TH5JCPN2.mjs.map → chunk-X5ORWYVO.mjs.map} +0 -0
- /package/dist/esm/{chunk-2SAYQUUX.mjs.map → chunk-X5UJYMJU.mjs.map} +0 -0
- /package/dist/esm/{chunk-QUJM5W4L.mjs.map → chunk-X6H4G6NE.mjs.map} +0 -0
- /package/dist/esm/{chunk-BQYKFATL.mjs.map → chunk-XFL3B4WZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-67A5U2X6.mjs.map → chunk-XX4SFNZY.mjs.map} +0 -0
- /package/dist/esm/{chunk-CPAAEEF4.mjs.map → chunk-YMXJ6GYE.mjs.map} +0 -0
- /package/dist/esm/{chunk-GRRBXHVG.mjs.map → chunk-ZOY6N6UM.mjs.map} +0 -0
- /package/dist/esm/{chunk-TWETGZ3W.mjs.map → chunk-ZVYTHOS5.mjs.map} +0 -0
- /package/dist/esm/{chunk-UIRAXHDH.mjs.map → internal/utils/index.mjs.map} +0 -0
package/src/internal/account.ts
CHANGED
|
@@ -23,14 +23,16 @@ import {
|
|
|
23
23
|
MoveStructId,
|
|
24
24
|
OrderByArg,
|
|
25
25
|
PaginationArgs,
|
|
26
|
+
PendingTransactionResponse,
|
|
26
27
|
TokenStandardArg,
|
|
27
28
|
TransactionResponse,
|
|
28
29
|
WhereArg,
|
|
29
30
|
} from "../types";
|
|
30
31
|
import { AccountAddress, AccountAddressInput } from "../core/accountAddress";
|
|
31
|
-
import { Account } from "../account";
|
|
32
|
+
import { Account, Ed25519Account, MultiEd25519Account } from "../account";
|
|
32
33
|
import { AnyPublicKey, Ed25519PublicKey, PrivateKey } from "../core/crypto";
|
|
33
34
|
import { queryIndexer } from "./general";
|
|
35
|
+
import { getModules as getModulesUtil, getModule as getModuleUtil, getInfo as getInfoUtil } from "./utils";
|
|
34
36
|
import {
|
|
35
37
|
GetAccountCoinsCountQuery,
|
|
36
38
|
GetAccountCoinsDataQuery,
|
|
@@ -51,12 +53,15 @@ import {
|
|
|
51
53
|
GetAccountTokensCount,
|
|
52
54
|
GetAccountTransactionsCount,
|
|
53
55
|
} from "../types/generated/queries";
|
|
54
|
-
import { memoizeAsync } from "../utils/memoize";
|
|
55
56
|
import { Secp256k1PrivateKey, AuthenticationKey, Ed25519PrivateKey, createObjectAddress } from "../core";
|
|
56
57
|
import { CurrentFungibleAssetBalancesBoolExp } from "../types/generated/types";
|
|
57
58
|
import { getTableItem } from "./table";
|
|
58
59
|
import { APTOS_COIN } from "../utils";
|
|
59
60
|
import { AptosApiError } from "../errors";
|
|
61
|
+
import { signAndSubmitTransaction, generateTransaction } from "./transactionSubmission";
|
|
62
|
+
import { EntryFunctionABI, RotationProofChallenge, TypeTagU8, TypeTagVector } from "../transactions";
|
|
63
|
+
import { U8, MoveVector } from "../bcs";
|
|
64
|
+
import { waitForTransaction } from "./transaction";
|
|
60
65
|
|
|
61
66
|
/**
|
|
62
67
|
* Retrieves account information for a specified account address.
|
|
@@ -70,13 +75,7 @@ export async function getInfo(args: {
|
|
|
70
75
|
aptosConfig: AptosConfig;
|
|
71
76
|
accountAddress: AccountAddressInput;
|
|
72
77
|
}): Promise<AccountData> {
|
|
73
|
-
|
|
74
|
-
const { data } = await getAptosFullNode<{}, AccountData>({
|
|
75
|
-
aptosConfig,
|
|
76
|
-
originMethod: "getInfo",
|
|
77
|
-
path: `accounts/${AccountAddress.from(accountAddress).toString()}`,
|
|
78
|
-
});
|
|
79
|
-
return data;
|
|
78
|
+
return getInfoUtil(args);
|
|
80
79
|
}
|
|
81
80
|
|
|
82
81
|
/**
|
|
@@ -96,17 +95,7 @@ export async function getModules(args: {
|
|
|
96
95
|
accountAddress: AccountAddressInput;
|
|
97
96
|
options?: PaginationArgs & LedgerVersionArg;
|
|
98
97
|
}): Promise<MoveModuleBytecode[]> {
|
|
99
|
-
|
|
100
|
-
return paginateWithObfuscatedCursor<{}, MoveModuleBytecode[]>({
|
|
101
|
-
aptosConfig,
|
|
102
|
-
originMethod: "getModules",
|
|
103
|
-
path: `accounts/${AccountAddress.from(accountAddress).toString()}/modules`,
|
|
104
|
-
params: {
|
|
105
|
-
ledger_version: options?.ledgerVersion,
|
|
106
|
-
offset: options?.offset,
|
|
107
|
-
limit: options?.limit ?? 1000,
|
|
108
|
-
},
|
|
109
|
-
});
|
|
98
|
+
return getModulesUtil(args);
|
|
110
99
|
}
|
|
111
100
|
|
|
112
101
|
/**
|
|
@@ -128,45 +117,7 @@ export async function getModule(args: {
|
|
|
128
117
|
moduleName: string;
|
|
129
118
|
options?: LedgerVersionArg;
|
|
130
119
|
}): Promise<MoveModuleBytecode> {
|
|
131
|
-
|
|
132
|
-
// by the developer directly
|
|
133
|
-
if (args.options?.ledgerVersion !== undefined) {
|
|
134
|
-
return getModuleInner(args);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
return memoizeAsync(
|
|
138
|
-
async () => getModuleInner(args),
|
|
139
|
-
`module-${args.accountAddress}-${args.moduleName}`,
|
|
140
|
-
1000 * 60 * 5, // 5 minutes
|
|
141
|
-
)();
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* Retrieves the bytecode of a specified module from a given account address.
|
|
146
|
-
*
|
|
147
|
-
* @param args - The parameters for retrieving the module bytecode.
|
|
148
|
-
* @param args.aptosConfig - The configuration for connecting to the Aptos network.
|
|
149
|
-
* @param args.accountAddress - The address of the account from which to retrieve the module.
|
|
150
|
-
* @param args.moduleName - The name of the module to retrieve.
|
|
151
|
-
* @param args.options - Optional parameters for specifying the ledger version.
|
|
152
|
-
* @param args.options.ledgerVersion - The specific ledger version to query.
|
|
153
|
-
* @group Implementation
|
|
154
|
-
*/
|
|
155
|
-
async function getModuleInner(args: {
|
|
156
|
-
aptosConfig: AptosConfig;
|
|
157
|
-
accountAddress: AccountAddressInput;
|
|
158
|
-
moduleName: string;
|
|
159
|
-
options?: LedgerVersionArg;
|
|
160
|
-
}): Promise<MoveModuleBytecode> {
|
|
161
|
-
const { aptosConfig, accountAddress, moduleName, options } = args;
|
|
162
|
-
|
|
163
|
-
const { data } = await getAptosFullNode<{}, MoveModuleBytecode>({
|
|
164
|
-
aptosConfig,
|
|
165
|
-
originMethod: "getModule",
|
|
166
|
-
path: `accounts/${AccountAddress.from(accountAddress).toString()}/module/${moduleName}`,
|
|
167
|
-
params: { ledger_version: options?.ledgerVersion },
|
|
168
|
-
});
|
|
169
|
-
return data;
|
|
120
|
+
return getModuleUtil(args);
|
|
170
121
|
}
|
|
171
122
|
|
|
172
123
|
/**
|
|
@@ -815,3 +766,194 @@ export async function isAccountExist(args: { aptosConfig: AptosConfig; authKey:
|
|
|
815
766
|
throw new Error(`Error while looking for an account info ${accountAddress.toString()}`);
|
|
816
767
|
}
|
|
817
768
|
}
|
|
769
|
+
|
|
770
|
+
const rotateAuthKeyAbi: EntryFunctionABI = {
|
|
771
|
+
typeParameters: [],
|
|
772
|
+
parameters: [
|
|
773
|
+
new TypeTagU8(),
|
|
774
|
+
TypeTagVector.u8(),
|
|
775
|
+
new TypeTagU8(),
|
|
776
|
+
TypeTagVector.u8(),
|
|
777
|
+
TypeTagVector.u8(),
|
|
778
|
+
TypeTagVector.u8(),
|
|
779
|
+
],
|
|
780
|
+
};
|
|
781
|
+
|
|
782
|
+
/**
|
|
783
|
+
* Rotates the authentication key for a given account.
|
|
784
|
+
*
|
|
785
|
+
* @param args - The arguments for rotating the authentication key.
|
|
786
|
+
* @param args.aptosConfig - The configuration settings for the Aptos network.
|
|
787
|
+
* @param args.fromAccount - The account from which the authentication key will be rotated.
|
|
788
|
+
* @param args.toAccount - (Optional) The target account to rotate to. Required if not using toNewPrivateKey or toAuthKey.
|
|
789
|
+
* @param args.toNewPrivateKey - (Optional) The new private key to rotate to. Required if not using toAccount or toAuthKey.
|
|
790
|
+
* @param args.toAuthKey - (Optional) The new authentication key to rotate to. Can only be used with dangerouslySkipVerification=true.
|
|
791
|
+
* @param args.dangerouslySkipVerification - (Optional) If true, skips verification steps after rotation. Required when using toAuthKey.
|
|
792
|
+
*
|
|
793
|
+
* @remarks
|
|
794
|
+
* This function supports three modes of rotation:
|
|
795
|
+
* 1. Using a target Account object (toAccount)
|
|
796
|
+
* 2. Using a new private key (toNewPrivateKey)
|
|
797
|
+
* 3. Using a raw authentication key (toAuthKey) - requires dangerouslySkipVerification=true
|
|
798
|
+
*
|
|
799
|
+
* When not using dangerouslySkipVerification, the function performs additional safety checks and account setup.
|
|
800
|
+
*
|
|
801
|
+
* If the new key is a multi key, skipping verification is dangerous because verification will publish the public key onchain and
|
|
802
|
+
* prevent users from being locked out of the account from loss of knowledge of one of the public keys.
|
|
803
|
+
*
|
|
804
|
+
* @returns A promise that resolves to the pending transaction response.
|
|
805
|
+
* @throws Error if the rotation fails or verification fails.
|
|
806
|
+
*
|
|
807
|
+
* @group Implementation
|
|
808
|
+
*/
|
|
809
|
+
export async function rotateAuthKey(
|
|
810
|
+
args: {
|
|
811
|
+
aptosConfig: AptosConfig;
|
|
812
|
+
fromAccount: Account;
|
|
813
|
+
} & (
|
|
814
|
+
| { toAccount: Account; dangerouslySkipVerification?: never }
|
|
815
|
+
| { toNewPrivateKey: Ed25519PrivateKey; dangerouslySkipVerification?: never }
|
|
816
|
+
| { toAuthKey: AuthenticationKey; dangerouslySkipVerification: true }
|
|
817
|
+
),
|
|
818
|
+
): Promise<PendingTransactionResponse> {
|
|
819
|
+
const { aptosConfig, fromAccount, dangerouslySkipVerification } = args;
|
|
820
|
+
if ("toNewPrivateKey" in args) {
|
|
821
|
+
return rotateAuthKeyWithChallenge({
|
|
822
|
+
aptosConfig,
|
|
823
|
+
fromAccount,
|
|
824
|
+
toNewPrivateKey: args.toNewPrivateKey,
|
|
825
|
+
});
|
|
826
|
+
}
|
|
827
|
+
let authKey: AuthenticationKey;
|
|
828
|
+
if ("toAccount" in args) {
|
|
829
|
+
if (args.toAccount instanceof Ed25519Account) {
|
|
830
|
+
return rotateAuthKeyWithChallenge({ aptosConfig, fromAccount, toNewPrivateKey: args.toAccount.privateKey });
|
|
831
|
+
}
|
|
832
|
+
if (args.toAccount instanceof MultiEd25519Account) {
|
|
833
|
+
return rotateAuthKeyWithChallenge({ aptosConfig, fromAccount, toAccount: args.toAccount });
|
|
834
|
+
}
|
|
835
|
+
authKey = args.toAccount.publicKey.authKey();
|
|
836
|
+
} else if ("toAuthKey" in args) {
|
|
837
|
+
authKey = args.toAuthKey;
|
|
838
|
+
} else {
|
|
839
|
+
throw new Error("Invalid arguments");
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
const pendingTxn = await rotateAuthKeyUnverified({
|
|
843
|
+
aptosConfig,
|
|
844
|
+
fromAccount,
|
|
845
|
+
toAuthKey: authKey,
|
|
846
|
+
});
|
|
847
|
+
|
|
848
|
+
if (dangerouslySkipVerification === true) {
|
|
849
|
+
return pendingTxn;
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
const rotateAuthKeyTxnResponse = await waitForTransaction({
|
|
853
|
+
aptosConfig,
|
|
854
|
+
transactionHash: pendingTxn.hash,
|
|
855
|
+
});
|
|
856
|
+
if (!rotateAuthKeyTxnResponse.success) {
|
|
857
|
+
throw new Error(`Failed to rotate authentication key - ${rotateAuthKeyTxnResponse}`);
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
// Verify the rotation by setting the originating address to the new account.
|
|
861
|
+
// This verifies the rotation even if the transaction payload fails to execute successfully.
|
|
862
|
+
const verificationTxn = await generateTransaction({
|
|
863
|
+
aptosConfig,
|
|
864
|
+
sender: fromAccount.accountAddress,
|
|
865
|
+
data: {
|
|
866
|
+
function: "0x1::account::set_originating_address",
|
|
867
|
+
functionArguments: [],
|
|
868
|
+
},
|
|
869
|
+
});
|
|
870
|
+
|
|
871
|
+
return signAndSubmitTransaction({
|
|
872
|
+
aptosConfig,
|
|
873
|
+
signer: args.toAccount, // Use the new account to sign
|
|
874
|
+
transaction: verificationTxn,
|
|
875
|
+
});
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
async function rotateAuthKeyWithChallenge(
|
|
879
|
+
args: {
|
|
880
|
+
aptosConfig: AptosConfig;
|
|
881
|
+
fromAccount: Account;
|
|
882
|
+
} & ({ toNewPrivateKey: Ed25519PrivateKey } | { toAccount: MultiEd25519Account }),
|
|
883
|
+
): Promise<PendingTransactionResponse> {
|
|
884
|
+
const { aptosConfig, fromAccount } = args;
|
|
885
|
+
const accountInfo = await getInfo({
|
|
886
|
+
aptosConfig,
|
|
887
|
+
accountAddress: fromAccount.accountAddress,
|
|
888
|
+
});
|
|
889
|
+
|
|
890
|
+
let newAccount: Account;
|
|
891
|
+
if ("toNewPrivateKey" in args) {
|
|
892
|
+
newAccount = Account.fromPrivateKey({ privateKey: args.toNewPrivateKey, legacy: true });
|
|
893
|
+
} else {
|
|
894
|
+
newAccount = args.toAccount;
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
const challenge = new RotationProofChallenge({
|
|
898
|
+
sequenceNumber: BigInt(accountInfo.sequence_number),
|
|
899
|
+
originator: fromAccount.accountAddress,
|
|
900
|
+
currentAuthKey: AccountAddress.from(accountInfo.authentication_key),
|
|
901
|
+
newPublicKey: newAccount.publicKey,
|
|
902
|
+
});
|
|
903
|
+
|
|
904
|
+
// Sign the challenge
|
|
905
|
+
const challengeHex = challenge.bcsToBytes();
|
|
906
|
+
const proofSignedByCurrentKey = fromAccount.sign(challengeHex);
|
|
907
|
+
const proofSignedByNewKey = newAccount.sign(challengeHex);
|
|
908
|
+
|
|
909
|
+
// Generate transaction
|
|
910
|
+
const rawTxn = await generateTransaction({
|
|
911
|
+
aptosConfig,
|
|
912
|
+
sender: fromAccount.accountAddress,
|
|
913
|
+
data: {
|
|
914
|
+
function: "0x1::account::rotate_authentication_key",
|
|
915
|
+
functionArguments: [
|
|
916
|
+
new U8(fromAccount.signingScheme), // from scheme
|
|
917
|
+
MoveVector.U8(fromAccount.publicKey.toUint8Array()),
|
|
918
|
+
new U8(newAccount.signingScheme), // to scheme
|
|
919
|
+
MoveVector.U8(newAccount.publicKey.toUint8Array()),
|
|
920
|
+
MoveVector.U8(proofSignedByCurrentKey.toUint8Array()),
|
|
921
|
+
MoveVector.U8(proofSignedByNewKey.toUint8Array()),
|
|
922
|
+
],
|
|
923
|
+
abi: rotateAuthKeyAbi,
|
|
924
|
+
},
|
|
925
|
+
});
|
|
926
|
+
return signAndSubmitTransaction({
|
|
927
|
+
aptosConfig,
|
|
928
|
+
signer: fromAccount,
|
|
929
|
+
transaction: rawTxn,
|
|
930
|
+
});
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
const rotateAuthKeyUnverifiedAbi: EntryFunctionABI = {
|
|
934
|
+
typeParameters: [],
|
|
935
|
+
parameters: [TypeTagVector.u8()],
|
|
936
|
+
};
|
|
937
|
+
|
|
938
|
+
async function rotateAuthKeyUnverified(args: {
|
|
939
|
+
aptosConfig: AptosConfig;
|
|
940
|
+
fromAccount: Account;
|
|
941
|
+
toAuthKey: AuthenticationKey;
|
|
942
|
+
}): Promise<PendingTransactionResponse> {
|
|
943
|
+
const { aptosConfig, fromAccount, toAuthKey } = args;
|
|
944
|
+
const authKey = toAuthKey;
|
|
945
|
+
const rawTxn = await generateTransaction({
|
|
946
|
+
aptosConfig,
|
|
947
|
+
sender: fromAccount.accountAddress,
|
|
948
|
+
data: {
|
|
949
|
+
function: "0x1::account::rotate_authentication_key_call",
|
|
950
|
+
functionArguments: [MoveVector.U8(authKey.toUint8Array())],
|
|
951
|
+
abi: rotateAuthKeyUnverifiedAbi,
|
|
952
|
+
},
|
|
953
|
+
});
|
|
954
|
+
return signAndSubmitTransaction({
|
|
955
|
+
aptosConfig,
|
|
956
|
+
signer: fromAccount,
|
|
957
|
+
transaction: rawTxn,
|
|
958
|
+
});
|
|
959
|
+
}
|
|
@@ -7,13 +7,12 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { AptosConfig } from "../api/aptosConfig";
|
|
10
|
-
import { Deserializer, MoveVector
|
|
10
|
+
import { Deserializer, MoveVector } from "../bcs";
|
|
11
11
|
import { postAptosFullNode } from "../client";
|
|
12
12
|
import { Account, AbstractKeylessAccount, isKeylessSigner } from "../account";
|
|
13
13
|
import { AccountAddress, AccountAddressInput } from "../core/accountAddress";
|
|
14
|
-
import { FederatedKeylessPublicKey, KeylessPublicKey, KeylessSignature
|
|
14
|
+
import { FederatedKeylessPublicKey, KeylessPublicKey, KeylessSignature } from "../core/crypto";
|
|
15
15
|
import { AccountAuthenticator } from "../transactions/authenticator/account";
|
|
16
|
-
import { RotationProofChallenge } from "../transactions/instances/rotationProofChallenge";
|
|
17
16
|
import {
|
|
18
17
|
buildTransaction,
|
|
19
18
|
generateTransactionPayload,
|
|
@@ -32,9 +31,8 @@ import {
|
|
|
32
31
|
AnyTransactionPayloadInstance,
|
|
33
32
|
EntryFunctionABI,
|
|
34
33
|
} from "../transactions/types";
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import { SignedTransaction, TypeTagU8, TypeTagVector, generateSigningMessageForTransaction } from "../transactions";
|
|
34
|
+
import { UserTransactionResponse, PendingTransactionResponse, MimeType, HexInput } from "../types";
|
|
35
|
+
import { SignedTransaction, TypeTagVector, generateSigningMessageForTransaction } from "../transactions";
|
|
38
36
|
import { SimpleTransaction } from "../transactions/instances/simpleTransaction";
|
|
39
37
|
import { MultiAgentTransaction } from "../transactions/instances/multiAgentTransaction";
|
|
40
38
|
|
|
@@ -444,78 +442,3 @@ export async function publicPackageTransaction(args: {
|
|
|
444
442
|
options,
|
|
445
443
|
});
|
|
446
444
|
}
|
|
447
|
-
|
|
448
|
-
const rotateAuthKeyAbi: EntryFunctionABI = {
|
|
449
|
-
typeParameters: [],
|
|
450
|
-
parameters: [
|
|
451
|
-
new TypeTagU8(),
|
|
452
|
-
TypeTagVector.u8(),
|
|
453
|
-
new TypeTagU8(),
|
|
454
|
-
TypeTagVector.u8(),
|
|
455
|
-
TypeTagVector.u8(),
|
|
456
|
-
TypeTagVector.u8(),
|
|
457
|
-
],
|
|
458
|
-
};
|
|
459
|
-
|
|
460
|
-
/**
|
|
461
|
-
* Rotates the authentication key for a given account, allowing for enhanced security and management of account access.
|
|
462
|
-
*
|
|
463
|
-
* @param args - The arguments for rotating the authentication key.
|
|
464
|
-
* @param args.aptosConfig - The configuration settings for the Aptos network.
|
|
465
|
-
* @param args.fromAccount - The account from which the authentication key will be rotated.
|
|
466
|
-
* @param args.toNewPrivateKey - The new private key that will be associated with the account.
|
|
467
|
-
*
|
|
468
|
-
* @remarks
|
|
469
|
-
* This function requires the current authentication key and the new private key to sign a challenge that validates the rotation.
|
|
470
|
-
*
|
|
471
|
-
* TODO: Need to refactor and move this function out of transactionSubmission.
|
|
472
|
-
* @group Implementation
|
|
473
|
-
*/
|
|
474
|
-
export async function rotateAuthKey(args: {
|
|
475
|
-
aptosConfig: AptosConfig;
|
|
476
|
-
fromAccount: Account;
|
|
477
|
-
toNewPrivateKey: PrivateKeyInput;
|
|
478
|
-
}): Promise<TransactionResponse> {
|
|
479
|
-
const { aptosConfig, fromAccount, toNewPrivateKey } = args;
|
|
480
|
-
const accountInfo = await getInfo({
|
|
481
|
-
aptosConfig,
|
|
482
|
-
accountAddress: fromAccount.accountAddress,
|
|
483
|
-
});
|
|
484
|
-
|
|
485
|
-
const newAccount = Account.fromPrivateKey({ privateKey: toNewPrivateKey, legacy: true });
|
|
486
|
-
|
|
487
|
-
const challenge = new RotationProofChallenge({
|
|
488
|
-
sequenceNumber: BigInt(accountInfo.sequence_number),
|
|
489
|
-
originator: fromAccount.accountAddress,
|
|
490
|
-
currentAuthKey: AccountAddress.from(accountInfo.authentication_key),
|
|
491
|
-
newPublicKey: newAccount.publicKey,
|
|
492
|
-
});
|
|
493
|
-
|
|
494
|
-
// Sign the challenge
|
|
495
|
-
const challengeHex = challenge.bcsToBytes();
|
|
496
|
-
const proofSignedByCurrentPrivateKey = fromAccount.sign(challengeHex);
|
|
497
|
-
const proofSignedByNewPrivateKey = newAccount.sign(challengeHex);
|
|
498
|
-
|
|
499
|
-
// Generate transaction
|
|
500
|
-
const rawTxn = await generateTransaction({
|
|
501
|
-
aptosConfig,
|
|
502
|
-
sender: fromAccount.accountAddress,
|
|
503
|
-
data: {
|
|
504
|
-
function: "0x1::account::rotate_authentication_key",
|
|
505
|
-
functionArguments: [
|
|
506
|
-
new U8(fromAccount.signingScheme), // from scheme
|
|
507
|
-
MoveVector.U8(fromAccount.publicKey.toUint8Array()),
|
|
508
|
-
new U8(newAccount.signingScheme), // to scheme
|
|
509
|
-
MoveVector.U8(newAccount.publicKey.toUint8Array()),
|
|
510
|
-
MoveVector.U8(proofSignedByCurrentPrivateKey.toUint8Array()),
|
|
511
|
-
MoveVector.U8(proofSignedByNewPrivateKey.toUint8Array()),
|
|
512
|
-
],
|
|
513
|
-
abi: rotateAuthKeyAbi,
|
|
514
|
-
},
|
|
515
|
-
});
|
|
516
|
-
return signAndSubmitTransaction({
|
|
517
|
-
aptosConfig,
|
|
518
|
-
signer: fromAccount,
|
|
519
|
-
transaction: rawTxn,
|
|
520
|
-
});
|
|
521
|
-
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { AccountAddress, AccountAddressInput } from "../../core/accountAddress";
|
|
2
|
+
import { MoveModuleBytecode, LedgerVersionArg, PaginationArgs, AccountData } from "../../types/types";
|
|
3
|
+
import { AptosConfig } from "../../api/aptosConfig";
|
|
4
|
+
import { getAptosFullNode, paginateWithObfuscatedCursor } from "../../client";
|
|
5
|
+
import { memoizeAsync } from "../../utils/memoize";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Retrieves the modules associated with a specified account address.
|
|
9
|
+
*
|
|
10
|
+
* @param args - The arguments for retrieving modules.
|
|
11
|
+
* @param args.aptosConfig - The configuration for connecting to the Aptos blockchain.
|
|
12
|
+
* @param args.accountAddress - The address of the account whose modules are to be retrieved.
|
|
13
|
+
* @param args.options - Optional parameters for pagination and ledger version.
|
|
14
|
+
* @param args.options.limit - The maximum number of modules to retrieve (default is 1000).
|
|
15
|
+
* @param args.options.offset - The starting point for pagination. Note, this is obfuscated and is not an index.
|
|
16
|
+
* @param args.options.ledgerVersion - The specific ledger version to query.
|
|
17
|
+
* @group Implementation
|
|
18
|
+
*/
|
|
19
|
+
export async function getModules(args: {
|
|
20
|
+
aptosConfig: AptosConfig;
|
|
21
|
+
accountAddress: AccountAddressInput;
|
|
22
|
+
options?: PaginationArgs & LedgerVersionArg;
|
|
23
|
+
}): Promise<MoveModuleBytecode[]> {
|
|
24
|
+
const { aptosConfig, accountAddress, options } = args;
|
|
25
|
+
return paginateWithObfuscatedCursor<{}, MoveModuleBytecode[]>({
|
|
26
|
+
aptosConfig,
|
|
27
|
+
originMethod: "getModules",
|
|
28
|
+
path: `accounts/${AccountAddress.from(accountAddress).toString()}/modules`,
|
|
29
|
+
params: {
|
|
30
|
+
ledger_version: options?.ledgerVersion,
|
|
31
|
+
offset: options?.offset,
|
|
32
|
+
limit: options?.limit ?? 1000,
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Retrieves account information for a specified account address.
|
|
39
|
+
*
|
|
40
|
+
* @param args - The arguments for retrieving account information.
|
|
41
|
+
* @param args.aptosConfig - The configuration object for Aptos.
|
|
42
|
+
* @param args.accountAddress - The address of the account to retrieve information for.
|
|
43
|
+
* @group Implementation
|
|
44
|
+
*/
|
|
45
|
+
export async function getInfo(args: {
|
|
46
|
+
aptosConfig: AptosConfig;
|
|
47
|
+
accountAddress: AccountAddressInput;
|
|
48
|
+
}): Promise<AccountData> {
|
|
49
|
+
const { aptosConfig, accountAddress } = args;
|
|
50
|
+
const { data } = await getAptosFullNode<{}, AccountData>({
|
|
51
|
+
aptosConfig,
|
|
52
|
+
originMethod: "getInfo",
|
|
53
|
+
path: `accounts/${AccountAddress.from(accountAddress).toString()}`,
|
|
54
|
+
});
|
|
55
|
+
return data;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Queries for a move module given an account address and module name.
|
|
60
|
+
* This function can help you retrieve the module's ABI and other relevant information.
|
|
61
|
+
*
|
|
62
|
+
* @param args - The arguments for retrieving the module.
|
|
63
|
+
* @param args.aptosConfig - The configuration for the Aptos client.
|
|
64
|
+
* @param args.accountAddress - The account address in hex-encoded 32 byte format.
|
|
65
|
+
* @param args.moduleName - The name of the module to retrieve.
|
|
66
|
+
* @param args.options - Optional parameters for the request.
|
|
67
|
+
* @param args.options.ledgerVersion - Specifies the ledger version of transactions. By default, the latest version will be used.
|
|
68
|
+
* @returns The move module.
|
|
69
|
+
* @group Implementation
|
|
70
|
+
*/
|
|
71
|
+
export async function getModule(args: {
|
|
72
|
+
aptosConfig: AptosConfig;
|
|
73
|
+
accountAddress: AccountAddressInput;
|
|
74
|
+
moduleName: string;
|
|
75
|
+
options?: LedgerVersionArg;
|
|
76
|
+
}): Promise<MoveModuleBytecode> {
|
|
77
|
+
// We don't memoize the account module by ledger version, as it's not a common use case, this would be handled
|
|
78
|
+
// by the developer directly
|
|
79
|
+
if (args.options?.ledgerVersion !== undefined) {
|
|
80
|
+
return getModuleInner(args);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return memoizeAsync(
|
|
84
|
+
async () => getModuleInner(args),
|
|
85
|
+
`module-${args.accountAddress}-${args.moduleName}`,
|
|
86
|
+
1000 * 60 * 5, // 5 minutes
|
|
87
|
+
)();
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Retrieves the bytecode of a specified module from a given account address.
|
|
92
|
+
*
|
|
93
|
+
* @param args - The parameters for retrieving the module bytecode.
|
|
94
|
+
* @param args.aptosConfig - The configuration for connecting to the Aptos network.
|
|
95
|
+
* @param args.accountAddress - The address of the account from which to retrieve the module.
|
|
96
|
+
* @param args.moduleName - The name of the module to retrieve.
|
|
97
|
+
* @param args.options - Optional parameters for specifying the ledger version.
|
|
98
|
+
* @param args.options.ledgerVersion - The specific ledger version to query.
|
|
99
|
+
* @group Implementation
|
|
100
|
+
*/
|
|
101
|
+
async function getModuleInner(args: {
|
|
102
|
+
aptosConfig: AptosConfig;
|
|
103
|
+
accountAddress: AccountAddressInput;
|
|
104
|
+
moduleName: string;
|
|
105
|
+
options?: LedgerVersionArg;
|
|
106
|
+
}): Promise<MoveModuleBytecode> {
|
|
107
|
+
const { aptosConfig, accountAddress, moduleName, options } = args;
|
|
108
|
+
|
|
109
|
+
const { data } = await getAptosFullNode<{}, MoveModuleBytecode>({
|
|
110
|
+
aptosConfig,
|
|
111
|
+
originMethod: "getModule",
|
|
112
|
+
path: `accounts/${AccountAddress.from(accountAddress).toString()}/module/${moduleName}`,
|
|
113
|
+
params: { ledger_version: options?.ledgerVersion },
|
|
114
|
+
});
|
|
115
|
+
return data;
|
|
116
|
+
}
|
|
@@ -5,9 +5,9 @@ import { ScriptComposerWasm } from "@aptos-labs/script-composer-pack";
|
|
|
5
5
|
import { AptosApiType, getFunctionParts } from "../../utils";
|
|
6
6
|
import { AptosConfig } from "../../api/aptosConfig";
|
|
7
7
|
import { InputBatchedFunctionData } from "../types";
|
|
8
|
-
import {
|
|
8
|
+
import { standardizeTypeTags } from "../transactionBuilder";
|
|
9
9
|
import { CallArgument } from "../../types";
|
|
10
|
-
import {
|
|
10
|
+
import { convertArgument, fetchModuleAbi } from "../transactionBuilder/remoteAbi";
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* A wrapper class around TransactionComposer, which is a WASM library compiled
|
|
@@ -58,19 +58,34 @@ export class AptosScriptComposer {
|
|
|
58
58
|
|
|
59
59
|
// Load the calling type arguments into the loader.
|
|
60
60
|
if (input.typeArguments !== undefined) {
|
|
61
|
-
|
|
61
|
+
for (const typeArgument of input.typeArguments) {
|
|
62
|
+
await this.builder.load_type_tag(nodeUrl, typeArgument.toString());
|
|
63
|
+
}
|
|
62
64
|
}
|
|
63
65
|
const typeArguments = standardizeTypeTags(input.typeArguments);
|
|
64
|
-
const
|
|
66
|
+
const moduleAbi = await fetchModuleAbi(moduleAddress, moduleName, this.config);
|
|
67
|
+
if (!moduleAbi) {
|
|
68
|
+
throw new Error(`Could not find module ABI for '${moduleAddress}::${moduleName}'`);
|
|
69
|
+
}
|
|
70
|
+
|
|
65
71
|
// Check the type argument count against the ABI
|
|
66
|
-
|
|
72
|
+
const functionAbi = moduleAbi?.exposed_functions.find((func) => func.name === functionName);
|
|
73
|
+
if (!functionAbi) {
|
|
74
|
+
throw new Error(`Could not find function ABI for '${moduleAddress}::${moduleName}::${functionName}'`);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (typeArguments.length !== functionAbi.generic_type_params.length) {
|
|
67
78
|
throw new Error(
|
|
68
|
-
`Type argument count mismatch, expected ${functionAbi.
|
|
79
|
+
`Type argument count mismatch, expected ${functionAbi?.generic_type_params.length}, received ${typeArguments.length}`,
|
|
69
80
|
);
|
|
70
81
|
}
|
|
71
82
|
|
|
72
83
|
const functionArguments: CallArgument[] = input.functionArguments.map((arg, i) =>
|
|
73
|
-
|
|
84
|
+
arg instanceof CallArgument
|
|
85
|
+
? arg
|
|
86
|
+
: CallArgument.newBytes(
|
|
87
|
+
convertArgument(functionName, moduleAbi, arg, i, typeArguments, { allowUnknownStructs: true }).bcsToBytes(),
|
|
88
|
+
),
|
|
74
89
|
);
|
|
75
90
|
|
|
76
91
|
return this.builder.add_batched_call(
|