@aptos-labs/ts-sdk 1.35.0-zeta.0 → 1.35.0-zeta.2
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-D3UA_cOZ.d.ts → accountAddress-Ce4Cv60D.d.ts} +36 -2
- package/dist/common/{chunk-CSUBLTFA.js → chunk-JMOQXLED.js} +10 -2
- package/dist/common/chunk-JMOQXLED.js.map +1 -0
- package/dist/common/cli/index.d.ts +1 -1
- package/dist/common/cli/index.js +2 -2
- package/dist/common/index.d.ts +33 -19
- package/dist/common/index.js +1325 -1289
- package/dist/common/index.js.map +1 -1
- package/dist/esm/account/AbstractKeylessAccount.mjs +14 -14
- package/dist/esm/account/AbstractedAccount.mjs +17 -17
- package/dist/esm/account/Account.mjs +16 -16
- package/dist/esm/account/AccountUtils.mjs +21 -21
- package/dist/esm/account/Ed25519Account.mjs +14 -14
- package/dist/esm/account/EphemeralKeyPair.mjs +5 -5
- package/dist/esm/account/FederatedKeylessAccount.mjs +15 -15
- package/dist/esm/account/KeylessAccount.mjs +15 -15
- package/dist/esm/account/MultiEd25519Account.mjs +14 -14
- package/dist/esm/account/MultiKeyAccount.d.mts +1 -0
- package/dist/esm/account/MultiKeyAccount.mjs +17 -17
- package/dist/esm/account/SingleKeyAccount.mjs +14 -14
- package/dist/esm/account/index.mjs +24 -24
- package/dist/esm/account/utils.mjs +6 -6
- package/dist/esm/api/account/abstraction.mjs +36 -36
- package/dist/esm/api/account.mjs +40 -38
- package/dist/esm/api/ans.mjs +36 -36
- package/dist/esm/api/aptos.d.mts +0 -1
- package/dist/esm/api/aptos.mjs +71 -68
- package/dist/esm/api/coin.mjs +35 -34
- package/dist/esm/api/digitalAsset.mjs +36 -36
- package/dist/esm/api/event.mjs +10 -10
- package/dist/esm/api/experimental.mjs +23 -37
- package/dist/esm/api/faucet.mjs +9 -9
- package/dist/esm/api/fungibleAsset.mjs +36 -36
- package/dist/esm/api/general.d.mts +2 -2
- package/dist/esm/api/general.mjs +23 -37
- package/dist/esm/api/index.d.mts +0 -1
- package/dist/esm/api/index.mjs +71 -68
- package/dist/esm/api/keyless.mjs +37 -35
- package/dist/esm/api/object.mjs +10 -10
- package/dist/esm/api/staking.mjs +10 -10
- package/dist/esm/api/table.mjs +10 -10
- package/dist/esm/api/transaction.d.mts +30 -18
- package/dist/esm/api/transaction.mjs +43 -41
- package/dist/esm/api/transactionSubmission/build.mjs +34 -34
- package/dist/esm/api/transactionSubmission/management.mjs +38 -36
- package/dist/esm/api/transactionSubmission/sign.mjs +33 -33
- package/dist/esm/api/transactionSubmission/simulate.mjs +34 -34
- package/dist/esm/api/transactionSubmission/submit.mjs +34 -34
- package/dist/esm/api/utils.mjs +8 -8
- package/dist/esm/bcs/index.mjs +7 -7
- package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
- package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
- package/dist/esm/{chunk-XGUYC57L.mjs → chunk-2FTF6J7F.mjs} +3 -3
- package/dist/esm/{chunk-LHQJNJUB.mjs → chunk-2HL7JEFC.mjs} +9 -9
- package/dist/esm/{chunk-EFJAJFI3.mjs → chunk-2WBJAKBO.mjs} +2 -2
- package/dist/esm/{chunk-J7WQ42OC.mjs → chunk-3DAVHDK4.mjs} +2 -2
- package/dist/esm/{chunk-QN5BQMWP.mjs → chunk-56UCIGTO.mjs} +2 -2
- package/dist/esm/{chunk-I6QE3PKO.mjs → chunk-5ORUQZAR.mjs} +2 -2
- package/dist/esm/{chunk-P64LPFEC.mjs → chunk-62LC4PPC.mjs} +2 -2
- package/dist/esm/{chunk-ZWD4BJVD.mjs → chunk-6OFCIXWS.mjs} +3 -3
- package/dist/esm/chunk-6OFCIXWS.mjs.map +1 -0
- package/dist/esm/{chunk-LL4RQKIB.mjs → chunk-6T3V5LXK.mjs} +1 -2
- package/dist/esm/{chunk-LL4RQKIB.mjs.map → chunk-6T3V5LXK.mjs.map} +1 -1
- package/dist/esm/{chunk-UXAUOSSB.mjs → chunk-7F32C225.mjs} +6 -6
- package/dist/esm/{chunk-ESZLRZTK.mjs → chunk-7WW735TU.mjs} +3 -3
- package/dist/esm/{chunk-BQ5JTYXK.mjs → chunk-A33OBGVN.mjs} +3 -3
- package/dist/esm/{chunk-LFMXR5C2.mjs → chunk-A7LYGPFL.mjs} +3 -3
- package/dist/esm/{chunk-SDIZSFCQ.mjs → chunk-BU43ZFDJ.mjs} +2 -2
- package/dist/esm/{chunk-YIHVPGHN.mjs → chunk-C7EEG6SW.mjs} +4 -4
- package/dist/esm/{chunk-XGB3QLVI.mjs → chunk-D6RXVCE3.mjs} +3 -3
- package/dist/esm/{chunk-SGKF62FT.mjs → chunk-DGDZNHUJ.mjs} +5 -3
- package/dist/esm/{chunk-SGKF62FT.mjs.map → chunk-DGDZNHUJ.mjs.map} +1 -1
- package/dist/esm/{chunk-WEOK7WVL.mjs → chunk-EBFKT35C.mjs} +2 -2
- package/dist/esm/{chunk-JOVCSFQC.mjs → chunk-F4VI7BNX.mjs} +2 -2
- package/dist/esm/{chunk-VGI2LPO3.mjs → chunk-FDMI4BUL.mjs} +32 -25
- package/dist/esm/chunk-FDMI4BUL.mjs.map +1 -0
- package/dist/esm/chunk-FRLS4GRM.mjs +62 -0
- package/dist/esm/chunk-FRLS4GRM.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-ZNGTK5IZ.mjs → chunk-G6R77JKO.mjs} +29 -29
- package/dist/esm/{chunk-6PMKDSGB.mjs → chunk-G7BB6K4B.mjs} +2 -2
- package/dist/esm/{chunk-ODG7T6OV.mjs → chunk-GCQK2S5Q.mjs} +2 -2
- package/dist/esm/{chunk-4BXAKN6A.mjs → chunk-HBXBODME.mjs} +3 -3
- package/dist/esm/{chunk-UKZP2GAB.mjs → chunk-HKQY5GXT.mjs} +7 -191
- package/dist/esm/chunk-HKQY5GXT.mjs.map +1 -0
- package/dist/esm/{chunk-NMYFY7WN.mjs → chunk-HL337SEM.mjs} +3 -3
- package/dist/esm/{chunk-K3CXNID3.mjs → chunk-HQDHSKVS.mjs} +2 -2
- package/dist/esm/{chunk-S56SMMAK.mjs → chunk-I5G7XFGT.mjs} +3 -3
- package/dist/esm/{chunk-HQ6A6TYS.mjs → chunk-IJ7XCPP3.mjs} +17 -12
- package/dist/esm/chunk-IJ7XCPP3.mjs.map +1 -0
- package/dist/esm/{chunk-46VPRC7E.mjs → chunk-ILTEOGFF.mjs} +2 -2
- package/dist/esm/{chunk-KLZCGNPI.mjs → chunk-IP7GATDH.mjs} +6 -6
- package/dist/esm/{chunk-KLZCGNPI.mjs.map → chunk-IP7GATDH.mjs.map} +1 -1
- package/dist/esm/{chunk-MHZVL3EA.mjs → chunk-IQVHXOD3.mjs} +8 -8
- package/dist/esm/{chunk-4WNIKKIV.mjs → chunk-JAZJE3OR.mjs} +3 -3
- package/dist/esm/{chunk-SN6KXHPA.mjs → chunk-JEVGHYEP.mjs} +2 -2
- package/dist/esm/{chunk-OQ6XT2GF.mjs → chunk-JFMFZ2IL.mjs} +3 -3
- package/dist/esm/{chunk-HQTQEHHZ.mjs → chunk-JQIRRM7G.mjs} +4 -4
- package/dist/esm/{chunk-MG6UFOJW.mjs → chunk-K5OCDM3W.mjs} +6 -6
- package/dist/esm/{chunk-MG6UFOJW.mjs.map → chunk-K5OCDM3W.mjs.map} +1 -1
- package/dist/esm/{chunk-MUSTBCQX.mjs → chunk-KW64NP2F.mjs} +2 -2
- package/dist/esm/{chunk-DUOU3SNQ.mjs → chunk-ORCQEMJL.mjs} +3 -3
- package/dist/esm/{chunk-LSIXUJ5T.mjs → chunk-QYNYDQE3.mjs} +4 -4
- package/dist/esm/{chunk-5E2IDRDF.mjs → chunk-R45SPK6Q.mjs} +2 -2
- package/dist/esm/{chunk-KAKSJSCR.mjs → chunk-RCXGTN36.mjs} +2 -2
- package/dist/esm/{chunk-3QMLVT4L.mjs → chunk-SPI2HO3E.mjs} +2 -2
- package/dist/esm/{chunk-KEZG4OGH.mjs → chunk-SPVJXZL5.mjs} +208 -68
- package/dist/esm/chunk-SPVJXZL5.mjs.map +1 -0
- package/dist/esm/{chunk-QW7RQDZ5.mjs → chunk-SQNS4SFV.mjs} +9 -1
- package/dist/esm/{chunk-QW7RQDZ5.mjs.map → chunk-SQNS4SFV.mjs.map} +1 -1
- package/dist/esm/{chunk-MIVDDJAH.mjs → chunk-SRXIHVZE.mjs} +2 -2
- package/dist/esm/{chunk-2ZOIVB2U.mjs → chunk-T4BFWV46.mjs} +2 -2
- package/dist/esm/{chunk-TQDWZXFD.mjs → chunk-TDLL7QX5.mjs} +7 -7
- package/dist/esm/{chunk-Y4FHNC5I.mjs → chunk-TJDF4CXI.mjs} +2 -2
- package/dist/esm/{chunk-HMHFKEHQ.mjs → chunk-TL4Z4KHK.mjs} +2 -2
- package/dist/esm/{chunk-Y7KAC4I4.mjs → chunk-UGFIWCJQ.mjs} +2 -2
- package/dist/esm/{chunk-EBEO4SA4.mjs → chunk-UGKZQUGE.mjs} +4 -4
- package/dist/esm/{chunk-KCV4HRSJ.mjs → chunk-UK7SPHIE.mjs} +4 -4
- package/dist/esm/{chunk-KEKNIJHE.mjs → chunk-WHSS6I7T.mjs} +3 -3
- package/dist/esm/{chunk-3SCNBHUA.mjs → chunk-WLTQHGIJ.mjs} +5 -5
- package/dist/esm/{chunk-I4OHHVRF.mjs → chunk-WUM247HF.mjs} +2 -2
- package/dist/esm/{chunk-A3TQLIEM.mjs → chunk-WXQUBQK4.mjs} +2 -2
- package/dist/esm/{chunk-WPV52HGD.mjs → chunk-X4N5BN3S.mjs} +3 -3
- package/dist/esm/{chunk-KPAICS4T.mjs → chunk-XX6C2QGI.mjs} +2 -2
- package/dist/esm/{chunk-XXLSA7W7.mjs → chunk-Y3M32DIB.mjs} +2 -2
- package/dist/esm/{chunk-HLTYSM7H.mjs → chunk-YK66QBML.mjs} +2 -2
- package/dist/esm/{chunk-EMKV5DFX.mjs → chunk-YT7V6AVJ.mjs} +3 -3
- package/dist/esm/chunk-ZRBUAZZD.mjs +36 -0
- package/dist/esm/chunk-ZRBUAZZD.mjs.map +1 -0
- package/dist/esm/cli/index.mjs +1 -1
- package/dist/esm/cli/localNode.mjs +1 -1
- package/dist/esm/client/core.mjs +4 -4
- package/dist/esm/client/get.mjs +4 -4
- package/dist/esm/client/index.mjs +5 -5
- package/dist/esm/client/post.mjs +5 -5
- package/dist/esm/core/account/index.mjs +1 -1
- package/dist/esm/core/account/utils/address.mjs +1 -1
- package/dist/esm/core/account/utils/index.mjs +1 -1
- package/dist/esm/core/accountAddress.mjs +1 -1
- package/dist/esm/core/authenticationKey.mjs +1 -1
- package/dist/esm/core/crypto/abstraction.mjs +3 -3
- package/dist/esm/core/crypto/ed25519.mjs +3 -3
- package/dist/esm/core/crypto/ephemeral.mjs +3 -3
- package/dist/esm/core/crypto/federatedKeyless.mjs +5 -5
- package/dist/esm/core/crypto/index.mjs +5 -5
- package/dist/esm/core/crypto/keyless.mjs +5 -5
- package/dist/esm/core/crypto/multiEd25519.mjs +5 -5
- package/dist/esm/core/crypto/multiKey.mjs +5 -5
- package/dist/esm/core/crypto/privateKey.mjs +1 -1
- package/dist/esm/core/crypto/proof.mjs +3 -3
- package/dist/esm/core/crypto/publicKey.mjs +3 -3
- package/dist/esm/core/crypto/secp256k1.mjs +3 -3
- package/dist/esm/core/crypto/signature.mjs +3 -3
- package/dist/esm/core/crypto/singleKey.mjs +5 -5
- package/dist/esm/core/index.mjs +5 -5
- package/dist/esm/errors/index.mjs +2 -2
- package/dist/esm/index.d.mts +1 -1
- package/dist/esm/index.mjs +81 -74
- package/dist/esm/internal/abstraction.mjs +34 -34
- package/dist/esm/internal/account.d.mts +45 -5
- package/dist/esm/internal/account.mjs +44 -30
- package/dist/esm/internal/ans.mjs +35 -35
- package/dist/esm/internal/coin.mjs +34 -33
- package/dist/esm/internal/digitalAsset.mjs +34 -34
- package/dist/esm/internal/event.mjs +7 -7
- package/dist/esm/internal/experimental.mjs +22 -36
- package/dist/esm/internal/faucet.mjs +8 -8
- package/dist/esm/internal/fungibleAsset.mjs +34 -34
- package/dist/esm/internal/general.mjs +6 -6
- package/dist/esm/internal/keyless.mjs +36 -34
- package/dist/esm/internal/object.mjs +7 -7
- package/dist/esm/internal/staking.mjs +7 -7
- package/dist/esm/internal/table.mjs +7 -7
- package/dist/esm/internal/transaction.mjs +7 -7
- package/dist/esm/internal/transactionSubmission.d.mts +6 -36
- package/dist/esm/internal/transactionSubmission.mjs +33 -39
- package/dist/esm/internal/utils/index.d.mts +15 -0
- package/dist/esm/internal/utils/index.mjs +39 -0
- package/dist/esm/internal/utils/index.mjs.map +1 -0
- package/dist/esm/internal/utils/utils.d.mts +65 -0
- package/dist/esm/internal/utils/utils.mjs +38 -0
- package/dist/esm/internal/utils/utils.mjs.map +1 -0
- package/dist/esm/internal/view.mjs +22 -36
- package/dist/esm/transactions/authenticator/account.mjs +5 -5
- package/dist/esm/transactions/authenticator/index.mjs +5 -5
- package/dist/esm/transactions/authenticator/transaction.mjs +5 -5
- package/dist/esm/transactions/index.mjs +23 -37
- package/dist/esm/transactions/instances/index.mjs +14 -14
- package/dist/esm/transactions/instances/moduleId.mjs +5 -5
- package/dist/esm/transactions/instances/multiAgentTransaction.mjs +9 -9
- package/dist/esm/transactions/instances/rawTransaction.mjs +8 -8
- package/dist/esm/transactions/instances/rotationProofChallenge.mjs +3 -3
- package/dist/esm/transactions/instances/signedTransaction.mjs +9 -9
- package/dist/esm/transactions/instances/simpleTransaction.mjs +9 -9
- package/dist/esm/transactions/instances/transactionPayload.mjs +6 -6
- package/dist/esm/transactions/management/accountSequenceNumber.mjs +41 -29
- package/dist/esm/transactions/management/index.mjs +37 -35
- package/dist/esm/transactions/management/transactionWorker.mjs +37 -35
- package/dist/esm/transactions/scriptComposer/index.mjs +21 -35
- package/dist/esm/transactions/transactionBuilder/helpers.mjs +6 -6
- package/dist/esm/transactions/transactionBuilder/index.mjs +20 -34
- package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +9 -40
- package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +13 -13
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +19 -34
- package/dist/esm/transactions/typeTag/index.mjs +5 -5
- package/dist/esm/transactions/typeTag/parser.mjs +5 -5
- package/dist/esm/types/index.d.mts +1 -1
- package/dist/esm/types/index.mjs +5 -1
- package/dist/esm/types/types.d.mts +36 -2
- package/dist/esm/types/types.mjs +5 -1
- package/dist/esm/utils/helpers.mjs +1 -1
- package/dist/esm/utils/index.mjs +4 -4
- package/dist/esm/utils/normalizeBundle.mjs +3 -3
- package/package.json +25 -24
- package/src/account/MultiKeyAccount.ts +3 -2
- package/src/api/general.ts +2 -2
- package/src/api/transaction.ts +30 -29
- package/src/client/post.ts +0 -1
- package/src/internal/account.ts +230 -71
- package/src/internal/transactionSubmission.ts +4 -202
- package/src/internal/utils/index.ts +4 -0
- package/src/internal/utils/utils.ts +116 -0
- package/src/transactions/scriptComposer/index.ts +3 -1
- package/src/transactions/transactionBuilder/remoteAbi.ts +1 -1
- package/src/transactions/transactionBuilder/transactionBuilder.ts +7 -2
- package/src/types/types.ts +38 -1
- package/dist/common/chunk-CSUBLTFA.js.map +0 -1
- package/dist/esm/chunk-HQ6A6TYS.mjs.map +0 -1
- package/dist/esm/chunk-KEZG4OGH.mjs.map +0 -1
- package/dist/esm/chunk-UKZP2GAB.mjs.map +0 -1
- package/dist/esm/chunk-VGI2LPO3.mjs.map +0 -1
- package/dist/esm/chunk-ZWD4BJVD.mjs.map +0 -1
- /package/dist/esm/{chunk-XGUYC57L.mjs.map → chunk-2FTF6J7F.mjs.map} +0 -0
- /package/dist/esm/{chunk-LHQJNJUB.mjs.map → chunk-2HL7JEFC.mjs.map} +0 -0
- /package/dist/esm/{chunk-EFJAJFI3.mjs.map → chunk-2WBJAKBO.mjs.map} +0 -0
- /package/dist/esm/{chunk-J7WQ42OC.mjs.map → chunk-3DAVHDK4.mjs.map} +0 -0
- /package/dist/esm/{chunk-QN5BQMWP.mjs.map → chunk-56UCIGTO.mjs.map} +0 -0
- /package/dist/esm/{chunk-I6QE3PKO.mjs.map → chunk-5ORUQZAR.mjs.map} +0 -0
- /package/dist/esm/{chunk-P64LPFEC.mjs.map → chunk-62LC4PPC.mjs.map} +0 -0
- /package/dist/esm/{chunk-UXAUOSSB.mjs.map → chunk-7F32C225.mjs.map} +0 -0
- /package/dist/esm/{chunk-ESZLRZTK.mjs.map → chunk-7WW735TU.mjs.map} +0 -0
- /package/dist/esm/{chunk-BQ5JTYXK.mjs.map → chunk-A33OBGVN.mjs.map} +0 -0
- /package/dist/esm/{chunk-LFMXR5C2.mjs.map → chunk-A7LYGPFL.mjs.map} +0 -0
- /package/dist/esm/{chunk-SDIZSFCQ.mjs.map → chunk-BU43ZFDJ.mjs.map} +0 -0
- /package/dist/esm/{chunk-YIHVPGHN.mjs.map → chunk-C7EEG6SW.mjs.map} +0 -0
- /package/dist/esm/{chunk-XGB3QLVI.mjs.map → chunk-D6RXVCE3.mjs.map} +0 -0
- /package/dist/esm/{chunk-WEOK7WVL.mjs.map → chunk-EBFKT35C.mjs.map} +0 -0
- /package/dist/esm/{chunk-JOVCSFQC.mjs.map → chunk-F4VI7BNX.mjs.map} +0 -0
- /package/dist/esm/{chunk-ZNGTK5IZ.mjs.map → chunk-G6R77JKO.mjs.map} +0 -0
- /package/dist/esm/{chunk-6PMKDSGB.mjs.map → chunk-G7BB6K4B.mjs.map} +0 -0
- /package/dist/esm/{chunk-ODG7T6OV.mjs.map → chunk-GCQK2S5Q.mjs.map} +0 -0
- /package/dist/esm/{chunk-4BXAKN6A.mjs.map → chunk-HBXBODME.mjs.map} +0 -0
- /package/dist/esm/{chunk-NMYFY7WN.mjs.map → chunk-HL337SEM.mjs.map} +0 -0
- /package/dist/esm/{chunk-K3CXNID3.mjs.map → chunk-HQDHSKVS.mjs.map} +0 -0
- /package/dist/esm/{chunk-S56SMMAK.mjs.map → chunk-I5G7XFGT.mjs.map} +0 -0
- /package/dist/esm/{chunk-46VPRC7E.mjs.map → chunk-ILTEOGFF.mjs.map} +0 -0
- /package/dist/esm/{chunk-MHZVL3EA.mjs.map → chunk-IQVHXOD3.mjs.map} +0 -0
- /package/dist/esm/{chunk-4WNIKKIV.mjs.map → chunk-JAZJE3OR.mjs.map} +0 -0
- /package/dist/esm/{chunk-SN6KXHPA.mjs.map → chunk-JEVGHYEP.mjs.map} +0 -0
- /package/dist/esm/{chunk-OQ6XT2GF.mjs.map → chunk-JFMFZ2IL.mjs.map} +0 -0
- /package/dist/esm/{chunk-HQTQEHHZ.mjs.map → chunk-JQIRRM7G.mjs.map} +0 -0
- /package/dist/esm/{chunk-MUSTBCQX.mjs.map → chunk-KW64NP2F.mjs.map} +0 -0
- /package/dist/esm/{chunk-DUOU3SNQ.mjs.map → chunk-ORCQEMJL.mjs.map} +0 -0
- /package/dist/esm/{chunk-LSIXUJ5T.mjs.map → chunk-QYNYDQE3.mjs.map} +0 -0
- /package/dist/esm/{chunk-5E2IDRDF.mjs.map → chunk-R45SPK6Q.mjs.map} +0 -0
- /package/dist/esm/{chunk-KAKSJSCR.mjs.map → chunk-RCXGTN36.mjs.map} +0 -0
- /package/dist/esm/{chunk-3QMLVT4L.mjs.map → chunk-SPI2HO3E.mjs.map} +0 -0
- /package/dist/esm/{chunk-MIVDDJAH.mjs.map → chunk-SRXIHVZE.mjs.map} +0 -0
- /package/dist/esm/{chunk-2ZOIVB2U.mjs.map → chunk-T4BFWV46.mjs.map} +0 -0
- /package/dist/esm/{chunk-TQDWZXFD.mjs.map → chunk-TDLL7QX5.mjs.map} +0 -0
- /package/dist/esm/{chunk-Y4FHNC5I.mjs.map → chunk-TJDF4CXI.mjs.map} +0 -0
- /package/dist/esm/{chunk-HMHFKEHQ.mjs.map → chunk-TL4Z4KHK.mjs.map} +0 -0
- /package/dist/esm/{chunk-Y7KAC4I4.mjs.map → chunk-UGFIWCJQ.mjs.map} +0 -0
- /package/dist/esm/{chunk-EBEO4SA4.mjs.map → chunk-UGKZQUGE.mjs.map} +0 -0
- /package/dist/esm/{chunk-KCV4HRSJ.mjs.map → chunk-UK7SPHIE.mjs.map} +0 -0
- /package/dist/esm/{chunk-KEKNIJHE.mjs.map → chunk-WHSS6I7T.mjs.map} +0 -0
- /package/dist/esm/{chunk-3SCNBHUA.mjs.map → chunk-WLTQHGIJ.mjs.map} +0 -0
- /package/dist/esm/{chunk-I4OHHVRF.mjs.map → chunk-WUM247HF.mjs.map} +0 -0
- /package/dist/esm/{chunk-A3TQLIEM.mjs.map → chunk-WXQUBQK4.mjs.map} +0 -0
- /package/dist/esm/{chunk-WPV52HGD.mjs.map → chunk-X4N5BN3S.mjs.map} +0 -0
- /package/dist/esm/{chunk-KPAICS4T.mjs.map → chunk-XX6C2QGI.mjs.map} +0 -0
- /package/dist/esm/{chunk-XXLSA7W7.mjs.map → chunk-Y3M32DIB.mjs.map} +0 -0
- /package/dist/esm/{chunk-HLTYSM7H.mjs.map → chunk-YK66QBML.mjs.map} +0 -0
- /package/dist/esm/{chunk-EMKV5DFX.mjs.map → chunk-YT7V6AVJ.mjs.map} +0 -0
package/package.json
CHANGED
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
"build:clean": "rm -rf dist",
|
|
37
37
|
"build": "pnpm build:clean && tsup",
|
|
38
38
|
"prepublishOnly": "pnpm run build",
|
|
39
|
-
"_fmt": "prettier 'src/**/*.ts' 'tests/**/*.ts' 'examples/**/*.js' 'examples/**/*.ts' '.
|
|
39
|
+
"_fmt": "prettier 'src/**/*.ts' 'tests/**/*.ts' 'examples/**/*.js' 'examples/**/*.ts' 'eslint.config.cjs'",
|
|
40
40
|
"fmt": "pnpm _fmt --write",
|
|
41
|
-
"lint": "eslint '
|
|
41
|
+
"lint": "eslint '**/*.{cts,mts,ts}'",
|
|
42
42
|
"test": "pnpm jest",
|
|
43
43
|
"unit-test": "pnpm jest tests/unit",
|
|
44
44
|
"e2e-test": "pnpm jest tests/e2e",
|
|
@@ -64,38 +64,39 @@
|
|
|
64
64
|
"poseidon-lite": "^0.2.0"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
|
-
"@babel/traverse": "^7.
|
|
68
|
-
"@cucumber/cucumber": "^11.0
|
|
69
|
-
"@
|
|
67
|
+
"@babel/traverse": "^7.26.8",
|
|
68
|
+
"@cucumber/cucumber": "^11.2.0",
|
|
69
|
+
"@eslint/eslintrc": "^3.2.0",
|
|
70
|
+
"@graphql-codegen/cli": "^5.0.4",
|
|
70
71
|
"@graphql-codegen/import-types-preset": "^3.0.0",
|
|
71
|
-
"@graphql-codegen/typescript": "^4.
|
|
72
|
+
"@graphql-codegen/typescript": "^4.1.3",
|
|
72
73
|
"@graphql-codegen/typescript-graphql-request": "^6.2.0",
|
|
73
|
-
"@graphql-codegen/typescript-operations": "^4.
|
|
74
|
+
"@graphql-codegen/typescript-operations": "^4.4.1",
|
|
74
75
|
"@types/base-64": "^1.0.2",
|
|
75
|
-
"@types/jest": "^29.5.
|
|
76
|
-
"@types/jsonwebtoken": "^9.0.
|
|
77
|
-
"@types/node": "^20.
|
|
78
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
79
|
-
"@typescript-eslint/parser": "^
|
|
80
|
-
"dotenv": "^16.4.
|
|
81
|
-
"eslint": "^
|
|
76
|
+
"@types/jest": "^29.5.14",
|
|
77
|
+
"@types/jsonwebtoken": "^9.0.8",
|
|
78
|
+
"@types/node": "^20.17.17",
|
|
79
|
+
"@typescript-eslint/eslint-plugin": "^7.18.0",
|
|
80
|
+
"@typescript-eslint/parser": "^7.18.0",
|
|
81
|
+
"dotenv": "^16.4.7",
|
|
82
|
+
"eslint": "^9.20.1",
|
|
82
83
|
"eslint-config-airbnb-base": "^15.0.0",
|
|
83
|
-
"eslint-config-
|
|
84
|
-
"eslint-config-prettier": "^9.1.0",
|
|
84
|
+
"eslint-config-prettier": "^10.0.1",
|
|
85
85
|
"eslint-plugin-import": "^2.31.0",
|
|
86
|
-
"graphql": "^16.
|
|
86
|
+
"graphql": "^16.10.0",
|
|
87
|
+
"globals": "^15.14.0",
|
|
87
88
|
"graphql-request": "^6.1.0",
|
|
88
89
|
"jest": "^29.7.0",
|
|
89
90
|
"jsonwebtoken": "^9.0.2",
|
|
90
|
-
"prettier": "^3.
|
|
91
|
+
"prettier": "^3.5.0",
|
|
91
92
|
"tree-kill": "^1.2.2",
|
|
92
93
|
"ts-jest": "^29.2.5",
|
|
93
|
-
"ts-loader": "^9.5.
|
|
94
|
+
"ts-loader": "^9.5.2",
|
|
94
95
|
"ts-node": "^10.9.2",
|
|
95
|
-
"tsup": "^8.3.
|
|
96
|
-
"typedoc": "^0.
|
|
97
|
-
"typedoc-plugin-missing-exports": "^3.
|
|
98
|
-
"typescript": "^5.
|
|
96
|
+
"tsup": "^8.3.6",
|
|
97
|
+
"typedoc": "^0.27.7",
|
|
98
|
+
"typedoc-plugin-missing-exports": "^3.1.0",
|
|
99
|
+
"typescript": "^5.7.3"
|
|
99
100
|
},
|
|
100
|
-
"version": "1.35.0-zeta.
|
|
101
|
+
"version": "1.35.0-zeta.2"
|
|
101
102
|
}
|
|
@@ -148,13 +148,14 @@ export class MultiKeyAccount implements Account, KeylessSigner {
|
|
|
148
148
|
* @category Account (On-Chain Model)
|
|
149
149
|
*/
|
|
150
150
|
static fromPublicKeysAndSigners(args: {
|
|
151
|
+
address?: AccountAddressInput;
|
|
151
152
|
publicKeys: PublicKey[];
|
|
152
153
|
signaturesRequired: number;
|
|
153
154
|
signers: SingleKeySignerOrLegacyEd25519Account[];
|
|
154
155
|
}): MultiKeyAccount {
|
|
155
|
-
const { publicKeys, signaturesRequired, signers } = args;
|
|
156
|
+
const { address, publicKeys, signaturesRequired, signers } = args;
|
|
156
157
|
const multiKey = new MultiKey({ publicKeys, signaturesRequired });
|
|
157
|
-
return new MultiKeyAccount({ multiKey, signers });
|
|
158
|
+
return new MultiKeyAccount({ multiKey, signers, address });
|
|
158
159
|
}
|
|
159
160
|
|
|
160
161
|
/**
|
package/src/api/general.ts
CHANGED
|
@@ -279,11 +279,11 @@ export class General {
|
|
|
279
279
|
* async function runExample() {
|
|
280
280
|
* // Querying the Aptos Indexer for ledger information
|
|
281
281
|
* const topUserTransactions = await aptos.queryIndexer({
|
|
282
|
-
* query: `query MyQuery {
|
|
282
|
+
* query: { query: `query MyQuery {
|
|
283
283
|
* ledger_infos {
|
|
284
284
|
* chain_id
|
|
285
285
|
* }
|
|
286
|
-
* }`
|
|
286
|
+
* }`}
|
|
287
287
|
* });
|
|
288
288
|
*
|
|
289
289
|
* console.log(topUserTransactions);
|
package/src/api/transaction.ts
CHANGED
|
@@ -24,9 +24,6 @@ import {
|
|
|
24
24
|
FeePayerOrFeePayerAuthenticatorOrNeither,
|
|
25
25
|
getSigningMessage,
|
|
26
26
|
publicPackageTransaction,
|
|
27
|
-
rotateAuthKey,
|
|
28
|
-
rotateAuthKeyToMultiEd25519,
|
|
29
|
-
rotateAuthKeyWithVerificationTransaction,
|
|
30
27
|
signAndSubmitAsFeePayer,
|
|
31
28
|
signAndSubmitTransaction,
|
|
32
29
|
signAsFeePayer,
|
|
@@ -38,14 +35,14 @@ import {
|
|
|
38
35
|
InputGenerateTransactionOptions,
|
|
39
36
|
InputGenerateTransactionPayloadData,
|
|
40
37
|
} from "../transactions";
|
|
41
|
-
import { AccountAddressInput, Ed25519PrivateKey } from "../core";
|
|
38
|
+
import { AccountAddressInput, AuthenticationKey, Ed25519PrivateKey } from "../core";
|
|
42
39
|
import { Account } from "../account";
|
|
43
40
|
import { Build } from "./transactionSubmission/build";
|
|
44
41
|
import { Simulate } from "./transactionSubmission/simulate";
|
|
45
42
|
import { Submit } from "./transactionSubmission/submit";
|
|
46
43
|
import { TransactionManagement } from "./transactionSubmission/management";
|
|
47
44
|
import { SimpleTransaction } from "../transactions/instances/simpleTransaction";
|
|
48
|
-
import {
|
|
45
|
+
import { rotateAuthKey } from "../internal/account";
|
|
49
46
|
|
|
50
47
|
/**
|
|
51
48
|
* Represents a transaction in the Aptos blockchain,
|
|
@@ -477,13 +474,26 @@ export class Transaction {
|
|
|
477
474
|
}
|
|
478
475
|
|
|
479
476
|
/**
|
|
480
|
-
*
|
|
481
|
-
*
|
|
482
|
-
* More info: {@link https://aptos.dev/guides/account-management/key-rotation/}
|
|
477
|
+
* Rotates the authentication key for a given account. Once an account is rotated, only the new private key
|
|
478
|
+
* or keyless signing scheme can be used to sign transactions for the account.
|
|
483
479
|
*
|
|
484
|
-
* @param args The arguments for rotating the
|
|
485
|
-
* @param args.fromAccount The account
|
|
486
|
-
* @param args.
|
|
480
|
+
* @param args - The arguments for rotating the authentication key.
|
|
481
|
+
* @param args.fromAccount - The account from which the authentication key will be rotated.
|
|
482
|
+
* @param args.toAccount - (Optional) The target account to rotate to. Required if not using toNewPrivateKey or toAuthKey.
|
|
483
|
+
* @param args.toNewPrivateKey - (Optional) The new private key to rotate to. Required if not using toAccount or toAuthKey.
|
|
484
|
+
* @param args.toAuthKey - (Optional) The new authentication key to rotate to. Can only be used with dangerouslySkipVerification=true.
|
|
485
|
+
* @param args.dangerouslySkipVerification - (Optional) If true, skips verification steps after rotation. Required when using toAuthKey.
|
|
486
|
+
*
|
|
487
|
+
* @remarks
|
|
488
|
+
* This function supports three modes of rotation:
|
|
489
|
+
* 1. Using a target Account object (toAccount)
|
|
490
|
+
* 2. Using a new private key (toNewPrivateKey)
|
|
491
|
+
* 3. Using a raw authentication key (toAuthKey) - requires dangerouslySkipVerification=true
|
|
492
|
+
*
|
|
493
|
+
* When not using dangerouslySkipVerification, the function performs additional safety checks and account setup.
|
|
494
|
+
*
|
|
495
|
+
* If the new key is a multi key, skipping verification is dangerous because verification will publish the public key onchain and
|
|
496
|
+
* prevent users from being locked out of the account from loss of knowledge of one of the public keys.
|
|
487
497
|
*
|
|
488
498
|
* @returns PendingTransactionResponse
|
|
489
499
|
*
|
|
@@ -509,27 +519,18 @@ export class Transaction {
|
|
|
509
519
|
* ```
|
|
510
520
|
* @group Transaction
|
|
511
521
|
*/
|
|
512
|
-
async rotateAuthKey(
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
522
|
+
async rotateAuthKey(
|
|
523
|
+
args: {
|
|
524
|
+
fromAccount: Account;
|
|
525
|
+
} & (
|
|
526
|
+
| { toAccount: Account; dangerouslySkipVerification?: never }
|
|
527
|
+
| { toNewPrivateKey: Ed25519PrivateKey; dangerouslySkipVerification?: never }
|
|
528
|
+
| { toAuthKey: AuthenticationKey; dangerouslySkipVerification: true }
|
|
529
|
+
),
|
|
530
|
+
): Promise<PendingTransactionResponse> {
|
|
516
531
|
return rotateAuthKey({ aptosConfig: this.config, ...args });
|
|
517
532
|
}
|
|
518
533
|
|
|
519
|
-
async rotateAuthKeyToMultiEd25519(args: {
|
|
520
|
-
fromAccount: Account;
|
|
521
|
-
multiEd25519Account: MultiEd25519Account;
|
|
522
|
-
}): Promise<PendingTransactionResponse> {
|
|
523
|
-
return rotateAuthKeyToMultiEd25519({ aptosConfig: this.config, ...args });
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
async rotateAuthKeyWithVerificationTransaction(args: {
|
|
527
|
-
fromAccount: Account;
|
|
528
|
-
toAccount: Account;
|
|
529
|
-
}): Promise<CommittedTransactionResponse> {
|
|
530
|
-
return rotateAuthKeyWithVerificationTransaction({ aptosConfig: this.config, ...args });
|
|
531
|
-
}
|
|
532
|
-
|
|
533
534
|
/**
|
|
534
535
|
* Sign a transaction that can later be submitted to the chain.
|
|
535
536
|
* This function is essential for ensuring the authenticity of the transaction by using the provided account's signing capabilities.
|
package/src/client/post.ts
CHANGED
|
@@ -230,7 +230,6 @@ export async function postAptosIndexer<Req extends {}, Res extends {}>(
|
|
|
230
230
|
options: PostAptosRequestOptions,
|
|
231
231
|
): Promise<AptosResponse<Req, Res>> {
|
|
232
232
|
const { aptosConfig } = options;
|
|
233
|
-
console.log("request", JSON.stringify(options.body, null, 2));
|
|
234
233
|
|
|
235
234
|
return post<Req, Res>({
|
|
236
235
|
...options,
|
package/src/internal/account.ts
CHANGED
|
@@ -21,7 +21,8 @@ import {
|
|
|
21
21
|
GetObjectDataQueryResponse,
|
|
22
22
|
isEd25519Signature,
|
|
23
23
|
isMultiEd25519Signature,
|
|
24
|
-
|
|
24
|
+
isSingleSenderMultiKeySignature,
|
|
25
|
+
isSingleSenderSingleKeySignature,
|
|
25
26
|
isUserTransactionResponse,
|
|
26
27
|
LedgerVersionArg,
|
|
27
28
|
MoveModuleBytecode,
|
|
@@ -29,12 +30,13 @@ import {
|
|
|
29
30
|
MoveStructId,
|
|
30
31
|
OrderByArg,
|
|
31
32
|
PaginationArgs,
|
|
33
|
+
PendingTransactionResponse,
|
|
32
34
|
TokenStandardArg,
|
|
33
35
|
TransactionResponse,
|
|
34
36
|
WhereArg,
|
|
35
37
|
} from "../types";
|
|
36
38
|
import { AccountAddress, AccountAddressInput } from "../core/accountAddress";
|
|
37
|
-
import { Account } from "../account";
|
|
39
|
+
import { Account, Ed25519Account, MultiEd25519Account } from "../account";
|
|
38
40
|
import {
|
|
39
41
|
AbstractMultiKey,
|
|
40
42
|
AccountPublicKey,
|
|
@@ -49,6 +51,7 @@ import {
|
|
|
49
51
|
Secp256k1PublicKey,
|
|
50
52
|
} from "../core/crypto";
|
|
51
53
|
import { queryIndexer } from "./general";
|
|
54
|
+
import { getModules as getModulesUtil, getModule as getModuleUtil, getInfo as getInfoUtil } from "./utils";
|
|
52
55
|
import {
|
|
53
56
|
GetAccountCoinsCountQuery,
|
|
54
57
|
GetAccountCoinsDataQuery,
|
|
@@ -77,7 +80,6 @@ import {
|
|
|
77
80
|
GetAccountAddressesForAuthKey,
|
|
78
81
|
GetSignatures,
|
|
79
82
|
} from "../types/generated/queries";
|
|
80
|
-
import { memoizeAsync } from "../utils/memoize";
|
|
81
83
|
import { Secp256k1PrivateKey, AuthenticationKey, Ed25519PrivateKey, createObjectAddress, Hex } from "../core";
|
|
82
84
|
import { CurrentFungibleAssetBalancesBoolExp } from "../types/generated/types";
|
|
83
85
|
import { getTableItem } from "./table";
|
|
@@ -85,6 +87,10 @@ import { APTOS_COIN } from "../utils";
|
|
|
85
87
|
import { AptosApiError } from "../errors";
|
|
86
88
|
import { Deserializer } from "../bcs";
|
|
87
89
|
import { getTransactionByVersion } from "./transaction";
|
|
90
|
+
import { signAndSubmitTransaction, generateTransaction } from "./transactionSubmission";
|
|
91
|
+
import { EntryFunctionABI, RotationProofChallenge, TypeTagU8, TypeTagVector } from "../transactions";
|
|
92
|
+
import { U8, MoveVector } from "../bcs";
|
|
93
|
+
import { waitForTransaction } from "./transaction";
|
|
88
94
|
import { deriveKeylessAccount, DeriveKeylessAccountParams } from "./keyless";
|
|
89
95
|
|
|
90
96
|
/**
|
|
@@ -99,13 +105,7 @@ export async function getInfo(args: {
|
|
|
99
105
|
aptosConfig: AptosConfig;
|
|
100
106
|
accountAddress: AccountAddressInput;
|
|
101
107
|
}): Promise<AccountData> {
|
|
102
|
-
|
|
103
|
-
const { data } = await getAptosFullNode<{}, AccountData>({
|
|
104
|
-
aptosConfig,
|
|
105
|
-
originMethod: "getInfo",
|
|
106
|
-
path: `accounts/${AccountAddress.from(accountAddress).toString()}`,
|
|
107
|
-
});
|
|
108
|
-
return data;
|
|
108
|
+
return getInfoUtil(args);
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
/**
|
|
@@ -125,17 +125,7 @@ export async function getModules(args: {
|
|
|
125
125
|
accountAddress: AccountAddressInput;
|
|
126
126
|
options?: PaginationArgs & LedgerVersionArg;
|
|
127
127
|
}): Promise<MoveModuleBytecode[]> {
|
|
128
|
-
|
|
129
|
-
return paginateWithObfuscatedCursor<{}, MoveModuleBytecode[]>({
|
|
130
|
-
aptosConfig,
|
|
131
|
-
originMethod: "getModules",
|
|
132
|
-
path: `accounts/${AccountAddress.from(accountAddress).toString()}/modules`,
|
|
133
|
-
params: {
|
|
134
|
-
ledger_version: options?.ledgerVersion,
|
|
135
|
-
offset: options?.offset,
|
|
136
|
-
limit: options?.limit ?? 1000,
|
|
137
|
-
},
|
|
138
|
-
});
|
|
128
|
+
return getModulesUtil(args);
|
|
139
129
|
}
|
|
140
130
|
|
|
141
131
|
/**
|
|
@@ -157,45 +147,7 @@ export async function getModule(args: {
|
|
|
157
147
|
moduleName: string;
|
|
158
148
|
options?: LedgerVersionArg;
|
|
159
149
|
}): Promise<MoveModuleBytecode> {
|
|
160
|
-
|
|
161
|
-
// by the developer directly
|
|
162
|
-
if (args.options?.ledgerVersion !== undefined) {
|
|
163
|
-
return getModuleInner(args);
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
return memoizeAsync(
|
|
167
|
-
async () => getModuleInner(args),
|
|
168
|
-
`module-${args.accountAddress}-${args.moduleName}`,
|
|
169
|
-
1000 * 60 * 5, // 5 minutes
|
|
170
|
-
)();
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* Retrieves the bytecode of a specified module from a given account address.
|
|
175
|
-
*
|
|
176
|
-
* @param args - The parameters for retrieving the module bytecode.
|
|
177
|
-
* @param args.aptosConfig - The configuration for connecting to the Aptos network.
|
|
178
|
-
* @param args.accountAddress - The address of the account from which to retrieve the module.
|
|
179
|
-
* @param args.moduleName - The name of the module to retrieve.
|
|
180
|
-
* @param args.options - Optional parameters for specifying the ledger version.
|
|
181
|
-
* @param args.options.ledgerVersion - The specific ledger version to query.
|
|
182
|
-
* @group Implementation
|
|
183
|
-
*/
|
|
184
|
-
async function getModuleInner(args: {
|
|
185
|
-
aptosConfig: AptosConfig;
|
|
186
|
-
accountAddress: AccountAddressInput;
|
|
187
|
-
moduleName: string;
|
|
188
|
-
options?: LedgerVersionArg;
|
|
189
|
-
}): Promise<MoveModuleBytecode> {
|
|
190
|
-
const { aptosConfig, accountAddress, moduleName, options } = args;
|
|
191
|
-
|
|
192
|
-
const { data } = await getAptosFullNode<{}, MoveModuleBytecode>({
|
|
193
|
-
aptosConfig,
|
|
194
|
-
originMethod: "getModule",
|
|
195
|
-
path: `accounts/${AccountAddress.from(accountAddress).toString()}/module/${moduleName}`,
|
|
196
|
-
params: { ledger_version: options?.ledgerVersion },
|
|
197
|
-
});
|
|
198
|
-
return data;
|
|
150
|
+
return getModuleUtil(args);
|
|
199
151
|
}
|
|
200
152
|
|
|
201
153
|
/**
|
|
@@ -845,6 +797,197 @@ export async function isAccountExist(args: { aptosConfig: AptosConfig; authKey:
|
|
|
845
797
|
}
|
|
846
798
|
}
|
|
847
799
|
|
|
800
|
+
const rotateAuthKeyAbi: EntryFunctionABI = {
|
|
801
|
+
typeParameters: [],
|
|
802
|
+
parameters: [
|
|
803
|
+
new TypeTagU8(),
|
|
804
|
+
TypeTagVector.u8(),
|
|
805
|
+
new TypeTagU8(),
|
|
806
|
+
TypeTagVector.u8(),
|
|
807
|
+
TypeTagVector.u8(),
|
|
808
|
+
TypeTagVector.u8(),
|
|
809
|
+
],
|
|
810
|
+
};
|
|
811
|
+
|
|
812
|
+
/**
|
|
813
|
+
* Rotates the authentication key for a given account.
|
|
814
|
+
*
|
|
815
|
+
* @param args - The arguments for rotating the authentication key.
|
|
816
|
+
* @param args.aptosConfig - The configuration settings for the Aptos network.
|
|
817
|
+
* @param args.fromAccount - The account from which the authentication key will be rotated.
|
|
818
|
+
* @param args.toAccount - (Optional) The target account to rotate to. Required if not using toNewPrivateKey or toAuthKey.
|
|
819
|
+
* @param args.toNewPrivateKey - (Optional) The new private key to rotate to. Required if not using toAccount or toAuthKey.
|
|
820
|
+
* @param args.toAuthKey - (Optional) The new authentication key to rotate to. Can only be used with dangerouslySkipVerification=true.
|
|
821
|
+
* @param args.dangerouslySkipVerification - (Optional) If true, skips verification steps after rotation. Required when using toAuthKey.
|
|
822
|
+
*
|
|
823
|
+
* @remarks
|
|
824
|
+
* This function supports three modes of rotation:
|
|
825
|
+
* 1. Using a target Account object (toAccount)
|
|
826
|
+
* 2. Using a new private key (toNewPrivateKey)
|
|
827
|
+
* 3. Using a raw authentication key (toAuthKey) - requires dangerouslySkipVerification=true
|
|
828
|
+
*
|
|
829
|
+
* When not using dangerouslySkipVerification, the function performs additional safety checks and account setup.
|
|
830
|
+
*
|
|
831
|
+
* If the new key is a multi key, skipping verification is dangerous because verification will publish the public key onchain and
|
|
832
|
+
* prevent users from being locked out of the account from loss of knowledge of one of the public keys.
|
|
833
|
+
*
|
|
834
|
+
* @returns A promise that resolves to the pending transaction response.
|
|
835
|
+
* @throws Error if the rotation fails or verification fails.
|
|
836
|
+
*
|
|
837
|
+
* @group Implementation
|
|
838
|
+
*/
|
|
839
|
+
export async function rotateAuthKey(
|
|
840
|
+
args: {
|
|
841
|
+
aptosConfig: AptosConfig;
|
|
842
|
+
fromAccount: Account;
|
|
843
|
+
} & (
|
|
844
|
+
| { toAccount: Account; dangerouslySkipVerification?: never }
|
|
845
|
+
| { toNewPrivateKey: Ed25519PrivateKey; dangerouslySkipVerification?: never }
|
|
846
|
+
| { toAuthKey: AuthenticationKey; dangerouslySkipVerification: true }
|
|
847
|
+
),
|
|
848
|
+
): Promise<PendingTransactionResponse> {
|
|
849
|
+
const { aptosConfig, fromAccount, dangerouslySkipVerification } = args;
|
|
850
|
+
if ("toNewPrivateKey" in args) {
|
|
851
|
+
return rotateAuthKeyWithChallenge({
|
|
852
|
+
aptosConfig,
|
|
853
|
+
fromAccount,
|
|
854
|
+
toNewPrivateKey: args.toNewPrivateKey,
|
|
855
|
+
});
|
|
856
|
+
}
|
|
857
|
+
let authKey: AuthenticationKey;
|
|
858
|
+
if ("toAccount" in args) {
|
|
859
|
+
if (args.toAccount instanceof Ed25519Account) {
|
|
860
|
+
return rotateAuthKeyWithChallenge({ aptosConfig, fromAccount, toNewPrivateKey: args.toAccount.privateKey });
|
|
861
|
+
}
|
|
862
|
+
if (args.toAccount instanceof MultiEd25519Account) {
|
|
863
|
+
return rotateAuthKeyWithChallenge({ aptosConfig, fromAccount, toAccount: args.toAccount });
|
|
864
|
+
}
|
|
865
|
+
authKey = args.toAccount.publicKey.authKey();
|
|
866
|
+
} else if ("toAuthKey" in args) {
|
|
867
|
+
authKey = args.toAuthKey;
|
|
868
|
+
} else {
|
|
869
|
+
throw new Error("Invalid arguments");
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
const pendingTxn = await rotateAuthKeyUnverified({
|
|
873
|
+
aptosConfig,
|
|
874
|
+
fromAccount,
|
|
875
|
+
toAuthKey: authKey,
|
|
876
|
+
});
|
|
877
|
+
|
|
878
|
+
if (dangerouslySkipVerification === true) {
|
|
879
|
+
return pendingTxn;
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
const rotateAuthKeyTxnResponse = await waitForTransaction({
|
|
883
|
+
aptosConfig,
|
|
884
|
+
transactionHash: pendingTxn.hash,
|
|
885
|
+
});
|
|
886
|
+
if (!rotateAuthKeyTxnResponse.success) {
|
|
887
|
+
throw new Error(`Failed to rotate authentication key - ${rotateAuthKeyTxnResponse}`);
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
// Verify the rotation by setting the originating address to the new account.
|
|
891
|
+
// This verifies the rotation even if the transaction payload fails to execute successfully.
|
|
892
|
+
const verificationTxn = await generateTransaction({
|
|
893
|
+
aptosConfig,
|
|
894
|
+
sender: fromAccount.accountAddress,
|
|
895
|
+
data: {
|
|
896
|
+
function: "0x1::account::set_originating_address",
|
|
897
|
+
functionArguments: [],
|
|
898
|
+
},
|
|
899
|
+
});
|
|
900
|
+
|
|
901
|
+
return signAndSubmitTransaction({
|
|
902
|
+
aptosConfig,
|
|
903
|
+
signer: args.toAccount, // Use the new account to sign
|
|
904
|
+
transaction: verificationTxn,
|
|
905
|
+
});
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
async function rotateAuthKeyWithChallenge(
|
|
909
|
+
args: {
|
|
910
|
+
aptosConfig: AptosConfig;
|
|
911
|
+
fromAccount: Account;
|
|
912
|
+
} & ({ toNewPrivateKey: Ed25519PrivateKey } | { toAccount: MultiEd25519Account }),
|
|
913
|
+
): Promise<PendingTransactionResponse> {
|
|
914
|
+
const { aptosConfig, fromAccount } = args;
|
|
915
|
+
const accountInfo = await getInfo({
|
|
916
|
+
aptosConfig,
|
|
917
|
+
accountAddress: fromAccount.accountAddress,
|
|
918
|
+
});
|
|
919
|
+
|
|
920
|
+
let newAccount: Account;
|
|
921
|
+
if ("toNewPrivateKey" in args) {
|
|
922
|
+
newAccount = Account.fromPrivateKey({ privateKey: args.toNewPrivateKey, legacy: true });
|
|
923
|
+
} else {
|
|
924
|
+
newAccount = args.toAccount;
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
const challenge = new RotationProofChallenge({
|
|
928
|
+
sequenceNumber: BigInt(accountInfo.sequence_number),
|
|
929
|
+
originator: fromAccount.accountAddress,
|
|
930
|
+
currentAuthKey: AccountAddress.from(accountInfo.authentication_key),
|
|
931
|
+
newPublicKey: newAccount.publicKey,
|
|
932
|
+
});
|
|
933
|
+
|
|
934
|
+
// Sign the challenge
|
|
935
|
+
const challengeHex = challenge.bcsToBytes();
|
|
936
|
+
const proofSignedByCurrentKey = fromAccount.sign(challengeHex);
|
|
937
|
+
const proofSignedByNewKey = newAccount.sign(challengeHex);
|
|
938
|
+
|
|
939
|
+
// Generate transaction
|
|
940
|
+
const rawTxn = await generateTransaction({
|
|
941
|
+
aptosConfig,
|
|
942
|
+
sender: fromAccount.accountAddress,
|
|
943
|
+
data: {
|
|
944
|
+
function: "0x1::account::rotate_authentication_key",
|
|
945
|
+
functionArguments: [
|
|
946
|
+
new U8(fromAccount.signingScheme), // from scheme
|
|
947
|
+
MoveVector.U8(fromAccount.publicKey.toUint8Array()),
|
|
948
|
+
new U8(newAccount.signingScheme), // to scheme
|
|
949
|
+
MoveVector.U8(newAccount.publicKey.toUint8Array()),
|
|
950
|
+
MoveVector.U8(proofSignedByCurrentKey.toUint8Array()),
|
|
951
|
+
MoveVector.U8(proofSignedByNewKey.toUint8Array()),
|
|
952
|
+
],
|
|
953
|
+
abi: rotateAuthKeyAbi,
|
|
954
|
+
},
|
|
955
|
+
});
|
|
956
|
+
return signAndSubmitTransaction({
|
|
957
|
+
aptosConfig,
|
|
958
|
+
signer: fromAccount,
|
|
959
|
+
transaction: rawTxn,
|
|
960
|
+
});
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
const rotateAuthKeyUnverifiedAbi: EntryFunctionABI = {
|
|
964
|
+
typeParameters: [],
|
|
965
|
+
parameters: [TypeTagVector.u8()],
|
|
966
|
+
};
|
|
967
|
+
|
|
968
|
+
async function rotateAuthKeyUnverified(args: {
|
|
969
|
+
aptosConfig: AptosConfig;
|
|
970
|
+
fromAccount: Account;
|
|
971
|
+
toAuthKey: AuthenticationKey;
|
|
972
|
+
}): Promise<PendingTransactionResponse> {
|
|
973
|
+
const { aptosConfig, fromAccount, toAuthKey } = args;
|
|
974
|
+
const authKey = toAuthKey;
|
|
975
|
+
const rawTxn = await generateTransaction({
|
|
976
|
+
aptosConfig,
|
|
977
|
+
sender: fromAccount.accountAddress,
|
|
978
|
+
data: {
|
|
979
|
+
function: "0x1::account::rotate_authentication_key_call",
|
|
980
|
+
functionArguments: [MoveVector.U8(authKey.toUint8Array())],
|
|
981
|
+
abi: rotateAuthKeyUnverifiedAbi,
|
|
982
|
+
},
|
|
983
|
+
});
|
|
984
|
+
return signAndSubmitTransaction({
|
|
985
|
+
aptosConfig,
|
|
986
|
+
signer: fromAccount,
|
|
987
|
+
transaction: rawTxn,
|
|
988
|
+
});
|
|
989
|
+
}
|
|
990
|
+
|
|
848
991
|
async function getMultiKeysForAuthenticationKeys(args: {
|
|
849
992
|
aptosConfig: AptosConfig;
|
|
850
993
|
authKeys: AuthenticationKey[];
|
|
@@ -980,6 +1123,7 @@ async function getLastestTransactionVersionForAddress(args: {
|
|
|
980
1123
|
variables: {
|
|
981
1124
|
where_condition: whereCondition,
|
|
982
1125
|
limit: 1,
|
|
1126
|
+
order_by: { transaction_version: "desc" },
|
|
983
1127
|
},
|
|
984
1128
|
};
|
|
985
1129
|
|
|
@@ -990,7 +1134,7 @@ async function getLastestTransactionVersionForAddress(args: {
|
|
|
990
1134
|
});
|
|
991
1135
|
|
|
992
1136
|
if (data.length !== 1) {
|
|
993
|
-
throw new Error(`
|
|
1137
|
+
throw new Error(`No signatures found for address ${address}`);
|
|
994
1138
|
}
|
|
995
1139
|
return Number(data[0].transaction_version);
|
|
996
1140
|
}
|
|
@@ -1102,6 +1246,7 @@ export async function getPublicKeyFromAccountAddress(args: {
|
|
|
1102
1246
|
aptosConfig,
|
|
1103
1247
|
accountAddress,
|
|
1104
1248
|
});
|
|
1249
|
+
console.log("lastTransactionVersion", lastTransactionVersion);
|
|
1105
1250
|
|
|
1106
1251
|
const transaction = await getTransactionByVersion({ aptosConfig, ledgerVersion: lastTransactionVersion });
|
|
1107
1252
|
if (!isUserTransactionResponse(transaction)) {
|
|
@@ -1121,17 +1266,17 @@ export async function getPublicKeyFromAccountAddress(args: {
|
|
|
1121
1266
|
publicKeys: signature.public_keys.map((pk) => new Ed25519PublicKey(pk)),
|
|
1122
1267
|
threshold: signature.threshold,
|
|
1123
1268
|
});
|
|
1124
|
-
} else if (
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
} else if (signature.public_key.type === "secp256k1_ecdsa") {
|
|
1131
|
-
publicKey = new AnyPublicKey(new Secp256k1PublicKey(signature.public_key.value));
|
|
1132
|
-
} else {
|
|
1133
|
-
throw new Error("Unknown public key type");
|
|
1269
|
+
} else if (isSingleSenderSingleKeySignature(signature)) {
|
|
1270
|
+
publicKey = parsePublicKey(signature.public_key);
|
|
1271
|
+
} else if (isSingleSenderMultiKeySignature(signature)) {
|
|
1272
|
+
const publicKeys: Array<PublicKey> = [];
|
|
1273
|
+
for (const pk of signature.public_keys) {
|
|
1274
|
+
publicKeys.push(parsePublicKey(pk));
|
|
1134
1275
|
}
|
|
1276
|
+
publicKey = new MultiKey({
|
|
1277
|
+
publicKeys,
|
|
1278
|
+
signaturesRequired: signature.signatures_required,
|
|
1279
|
+
});
|
|
1135
1280
|
} else {
|
|
1136
1281
|
throw new Error("Unknown signature type");
|
|
1137
1282
|
}
|
|
@@ -1191,3 +1336,17 @@ export async function getMultiKeyFromAuthenticationKey(args: {
|
|
|
1191
1336
|
// }
|
|
1192
1337
|
|
|
1193
1338
|
type AccountDerivationParams = { privateKey: PrivateKey } | DeriveKeylessAccountParams;
|
|
1339
|
+
|
|
1340
|
+
function parsePublicKey(data: { value: string; type: string }): AnyPublicKey {
|
|
1341
|
+
if (data.type === "keyless") {
|
|
1342
|
+
const deserializer = Deserializer.fromHex(data.value);
|
|
1343
|
+
return new AnyPublicKey(KeylessPublicKey.deserialize(deserializer));
|
|
1344
|
+
}
|
|
1345
|
+
if (data.type === "ed25519") {
|
|
1346
|
+
return new AnyPublicKey(new Ed25519PublicKey(data.value));
|
|
1347
|
+
}
|
|
1348
|
+
if (data.type === "secp256k1_ecdsa") {
|
|
1349
|
+
return new AnyPublicKey(new Secp256k1PublicKey(data.value));
|
|
1350
|
+
}
|
|
1351
|
+
throw new Error("Unknown public key type");
|
|
1352
|
+
}
|