@aptos-labs/ts-sdk 1.14.0-zeta.0 → 1.14.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-NPQwRmxn.d.ts → accountAddress-u9wEan9p.d.ts} +32 -4
- package/dist/common/chunk-QRI7EC4T.js +24 -0
- package/dist/common/chunk-QRI7EC4T.js.map +1 -0
- package/dist/common/cli/index.d.ts +1 -1
- package/dist/common/cli/index.js +245 -1
- package/dist/common/cli/index.js.map +1 -1
- package/dist/common/index.d.ts +290 -171
- package/dist/common/index.js +11786 -374
- package/dist/common/index.js.map +1 -1
- package/dist/esm/account/Account.mjs +55 -1
- package/dist/esm/account/Ed25519Account.mjs +53 -1
- package/dist/esm/account/EphemeralKeyPair.d.mts +38 -5
- package/dist/esm/account/EphemeralKeyPair.mjs +36 -1
- package/dist/esm/account/KeylessAccount.d.mts +75 -37
- package/dist/esm/account/KeylessAccount.mjs +56 -1
- package/dist/esm/account/MultiKeyAccount.d.mts +4 -0
- package/dist/esm/account/MultiKeyAccount.mjs +55 -1
- package/dist/esm/account/SingleKeyAccount.mjs +53 -1
- package/dist/esm/account/index.d.mts +2 -1
- package/dist/esm/account/index.mjs +76 -1
- package/dist/esm/api/account.mjs +76 -1
- package/dist/esm/api/ans.mjs +87 -1
- package/dist/esm/api/aptos.d.mts +1 -0
- package/dist/esm/api/aptos.mjs +116 -1
- package/dist/esm/api/aptosConfig.mjs +9 -1
- package/dist/esm/api/coin.mjs +86 -1
- package/dist/esm/api/digitalAsset.mjs +87 -1
- package/dist/esm/api/event.mjs +54 -1
- package/dist/esm/api/faucet.mjs +53 -1
- package/dist/esm/api/fungibleAsset.mjs +87 -1
- package/dist/esm/api/general.mjs +84 -1
- package/dist/esm/api/index.d.mts +1 -0
- package/dist/esm/api/index.mjs +120 -1
- package/dist/esm/api/keyless.d.mts +19 -5
- package/dist/esm/api/keyless.mjs +70 -1
- package/dist/esm/api/staking.mjs +54 -1
- package/dist/esm/api/transaction.mjs +94 -1
- package/dist/esm/api/transactionSubmission/build.mjs +85 -1
- package/dist/esm/api/transactionSubmission/helpers.mjs +9 -1
- package/dist/esm/api/transactionSubmission/management.mjs +89 -1
- package/dist/esm/api/transactionSubmission/sign.mjs +109 -1
- package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -1
- package/dist/esm/api/transactionSubmission/simulate.mjs +86 -1
- package/dist/esm/api/transactionSubmission/submit.mjs +86 -1
- package/dist/esm/api/utils.mjs +34 -1
- package/dist/esm/bcs/consts.mjs +17 -1
- package/dist/esm/bcs/deserializer.d.mts +26 -0
- package/dist/esm/bcs/deserializer.mjs +8 -1
- package/dist/esm/bcs/index.mjs +57 -1
- package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +12 -1
- package/dist/esm/bcs/serializable/fixedBytes.mjs +11 -1
- package/dist/esm/bcs/serializable/movePrimitives.mjs +25 -1
- package/dist/esm/bcs/serializable/moveStructs.mjs +18 -1
- package/dist/esm/bcs/serializer.mjs +18 -1
- package/dist/esm/chunk-2JOCR2VL.mjs +32 -0
- package/dist/esm/chunk-2JOCR2VL.mjs.map +1 -0
- package/dist/esm/chunk-2OQW7BMN.mjs +129 -0
- package/dist/esm/{chunk-7WJTKYRG.mjs.map → chunk-2OQW7BMN.mjs.map} +1 -1
- package/dist/esm/chunk-2TJJWII2.mjs +23 -0
- package/dist/esm/{chunk-MGOHPDX4.mjs.map → chunk-2TJJWII2.mjs.map} +1 -1
- package/dist/esm/chunk-2ZEGJU43.mjs +252 -0
- package/dist/esm/{chunk-KWNBC5MF.mjs.map → chunk-2ZEGJU43.mjs.map} +1 -1
- package/dist/esm/chunk-4OYYOYSO.mjs +336 -0
- package/dist/esm/chunk-4OYYOYSO.mjs.map +1 -0
- package/dist/esm/{chunk-S4SEFF4K.mjs → chunk-4PJ5FYGQ.mjs} +302 -27
- package/dist/esm/{chunk-S4SEFF4K.mjs.map → chunk-4PJ5FYGQ.mjs.map} +1 -1
- package/dist/esm/chunk-55NODGHC.mjs +135 -0
- package/dist/esm/{chunk-G4XSNSOT.mjs.map → chunk-55NODGHC.mjs.map} +1 -1
- package/dist/esm/chunk-6LRQSBRH.mjs +130 -0
- package/dist/esm/{chunk-C5UVSNZW.mjs.map → chunk-6LRQSBRH.mjs.map} +1 -1
- package/dist/esm/chunk-6MSZMIFW.mjs +23 -0
- package/dist/esm/{chunk-MWUJCP27.mjs.map → chunk-6MSZMIFW.mjs.map} +1 -1
- package/dist/esm/chunk-76TSTAU4.mjs +120 -0
- package/dist/esm/{chunk-FLYEALDB.mjs.map → chunk-76TSTAU4.mjs.map} +1 -1
- package/dist/esm/chunk-7FO3S6IZ.mjs +324 -0
- package/dist/esm/{chunk-3VGX3TXH.mjs.map → chunk-7FO3S6IZ.mjs.map} +1 -1
- package/dist/esm/chunk-7FUHWL6A.mjs +42 -0
- package/dist/esm/{chunk-SRPTQ4VV.mjs.map → chunk-7FUHWL6A.mjs.map} +1 -1
- package/dist/esm/chunk-7IDBB4J4.mjs +33 -0
- package/dist/esm/{chunk-PINF6ZWP.mjs.map → chunk-7IDBB4J4.mjs.map} +1 -1
- package/dist/esm/chunk-7JRMOHBP.mjs +247 -0
- package/dist/esm/chunk-7JRMOHBP.mjs.map +1 -0
- package/dist/esm/chunk-7REUIYF4.mjs +63 -0
- package/dist/esm/chunk-7REUIYF4.mjs.map +1 -0
- package/dist/esm/chunk-AC3OGAL6.mjs +87 -0
- package/dist/esm/{chunk-U6Z4FNB7.mjs.map → chunk-AC3OGAL6.mjs.map} +1 -1
- package/dist/esm/chunk-AR7X6GWQ.mjs +356 -0
- package/dist/esm/{chunk-EB7AI4B4.mjs.map → chunk-AR7X6GWQ.mjs.map} +1 -1
- package/dist/esm/chunk-ASF2VWOX.mjs +142 -0
- package/dist/esm/{chunk-O34EOOVF.mjs.map → chunk-ASF2VWOX.mjs.map} +1 -1
- package/dist/esm/chunk-ATVFVXR6.mjs +43 -0
- package/dist/esm/{chunk-IXYXFDJZ.mjs.map → chunk-ATVFVXR6.mjs.map} +1 -1
- package/dist/esm/chunk-B5S6DDUD.mjs +120 -0
- package/dist/esm/chunk-B5S6DDUD.mjs.map +1 -0
- package/dist/esm/chunk-BXMHDQHW.mjs +512 -0
- package/dist/esm/{chunk-DLTC6PJP.mjs.map → chunk-BXMHDQHW.mjs.map} +1 -1
- package/dist/esm/chunk-CC4DQ6NH.mjs +19 -0
- package/dist/esm/{chunk-H3TFQ7K4.mjs.map → chunk-CC4DQ6NH.mjs.map} +1 -1
- package/dist/esm/chunk-CMNJG4NN.mjs +345 -0
- package/dist/esm/{chunk-T23OVRNF.mjs.map → chunk-CMNJG4NN.mjs.map} +1 -1
- package/dist/esm/chunk-CTJSZT5V.mjs +87 -0
- package/dist/esm/{chunk-J7J7ZTBF.mjs.map → chunk-CTJSZT5V.mjs.map} +1 -1
- package/dist/esm/chunk-CX3NAVRD.mjs +205 -0
- package/dist/esm/chunk-CX3NAVRD.mjs.map +1 -0
- package/dist/esm/chunk-CXUGZXED.mjs +307 -0
- package/dist/esm/{chunk-EKABTHUZ.mjs.map → chunk-CXUGZXED.mjs.map} +1 -1
- package/dist/esm/chunk-D2BVBXWO.mjs +7 -0
- package/dist/esm/{chunk-7PSX4LCV.mjs.map → chunk-D2BVBXWO.mjs.map} +1 -1
- package/dist/esm/chunk-DGV7DYU4.mjs +413 -0
- package/dist/esm/{chunk-7Q2NVO5M.mjs.map → chunk-DGV7DYU4.mjs.map} +1 -1
- package/dist/esm/chunk-DIYZRGR6.mjs +242 -0
- package/dist/esm/{chunk-UVOU6BW2.mjs.map → chunk-DIYZRGR6.mjs.map} +1 -1
- package/dist/esm/chunk-DNPMS2OF.mjs +236 -0
- package/dist/esm/{chunk-PFFAQZHT.mjs.map → chunk-DNPMS2OF.mjs.map} +1 -1
- package/dist/esm/chunk-DVPQGCFT.mjs +74 -0
- package/dist/esm/{chunk-RBPGL6YB.mjs.map → chunk-DVPQGCFT.mjs.map} +1 -1
- package/dist/esm/chunk-EYHRMZPO.mjs +34 -0
- package/dist/esm/{chunk-AH44UPM4.mjs.map → chunk-EYHRMZPO.mjs.map} +1 -1
- package/dist/esm/chunk-F2ZWA7B7.mjs +412 -0
- package/dist/esm/{chunk-RTSEMQCK.mjs.map → chunk-F2ZWA7B7.mjs.map} +1 -1
- package/dist/esm/chunk-FDWJNY4U.mjs +22 -0
- package/dist/esm/{chunk-STYDBDYL.mjs.map → chunk-FDWJNY4U.mjs.map} +1 -1
- package/dist/esm/chunk-FF4JPDKD.mjs +315 -0
- package/dist/esm/{chunk-5DW2AJPI.mjs.map → chunk-FF4JPDKD.mjs.map} +1 -1
- package/dist/esm/chunk-FQQW55X7.mjs +288 -0
- package/dist/esm/{chunk-TVRJ3M7B.mjs.map → chunk-FQQW55X7.mjs.map} +1 -1
- package/dist/esm/chunk-FXKSE3ZP.mjs +25 -0
- package/dist/esm/{chunk-COW5IGYC.mjs.map → chunk-FXKSE3ZP.mjs.map} +1 -1
- package/dist/esm/chunk-GBEVD2VM.mjs +99 -0
- package/dist/esm/chunk-GBEVD2VM.mjs.map +1 -0
- package/dist/esm/chunk-GGMTQAQP.mjs +11 -0
- package/dist/esm/{chunk-3JPVQHOR.mjs.map → chunk-GGMTQAQP.mjs.map} +1 -1
- package/dist/esm/chunk-GSVQ6EUD.mjs +649 -0
- package/dist/esm/{chunk-WOLIXKOK.mjs.map → chunk-GSVQ6EUD.mjs.map} +1 -1
- package/dist/esm/chunk-HBNSRCZN.mjs +100 -0
- package/dist/esm/{chunk-FKSACFCB.mjs.map → chunk-HBNSRCZN.mjs.map} +1 -1
- package/dist/esm/chunk-IC56GQFJ.mjs +127 -0
- package/dist/esm/{chunk-XN4SQWI5.mjs.map → chunk-IC56GQFJ.mjs.map} +1 -1
- package/dist/esm/chunk-IHNPN5CQ.mjs +256 -0
- package/dist/esm/chunk-IHNPN5CQ.mjs.map +1 -0
- package/dist/esm/chunk-JHDHNGJ3.mjs +126 -0
- package/dist/esm/{chunk-JVKMQ64G.mjs.map → chunk-JHDHNGJ3.mjs.map} +1 -1
- package/dist/esm/chunk-JL2JHVS4.mjs +49 -0
- package/dist/esm/{chunk-ZNEBMSNC.mjs.map → chunk-JL2JHVS4.mjs.map} +1 -1
- package/dist/esm/chunk-JV3GSIJW.mjs +268 -0
- package/dist/esm/chunk-JV3GSIJW.mjs.map +1 -0
- package/dist/esm/chunk-KK2BSALW.mjs +32 -0
- package/dist/esm/{chunk-3FVRXELT.mjs.map → chunk-KK2BSALW.mjs.map} +1 -1
- package/dist/esm/chunk-KMXSRHJ6.mjs +93 -0
- package/dist/esm/{chunk-NMECYE3D.mjs.map → chunk-KMXSRHJ6.mjs.map} +1 -1
- package/dist/esm/chunk-KVSQ57HU.mjs +45 -0
- package/dist/esm/{chunk-NNW6HWIO.mjs.map → chunk-KVSQ57HU.mjs.map} +1 -1
- package/dist/esm/chunk-LI2QV6RU.mjs +129 -0
- package/dist/esm/chunk-LI2QV6RU.mjs.map +1 -0
- package/dist/esm/chunk-LLLQJWRZ.mjs +35 -0
- package/dist/esm/{chunk-QNHDS64I.mjs.map → chunk-LLLQJWRZ.mjs.map} +1 -1
- package/dist/esm/chunk-LYK4TQZO.mjs +70 -0
- package/dist/esm/{chunk-OZC3FCJP.mjs.map → chunk-LYK4TQZO.mjs.map} +1 -1
- package/dist/esm/chunk-LYMY63SO.mjs +124 -0
- package/dist/esm/{chunk-UGIJHLL3.mjs.map → chunk-LYMY63SO.mjs.map} +1 -1
- package/dist/esm/chunk-MZZLEY6O.mjs +92 -0
- package/dist/esm/{chunk-NKCZ4KGO.mjs.map → chunk-MZZLEY6O.mjs.map} +1 -1
- package/dist/esm/chunk-N4WKFNQ6.mjs +156 -0
- package/dist/esm/{chunk-LDQ6JFEF.mjs.map → chunk-N4WKFNQ6.mjs.map} +1 -1
- package/dist/esm/chunk-NFJCQRVK.mjs +37 -0
- package/dist/esm/{chunk-YE5B2S5L.mjs.map → chunk-NFJCQRVK.mjs.map} +1 -1
- package/dist/esm/chunk-NMKCJNQM.mjs +20 -0
- package/dist/esm/{chunk-TJDC5PWD.mjs.map → chunk-NMKCJNQM.mjs.map} +1 -1
- package/dist/esm/chunk-NW45SCPY.mjs +36 -0
- package/dist/esm/{chunk-V7P6MLSY.mjs.map → chunk-NW45SCPY.mjs.map} +1 -1
- package/dist/esm/chunk-NXFO2W4G.mjs +84 -0
- package/dist/esm/{chunk-D22EMNIY.mjs.map → chunk-NXFO2W4G.mjs.map} +1 -1
- package/dist/esm/chunk-NYL77J4X.mjs +97 -0
- package/dist/esm/{chunk-43WARVT3.mjs.map → chunk-NYL77J4X.mjs.map} +1 -1
- package/dist/esm/chunk-O6PSHSN3.mjs +53 -0
- package/dist/esm/{chunk-6LOTZ4GY.mjs.map → chunk-O6PSHSN3.mjs.map} +1 -1
- package/dist/esm/chunk-OR7TEZ25.mjs +16 -0
- package/dist/esm/chunk-PCLNX6FS.mjs +17 -0
- package/dist/esm/{chunk-6FBKUTGF.mjs.map → chunk-PCLNX6FS.mjs.map} +1 -1
- package/dist/esm/chunk-PIMQHG2J.mjs +49 -0
- package/dist/esm/{chunk-C3L4ETUF.mjs.map → chunk-PIMQHG2J.mjs.map} +1 -1
- package/dist/esm/chunk-PU5AFUX3.mjs +52 -0
- package/dist/esm/chunk-PU5AFUX3.mjs.map +1 -0
- package/dist/esm/chunk-PYLOAMR2.mjs +29 -0
- package/dist/esm/{chunk-HGZGTBA4.mjs.map → chunk-PYLOAMR2.mjs.map} +1 -1
- package/dist/esm/chunk-QBBTUC66.mjs +15 -0
- package/dist/esm/{chunk-ROXFCLDT.mjs.map → chunk-QBBTUC66.mjs.map} +1 -1
- package/dist/esm/chunk-QFOG4LIN.mjs +319 -0
- package/dist/esm/{chunk-RJ4PSGZ4.mjs.map → chunk-QFOG4LIN.mjs.map} +1 -1
- package/dist/esm/chunk-QMM2KL6C.mjs +12 -0
- package/dist/esm/{chunk-FBPNHF54.mjs.map → chunk-QMM2KL6C.mjs.map} +1 -1
- package/dist/esm/chunk-RCQMWXEW.mjs +35 -0
- package/dist/esm/{chunk-TXMPXZBG.mjs.map → chunk-RCQMWXEW.mjs.map} +1 -1
- package/dist/esm/chunk-RX4VG2AT.mjs +314 -0
- package/dist/esm/chunk-RX4VG2AT.mjs.map +1 -0
- package/dist/esm/chunk-SBB4YEPT.mjs +17 -0
- package/dist/esm/{chunk-56CNRT2K.mjs.map → chunk-SBB4YEPT.mjs.map} +1 -1
- package/dist/esm/chunk-SIJELMDP.mjs +29 -0
- package/dist/esm/{chunk-6EMN3BOV.mjs.map → chunk-SIJELMDP.mjs.map} +1 -1
- package/dist/esm/chunk-SS3NUM5L.mjs +94 -0
- package/dist/esm/{chunk-L54P6EGN.mjs.map → chunk-SS3NUM5L.mjs.map} +1 -1
- package/dist/esm/chunk-ST4QXIMI.mjs +37 -0
- package/dist/esm/{chunk-XMFPKHB5.mjs.map → chunk-ST4QXIMI.mjs.map} +1 -1
- package/dist/esm/chunk-TBHU6ZW6.mjs +215 -0
- package/dist/esm/{chunk-QHVZL3LZ.mjs.map → chunk-TBHU6ZW6.mjs.map} +1 -1
- package/dist/esm/chunk-TLNHRJB2.mjs +155 -0
- package/dist/esm/{chunk-H6LYW7HG.mjs.map → chunk-TLNHRJB2.mjs.map} +1 -1
- package/dist/esm/chunk-U3IUCR2G.mjs +54 -0
- package/dist/esm/{chunk-52ECIIIH.mjs.map → chunk-U3IUCR2G.mjs.map} +1 -1
- package/dist/esm/chunk-U7QBZ6PP.mjs +400 -0
- package/dist/esm/{chunk-ZM436N3W.mjs.map → chunk-U7QBZ6PP.mjs.map} +1 -1
- package/dist/esm/chunk-UEBBLQJ5.mjs +94 -0
- package/dist/esm/{chunk-7STYQ5ZE.mjs.map → chunk-UEBBLQJ5.mjs.map} +1 -1
- package/dist/esm/chunk-UKU6A2W2.mjs +232 -0
- package/dist/esm/{chunk-HXSW6X7K.mjs.map → chunk-UKU6A2W2.mjs.map} +1 -1
- package/dist/esm/chunk-UX5NSZEN.mjs +134 -0
- package/dist/esm/{chunk-WVIPPU2C.mjs.map → chunk-UX5NSZEN.mjs.map} +1 -1
- package/dist/esm/chunk-VDJBDX3A.mjs +79 -0
- package/dist/esm/{chunk-25N7RLBW.mjs.map → chunk-VDJBDX3A.mjs.map} +1 -1
- package/dist/esm/chunk-VJP2VWMF.mjs +58 -0
- package/dist/esm/{chunk-56NB52W6.mjs.map → chunk-VJP2VWMF.mjs.map} +1 -1
- package/dist/esm/chunk-VKJQORON.mjs +93 -0
- package/dist/esm/{chunk-3OELNIC6.mjs.map → chunk-VKJQORON.mjs.map} +1 -1
- package/dist/esm/chunk-VPWUODU4.mjs +51 -0
- package/dist/esm/{chunk-NNIHTVLA.mjs.map → chunk-VPWUODU4.mjs.map} +1 -1
- package/dist/esm/chunk-VZQXLVEP.mjs +197 -0
- package/dist/esm/{chunk-VJJN3GFD.mjs.map → chunk-VZQXLVEP.mjs.map} +1 -1
- package/dist/esm/chunk-W76MGKZB.mjs +33 -0
- package/dist/esm/{chunk-CLVAGDXO.mjs.map → chunk-W76MGKZB.mjs.map} +1 -1
- package/dist/esm/chunk-WDRH2URB.mjs +91 -0
- package/dist/esm/{chunk-65UZZNN2.mjs.map → chunk-WDRH2URB.mjs.map} +1 -1
- package/dist/esm/chunk-WHBWEN6N.mjs +206 -0
- package/dist/esm/{chunk-NGNETNK2.mjs.map → chunk-WHBWEN6N.mjs.map} +1 -1
- package/dist/esm/chunk-WK5ZSNE2.mjs +173 -0
- package/dist/esm/{chunk-6RBUXB5I.mjs.map → chunk-WK5ZSNE2.mjs.map} +1 -1
- package/dist/esm/chunk-WLTBF4DF.mjs +22 -0
- package/dist/esm/chunk-WLTBF4DF.mjs.map +1 -0
- package/dist/esm/chunk-WVGO4D7K.mjs +254 -0
- package/dist/esm/{chunk-OLGSIKFB.mjs.map → chunk-WVGO4D7K.mjs.map} +1 -1
- package/dist/esm/chunk-XANFAUBD.mjs +44 -0
- package/dist/esm/{chunk-NC5HHEEM.mjs.map → chunk-XANFAUBD.mjs.map} +1 -1
- package/dist/esm/chunk-Y2LV3S5W.mjs +410 -0
- package/dist/esm/{chunk-6SHLLRJA.mjs.map → chunk-Y2LV3S5W.mjs.map} +1 -1
- package/dist/esm/chunk-YV7M4CFP.mjs +137 -0
- package/dist/esm/{chunk-AOCNYMMX.mjs.map → chunk-YV7M4CFP.mjs.map} +1 -1
- package/dist/esm/chunk-YYOPNUX5.mjs +41 -0
- package/dist/esm/chunk-YYOPNUX5.mjs.map +1 -0
- package/dist/esm/chunk-ZAHJ7KXB.mjs +81 -0
- package/dist/esm/{chunk-Z5KKUXYI.mjs.map → chunk-ZAHJ7KXB.mjs.map} +1 -1
- package/dist/esm/chunk-ZMFKQUHL.mjs +117 -0
- package/dist/esm/{chunk-TICM455H.mjs.map → chunk-ZMFKQUHL.mjs.map} +1 -1
- package/dist/esm/cli/index.mjs +12 -1
- package/dist/esm/cli/localNode.mjs +8 -1
- package/dist/esm/cli/move.mjs +7 -1
- package/dist/esm/client/core.mjs +27 -1
- package/dist/esm/client/get.mjs +32 -1
- package/dist/esm/client/index.mjs +55 -1
- package/dist/esm/client/post.mjs +36 -1
- package/dist/esm/client/types.d.mts +5 -1
- package/dist/esm/client/types.mjs +7 -1
- package/dist/esm/core/account/index.mjs +19 -1
- package/dist/esm/core/account/utils/address.mjs +18 -1
- package/dist/esm/core/account/utils/index.mjs +19 -1
- package/dist/esm/core/accountAddress.mjs +15 -1
- package/dist/esm/core/authenticationKey.mjs +14 -1
- package/dist/esm/core/common.mjs +7 -1
- package/dist/esm/core/crypto/ed25519.d.mts +10 -0
- package/dist/esm/core/crypto/ed25519.mjs +29 -1
- package/dist/esm/core/crypto/ephemeral.d.mts +16 -20
- package/dist/esm/core/crypto/ephemeral.mjs +28 -1
- package/dist/esm/core/crypto/hdKey.d.mts +1 -15
- package/dist/esm/core/crypto/hdKey.mjs +25 -1
- package/dist/esm/core/crypto/index.d.mts +3 -2
- package/dist/esm/core/crypto/index.mjs +124 -1
- package/dist/esm/core/crypto/keyless.d.mts +121 -106
- package/dist/esm/core/crypto/keyless.mjs +55 -1
- package/dist/esm/core/crypto/multiEd25519.mjs +28 -1
- package/dist/esm/core/crypto/multiKey.mjs +34 -1
- package/dist/esm/core/crypto/poseidon.mjs +15 -1
- package/dist/esm/core/crypto/privateKey.mjs +1 -1
- package/dist/esm/core/crypto/proof.d.mts +21 -0
- package/dist/esm/core/crypto/proof.mjs +20 -0
- package/dist/esm/core/crypto/proof.mjs.map +1 -0
- package/dist/esm/core/crypto/publicKey.mjs +21 -1
- package/dist/esm/core/crypto/secp256k1.mjs +27 -1
- package/dist/esm/core/crypto/signature.mjs +19 -1
- package/dist/esm/core/crypto/singleKey.mjs +33 -1
- package/dist/esm/core/crypto/utils.mjs +9 -1
- package/dist/esm/core/hex.mjs +10 -1
- package/dist/esm/core/index.d.mts +3 -2
- package/dist/esm/core/index.mjs +141 -1
- package/dist/esm/index.d.mts +5 -4
- package/dist/esm/index.mjs +635 -1
- package/dist/esm/internal/account.mjs +106 -1
- package/dist/esm/internal/ans.mjs +120 -1
- package/dist/esm/internal/coin.mjs +85 -1
- package/dist/esm/internal/digitalAsset.mjs +127 -1
- package/dist/esm/internal/event.mjs +55 -1
- package/dist/esm/internal/faucet.mjs +52 -1
- package/dist/esm/internal/fungibleAsset.mjs +91 -1
- package/dist/esm/internal/general.mjs +46 -1
- package/dist/esm/internal/keyless.d.mts +4 -3
- package/dist/esm/internal/keyless.mjs +73 -1
- package/dist/esm/internal/staking.mjs +53 -1
- package/dist/esm/internal/transaction.mjs +51 -1
- package/dist/esm/internal/transactionSubmission.mjs +102 -1
- package/dist/esm/internal/view.mjs +83 -1
- package/dist/esm/transactions/authenticator/account.mjs +44 -1
- package/dist/esm/transactions/authenticator/index.mjs +60 -1
- package/dist/esm/transactions/authenticator/transaction.mjs +48 -1
- package/dist/esm/transactions/index.mjs +284 -1
- package/dist/esm/transactions/instances/chainId.mjs +11 -1
- package/dist/esm/transactions/instances/identifier.mjs +11 -1
- package/dist/esm/transactions/instances/index.mjs +96 -1
- package/dist/esm/transactions/instances/moduleId.mjs +38 -1
- package/dist/esm/transactions/instances/multiAgentTransaction.mjs +43 -1
- package/dist/esm/transactions/instances/rawTransaction.mjs +48 -1
- package/dist/esm/transactions/instances/rotationProofChallenge.mjs +20 -1
- package/dist/esm/transactions/instances/signedTransaction.mjs +45 -1
- package/dist/esm/transactions/instances/simpleTransaction.mjs +43 -1
- package/dist/esm/transactions/instances/transactionArgument.mjs +1 -1
- package/dist/esm/transactions/instances/transactionPayload.mjs +56 -1
- package/dist/esm/transactions/management/accountSequenceNumber.mjs +74 -1
- package/dist/esm/transactions/management/asyncQueue.mjs +9 -1
- package/dist/esm/transactions/management/index.mjs +95 -1
- package/dist/esm/transactions/management/transactionWorker.mjs +91 -1
- package/dist/esm/transactions/transactionBuilder/helpers.mjs +75 -1
- package/dist/esm/transactions/transactionBuilder/index.mjs +162 -1
- package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +85 -1
- package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +58 -1
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +98 -1
- package/dist/esm/transactions/typeTag/index.mjs +74 -1
- package/dist/esm/transactions/typeTag/parser.mjs +43 -1
- package/dist/esm/transactions/types.mjs +1 -1
- package/dist/esm/types/generated/queries.mjs +57 -1
- package/dist/esm/types/generated/types.mjs +809 -1
- package/dist/esm/types/generated/types.mjs.map +1 -1
- package/dist/esm/types/index.d.mts +6 -4
- package/dist/esm/types/index.mjs +68 -1
- package/dist/esm/types/indexer.mjs +1 -1
- package/dist/esm/types/keyless.d.mts +54 -1
- package/dist/esm/types/keyless.mjs +9 -0
- package/dist/esm/utils/apiEndpoints.mjs +21 -1
- package/dist/esm/utils/const.mjs +21 -1
- package/dist/esm/utils/helpers.mjs +7 -1
- package/dist/esm/utils/index.mjs +56 -1
- package/dist/esm/utils/memoize.mjs +9 -1
- package/dist/esm/utils/normalizeBundle.mjs +19 -1
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +7 -1
- package/package.json +5 -2
- package/src/account/EphemeralKeyPair.ts +45 -7
- package/src/account/KeylessAccount.ts +152 -113
- package/src/account/MultiKeyAccount.ts +4 -0
- package/src/api/keyless.ts +17 -4
- package/src/bcs/deserializer.ts +40 -0
- package/src/client/core.ts +1 -1
- package/src/client/types.ts +1 -1
- package/src/core/account/index.ts +0 -1
- package/src/core/crypto/ed25519.ts +24 -4
- package/src/core/crypto/ephemeral.ts +17 -28
- package/src/core/crypto/hdKey.ts +0 -31
- package/src/core/crypto/keyless.ts +231 -286
- package/src/core/crypto/proof.ts +16 -0
- package/src/internal/keyless.ts +16 -15
- package/src/internal/transactionSubmission.ts +16 -6
- package/src/transactions/management/transactionWorker.ts +1 -7
- package/src/types/index.ts +5 -2
- package/src/types/keyless.ts +31 -0
- package/src/utils/apiEndpoints.ts +6 -6
- package/src/version.ts +1 -1
- package/dist/common/chunk-KSEUZTKY.js +0 -2
- package/dist/common/chunk-KSEUZTKY.js.map +0 -1
- package/dist/esm/chunk-25N7RLBW.mjs +0 -2
- package/dist/esm/chunk-32355KGV.mjs +0 -2
- package/dist/esm/chunk-32355KGV.mjs.map +0 -1
- package/dist/esm/chunk-3FVRXELT.mjs +0 -2
- package/dist/esm/chunk-3JPVQHOR.mjs +0 -2
- package/dist/esm/chunk-3OELNIC6.mjs +0 -2
- package/dist/esm/chunk-3U5VRZLS.mjs +0 -2
- package/dist/esm/chunk-3U5VRZLS.mjs.map +0 -1
- package/dist/esm/chunk-3VGX3TXH.mjs +0 -2
- package/dist/esm/chunk-43WARVT3.mjs +0 -2
- package/dist/esm/chunk-52ECIIIH.mjs +0 -2
- package/dist/esm/chunk-56CNRT2K.mjs +0 -2
- package/dist/esm/chunk-56NB52W6.mjs +0 -2
- package/dist/esm/chunk-5DW2AJPI.mjs +0 -2
- package/dist/esm/chunk-5QWUIVAQ.mjs +0 -2
- package/dist/esm/chunk-5QWUIVAQ.mjs.map +0 -1
- package/dist/esm/chunk-6456EI2E.mjs +0 -2
- package/dist/esm/chunk-6456EI2E.mjs.map +0 -1
- package/dist/esm/chunk-65UZZNN2.mjs +0 -2
- package/dist/esm/chunk-6EMN3BOV.mjs +0 -2
- package/dist/esm/chunk-6FBKUTGF.mjs +0 -2
- package/dist/esm/chunk-6IFMQ5AS.mjs +0 -2
- package/dist/esm/chunk-6IFMQ5AS.mjs.map +0 -1
- package/dist/esm/chunk-6LOTZ4GY.mjs +0 -2
- package/dist/esm/chunk-6RBUXB5I.mjs +0 -2
- package/dist/esm/chunk-6SHLLRJA.mjs +0 -2
- package/dist/esm/chunk-73Y4NTDU.mjs +0 -2
- package/dist/esm/chunk-73Y4NTDU.mjs.map +0 -1
- package/dist/esm/chunk-7PSX4LCV.mjs +0 -2
- package/dist/esm/chunk-7Q2NVO5M.mjs +0 -2
- package/dist/esm/chunk-7STYQ5ZE.mjs +0 -2
- package/dist/esm/chunk-7WJTKYRG.mjs +0 -2
- package/dist/esm/chunk-AH44UPM4.mjs +0 -2
- package/dist/esm/chunk-AOCNYMMX.mjs +0 -2
- package/dist/esm/chunk-C3L4ETUF.mjs +0 -2
- package/dist/esm/chunk-C5UVSNZW.mjs +0 -2
- package/dist/esm/chunk-CLVAGDXO.mjs +0 -2
- package/dist/esm/chunk-COW5IGYC.mjs +0 -2
- package/dist/esm/chunk-D22EMNIY.mjs +0 -2
- package/dist/esm/chunk-DLTC6PJP.mjs +0 -2
- package/dist/esm/chunk-EB7AI4B4.mjs +0 -2
- package/dist/esm/chunk-EKABTHUZ.mjs +0 -2
- package/dist/esm/chunk-EOMDZYSJ.mjs +0 -2
- package/dist/esm/chunk-EOMDZYSJ.mjs.map +0 -1
- package/dist/esm/chunk-FBPNHF54.mjs +0 -2
- package/dist/esm/chunk-FKSACFCB.mjs +0 -2
- package/dist/esm/chunk-FLYEALDB.mjs +0 -2
- package/dist/esm/chunk-FVA2OPG4.mjs +0 -2
- package/dist/esm/chunk-G4XSNSOT.mjs +0 -2
- package/dist/esm/chunk-H3TFQ7K4.mjs +0 -2
- package/dist/esm/chunk-H6LYW7HG.mjs +0 -2
- package/dist/esm/chunk-HCGWCB5E.mjs +0 -2
- package/dist/esm/chunk-HCGWCB5E.mjs.map +0 -1
- package/dist/esm/chunk-HGZGTBA4.mjs +0 -2
- package/dist/esm/chunk-HXSW6X7K.mjs +0 -2
- package/dist/esm/chunk-IXYXFDJZ.mjs +0 -2
- package/dist/esm/chunk-J7J7ZTBF.mjs +0 -2
- package/dist/esm/chunk-JVKMQ64G.mjs +0 -2
- package/dist/esm/chunk-KWNBC5MF.mjs +0 -2
- package/dist/esm/chunk-L54P6EGN.mjs +0 -2
- package/dist/esm/chunk-LDQ6JFEF.mjs +0 -2
- package/dist/esm/chunk-MGOHPDX4.mjs +0 -2
- package/dist/esm/chunk-MWUJCP27.mjs +0 -2
- package/dist/esm/chunk-NC5HHEEM.mjs +0 -2
- package/dist/esm/chunk-NGNETNK2.mjs +0 -2
- package/dist/esm/chunk-NKCZ4KGO.mjs +0 -2
- package/dist/esm/chunk-NMECYE3D.mjs +0 -2
- package/dist/esm/chunk-NNIHTVLA.mjs +0 -2
- package/dist/esm/chunk-NNW6HWIO.mjs +0 -2
- package/dist/esm/chunk-O34EOOVF.mjs +0 -2
- package/dist/esm/chunk-OBEVVLF7.mjs +0 -2
- package/dist/esm/chunk-OBEVVLF7.mjs.map +0 -1
- package/dist/esm/chunk-OKRUEVF3.mjs +0 -2
- package/dist/esm/chunk-OKRUEVF3.mjs.map +0 -1
- package/dist/esm/chunk-OLGSIKFB.mjs +0 -2
- package/dist/esm/chunk-OZC3FCJP.mjs +0 -2
- package/dist/esm/chunk-PFFAQZHT.mjs +0 -2
- package/dist/esm/chunk-PINF6ZWP.mjs +0 -2
- package/dist/esm/chunk-PJXRQBF6.mjs +0 -2
- package/dist/esm/chunk-PJXRQBF6.mjs.map +0 -1
- package/dist/esm/chunk-QHVZL3LZ.mjs +0 -2
- package/dist/esm/chunk-QNHDS64I.mjs +0 -2
- package/dist/esm/chunk-RBPGL6YB.mjs +0 -2
- package/dist/esm/chunk-RJ4PSGZ4.mjs +0 -2
- package/dist/esm/chunk-ROXFCLDT.mjs +0 -2
- package/dist/esm/chunk-RTSEMQCK.mjs +0 -2
- package/dist/esm/chunk-SRPTQ4VV.mjs +0 -2
- package/dist/esm/chunk-STYDBDYL.mjs +0 -2
- package/dist/esm/chunk-T23OVRNF.mjs +0 -2
- package/dist/esm/chunk-TICM455H.mjs +0 -2
- package/dist/esm/chunk-TJDC5PWD.mjs +0 -2
- package/dist/esm/chunk-TVRJ3M7B.mjs +0 -2
- package/dist/esm/chunk-TXMPXZBG.mjs +0 -2
- package/dist/esm/chunk-U6Z4FNB7.mjs +0 -2
- package/dist/esm/chunk-UGIJHLL3.mjs +0 -2
- package/dist/esm/chunk-UVOU6BW2.mjs +0 -2
- package/dist/esm/chunk-V7P6MLSY.mjs +0 -2
- package/dist/esm/chunk-VJJN3GFD.mjs +0 -2
- package/dist/esm/chunk-WOLIXKOK.mjs +0 -2
- package/dist/esm/chunk-WVIPPU2C.mjs +0 -2
- package/dist/esm/chunk-XCR3YNHW.mjs +0 -2
- package/dist/esm/chunk-XCR3YNHW.mjs.map +0 -1
- package/dist/esm/chunk-XMFPKHB5.mjs +0 -2
- package/dist/esm/chunk-XN4SQWI5.mjs +0 -2
- package/dist/esm/chunk-YE5B2S5L.mjs +0 -2
- package/dist/esm/chunk-Z5KKUXYI.mjs +0 -2
- package/dist/esm/chunk-ZM436N3W.mjs +0 -2
- package/dist/esm/chunk-ZNEBMSNC.mjs +0 -2
- /package/dist/esm/{chunk-FVA2OPG4.mjs.map → chunk-OR7TEZ25.mjs.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/api/account.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Account as AccountModule } from \"../account\";\nimport { AccountAddress, PrivateKey, AccountAddressInput } from \"../core\";\nimport {\n AccountData,\n AnyNumber,\n GetAccountCoinsDataResponse,\n GetAccountCollectionsWithOwnedTokenResponse,\n GetAccountOwnedObjectsResponse,\n GetAccountOwnedTokensFromCollectionResponse,\n GetAccountOwnedTokensQueryResponse,\n LedgerVersionArg,\n MoveModuleBytecode,\n MoveResource,\n MoveStructId,\n OrderByArg,\n PaginationArgs,\n TokenStandardArg,\n TransactionResponse,\n WhereArg,\n} from \"../types\";\nimport {\n deriveAccountFromPrivateKey,\n getAccountCoinAmount,\n getAccountCoinsCount,\n getAccountCoinsData,\n getAccountCollectionsWithOwnedTokens,\n getAccountOwnedObjects,\n getAccountOwnedTokens,\n getAccountOwnedTokensFromCollectionAddress,\n getAccountTokensCount,\n getAccountTransactionsCount,\n getInfo,\n getModule,\n getModules,\n getResource,\n getResources,\n getTransactions,\n lookupOriginalAccountAddress,\n} from \"../internal/account\";\nimport { APTOS_COIN, ProcessorType } from \"../utils/const\";\nimport { AptosConfig } from \"./aptosConfig\";\nimport { waitForIndexerOnVersion } from \"./utils\";\nimport { CurrentFungibleAssetBalancesBoolExp } from \"../types/generated/types\";\n\n/**\n * A class to query all `Account` related queries on Aptos.\n */\nexport class Account {\n constructor(readonly config: AptosConfig) {}\n\n /**\n * Queries the current state for an Aptos account given its account address\n *\n * @param args.accountAddress Aptos account address\n *\n * @returns The account data\n *\n * @example An example of the returned account\n * ```\n * {\n * sequence_number: \"1\",\n * authentication_key: \"0x5307b5f4bc67829097a8ba9b43dba3b88261eeccd1f709d9bde240fc100fbb69\"\n * }\n * ```\n */\n async getAccountInfo(args: { accountAddress: AccountAddressInput }): Promise<AccountData> {\n return getInfo({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries for all modules in an account given an account address\n *\n * Note: In order to get all account modules, this function may call the API\n * multiple times as it auto paginates.\n *\n * @param args.accountAddress Aptos account address\n * @param args.options.offset The number module to start returning results from\n * @param args.options.limit The number of results to return\n * @param args.options.ledgerVersion The ledger version to query, if not provided it will get the latest version\n *\n * @returns Account modules\n */\n\n async getAccountModules(args: {\n accountAddress: AccountAddressInput;\n options?: PaginationArgs & LedgerVersionArg;\n }): Promise<MoveModuleBytecode[]> {\n return getModules({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries for a specific account module given account address and module name\n *\n * @param args.accountAddress Aptos account address\n * @param args.moduleName The name of the module\n * @param args.options.ledgerVersion The ledger version to query, if not provided it will get the latest version\n *\n * @returns Account module\n *\n * @example\n * const module = await aptos.getAccountModule({accountAddress:\"0x456\"})\n * // An example of an account module response\n * ```\n * {\n * bytecode: \"0xa11ceb0b0600000006010002030206050807070f0d081c200\",\n * abi: { address: \"0x1\" }\n * }\n * ```\n */\n async getAccountModule(args: {\n accountAddress: AccountAddressInput;\n moduleName: string;\n options?: LedgerVersionArg;\n }): Promise<MoveModuleBytecode> {\n return getModule({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries account transactions given an account address\n *\n * Note: In order to get all account transactions, this function may call the API\n * multiple times as it auto paginates.\n *\n * @example\n * const transactions = await aptos.getAccountTransactions({accountAddress:\"0x456\"})\n *\n * @param args.accountAddress Aptos account address\n * @param args.options.offset The number transaction to start returning results from\n * @param args.options.limit The number of results to return\n *\n * @returns The account transactions\n */\n async getAccountTransactions(args: {\n accountAddress: AccountAddressInput;\n options?: PaginationArgs;\n }): Promise<TransactionResponse[]> {\n return getTransactions({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries all account resources given an account address\n *\n * Note: In order to get all account resources, this function may call the API\n * multiple times as it auto paginates.\n *\n * @example\n * const resources = await aptos.getAccountResources({accountAddress:\"0x456\"})\n *\n * @param args.accountAddress Aptos account address\n * @param args.options.offset The number resource to start returning results from\n * @param args.options.limit The number of results to return\n * @param args.options.ledgerVersion The ledger version to query, if not provided it will get the latest version\n * @returns Account resources\n */\n async getAccountResources(args: {\n accountAddress: AccountAddressInput;\n options?: PaginationArgs & LedgerVersionArg;\n }): Promise<MoveResource[]> {\n return getResources({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries a specific account resource given account address and resource type. Note that the default is `any` in order\n * to allow for ease of accessing properties of the object.\n *\n * @type The typed output of the resource\n * @param args.accountAddress Aptos account address\n * @param args.resourceType String representation of an on-chain Move struct type, i.e \"0x1::aptos_coin::AptosCoin\"\n * @param args.options.ledgerVersion The ledger version to query, if not provided it will get the latest version\n *\n * @returns Account resource\n *\n * @example\n * const resource = await aptos.getAccountResource({accountAddress:\"0x456\"})\n *\n */\n async getAccountResource<T extends {} = any>(args: {\n accountAddress: AccountAddressInput;\n resourceType: MoveStructId;\n options?: LedgerVersionArg;\n }): Promise<T> {\n return getResource<T>({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Looks up the account address for a given authentication key\n *\n * This handles both if the account's authentication key has been rotated or not.\n *\n * @example\n * const accountAddress = await aptos.lookupOriginalAccountAddress({authenticationKey:account.accountAddress})\n *\n * @param args.authenticationKey The authentication key\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n * @param args.options.ledgerVersion The ledger version to query, if not provided it will get the latest version\n * @returns Promise<AccountAddress> The accountAddress associated with the authentication key\n */\n async lookupOriginalAccountAddress(args: {\n authenticationKey: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n options?: LedgerVersionArg;\n }): Promise<AccountAddress> {\n return lookupOriginalAccountAddress({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries the current count of tokens owned by an account\n *\n * @example\n * const tokensCount = await aptos.getAccountTokensCount({accountAddress:\"0x456\"})\n *\n * @param args.accountAddress The account address\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n * @returns Current count of tokens owned by the account\n */\n async getAccountTokensCount(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n }): Promise<number> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.ACCOUNT_TRANSACTION_PROCESSOR,\n });\n return getAccountTokensCount({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries the account's current owned tokens.\n *\n * This query returns all tokens (v1 and v2 standards) an account owns, including NFTs, fungible, soulbound, etc.\n * If you want to get only the token from a specific standard, you can pass an optional tokenStandard param\n *\n * @example\n * const accountOwnedTokens = await aptos.getAccountOwnedTokens({accountAddress:\"0x456\"})\n *\n * @param args.accountAddress The account address we want to get the tokens for\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n * @param args.options.tokenStandard The NFT standard to query for\n * @param args.options.offset The number token to start returning results from\n * @param args.options.limit The number of results to return\n * @param args.options.orderBy The order to sort the tokens by\n * @returns Tokens array with the token data\n */\n async getAccountOwnedTokens(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n options?: TokenStandardArg & PaginationArgs & OrderByArg<GetAccountOwnedTokensQueryResponse[0]>;\n }): Promise<GetAccountOwnedTokensQueryResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.TOKEN_V2_PROCESSOR,\n });\n return getAccountOwnedTokens({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries all current tokens of a specific collection that an account owns by the collection address\n *\n * This query returns all tokens (v1 and v2 standards) an account owns, including NFTs, fungible, soulbound, etc.\n * If you want to get only the token from a specific standard, you can pass an optional tokenStandard param\n *\n * @example\n * const accountOwnedTokens = await aptos.getAccountOwnedTokensFromCollectionAddress({accountAddress:\"0x123\", collectionAddress:\"0x456\"})\n *\n * @param args.accountAddress The account address we want to get the tokens for\n * @param args.collectionAddress The address of the collection being queried\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n * @param args.options.tokenStandard The NFT standard to query for\n * @param args.options.offset The number token to start returning results from\n * @param args.options.limit The number of results to return\n * @param args.options.orderBy The order to sort the tokens by\n * @returns Tokens array with the token data\n */\n async getAccountOwnedTokensFromCollectionAddress(args: {\n accountAddress: AccountAddressInput;\n collectionAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n options?: TokenStandardArg & PaginationArgs & OrderByArg<GetAccountOwnedTokensFromCollectionResponse[0]>;\n }): Promise<GetAccountOwnedTokensFromCollectionResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.TOKEN_V2_PROCESSOR,\n });\n return getAccountOwnedTokensFromCollectionAddress({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries for all collections that an account currently has tokens for.\n *\n * This query returns all tokens (v1 and v2 standards) an account owns, including NFTs, fungible, soulbound, etc.\n * If you want to get only the token from a specific standard, you can pass an optional tokenStandard param\n *\n * @example\n * const accountCollectionsWithOwnedTokens = await aptos.getAccountCollectionsWithOwnedTokens({accountAddress:\"0x123\"})\n *\n * @param args.accountAddress The account address we want to get the collections for\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n * @param args.options.tokenStandard The NFT standard to query for\n * @param args.options.offset The number collection to start returning results from\n * @param args.options.limit The number of results to return\n * @param args.options.orderBy The order to sort the tokens by\n * @returns Collections array with the collections data\n */\n async getAccountCollectionsWithOwnedTokens(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n options?: TokenStandardArg & PaginationArgs & OrderByArg<GetAccountCollectionsWithOwnedTokenResponse[0]>;\n }): Promise<GetAccountCollectionsWithOwnedTokenResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.TOKEN_V2_PROCESSOR,\n });\n return getAccountCollectionsWithOwnedTokens({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries the current count of transactions submitted by an account\n *\n * @example\n * const accountTransactionsCount = await aptos.getAccountTransactionsCount({accountAddress:\"0x123\"})\n *\n * @param args.accountAddress The account address we want to get the total count for\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n * @returns Current count of transactions made by an account\n */\n async getAccountTransactionsCount(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n }): Promise<number> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.ACCOUNT_TRANSACTION_PROCESSOR,\n });\n return getAccountTransactionsCount({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries an account's coins data\n *\n * @example\n * const accountCoinsData = await aptos.getAccountCoinsData({accountAddress:\"0x123\"})\n *\n * @param args.accountAddress The account address we want to get the coins data for\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n * @param args.options.offset optional. The number coin to start returning results from\n * @param args.options.limit optional. The number of results to return\n * @param args.options.orderBy optional. The order to sort the coins by\n * @param args.options.where optional. Filter the results by\n * @returns Array with the coins data\n */\n async getAccountCoinsData(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n options?: PaginationArgs &\n OrderByArg<GetAccountCoinsDataResponse[0]> &\n WhereArg<CurrentFungibleAssetBalancesBoolExp>;\n }): Promise<GetAccountCoinsDataResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.FUNGIBLE_ASSET_PROCESSOR,\n });\n return getAccountCoinsData({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries the current count of an account's coins aggregated\n *\n * @example\n * const accountCoinsCount = await aptos.getAccountCoinsCount({accountAddress:\"0x123\"})\n *\n * @param args.accountAddress The account address we want to get the total count for\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n * @returns Current count of the aggregated count of all account's coins\n */\n async getAccountCoinsCount(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n }): Promise<number> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.FUNGIBLE_ASSET_PROCESSOR,\n });\n return getAccountCoinsCount({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries the account's APT amount\n *\n * @example\n * const accountAPTAmount = await aptos.getAccountAPTAmount({accountAddress:\"0x123\"})\n *\n * @param args.accountAddress The account address we want to get the total count for\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n * @returns Current amount of account's APT\n */\n async getAccountAPTAmount(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n }): Promise<number> {\n return this.getAccountCoinAmount({ coinType: APTOS_COIN, ...args });\n }\n\n /**\n * Queries the account's coin amount by the coin type\n *\n * @example\n * const accountCoinAmount = await aptos.getAccountCoinAmount({accountAddress:\"0x123\", coinType:\"0x1::aptos_coin::AptosCoin\"})\n *\n * @param args.accountAddress The account address we want to get the total count for\n * @param args.coinType The coin type to query\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n * @returns Current amount of account's coin\n */\n async getAccountCoinAmount(args: {\n accountAddress: AccountAddressInput;\n coinType: MoveStructId;\n minimumLedgerVersion?: AnyNumber;\n }): Promise<number> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.FUNGIBLE_ASSET_PROCESSOR,\n });\n return getAccountCoinAmount({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries an account's owned objects\n *\n * @example\n * const accountOwnedObjects = await aptos.getAccountOwnedObjects({accountAddress:\"0x123\"})\n *\n * @param args.accountAddress The account address we want to get the objects for\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n * @param args.options.offset The starting position to start returning results from\n * @param args.options.limit The number of results to return\n * @param args.options.orderBy The order to sort the objects by\n * @returns Objects array with the object data\n */\n async getAccountOwnedObjects(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n options?: PaginationArgs & OrderByArg<GetAccountOwnedObjectsResponse[0]>;\n }): Promise<GetAccountOwnedObjectsResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.DEFAULT,\n });\n return getAccountOwnedObjects({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Derives an account by providing a private key.\n * This functions resolves the provided private key type and derives the public key from it.\n *\n * If the privateKey is a Secp256k1 type, it derives the account using the derived public key and\n * auth key using the SingleKey scheme locally.\n *\n * If the privateKey is a ED25519 type, it looks up the authentication key on chain, and uses it to resolve\n * whether it is a Legacy ED25519 key or a Unified ED25519 key. It then derives the account based\n * on that.\n *\n * @example\n * const account = await aptos.deriveAccountFromPrivateKey({privateKey:new Ed25519PrivateKey(\"0x123\")})\n *\n * @param args.privateKey An account private key\n * @returns Account type\n */\n async deriveAccountFromPrivateKey(args: { privateKey: PrivateKey }): Promise<AccountModule> {\n return deriveAccountFromPrivateKey({ aptosConfig: this.config, ...args });\n }\n}\n"],"mappings":"2OAkDO,IAAMA,EAAN,KAAc,CACnB,YAAqBC,EAAqB,CAArB,YAAAA,CAAsB,CAiB3C,MAAM,eAAeC,EAAqE,CACxF,OAAOC,EAAQ,CAAE,YAAa,KAAK,OAAQ,GAAGD,CAAK,CAAC,CACtD,CAgBA,MAAM,kBAAkBA,EAGU,CAChC,OAAOE,EAAW,CAAE,YAAa,KAAK,OAAQ,GAAGF,CAAK,CAAC,CACzD,CAqBA,MAAM,iBAAiBA,EAIS,CAC9B,OAAOG,EAAU,CAAE,YAAa,KAAK,OAAQ,GAAGH,CAAK,CAAC,CACxD,CAiBA,MAAM,uBAAuBA,EAGM,CACjC,OAAOI,EAAgB,CACrB,YAAa,KAAK,OAClB,GAAGJ,CACL,CAAC,CACH,CAiBA,MAAM,oBAAoBA,EAGE,CAC1B,OAAOK,EAAa,CAAE,YAAa,KAAK,OAAQ,GAAGL,CAAK,CAAC,CAC3D,CAiBA,MAAM,mBAAuCA,EAI9B,CACb,OAAOM,EAAe,CAAE,YAAa,KAAK,OAAQ,GAAGN,CAAK,CAAC,CAC7D,CAeA,MAAM,6BAA6BA,E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,EAAqB,CAAE,YAAa,KAAK,OAAQ,GAAGf,CAAK,CAAC,CACnE,CAYA,MAAM,oBAAoBA,EAGN,CAClB,OAAO,KAAK,qBAAqB,CAAE,SAAUgB,EAAY,GAAGhB,CAAK,CAAC,CACpE,CAaA,MAAM,qBAAqBA,EAIP,CAClB,aAAMQ,EAAwB,CAC5B,OAAQ,KAAK,OACb,qBAAsBR,EAAK,qBAC3B,wCACF,CAAC,EACMiB,EAAqB,CAAE,YAAa,KAAK,OAAQ,GAAGjB,CAAK,CAAC,CACnE,CAeA,MAAM,uBAAuBA,EAIe,CAC1C,aAAMQ,EAAwB,CAC5B,OAAQ,KAAK,OACb,qBAAsBR,EAAK,qBAC3B,iCACF,CAAC,EACMkB,EAAuB,CAC5B,YAAa,KAAK,OAClB,GAAGlB,CACL,CAAC,CACH,CAmBA,MAAM,4BAA4BA,EAA0D,CAC1F,OAAOmB,EAA4B,CAAE,YAAa,KAAK,OAAQ,GAAGnB,CAAK,CAAC,CAC1E,CACF","names":["Account","config","args","getInfo","getModules","getModule","getTransactions","getResources","getResource","lookupOriginalAccountAddress","waitForIndexerOnVersion","getAccountTokensCount","getAccountOwnedTokens","getAccountOwnedTokensFromCollectionAddress","getAccountCollectionsWithOwnedTokens","getAccountTransactionsCount","getAccountCoinsData","getAccountCoinsCount","APTOS_COIN","getAccountCoinAmount","getAccountOwnedObjects","deriveAccountFromPrivateKey"]}
|
|
1
|
+
{"version":3,"sources":["../../src/api/account.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Account as AccountModule } from \"../account\";\nimport { AccountAddress, PrivateKey, AccountAddressInput } from \"../core\";\nimport {\n AccountData,\n AnyNumber,\n GetAccountCoinsDataResponse,\n GetAccountCollectionsWithOwnedTokenResponse,\n GetAccountOwnedObjectsResponse,\n GetAccountOwnedTokensFromCollectionResponse,\n GetAccountOwnedTokensQueryResponse,\n LedgerVersionArg,\n MoveModuleBytecode,\n MoveResource,\n MoveStructId,\n OrderByArg,\n PaginationArgs,\n TokenStandardArg,\n TransactionResponse,\n WhereArg,\n} from \"../types\";\nimport {\n deriveAccountFromPrivateKey,\n getAccountCoinAmount,\n getAccountCoinsCount,\n getAccountCoinsData,\n getAccountCollectionsWithOwnedTokens,\n getAccountOwnedObjects,\n getAccountOwnedTokens,\n getAccountOwnedTokensFromCollectionAddress,\n getAccountTokensCount,\n getAccountTransactionsCount,\n getInfo,\n getModule,\n getModules,\n getResource,\n getResources,\n getTransactions,\n lookupOriginalAccountAddress,\n} from \"../internal/account\";\nimport { APTOS_COIN, ProcessorType } from \"../utils/const\";\nimport { AptosConfig } from \"./aptosConfig\";\nimport { waitForIndexerOnVersion } from \"./utils\";\nimport { CurrentFungibleAssetBalancesBoolExp } from \"../types/generated/types\";\n\n/**\n * A class to query all `Account` related queries on Aptos.\n */\nexport class Account {\n constructor(readonly config: AptosConfig) {}\n\n /**\n * Queries the current state for an Aptos account given its account address\n *\n * @param args.accountAddress Aptos account address\n *\n * @returns The account data\n *\n * @example An example of the returned account\n * ```\n * {\n * sequence_number: \"1\",\n * authentication_key: \"0x5307b5f4bc67829097a8ba9b43dba3b88261eeccd1f709d9bde240fc100fbb69\"\n * }\n * ```\n */\n async getAccountInfo(args: { accountAddress: AccountAddressInput }): Promise<AccountData> {\n return getInfo({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries for all modules in an account given an account address\n *\n * Note: In order to get all account modules, this function may call the API\n * multiple times as it auto paginates.\n *\n * @param args.accountAddress Aptos account address\n * @param args.options.offset The number module to start returning results from\n * @param args.options.limit The number of results to return\n * @param args.options.ledgerVersion The ledger version to query, if not provided it will get the latest version\n *\n * @returns Account modules\n */\n\n async getAccountModules(args: {\n accountAddress: AccountAddressInput;\n options?: PaginationArgs & LedgerVersionArg;\n }): Promise<MoveModuleBytecode[]> {\n return getModules({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries for a specific account module given account address and module name\n *\n * @param args.accountAddress Aptos account address\n * @param args.moduleName The name of the module\n * @param args.options.ledgerVersion The ledger version to query, if not provided it will get the latest version\n *\n * @returns Account module\n *\n * @example\n * const module = await aptos.getAccountModule({accountAddress:\"0x456\"})\n * // An example of an account module response\n * ```\n * {\n * bytecode: \"0xa11ceb0b0600000006010002030206050807070f0d081c200\",\n * abi: { address: \"0x1\" }\n * }\n * ```\n */\n async getAccountModule(args: {\n accountAddress: AccountAddressInput;\n moduleName: string;\n options?: LedgerVersionArg;\n }): Promise<MoveModuleBytecode> {\n return getModule({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries account transactions given an account address\n *\n * Note: In order to get all account transactions, this function may call the API\n * multiple times as it auto paginates.\n *\n * @example\n * const transactions = await aptos.getAccountTransactions({accountAddress:\"0x456\"})\n *\n * @param args.accountAddress Aptos account address\n * @param args.options.offset The number transaction to start returning results from\n * @param args.options.limit The number of results to return\n *\n * @returns The account transactions\n */\n async getAccountTransactions(args: {\n accountAddress: AccountAddressInput;\n options?: PaginationArgs;\n }): Promise<TransactionResponse[]> {\n return getTransactions({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries all account resources given an account address\n *\n * Note: In order to get all account resources, this function may call the API\n * multiple times as it auto paginates.\n *\n * @example\n * const resources = await aptos.getAccountResources({accountAddress:\"0x456\"})\n *\n * @param args.accountAddress Aptos account address\n * @param args.options.offset The number resource to start returning results from\n * @param args.options.limit The number of results to return\n * @param args.options.ledgerVersion The ledger version to query, if not provided it will get the latest version\n * @returns Account resources\n */\n async getAccountResources(args: {\n accountAddress: AccountAddressInput;\n options?: PaginationArgs & LedgerVersionArg;\n }): Promise<MoveResource[]> {\n return getResources({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries a specific account resource given account address and resource type. Note that the default is `any` in order\n * to allow for ease of accessing properties of the object.\n *\n * @type The typed output of the resource\n * @param args.accountAddress Aptos account address\n * @param args.resourceType String representation of an on-chain Move struct type, i.e \"0x1::aptos_coin::AptosCoin\"\n * @param args.options.ledgerVersion The ledger version to query, if not provided it will get the latest version\n *\n * @returns Account resource\n *\n * @example\n * const resource = await aptos.getAccountResource({accountAddress:\"0x456\"})\n *\n */\n async getAccountResource<T extends {} = any>(args: {\n accountAddress: AccountAddressInput;\n resourceType: MoveStructId;\n options?: LedgerVersionArg;\n }): Promise<T> {\n return getResource<T>({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Looks up the account address for a given authentication key\n *\n * This handles both if the account's authentication key has been rotated or not.\n *\n * @example\n * const accountAddress = await aptos.lookupOriginalAccountAddress({authenticationKey:account.accountAddress})\n *\n * @param args.authenticationKey The authentication key\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n * @param args.options.ledgerVersion The ledger version to query, if not provided it will get the latest version\n * @returns Promise<AccountAddress> The accountAddress associated with the authentication key\n */\n async lookupOriginalAccountAddress(args: {\n authenticationKey: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n options?: LedgerVersionArg;\n }): Promise<AccountAddress> {\n return lookupOriginalAccountAddress({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries the current count of tokens owned by an account\n *\n * @example\n * const tokensCount = await aptos.getAccountTokensCount({accountAddress:\"0x456\"})\n *\n * @param args.accountAddress The account address\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n * @returns Current count of tokens owned by the account\n */\n async getAccountTokensCount(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n }): Promise<number> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.ACCOUNT_TRANSACTION_PROCESSOR,\n });\n return getAccountTokensCount({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries the account's current owned tokens.\n *\n * This query returns all tokens (v1 and v2 standards) an account owns, including NFTs, fungible, soulbound, etc.\n * If you want to get only the token from a specific standard, you can pass an optional tokenStandard param\n *\n * @example\n * const accountOwnedTokens = await aptos.getAccountOwnedTokens({accountAddress:\"0x456\"})\n *\n * @param args.accountAddress The account address we want to get the tokens for\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n * @param args.options.tokenStandard The NFT standard to query for\n * @param args.options.offset The number token to start returning results from\n * @param args.options.limit The number of results to return\n * @param args.options.orderBy The order to sort the tokens by\n * @returns Tokens array with the token data\n */\n async getAccountOwnedTokens(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n options?: TokenStandardArg & PaginationArgs & OrderByArg<GetAccountOwnedTokensQueryResponse[0]>;\n }): Promise<GetAccountOwnedTokensQueryResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.TOKEN_V2_PROCESSOR,\n });\n return getAccountOwnedTokens({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries all current tokens of a specific collection that an account owns by the collection address\n *\n * This query returns all tokens (v1 and v2 standards) an account owns, including NFTs, fungible, soulbound, etc.\n * If you want to get only the token from a specific standard, you can pass an optional tokenStandard param\n *\n * @example\n * const accountOwnedTokens = await aptos.getAccountOwnedTokensFromCollectionAddress({accountAddress:\"0x123\", collectionAddress:\"0x456\"})\n *\n * @param args.accountAddress The account address we want to get the tokens for\n * @param args.collectionAddress The address of the collection being queried\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n * @param args.options.tokenStandard The NFT standard to query for\n * @param args.options.offset The number token to start returning results from\n * @param args.options.limit The number of results to return\n * @param args.options.orderBy The order to sort the tokens by\n * @returns Tokens array with the token data\n */\n async getAccountOwnedTokensFromCollectionAddress(args: {\n accountAddress: AccountAddressInput;\n collectionAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n options?: TokenStandardArg & PaginationArgs & OrderByArg<GetAccountOwnedTokensFromCollectionResponse[0]>;\n }): Promise<GetAccountOwnedTokensFromCollectionResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.TOKEN_V2_PROCESSOR,\n });\n return getAccountOwnedTokensFromCollectionAddress({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries for all collections that an account currently has tokens for.\n *\n * This query returns all tokens (v1 and v2 standards) an account owns, including NFTs, fungible, soulbound, etc.\n * If you want to get only the token from a specific standard, you can pass an optional tokenStandard param\n *\n * @example\n * const accountCollectionsWithOwnedTokens = await aptos.getAccountCollectionsWithOwnedTokens({accountAddress:\"0x123\"})\n *\n * @param args.accountAddress The account address we want to get the collections for\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n * @param args.options.tokenStandard The NFT standard to query for\n * @param args.options.offset The number collection to start returning results from\n * @param args.options.limit The number of results to return\n * @param args.options.orderBy The order to sort the tokens by\n * @returns Collections array with the collections data\n */\n async getAccountCollectionsWithOwnedTokens(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n options?: TokenStandardArg & PaginationArgs & OrderByArg<GetAccountCollectionsWithOwnedTokenResponse[0]>;\n }): Promise<GetAccountCollectionsWithOwnedTokenResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.TOKEN_V2_PROCESSOR,\n });\n return getAccountCollectionsWithOwnedTokens({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries the current count of transactions submitted by an account\n *\n * @example\n * const accountTransactionsCount = await aptos.getAccountTransactionsCount({accountAddress:\"0x123\"})\n *\n * @param args.accountAddress The account address we want to get the total count for\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n * @returns Current count of transactions made by an account\n */\n async getAccountTransactionsCount(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n }): Promise<number> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.ACCOUNT_TRANSACTION_PROCESSOR,\n });\n return getAccountTransactionsCount({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries an account's coins data\n *\n * @example\n * const accountCoinsData = await aptos.getAccountCoinsData({accountAddress:\"0x123\"})\n *\n * @param args.accountAddress The account address we want to get the coins data for\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n * @param args.options.offset optional. The number coin to start returning results from\n * @param args.options.limit optional. The number of results to return\n * @param args.options.orderBy optional. The order to sort the coins by\n * @param args.options.where optional. Filter the results by\n * @returns Array with the coins data\n */\n async getAccountCoinsData(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n options?: PaginationArgs &\n OrderByArg<GetAccountCoinsDataResponse[0]> &\n WhereArg<CurrentFungibleAssetBalancesBoolExp>;\n }): Promise<GetAccountCoinsDataResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.FUNGIBLE_ASSET_PROCESSOR,\n });\n return getAccountCoinsData({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries the current count of an account's coins aggregated\n *\n * @example\n * const accountCoinsCount = await aptos.getAccountCoinsCount({accountAddress:\"0x123\"})\n *\n * @param args.accountAddress The account address we want to get the total count for\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n * @returns Current count of the aggregated count of all account's coins\n */\n async getAccountCoinsCount(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n }): Promise<number> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.FUNGIBLE_ASSET_PROCESSOR,\n });\n return getAccountCoinsCount({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries the account's APT amount\n *\n * @example\n * const accountAPTAmount = await aptos.getAccountAPTAmount({accountAddress:\"0x123\"})\n *\n * @param args.accountAddress The account address we want to get the total count for\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n * @returns Current amount of account's APT\n */\n async getAccountAPTAmount(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n }): Promise<number> {\n return this.getAccountCoinAmount({ coinType: APTOS_COIN, ...args });\n }\n\n /**\n * Queries the account's coin amount by the coin type\n *\n * @example\n * const accountCoinAmount = await aptos.getAccountCoinAmount({accountAddress:\"0x123\", coinType:\"0x1::aptos_coin::AptosCoin\"})\n *\n * @param args.accountAddress The account address we want to get the total count for\n * @param args.coinType The coin type to query\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n * @returns Current amount of account's coin\n */\n async getAccountCoinAmount(args: {\n accountAddress: AccountAddressInput;\n coinType: MoveStructId;\n minimumLedgerVersion?: AnyNumber;\n }): Promise<number> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.FUNGIBLE_ASSET_PROCESSOR,\n });\n return getAccountCoinAmount({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries an account's owned objects\n *\n * @example\n * const accountOwnedObjects = await aptos.getAccountOwnedObjects({accountAddress:\"0x123\"})\n *\n * @param args.accountAddress The account address we want to get the objects for\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n * @param args.options.offset The starting position to start returning results from\n * @param args.options.limit The number of results to return\n * @param args.options.orderBy The order to sort the objects by\n * @returns Objects array with the object data\n */\n async getAccountOwnedObjects(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n options?: PaginationArgs & OrderByArg<GetAccountOwnedObjectsResponse[0]>;\n }): Promise<GetAccountOwnedObjectsResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.DEFAULT,\n });\n return getAccountOwnedObjects({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Derives an account by providing a private key.\n * This functions resolves the provided private key type and derives the public key from it.\n *\n * If the privateKey is a Secp256k1 type, it derives the account using the derived public key and\n * auth key using the SingleKey scheme locally.\n *\n * If the privateKey is a ED25519 type, it looks up the authentication key on chain, and uses it to resolve\n * whether it is a Legacy ED25519 key or a Unified ED25519 key. It then derives the account based\n * on that.\n *\n * @example\n * const account = await aptos.deriveAccountFromPrivateKey({privateKey:new Ed25519PrivateKey(\"0x123\")})\n *\n * @param args.privateKey An account private key\n * @returns Account type\n */\n async deriveAccountFromPrivateKey(args: { privateKey: PrivateKey }): Promise<AccountModule> {\n return deriveAccountFromPrivateKey({ aptosConfig: this.config, ...args });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAkDO,IAAM,UAAN,MAAc;AAAA,EACnB,YAAqB,QAAqB;AAArB;AAAA,EAAsB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAiB3C,MAAM,eAAe,MAAqE;AACxF,WAAO,QAAQ,EAAE,aAAa,KAAK,QAAQ,GAAG,KAAK,CAAC;AAAA,EACtD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAgBA,MAAM,kBAAkB,MAGU;AAChC,WAAO,WAAW,EAAE,aAAa,KAAK,QAAQ,GAAG,KAAK,CAAC;AAAA,EACzD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAqBA,MAAM,iBAAiB,MAIS;AAC9B,WAAO,UAAU,EAAE,aAAa,KAAK,QAAQ,GAAG,KAAK,CAAC;AAAA,EACxD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAiBA,MAAM,uBAAuB,MAGM;AACjC,WAAO,gBAAgB;AAAA,MACrB,aAAa,KAAK;AAAA,MAClB,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AG,KAAK,CAAC;AAAA,EAC1E;AACF;","names":[]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Serializable
|
|
3
|
+
} from "./chunk-FQQW55X7.mjs";
|
|
4
|
+
import {
|
|
5
|
+
Hex
|
|
6
|
+
} from "./chunk-YV7M4CFP.mjs";
|
|
7
|
+
|
|
8
|
+
// src/core/crypto/signature.ts
|
|
9
|
+
var Signature = class extends Serializable {
|
|
10
|
+
/**
|
|
11
|
+
* Get the signature as a hex string with a 0x prefix e.g. 0x123456...
|
|
12
|
+
*/
|
|
13
|
+
toString() {
|
|
14
|
+
const bytes = this.toUint8Array();
|
|
15
|
+
return Hex.fromHexInput(bytes).toString();
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export {
|
|
20
|
+
Signature
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=chunk-FDWJNY4U.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/core/crypto/signature.ts"],"sourcesContent":["import { Serializable } from \"../../bcs\";\nimport { Hex } from \"../hex\";\n\n/**\n * An abstract representation of a crypto signature,\n * associated to a specific signature scheme e.g. Ed25519 or Secp256k1\n *\n * This is the product of signing a message directly from a PrivateKey\n * and can be verified against a CryptoPublicKey.\n */\nexport abstract class Signature extends Serializable {\n /**\n * Get the raw signature bytes\n */\n abstract toUint8Array(): Uint8Array;\n\n /**\n * Get the signature as a hex string with a 0x prefix e.g. 0x123456...\n */\n toString(): string {\n const bytes = this.toUint8Array();\n return Hex.fromHexInput(bytes).toString();\n }\n}\n\n/**\n * An abstract representation of an account signature,\n * associated to a specific authentication scheme e.g. Ed25519 or SingleKey\n *\n * This is the product of signing a message through an account,\n * and can be verified against an AccountPublicKey.\n */\n// export abstract class AccountSignature extends Serializable {\n// /**\n// * Get the raw signature bytes\n// */\n// abstract toUint8Array(): Uint8Array;\n//\n// /**\n// * Get the signature as a hex string with a 0x prefix e.g. 0x123456...\n// */\n// toString(): string {\n// const bytes = this.toUint8Array();\n// return Hex.fromHexInput(bytes).toString();\n// }\n// }\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/core/crypto/signature.ts"],"sourcesContent":["import { Serializable } from \"../../bcs\";\nimport { Hex } from \"../hex\";\n\n/**\n * An abstract representation of a crypto signature,\n * associated to a specific signature scheme e.g. Ed25519 or Secp256k1\n *\n * This is the product of signing a message directly from a PrivateKey\n * and can be verified against a CryptoPublicKey.\n */\nexport abstract class Signature extends Serializable {\n /**\n * Get the raw signature bytes\n */\n abstract toUint8Array(): Uint8Array;\n\n /**\n * Get the signature as a hex string with a 0x prefix e.g. 0x123456...\n */\n toString(): string {\n const bytes = this.toUint8Array();\n return Hex.fromHexInput(bytes).toString();\n }\n}\n\n/**\n * An abstract representation of an account signature,\n * associated to a specific authentication scheme e.g. Ed25519 or SingleKey\n *\n * This is the product of signing a message through an account,\n * and can be verified against an AccountPublicKey.\n */\n// export abstract class AccountSignature extends Serializable {\n// /**\n// * Get the raw signature bytes\n// */\n// abstract toUint8Array(): Uint8Array;\n//\n// /**\n// * Get the signature as a hex string with a 0x prefix e.g. 0x123456...\n// */\n// toString(): string {\n// const bytes = this.toUint8Array();\n// return Hex.fromHexInput(bytes).toString();\n// }\n// }\n"],"mappings":";;;;;;;;AAUO,IAAe,YAAf,cAAiC,aAAa;AAAA;AAAA;AAAA;AAAA,EASnD,WAAmB;AACjB,UAAM,QAAQ,KAAK,aAAa;AAChC,WAAO,IAAI,aAAa,KAAK,EAAE,SAAS;AAAA,EAC1C;AACF;","names":[]}
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Simulate
|
|
3
|
+
} from "./chunk-W76MGKZB.mjs";
|
|
4
|
+
import {
|
|
5
|
+
Submit
|
|
6
|
+
} from "./chunk-7IDBB4J4.mjs";
|
|
7
|
+
import {
|
|
8
|
+
Build
|
|
9
|
+
} from "./chunk-7FUHWL6A.mjs";
|
|
10
|
+
import {
|
|
11
|
+
TransactionManagement
|
|
12
|
+
} from "./chunk-WDRH2URB.mjs";
|
|
13
|
+
import {
|
|
14
|
+
getSigningMessage,
|
|
15
|
+
publicPackageTransaction,
|
|
16
|
+
rotateAuthKey,
|
|
17
|
+
signAndSubmitTransaction,
|
|
18
|
+
signTransaction
|
|
19
|
+
} from "./chunk-IHNPN5CQ.mjs";
|
|
20
|
+
import {
|
|
21
|
+
getGasPriceEstimation,
|
|
22
|
+
getTransactionByHash,
|
|
23
|
+
getTransactionByVersion,
|
|
24
|
+
getTransactions,
|
|
25
|
+
isTransactionPending,
|
|
26
|
+
waitForTransaction
|
|
27
|
+
} from "./chunk-TBHU6ZW6.mjs";
|
|
28
|
+
|
|
29
|
+
// src/api/transaction.ts
|
|
30
|
+
var Transaction = class {
|
|
31
|
+
constructor(config) {
|
|
32
|
+
this.config = config;
|
|
33
|
+
this.build = new Build(this.config);
|
|
34
|
+
this.simulate = new Simulate(this.config);
|
|
35
|
+
this.submit = new Submit(this.config);
|
|
36
|
+
this.batch = new TransactionManagement(this.config);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Queries on-chain transactions. This function will not return pending
|
|
40
|
+
* transactions. For that, use `getTransactionsByHash`.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* const transactions = await aptos.getTransactions()
|
|
44
|
+
*
|
|
45
|
+
* @param args.options.offset The number transaction to start with
|
|
46
|
+
* @param args.options.limit Number of results to return
|
|
47
|
+
*
|
|
48
|
+
* @returns Array of on-chain transactions
|
|
49
|
+
*/
|
|
50
|
+
async getTransactions(args) {
|
|
51
|
+
return getTransactions({
|
|
52
|
+
aptosConfig: this.config,
|
|
53
|
+
...args
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Queries on-chain transaction by version. This function will not return pending transactions.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* const transaction = await aptos.getTransactions({ledgerVersion:1})
|
|
61
|
+
*
|
|
62
|
+
* @param args.ledgerVersion - Transaction version is an unsigned 64-bit number.
|
|
63
|
+
* @returns On-chain transaction. Only on-chain transactions have versions, so this
|
|
64
|
+
* function cannot be used to query pending transactions.
|
|
65
|
+
*/
|
|
66
|
+
async getTransactionByVersion(args) {
|
|
67
|
+
return getTransactionByVersion({
|
|
68
|
+
aptosConfig: this.config,
|
|
69
|
+
...args
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Queries on-chain transaction by transaction hash. This function will return pending transactions.
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* const transaction = await aptos.getTransactionByHash({transactionHash:"0x123"})
|
|
77
|
+
*
|
|
78
|
+
* @param args.transactionHash - Transaction hash should be hex-encoded bytes string with 0x prefix.
|
|
79
|
+
* @returns Transaction from mempool (pending) or on-chain (committed) transaction
|
|
80
|
+
*/
|
|
81
|
+
async getTransactionByHash(args) {
|
|
82
|
+
return getTransactionByHash({
|
|
83
|
+
aptosConfig: this.config,
|
|
84
|
+
...args
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Defines if specified transaction is currently in pending state
|
|
89
|
+
*
|
|
90
|
+
* To create a transaction hash:
|
|
91
|
+
*
|
|
92
|
+
* 1. Create a hash message from the bytes: "Aptos::Transaction" bytes + the BCS-serialized Transaction bytes.
|
|
93
|
+
* 2. Apply hash algorithm SHA3-256 to the hash message bytes.
|
|
94
|
+
* 3. Hex-encode the hash bytes with 0x prefix.
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* const isPendingTransaction = await aptos.isPendingTransaction({transactionHash:"0x123"})
|
|
98
|
+
*
|
|
99
|
+
* @param args.transactionHash A hash of transaction
|
|
100
|
+
* @returns `true` if transaction is in pending state and `false` otherwise
|
|
101
|
+
*/
|
|
102
|
+
async isPendingTransaction(args) {
|
|
103
|
+
return isTransactionPending({
|
|
104
|
+
aptosConfig: this.config,
|
|
105
|
+
...args
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Waits for a transaction to move past the pending state.
|
|
110
|
+
*
|
|
111
|
+
* There are 4 cases.
|
|
112
|
+
* 1. Transaction is successfully processed and committed to the chain.
|
|
113
|
+
* - The function will resolve with the transaction response from the API.
|
|
114
|
+
* 2. Transaction is rejected for some reason, and is therefore not committed to the blockchain.
|
|
115
|
+
* - The function will throw an AptosApiError with an HTTP status code indicating some problem with the request.
|
|
116
|
+
* 3. Transaction is committed but execution failed, meaning no changes were
|
|
117
|
+
* written to the blockchain state.
|
|
118
|
+
* - If `checkSuccess` is true, the function will throw a FailedTransactionError
|
|
119
|
+
* If `checkSuccess` is false, the function will resolve with the transaction response where the `success` field is false.
|
|
120
|
+
* 4. Transaction does not move past the pending state within `args.options.timeoutSecs` seconds.
|
|
121
|
+
* - The function will throw a WaitForTransactionError
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
* const transaction = await aptos.waitForTransaction({transactionHash:"0x123"})
|
|
125
|
+
*
|
|
126
|
+
* @param args.transactionHash The hash of a transaction previously submitted to the blockchain.
|
|
127
|
+
* @param args.options.timeoutSecs Timeout in seconds. Defaults to 20 seconds.
|
|
128
|
+
* @param args.options.checkSuccess A boolean which controls whether the function will error if the transaction failed.
|
|
129
|
+
* Defaults to true. See case 3 above.
|
|
130
|
+
* @returns The transaction on-chain. See above for more details.
|
|
131
|
+
*/
|
|
132
|
+
async waitForTransaction(args) {
|
|
133
|
+
return waitForTransaction({
|
|
134
|
+
aptosConfig: this.config,
|
|
135
|
+
...args
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Gives an estimate of the gas unit price required to get a
|
|
140
|
+
* transaction on chain in a reasonable amount of time.
|
|
141
|
+
* For more information {@link https://api.mainnet.aptoslabs.com/v1/spec#/operations/estimate_gas_price}
|
|
142
|
+
*
|
|
143
|
+
* @returns Object holding the outputs of the estimate gas API
|
|
144
|
+
*
|
|
145
|
+
* @example
|
|
146
|
+
* const gasPrice = await aptos.waitForTransaction()
|
|
147
|
+
*/
|
|
148
|
+
async getGasPriceEstimation() {
|
|
149
|
+
return getGasPriceEstimation({
|
|
150
|
+
aptosConfig: this.config
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Returns a signing message for a transaction.
|
|
155
|
+
*
|
|
156
|
+
* This allows a user to sign a transaction using their own preferred signing method, and
|
|
157
|
+
* then submit it to the network.
|
|
158
|
+
*
|
|
159
|
+
* @example
|
|
160
|
+
* const transaction = await aptos.transaction.build.simple({...})
|
|
161
|
+
* const message = await aptos.getSigningMessage({transaction})
|
|
162
|
+
*
|
|
163
|
+
* @param args.transaction A raw transaction for signing elsewhere
|
|
164
|
+
*/
|
|
165
|
+
// eslint-disable-next-line class-methods-use-this
|
|
166
|
+
getSigningMessage(args) {
|
|
167
|
+
return getSigningMessage(args);
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Generates a transaction to publish a move package to chain.
|
|
171
|
+
*
|
|
172
|
+
* To get the `metadataBytes` and `byteCode`, can compile using Aptos CLI with command
|
|
173
|
+
* `aptos move compile --save-metadata ...`,
|
|
174
|
+
* For more info {@link https://aptos.dev/tutorials/your-first-dapp/#step-4-publish-a-move-module}
|
|
175
|
+
*
|
|
176
|
+
* @example
|
|
177
|
+
* const transaction = await aptos.publishPackageTransaction({
|
|
178
|
+
* account: alice,
|
|
179
|
+
* metadataBytes,
|
|
180
|
+
* moduleBytecode: [byteCode],
|
|
181
|
+
* })
|
|
182
|
+
*
|
|
183
|
+
* @param args.account The publisher account
|
|
184
|
+
* @param args.metadataBytes The package metadata bytes
|
|
185
|
+
* @param args.moduleBytecode An array of the bytecode of each module in the package in compiler output order
|
|
186
|
+
*
|
|
187
|
+
* @returns A SimpleTransaction that can be simulated or submitted to chain
|
|
188
|
+
*/
|
|
189
|
+
async publishPackageTransaction(args) {
|
|
190
|
+
return publicPackageTransaction({ aptosConfig: this.config, ...args });
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Rotate an account's auth key. After rotation, only the new private key can be used to sign txns for
|
|
194
|
+
* the account.
|
|
195
|
+
* Note: Only legacy Ed25519 scheme is supported for now.
|
|
196
|
+
* More info: {@link https://aptos.dev/guides/account-management/key-rotation/}
|
|
197
|
+
*
|
|
198
|
+
* @example
|
|
199
|
+
* const response = await aptos.rotateAuthKey({
|
|
200
|
+
* fromAccount: alice,
|
|
201
|
+
* toNewPrivateKey: new ED25519PublicKey("0x123"),
|
|
202
|
+
* })
|
|
203
|
+
*
|
|
204
|
+
* @param args.fromAccount The account to rotate the auth key for
|
|
205
|
+
* @param args.toNewPrivateKey The new private key to rotate to
|
|
206
|
+
*
|
|
207
|
+
* @returns PendingTransactionResponse
|
|
208
|
+
*/
|
|
209
|
+
async rotateAuthKey(args) {
|
|
210
|
+
return rotateAuthKey({ aptosConfig: this.config, ...args });
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Sign a transaction that can later be submitted to chain
|
|
214
|
+
*
|
|
215
|
+
* @example
|
|
216
|
+
* const transaction = await aptos.transaction.build.simple({...})
|
|
217
|
+
* const transaction = await aptos.transaction.sign({
|
|
218
|
+
* signer: alice,
|
|
219
|
+
* transaction
|
|
220
|
+
* })
|
|
221
|
+
*
|
|
222
|
+
* @param args.signer The signer account
|
|
223
|
+
* @param args.transaction A raw transaction to sign on
|
|
224
|
+
*
|
|
225
|
+
* @returns AccountAuthenticator
|
|
226
|
+
*/
|
|
227
|
+
// eslint-disable-next-line class-methods-use-this
|
|
228
|
+
sign(args) {
|
|
229
|
+
return signTransaction({
|
|
230
|
+
...args
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Sign a transaction as a fee payer that can later be submitted to chain
|
|
235
|
+
*
|
|
236
|
+
* @example
|
|
237
|
+
* const transaction = await aptos.transaction.build.simple({...})
|
|
238
|
+
* const transaction = await aptos.transaction.signAsFeePayer({
|
|
239
|
+
* signer: alice,
|
|
240
|
+
* transaction
|
|
241
|
+
* })
|
|
242
|
+
*
|
|
243
|
+
* @param args.signer The fee payer signer account
|
|
244
|
+
* @param args.transaction A raw transaction to sign on
|
|
245
|
+
*
|
|
246
|
+
* @returns AccountAuthenticator
|
|
247
|
+
*/
|
|
248
|
+
// eslint-disable-next-line class-methods-use-this
|
|
249
|
+
signAsFeePayer(args) {
|
|
250
|
+
const { signer, transaction } = args;
|
|
251
|
+
if (!transaction.feePayerAddress) {
|
|
252
|
+
throw new Error(`Transaction ${transaction} is not a Fee Payer transaction`);
|
|
253
|
+
}
|
|
254
|
+
transaction.feePayerAddress = signer.accountAddress;
|
|
255
|
+
return signTransaction({
|
|
256
|
+
signer,
|
|
257
|
+
transaction
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
// TRANSACTION SUBMISSION //
|
|
261
|
+
/**
|
|
262
|
+
* @deprecated Prefer to use `aptos.transaction.batch.forSingleAccount()`
|
|
263
|
+
*
|
|
264
|
+
* Batch transactions for a single account.
|
|
265
|
+
*
|
|
266
|
+
* This function uses a transaction worker that receives payloads to be processed
|
|
267
|
+
* and submitted to chain.
|
|
268
|
+
* Note that this process is best for submitting multiple transactions that
|
|
269
|
+
* dont rely on each other, i.e batch funds, batch token mints, etc.
|
|
270
|
+
*
|
|
271
|
+
* If any worker failure, the functions throws an error.
|
|
272
|
+
*
|
|
273
|
+
* @param args.sender The sender account to sign and submit the transaction
|
|
274
|
+
* @param args.data An array of transaction payloads
|
|
275
|
+
* @param args.options optional. Transaction generation configurations (excluding accountSequenceNumber)
|
|
276
|
+
*
|
|
277
|
+
* @return void. Throws if any error
|
|
278
|
+
*/
|
|
279
|
+
async batchTransactionsForSingleAccount(args) {
|
|
280
|
+
try {
|
|
281
|
+
const { sender, data, options } = args;
|
|
282
|
+
this.batch.forSingleAccount({ sender, data, options });
|
|
283
|
+
} catch (error) {
|
|
284
|
+
throw new Error(`failed to submit transactions with error: ${error}`);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Sign and submit a single signer transaction to chain
|
|
289
|
+
*
|
|
290
|
+
* @param args.signer The signer account to sign the transaction
|
|
291
|
+
* @param args.transaction An instance of a RawTransaction, plus optional secondary/fee payer addresses
|
|
292
|
+
*
|
|
293
|
+
* @example
|
|
294
|
+
* const transaction = await aptos.transaction.build.simple({...})
|
|
295
|
+
* const transaction = await aptos.signAndSubmitTransaction({
|
|
296
|
+
* signer: alice,
|
|
297
|
+
* transaction
|
|
298
|
+
* })
|
|
299
|
+
*
|
|
300
|
+
* @return PendingTransactionResponse
|
|
301
|
+
*/
|
|
302
|
+
async signAndSubmitTransaction(args) {
|
|
303
|
+
const { signer, transaction } = args;
|
|
304
|
+
return signAndSubmitTransaction({
|
|
305
|
+
aptosConfig: this.config,
|
|
306
|
+
signer,
|
|
307
|
+
transaction
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
export {
|
|
313
|
+
Transaction
|
|
314
|
+
};
|
|
315
|
+
//# sourceMappingURL=chunk-FF4JPDKD.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/api/transaction.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { AptosConfig } from \"./aptosConfig\";\nimport {\n getGasPriceEstimation,\n getTransactionByHash,\n getTransactionByVersion,\n getTransactions,\n isTransactionPending,\n waitForTransaction,\n} from \"../internal/transaction\";\nimport {\n AnyNumber,\n CommittedTransactionResponse,\n GasEstimation,\n HexInput,\n PaginationArgs,\n PendingTransactionResponse,\n TransactionResponse,\n WaitForTransactionOptions,\n} from \"../types\";\nimport {\n getSigningMessage,\n publicPackageTransaction,\n rotateAuthKey,\n signAndSubmitTransaction,\n signTransaction,\n} from \"../internal/transactionSubmission\";\nimport {\n AccountAuthenticator,\n AnyRawTransaction,\n InputGenerateTransactionOptions,\n InputGenerateTransactionPayloadData,\n} from \"../transactions\";\nimport { AccountAddressInput, PrivateKey } from \"../core\";\nimport { Account } from \"../account\";\nimport { Build } from \"./transactionSubmission/build\";\nimport { Simulate } from \"./transactionSubmission/simulate\";\nimport { Submit } from \"./transactionSubmission/submit\";\nimport { TransactionManagement } from \"./transactionSubmission/management\";\nimport { SimpleTransaction } from \"../transactions/instances/simpleTransaction\";\n\nexport class Transaction {\n readonly config: AptosConfig;\n\n readonly build: Build;\n\n readonly simulate: Simulate;\n\n readonly submit: Submit;\n\n readonly batch: TransactionManagement;\n\n constructor(config: AptosConfig) {\n this.config = config;\n this.build = new Build(this.config);\n this.simulate = new Simulate(this.config);\n this.submit = new Submit(this.config);\n this.batch = new TransactionManagement(this.config);\n }\n\n /**\n * Queries on-chain transactions. This function will not return pending\n * transactions. For that, use `getTransactionsByHash`.\n *\n * @example\n * const transactions = await aptos.getTransactions()\n *\n * @param args.options.offset The number transaction to start with\n * @param args.options.limit Number of results to return\n *\n * @returns Array of on-chain transactions\n */\n async getTransactions(args?: { options?: PaginationArgs }): Promise<TransactionResponse[]> {\n return getTransactions({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries on-chain transaction by version. This function will not return pending transactions.\n *\n * @example\n * const transaction = await aptos.getTransactions({ledgerVersion:1})\n *\n * @param args.ledgerVersion - Transaction version is an unsigned 64-bit number.\n * @returns On-chain transaction. Only on-chain transactions have versions, so this\n * function cannot be used to query pending transactions.\n */\n async getTransactionByVersion(args: { ledgerVersion: AnyNumber }): Promise<TransactionResponse> {\n return getTransactionByVersion({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries on-chain transaction by transaction hash. This function will return pending transactions.\n *\n * @example\n * const transaction = await aptos.getTransactionByHash({transactionHash:\"0x123\"})\n *\n * @param args.transactionHash - Transaction hash should be hex-encoded bytes string with 0x prefix.\n * @returns Transaction from mempool (pending) or on-chain (committed) transaction\n */\n async getTransactionByHash(args: { transactionHash: HexInput }): Promise<TransactionResponse> {\n return getTransactionByHash({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Defines if specified transaction is currently in pending state\n *\n * To create a transaction hash:\n *\n * 1. Create a hash message from the bytes: \"Aptos::Transaction\" bytes + the BCS-serialized Transaction bytes.\n * 2. Apply hash algorithm SHA3-256 to the hash message bytes.\n * 3. Hex-encode the hash bytes with 0x prefix.\n *\n * @example\n * const isPendingTransaction = await aptos.isPendingTransaction({transactionHash:\"0x123\"})\n *\n * @param args.transactionHash A hash of transaction\n * @returns `true` if transaction is in pending state and `false` otherwise\n */\n async isPendingTransaction(args: { transactionHash: HexInput }): Promise<boolean> {\n return isTransactionPending({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Waits for a transaction to move past the pending state.\n *\n * There are 4 cases.\n * 1. Transaction is successfully processed and committed to the chain.\n * - The function will resolve with the transaction response from the API.\n * 2. Transaction is rejected for some reason, and is therefore not committed to the blockchain.\n * - The function will throw an AptosApiError with an HTTP status code indicating some problem with the request.\n * 3. Transaction is committed but execution failed, meaning no changes were\n * written to the blockchain state.\n * - If `checkSuccess` is true, the function will throw a FailedTransactionError\n * If `checkSuccess` is false, the function will resolve with the transaction response where the `success` field is false.\n * 4. Transaction does not move past the pending state within `args.options.timeoutSecs` seconds.\n * - The function will throw a WaitForTransactionError\n *\n * @example\n * const transaction = await aptos.waitForTransaction({transactionHash:\"0x123\"})\n *\n * @param args.transactionHash The hash of a transaction previously submitted to the blockchain.\n * @param args.options.timeoutSecs Timeout in seconds. Defaults to 20 seconds.\n * @param args.options.checkSuccess A boolean which controls whether the function will error if the transaction failed.\n * Defaults to true. See case 3 above.\n * @returns The transaction on-chain. See above for more details.\n */\n async waitForTransaction(args: {\n transactionHash: HexInput;\n options?: WaitForTransactionOptions;\n }): Promise<CommittedTransactionResponse> {\n return waitForTransaction({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Gives an estimate of the gas unit price required to get a\n * transaction on chain in a reasonable amount of time.\n * For more information {@link https://api.mainnet.aptoslabs.com/v1/spec#/operations/estimate_gas_price}\n *\n * @returns Object holding the outputs of the estimate gas API\n *\n * @example\n * const gasPrice = await aptos.waitForTransaction()\n */\n async getGasPriceEstimation(): Promise<GasEstimation> {\n return getGasPriceEstimation({\n aptosConfig: this.config,\n });\n }\n\n /**\n * Returns a signing message for a transaction.\n *\n * This allows a user to sign a transaction using their own preferred signing method, and\n * then submit it to the network.\n *\n * @example\n * const transaction = await aptos.transaction.build.simple({...})\n * const message = await aptos.getSigningMessage({transaction})\n *\n * @param args.transaction A raw transaction for signing elsewhere\n */\n // eslint-disable-next-line class-methods-use-this\n getSigningMessage(args: { transaction: AnyRawTransaction }): Uint8Array {\n return getSigningMessage(args);\n }\n\n /**\n * Generates a transaction to publish a move package to chain.\n *\n * To get the `metadataBytes` and `byteCode`, can compile using Aptos CLI with command\n * `aptos move compile --save-metadata ...`,\n * For more info {@link https://aptos.dev/tutorials/your-first-dapp/#step-4-publish-a-move-module}\n *\n * @example\n * const transaction = await aptos.publishPackageTransaction({\n * account: alice,\n * metadataBytes,\n * moduleBytecode: [byteCode],\n * })\n *\n * @param args.account The publisher account\n * @param args.metadataBytes The package metadata bytes\n * @param args.moduleBytecode An array of the bytecode of each module in the package in compiler output order\n *\n * @returns A SimpleTransaction that can be simulated or submitted to chain\n */\n async publishPackageTransaction(args: {\n account: AccountAddressInput;\n metadataBytes: HexInput;\n moduleBytecode: Array<HexInput>;\n options?: InputGenerateTransactionOptions;\n }): Promise<SimpleTransaction> {\n return publicPackageTransaction({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Rotate an account's auth key. After rotation, only the new private key can be used to sign txns for\n * the account.\n * Note: Only legacy Ed25519 scheme is supported for now.\n * More info: {@link https://aptos.dev/guides/account-management/key-rotation/}\n *\n * @example\n * const response = await aptos.rotateAuthKey({\n * fromAccount: alice,\n * toNewPrivateKey: new ED25519PublicKey(\"0x123\"),\n * })\n *\n * @param args.fromAccount The account to rotate the auth key for\n * @param args.toNewPrivateKey The new private key to rotate to\n *\n * @returns PendingTransactionResponse\n */\n async rotateAuthKey(args: { fromAccount: Account; toNewPrivateKey: PrivateKey }): Promise<TransactionResponse> {\n return rotateAuthKey({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Sign a transaction that can later be submitted to chain\n *\n * @example\n * const transaction = await aptos.transaction.build.simple({...})\n * const transaction = await aptos.transaction.sign({\n * signer: alice,\n * transaction\n * })\n *\n * @param args.signer The signer account\n * @param args.transaction A raw transaction to sign on\n *\n * @returns AccountAuthenticator\n */\n // eslint-disable-next-line class-methods-use-this\n sign(args: { signer: Account; transaction: AnyRawTransaction }): AccountAuthenticator {\n return signTransaction({\n ...args,\n });\n }\n\n /**\n * Sign a transaction as a fee payer that can later be submitted to chain\n *\n * @example\n * const transaction = await aptos.transaction.build.simple({...})\n * const transaction = await aptos.transaction.signAsFeePayer({\n * signer: alice,\n * transaction\n * })\n *\n * @param args.signer The fee payer signer account\n * @param args.transaction A raw transaction to sign on\n *\n * @returns AccountAuthenticator\n */\n // eslint-disable-next-line class-methods-use-this\n signAsFeePayer(args: { signer: Account; transaction: AnyRawTransaction }): AccountAuthenticator {\n const { signer, transaction } = args;\n\n // if transaction doesnt hold a \"feePayerAddress\" prop it means\n // this is not a fee payer transaction\n if (!transaction.feePayerAddress) {\n throw new Error(`Transaction ${transaction} is not a Fee Payer transaction`);\n }\n\n // Set the feePayerAddress to the signer account address\n transaction.feePayerAddress = signer.accountAddress;\n\n return signTransaction({\n signer,\n transaction,\n });\n }\n\n // TRANSACTION SUBMISSION //\n\n /**\n * @deprecated Prefer to use `aptos.transaction.batch.forSingleAccount()`\n *\n * Batch transactions for a single account.\n *\n * This function uses a transaction worker that receives payloads to be processed\n * and submitted to chain.\n * Note that this process is best for submitting multiple transactions that\n * dont rely on each other, i.e batch funds, batch token mints, etc.\n *\n * If any worker failure, the functions throws an error.\n *\n * @param args.sender The sender account to sign and submit the transaction\n * @param args.data An array of transaction payloads\n * @param args.options optional. Transaction generation configurations (excluding accountSequenceNumber)\n *\n * @return void. Throws if any error\n */\n async batchTransactionsForSingleAccount(args: {\n sender: Account;\n data: InputGenerateTransactionPayloadData[];\n options?: Omit<InputGenerateTransactionOptions, \"accountSequenceNumber\">;\n }): Promise<void> {\n try {\n const { sender, data, options } = args;\n this.batch.forSingleAccount({ sender, data, options });\n } catch (error: any) {\n throw new Error(`failed to submit transactions with error: ${error}`);\n }\n }\n\n /**\n * Sign and submit a single signer transaction to chain\n *\n * @param args.signer The signer account to sign the transaction\n * @param args.transaction An instance of a RawTransaction, plus optional secondary/fee payer addresses\n *\n * @example\n * const transaction = await aptos.transaction.build.simple({...})\n * const transaction = await aptos.signAndSubmitTransaction({\n * signer: alice,\n * transaction\n * })\n *\n * @return PendingTransactionResponse\n */\n async signAndSubmitTransaction(args: {\n signer: Account;\n transaction: AnyRawTransaction;\n }): Promise<PendingTransactionResponse> {\n const { signer, transaction } = args;\n return signAndSubmitTransaction({\n aptosConfig: this.config,\n signer,\n transaction,\n });\n }\n}\n"],"mappings":"qTA2CO,IAAMA,EAAN,KAAkB,CAWvB,YAAYC,EAAqB,CAC/B,KAAK,OAASA,EACd,KAAK,MAAQ,IAAIC,EAAM,KAAK,MAAM,EAClC,KAAK,SAAW,IAAIC,EAAS,KAAK,MAAM,EACxC,KAAK,OAAS,IAAIC,EAAO,KAAK,MAAM,EACpC,KAAK,MAAQ,IAAIC,EAAsB,KAAK,MAAM,CACpD,CAcA,MAAM,gBAAgBC,EAAqE,CACzF,OAAOC,EAAgB,CACrB,YAAa,KAAK,OAClB,GAAGD,CACL,CAAC,CACH,CAYA,MAAM,wBAAwBA,EAAkE,CAC9F,OAAOE,EAAwB,CAC7B,YAAa,KAAK,OAClB,GAAGF,CACL,CAAC,CACH,CAWA,MAAM,qBAAqBA,EAAmE,CAC5F,OAAOG,EAAqB,CAC1B,YAAa,KAAK,OAClB,GAAGH,CACL,CAAC,CACH,CAiBA,MAAM,q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,EACA,YAAAC,CACF,CAAC,CACH,CACF","names":["Transaction","config","Build","Simulate","Submit","TransactionManagement","args","getTransactions","getTransactionByVersion","getTransactionByHash","isTransactionPending","waitForTransaction","getGasPriceEstimation","getSigningMessage","publicPackageTransaction","rotateAuthKey","signTransaction","signer","transaction","sender","data","options","error","signAndSubmitTransaction"]}
|
|
1
|
+
{"version":3,"sources":["../../src/api/transaction.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { AptosConfig } from \"./aptosConfig\";\nimport {\n getGasPriceEstimation,\n getTransactionByHash,\n getTransactionByVersion,\n getTransactions,\n isTransactionPending,\n waitForTransaction,\n} from \"../internal/transaction\";\nimport {\n AnyNumber,\n CommittedTransactionResponse,\n GasEstimation,\n HexInput,\n PaginationArgs,\n PendingTransactionResponse,\n TransactionResponse,\n WaitForTransactionOptions,\n} from \"../types\";\nimport {\n getSigningMessage,\n publicPackageTransaction,\n rotateAuthKey,\n signAndSubmitTransaction,\n signTransaction,\n} from \"../internal/transactionSubmission\";\nimport {\n AccountAuthenticator,\n AnyRawTransaction,\n InputGenerateTransactionOptions,\n InputGenerateTransactionPayloadData,\n} from \"../transactions\";\nimport { AccountAddressInput, PrivateKey } from \"../core\";\nimport { Account } from \"../account\";\nimport { Build } from \"./transactionSubmission/build\";\nimport { Simulate } from \"./transactionSubmission/simulate\";\nimport { Submit } from \"./transactionSubmission/submit\";\nimport { TransactionManagement } from \"./transactionSubmission/management\";\nimport { SimpleTransaction } from \"../transactions/instances/simpleTransaction\";\n\nexport class Transaction {\n readonly config: AptosConfig;\n\n readonly build: Build;\n\n readonly simulate: Simulate;\n\n readonly submit: Submit;\n\n readonly batch: TransactionManagement;\n\n constructor(config: AptosConfig) {\n this.config = config;\n this.build = new Build(this.config);\n this.simulate = new Simulate(this.config);\n this.submit = new Submit(this.config);\n this.batch = new TransactionManagement(this.config);\n }\n\n /**\n * Queries on-chain transactions. This function will not return pending\n * transactions. For that, use `getTransactionsByHash`.\n *\n * @example\n * const transactions = await aptos.getTransactions()\n *\n * @param args.options.offset The number transaction to start with\n * @param args.options.limit Number of results to return\n *\n * @returns Array of on-chain transactions\n */\n async getTransactions(args?: { options?: PaginationArgs }): Promise<TransactionResponse[]> {\n return getTransactions({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries on-chain transaction by version. This function will not return pending transactions.\n *\n * @example\n * const transaction = await aptos.getTransactions({ledgerVersion:1})\n *\n * @param args.ledgerVersion - Transaction version is an unsigned 64-bit number.\n * @returns On-chain transaction. Only on-chain transactions have versions, so this\n * function cannot be used to query pending transactions.\n */\n async getTransactionByVersion(args: { ledgerVersion: AnyNumber }): Promise<TransactionResponse> {\n return getTransactionByVersion({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries on-chain transaction by transaction hash. This function will return pending transactions.\n *\n * @example\n * const transaction = await aptos.getTransactionByHash({transactionHash:\"0x123\"})\n *\n * @param args.transactionHash - Transaction hash should be hex-encoded bytes string with 0x prefix.\n * @returns Transaction from mempool (pending) or on-chain (committed) transaction\n */\n async getTransactionByHash(args: { transactionHash: HexInput }): Promise<TransactionResponse> {\n return getTransactionByHash({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Defines if specified transaction is currently in pending state\n *\n * To create a transaction hash:\n *\n * 1. Create a hash message from the bytes: \"Aptos::Transaction\" bytes + the BCS-serialized Transaction bytes.\n * 2. Apply hash algorithm SHA3-256 to the hash message bytes.\n * 3. Hex-encode the hash bytes with 0x prefix.\n *\n * @example\n * const isPendingTransaction = await aptos.isPendingTransaction({transactionHash:\"0x123\"})\n *\n * @param args.transactionHash A hash of transaction\n * @returns `true` if transaction is in pending state and `false` otherwise\n */\n async isPendingTransaction(args: { transactionHash: HexInput }): Promise<boolean> {\n return isTransactionPending({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Waits for a transaction to move past the pending state.\n *\n * There are 4 cases.\n * 1. Transaction is successfully processed and committed to the chain.\n * - The function will resolve with the transaction response from the API.\n * 2. Transaction is rejected for some reason, and is therefore not committed to the blockchain.\n * - The function will throw an AptosApiError with an HTTP status code indicating some problem with the request.\n * 3. Transaction is committed but execution failed, meaning no changes were\n * written to the blockchain state.\n * - If `checkSuccess` is true, the function will throw a FailedTransactionError\n * If `checkSuccess` is false, the function will resolve with the transaction response where the `success` field is false.\n * 4. Transaction does not move past the pending state within `args.options.timeoutSecs` seconds.\n * - The function will throw a WaitForTransactionError\n *\n * @example\n * const transaction = await aptos.waitForTransaction({transactionHash:\"0x123\"})\n *\n * @param args.transactionHash The hash of a transaction previously submitted to the blockchain.\n * @param args.options.timeoutSecs Timeout in seconds. Defaults to 20 seconds.\n * @param args.options.checkSuccess A boolean which controls whether the function will error if the transaction failed.\n * Defaults to true. See case 3 above.\n * @returns The transaction on-chain. See above for more details.\n */\n async waitForTransaction(args: {\n transactionHash: HexInput;\n options?: WaitForTransactionOptions;\n }): Promise<CommittedTransactionResponse> {\n return waitForTransaction({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Gives an estimate of the gas unit price required to get a\n * transaction on chain in a reasonable amount of time.\n * For more information {@link https://api.mainnet.aptoslabs.com/v1/spec#/operations/estimate_gas_price}\n *\n * @returns Object holding the outputs of the estimate gas API\n *\n * @example\n * const gasPrice = await aptos.waitForTransaction()\n */\n async getGasPriceEstimation(): Promise<GasEstimation> {\n return getGasPriceEstimation({\n aptosConfig: this.config,\n });\n }\n\n /**\n * Returns a signing message for a transaction.\n *\n * This allows a user to sign a transaction using their own preferred signing method, and\n * then submit it to the network.\n *\n * @example\n * const transaction = await aptos.transaction.build.simple({...})\n * const message = await aptos.getSigningMessage({transaction})\n *\n * @param args.transaction A raw transaction for signing elsewhere\n */\n // eslint-disable-next-line class-methods-use-this\n getSigningMessage(args: { transaction: AnyRawTransaction }): Uint8Array {\n return getSigningMessage(args);\n }\n\n /**\n * Generates a transaction to publish a move package to chain.\n *\n * To get the `metadataBytes` and `byteCode`, can compile using Aptos CLI with command\n * `aptos move compile --save-metadata ...`,\n * For more info {@link https://aptos.dev/tutorials/your-first-dapp/#step-4-publish-a-move-module}\n *\n * @example\n * const transaction = await aptos.publishPackageTransaction({\n * account: alice,\n * metadataBytes,\n * moduleBytecode: [byteCode],\n * })\n *\n * @param args.account The publisher account\n * @param args.metadataBytes The package metadata bytes\n * @param args.moduleBytecode An array of the bytecode of each module in the package in compiler output order\n *\n * @returns A SimpleTransaction that can be simulated or submitted to chain\n */\n async publishPackageTransaction(args: {\n account: AccountAddressInput;\n metadataBytes: HexInput;\n moduleBytecode: Array<HexInput>;\n options?: InputGenerateTransactionOptions;\n }): Promise<SimpleTransaction> {\n return publicPackageTransaction({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Rotate an account's auth key. After rotation, only the new private key can be used to sign txns for\n * the account.\n * Note: Only legacy Ed25519 scheme is supported for now.\n * More info: {@link https://aptos.dev/guides/account-management/key-rotation/}\n *\n * @example\n * const response = await aptos.rotateAuthKey({\n * fromAccount: alice,\n * toNewPrivateKey: new ED25519PublicKey(\"0x123\"),\n * })\n *\n * @param args.fromAccount The account to rotate the auth key for\n * @param args.toNewPrivateKey The new private key to rotate to\n *\n * @returns PendingTransactionResponse\n */\n async rotateAuthKey(args: { fromAccount: Account; toNewPrivateKey: PrivateKey }): Promise<TransactionResponse> {\n return rotateAuthKey({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Sign a transaction that can later be submitted to chain\n *\n * @example\n * const transaction = await aptos.transaction.build.simple({...})\n * const transaction = await aptos.transaction.sign({\n * signer: alice,\n * transaction\n * })\n *\n * @param args.signer The signer account\n * @param args.transaction A raw transaction to sign on\n *\n * @returns AccountAuthenticator\n */\n // eslint-disable-next-line class-methods-use-this\n sign(args: { signer: Account; transaction: AnyRawTransaction }): AccountAuthenticator {\n return signTransaction({\n ...args,\n });\n }\n\n /**\n * Sign a transaction as a fee payer that can later be submitted to chain\n *\n * @example\n * const transaction = await aptos.transaction.build.simple({...})\n * const transaction = await aptos.transaction.signAsFeePayer({\n * signer: alice,\n * transaction\n * })\n *\n * @param args.signer The fee payer signer account\n * @param args.transaction A raw transaction to sign on\n *\n * @returns AccountAuthenticator\n */\n // eslint-disable-next-line class-methods-use-this\n signAsFeePayer(args: { signer: Account; transaction: AnyRawTransaction }): AccountAuthenticator {\n const { signer, transaction } = args;\n\n // if transaction doesnt hold a \"feePayerAddress\" prop it means\n // this is not a fee payer transaction\n if (!transaction.feePayerAddress) {\n throw new Error(`Transaction ${transaction} is not a Fee Payer transaction`);\n }\n\n // Set the feePayerAddress to the signer account address\n transaction.feePayerAddress = signer.accountAddress;\n\n return signTransaction({\n signer,\n transaction,\n });\n }\n\n // TRANSACTION SUBMISSION //\n\n /**\n * @deprecated Prefer to use `aptos.transaction.batch.forSingleAccount()`\n *\n * Batch transactions for a single account.\n *\n * This function uses a transaction worker that receives payloads to be processed\n * and submitted to chain.\n * Note that this process is best for submitting multiple transactions that\n * dont rely on each other, i.e batch funds, batch token mints, etc.\n *\n * If any worker failure, the functions throws an error.\n *\n * @param args.sender The sender account to sign and submit the transaction\n * @param args.data An array of transaction payloads\n * @param args.options optional. Transaction generation configurations (excluding accountSequenceNumber)\n *\n * @return void. Throws if any error\n */\n async batchTransactionsForSingleAccount(args: {\n sender: Account;\n data: InputGenerateTransactionPayloadData[];\n options?: Omit<InputGenerateTransactionOptions, \"accountSequenceNumber\">;\n }): Promise<void> {\n try {\n const { sender, data, options } = args;\n this.batch.forSingleAccount({ sender, data, options });\n } catch (error: any) {\n throw new Error(`failed to submit transactions with error: ${error}`);\n }\n }\n\n /**\n * Sign and submit a single signer transaction to chain\n *\n * @param args.signer The signer account to sign the transaction\n * @param args.transaction An instance of a RawTransaction, plus optional secondary/fee payer addresses\n *\n * @example\n * const transaction = await aptos.transaction.build.simple({...})\n * const transaction = await aptos.signAndSubmitTransaction({\n * signer: alice,\n * transaction\n * })\n *\n * @return PendingTransactionResponse\n */\n async signAndSubmitTransaction(args: {\n signer: Account;\n transaction: AnyRawTransaction;\n }): Promise<PendingTransactionResponse> {\n const { signer, transaction } = args;\n return signAndSubmitTransaction({\n aptosConfig: this.config,\n signer,\n transaction,\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CO,IAAM,cAAN,MAAkB;AAAA,EAWvB,YAAY,QAAqB;AAC/B,SAAK,SAAS;AACd,SAAK,QAAQ,IAAI,MAAM,KAAK,MAAM;AAClC,SAAK,WAAW,IAAI,SAAS,KAAK,MAAM;AACxC,SAAK,SAAS,IAAI,OAAO,KAAK,MAAM;AACpC,SAAK,QAAQ,IAAI,sBAAsB,KAAK,MAAM;AAAA,EACpD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAcA,MAAM,gBAAgB,MAAqE;AACzF,WAAO,gBAAgB;AAAA,MACrB,aAAa,KAAK;AAAA,MAClB,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYA,MAAM,wBAAwB,MAAkE;AAC9F,WAAO,wBAAwB;AAAA,MAC7B,aAAa,KAAK;AAAA,MAClB,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,MAAM,qBAAqB,MAAmE;AAC5F,WAAO,qBAAqB;AAAA,MAC1B,aAAa,KAAK;AAAA,MAClB,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAiBA,MAAM,qBAAqB,MAAuD;AAChF,WAAO,qBAAqB;AAAA,MAC1B,aAAa,KAAK;AAAA,MAClB,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA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