@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
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import {
|
|
2
|
+
sleep
|
|
3
|
+
} from "./chunk-GGMTQAQP.mjs";
|
|
4
|
+
|
|
5
|
+
// src/cli/localNode.ts
|
|
6
|
+
import { spawn } from "child_process";
|
|
7
|
+
import kill from "tree-kill";
|
|
8
|
+
var LocalNode = class {
|
|
9
|
+
constructor() {
|
|
10
|
+
this.MAXIMUM_WAIT_TIME_SEC = 75;
|
|
11
|
+
this.READINESS_ENDPOINT = "http://127.0.0.1:8070/";
|
|
12
|
+
this.process = null;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* kills all the descendent processes
|
|
16
|
+
* of the node process, including the node process itself
|
|
17
|
+
*/
|
|
18
|
+
stop() {
|
|
19
|
+
if (!this.process?.pid)
|
|
20
|
+
return;
|
|
21
|
+
kill(this.process.pid);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Runs a local testnet and waits for process to be up.
|
|
25
|
+
*
|
|
26
|
+
* If local node process is already up it returns and does
|
|
27
|
+
* not start the process
|
|
28
|
+
*/
|
|
29
|
+
async run() {
|
|
30
|
+
const nodeIsUp = await this.checkIfProcessIsUp();
|
|
31
|
+
if (nodeIsUp) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
this.start();
|
|
35
|
+
await this.waitUntilProcessIsUp();
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Starts the local testnet by running the aptos node run-local-testnet command
|
|
39
|
+
*/
|
|
40
|
+
start() {
|
|
41
|
+
const cliCommand = "npx";
|
|
42
|
+
const cliArgs = ["aptos", "node", "run-local-testnet", "--force-restart", "--assume-yes", "--with-indexer-api"];
|
|
43
|
+
const childProcess = spawn(cliCommand, cliArgs);
|
|
44
|
+
this.process = childProcess;
|
|
45
|
+
childProcess.stderr?.on("data", (data) => {
|
|
46
|
+
const str = data.toString();
|
|
47
|
+
console.log(str);
|
|
48
|
+
});
|
|
49
|
+
childProcess.stdout?.on("data", (data) => {
|
|
50
|
+
const str = data.toString();
|
|
51
|
+
console.log(str);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Waits for the local testnet process to be up
|
|
56
|
+
*
|
|
57
|
+
* @returns Promise<boolean>
|
|
58
|
+
*/
|
|
59
|
+
async waitUntilProcessIsUp() {
|
|
60
|
+
let operational = await this.checkIfProcessIsUp();
|
|
61
|
+
const start = Date.now() / 1e3;
|
|
62
|
+
let last = start;
|
|
63
|
+
while (!operational && start + this.MAXIMUM_WAIT_TIME_SEC > last) {
|
|
64
|
+
await sleep(1e3);
|
|
65
|
+
operational = await this.checkIfProcessIsUp();
|
|
66
|
+
last = Date.now() / 1e3;
|
|
67
|
+
}
|
|
68
|
+
if (!operational) {
|
|
69
|
+
throw new Error("Process failed to start");
|
|
70
|
+
}
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Checks if the local testnet is up
|
|
75
|
+
*
|
|
76
|
+
* @returns Promise<boolean>
|
|
77
|
+
*/
|
|
78
|
+
async checkIfProcessIsUp() {
|
|
79
|
+
try {
|
|
80
|
+
const data = await fetch(this.READINESS_ENDPOINT);
|
|
81
|
+
if (data.status === 200) {
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
return false;
|
|
85
|
+
} catch (err) {
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export {
|
|
92
|
+
LocalNode
|
|
93
|
+
};
|
|
94
|
+
//# sourceMappingURL=chunk-SS3NUM5L.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/cli/localNode.ts"],"sourcesContent":["import { ChildProcessWithoutNullStreams, spawn } from \"child_process\";\nimport kill from \"tree-kill\";\nimport { sleep } from \"../utils/helpers\";\n\nexport class LocalNode {\n readonly MAXIMUM_WAIT_TIME_SEC = 75;\n\n readonly READINESS_ENDPOINT = \"http://127.0.0.1:8070/\";\n\n process: ChildProcessWithoutNullStreams | null = null;\n\n /**\n * kills all the descendent processes\n * of the node process, including the node process itself\n */\n stop() {\n if (!this.process?.pid) return;\n kill(this.process.pid);\n }\n\n /**\n * Runs a local testnet and waits for process to be up.\n *\n * If local node process is already up it returns and does\n * not start the process\n */\n async run() {\n const nodeIsUp = await this.checkIfProcessIsUp();\n if (nodeIsUp) {\n return;\n }\n this.start();\n await this.waitUntilProcessIsUp();\n }\n\n /**\n * Starts the local testnet by running the aptos node run-local-testnet command\n */\n start() {\n const cliCommand = \"npx\";\n const cliArgs = [\"aptos\", \"node\", \"run-local-testnet\", \"--force-restart\", \"--assume-yes\", \"--with-indexer-api\"];\n\n const childProcess = spawn(cliCommand, cliArgs);\n this.process = childProcess;\n\n childProcess.stderr?.on(\"data\", (data: any) => {\n const str = data.toString();\n // Print local node output log\n // eslint-disable-next-line no-console\n console.log(str);\n });\n\n childProcess.stdout?.on(\"data\", (data: any) => {\n const str = data.toString();\n // Print local node output log\n // eslint-disable-next-line no-console\n console.log(str);\n });\n }\n\n /**\n * Waits for the local testnet process to be up\n *\n * @returns Promise<boolean>\n */\n async waitUntilProcessIsUp(): Promise<boolean> {\n let operational = await this.checkIfProcessIsUp();\n const start = Date.now() / 1000;\n let last = start;\n\n while (!operational && start + this.MAXIMUM_WAIT_TIME_SEC > last) {\n // eslint-disable-next-line no-await-in-loop\n await sleep(1000);\n // eslint-disable-next-line no-await-in-loop\n operational = await this.checkIfProcessIsUp();\n last = Date.now() / 1000;\n }\n\n // If we are here it means something blocks the process to start.\n // Might worth checking if another process is running on port 8080\n if (!operational) {\n throw new Error(\"Process failed to start\");\n }\n\n return true;\n }\n\n /**\n * Checks if the local testnet is up\n *\n * @returns Promise<boolean>\n */\n async checkIfProcessIsUp(): Promise<boolean> {\n try {\n // Query readiness endpoint\n const data = await fetch(this.READINESS_ENDPOINT);\n if (data.status === 200) {\n return true;\n }\n return false;\n } catch (err: any) {\n return false;\n }\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/cli/localNode.ts"],"sourcesContent":["import { ChildProcessWithoutNullStreams, spawn } from \"child_process\";\nimport kill from \"tree-kill\";\nimport { sleep } from \"../utils/helpers\";\n\nexport class LocalNode {\n readonly MAXIMUM_WAIT_TIME_SEC = 75;\n\n readonly READINESS_ENDPOINT = \"http://127.0.0.1:8070/\";\n\n process: ChildProcessWithoutNullStreams | null = null;\n\n /**\n * kills all the descendent processes\n * of the node process, including the node process itself\n */\n stop() {\n if (!this.process?.pid) return;\n kill(this.process.pid);\n }\n\n /**\n * Runs a local testnet and waits for process to be up.\n *\n * If local node process is already up it returns and does\n * not start the process\n */\n async run() {\n const nodeIsUp = await this.checkIfProcessIsUp();\n if (nodeIsUp) {\n return;\n }\n this.start();\n await this.waitUntilProcessIsUp();\n }\n\n /**\n * Starts the local testnet by running the aptos node run-local-testnet command\n */\n start() {\n const cliCommand = \"npx\";\n const cliArgs = [\"aptos\", \"node\", \"run-local-testnet\", \"--force-restart\", \"--assume-yes\", \"--with-indexer-api\"];\n\n const childProcess = spawn(cliCommand, cliArgs);\n this.process = childProcess;\n\n childProcess.stderr?.on(\"data\", (data: any) => {\n const str = data.toString();\n // Print local node output log\n // eslint-disable-next-line no-console\n console.log(str);\n });\n\n childProcess.stdout?.on(\"data\", (data: any) => {\n const str = data.toString();\n // Print local node output log\n // eslint-disable-next-line no-console\n console.log(str);\n });\n }\n\n /**\n * Waits for the local testnet process to be up\n *\n * @returns Promise<boolean>\n */\n async waitUntilProcessIsUp(): Promise<boolean> {\n let operational = await this.checkIfProcessIsUp();\n const start = Date.now() / 1000;\n let last = start;\n\n while (!operational && start + this.MAXIMUM_WAIT_TIME_SEC > last) {\n // eslint-disable-next-line no-await-in-loop\n await sleep(1000);\n // eslint-disable-next-line no-await-in-loop\n operational = await this.checkIfProcessIsUp();\n last = Date.now() / 1000;\n }\n\n // If we are here it means something blocks the process to start.\n // Might worth checking if another process is running on port 8080\n if (!operational) {\n throw new Error(\"Process failed to start\");\n }\n\n return true;\n }\n\n /**\n * Checks if the local testnet is up\n *\n * @returns Promise<boolean>\n */\n async checkIfProcessIsUp(): Promise<boolean> {\n try {\n // Query readiness endpoint\n const data = await fetch(this.READINESS_ENDPOINT);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AAO,KAAK,IAAI,IAAI;AAAA,IACtB;AAIA,QAAI,CAAC,aAAa;AAChB,YAAM,IAAI,MAAM,yBAAyB;AAAA,IAC3C;AAEA,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,qBAAuC;AAC3C,QAAI;AAEF,YAAM,OAAO,MAAM,MAAM,KAAK,kBAAkB;AAChD,UAAI,KAAK,WAAW,KAAK;AACvB,eAAO;AAAA,MACT;AACA,aAAO;AAAA,IACT,SAAS,KAAU;AACjB,aAAO;AAAA,IACT;AAAA,EACF;AACF;","names":[]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import {
|
|
2
|
+
fundAccount
|
|
3
|
+
} from "./chunk-KVSQ57HU.mjs";
|
|
4
|
+
import {
|
|
5
|
+
waitForIndexer
|
|
6
|
+
} from "./chunk-TBHU6ZW6.mjs";
|
|
7
|
+
|
|
8
|
+
// src/api/faucet.ts
|
|
9
|
+
var Faucet = class {
|
|
10
|
+
constructor(config) {
|
|
11
|
+
this.config = config;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* This creates an account if it does not exist and mints the specified amount of
|
|
15
|
+
* coins into that account
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* const transaction = await aptos.fundAccount({accountAddress:"0x123", amount: 100})
|
|
19
|
+
*
|
|
20
|
+
* @param args.accountAddress Address of the account to fund
|
|
21
|
+
* @param args.amount Amount of tokens to fund the account with
|
|
22
|
+
* @param args.options Configuration options for waitForTransaction
|
|
23
|
+
* @returns Transaction hash of the transaction that funded the account
|
|
24
|
+
*/
|
|
25
|
+
async fundAccount(args) {
|
|
26
|
+
const fundTxn = await fundAccount({ aptosConfig: this.config, ...args });
|
|
27
|
+
if (args.options?.waitForIndexer !== false) {
|
|
28
|
+
await waitForIndexer({ aptosConfig: this.config, minimumLedgerVersion: BigInt(fundTxn.version) });
|
|
29
|
+
}
|
|
30
|
+
return fundTxn;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export {
|
|
35
|
+
Faucet
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=chunk-ST4QXIMI.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/api/faucet.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { fundAccount } from \"../internal/faucet\";\nimport { UserTransactionResponse, WaitForTransactionOptions } from \"../types\";\nimport { AccountAddressInput } from \"../core\";\nimport { AptosConfig } from \"./aptosConfig\";\nimport { waitForIndexer } from \"../internal/transaction\";\n\n/**\n * A class to query all `Faucet` related queries on Aptos.\n */\nexport class Faucet {\n constructor(readonly config: AptosConfig) {}\n\n /**\n * This creates an account if it does not exist and mints the specified amount of\n * coins into that account\n *\n * @example\n * const transaction = await aptos.fundAccount({accountAddress:\"0x123\", amount: 100})\n *\n * @param args.accountAddress Address of the account to fund\n * @param args.amount Amount of tokens to fund the account with\n * @param args.options Configuration options for waitForTransaction\n * @returns Transaction hash of the transaction that funded the account\n */\n async fundAccount(args: {\n accountAddress: AccountAddressInput;\n amount: number;\n options?: WaitForTransactionOptions;\n }): Promise<UserTransactionResponse> {\n const fundTxn = await fundAccount({ aptosConfig: this.config, ...args });\n\n if (args.options?.waitForIndexer !== false) {\n await waitForIndexer({ aptosConfig: this.config, minimumLedgerVersion: BigInt(fundTxn.version) });\n }\n\n return fundTxn;\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/api/faucet.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { fundAccount } from \"../internal/faucet\";\nimport { UserTransactionResponse, WaitForTransactionOptions } from \"../types\";\nimport { AccountAddressInput } from \"../core\";\nimport { AptosConfig } from \"./aptosConfig\";\nimport { waitForIndexer } from \"../internal/transaction\";\n\n/**\n * A class to query all `Faucet` related queries on Aptos.\n */\nexport class Faucet {\n constructor(readonly config: AptosConfig) {}\n\n /**\n * This creates an account if it does not exist and mints the specified amount of\n * coins into that account\n *\n * @example\n * const transaction = await aptos.fundAccount({accountAddress:\"0x123\", amount: 100})\n *\n * @param args.accountAddress Address of the account to fund\n * @param args.amount Amount of tokens to fund the account with\n * @param args.options Configuration options for waitForTransaction\n * @returns Transaction hash of the transaction that funded the account\n */\n async fundAccount(args: {\n accountAddress: AccountAddressInput;\n amount: number;\n options?: WaitForTransactionOptions;\n }): Promise<UserTransactionResponse> {\n const fundTxn = await fundAccount({ aptosConfig: this.config, ...args });\n\n if (args.options?.waitForIndexer !== false) {\n await waitForIndexer({ aptosConfig: this.config, minimumLedgerVersion: BigInt(fundTxn.version) });\n }\n\n return fundTxn;\n }\n}\n"],"mappings":";;;;;;;;AAYO,IAAM,SAAN,MAAa;AAAA,EAClB,YAAqB,QAAqB;AAArB;AAAA,EAAsB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAc3C,MAAM,YAAY,MAImB;AACnC,UAAM,UAAU,MAAM,YAAY,EAAE,aAAa,KAAK,QAAQ,GAAG,KAAK,CAAC;AAEvE,QAAI,KAAK,SAAS,mBAAmB,OAAO;AAC1C,YAAM,eAAe,EAAE,aAAa,KAAK,QAAQ,sBAAsB,OAAO,QAAQ,OAAO,EAAE,CAAC;AAAA,IAClG;AAEA,WAAO;AAAA,EACT;AACF;","names":[]}
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import {
|
|
2
|
+
memoizeAsync
|
|
3
|
+
} from "./chunk-EYHRMZPO.mjs";
|
|
4
|
+
import {
|
|
5
|
+
getIndexerLastSuccessVersion,
|
|
6
|
+
getProcessorStatus
|
|
7
|
+
} from "./chunk-LYMY63SO.mjs";
|
|
8
|
+
import {
|
|
9
|
+
getAptosFullNode,
|
|
10
|
+
paginateWithCursor
|
|
11
|
+
} from "./chunk-LYK4TQZO.mjs";
|
|
12
|
+
import {
|
|
13
|
+
sleep
|
|
14
|
+
} from "./chunk-GGMTQAQP.mjs";
|
|
15
|
+
import {
|
|
16
|
+
AptosApiError
|
|
17
|
+
} from "./chunk-PCLNX6FS.mjs";
|
|
18
|
+
import {
|
|
19
|
+
DEFAULT_TXN_TIMEOUT_SEC
|
|
20
|
+
} from "./chunk-NFJCQRVK.mjs";
|
|
21
|
+
|
|
22
|
+
// src/internal/transaction.ts
|
|
23
|
+
async function getTransactions(args) {
|
|
24
|
+
const { aptosConfig, options } = args;
|
|
25
|
+
return paginateWithCursor({
|
|
26
|
+
aptosConfig,
|
|
27
|
+
originMethod: "getTransactions",
|
|
28
|
+
path: "transactions",
|
|
29
|
+
params: { start: options?.offset, limit: options?.limit }
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
async function getGasPriceEstimation(args) {
|
|
33
|
+
const { aptosConfig } = args;
|
|
34
|
+
return memoizeAsync(
|
|
35
|
+
async () => {
|
|
36
|
+
const { data } = await getAptosFullNode({
|
|
37
|
+
aptosConfig,
|
|
38
|
+
originMethod: "getGasPriceEstimation",
|
|
39
|
+
path: "estimate_gas_price"
|
|
40
|
+
});
|
|
41
|
+
return data;
|
|
42
|
+
},
|
|
43
|
+
`gas-price-${aptosConfig.network}`,
|
|
44
|
+
1e3 * 60 * 5
|
|
45
|
+
// 5 minutes
|
|
46
|
+
)();
|
|
47
|
+
}
|
|
48
|
+
async function getTransactionByVersion(args) {
|
|
49
|
+
const { aptosConfig, ledgerVersion } = args;
|
|
50
|
+
const { data } = await getAptosFullNode({
|
|
51
|
+
aptosConfig,
|
|
52
|
+
originMethod: "getTransactionByVersion",
|
|
53
|
+
path: `transactions/by_version/${ledgerVersion}`
|
|
54
|
+
});
|
|
55
|
+
return data;
|
|
56
|
+
}
|
|
57
|
+
async function getTransactionByHash(args) {
|
|
58
|
+
const { aptosConfig, transactionHash } = args;
|
|
59
|
+
const { data } = await getAptosFullNode({
|
|
60
|
+
aptosConfig,
|
|
61
|
+
path: `transactions/by_hash/${transactionHash}`,
|
|
62
|
+
originMethod: "getTransactionByHash"
|
|
63
|
+
});
|
|
64
|
+
return data;
|
|
65
|
+
}
|
|
66
|
+
async function isTransactionPending(args) {
|
|
67
|
+
const { aptosConfig, transactionHash } = args;
|
|
68
|
+
try {
|
|
69
|
+
const transaction = await getTransactionByHash({ aptosConfig, transactionHash });
|
|
70
|
+
return transaction.type === "pending_transaction" /* Pending */;
|
|
71
|
+
} catch (e) {
|
|
72
|
+
if (e?.status === 404) {
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
throw e;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
async function longWaitForTransaction(args) {
|
|
79
|
+
const { aptosConfig, transactionHash } = args;
|
|
80
|
+
const { data } = await getAptosFullNode({
|
|
81
|
+
aptosConfig,
|
|
82
|
+
path: `transactions/wait_by_hash/${transactionHash}`,
|
|
83
|
+
originMethod: "longWaitForTransaction"
|
|
84
|
+
});
|
|
85
|
+
return data;
|
|
86
|
+
}
|
|
87
|
+
async function waitForTransaction(args) {
|
|
88
|
+
const { aptosConfig, transactionHash, options } = args;
|
|
89
|
+
const timeoutSecs = options?.timeoutSecs ?? DEFAULT_TXN_TIMEOUT_SEC;
|
|
90
|
+
const checkSuccess = options?.checkSuccess ?? true;
|
|
91
|
+
let isPending = true;
|
|
92
|
+
let timeElapsed = 0;
|
|
93
|
+
let lastTxn;
|
|
94
|
+
let lastError;
|
|
95
|
+
let backoffIntervalMs = 200;
|
|
96
|
+
const backoffMultiplier = 1.5;
|
|
97
|
+
function handleAPIError(e) {
|
|
98
|
+
const isAptosApiError = e instanceof AptosApiError;
|
|
99
|
+
if (!isAptosApiError) {
|
|
100
|
+
throw e;
|
|
101
|
+
}
|
|
102
|
+
lastError = e;
|
|
103
|
+
const isRequestError = e.status !== 404 && e.status >= 400 && e.status < 500;
|
|
104
|
+
if (isRequestError) {
|
|
105
|
+
throw e;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
try {
|
|
109
|
+
lastTxn = await getTransactionByHash({ aptosConfig, transactionHash });
|
|
110
|
+
isPending = lastTxn.type === "pending_transaction" /* Pending */;
|
|
111
|
+
} catch (e) {
|
|
112
|
+
handleAPIError(e);
|
|
113
|
+
}
|
|
114
|
+
if (isPending) {
|
|
115
|
+
const startTime = Date.now();
|
|
116
|
+
try {
|
|
117
|
+
lastTxn = await longWaitForTransaction({ aptosConfig, transactionHash });
|
|
118
|
+
isPending = lastTxn.type === "pending_transaction" /* Pending */;
|
|
119
|
+
} catch (e) {
|
|
120
|
+
handleAPIError(e);
|
|
121
|
+
}
|
|
122
|
+
timeElapsed = (Date.now() - startTime) / 1e3;
|
|
123
|
+
}
|
|
124
|
+
while (isPending) {
|
|
125
|
+
if (timeElapsed >= timeoutSecs) {
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
try {
|
|
129
|
+
lastTxn = await getTransactionByHash({ aptosConfig, transactionHash });
|
|
130
|
+
isPending = lastTxn.type === "pending_transaction" /* Pending */;
|
|
131
|
+
if (!isPending) {
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
} catch (e) {
|
|
135
|
+
handleAPIError(e);
|
|
136
|
+
}
|
|
137
|
+
await sleep(backoffIntervalMs);
|
|
138
|
+
timeElapsed += backoffIntervalMs / 1e3;
|
|
139
|
+
backoffIntervalMs *= backoffMultiplier;
|
|
140
|
+
}
|
|
141
|
+
if (lastTxn === void 0) {
|
|
142
|
+
if (lastError) {
|
|
143
|
+
throw lastError;
|
|
144
|
+
} else {
|
|
145
|
+
throw new WaitForTransactionError(
|
|
146
|
+
`Fetching transaction ${transactionHash} failed and timed out after ${timeoutSecs} seconds`,
|
|
147
|
+
lastTxn
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
if (lastTxn.type === "pending_transaction" /* Pending */) {
|
|
152
|
+
throw new WaitForTransactionError(
|
|
153
|
+
`Transaction ${transactionHash} timed out in pending state after ${timeoutSecs} seconds`,
|
|
154
|
+
lastTxn
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
if (!checkSuccess) {
|
|
158
|
+
return lastTxn;
|
|
159
|
+
}
|
|
160
|
+
if (!lastTxn.success) {
|
|
161
|
+
throw new FailedTransactionError(
|
|
162
|
+
`Transaction ${transactionHash} failed with an error: ${lastTxn.vm_status}`,
|
|
163
|
+
lastTxn
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
return lastTxn;
|
|
167
|
+
}
|
|
168
|
+
async function waitForIndexer(args) {
|
|
169
|
+
const { aptosConfig, processorType } = args;
|
|
170
|
+
const minimumLedgerVersion = BigInt(args.minimumLedgerVersion);
|
|
171
|
+
const timeoutMilliseconds = 3e3;
|
|
172
|
+
const startTime = (/* @__PURE__ */ new Date()).getTime();
|
|
173
|
+
let indexerVersion = BigInt(-1);
|
|
174
|
+
while (indexerVersion < minimumLedgerVersion) {
|
|
175
|
+
if ((/* @__PURE__ */ new Date()).getTime() - startTime > timeoutMilliseconds) {
|
|
176
|
+
throw new Error("waitForLastSuccessIndexerVersionSync timeout");
|
|
177
|
+
}
|
|
178
|
+
if (processorType === void 0) {
|
|
179
|
+
indexerVersion = await getIndexerLastSuccessVersion({ aptosConfig });
|
|
180
|
+
} else {
|
|
181
|
+
const processor = await getProcessorStatus({ aptosConfig, processorType });
|
|
182
|
+
indexerVersion = processor.last_success_version;
|
|
183
|
+
}
|
|
184
|
+
if (indexerVersion >= minimumLedgerVersion) {
|
|
185
|
+
break;
|
|
186
|
+
}
|
|
187
|
+
await sleep(200);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
var WaitForTransactionError = class extends Error {
|
|
191
|
+
constructor(message, lastSubmittedTransaction) {
|
|
192
|
+
super(message);
|
|
193
|
+
this.lastSubmittedTransaction = lastSubmittedTransaction;
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
var FailedTransactionError = class extends Error {
|
|
197
|
+
constructor(message, transaction) {
|
|
198
|
+
super(message);
|
|
199
|
+
this.transaction = transaction;
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
export {
|
|
204
|
+
getTransactions,
|
|
205
|
+
getGasPriceEstimation,
|
|
206
|
+
getTransactionByVersion,
|
|
207
|
+
getTransactionByHash,
|
|
208
|
+
isTransactionPending,
|
|
209
|
+
longWaitForTransaction,
|
|
210
|
+
waitForTransaction,
|
|
211
|
+
waitForIndexer,
|
|
212
|
+
WaitForTransactionError,
|
|
213
|
+
FailedTransactionError
|
|
214
|
+
};
|
|
215
|
+
//# sourceMappingURL=chunk-TBHU6ZW6.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/internal/transaction.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * This file contains the underlying implementations for exposed API surface in\n * the {@link api/transaction}. By moving the methods out into a separate file,\n * other namespaces and processes can access these methods without depending on the entire\n * transaction namespace and without having a dependency cycle error.\n */\n\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { AptosApiError, getAptosFullNode, paginateWithCursor } from \"../client\";\nimport {\n TransactionResponseType,\n type AnyNumber,\n type GasEstimation,\n type HexInput,\n type PaginationArgs,\n type TransactionResponse,\n WaitForTransactionOptions,\n CommittedTransactionResponse,\n} from \"../types\";\nimport { DEFAULT_TXN_TIMEOUT_SEC, ProcessorType } from \"../utils/const\";\nimport { sleep } from \"../utils/helpers\";\nimport { memoizeAsync } from \"../utils/memoize\";\nimport { getIndexerLastSuccessVersion, getProcessorStatus } from \"./general\";\n\nexport async function getTransactions(args: {\n aptosConfig: AptosConfig;\n options?: PaginationArgs;\n}): Promise<TransactionResponse[]> {\n const { aptosConfig, options } = args;\n return paginateWithCursor<{}, TransactionResponse[]>({\n aptosConfig,\n originMethod: \"getTransactions\",\n path: \"transactions\",\n params: { start: options?.offset, limit: options?.limit },\n });\n}\n\nexport async function getGasPriceEstimation(args: { aptosConfig: AptosConfig }) {\n const { aptosConfig } = args;\n\n return memoizeAsync(\n async () => {\n const { data } = await getAptosFullNode<{}, GasEstimation>({\n aptosConfig,\n originMethod: \"getGasPriceEstimation\",\n path: \"estimate_gas_price\",\n });\n return data;\n },\n `gas-price-${aptosConfig.network}`,\n 1000 * 60 * 5, // 5 minutes\n )();\n}\n\nexport async function getTransactionByVersion(args: {\n aptosConfig: AptosConfig;\n ledgerVersion: AnyNumber;\n}): Promise<TransactionResponse> {\n const { aptosConfig, ledgerVersion } = args;\n const { data } = await getAptosFullNode<{}, TransactionResponse>({\n aptosConfig,\n originMethod: \"getTransactionByVersion\",\n path: `transactions/by_version/${ledgerVersion}`,\n });\n return data;\n}\n\nexport async function getTransactionByHash(args: {\n aptosConfig: AptosConfig;\n transactionHash: HexInput;\n}): Promise<TransactionResponse> {\n const { aptosConfig, transactionHash } = args;\n const { data } = await getAptosFullNode<{}, TransactionResponse>({\n aptosConfig,\n path: `transactions/by_hash/${transactionHash}`,\n originMethod: \"getTransactionByHash\",\n });\n return data;\n}\n\nexport async function isTransactionPending(args: {\n aptosConfig: AptosConfig;\n transactionHash: HexInput;\n}): Promise<boolean> {\n const { aptosConfig, transactionHash } = args;\n try {\n const transaction = await getTransactionByHash({ aptosConfig, transactionHash });\n return transaction.type === TransactionResponseType.Pending;\n } catch (e: any) {\n if (e?.status === 404) {\n return true;\n }\n throw e;\n }\n}\n\nexport async function longWaitForTransaction(args: {\n aptosConfig: AptosConfig;\n transactionHash: HexInput;\n}): Promise<TransactionResponse> {\n const { aptosConfig, transactionHash } = args;\n const { data } = await getAptosFullNode<{}, TransactionResponse>({\n aptosConfig,\n path: `transactions/wait_by_hash/${transactionHash}`,\n originMethod: \"longWaitForTransaction\",\n });\n return data;\n}\n\nexport async function waitForTransaction(args: {\n aptosConfig: AptosConfig;\n transactionHash: HexInput;\n options?: WaitForTransactionOptions;\n}): Promise<CommittedTransactionResponse> {\n const { aptosConfig, transactionHash, options } = args;\n const timeoutSecs = options?.timeoutSecs ?? DEFAULT_TXN_TIMEOUT_SEC;\n const checkSuccess = options?.checkSuccess ?? true;\n\n let isPending = true;\n let timeElapsed = 0;\n let lastTxn: TransactionResponse | undefined;\n let lastError: AptosApiError | undefined;\n let backoffIntervalMs = 200;\n const backoffMultiplier = 1.5;\n\n function handleAPIError(e: any) {\n // In short, this means we will retry if it was an AptosApiError and the code was 404 or 5xx.\n const isAptosApiError = e instanceof AptosApiError;\n if (!isAptosApiError) {\n throw e; // This would be unexpected\n }\n lastError = e;\n const isRequestError = e.status !== 404 && e.status >= 400 && e.status < 500;\n if (isRequestError) {\n throw e;\n }\n }\n\n // check to see if the txn is already on the blockchain\n try {\n lastTxn = await getTransactionByHash({ aptosConfig, transactionHash });\n isPending = lastTxn.type === TransactionResponseType.Pending;\n } catch (e) {\n handleAPIError(e);\n }\n\n // If the transaction is pending, we do a long wait once to avoid polling\n if (isPending) {\n const startTime = Date.now();\n try {\n lastTxn = await longWaitForTransaction({ aptosConfig, transactionHash });\n isPending = lastTxn.type === TransactionResponseType.Pending;\n } catch (e) {\n handleAPIError(e);\n }\n timeElapsed = (Date.now() - startTime) / 1000;\n }\n\n // Now we do polling to see if the transaction is still pending\n while (isPending) {\n if (timeElapsed >= timeoutSecs) {\n break;\n }\n try {\n // eslint-disable-next-line no-await-in-loop\n lastTxn = await getTransactionByHash({ aptosConfig, transactionHash });\n\n isPending = lastTxn.type === TransactionResponseType.Pending;\n\n if (!isPending) {\n break;\n }\n } catch (e) {\n handleAPIError(e);\n }\n // eslint-disable-next-line no-await-in-loop\n await sleep(backoffIntervalMs);\n timeElapsed += backoffIntervalMs / 1000; // Convert to seconds\n backoffIntervalMs *= backoffMultiplier;\n }\n\n // There is a chance that lastTxn is still undefined. Let's throw the last error otherwise a WaitForTransactionError\n if (lastTxn === undefined) {\n if (lastError) {\n throw lastError;\n } else {\n throw new WaitForTransactionError(\n `Fetching transaction ${transactionHash} failed and timed out after ${timeoutSecs} seconds`,\n lastTxn,\n );\n }\n }\n\n if (lastTxn.type === TransactionResponseType.Pending) {\n throw new WaitForTransactionError(\n `Transaction ${transactionHash} timed out in pending state after ${timeoutSecs} seconds`,\n lastTxn,\n );\n }\n if (!checkSuccess) {\n return lastTxn;\n }\n if (!lastTxn.success) {\n throw new FailedTransactionError(\n `Transaction ${transactionHash} failed with an error: ${lastTxn.vm_status}`,\n lastTxn,\n );\n }\n\n return lastTxn;\n}\n\n/**\n * Waits for the indexer to sync up to the ledgerVersion. Timeout is 3 seconds.\n */\nexport async function waitForIndexer(args: {\n aptosConfig: AptosConfig;\n minimumLedgerVersion: AnyNumber;\n processorType?: ProcessorType;\n}): Promise<void> {\n const { aptosConfig, processorType } = args;\n const minimumLedgerVersion = BigInt(args.minimumLedgerVersion);\n const timeoutMilliseconds = 3000; // 3 seconds\n const startTime = new Date().getTime();\n let indexerVersion = BigInt(-1);\n\n while (indexerVersion < minimumLedgerVersion) {\n // check for timeout\n if (new Date().getTime() - startTime > timeoutMilliseconds) {\n throw new Error(\"waitForLastSuccessIndexerVersionSync timeout\");\n }\n\n if (processorType === undefined) {\n // Get the last success version from all processor\n // eslint-disable-next-line no-await-in-loop\n indexerVersion = await getIndexerLastSuccessVersion({ aptosConfig });\n } else {\n // Get the last success version from the specific processor\n // eslint-disable-next-line no-await-in-loop\n const processor = await getProcessorStatus({ aptosConfig, processorType });\n indexerVersion = processor.last_success_version;\n }\n\n if (indexerVersion >= minimumLedgerVersion) {\n // break out immediately if we are synced\n break;\n }\n\n // eslint-disable-next-line no-await-in-loop\n await sleep(200);\n }\n}\n\n/**\n * This error is used by `waitForTransaction` when waiting for a\n * transaction to time out or when the transaction response is undefined\n */\nexport class WaitForTransactionError extends Error {\n public readonly lastSubmittedTransaction: TransactionResponse | undefined;\n\n constructor(message: string, lastSubmittedTransaction: TransactionResponse | undefined) {\n super(message);\n this.lastSubmittedTransaction = lastSubmittedTransaction;\n }\n}\n\n/**\n * This error is used by `waitForTransaction` if `checkSuccess` is true.\n * See that function for more information.\n */\nexport class FailedTransactionError extends Error {\n public readonly transaction: TransactionResponse;\n\n constructor(message: string, transaction: TransactionResponse) {\n super(message);\n this.transaction = transaction;\n }\n}\n"],"mappings":"oQA2BA,eAAsBA,EAAgBC,EAGH,CACjC,GAAM,CAAE,YAAAC,EAAa,QAAAC,CAAQ,EAAIF,EACjC,OAAOG,EAA8C,CACnD,YAAAF,EACA,aAAc,kBACd,KAAM,eACN,OAAQ,CAAE,MAAOC,GAAS,OAAQ,MAAOA,GAAS,KAAM,CAC1D,CAAC,CACH,CAEA,eAAsBE,EAAsBJ,EAAoC,CAC9E,GAAM,CAAE,YAAAC,CAAY,EAAID,EAExB,OAAOK,EACL,SAAY,CACV,GAAM,CAAE,KAAAC,CAAK,EAAI,MAAMC,EAAoC,CACzD,YAAAN,EACA,aAAc,wBACd,KAAM,oBACR,CAAC,EACD,OAAOK,CACT,EACA,aAAaL,EAAY,OAAO,GAChC,IAAO,GAAK,CACd,EAAE,CACJ,CAEA,eAAsBO,EAAwBR,EAGb,CAC/B,GAAM,CAAE,YAAAC,EAAa,cAAAQ,CAAc,EAAIT,EACjC,CAAE,KAAAM,CAAK,EAAI,MAAMC,EAA0C,CAC/D,YAAAN,EACA,aAAc,0BACd,KAAM,2BAA2BQ,CAAa,EAChD,CAAC,EACD,OAAOH,CACT,CAEA,eAAsBI,EAAqBV,EAGV,CAC/B,GAAM,CAAE,YAAAC,EAAa,gBAAAU,CAAgB,EAAIX,EACnC,CAAE,KAAAM,CAAK,EAAI,MAAMC,EAA0C,CAC/D,YAAAN,EACA,KAAM,wBAAwBU,CAAe,GAC7C,aAAc,sBAChB,CAAC,EACD,OAAOL,CACT,CAEA,eAAsBM,EAAqBZ,EAGtB,CACnB,GAAM,CAAE,YAAAC,EAAa,gBAAAU,CAAgB,EAAIX,EACzC,GAAI,CAEF,OADoB,MAAMU,EAAqB,CAAE,YAAAT,EAAa,gBAAAU,CAAgB,CAAC,GAC5D,4BACrB,OAASE,EAAQ,CACf,GAAIA,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,MAAMc,EAAML,CAAiB,EAC7BH,GAAeG,EAAoB,IACnCA,GAAqBC,CACvB,CAGA,GAAIH,IAAY,OACd,MAAIC,GAGI,IAAIO,EACR,wBAAwBjB,CAAe,+BAA+BK,CAAW,WACjFI,CACF,EAIJ,GAAIA,EAAQ,6BACV,MAAM,IAAIQ,EACR,eAAejB,CAAe,qCAAqCK,CAAW,WAC9EI,CACF,EAEF,GAAI,CAACH,EACH,OAAOG,EAET,GAAI,CAACA,EAAQ,QACX,MAAM,IAAIS,EACR,eAAelB,CAAe,0BAA0BS,EAAQ,SAAS,GACzEA,CACF,EAGF,OAAOA,CACT,CAKA,eAAsBU,EAAe9B,EAInB,CAChB,GAAM,CAAE,YAAAC,EAAa,cAAA8B,CAAc,EAAI/B,EACjCgC,EAAuB,OAAOhC,EAAK,oBAAoB,EACvDiC,EAAsB,IACtBP,EAAY,IAAI,KAAK,EAAE,QAAQ,EACjCQ,EAAiB,OAAO,EAAE,EAE9B,KAAOA,EAAiBF,GAAsB,CAE5C,GAAI,IAAI,KAAK,EAAE,QAAQ,EAAIN,EAAYO,EACrC,MAAM,IAAI,MAAM,8CAA8C,EAchE,GAXIF,IAAkB,OAGpBG,EAAiB,MAAMC,EAA6B,CAAE,YAAAlC,CAAY,CAAC,EAKnEiC,GADkB,MAAME,EAAmB,CAAE,YAAAnC,EAAa,cAAA8B,CAAc,CAAC,GAC9C,qBAGzBG,GAAkBF,EAEpB,MAIF,MAAML,EAAM,GAAG,CACjB,CACF,CAMO,IAAMC,EAAN,cAAsC,KAAM,CAGjD,YAAYS,EAAiBC,EAA2D,CACtF,MAAMD,CAAO,EACb,KAAK,yBAA2BC,CAClC,CACF,EAMaT,EAAN,cAAqC,KAAM,CAGhD,YAAYQ,EAAiBE,EAAkC,CAC7D,MAAMF,CAAO,EACb,KAAK,YAAcE,CACrB,CACF","names":["getTransactions","args","aptosConfig","options","paginateWithCursor","getGasPriceEstimation","memoizeAsync","data","getAptosFullNode","getTransactionByVersion","ledgerVersion","getTransactionByHash","transactionHash","isTransactionPending","e","longWaitForTransaction","waitForTransaction","timeoutSecs","checkSuccess","isPending","timeElapsed","lastTxn","lastError","backoffIntervalMs","backoffMultiplier","handleAPIError","AptosApiError","startTime","sleep","WaitForTransactionError","FailedTransactionError","waitForIndexer","processorType","minimumLedgerVersion","timeoutMilliseconds","indexerVersion","getIndexerLastSuccessVersion","getProcessorStatus","message","lastSubmittedTransaction","transaction"]}
|
|
1
|
+
{"version":3,"sources":["../../src/internal/transaction.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * This file contains the underlying implementations for exposed API surface in\n * the {@link api/transaction}. By moving the methods out into a separate file,\n * other namespaces and processes can access these methods without depending on the entire\n * transaction namespace and without having a dependency cycle error.\n */\n\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { AptosApiError, getAptosFullNode, paginateWithCursor } from \"../client\";\nimport {\n TransactionResponseType,\n type AnyNumber,\n type GasEstimation,\n type HexInput,\n type PaginationArgs,\n type TransactionResponse,\n WaitForTransactionOptions,\n CommittedTransactionResponse,\n} from \"../types\";\nimport { DEFAULT_TXN_TIMEOUT_SEC, ProcessorType } from \"../utils/const\";\nimport { sleep } from \"../utils/helpers\";\nimport { memoizeAsync } from \"../utils/memoize\";\nimport { getIndexerLastSuccessVersion, getProcessorStatus } from \"./general\";\n\nexport async function getTransactions(args: {\n aptosConfig: AptosConfig;\n options?: PaginationArgs;\n}): Promise<TransactionResponse[]> {\n const { aptosConfig, options } = args;\n return paginateWithCursor<{}, TransactionResponse[]>({\n aptosConfig,\n originMethod: \"getTransactions\",\n path: \"transactions\",\n params: { start: options?.offset, limit: options?.limit },\n });\n}\n\nexport async function getGasPriceEstimation(args: { aptosConfig: AptosConfig }) {\n const { aptosConfig } = args;\n\n return memoizeAsync(\n async () => {\n const { data } = await getAptosFullNode<{}, GasEstimation>({\n aptosConfig,\n originMethod: \"getGasPriceEstimation\",\n path: \"estimate_gas_price\",\n });\n return data;\n },\n `gas-price-${aptosConfig.network}`,\n 1000 * 60 * 5, // 5 minutes\n )();\n}\n\nexport async function getTransactionByVersion(args: {\n aptosConfig: AptosConfig;\n ledgerVersion: AnyNumber;\n}): Promise<TransactionResponse> {\n const { aptosConfig, ledgerVersion } = args;\n const { data } = await getAptosFullNode<{}, TransactionResponse>({\n aptosConfig,\n originMethod: \"getTransactionByVersion\",\n path: `transactions/by_version/${ledgerVersion}`,\n });\n return data;\n}\n\nexport async function getTransactionByHash(args: {\n aptosConfig: AptosConfig;\n transactionHash: HexInput;\n}): Promise<TransactionResponse> {\n const { aptosConfig, transactionHash } = args;\n const { data } = await getAptosFullNode<{}, TransactionResponse>({\n aptosConfig,\n path: `transactions/by_hash/${transactionHash}`,\n originMethod: \"getTransactionByHash\",\n });\n return data;\n}\n\nexport async function isTransactionPending(args: {\n aptosConfig: AptosConfig;\n transactionHash: HexInput;\n}): Promise<boolean> {\n const { aptosConfig, transactionHash } = args;\n try {\n const transaction = await getTransactionByHash({ aptosConfig, transactionHash });\n return transaction.type === TransactionResponseType.Pending;\n } catch (e: any) {\n if (e?.status === 404) {\n return true;\n }\n throw e;\n }\n}\n\nexport async function longWaitForTransaction(args: {\n aptosConfig: AptosConfig;\n transactionHash: HexInput;\n}): Promise<TransactionResponse> {\n const { aptosConfig, transactionHash } = args;\n const { data } = await getAptosFullNode<{}, TransactionResponse>({\n aptosConfig,\n path: `transactions/wait_by_hash/${transactionHash}`,\n originMethod: \"longWaitForTransaction\",\n });\n return data;\n}\n\nexport async function waitForTransaction(args: {\n aptosConfig: AptosConfig;\n transactionHash: HexInput;\n options?: WaitForTransactionOptions;\n}): Promise<CommittedTransactionResponse> {\n const { aptosConfig, transactionHash, options } = args;\n const timeoutSecs = options?.timeoutSecs ?? DEFAULT_TXN_TIMEOUT_SEC;\n const checkSuccess = options?.checkSuccess ?? true;\n\n let isPending = true;\n let timeElapsed = 0;\n let lastTxn: TransactionResponse | undefined;\n let lastError: AptosApiError | undefined;\n let backoffIntervalMs = 200;\n const backoffMultiplier = 1.5;\n\n function handleAPIError(e: any) {\n // In short, this means we will retry if it was an AptosApiError and the code was 404 or 5xx.\n const isAptosApiError = e instanceof AptosApiError;\n if (!isAptosApiError) {\n throw e; // This would be unexpected\n }\n lastError = e;\n const isRequestError = e.status !== 404 && e.status >= 400 && e.status < 500;\n if (isRequestError) {\n throw e;\n }\n }\n\n // check to see if the txn is already on the blockchain\n try {\n lastTxn = await getTransactionByHash({ aptosConfig, transactionHash });\n isPending = lastTxn.type === TransactionResponseType.Pending;\n } catch (e) {\n handleAPIError(e);\n }\n\n // If the transaction is pending, we do a long wait once to avoid polling\n if (isPending) {\n const startTime = Date.now();\n try {\n lastTxn = await longWaitForTransaction({ aptosConfig, transactionHash });\n isPending = lastTxn.type === TransactionResponseType.Pending;\n } catch (e) {\n handleAPIError(e);\n }\n timeElapsed = (Date.now() - startTime) / 1000;\n }\n\n // Now we do polling to see if the transaction is still pending\n while (isPending) {\n if (timeElapsed >= timeoutSecs) {\n break;\n }\n try {\n // eslint-disable-next-line no-await-in-loop\n lastTxn = await getTransactionByHash({ aptosConfig, transactionHash });\n\n isPending = lastTxn.type === TransactionResponseType.Pending;\n\n if (!isPending) {\n break;\n }\n } catch (e) {\n handleAPIError(e);\n }\n // eslint-disable-next-line no-await-in-loop\n await sleep(backoffIntervalMs);\n timeElapsed += backoffIntervalMs / 1000; // Convert to seconds\n backoffIntervalMs *= backoffMultiplier;\n }\n\n // There is a chance that lastTxn is still undefined. Let's throw the last error otherwise a WaitForTransactionError\n if (lastTxn === undefined) {\n if (lastError) {\n throw lastError;\n } else {\n throw new WaitForTransactionError(\n `Fetching transaction ${transactionHash} failed and timed out after ${timeoutSecs} seconds`,\n lastTxn,\n );\n }\n }\n\n if (lastTxn.type === TransactionResponseType.Pending) {\n throw new WaitForTransactionError(\n `Transaction ${transactionHash} timed out in pending state after ${timeoutSecs} seconds`,\n lastTxn,\n );\n }\n if (!checkSuccess) {\n return lastTxn;\n }\n if (!lastTxn.success) {\n throw new FailedTransactionError(\n `Transaction ${transactionHash} failed with an error: ${lastTxn.vm_status}`,\n lastTxn,\n );\n }\n\n return lastTxn;\n}\n\n/**\n * Waits for the indexer to sync up to the ledgerVersion. Timeout is 3 seconds.\n */\nexport async function waitForIndexer(args: {\n aptosConfig: AptosConfig;\n minimumLedgerVersion: AnyNumber;\n processorType?: ProcessorType;\n}): Promise<void> {\n const { aptosConfig, processorType } = args;\n const minimumLedgerVersion = BigInt(args.minimumLedgerVersion);\n const timeoutMilliseconds = 3000; // 3 seconds\n const startTime = new Date().getTime();\n let indexerVersion = BigInt(-1);\n\n while (indexerVersion < minimumLedgerVersion) {\n // check for timeout\n if (new Date().getTime() - startTime > timeoutMilliseconds) {\n throw new Error(\"waitForLastSuccessIndexerVersionSync timeout\");\n }\n\n if (processorType === undefined) {\n // Get the last success version from all processor\n // eslint-disable-next-line no-await-in-loop\n indexerVersion = await getIndexerLastSuccessVersion({ aptosConfig });\n } else {\n // Get the last success version from the specific processor\n // eslint-disable-next-line no-await-in-loop\n const processor = await getProcessorStatus({ aptosConfig, processorType });\n indexerVersion = processor.last_success_version;\n }\n\n if (indexerVersion >= minimumLedgerVersion) {\n // break out immediately if we are synced\n break;\n }\n\n // eslint-disable-next-line no-await-in-loop\n await sleep(200);\n }\n}\n\n/**\n * This error is used by `waitForTransaction` when waiting for a\n * transaction to time out or when the transaction response is undefined\n */\nexport class WaitForTransactionError extends Error {\n public readonly lastSubmittedTransaction: TransactionResponse | undefined;\n\n constructor(message: string, lastSubmittedTransaction: TransactionResponse | undefined) {\n super(message);\n this.lastSubmittedTransaction = lastSubmittedTransaction;\n }\n}\n\n/**\n * This error is used by `waitForTransaction` if `checkSuccess` is true.\n * See that function for more information.\n */\nexport class FailedTransactionError extends Error {\n public readonly transaction: TransactionResponse;\n\n constructor(message: string, transaction: TransactionResponse) {\n super(message);\n this.transaction = transaction;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;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,EAGjD,YAAY,SAAiB,0BAA2D;AACtF,UAAM,OAAO;AACb,SAAK,2BAA2B;AAAA,EAClC;AACF;AAMO,IAAM,yBAAN,cAAqC,MAAM;AAAA,EAGhD,YAAY,SAAiB,aAAkC;AAC7D,UAAM,OAAO;AACb,SAAK,cAAc;AAAA,EACrB;AACF;","names":[]}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import {
|
|
2
|
+
KeylessPublicKey,
|
|
3
|
+
KeylessSignature
|
|
4
|
+
} from "./chunk-4OYYOYSO.mjs";
|
|
5
|
+
import {
|
|
6
|
+
Secp256k1PublicKey,
|
|
7
|
+
Secp256k1Signature
|
|
8
|
+
} from "./chunk-DIYZRGR6.mjs";
|
|
9
|
+
import {
|
|
10
|
+
Ed25519PublicKey,
|
|
11
|
+
Ed25519Signature
|
|
12
|
+
} from "./chunk-RX4VG2AT.mjs";
|
|
13
|
+
import {
|
|
14
|
+
Signature
|
|
15
|
+
} from "./chunk-FDWJNY4U.mjs";
|
|
16
|
+
import {
|
|
17
|
+
AccountPublicKey
|
|
18
|
+
} from "./chunk-FXKSE3ZP.mjs";
|
|
19
|
+
import {
|
|
20
|
+
AuthenticationKey
|
|
21
|
+
} from "./chunk-UEBBLQJ5.mjs";
|
|
22
|
+
|
|
23
|
+
// src/core/crypto/singleKey.ts
|
|
24
|
+
var AnyPublicKey = class _AnyPublicKey extends AccountPublicKey {
|
|
25
|
+
// region Constructors
|
|
26
|
+
constructor(publicKey) {
|
|
27
|
+
super();
|
|
28
|
+
this.publicKey = publicKey;
|
|
29
|
+
if (publicKey instanceof Ed25519PublicKey) {
|
|
30
|
+
this.variant = 0 /* Ed25519 */;
|
|
31
|
+
} else if (publicKey instanceof Secp256k1PublicKey) {
|
|
32
|
+
this.variant = 1 /* Secp256k1 */;
|
|
33
|
+
} else if (publicKey instanceof KeylessPublicKey) {
|
|
34
|
+
this.variant = 3 /* Keyless */;
|
|
35
|
+
} else {
|
|
36
|
+
throw new Error("Unsupported public key type");
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
// endregion
|
|
40
|
+
// region AccountPublicKey
|
|
41
|
+
verifySignature(args) {
|
|
42
|
+
const { message, signature } = args;
|
|
43
|
+
if (!(signature instanceof AnySignature)) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
return this.publicKey.verifySignature({
|
|
47
|
+
message,
|
|
48
|
+
signature: signature.signature
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
authKey() {
|
|
52
|
+
return AuthenticationKey.fromSchemeAndBytes({
|
|
53
|
+
scheme: 2 /* SingleKey */,
|
|
54
|
+
input: this.toUint8Array()
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
toUint8Array() {
|
|
58
|
+
return this.bcsToBytes();
|
|
59
|
+
}
|
|
60
|
+
// endregion
|
|
61
|
+
// region Serializable
|
|
62
|
+
serialize(serializer) {
|
|
63
|
+
serializer.serializeU32AsUleb128(this.variant);
|
|
64
|
+
this.publicKey.serialize(serializer);
|
|
65
|
+
}
|
|
66
|
+
static deserialize(deserializer) {
|
|
67
|
+
const variantIndex = deserializer.deserializeUleb128AsU32();
|
|
68
|
+
let publicKey;
|
|
69
|
+
switch (variantIndex) {
|
|
70
|
+
case 0 /* Ed25519 */:
|
|
71
|
+
publicKey = Ed25519PublicKey.deserialize(deserializer);
|
|
72
|
+
break;
|
|
73
|
+
case 1 /* Secp256k1 */:
|
|
74
|
+
publicKey = Secp256k1PublicKey.deserialize(deserializer);
|
|
75
|
+
break;
|
|
76
|
+
case 3 /* Keyless */:
|
|
77
|
+
publicKey = KeylessPublicKey.deserialize(deserializer);
|
|
78
|
+
break;
|
|
79
|
+
default:
|
|
80
|
+
throw new Error(`Unknown variant index for AnyPublicKey: ${variantIndex}`);
|
|
81
|
+
}
|
|
82
|
+
return new _AnyPublicKey(publicKey);
|
|
83
|
+
}
|
|
84
|
+
// endregion
|
|
85
|
+
/**
|
|
86
|
+
* @deprecated use `instanceof AnyPublicKey` instead.
|
|
87
|
+
*/
|
|
88
|
+
static isPublicKey(publicKey) {
|
|
89
|
+
return publicKey instanceof _AnyPublicKey;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* @deprecated use `publicKey instanceof Ed25519PublicKey` instead.
|
|
93
|
+
*/
|
|
94
|
+
isEd25519() {
|
|
95
|
+
return this.publicKey instanceof Ed25519PublicKey;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* @deprecated use `publicKey instanceof Secp256k1PublicKey` instead.
|
|
99
|
+
*/
|
|
100
|
+
isSecp256k1PublicKey() {
|
|
101
|
+
return this.publicKey instanceof Secp256k1PublicKey;
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
var AnySignature = class _AnySignature extends Signature {
|
|
105
|
+
// region Constructors
|
|
106
|
+
constructor(signature) {
|
|
107
|
+
super();
|
|
108
|
+
this.signature = signature;
|
|
109
|
+
if (signature instanceof Ed25519Signature) {
|
|
110
|
+
this.variant = 0 /* Ed25519 */;
|
|
111
|
+
} else if (signature instanceof Secp256k1Signature) {
|
|
112
|
+
this.variant = 1 /* Secp256k1 */;
|
|
113
|
+
} else if (signature instanceof KeylessSignature) {
|
|
114
|
+
this.variant = 3 /* Keyless */;
|
|
115
|
+
} else {
|
|
116
|
+
throw new Error("Unsupported signature type");
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
// endregion
|
|
120
|
+
// region AccountSignature
|
|
121
|
+
toUint8Array() {
|
|
122
|
+
return this.bcsToBytes();
|
|
123
|
+
}
|
|
124
|
+
// endregion
|
|
125
|
+
// region Serializable
|
|
126
|
+
serialize(serializer) {
|
|
127
|
+
serializer.serializeU32AsUleb128(this.variant);
|
|
128
|
+
this.signature.serialize(serializer);
|
|
129
|
+
}
|
|
130
|
+
static deserialize(deserializer) {
|
|
131
|
+
const variantIndex = deserializer.deserializeUleb128AsU32();
|
|
132
|
+
let signature;
|
|
133
|
+
switch (variantIndex) {
|
|
134
|
+
case 0 /* Ed25519 */:
|
|
135
|
+
signature = Ed25519Signature.deserialize(deserializer);
|
|
136
|
+
break;
|
|
137
|
+
case 1 /* Secp256k1 */:
|
|
138
|
+
signature = Secp256k1Signature.deserialize(deserializer);
|
|
139
|
+
break;
|
|
140
|
+
case 3 /* Keyless */:
|
|
141
|
+
signature = KeylessSignature.deserialize(deserializer);
|
|
142
|
+
break;
|
|
143
|
+
default:
|
|
144
|
+
throw new Error(`Unknown variant index for AnySignature: ${variantIndex}`);
|
|
145
|
+
}
|
|
146
|
+
return new _AnySignature(signature);
|
|
147
|
+
}
|
|
148
|
+
// endregion
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
export {
|
|
152
|
+
AnyPublicKey,
|
|
153
|
+
AnySignature
|
|
154
|
+
};
|
|
155
|
+
//# sourceMappingURL=chunk-TLNHRJB2.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/core/crypto/singleKey.ts"],"sourcesContent":["import { Deserializer, Serializer } from \"../../bcs\";\nimport { AnyPublicKeyVariant, AnySignatureVariant, SigningScheme as AuthenticationKeyScheme } from \"../../types\";\nimport { AuthenticationKey } from \"../authenticationKey\";\nimport { Ed25519PublicKey, Ed25519Signature } from \"./ed25519\";\nimport { AccountPublicKey, PublicKey, VerifySignatureArgs } from \"./publicKey\";\nimport { Secp256k1PublicKey, Secp256k1Signature } from \"./secp256k1\";\nimport { KeylessPublicKey, KeylessSignature } from \"./keyless\";\nimport { Signature } from \"./signature\";\n\n/**\n * Represents any public key supported by Aptos.\n *\n * Since [AIP-55](https://github.com/aptos-foundation/AIPs/pull/263) Aptos supports\n * `Legacy` and `Unified` authentication keys.\n *\n * Any unified authentication key is represented in the SDK as `AnyPublicKey`.\n */\nexport class AnyPublicKey extends AccountPublicKey {\n /**\n * Reference to the inner public key\n */\n public readonly publicKey: PublicKey;\n\n /**\n * Index of the underlying enum variant\n */\n public readonly variant: AnyPublicKeyVariant;\n\n // region Constructors\n\n constructor(publicKey: PublicKey) {\n super();\n this.publicKey = publicKey;\n if (publicKey instanceof Ed25519PublicKey) {\n this.variant = AnyPublicKeyVariant.Ed25519;\n } else if (publicKey instanceof Secp256k1PublicKey) {\n this.variant = AnyPublicKeyVariant.Secp256k1;\n } else if (publicKey instanceof KeylessPublicKey) {\n this.variant = AnyPublicKeyVariant.Keyless;\n } else {\n throw new Error(\"Unsupported public key type\");\n }\n }\n\n // endregion\n\n // region AccountPublicKey\n\n verifySignature(args: VerifySignatureArgs): boolean {\n const { message, signature } = args;\n if (!(signature instanceof AnySignature)) {\n return false;\n }\n\n return this.publicKey.verifySignature({\n message,\n signature: signature.signature,\n });\n }\n\n authKey(): AuthenticationKey {\n return AuthenticationKey.fromSchemeAndBytes({\n scheme: AuthenticationKeyScheme.SingleKey,\n input: this.toUint8Array(),\n });\n }\n\n toUint8Array() {\n return this.bcsToBytes();\n }\n\n // endregion\n\n // region Serializable\n\n serialize(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(this.variant);\n this.publicKey.serialize(serializer);\n }\n\n static deserialize(deserializer: Deserializer): AnyPublicKey {\n const variantIndex = deserializer.deserializeUleb128AsU32();\n let publicKey: PublicKey;\n switch (variantIndex) {\n case AnyPublicKeyVariant.Ed25519:\n publicKey = Ed25519PublicKey.deserialize(deserializer);\n break;\n case AnyPublicKeyVariant.Secp256k1:\n publicKey = Secp256k1PublicKey.deserialize(deserializer);\n break;\n case AnyPublicKeyVariant.Keyless:\n publicKey = KeylessPublicKey.deserialize(deserializer);\n break;\n default:\n throw new Error(`Unknown variant index for AnyPublicKey: ${variantIndex}`);\n }\n return new AnyPublicKey(publicKey);\n }\n\n // endregion\n\n /**\n * @deprecated use `instanceof AnyPublicKey` instead.\n */\n static isPublicKey(publicKey: AccountPublicKey): publicKey is AnyPublicKey {\n return publicKey instanceof AnyPublicKey;\n }\n\n /**\n * @deprecated use `publicKey instanceof Ed25519PublicKey` instead.\n */\n isEd25519(): boolean {\n return this.publicKey instanceof Ed25519PublicKey;\n }\n\n /**\n * @deprecated use `publicKey instanceof Secp256k1PublicKey` instead.\n */\n isSecp256k1PublicKey(): boolean {\n return this.publicKey instanceof Secp256k1PublicKey;\n }\n}\n\n/**\n * Instance of signature that uses the SingleKey authentication scheme.\n * This signature can only be generated by a `SingleKeySigner`, since it uses the\n * same authentication scheme.\n */\nexport class AnySignature extends Signature {\n public readonly signature: Signature;\n\n /**\n * Index of the underlying enum variant\n */\n private readonly variant: AnySignatureVariant;\n\n // region Constructors\n\n constructor(signature: Signature) {\n super();\n this.signature = signature;\n\n if (signature instanceof Ed25519Signature) {\n this.variant = AnySignatureVariant.Ed25519;\n } else if (signature instanceof Secp256k1Signature) {\n this.variant = AnySignatureVariant.Secp256k1;\n } else if (signature instanceof KeylessSignature) {\n this.variant = AnySignatureVariant.Keyless;\n } else {\n throw new Error(\"Unsupported signature type\");\n }\n }\n\n // endregion\n\n // region AccountSignature\n\n toUint8Array() {\n return this.bcsToBytes();\n }\n\n // endregion\n\n // region Serializable\n\n serialize(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(this.variant);\n this.signature.serialize(serializer);\n }\n\n static deserialize(deserializer: Deserializer): AnySignature {\n const variantIndex = deserializer.deserializeUleb128AsU32();\n let signature: Signature;\n switch (variantIndex) {\n case AnySignatureVariant.Ed25519:\n signature = Ed25519Signature.deserialize(deserializer);\n break;\n case AnySignatureVariant.Secp256k1:\n signature = Secp256k1Signature.deserialize(deserializer);\n break;\n case AnySignatureVariant.Keyless:\n signature = KeylessSignature.deserialize(deserializer);\n break;\n default:\n throw new Error(`Unknown variant index for AnySignature: ${variantIndex}`);\n }\n return new AnySignature(signature);\n }\n\n // endregion\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/core/crypto/singleKey.ts"],"sourcesContent":["import { Deserializer, Serializer } from \"../../bcs\";\nimport { AnyPublicKeyVariant, AnySignatureVariant, SigningScheme as AuthenticationKeyScheme } from \"../../types\";\nimport { AuthenticationKey } from \"../authenticationKey\";\nimport { Ed25519PublicKey, Ed25519Signature } from \"./ed25519\";\nimport { AccountPublicKey, PublicKey, VerifySignatureArgs } from \"./publicKey\";\nimport { Secp256k1PublicKey, Secp256k1Signature } from \"./secp256k1\";\nimport { KeylessPublicKey, KeylessSignature } from \"./keyless\";\nimport { Signature } from \"./signature\";\n\n/**\n * Represents any public key supported by Aptos.\n *\n * Since [AIP-55](https://github.com/aptos-foundation/AIPs/pull/263) Aptos supports\n * `Legacy` and `Unified` authentication keys.\n *\n * Any unified authentication key is represented in the SDK as `AnyPublicKey`.\n */\nexport class AnyPublicKey extends AccountPublicKey {\n /**\n * Reference to the inner public key\n */\n public readonly publicKey: PublicKey;\n\n /**\n * Index of the underlying enum variant\n */\n public readonly variant: AnyPublicKeyVariant;\n\n // region Constructors\n\n constructor(publicKey: PublicKey) {\n super();\n this.publicKey = publicKey;\n if (publicKey instanceof Ed25519PublicKey) {\n this.variant = AnyPublicKeyVariant.Ed25519;\n } else if (publicKey instanceof Secp256k1PublicKey) {\n this.variant = AnyPublicKeyVariant.Secp256k1;\n } else if (publicKey instanceof KeylessPublicKey) {\n this.variant = AnyPublicKeyVariant.Keyless;\n } else {\n throw new Error(\"Unsupported public key type\");\n }\n }\n\n // endregion\n\n // region AccountPublicKey\n\n verifySignature(args: VerifySignatureArgs): boolean {\n const { message, signature } = args;\n if (!(signature instanceof AnySignature)) {\n return false;\n }\n\n return this.publicKey.verifySignature({\n message,\n signature: signature.signature,\n });\n }\n\n authKey(): AuthenticationKey {\n return AuthenticationKey.fromSchemeAndBytes({\n scheme: AuthenticationKeyScheme.SingleKey,\n input: this.toUint8Array(),\n });\n }\n\n toUint8Array() {\n return this.bcsToBytes();\n }\n\n // endregion\n\n // region Serializable\n\n serialize(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(this.variant);\n this.publicKey.serialize(serializer);\n }\n\n static deserialize(deserializer: Deserializer): AnyPublicKey {\n const variantIndex = deserializer.deserializeUleb128AsU32();\n let publicKey: PublicKey;\n switch (variantIndex) {\n case AnyPublicKeyVariant.Ed25519:\n publicKey = Ed25519PublicKey.deserialize(deserializer);\n break;\n case AnyPublicKeyVariant.Secp256k1:\n publicKey = Secp256k1PublicKey.deserialize(deserializer);\n break;\n case AnyPublicKeyVariant.Keyless:\n publicKey = KeylessPublicKey.deserialize(deserializer);\n break;\n default:\n throw new Error(`Unknown variant index for AnyPublicKey: ${variantIndex}`);\n }\n return new AnyPublicKey(publicKey);\n }\n\n // endregion\n\n /**\n * @deprecated use `instanceof AnyPublicKey` instead.\n */\n static isPublicKey(publicKey: AccountPublicKey): publicKey is AnyPublicKey {\n return publicKey instanceof AnyPublicKey;\n }\n\n /**\n * @deprecated use `publicKey instanceof Ed25519PublicKey` instead.\n */\n isEd25519(): boolean {\n return this.publicKey instanceof Ed25519PublicKey;\n }\n\n /**\n * @deprecated use `publicKey instanceof Secp256k1PublicKey` instead.\n */\n isSecp256k1PublicKey(): boolean {\n return this.publicKey instanceof Secp256k1PublicKey;\n }\n}\n\n/**\n * Instance of signature that uses the SingleKey authentication scheme.\n * This signature can only be generated by a `SingleKeySigner`, since it uses the\n * same authentication scheme.\n */\nexport class AnySignature extends Signature {\n public readonly signature: Signature;\n\n /**\n * Index of the underlying enum variant\n */\n private readonly variant: AnySignatureVariant;\n\n // region Constructors\n\n constructor(signature: Signature) {\n super();\n this.signature = signature;\n\n if (signature instanceof Ed25519Signature) {\n this.variant = AnySignatureVariant.Ed25519;\n } else if (signature instanceof Secp256k1Signature) {\n this.variant = AnySignatureVariant.Secp256k1;\n } else if (signature instanceof KeylessSignature) {\n this.variant = AnySignatureVariant.Keyless;\n } else {\n throw new Error(\"Unsupported signature type\");\n }\n }\n\n // endregion\n\n // region AccountSignature\n\n toUint8Array() {\n return this.bcsToBytes();\n }\n\n // endregion\n\n // region Serializable\n\n serialize(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(this.variant);\n this.signature.serialize(serializer);\n }\n\n static deserialize(deserializer: Deserializer): AnySignature {\n const variantIndex = deserializer.deserializeUleb128AsU32();\n let signature: Signature;\n switch (variantIndex) {\n case AnySignatureVariant.Ed25519:\n signature = Ed25519Signature.deserialize(deserializer);\n break;\n case AnySignatureVariant.Secp256k1:\n signature = Secp256k1Signature.deserialize(deserializer);\n break;\n case AnySignatureVariant.Keyless:\n signature = KeylessSignature.deserialize(deserializer);\n break;\n default:\n throw new Error(`Unknown variant index for AnySignature: ${variantIndex}`);\n }\n return new AnySignature(signature);\n }\n\n // endregion\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAiBO,IAAM,eAAN,MAAM,sBAAqB,iBAAiB;AAAA;AAAA,EAajD,YAAY,WAAsB;AAChC,UAAM;AACN,SAAK,YAAY;AACjB,QAAI,qBAAqB,kBAAkB;AACzC,WAAK;AAAA,IACP,WAAW,qBAAqB,oBAAoB;AAClD,WAAK;AAAA,IACP,WAAW,qBAAqB,kBAAkB;AAChD,WAAK;AAAA,IACP,OAAO;AACL,YAAM,IAAI,MAAM,6BAA6B;AAAA,IAC/C;AAAA,EACF;AAAA;AAAA;AAAA,EAMA,gBAAgB,MAAoC;AAClD,UAAM,EAAE,SAAS,UAAU,IAAI;AAC/B,QAAI,EAAE,qBAAqB,eAAe;AACxC,aAAO;AAAA,IACT;AAEA,WAAO,KAAK,UAAU,gBAAgB;AAAA,MACpC;AAAA,MACA,WAAW,UAAU;AAAA,IACvB,CAAC;AAAA,EACH;AAAA,EAEA,UAA6B;AAC3B,WAAO,kBAAkB,mBAAmB;AAAA,MAC1C;AAAA,MACA,OAAO,KAAK,aAAa;AAAA,IAC3B,CAAC;AAAA,EACH;AAAA,EAEA,eAAe;AACb,WAAO,KAAK,WAAW;AAAA,EACzB;AAAA;AAAA;AAAA,EAMA,UAAU,YAA8B;AACtC,eAAW,sBAAsB,KAAK,OAAO;AAC7C,SAAK,UAAU,UAAU,UAAU;AAAA,EACrC;AAAA,EAEA,OAAO,YAAY,cAA0C;AAC3D,UAAM,eAAe,aAAa,wBAAwB;AAC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