@aptos-labs/ts-sdk 1.14.0-zeta.0 → 1.14.0-zeta.1
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/transactionSubmission/submit.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { submitTransaction } from \"../../internal/transactionSubmission\";\nimport { AccountAuthenticator, AnyRawTransaction } from \"../../transactions\";\nimport { PendingTransactionResponse } from \"../../types\";\nimport { AptosConfig } from \"../aptosConfig\";\nimport { ValidateFeePayerDataOnSubmission } from \"./helpers\";\n\n/**\n * A class to handle all `Submit` transaction operations\n */\nexport class Submit {\n readonly config: AptosConfig;\n\n constructor(config: AptosConfig) {\n this.config = config;\n }\n\n /**\n * Submit a simple transaction\n *\n * @param args.transaction An instance of a raw transaction\n * @param args.senderAuthenticator optional. The sender account authenticator\n * @param args.feePayerAuthenticator optional. The fee payer account authenticator if it is a fee payer transaction\n *\n * @returns PendingTransactionResponse\n */\n @ValidateFeePayerDataOnSubmission\n async simple(args: {\n transaction: AnyRawTransaction;\n senderAuthenticator: AccountAuthenticator;\n feePayerAuthenticator?: AccountAuthenticator;\n }): Promise<PendingTransactionResponse> {\n return submitTransaction({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Submit a multi agent transaction\n *\n * @param args.transaction An instance of a raw transaction\n * @param args.senderAuthenticator optional. The sender account authenticator\n * @param args.additionalSignersAuthenticators An array of the secondary signers account authenticators\n * @param args.feePayerAuthenticator optional. The fee payer account authenticator if it is a fee payer transaction\n *\n * @returns PendingTransactionResponse\n */\n @ValidateFeePayerDataOnSubmission\n async multiAgent(args: {\n transaction: AnyRawTransaction;\n senderAuthenticator: AccountAuthenticator;\n additionalSignersAuthenticators: Array<AccountAuthenticator>;\n feePayerAuthenticator?: AccountAuthenticator;\n }): Promise<PendingTransactionResponse> {\n return submitTransaction({ aptosConfig: this.config, ...args });\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/api/transactionSubmission/submit.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { submitTransaction } from \"../../internal/transactionSubmission\";\nimport { AccountAuthenticator, AnyRawTransaction } from \"../../transactions\";\nimport { PendingTransactionResponse } from \"../../types\";\nimport { AptosConfig } from \"../aptosConfig\";\nimport { ValidateFeePayerDataOnSubmission } from \"./helpers\";\n\n/**\n * A class to handle all `Submit` transaction operations\n */\nexport class Submit {\n readonly config: AptosConfig;\n\n constructor(config: AptosConfig) {\n this.config = config;\n }\n\n /**\n * Submit a simple transaction\n *\n * @param args.transaction An instance of a raw transaction\n * @param args.senderAuthenticator optional. The sender account authenticator\n * @param args.feePayerAuthenticator optional. The fee payer account authenticator if it is a fee payer transaction\n *\n * @returns PendingTransactionResponse\n */\n @ValidateFeePayerDataOnSubmission\n async simple(args: {\n transaction: AnyRawTransaction;\n senderAuthenticator: AccountAuthenticator;\n feePayerAuthenticator?: AccountAuthenticator;\n }): Promise<PendingTransactionResponse> {\n return submitTransaction({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Submit a multi agent transaction\n *\n * @param args.transaction An instance of a raw transaction\n * @param args.senderAuthenticator optional. The sender account authenticator\n * @param args.additionalSignersAuthenticators An array of the secondary signers account authenticators\n * @param args.feePayerAuthenticator optional. The fee payer account authenticator if it is a fee payer transaction\n *\n * @returns PendingTransactionResponse\n */\n @ValidateFeePayerDataOnSubmission\n async multiAgent(args: {\n transaction: AnyRawTransaction;\n senderAuthenticator: AccountAuthenticator;\n additionalSignersAuthenticators: Array<AccountAuthenticator>;\n feePayerAuthenticator?: AccountAuthenticator;\n }): Promise<PendingTransactionResponse> {\n return submitTransaction({ aptosConfig: this.config, ...args });\n }\n}\n"],"mappings":";;;;;;;;;;;AAYO,IAAM,SAAN,MAAa;AAAA,EAGlB,YAAY,QAAqB;AAC/B,SAAK,SAAS;AAAA,EAChB;AAAA,EAYA,MAAM,OAAO,MAI2B;AACtC,WAAO,kBAAkB,EAAE,aAAa,KAAK,QAAQ,GAAG,KAAK,CAAC;AAAA,EAChE;AAAA,EAaA,MAAM,WAAW,MAKuB;AACtC,WAAO,kBAAkB,EAAE,aAAa,KAAK,QAAQ,GAAG,KAAK,CAAC;AAAA,EAChE;AACF;AA3BQ;AAAA,EADL;AAAA,GAhBU,OAiBL;AAmBA;AAAA,EADL;AAAA,GAnCU,OAoCL;","names":[]}
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import {
|
|
2
|
+
MAX_U32_NUMBER
|
|
3
|
+
} from "./chunk-SBB4YEPT.mjs";
|
|
4
|
+
|
|
5
|
+
// src/bcs/deserializer.ts
|
|
6
|
+
var Deserializer = class {
|
|
7
|
+
constructor(data) {
|
|
8
|
+
this.buffer = new ArrayBuffer(data.length);
|
|
9
|
+
new Uint8Array(this.buffer).set(data, 0);
|
|
10
|
+
this.offset = 0;
|
|
11
|
+
}
|
|
12
|
+
read(length) {
|
|
13
|
+
if (this.offset + length > this.buffer.byteLength) {
|
|
14
|
+
throw new Error("Reached to the end of buffer");
|
|
15
|
+
}
|
|
16
|
+
const bytes = this.buffer.slice(this.offset, this.offset + length);
|
|
17
|
+
this.offset += length;
|
|
18
|
+
return bytes;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Deserializes a string. UTF8 string is supported. Reads the string's bytes length "l" first,
|
|
22
|
+
* and then reads "l" bytes of content. Decodes the byte array into a string.
|
|
23
|
+
*
|
|
24
|
+
* BCS layout for "string": string_length | string_content
|
|
25
|
+
* where string_length is a u32 integer encoded as a uleb128 integer, equal to the number of bytes in string_content.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* const deserializer = new Deserializer(new Uint8Array([8, 49, 50, 51, 52, 97, 98, 99, 100]));
|
|
30
|
+
* assert(deserializer.deserializeStr() === "1234abcd");
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
deserializeStr() {
|
|
34
|
+
const value = this.deserializeBytes();
|
|
35
|
+
const textDecoder = new TextDecoder();
|
|
36
|
+
return textDecoder.decode(value);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Deserializes a an optional string.
|
|
40
|
+
*
|
|
41
|
+
* BCS layout for Optional<String>: 0 if none, else 1 | string_length | string_content
|
|
42
|
+
* @example
|
|
43
|
+
* ```ts
|
|
44
|
+
* const deserializer = new Deserializer(new Uint8Array([0x00]));
|
|
45
|
+
* assert(deserializer.deserializeOptionStr() === undefined);
|
|
46
|
+
* const deserializer = new Deserializer(new Uint8Array([1, 8, 49, 50, 51, 52, 97, 98, 99, 100]));
|
|
47
|
+
* assert(deserializer.deserializeOptionStr() === "1234abcd");
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
deserializeOptionStr() {
|
|
51
|
+
const exists = this.deserializeUleb128AsU32();
|
|
52
|
+
if (exists === 1) {
|
|
53
|
+
return this.deserializeStr();
|
|
54
|
+
}
|
|
55
|
+
return void 0;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Deserializes a an optional string.
|
|
59
|
+
*
|
|
60
|
+
* BCS layout for Optional<String>: 0 if none, else 1 | string_length | string_content
|
|
61
|
+
* @example
|
|
62
|
+
* ```ts
|
|
63
|
+
* const deserializer = new Deserializer(new Uint8Array([0x00]));
|
|
64
|
+
* assert(deserializer.deserializeOptionStr() === undefined);
|
|
65
|
+
* const deserializer = new Deserializer(new Uint8Array([1, 8, 49, 50, 51, 52, 97, 98, 99, 100]));
|
|
66
|
+
* assert(deserializer.deserializeOptionStr() === "1234abcd");
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
deserializeOption(cls) {
|
|
70
|
+
const exists = this.deserializeUleb128AsU32();
|
|
71
|
+
if (exists === 1) {
|
|
72
|
+
return this.deserialize(cls);
|
|
73
|
+
}
|
|
74
|
+
return void 0;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Deserializes an array of bytes.
|
|
78
|
+
*
|
|
79
|
+
* BCS layout for "bytes": bytes_length | bytes
|
|
80
|
+
* where bytes_length is a u32 integer encoded as a uleb128 integer, equal to the length of the bytes array.
|
|
81
|
+
*/
|
|
82
|
+
deserializeBytes() {
|
|
83
|
+
const len = this.deserializeUleb128AsU32();
|
|
84
|
+
return new Uint8Array(this.read(len));
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Deserializes an array of bytes. The number of bytes to read is already known.
|
|
88
|
+
*
|
|
89
|
+
*/
|
|
90
|
+
deserializeFixedBytes(len) {
|
|
91
|
+
return new Uint8Array(this.read(len));
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Deserializes a boolean value.
|
|
95
|
+
*
|
|
96
|
+
* BCS layout for "boolean": One byte. "0x01" for true and "0x00" for false.
|
|
97
|
+
*/
|
|
98
|
+
deserializeBool() {
|
|
99
|
+
const bool = new Uint8Array(this.read(1))[0];
|
|
100
|
+
if (bool !== 1 && bool !== 0) {
|
|
101
|
+
throw new Error("Invalid boolean value");
|
|
102
|
+
}
|
|
103
|
+
return bool === 1;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Deserializes a uint8 number.
|
|
107
|
+
*
|
|
108
|
+
* BCS layout for "uint8": One byte. Binary format in little-endian representation.
|
|
109
|
+
*/
|
|
110
|
+
deserializeU8() {
|
|
111
|
+
return new DataView(this.read(1)).getUint8(0);
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Deserializes a uint16 number.
|
|
115
|
+
*
|
|
116
|
+
* BCS layout for "uint16": Two bytes. Binary format in little-endian representation.
|
|
117
|
+
* @example
|
|
118
|
+
* ```ts
|
|
119
|
+
* const deserializer = new Deserializer(new Uint8Array([0x34, 0x12]));
|
|
120
|
+
* assert(deserializer.deserializeU16() === 4660);
|
|
121
|
+
* ```
|
|
122
|
+
*/
|
|
123
|
+
deserializeU16() {
|
|
124
|
+
return new DataView(this.read(2)).getUint16(0, true);
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Deserializes a uint32 number.
|
|
128
|
+
*
|
|
129
|
+
* BCS layout for "uint32": Four bytes. Binary format in little-endian representation.
|
|
130
|
+
* @example
|
|
131
|
+
* ```ts
|
|
132
|
+
* const deserializer = new Deserializer(new Uint8Array([0x78, 0x56, 0x34, 0x12]));
|
|
133
|
+
* assert(deserializer.deserializeU32() === 305419896);
|
|
134
|
+
* ```
|
|
135
|
+
*/
|
|
136
|
+
deserializeU32() {
|
|
137
|
+
return new DataView(this.read(4)).getUint32(0, true);
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Deserializes a uint64 number.
|
|
141
|
+
*
|
|
142
|
+
* BCS layout for "uint64": Eight bytes. Binary format in little-endian representation.
|
|
143
|
+
* @example
|
|
144
|
+
* ```ts
|
|
145
|
+
* const deserializer = new Deserializer(new Uint8Array([0x00, 0xEF, 0xCD, 0xAB, 0x78, 0x56, 0x34, 0x12]));
|
|
146
|
+
* assert(deserializer.deserializeU64() === 1311768467750121216);
|
|
147
|
+
* ```
|
|
148
|
+
*/
|
|
149
|
+
deserializeU64() {
|
|
150
|
+
const low = this.deserializeU32();
|
|
151
|
+
const high = this.deserializeU32();
|
|
152
|
+
return BigInt(BigInt(high) << BigInt(32) | BigInt(low));
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Deserializes a uint128 number.
|
|
156
|
+
*
|
|
157
|
+
* BCS layout for "uint128": Sixteen bytes. Binary format in little-endian representation.
|
|
158
|
+
*/
|
|
159
|
+
deserializeU128() {
|
|
160
|
+
const low = this.deserializeU64();
|
|
161
|
+
const high = this.deserializeU64();
|
|
162
|
+
return BigInt(high << BigInt(64) | low);
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Deserializes a uint256 number.
|
|
166
|
+
*
|
|
167
|
+
* BCS layout for "uint256": Thirty-two bytes. Binary format in little-endian representation.
|
|
168
|
+
*/
|
|
169
|
+
deserializeU256() {
|
|
170
|
+
const low = this.deserializeU128();
|
|
171
|
+
const high = this.deserializeU128();
|
|
172
|
+
return BigInt(high << BigInt(128) | low);
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Deserializes a uleb128 encoded uint32 number.
|
|
176
|
+
*
|
|
177
|
+
* BCS use uleb128 encoding in two cases: (1) lengths of variable-length sequences and (2) tags of enum values
|
|
178
|
+
*/
|
|
179
|
+
deserializeUleb128AsU32() {
|
|
180
|
+
let value = BigInt(0);
|
|
181
|
+
let shift = 0;
|
|
182
|
+
while (value < MAX_U32_NUMBER) {
|
|
183
|
+
const byte = this.deserializeU8();
|
|
184
|
+
value |= BigInt(byte & 127) << BigInt(shift);
|
|
185
|
+
if ((byte & 128) === 0) {
|
|
186
|
+
break;
|
|
187
|
+
}
|
|
188
|
+
shift += 7;
|
|
189
|
+
}
|
|
190
|
+
if (value > MAX_U32_NUMBER) {
|
|
191
|
+
throw new Error("Overflow while parsing uleb128-encoded uint32 value");
|
|
192
|
+
}
|
|
193
|
+
return Number(value);
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Helper function that primarily exists to support alternative syntax for deserialization.
|
|
197
|
+
* That is, if we have a `const deserializer: new Deserializer(...)`, instead of having to use
|
|
198
|
+
* `MyClass.deserialize(deserializer)`, we can call `deserializer.deserialize(MyClass)`.
|
|
199
|
+
*
|
|
200
|
+
* @example const deserializer = new Deserializer(new Uint8Array([1, 2, 3]));
|
|
201
|
+
* const value = deserializer.deserialize(MyClass); // where MyClass has a `deserialize` function
|
|
202
|
+
* // value is now an instance of MyClass
|
|
203
|
+
* // equivalent to `const value = MyClass.deserialize(deserializer)`
|
|
204
|
+
* @param cls The BCS-deserializable class to deserialize the buffered bytes into.
|
|
205
|
+
*
|
|
206
|
+
* @returns the deserialized value of class type T
|
|
207
|
+
*/
|
|
208
|
+
deserialize(cls) {
|
|
209
|
+
return cls.deserialize(this);
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Deserializes an array of BCS Deserializable values given an existing Deserializer
|
|
213
|
+
* instance with a loaded byte buffer.
|
|
214
|
+
*
|
|
215
|
+
* @param cls The BCS-deserializable class to deserialize the buffered bytes into.
|
|
216
|
+
* @example
|
|
217
|
+
* // serialize a vector of addresses
|
|
218
|
+
* const addresses = new Array<AccountAddress>(
|
|
219
|
+
* AccountAddress.from("0x1"),
|
|
220
|
+
* AccountAddress.from("0x2"),
|
|
221
|
+
* AccountAddress.from("0xa"),
|
|
222
|
+
* AccountAddress.from("0xb"),
|
|
223
|
+
* );
|
|
224
|
+
* const serializer = new Serializer();
|
|
225
|
+
* serializer.serializeVector(addresses);
|
|
226
|
+
* const serializedBytes = serializer.toUint8Array();
|
|
227
|
+
*
|
|
228
|
+
* // deserialize the bytes into an array of addresses
|
|
229
|
+
* const deserializer = new Deserializer(serializedBytes);
|
|
230
|
+
* const deserializedAddresses = deserializer.deserializeVector(AccountAddress);
|
|
231
|
+
* // deserializedAddresses is now an array of AccountAddress instances
|
|
232
|
+
* @returns an array of deserialized values of type T
|
|
233
|
+
*/
|
|
234
|
+
deserializeVector(cls) {
|
|
235
|
+
const length = this.deserializeUleb128AsU32();
|
|
236
|
+
const vector = new Array();
|
|
237
|
+
for (let i = 0; i < length; i += 1) {
|
|
238
|
+
vector.push(this.deserialize(cls));
|
|
239
|
+
}
|
|
240
|
+
return vector;
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
export {
|
|
245
|
+
Deserializer
|
|
246
|
+
};
|
|
247
|
+
//# sourceMappingURL=chunk-7JRMOHBP.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/bcs/deserializer.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/* eslint-disable no-bitwise */\nimport { MAX_U32_NUMBER } from \"./consts\";\nimport { Uint8, Uint16, Uint32, Uint64, Uint128, Uint256 } from \"../types\";\n\n/**\n * This interface exists to define Deserializable<T> inputs for functions that\n * deserialize a byte buffer into a type T.\n * It is not intended to be implemented or extended, because Typescript has no support\n * for static methods in interfaces.\n */\nexport interface Deserializable<T> {\n deserialize(deserializer: Deserializer): T;\n}\n\nexport class Deserializer {\n private buffer: ArrayBuffer;\n\n private offset: number;\n\n constructor(data: Uint8Array) {\n // copies data to prevent outside mutation of buffer.\n this.buffer = new ArrayBuffer(data.length);\n new Uint8Array(this.buffer).set(data, 0);\n this.offset = 0;\n }\n\n private read(length: number): ArrayBuffer {\n if (this.offset + length > this.buffer.byteLength) {\n throw new Error(\"Reached to the end of buffer\");\n }\n\n const bytes = this.buffer.slice(this.offset, this.offset + length);\n this.offset += length;\n return bytes;\n }\n\n /**\n * Deserializes a string. UTF8 string is supported. Reads the string's bytes length \"l\" first,\n * and then reads \"l\" bytes of content. Decodes the byte array into a string.\n *\n * BCS layout for \"string\": string_length | string_content\n * where string_length is a u32 integer encoded as a uleb128 integer, equal to the number of bytes in string_content.\n *\n * @example\n * ```ts\n * const deserializer = new Deserializer(new Uint8Array([8, 49, 50, 51, 52, 97, 98, 99, 100]));\n * assert(deserializer.deserializeStr() === \"1234abcd\");\n * ```\n */\n deserializeStr(): string {\n const value = this.deserializeBytes();\n const textDecoder = new TextDecoder();\n return textDecoder.decode(value);\n }\n\n /**\n * Deserializes a an optional string.\n *\n * BCS layout for Optional<String>: 0 if none, else 1 | string_length | string_content\n * @example\n * ```ts\n * const deserializer = new Deserializer(new Uint8Array([0x00]));\n * assert(deserializer.deserializeOptionStr() === undefined);\n * const deserializer = new Deserializer(new Uint8Array([1, 8, 49, 50, 51, 52, 97, 98, 99, 100]));\n * assert(deserializer.deserializeOptionStr() === \"1234abcd\");\n * ```\n */\n deserializeOptionStr(): string | undefined {\n const exists = this.deserializeUleb128AsU32();\n if (exists === 1) {\n return this.deserializeStr();\n }\n return undefined;\n }\n\n /**\n * Deserializes a an optional string.\n *\n * BCS layout for Optional<String>: 0 if none, else 1 | string_length | string_content\n * @example\n * ```ts\n * const deserializer = new Deserializer(new Uint8Array([0x00]));\n * assert(deserializer.deserializeOptionStr() === undefined);\n * const deserializer = new Deserializer(new Uint8Array([1, 8, 49, 50, 51, 52, 97, 98, 99, 100]));\n * assert(deserializer.deserializeOptionStr() === \"1234abcd\");\n * ```\n */\n deserializeOption<T>(cls: Deserializable<T>): T | undefined {\n const exists = this.deserializeUleb128AsU32();\n if (exists === 1) {\n return this.deserialize(cls);\n }\n return undefined;\n }\n\n /**\n * Deserializes an array of bytes.\n *\n * BCS layout for \"bytes\": bytes_length | bytes\n * where bytes_length is a u32 integer encoded as a uleb128 integer, equal to the length of the bytes array.\n */\n deserializeBytes(): Uint8Array {\n const len = this.deserializeUleb128AsU32();\n return new Uint8Array(this.read(len));\n }\n\n /**\n * Deserializes an array of bytes. The number of bytes to read is already known.\n *\n */\n deserializeFixedBytes(len: number): Uint8Array {\n return new Uint8Array(this.read(len));\n }\n\n /**\n * Deserializes a boolean value.\n *\n * BCS layout for \"boolean\": One byte. \"0x01\" for true and \"0x00\" for false.\n */\n deserializeBool(): boolean {\n const bool = new Uint8Array(this.read(1))[0];\n if (bool !== 1 && bool !== 0) {\n throw new Error(\"Invalid boolean value\");\n }\n return bool === 1;\n }\n\n /**\n * Deserializes a uint8 number.\n *\n * BCS layout for \"uint8\": One byte. Binary format in little-endian representation.\n */\n deserializeU8(): Uint8 {\n return new DataView(this.read(1)).getUint8(0);\n }\n\n /**\n * Deserializes a uint16 number.\n *\n * BCS layout for \"uint16\": Two bytes. Binary format in little-endian representation.\n * @example\n * ```ts\n * const deserializer = new Deserializer(new Uint8Array([0x34, 0x12]));\n * assert(deserializer.deserializeU16() === 4660);\n * ```\n */\n deserializeU16(): Uint16 {\n return new DataView(this.read(2)).getUint16(0, true);\n }\n\n /**\n * Deserializes a uint32 number.\n *\n * BCS layout for \"uint32\": Four bytes. Binary format in little-endian representation.\n * @example\n * ```ts\n * const deserializer = new Deserializer(new Uint8Array([0x78, 0x56, 0x34, 0x12]));\n * assert(deserializer.deserializeU32() === 305419896);\n * ```\n */\n deserializeU32(): Uint32 {\n return new DataView(this.read(4)).getUint32(0, true);\n }\n\n /**\n * Deserializes a uint64 number.\n *\n * BCS layout for \"uint64\": Eight bytes. Binary format in little-endian representation.\n * @example\n * ```ts\n * const deserializer = new Deserializer(new Uint8Array([0x00, 0xEF, 0xCD, 0xAB, 0x78, 0x56, 0x34, 0x12]));\n * assert(deserializer.deserializeU64() === 1311768467750121216);\n * ```\n */\n deserializeU64(): Uint64 {\n const low = this.deserializeU32();\n const high = this.deserializeU32();\n\n // combine the two 32-bit values and return (little endian)\n return BigInt((BigInt(high) << BigInt(32)) | BigInt(low));\n }\n\n /**\n * Deserializes a uint128 number.\n *\n * BCS layout for \"uint128\": Sixteen bytes. Binary format in little-endian representation.\n */\n deserializeU128(): Uint128 {\n const low = this.deserializeU64();\n const high = this.deserializeU64();\n\n // combine the two 64-bit values and return (little endian)\n return BigInt((high << BigInt(64)) | low);\n }\n\n /**\n * Deserializes a uint256 number.\n *\n * BCS layout for \"uint256\": Thirty-two bytes. Binary format in little-endian representation.\n */\n deserializeU256(): Uint256 {\n const low = this.deserializeU128();\n const high = this.deserializeU128();\n\n // combine the two 128-bit values and return (little endian)\n return BigInt((high << BigInt(128)) | low);\n }\n\n /**\n * Deserializes a uleb128 encoded uint32 number.\n *\n * BCS use uleb128 encoding in two cases: (1) lengths of variable-length sequences and (2) tags of enum values\n */\n deserializeUleb128AsU32(): Uint32 {\n let value: bigint = BigInt(0);\n let shift = 0;\n\n while (value < MAX_U32_NUMBER) {\n const byte = this.deserializeU8();\n value |= BigInt(byte & 0x7f) << BigInt(shift);\n\n if ((byte & 0x80) === 0) {\n break;\n }\n shift += 7;\n }\n\n if (value > MAX_U32_NUMBER) {\n throw new Error(\"Overflow while parsing uleb128-encoded uint32 value\");\n }\n\n return Number(value);\n }\n\n /**\n * Helper function that primarily exists to support alternative syntax for deserialization.\n * That is, if we have a `const deserializer: new Deserializer(...)`, instead of having to use\n * `MyClass.deserialize(deserializer)`, we can call `deserializer.deserialize(MyClass)`.\n *\n * @example const deserializer = new Deserializer(new Uint8Array([1, 2, 3]));\n * const value = deserializer.deserialize(MyClass); // where MyClass has a `deserialize` function\n * // value is now an instance of MyClass\n * // equivalent to `const value = MyClass.deserialize(deserializer)`\n * @param cls The BCS-deserializable class to deserialize the buffered bytes into.\n *\n * @returns the deserialized value of class type T\n */\n deserialize<T>(cls: Deserializable<T>): T {\n // NOTE: `deserialize` in `cls.deserialize(this)` here is a static method defined in `cls`,\n // It is separate from the `deserialize` instance method defined here in Deserializer.\n return cls.deserialize(this);\n }\n\n /**\n * Deserializes an array of BCS Deserializable values given an existing Deserializer\n * instance with a loaded byte buffer.\n *\n * @param cls The BCS-deserializable class to deserialize the buffered bytes into.\n * @example\n * // serialize a vector of addresses\n * const addresses = new Array<AccountAddress>(\n * AccountAddress.from(\"0x1\"),\n * AccountAddress.from(\"0x2\"),\n * AccountAddress.from(\"0xa\"),\n * AccountAddress.from(\"0xb\"),\n * );\n * const serializer = new Serializer();\n * serializer.serializeVector(addresses);\n * const serializedBytes = serializer.toUint8Array();\n *\n * // deserialize the bytes into an array of addresses\n * const deserializer = new Deserializer(serializedBytes);\n * const deserializedAddresses = deserializer.deserializeVector(AccountAddress);\n * // deserializedAddresses is now an array of AccountAddress instances\n * @returns an array of deserialized values of type T\n */\n deserializeVector<T>(cls: Deserializable<T>): Array<T> {\n const length = this.deserializeUleb128AsU32();\n const vector = new Array<T>();\n for (let i = 0; i < length; i += 1) {\n vector.push(this.deserialize(cls));\n }\n return vector;\n }\n}\n"],"mappings":"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","names":[]}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// src/utils/apiEndpoints.ts
|
|
2
|
+
var NetworkToIndexerAPI = {
|
|
3
|
+
mainnet: "https://api.mainnet.aptoslabs.com/v1/graphql",
|
|
4
|
+
testnet: "https://api.testnet.aptoslabs.com/v1/graphql",
|
|
5
|
+
devnet: "https://api.devnet.aptoslabs.com/v1/graphql",
|
|
6
|
+
local: "http://127.0.0.1:8090/v1/graphql"
|
|
7
|
+
};
|
|
8
|
+
var NetworkToNodeAPI = {
|
|
9
|
+
mainnet: "https://api.mainnet.aptoslabs.com/v1",
|
|
10
|
+
testnet: "https://api.testnet.aptoslabs.com/v1",
|
|
11
|
+
devnet: "https://api.devnet.aptoslabs.com/v1",
|
|
12
|
+
local: "http://127.0.0.1:8080/v1"
|
|
13
|
+
};
|
|
14
|
+
var NetworkToFaucetAPI = {
|
|
15
|
+
mainnet: "https://faucet.mainnet.aptoslabs.com",
|
|
16
|
+
testnet: "https://faucet.testnet.aptoslabs.com",
|
|
17
|
+
devnet: "https://faucet.devnet.aptoslabs.com",
|
|
18
|
+
local: "http://127.0.0.1:8081"
|
|
19
|
+
};
|
|
20
|
+
var NetworkToPepperAPI = {
|
|
21
|
+
mainnet: "https://pepper.keyless.mainnet.aptoslabs.com/v0",
|
|
22
|
+
testnet: "https://pepper.keyless.testnet.aptoslabs.com/v0",
|
|
23
|
+
devnet: "https://api.devnet.aptoslabs.com/keyless/pepper/v0",
|
|
24
|
+
local: "http://127.0.0.1:8000/v0"
|
|
25
|
+
};
|
|
26
|
+
var NetworkToProverAPI = {
|
|
27
|
+
mainnet: "https://prover.keyless.mainnet.aptoslabs.com/v0",
|
|
28
|
+
testnet: "https://prover.keyless.testnet.aptoslabs.com/v0",
|
|
29
|
+
devnet: "https://api.devnet.aptoslabs.com/keyless/prover/v0",
|
|
30
|
+
local: "http://127.0.0.1:8083/v0"
|
|
31
|
+
};
|
|
32
|
+
var Network = /* @__PURE__ */ ((Network2) => {
|
|
33
|
+
Network2["MAINNET"] = "mainnet";
|
|
34
|
+
Network2["TESTNET"] = "testnet";
|
|
35
|
+
Network2["DEVNET"] = "devnet";
|
|
36
|
+
Network2["LOCAL"] = "local";
|
|
37
|
+
Network2["CUSTOM"] = "custom";
|
|
38
|
+
return Network2;
|
|
39
|
+
})(Network || {});
|
|
40
|
+
var NetworkToChainId = {
|
|
41
|
+
mainnet: 1,
|
|
42
|
+
testnet: 2,
|
|
43
|
+
local: 4
|
|
44
|
+
};
|
|
45
|
+
var NetworkToNetworkName = {
|
|
46
|
+
mainnet: "mainnet" /* MAINNET */,
|
|
47
|
+
testnet: "testnet" /* TESTNET */,
|
|
48
|
+
devnet: "devnet" /* DEVNET */,
|
|
49
|
+
local: "local" /* LOCAL */,
|
|
50
|
+
custom: "custom" /* CUSTOM */
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export {
|
|
54
|
+
NetworkToIndexerAPI,
|
|
55
|
+
NetworkToNodeAPI,
|
|
56
|
+
NetworkToFaucetAPI,
|
|
57
|
+
NetworkToPepperAPI,
|
|
58
|
+
NetworkToProverAPI,
|
|
59
|
+
Network,
|
|
60
|
+
NetworkToChainId,
|
|
61
|
+
NetworkToNetworkName
|
|
62
|
+
};
|
|
63
|
+
//# sourceMappingURL=chunk-7REUIYF4.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/apiEndpoints.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nexport const NetworkToIndexerAPI: Record<string, string> = {\n mainnet: \"https://api.mainnet.aptoslabs.com/v1/graphql\",\n testnet: \"https://api.testnet.aptoslabs.com/v1/graphql\",\n devnet: \"https://api.devnet.aptoslabs.com/v1/graphql\",\n local: \"http://127.0.0.1:8090/v1/graphql\",\n};\n\nexport const NetworkToNodeAPI: Record<string, string> = {\n mainnet: \"https://api.mainnet.aptoslabs.com/v1\",\n testnet: \"https://api.testnet.aptoslabs.com/v1\",\n devnet: \"https://api.devnet.aptoslabs.com/v1\",\n local: \"http://127.0.0.1:8080/v1\",\n};\n\nexport const NetworkToFaucetAPI: Record<string, string> = {\n mainnet: \"https://faucet.mainnet.aptoslabs.com\",\n testnet: \"https://faucet.testnet.aptoslabs.com\",\n devnet: \"https://faucet.devnet.aptoslabs.com\",\n local: \"http://127.0.0.1:8081\",\n};\n\nexport const NetworkToPepperAPI: Record<string, string> = {\n mainnet: \"https://pepper.keyless.mainnet.aptoslabs.com/v0\",\n testnet: \"https://pepper.keyless.testnet.aptoslabs.com/v0\",\n devnet: \"https://api.devnet.aptoslabs.com/keyless/pepper/v0\",\n local: \"http://127.0.0.1:8000/v0\",\n};\n\nexport const NetworkToProverAPI: Record<string, string> = {\n mainnet: \"https://prover.keyless.mainnet.aptoslabs.com/v0\",\n testnet: \"https://prover.keyless.testnet.aptoslabs.com/v0\",\n devnet: \"https://api.devnet.aptoslabs.com/keyless/prover/v0\",\n local: \"http://127.0.0.1:8083/v0\",\n};\n\nexport enum Network {\n MAINNET = \"mainnet\",\n TESTNET = \"testnet\",\n DEVNET = \"devnet\",\n LOCAL = \"local\",\n CUSTOM = \"custom\",\n}\n\nexport const NetworkToChainId: Record<string, number> = {\n mainnet: 1,\n testnet: 2,\n local: 4,\n};\n\nexport const NetworkToNetworkName: Record<string, Network> = {\n mainnet: Network.MAINNET,\n testnet: Network.TESTNET,\n devnet: Network.DEVNET,\n local: Network.LOCAL,\n custom: Network.CUSTOM,\n};\n"],"mappings":";AAGO,IAAM,sBAA8C;AAAA,EACzD,SAAS;AAAA,EACT,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,OAAO;AACT;AAEO,IAAM,mBAA2C;AAAA,EACtD,SAAS;AAAA,EACT,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,OAAO;AACT;AAEO,IAAM,qBAA6C;AAAA,EACxD,SAAS;AAAA,EACT,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,OAAO;AACT;AAEO,IAAM,qBAA6C;AAAA,EACxD,SAAS;AAAA,EACT,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,OAAO;AACT;AAEO,IAAM,qBAA6C;AAAA,EACxD,SAAS;AAAA,EACT,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,OAAO;AACT;AAEO,IAAK,UAAL,kBAAKA,aAAL;AACL,EAAAA,SAAA,aAAU;AACV,EAAAA,SAAA,aAAU;AACV,EAAAA,SAAA,YAAS;AACT,EAAAA,SAAA,WAAQ;AACR,EAAAA,SAAA,YAAS;AALC,SAAAA;AAAA,GAAA;AAQL,IAAM,mBAA2C;AAAA,EACtD,SAAS;AAAA,EACT,SAAS;AAAA,EACT,OAAO;AACT;AAEO,IAAM,uBAAgD;AAAA,EAC3D,SAAS;AAAA,EACT,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,QAAQ;AACV;","names":["Network"]}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// src/transactions/management/asyncQueue.ts
|
|
2
|
+
var AsyncQueue = class {
|
|
3
|
+
constructor() {
|
|
4
|
+
this.queue = [];
|
|
5
|
+
// The pendingDequeue is used to handle the resolution of promises when items are enqueued and dequeued.
|
|
6
|
+
this.pendingDequeue = [];
|
|
7
|
+
this.cancelled = false;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The enqueue method adds an item to the queue. If there are pending dequeued promises,
|
|
11
|
+
* in the pendingDequeue, it resolves the oldest promise with the enqueued item immediately.
|
|
12
|
+
* Otherwise, it adds the item to the queue.
|
|
13
|
+
*
|
|
14
|
+
* @param item T
|
|
15
|
+
*/
|
|
16
|
+
enqueue(item) {
|
|
17
|
+
this.cancelled = false;
|
|
18
|
+
if (this.pendingDequeue.length > 0) {
|
|
19
|
+
const promise = this.pendingDequeue.shift();
|
|
20
|
+
promise?.resolve(item);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
this.queue.push(item);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The dequeue method returns a promise that resolves to the next item in the queue.
|
|
27
|
+
* If the queue is not empty, it resolves the promise immediately with the next item.
|
|
28
|
+
* Otherwise, it creates a new promise. The promise's resolve function is stored
|
|
29
|
+
* in the pendingDequeue with a unique counter value as the key.
|
|
30
|
+
* The newly created promise is then returned, and it will be resolved later when an item is enqueued.
|
|
31
|
+
*
|
|
32
|
+
* @returns Promise<T>
|
|
33
|
+
*/
|
|
34
|
+
async dequeue() {
|
|
35
|
+
if (this.queue.length > 0) {
|
|
36
|
+
return Promise.resolve(this.queue.shift());
|
|
37
|
+
}
|
|
38
|
+
return new Promise((resolve, reject) => {
|
|
39
|
+
this.pendingDequeue.push({ resolve, reject });
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* The isEmpty method returns whether the queue is empty or not.
|
|
44
|
+
*
|
|
45
|
+
* @returns boolean
|
|
46
|
+
*/
|
|
47
|
+
isEmpty() {
|
|
48
|
+
return this.queue.length === 0;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The cancel method cancels all pending promises in the queue.
|
|
52
|
+
* It rejects the promises with a AsyncQueueCancelledError error,
|
|
53
|
+
* ensuring that any awaiting code can handle the cancellation appropriately.
|
|
54
|
+
*/
|
|
55
|
+
cancel() {
|
|
56
|
+
this.cancelled = true;
|
|
57
|
+
this.pendingDequeue.forEach(async ({ reject }) => {
|
|
58
|
+
reject(new AsyncQueueCancelledError("Task cancelled"));
|
|
59
|
+
});
|
|
60
|
+
this.pendingDequeue = [];
|
|
61
|
+
this.queue.length = 0;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* The isCancelled method returns whether the queue is cancelled or not.
|
|
65
|
+
*
|
|
66
|
+
* @returns boolean
|
|
67
|
+
*/
|
|
68
|
+
isCancelled() {
|
|
69
|
+
return this.cancelled;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* The pendingDequeueLength method returns the length of the pendingDequeue.
|
|
73
|
+
*
|
|
74
|
+
* @returns number
|
|
75
|
+
*/
|
|
76
|
+
pendingDequeueLength() {
|
|
77
|
+
return this.pendingDequeue.length;
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
var AsyncQueueCancelledError = class extends Error {
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export {
|
|
84
|
+
AsyncQueue,
|
|
85
|
+
AsyncQueueCancelledError
|
|
86
|
+
};
|
|
87
|
+
//# sourceMappingURL=chunk-AC3OGAL6.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/transactions/management/asyncQueue.ts"],"sourcesContent":["/**\n * The AsyncQueue class is an async-aware data structure that provides a queue-like\n * behavior for managing asynchronous tasks or operations.\n * It allows to enqueue items and dequeue them asynchronously.\n * This is not thread-safe but it is async concurrency safe and\n * it does not guarantee ordering for those that call into and await on enqueue.\n */\n\ninterface PendingDequeue<T> {\n resolve: (value: T) => void;\n reject: (reason?: AsyncQueueCancelledError) => void;\n}\n\nexport class AsyncQueue<T> {\n readonly queue: T[] = [];\n\n // The pendingDequeue is used to handle the resolution of promises when items are enqueued and dequeued.\n private pendingDequeue: PendingDequeue<T>[] = [];\n\n private cancelled: boolean = false;\n\n /**\n * The enqueue method adds an item to the queue. If there are pending dequeued promises,\n * in the pendingDequeue, it resolves the oldest promise with the enqueued item immediately.\n * Otherwise, it adds the item to the queue.\n *\n * @param item T\n */\n enqueue(item: T): void {\n this.cancelled = false;\n\n if (this.pendingDequeue.length > 0) {\n const promise = this.pendingDequeue.shift();\n\n promise?.resolve(item);\n\n return;\n }\n\n this.queue.push(item);\n }\n\n /**\n * The dequeue method returns a promise that resolves to the next item in the queue.\n * If the queue is not empty, it resolves the promise immediately with the next item.\n * Otherwise, it creates a new promise. The promise's resolve function is stored\n * in the pendingDequeue with a unique counter value as the key.\n * The newly created promise is then returned, and it will be resolved later when an item is enqueued.\n *\n * @returns Promise<T>\n */\n async dequeue(): Promise<T> {\n if (this.queue.length > 0) {\n return Promise.resolve(this.queue.shift()!);\n }\n\n return new Promise<T>((resolve, reject) => {\n this.pendingDequeue.push({ resolve, reject });\n });\n }\n\n /**\n * The isEmpty method returns whether the queue is empty or not.\n *\n * @returns boolean\n */\n isEmpty(): boolean {\n return this.queue.length === 0;\n }\n\n /**\n * The cancel method cancels all pending promises in the queue.\n * It rejects the promises with a AsyncQueueCancelledError error,\n * ensuring that any awaiting code can handle the cancellation appropriately.\n */\n cancel(): void {\n this.cancelled = true;\n\n this.pendingDequeue.forEach(async ({ reject }) => {\n reject(new AsyncQueueCancelledError(\"Task cancelled\"));\n });\n\n this.pendingDequeue = [];\n\n this.queue.length = 0;\n }\n\n /**\n * The isCancelled method returns whether the queue is cancelled or not.\n *\n * @returns boolean\n */\n isCancelled(): boolean {\n return this.cancelled;\n }\n\n /**\n * The pendingDequeueLength method returns the length of the pendingDequeue.\n *\n * @returns number\n */\n pendingDequeueLength(): number {\n return this.pendingDequeue.length;\n }\n}\n\nexport class AsyncQueueCancelledError extends Error {}\n"],"mappings":"AAaO,
|
|
1
|
+
{"version":3,"sources":["../../src/transactions/management/asyncQueue.ts"],"sourcesContent":["/**\n * The AsyncQueue class is an async-aware data structure that provides a queue-like\n * behavior for managing asynchronous tasks or operations.\n * It allows to enqueue items and dequeue them asynchronously.\n * This is not thread-safe but it is async concurrency safe and\n * it does not guarantee ordering for those that call into and await on enqueue.\n */\n\ninterface PendingDequeue<T> {\n resolve: (value: T) => void;\n reject: (reason?: AsyncQueueCancelledError) => void;\n}\n\nexport class AsyncQueue<T> {\n readonly queue: T[] = [];\n\n // The pendingDequeue is used to handle the resolution of promises when items are enqueued and dequeued.\n private pendingDequeue: PendingDequeue<T>[] = [];\n\n private cancelled: boolean = false;\n\n /**\n * The enqueue method adds an item to the queue. If there are pending dequeued promises,\n * in the pendingDequeue, it resolves the oldest promise with the enqueued item immediately.\n * Otherwise, it adds the item to the queue.\n *\n * @param item T\n */\n enqueue(item: T): void {\n this.cancelled = false;\n\n if (this.pendingDequeue.length > 0) {\n const promise = this.pendingDequeue.shift();\n\n promise?.resolve(item);\n\n return;\n }\n\n this.queue.push(item);\n }\n\n /**\n * The dequeue method returns a promise that resolves to the next item in the queue.\n * If the queue is not empty, it resolves the promise immediately with the next item.\n * Otherwise, it creates a new promise. The promise's resolve function is stored\n * in the pendingDequeue with a unique counter value as the key.\n * The newly created promise is then returned, and it will be resolved later when an item is enqueued.\n *\n * @returns Promise<T>\n */\n async dequeue(): Promise<T> {\n if (this.queue.length > 0) {\n return Promise.resolve(this.queue.shift()!);\n }\n\n return new Promise<T>((resolve, reject) => {\n this.pendingDequeue.push({ resolve, reject });\n });\n }\n\n /**\n * The isEmpty method returns whether the queue is empty or not.\n *\n * @returns boolean\n */\n isEmpty(): boolean {\n return this.queue.length === 0;\n }\n\n /**\n * The cancel method cancels all pending promises in the queue.\n * It rejects the promises with a AsyncQueueCancelledError error,\n * ensuring that any awaiting code can handle the cancellation appropriately.\n */\n cancel(): void {\n this.cancelled = true;\n\n this.pendingDequeue.forEach(async ({ reject }) => {\n reject(new AsyncQueueCancelledError(\"Task cancelled\"));\n });\n\n this.pendingDequeue = [];\n\n this.queue.length = 0;\n }\n\n /**\n * The isCancelled method returns whether the queue is cancelled or not.\n *\n * @returns boolean\n */\n isCancelled(): boolean {\n return this.cancelled;\n }\n\n /**\n * The pendingDequeueLength method returns the length of the pendingDequeue.\n *\n * @returns number\n */\n pendingDequeueLength(): number {\n return this.pendingDequeue.length;\n }\n}\n\nexport class AsyncQueueCancelledError extends Error {}\n"],"mappings":";AAaO,IAAM,aAAN,MAAoB;AAAA,EAApB;AACL,SAAS,QAAa,CAAC;AAGvB;AAAA,SAAQ,iBAAsC,CAAC;AAE/C,SAAQ,YAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAS7B,QAAQ,MAAe;AACrB,SAAK,YAAY;AAEjB,QAAI,KAAK,eAAe,SAAS,GAAG;AAClC,YAAM,UAAU,KAAK,eAAe,MAAM;AAE1C,eAAS,QAAQ,IAAI;AAErB;AAAA,IACF;AAEA,SAAK,MAAM,KAAK,IAAI;AAAA,EACtB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,MAAM,UAAsB;AAC1B,QAAI,KAAK,MAAM,SAAS,GAAG;AACzB,aAAO,QAAQ,QAAQ,KAAK,MAAM,MAAM,CAAE;AAAA,IAC5C;AAEA,WAAO,IAAI,QAAW,CAAC,SAAS,WAAW;AACzC,WAAK,eAAe,KAAK,EAAE,SAAS,OAAO,CAAC;AAAA,IAC9C,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,UAAmB;AACjB,WAAO,KAAK,MAAM,WAAW;AAAA,EAC/B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,SAAe;AACb,SAAK,YAAY;AAEjB,SAAK,eAAe,QAAQ,OAAO,EAAE,OAAO,MAAM;AAChD,aAAO,IAAI,yBAAyB,gBAAgB,CAAC;AAAA,IACvD,CAAC;AAED,SAAK,iBAAiB,CAAC;AAEvB,SAAK,MAAM,SAAS;AAAA,EACtB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,cAAuB;AACrB,WAAO,KAAK;AAAA,EACd;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,uBAA+B;AAC7B,WAAO,KAAK,eAAe;AAAA,EAC7B;AACF;AAEO,IAAM,2BAAN,cAAuC,MAAM;AAAC;","names":[]}
|