@aptos-labs/ts-sdk 1.14.0-zeta.1 → 1.14.0-zeta.3
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/chunk-KSEUZTKY.js +2 -0
- package/dist/common/chunk-KSEUZTKY.js.map +1 -0
- package/dist/common/cli/index.js +1 -245
- package/dist/common/cli/index.js.map +1 -1
- package/dist/common/index.d.ts +1 -1
- package/dist/common/index.js +390 -11802
- package/dist/common/index.js.map +1 -1
- package/dist/esm/account/Account.mjs +1 -55
- package/dist/esm/account/Ed25519Account.mjs +1 -53
- package/dist/esm/account/EphemeralKeyPair.mjs +1 -36
- package/dist/esm/account/KeylessAccount.mjs +1 -56
- package/dist/esm/account/MultiKeyAccount.mjs +1 -55
- package/dist/esm/account/SingleKeyAccount.mjs +1 -53
- package/dist/esm/account/index.mjs +1 -76
- package/dist/esm/api/account.mjs +1 -76
- package/dist/esm/api/ans.mjs +1 -87
- package/dist/esm/api/aptos.mjs +1 -116
- package/dist/esm/api/aptosConfig.mjs +1 -9
- package/dist/esm/api/coin.mjs +1 -86
- package/dist/esm/api/digitalAsset.mjs +1 -87
- package/dist/esm/api/event.mjs +1 -54
- package/dist/esm/api/faucet.mjs +1 -53
- package/dist/esm/api/fungibleAsset.mjs +1 -87
- package/dist/esm/api/general.mjs +1 -84
- package/dist/esm/api/index.mjs +1 -120
- package/dist/esm/api/keyless.mjs +1 -70
- package/dist/esm/api/staking.mjs +1 -54
- package/dist/esm/api/transaction.mjs +1 -94
- package/dist/esm/api/transactionSubmission/build.mjs +1 -85
- package/dist/esm/api/transactionSubmission/helpers.mjs +1 -9
- package/dist/esm/api/transactionSubmission/management.mjs +1 -89
- package/dist/esm/api/transactionSubmission/sign.mjs +1 -109
- package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -1
- package/dist/esm/api/transactionSubmission/simulate.mjs +1 -86
- package/dist/esm/api/transactionSubmission/submit.mjs +1 -86
- package/dist/esm/api/utils.mjs +1 -34
- package/dist/esm/bcs/consts.mjs +1 -17
- package/dist/esm/bcs/deserializer.mjs +1 -8
- package/dist/esm/bcs/index.mjs +1 -57
- package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +1 -12
- package/dist/esm/bcs/serializable/fixedBytes.mjs +1 -11
- package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -25
- package/dist/esm/bcs/serializable/moveStructs.mjs +1 -18
- package/dist/esm/bcs/serializer.mjs +1 -18
- package/dist/esm/chunk-23MNZ5LZ.mjs +2 -0
- package/dist/esm/{chunk-RCQMWXEW.mjs.map → chunk-23MNZ5LZ.mjs.map} +1 -1
- package/dist/esm/chunk-24ZOKI52.mjs +2 -0
- package/dist/esm/{chunk-F2ZWA7B7.mjs.map → chunk-24ZOKI52.mjs.map} +1 -1
- package/dist/esm/chunk-25H3DXTL.mjs +2 -0
- package/dist/esm/{chunk-B5S6DDUD.mjs.map → chunk-25H3DXTL.mjs.map} +1 -1
- package/dist/esm/chunk-2ECWQRBB.mjs +2 -0
- package/dist/esm/{chunk-2OQW7BMN.mjs.map → chunk-2ECWQRBB.mjs.map} +1 -1
- package/dist/esm/chunk-2HD2G4AH.mjs +2 -0
- package/dist/esm/{chunk-Y2LV3S5W.mjs.map → chunk-2HD2G4AH.mjs.map} +1 -1
- package/dist/esm/chunk-3CMS2KOX.mjs +2 -0
- package/dist/esm/{chunk-NW45SCPY.mjs.map → chunk-3CMS2KOX.mjs.map} +1 -1
- package/dist/esm/chunk-3COVJN6Z.mjs +2 -0
- package/dist/esm/{chunk-2JOCR2VL.mjs.map → chunk-3COVJN6Z.mjs.map} +1 -1
- package/dist/esm/chunk-3CUVYW32.mjs +2 -0
- package/dist/esm/{chunk-DIYZRGR6.mjs.map → chunk-3CUVYW32.mjs.map} +1 -1
- package/dist/esm/chunk-3FVRXELT.mjs +2 -0
- package/dist/esm/{chunk-KK2BSALW.mjs.map → chunk-3FVRXELT.mjs.map} +1 -1
- package/dist/esm/chunk-3JPVQHOR.mjs +2 -0
- package/dist/esm/{chunk-GGMTQAQP.mjs.map → chunk-3JPVQHOR.mjs.map} +1 -1
- package/dist/esm/chunk-3S3GIUQY.mjs +2 -0
- package/dist/esm/{chunk-ASF2VWOX.mjs.map → chunk-3S3GIUQY.mjs.map} +1 -1
- package/dist/esm/chunk-3VGX3TXH.mjs +2 -0
- package/dist/esm/{chunk-7FO3S6IZ.mjs.map → chunk-3VGX3TXH.mjs.map} +1 -1
- package/dist/esm/chunk-56CNRT2K.mjs +2 -0
- package/dist/esm/{chunk-SBB4YEPT.mjs.map → chunk-56CNRT2K.mjs.map} +1 -1
- package/dist/esm/chunk-5XOFEQWC.mjs +2 -0
- package/dist/esm/{chunk-ATVFVXR6.mjs.map → chunk-5XOFEQWC.mjs.map} +1 -1
- package/dist/esm/chunk-6EMN3BOV.mjs +2 -0
- package/dist/esm/{chunk-SIJELMDP.mjs.map → chunk-6EMN3BOV.mjs.map} +1 -1
- package/dist/esm/chunk-6RBUXB5I.mjs +2 -0
- package/dist/esm/{chunk-WK5ZSNE2.mjs.map → chunk-6RBUXB5I.mjs.map} +1 -1
- package/dist/esm/chunk-6WIB3GGF.mjs +2 -0
- package/dist/esm/{chunk-CTJSZT5V.mjs.map → chunk-6WIB3GGF.mjs.map} +1 -1
- package/dist/esm/chunk-75J7H3XD.mjs +2 -0
- package/dist/esm/{chunk-GBEVD2VM.mjs.map → chunk-75J7H3XD.mjs.map} +1 -1
- package/dist/esm/chunk-7IMWGGA6.mjs +2 -0
- package/dist/esm/{chunk-UX5NSZEN.mjs.map → chunk-7IMWGGA6.mjs.map} +1 -1
- package/dist/esm/chunk-7KOC7VNK.mjs +2 -0
- package/dist/esm/{chunk-YYOPNUX5.mjs.map → chunk-7KOC7VNK.mjs.map} +1 -1
- package/dist/esm/chunk-7SIQDOYY.mjs +2 -0
- package/dist/esm/{chunk-ST4QXIMI.mjs.map → chunk-7SIQDOYY.mjs.map} +1 -1
- package/dist/esm/chunk-7STYQ5ZE.mjs +2 -0
- package/dist/esm/{chunk-UEBBLQJ5.mjs.map → chunk-7STYQ5ZE.mjs.map} +1 -1
- package/dist/esm/chunk-7XYECSW6.mjs +2 -0
- package/dist/esm/{chunk-GSVQ6EUD.mjs.map → chunk-7XYECSW6.mjs.map} +1 -1
- package/dist/esm/chunk-AH44UPM4.mjs +2 -0
- package/dist/esm/{chunk-EYHRMZPO.mjs.map → chunk-AH44UPM4.mjs.map} +1 -1
- package/dist/esm/chunk-AHNE2QA3.mjs +2 -0
- package/dist/esm/{chunk-WDRH2URB.mjs.map → chunk-AHNE2QA3.mjs.map} +1 -1
- package/dist/esm/chunk-AJ7UC2G3.mjs +2 -0
- package/dist/esm/{chunk-ZAHJ7KXB.mjs.map → chunk-AJ7UC2G3.mjs.map} +1 -1
- package/dist/esm/chunk-AOCNYMMX.mjs +2 -0
- package/dist/esm/{chunk-YV7M4CFP.mjs.map → chunk-AOCNYMMX.mjs.map} +1 -1
- package/dist/esm/chunk-BTLFW3YY.mjs +2 -0
- package/dist/esm/{chunk-2ZEGJU43.mjs.map → chunk-BTLFW3YY.mjs.map} +1 -1
- package/dist/esm/chunk-C3L4ETUF.mjs +2 -0
- package/dist/esm/{chunk-PIMQHG2J.mjs.map → chunk-C3L4ETUF.mjs.map} +1 -1
- package/dist/esm/chunk-CB6CNNM2.mjs +2 -0
- package/dist/esm/{chunk-VPWUODU4.mjs.map → chunk-CB6CNNM2.mjs.map} +1 -1
- package/dist/esm/chunk-CO53EOHE.mjs +2 -0
- package/dist/esm/{chunk-MZZLEY6O.mjs.map → chunk-CO53EOHE.mjs.map} +1 -1
- package/dist/esm/chunk-COW5IGYC.mjs +2 -0
- package/dist/esm/{chunk-FXKSE3ZP.mjs.map → chunk-COW5IGYC.mjs.map} +1 -1
- package/dist/esm/chunk-CS7B3FVO.mjs +2 -0
- package/dist/esm/{chunk-CXUGZXED.mjs.map → chunk-CS7B3FVO.mjs.map} +1 -1
- package/dist/esm/chunk-DD2VWOMZ.mjs +2 -0
- package/dist/esm/{chunk-55NODGHC.mjs.map → chunk-DD2VWOMZ.mjs.map} +1 -1
- package/dist/esm/chunk-EB7AI4B4.mjs +2 -0
- package/dist/esm/{chunk-AR7X6GWQ.mjs.map → chunk-EB7AI4B4.mjs.map} +1 -1
- package/dist/esm/chunk-FBPNHF54.mjs +2 -0
- package/dist/esm/{chunk-QMM2KL6C.mjs.map → chunk-FBPNHF54.mjs.map} +1 -1
- package/dist/esm/chunk-FLYEALDB.mjs +2 -0
- package/dist/esm/{chunk-76TSTAU4.mjs.map → chunk-FLYEALDB.mjs.map} +1 -1
- package/dist/esm/chunk-FVA2OPG4.mjs +2 -0
- package/dist/esm/chunk-GNNNICLW.mjs +2 -0
- package/dist/esm/{chunk-DGV7DYU4.mjs.map → chunk-GNNNICLW.mjs.map} +1 -1
- package/dist/esm/chunk-GQ6HIKZT.mjs +2 -0
- package/dist/esm/{chunk-NYL77J4X.mjs.map → chunk-GQ6HIKZT.mjs.map} +1 -1
- package/dist/esm/chunk-H62IKYXG.mjs +2 -0
- package/dist/esm/{chunk-QFOG4LIN.mjs.map → chunk-H62IKYXG.mjs.map} +1 -1
- package/dist/esm/chunk-HGZGTBA4.mjs +2 -0
- package/dist/esm/{chunk-PYLOAMR2.mjs.map → chunk-HGZGTBA4.mjs.map} +1 -1
- package/dist/esm/chunk-HHVAU5HU.mjs +2 -0
- package/dist/esm/{chunk-UKU6A2W2.mjs.map → chunk-HHVAU5HU.mjs.map} +1 -1
- package/dist/esm/chunk-HMFL7AOJ.mjs +2 -0
- package/dist/esm/{chunk-KMXSRHJ6.mjs.map → chunk-HMFL7AOJ.mjs.map} +1 -1
- package/dist/esm/chunk-HSFG2AIK.mjs +2 -0
- package/dist/esm/{chunk-HBNSRCZN.mjs.map → chunk-HSFG2AIK.mjs.map} +1 -1
- package/dist/esm/chunk-HYDDIAJ6.mjs +2 -0
- package/dist/esm/{chunk-IC56GQFJ.mjs.map → chunk-HYDDIAJ6.mjs.map} +1 -1
- package/dist/esm/chunk-HYU23YVP.mjs +2 -0
- package/dist/esm/{chunk-U3IUCR2G.mjs.map → chunk-HYU23YVP.mjs.map} +1 -1
- package/dist/esm/chunk-JLWKIYHV.mjs +2 -0
- package/dist/esm/{chunk-WHBWEN6N.mjs.map → chunk-JLWKIYHV.mjs.map} +1 -1
- package/dist/esm/chunk-JM2B5E2I.mjs +2 -0
- package/dist/esm/{chunk-CX3NAVRD.mjs.map → chunk-JM2B5E2I.mjs.map} +1 -1
- package/dist/esm/chunk-JM544NRW.mjs +2 -0
- package/dist/esm/{chunk-7REUIYF4.mjs.map → chunk-JM544NRW.mjs.map} +1 -1
- package/dist/esm/chunk-KMKSA7LM.mjs +2 -0
- package/dist/esm/{chunk-FF4JPDKD.mjs.map → chunk-KMKSA7LM.mjs.map} +1 -1
- package/dist/esm/chunk-L54P6EGN.mjs +2 -0
- package/dist/esm/{chunk-SS3NUM5L.mjs.map → chunk-L54P6EGN.mjs.map} +1 -1
- package/dist/esm/chunk-L5WUYZ35.mjs +2 -0
- package/dist/esm/{chunk-7FUHWL6A.mjs.map → chunk-L5WUYZ35.mjs.map} +1 -1
- package/dist/esm/chunk-LDQ6JFEF.mjs +2 -0
- package/dist/esm/{chunk-N4WKFNQ6.mjs.map → chunk-LDQ6JFEF.mjs.map} +1 -1
- package/dist/esm/chunk-LR65XHSF.mjs +2 -0
- package/dist/esm/{chunk-PU5AFUX3.mjs.map → chunk-LR65XHSF.mjs.map} +1 -1
- package/dist/esm/chunk-MGOHPDX4.mjs +2 -0
- package/dist/esm/{chunk-2TJJWII2.mjs.map → chunk-MGOHPDX4.mjs.map} +1 -1
- package/dist/esm/chunk-MOKAU77C.mjs +2 -0
- package/dist/esm/{chunk-IHNPN5CQ.mjs.map → chunk-MOKAU77C.mjs.map} +1 -1
- package/dist/esm/chunk-MWUJCP27.mjs +2 -0
- package/dist/esm/{chunk-6MSZMIFW.mjs.map → chunk-MWUJCP27.mjs.map} +1 -1
- package/dist/esm/chunk-N466X3S6.mjs +2 -0
- package/dist/esm/{chunk-WLTBF4DF.mjs.map → chunk-N466X3S6.mjs.map} +1 -1
- package/dist/esm/chunk-NBEXLW7P.mjs +2 -0
- package/dist/esm/{chunk-D2BVBXWO.mjs.map → chunk-NBEXLW7P.mjs.map} +1 -1
- package/dist/esm/chunk-NC5HHEEM.mjs +2 -0
- package/dist/esm/{chunk-XANFAUBD.mjs.map → chunk-NC5HHEEM.mjs.map} +1 -1
- package/dist/esm/chunk-O3PLAAN7.mjs +2 -0
- package/dist/esm/{chunk-LLLQJWRZ.mjs.map → chunk-O3PLAAN7.mjs.map} +1 -1
- package/dist/esm/chunk-P2WALKSW.mjs +2 -0
- package/dist/esm/{chunk-O6PSHSN3.mjs.map → chunk-P2WALKSW.mjs.map} +1 -1
- package/dist/esm/chunk-P7JMD7KZ.mjs +2 -0
- package/dist/esm/{chunk-TBHU6ZW6.mjs.map → chunk-P7JMD7KZ.mjs.map} +1 -1
- package/dist/esm/chunk-PFFAQZHT.mjs +2 -0
- package/dist/esm/{chunk-DNPMS2OF.mjs.map → chunk-PFFAQZHT.mjs.map} +1 -1
- package/dist/esm/chunk-PGCBIU33.mjs +2 -0
- package/dist/esm/{chunk-4OYYOYSO.mjs.map → chunk-PGCBIU33.mjs.map} +1 -1
- package/dist/esm/chunk-PMPTAPM3.mjs +2 -0
- package/dist/esm/{chunk-DVPQGCFT.mjs.map → chunk-PMPTAPM3.mjs.map} +1 -1
- package/dist/esm/chunk-PYUWGGAW.mjs +2 -0
- package/dist/esm/chunk-PYUWGGAW.mjs.map +1 -0
- package/dist/esm/chunk-R52BRP36.mjs +2 -0
- package/dist/esm/{chunk-BXMHDQHW.mjs.map → chunk-R52BRP36.mjs.map} +1 -1
- package/dist/esm/chunk-RKHPXZM6.mjs +2 -0
- package/dist/esm/{chunk-PCLNX6FS.mjs.map → chunk-RKHPXZM6.mjs.map} +1 -1
- package/dist/esm/chunk-RKTM5GBP.mjs +2 -0
- package/dist/esm/{chunk-LI2QV6RU.mjs.map → chunk-RKTM5GBP.mjs.map} +1 -1
- package/dist/esm/{chunk-4PJ5FYGQ.mjs → chunk-S4SEFF4K.mjs} +27 -302
- package/dist/esm/{chunk-4PJ5FYGQ.mjs.map → chunk-S4SEFF4K.mjs.map} +1 -1
- package/dist/esm/chunk-SI7MPP6G.mjs +2 -0
- package/dist/esm/{chunk-RX4VG2AT.mjs.map → chunk-SI7MPP6G.mjs.map} +1 -1
- package/dist/esm/chunk-SLI3KELH.mjs +2 -0
- package/dist/esm/{chunk-7IDBB4J4.mjs.map → chunk-SLI3KELH.mjs.map} +1 -1
- package/dist/esm/chunk-STYDBDYL.mjs +2 -0
- package/dist/esm/{chunk-FDWJNY4U.mjs.map → chunk-STYDBDYL.mjs.map} +1 -1
- package/dist/esm/chunk-T23OVRNF.mjs +2 -0
- package/dist/esm/{chunk-CMNJG4NN.mjs.map → chunk-T23OVRNF.mjs.map} +1 -1
- package/dist/esm/chunk-TE3WIJ26.mjs +2 -0
- package/dist/esm/{chunk-CC4DQ6NH.mjs.map → chunk-TE3WIJ26.mjs.map} +1 -1
- package/dist/esm/chunk-TICM455H.mjs +2 -0
- package/dist/esm/{chunk-ZMFKQUHL.mjs.map → chunk-TICM455H.mjs.map} +1 -1
- package/dist/esm/chunk-TJDC5PWD.mjs +2 -0
- package/dist/esm/{chunk-NMKCJNQM.mjs.map → chunk-TJDC5PWD.mjs.map} +1 -1
- package/dist/esm/chunk-TVRJ3M7B.mjs +2 -0
- package/dist/esm/{chunk-FQQW55X7.mjs.map → chunk-TVRJ3M7B.mjs.map} +1 -1
- package/dist/esm/chunk-U5C2PXC6.mjs +2 -0
- package/dist/esm/{chunk-WVGO4D7K.mjs.map → chunk-U5C2PXC6.mjs.map} +1 -1
- package/dist/esm/chunk-U6Z4FNB7.mjs +2 -0
- package/dist/esm/{chunk-AC3OGAL6.mjs.map → chunk-U6Z4FNB7.mjs.map} +1 -1
- package/dist/esm/chunk-UTXJOB3O.mjs +2 -0
- package/dist/esm/{chunk-QBBTUC66.mjs.map → chunk-UTXJOB3O.mjs.map} +1 -1
- package/dist/esm/chunk-VL6EYA53.mjs +2 -0
- package/dist/esm/{chunk-VZQXLVEP.mjs.map → chunk-VL6EYA53.mjs.map} +1 -1
- package/dist/esm/chunk-VPKPQBKL.mjs +2 -0
- package/dist/esm/{chunk-6LRQSBRH.mjs.map → chunk-VPKPQBKL.mjs.map} +1 -1
- package/dist/esm/chunk-VSD2AWUR.mjs +2 -0
- package/dist/esm/chunk-VSD2AWUR.mjs.map +1 -0
- package/dist/esm/chunk-VT6XJSRO.mjs +2 -0
- package/dist/esm/{chunk-7JRMOHBP.mjs.map → chunk-VT6XJSRO.mjs.map} +1 -1
- package/dist/esm/chunk-WM2NCYZL.mjs +2 -0
- package/dist/esm/{chunk-VKJQORON.mjs.map → chunk-WM2NCYZL.mjs.map} +1 -1
- package/dist/esm/chunk-WWGROAKX.mjs +2 -0
- package/dist/esm/{chunk-W76MGKZB.mjs.map → chunk-WWGROAKX.mjs.map} +1 -1
- package/dist/esm/chunk-XZGQMZ2H.mjs +2 -0
- package/dist/esm/{chunk-VJP2VWMF.mjs.map → chunk-XZGQMZ2H.mjs.map} +1 -1
- package/dist/esm/chunk-Y33CIIZX.mjs +2 -0
- package/dist/esm/{chunk-JHDHNGJ3.mjs.map → chunk-Y33CIIZX.mjs.map} +1 -1
- package/dist/esm/chunk-Y4SSUCPJ.mjs +2 -0
- package/dist/esm/{chunk-VDJBDX3A.mjs.map → chunk-Y4SSUCPJ.mjs.map} +1 -1
- package/dist/esm/chunk-YE5B2S5L.mjs +2 -0
- package/dist/esm/{chunk-NFJCQRVK.mjs.map → chunk-YE5B2S5L.mjs.map} +1 -1
- package/dist/esm/chunk-YGOJYDJA.mjs +2 -0
- package/dist/esm/{chunk-LYK4TQZO.mjs.map → chunk-YGOJYDJA.mjs.map} +1 -1
- package/dist/esm/chunk-YNNPWCF6.mjs +2 -0
- package/dist/esm/{chunk-NXFO2W4G.mjs.map → chunk-YNNPWCF6.mjs.map} +1 -1
- package/dist/esm/chunk-YV7OBLK2.mjs +2 -0
- package/dist/esm/{chunk-TLNHRJB2.mjs.map → chunk-YV7OBLK2.mjs.map} +1 -1
- package/dist/esm/chunk-ZKRG4C4U.mjs +2 -0
- package/dist/esm/{chunk-LYMY63SO.mjs.map → chunk-ZKRG4C4U.mjs.map} +1 -1
- package/dist/esm/chunk-ZNEBMSNC.mjs +2 -0
- package/dist/esm/{chunk-JL2JHVS4.mjs.map → chunk-ZNEBMSNC.mjs.map} +1 -1
- package/dist/esm/chunk-ZPMS2Q37.mjs +2 -0
- package/dist/esm/{chunk-KVSQ57HU.mjs.map → chunk-ZPMS2Q37.mjs.map} +1 -1
- package/dist/esm/cli/index.mjs +1 -12
- package/dist/esm/cli/localNode.mjs +1 -8
- package/dist/esm/cli/move.mjs +1 -7
- package/dist/esm/client/core.mjs +1 -27
- package/dist/esm/client/get.mjs +1 -32
- package/dist/esm/client/index.mjs +1 -55
- package/dist/esm/client/post.mjs +1 -36
- package/dist/esm/client/types.mjs +1 -7
- package/dist/esm/core/account/index.mjs +1 -19
- package/dist/esm/core/account/utils/address.mjs +1 -18
- package/dist/esm/core/account/utils/index.mjs +1 -19
- package/dist/esm/core/accountAddress.mjs +1 -15
- package/dist/esm/core/authenticationKey.mjs +1 -14
- package/dist/esm/core/common.mjs +1 -7
- package/dist/esm/core/crypto/ed25519.mjs +1 -29
- package/dist/esm/core/crypto/ephemeral.mjs +1 -28
- package/dist/esm/core/crypto/hdKey.mjs +1 -25
- package/dist/esm/core/crypto/index.mjs +1 -124
- package/dist/esm/core/crypto/keyless.mjs +1 -55
- package/dist/esm/core/crypto/multiEd25519.mjs +1 -28
- package/dist/esm/core/crypto/multiKey.mjs +1 -34
- package/dist/esm/core/crypto/poseidon.mjs +1 -15
- package/dist/esm/core/crypto/privateKey.mjs +1 -1
- package/dist/esm/core/crypto/proof.mjs +1 -19
- package/dist/esm/core/crypto/publicKey.mjs +1 -21
- package/dist/esm/core/crypto/secp256k1.mjs +1 -27
- package/dist/esm/core/crypto/signature.mjs +1 -19
- package/dist/esm/core/crypto/singleKey.mjs +1 -33
- package/dist/esm/core/crypto/utils.mjs +1 -9
- package/dist/esm/core/hex.mjs +1 -10
- package/dist/esm/core/index.mjs +1 -141
- package/dist/esm/index.mjs +1 -635
- package/dist/esm/internal/account.mjs +1 -106
- package/dist/esm/internal/ans.mjs +1 -120
- package/dist/esm/internal/coin.mjs +1 -85
- package/dist/esm/internal/digitalAsset.mjs +1 -127
- package/dist/esm/internal/event.mjs +1 -55
- package/dist/esm/internal/faucet.mjs +1 -52
- package/dist/esm/internal/fungibleAsset.mjs +1 -91
- package/dist/esm/internal/general.mjs +1 -46
- package/dist/esm/internal/keyless.mjs +1 -73
- package/dist/esm/internal/staking.mjs +1 -53
- package/dist/esm/internal/transaction.mjs +1 -51
- package/dist/esm/internal/transactionSubmission.mjs +1 -102
- package/dist/esm/internal/view.mjs +1 -83
- package/dist/esm/transactions/authenticator/account.mjs +1 -44
- package/dist/esm/transactions/authenticator/index.mjs +1 -60
- package/dist/esm/transactions/authenticator/transaction.mjs +1 -48
- package/dist/esm/transactions/index.mjs +1 -284
- package/dist/esm/transactions/instances/chainId.mjs +1 -11
- package/dist/esm/transactions/instances/identifier.mjs +1 -11
- package/dist/esm/transactions/instances/index.mjs +1 -96
- package/dist/esm/transactions/instances/moduleId.mjs +1 -38
- package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -43
- package/dist/esm/transactions/instances/rawTransaction.mjs +1 -48
- package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -20
- package/dist/esm/transactions/instances/signedTransaction.mjs +1 -45
- package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -43
- package/dist/esm/transactions/instances/transactionArgument.mjs +1 -1
- package/dist/esm/transactions/instances/transactionPayload.mjs +1 -56
- package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -74
- package/dist/esm/transactions/management/asyncQueue.mjs +1 -9
- package/dist/esm/transactions/management/index.mjs +1 -95
- package/dist/esm/transactions/management/transactionWorker.mjs +1 -91
- package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -75
- package/dist/esm/transactions/transactionBuilder/index.mjs +1 -162
- package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -85
- package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -58
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +1 -1
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -98
- package/dist/esm/transactions/typeTag/index.mjs +1 -74
- package/dist/esm/transactions/typeTag/parser.mjs +1 -43
- package/dist/esm/transactions/types.mjs +1 -1
- package/dist/esm/types/generated/queries.mjs +1 -57
- package/dist/esm/types/generated/types.mjs +1 -809
- package/dist/esm/types/generated/types.mjs.map +1 -1
- package/dist/esm/types/index.mjs +1 -68
- package/dist/esm/types/indexer.mjs +1 -1
- package/dist/esm/types/keyless.mjs +1 -9
- package/dist/esm/utils/apiEndpoints.mjs +1 -21
- package/dist/esm/utils/const.mjs +1 -21
- package/dist/esm/utils/helpers.mjs +1 -7
- package/dist/esm/utils/index.mjs +1 -56
- package/dist/esm/utils/memoize.mjs +1 -9
- package/dist/esm/utils/normalizeBundle.mjs +1 -19
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -7
- package/package.json +2 -2
- package/src/account/KeylessAccount.ts +1 -2
- package/src/transactions/transactionBuilder/transactionBuilder.ts +16 -2
- package/src/version.ts +1 -1
- package/dist/common/chunk-QRI7EC4T.js +0 -24
- package/dist/common/chunk-QRI7EC4T.js.map +0 -1
- package/dist/esm/chunk-2JOCR2VL.mjs +0 -32
- package/dist/esm/chunk-2OQW7BMN.mjs +0 -129
- package/dist/esm/chunk-2TJJWII2.mjs +0 -23
- package/dist/esm/chunk-2ZEGJU43.mjs +0 -252
- package/dist/esm/chunk-4OYYOYSO.mjs +0 -336
- package/dist/esm/chunk-55NODGHC.mjs +0 -135
- package/dist/esm/chunk-6LRQSBRH.mjs +0 -130
- package/dist/esm/chunk-6MSZMIFW.mjs +0 -23
- package/dist/esm/chunk-76TSTAU4.mjs +0 -120
- package/dist/esm/chunk-7FO3S6IZ.mjs +0 -324
- package/dist/esm/chunk-7FUHWL6A.mjs +0 -42
- package/dist/esm/chunk-7IDBB4J4.mjs +0 -33
- package/dist/esm/chunk-7JRMOHBP.mjs +0 -247
- package/dist/esm/chunk-7REUIYF4.mjs +0 -63
- package/dist/esm/chunk-AC3OGAL6.mjs +0 -87
- package/dist/esm/chunk-AR7X6GWQ.mjs +0 -356
- package/dist/esm/chunk-ASF2VWOX.mjs +0 -142
- package/dist/esm/chunk-ATVFVXR6.mjs +0 -43
- package/dist/esm/chunk-B5S6DDUD.mjs +0 -120
- package/dist/esm/chunk-BXMHDQHW.mjs +0 -512
- package/dist/esm/chunk-CC4DQ6NH.mjs +0 -19
- package/dist/esm/chunk-CMNJG4NN.mjs +0 -345
- package/dist/esm/chunk-CTJSZT5V.mjs +0 -87
- package/dist/esm/chunk-CX3NAVRD.mjs +0 -205
- package/dist/esm/chunk-CXUGZXED.mjs +0 -307
- package/dist/esm/chunk-D2BVBXWO.mjs +0 -7
- package/dist/esm/chunk-DGV7DYU4.mjs +0 -413
- package/dist/esm/chunk-DIYZRGR6.mjs +0 -242
- package/dist/esm/chunk-DNPMS2OF.mjs +0 -236
- package/dist/esm/chunk-DVPQGCFT.mjs +0 -74
- package/dist/esm/chunk-EYHRMZPO.mjs +0 -34
- package/dist/esm/chunk-F2ZWA7B7.mjs +0 -412
- package/dist/esm/chunk-FDWJNY4U.mjs +0 -22
- package/dist/esm/chunk-FF4JPDKD.mjs +0 -315
- package/dist/esm/chunk-FQQW55X7.mjs +0 -288
- package/dist/esm/chunk-FXKSE3ZP.mjs +0 -25
- package/dist/esm/chunk-GBEVD2VM.mjs +0 -99
- package/dist/esm/chunk-GGMTQAQP.mjs +0 -11
- package/dist/esm/chunk-GSVQ6EUD.mjs +0 -649
- package/dist/esm/chunk-HBNSRCZN.mjs +0 -100
- package/dist/esm/chunk-IC56GQFJ.mjs +0 -127
- package/dist/esm/chunk-IHNPN5CQ.mjs +0 -256
- package/dist/esm/chunk-JHDHNGJ3.mjs +0 -126
- package/dist/esm/chunk-JL2JHVS4.mjs +0 -49
- package/dist/esm/chunk-JV3GSIJW.mjs +0 -268
- package/dist/esm/chunk-JV3GSIJW.mjs.map +0 -1
- package/dist/esm/chunk-KK2BSALW.mjs +0 -32
- package/dist/esm/chunk-KMXSRHJ6.mjs +0 -93
- package/dist/esm/chunk-KVSQ57HU.mjs +0 -45
- package/dist/esm/chunk-LI2QV6RU.mjs +0 -129
- package/dist/esm/chunk-LLLQJWRZ.mjs +0 -35
- package/dist/esm/chunk-LYK4TQZO.mjs +0 -70
- package/dist/esm/chunk-LYMY63SO.mjs +0 -124
- package/dist/esm/chunk-MZZLEY6O.mjs +0 -92
- package/dist/esm/chunk-N4WKFNQ6.mjs +0 -156
- package/dist/esm/chunk-NFJCQRVK.mjs +0 -37
- package/dist/esm/chunk-NMKCJNQM.mjs +0 -20
- package/dist/esm/chunk-NW45SCPY.mjs +0 -36
- package/dist/esm/chunk-NXFO2W4G.mjs +0 -84
- package/dist/esm/chunk-NYL77J4X.mjs +0 -97
- package/dist/esm/chunk-O6PSHSN3.mjs +0 -53
- package/dist/esm/chunk-OR7TEZ25.mjs +0 -16
- package/dist/esm/chunk-PCLNX6FS.mjs +0 -17
- package/dist/esm/chunk-PIMQHG2J.mjs +0 -49
- package/dist/esm/chunk-PU5AFUX3.mjs +0 -52
- package/dist/esm/chunk-PYLOAMR2.mjs +0 -29
- package/dist/esm/chunk-QBBTUC66.mjs +0 -15
- package/dist/esm/chunk-QFOG4LIN.mjs +0 -319
- package/dist/esm/chunk-QMM2KL6C.mjs +0 -12
- package/dist/esm/chunk-RCQMWXEW.mjs +0 -35
- package/dist/esm/chunk-RX4VG2AT.mjs +0 -314
- package/dist/esm/chunk-SBB4YEPT.mjs +0 -17
- package/dist/esm/chunk-SIJELMDP.mjs +0 -29
- package/dist/esm/chunk-SS3NUM5L.mjs +0 -94
- package/dist/esm/chunk-ST4QXIMI.mjs +0 -37
- package/dist/esm/chunk-TBHU6ZW6.mjs +0 -215
- package/dist/esm/chunk-TLNHRJB2.mjs +0 -155
- package/dist/esm/chunk-U3IUCR2G.mjs +0 -54
- package/dist/esm/chunk-U7QBZ6PP.mjs +0 -400
- package/dist/esm/chunk-U7QBZ6PP.mjs.map +0 -1
- package/dist/esm/chunk-UEBBLQJ5.mjs +0 -94
- package/dist/esm/chunk-UKU6A2W2.mjs +0 -232
- package/dist/esm/chunk-UX5NSZEN.mjs +0 -134
- package/dist/esm/chunk-VDJBDX3A.mjs +0 -79
- package/dist/esm/chunk-VJP2VWMF.mjs +0 -58
- package/dist/esm/chunk-VKJQORON.mjs +0 -93
- package/dist/esm/chunk-VPWUODU4.mjs +0 -51
- package/dist/esm/chunk-VZQXLVEP.mjs +0 -197
- package/dist/esm/chunk-W76MGKZB.mjs +0 -33
- package/dist/esm/chunk-WDRH2URB.mjs +0 -91
- package/dist/esm/chunk-WHBWEN6N.mjs +0 -206
- package/dist/esm/chunk-WK5ZSNE2.mjs +0 -173
- package/dist/esm/chunk-WLTBF4DF.mjs +0 -22
- package/dist/esm/chunk-WVGO4D7K.mjs +0 -254
- package/dist/esm/chunk-XANFAUBD.mjs +0 -44
- package/dist/esm/chunk-Y2LV3S5W.mjs +0 -410
- package/dist/esm/chunk-YV7M4CFP.mjs +0 -137
- package/dist/esm/chunk-YYOPNUX5.mjs +0 -41
- package/dist/esm/chunk-ZAHJ7KXB.mjs +0 -81
- package/dist/esm/chunk-ZMFKQUHL.mjs +0 -117
- /package/dist/esm/{chunk-OR7TEZ25.mjs.map → chunk-FVA2OPG4.mjs.map} +0 -0
|
@@ -1,268 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
EphemeralKeyPair
|
|
3
|
-
} from "./chunk-LI2QV6RU.mjs";
|
|
4
|
-
import {
|
|
5
|
-
deriveTransactionType,
|
|
6
|
-
generateSigningMessageForSerializable
|
|
7
|
-
} from "./chunk-VJP2VWMF.mjs";
|
|
8
|
-
import {
|
|
9
|
-
AccountAuthenticatorSingleKey
|
|
10
|
-
} from "./chunk-IC56GQFJ.mjs";
|
|
11
|
-
import {
|
|
12
|
-
AnyPublicKey,
|
|
13
|
-
AnySignature
|
|
14
|
-
} from "./chunk-TLNHRJB2.mjs";
|
|
15
|
-
import {
|
|
16
|
-
EphemeralCertificate,
|
|
17
|
-
KeylessPublicKey,
|
|
18
|
-
KeylessSignature,
|
|
19
|
-
ZeroKnowledgeSig
|
|
20
|
-
} from "./chunk-4OYYOYSO.mjs";
|
|
21
|
-
import {
|
|
22
|
-
AccountAddress
|
|
23
|
-
} from "./chunk-CMNJG4NN.mjs";
|
|
24
|
-
import {
|
|
25
|
-
Deserializer
|
|
26
|
-
} from "./chunk-7JRMOHBP.mjs";
|
|
27
|
-
import {
|
|
28
|
-
Serializable
|
|
29
|
-
} from "./chunk-FQQW55X7.mjs";
|
|
30
|
-
import {
|
|
31
|
-
Hex
|
|
32
|
-
} from "./chunk-YV7M4CFP.mjs";
|
|
33
|
-
|
|
34
|
-
// src/account/KeylessAccount.ts
|
|
35
|
-
import { jwtDecode } from "jwt-decode";
|
|
36
|
-
import { JwksClient } from "jwks-rsa";
|
|
37
|
-
import { decode } from "base-64";
|
|
38
|
-
import EventEmitter from "eventemitter3";
|
|
39
|
-
var IssuerToJwkEndpoint = {
|
|
40
|
-
"https://accounts.google.com": "https://www.googleapis.com/oauth2/v3/certs"
|
|
41
|
-
};
|
|
42
|
-
var _KeylessAccount = class _KeylessAccount extends Serializable {
|
|
43
|
-
constructor(args) {
|
|
44
|
-
super();
|
|
45
|
-
const { address, ephemeralKeyPair, uidKey, uidVal, aud, pepper, proofOrFetcher, proofFetchCallback, jwt } = args;
|
|
46
|
-
this.ephemeralKeyPair = ephemeralKeyPair;
|
|
47
|
-
this.publicKey = KeylessPublicKey.create(args);
|
|
48
|
-
this.accountAddress = address ? AccountAddress.from(address) : this.publicKey.authKey().derivedAddress();
|
|
49
|
-
this.uidKey = uidKey;
|
|
50
|
-
this.uidVal = uidVal;
|
|
51
|
-
this.aud = aud;
|
|
52
|
-
this.jwt = jwt;
|
|
53
|
-
this.emitter = new EventEmitter();
|
|
54
|
-
this.proofOrPromise = proofOrFetcher;
|
|
55
|
-
if (proofOrFetcher instanceof ZeroKnowledgeSig) {
|
|
56
|
-
this.proof = proofOrFetcher;
|
|
57
|
-
} else {
|
|
58
|
-
if (proofFetchCallback === void 0) {
|
|
59
|
-
throw new Error("Must provide callback for async proof fetch");
|
|
60
|
-
}
|
|
61
|
-
this.emitter.on("proofFetchFinish", async (status) => {
|
|
62
|
-
await proofFetchCallback(status);
|
|
63
|
-
this.emitter.removeAllListeners();
|
|
64
|
-
});
|
|
65
|
-
this.init(proofOrFetcher);
|
|
66
|
-
}
|
|
67
|
-
this.signingScheme = 2 /* SingleKey */;
|
|
68
|
-
const pepperBytes = Hex.fromHexInput(pepper).toUint8Array();
|
|
69
|
-
if (pepperBytes.length !== _KeylessAccount.PEPPER_LENGTH) {
|
|
70
|
-
throw new Error(`Pepper length in bytes should be ${_KeylessAccount.PEPPER_LENGTH}`);
|
|
71
|
-
}
|
|
72
|
-
this.pepper = pepperBytes;
|
|
73
|
-
this.isJwtValid = true;
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* This initializes the asyncronous proof fetch
|
|
77
|
-
* @return
|
|
78
|
-
*/
|
|
79
|
-
async init(promise) {
|
|
80
|
-
try {
|
|
81
|
-
this.proof = await promise;
|
|
82
|
-
this.emitter.emit("proofFetchFinish", { status: "Success" });
|
|
83
|
-
} catch (error) {
|
|
84
|
-
if (error instanceof Error) {
|
|
85
|
-
this.emitter.emit("proofFetchFinish", { status: "Failed", error: error.toString() });
|
|
86
|
-
} else {
|
|
87
|
-
this.emitter.emit("proofFetchFinish", { status: "Failed", error: "Unknown" });
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
serialize(serializer) {
|
|
92
|
-
serializer.serializeStr(this.jwt);
|
|
93
|
-
serializer.serializeStr(this.uidKey);
|
|
94
|
-
serializer.serializeFixedBytes(this.pepper);
|
|
95
|
-
this.ephemeralKeyPair.serialize(serializer);
|
|
96
|
-
if (this.proof === void 0) {
|
|
97
|
-
throw new Error("Connot serialize - proof undefined");
|
|
98
|
-
}
|
|
99
|
-
this.proof.serialize(serializer);
|
|
100
|
-
}
|
|
101
|
-
static deserialize(deserializer) {
|
|
102
|
-
const jwt = deserializer.deserializeStr();
|
|
103
|
-
const uidKey = deserializer.deserializeStr();
|
|
104
|
-
const pepper = deserializer.deserializeFixedBytes(31);
|
|
105
|
-
const ephemeralKeyPair = EphemeralKeyPair.deserialize(deserializer);
|
|
106
|
-
const proof = ZeroKnowledgeSig.deserialize(deserializer);
|
|
107
|
-
return _KeylessAccount.fromJWTAndProof({
|
|
108
|
-
proof,
|
|
109
|
-
pepper,
|
|
110
|
-
uidKey,
|
|
111
|
-
jwt,
|
|
112
|
-
ephemeralKeyPair
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Checks if the proof is expired. If so the account must be rederived with a new EphemeralKeyPair
|
|
117
|
-
* and JWT token.
|
|
118
|
-
* @return boolean
|
|
119
|
-
*/
|
|
120
|
-
isExpired() {
|
|
121
|
-
return this.ephemeralKeyPair.isExpired();
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* Checks if the the JWK used to verify the token still exists on the issuer's JWK uri.
|
|
125
|
-
* Caches the result.
|
|
126
|
-
* @return boolean
|
|
127
|
-
*/
|
|
128
|
-
async checkJwkValidity() {
|
|
129
|
-
if (!this.isJwtValid) {
|
|
130
|
-
return false;
|
|
131
|
-
}
|
|
132
|
-
const jwtHeader = jwtDecode(this.jwt, { header: true });
|
|
133
|
-
const client = new JwksClient({
|
|
134
|
-
jwksUri: IssuerToJwkEndpoint[this.publicKey.iss]
|
|
135
|
-
});
|
|
136
|
-
try {
|
|
137
|
-
await client.getSigningKey(jwtHeader.kid);
|
|
138
|
-
return true;
|
|
139
|
-
} catch (error) {
|
|
140
|
-
this.isJwtValid = false;
|
|
141
|
-
return false;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* Sign a message using Keyless.
|
|
146
|
-
* @param message the message to sign, as binary input
|
|
147
|
-
* @return the AccountAuthenticator containing the signature, together with the account's public key
|
|
148
|
-
*/
|
|
149
|
-
signWithAuthenticator(message) {
|
|
150
|
-
const signature = new AnySignature(this.sign(message));
|
|
151
|
-
const publicKey = new AnyPublicKey(this.publicKey);
|
|
152
|
-
return new AccountAuthenticatorSingleKey(publicKey, signature);
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* Sign a transaction using Keyless.
|
|
156
|
-
* @param transaction the raw transaction
|
|
157
|
-
* @return the AccountAuthenticator containing the signature of the transaction, together with the account's public key
|
|
158
|
-
*/
|
|
159
|
-
signTransactionWithAuthenticator(transaction) {
|
|
160
|
-
const signature = new AnySignature(this.signTransaction(transaction));
|
|
161
|
-
const publicKey = new AnyPublicKey(this.publicKey);
|
|
162
|
-
return new AccountAuthenticatorSingleKey(publicKey, signature);
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
|
-
* Waits for asyncronous proof fetching to finish.
|
|
166
|
-
* @return
|
|
167
|
-
*/
|
|
168
|
-
async waitForProofFetch() {
|
|
169
|
-
if (this.proofOrPromise instanceof Promise) {
|
|
170
|
-
await this.proofOrPromise;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
/**
|
|
174
|
-
* Sign the given message using Keyless.
|
|
175
|
-
* @param message in HexInput format
|
|
176
|
-
* @returns Signature
|
|
177
|
-
*/
|
|
178
|
-
sign(data) {
|
|
179
|
-
const { expiryDateSecs } = this.ephemeralKeyPair;
|
|
180
|
-
if (this.isExpired()) {
|
|
181
|
-
throw new Error("Ephemeral key pair is expired.");
|
|
182
|
-
}
|
|
183
|
-
if (this.proof === void 0) {
|
|
184
|
-
throw new Error("Proof not found");
|
|
185
|
-
}
|
|
186
|
-
if (!this.isJwtValid) {
|
|
187
|
-
throw new Error("The proof has expired. Please refetch proof");
|
|
188
|
-
}
|
|
189
|
-
const ephemeralPublicKey = this.ephemeralKeyPair.getPublicKey();
|
|
190
|
-
const ephemeralSignature = this.ephemeralKeyPair.sign(data);
|
|
191
|
-
return new KeylessSignature({
|
|
192
|
-
jwtHeader: base64UrlDecode(this.jwt.split(".")[0]),
|
|
193
|
-
ephemeralCertificate: new EphemeralCertificate(this.proof, 0 /* ZkProof */),
|
|
194
|
-
expiryDateSecs,
|
|
195
|
-
ephemeralPublicKey,
|
|
196
|
-
ephemeralSignature
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
/**
|
|
200
|
-
* Sign the given transaction with Keyless.
|
|
201
|
-
* Signs the transaction and proof to guard against proof malleability.
|
|
202
|
-
* @param transaction the transaction to be signed
|
|
203
|
-
* @returns KeylessSignature
|
|
204
|
-
*/
|
|
205
|
-
signTransaction(transaction) {
|
|
206
|
-
if (this.proof === void 0) {
|
|
207
|
-
throw new Error("Proof not found");
|
|
208
|
-
}
|
|
209
|
-
const raw = deriveTransactionType(transaction);
|
|
210
|
-
const txnAndProof = new TransactionAndProof(raw, this.proof.proof);
|
|
211
|
-
const signMess = generateSigningMessageForSerializable(txnAndProof);
|
|
212
|
-
return this.sign(signMess);
|
|
213
|
-
}
|
|
214
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars, class-methods-use-this
|
|
215
|
-
verifySignature(args) {
|
|
216
|
-
throw new Error("Not implemented");
|
|
217
|
-
}
|
|
218
|
-
static fromBytes(bytes) {
|
|
219
|
-
return _KeylessAccount.deserialize(new Deserializer(bytes));
|
|
220
|
-
}
|
|
221
|
-
static fromJWTAndProof(args) {
|
|
222
|
-
const { proof, jwt, ephemeralKeyPair, pepper, proofFetchCallback } = args;
|
|
223
|
-
const uidKey = args.uidKey ?? "sub";
|
|
224
|
-
const jwtPayload = jwtDecode(jwt);
|
|
225
|
-
const iss = jwtPayload.iss;
|
|
226
|
-
if (typeof jwtPayload.aud !== "string") {
|
|
227
|
-
throw new Error("aud was not found or an array of values");
|
|
228
|
-
}
|
|
229
|
-
const aud = jwtPayload.aud;
|
|
230
|
-
const uidVal = jwtPayload[uidKey];
|
|
231
|
-
return new _KeylessAccount({
|
|
232
|
-
proofOrFetcher: proof,
|
|
233
|
-
ephemeralKeyPair,
|
|
234
|
-
iss,
|
|
235
|
-
uidKey,
|
|
236
|
-
uidVal,
|
|
237
|
-
aud,
|
|
238
|
-
pepper,
|
|
239
|
-
jwt,
|
|
240
|
-
proofFetchCallback
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
|
-
};
|
|
244
|
-
_KeylessAccount.PEPPER_LENGTH = 31;
|
|
245
|
-
var KeylessAccount = _KeylessAccount;
|
|
246
|
-
var TransactionAndProof = class extends Serializable {
|
|
247
|
-
constructor(transaction, proof) {
|
|
248
|
-
super();
|
|
249
|
-
this.transaction = transaction;
|
|
250
|
-
this.proof = proof;
|
|
251
|
-
}
|
|
252
|
-
serialize(serializer) {
|
|
253
|
-
serializer.serializeFixedBytes(this.transaction.bcsToBytes());
|
|
254
|
-
serializer.serializeOption(this.proof);
|
|
255
|
-
}
|
|
256
|
-
};
|
|
257
|
-
function base64UrlDecode(base64Url) {
|
|
258
|
-
const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/");
|
|
259
|
-
const paddedBase64 = base64 + "==".substring(0, (3 - base64.length % 3) % 3);
|
|
260
|
-
const decodedString = decode(paddedBase64);
|
|
261
|
-
return decodedString;
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
export {
|
|
265
|
-
IssuerToJwkEndpoint,
|
|
266
|
-
KeylessAccount
|
|
267
|
-
};
|
|
268
|
-
//# sourceMappingURL=chunk-JV3GSIJW.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/account/KeylessAccount.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { JwtPayload, jwtDecode } from \"jwt-decode\";\nimport { JwksClient } from \"jwks-rsa\";\nimport { decode } from \"base-64\";\nimport EventEmitter from \"eventemitter3\";\nimport { EphemeralCertificateVariant, HexInput, SigningScheme } from \"../types\";\nimport { AccountAddress } from \"../core/accountAddress\";\nimport {\n AnyPublicKey,\n AnySignature,\n KeylessPublicKey,\n KeylessSignature,\n EphemeralCertificate,\n Signature,\n ZeroKnowledgeSig,\n ZkProof,\n} from \"../core/crypto\";\n\nimport { Account } from \"./Account\";\nimport { EphemeralKeyPair } from \"./EphemeralKeyPair\";\nimport { Hex } from \"../core/hex\";\nimport { AccountAuthenticatorSingleKey } from \"../transactions/authenticator/account\";\nimport { Deserializer, Serializable, Serializer } from \"../bcs\";\nimport {\n deriveTransactionType,\n generateSigningMessageForSerializable,\n} from \"../transactions/transactionBuilder/signingMessage\";\nimport { AnyRawTransaction, AnyRawTransactionInstance } from \"../transactions/types\";\n\nexport const IssuerToJwkEndpoint: Record<string, string> = {\n \"https://accounts.google.com\": \"https://www.googleapis.com/oauth2/v3/certs\",\n};\n\nexport class KeylessAccount extends Serializable implements Account {\n static readonly PEPPER_LENGTH: number = 31;\n\n readonly publicKey: KeylessPublicKey;\n\n readonly ephemeralKeyPair: EphemeralKeyPair;\n\n readonly uidKey: string;\n\n readonly uidVal: string;\n\n readonly aud: string;\n\n readonly pepper: Uint8Array;\n\n readonly accountAddress: AccountAddress;\n\n proof: ZeroKnowledgeSig | undefined;\n\n readonly proofOrPromise: ZeroKnowledgeSig | Promise<ZeroKnowledgeSig>;\n\n readonly signingScheme: SigningScheme;\n\n private jwt: string;\n\n private isJwtValid: boolean;\n\n readonly emitter: EventEmitter<ProofFetchEvents>;\n\n constructor(args: {\n address?: AccountAddress;\n ephemeralKeyPair: EphemeralKeyPair;\n iss: string;\n uidKey: string;\n uidVal: string;\n aud: string;\n pepper: HexInput;\n proofOrFetcher: ZeroKnowledgeSig | Promise<ZeroKnowledgeSig>;\n proofFetchCallback?: ProofFetchCallback;\n jwt: string;\n }) {\n super();\n const { address, ephemeralKeyPair, uidKey, uidVal, aud, pepper, proofOrFetcher, proofFetchCallback, jwt } = args;\n this.ephemeralKeyPair = ephemeralKeyPair;\n this.publicKey = KeylessPublicKey.create(args);\n this.accountAddress = address ? AccountAddress.from(address) : this.publicKey.authKey().derivedAddress();\n this.uidKey = uidKey;\n this.uidVal = uidVal;\n this.aud = aud;\n this.jwt = jwt;\n this.emitter = new EventEmitter<ProofFetchEvents>();\n this.proofOrPromise = proofOrFetcher;\n if (proofOrFetcher instanceof ZeroKnowledgeSig) {\n this.proof = proofOrFetcher;\n } else {\n if (proofFetchCallback === undefined) {\n throw new Error(\"Must provide callback for async proof fetch\");\n }\n this.emitter.on(\"proofFetchFinish\", async (status) => {\n await proofFetchCallback(status);\n this.emitter.removeAllListeners();\n });\n this.init(proofOrFetcher);\n }\n this.signingScheme = SigningScheme.SingleKey;\n const pepperBytes = Hex.fromHexInput(pepper).toUint8Array();\n if (pepperBytes.length !== KeylessAccount.PEPPER_LENGTH) {\n throw new Error(`Pepper length in bytes should be ${KeylessAccount.PEPPER_LENGTH}`);\n }\n this.pepper = pepperBytes;\n this.isJwtValid = true;\n }\n\n /**\n * This initializes the asyncronous proof fetch\n * @return\n */\n async init(promise: Promise<ZeroKnowledgeSig>) {\n try {\n this.proof = await promise;\n this.emitter.emit(\"proofFetchFinish\", { status: \"Success\" });\n } catch (error) {\n if (error instanceof Error) {\n this.emitter.emit(\"proofFetchFinish\", { status: \"Failed\", error: error.toString() });\n } else {\n this.emitter.emit(\"proofFetchFinish\", { status: \"Failed\", error: \"Unknown\" });\n }\n }\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeStr(this.jwt);\n serializer.serializeStr(this.uidKey);\n serializer.serializeFixedBytes(this.pepper);\n this.ephemeralKeyPair.serialize(serializer);\n if (this.proof === undefined) {\n throw new Error(\"Connot serialize - proof undefined\");\n }\n this.proof.serialize(serializer);\n }\n\n static deserialize(deserializer: Deserializer): KeylessAccount {\n const jwt = deserializer.deserializeStr();\n const uidKey = deserializer.deserializeStr();\n const pepper = deserializer.deserializeFixedBytes(31);\n const ephemeralKeyPair = EphemeralKeyPair.deserialize(deserializer);\n const proof = ZeroKnowledgeSig.deserialize(deserializer);\n return KeylessAccount.fromJWTAndProof({\n proof,\n pepper,\n uidKey,\n jwt,\n ephemeralKeyPair,\n });\n }\n\n /**\n * Checks if the proof is expired. If so the account must be rederived with a new EphemeralKeyPair\n * and JWT token.\n * @return boolean\n */\n isExpired(): boolean {\n return this.ephemeralKeyPair.isExpired();\n }\n\n /**\n * Checks if the the JWK used to verify the token still exists on the issuer's JWK uri.\n * Caches the result.\n * @return boolean\n */\n async checkJwkValidity(): Promise<boolean> {\n if (!this.isJwtValid) {\n return false;\n }\n const jwtHeader = jwtDecode(this.jwt, { header: true });\n const client = new JwksClient({\n jwksUri: IssuerToJwkEndpoint[this.publicKey.iss],\n });\n try {\n await client.getSigningKey(jwtHeader.kid);\n return true;\n } catch (error) {\n this.isJwtValid = false;\n return false;\n }\n }\n\n /**\n * Sign a message using Keyless.\n * @param message the message to sign, as binary input\n * @return the AccountAuthenticator containing the signature, together with the account's public key\n */\n signWithAuthenticator(message: HexInput): AccountAuthenticatorSingleKey {\n const signature = new AnySignature(this.sign(message));\n const publicKey = new AnyPublicKey(this.publicKey);\n return new AccountAuthenticatorSingleKey(publicKey, signature);\n }\n\n /**\n * Sign a transaction using Keyless.\n * @param transaction the raw transaction\n * @return the AccountAuthenticator containing the signature of the transaction, together with the account's public key\n */\n signTransactionWithAuthenticator(transaction: AnyRawTransaction): AccountAuthenticatorSingleKey {\n const signature = new AnySignature(this.signTransaction(transaction));\n const publicKey = new AnyPublicKey(this.publicKey);\n return new AccountAuthenticatorSingleKey(publicKey, signature);\n }\n\n /**\n * Waits for asyncronous proof fetching to finish.\n * @return\n */\n async waitForProofFetch() {\n if (this.proofOrPromise instanceof Promise) {\n await this.proofOrPromise;\n }\n }\n\n /**\n * Sign the given message using Keyless.\n * @param message in HexInput format\n * @returns Signature\n */\n sign(data: HexInput): KeylessSignature {\n const { expiryDateSecs } = this.ephemeralKeyPair;\n if (this.isExpired()) {\n throw new Error(\"Ephemeral key pair is expired.\");\n }\n if (this.proof === undefined) {\n throw new Error(\"Proof not found\");\n }\n if (!this.isJwtValid) {\n throw new Error(\"The proof has expired. Please refetch proof\");\n }\n const ephemeralPublicKey = this.ephemeralKeyPair.getPublicKey();\n const ephemeralSignature = this.ephemeralKeyPair.sign(data);\n\n return new KeylessSignature({\n jwtHeader: base64UrlDecode(this.jwt.split(\".\")[0]),\n ephemeralCertificate: new EphemeralCertificate(this.proof, EphemeralCertificateVariant.ZkProof),\n expiryDateSecs,\n ephemeralPublicKey,\n ephemeralSignature,\n });\n }\n\n /**\n * Sign the given transaction with Keyless.\n * Signs the transaction and proof to guard against proof malleability.\n * @param transaction the transaction to be signed\n * @returns KeylessSignature\n */\n signTransaction(transaction: AnyRawTransaction): KeylessSignature {\n if (this.proof === undefined) {\n throw new Error(\"Proof not found\");\n }\n const raw = deriveTransactionType(transaction);\n const txnAndProof = new TransactionAndProof(raw, this.proof.proof);\n const signMess = generateSigningMessageForSerializable(txnAndProof);\n return this.sign(signMess);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars, class-methods-use-this\n verifySignature(args: { message: HexInput; signature: Signature }): boolean {\n throw new Error(\"Not implemented\");\n }\n\n static fromBytes(bytes: Uint8Array): KeylessAccount {\n return KeylessAccount.deserialize(new Deserializer(bytes));\n }\n\n static fromJWTAndProof(args: {\n proof: ZeroKnowledgeSig | Promise<ZeroKnowledgeSig>;\n jwt: string;\n ephemeralKeyPair: EphemeralKeyPair;\n pepper: HexInput;\n uidKey?: string;\n proofFetchCallback?: ProofFetchCallback;\n }): KeylessAccount {\n const { proof, jwt, ephemeralKeyPair, pepper, proofFetchCallback } = args;\n const uidKey = args.uidKey ?? \"sub\";\n\n const jwtPayload = jwtDecode<JwtPayload & { [key: string]: string }>(jwt);\n const iss = jwtPayload.iss!;\n if (typeof jwtPayload.aud !== \"string\") {\n throw new Error(\"aud was not found or an array of values\");\n }\n const aud = jwtPayload.aud!;\n const uidVal = jwtPayload[uidKey];\n return new KeylessAccount({\n proofOrFetcher: proof,\n ephemeralKeyPair,\n iss,\n uidKey,\n uidVal,\n aud,\n pepper,\n jwt,\n proofFetchCallback,\n });\n }\n}\n\nclass TransactionAndProof extends Serializable {\n transaction: AnyRawTransactionInstance;\n\n proof?: ZkProof;\n\n constructor(transaction: AnyRawTransactionInstance, proof?: ZkProof) {\n super();\n this.transaction = transaction;\n this.proof = proof;\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeFixedBytes(this.transaction.bcsToBytes());\n serializer.serializeOption(this.proof);\n }\n}\n\nfunction base64UrlDecode(base64Url: string): string {\n // Replace base64url-specific characters\n const base64 = base64Url.replace(/-/g, \"+\").replace(/_/g, \"/\");\n // Pad the string with '=' characters if needed\n const paddedBase64 = base64 + \"==\".substring(0, (3 - (base64.length % 3)) % 3);\n // Decode the base64 string using the base-64 library\n const decodedString = decode(paddedBase64);\n return decodedString;\n}\n\nexport type ProofFetchSuccess = {\n status: \"Success\";\n};\n\nexport type ProofFetchFailure = {\n status: \"Failed\";\n error: string;\n};\n\nexport type ProofFetchStatus = ProofFetchSuccess | ProofFetchFailure;\n\nexport type ProofFetchCallback = (status: ProofFetchStatus) => Promise<void>;\n\nexport interface ProofFetchEvents {\n proofFetchFinish: (status: ProofFetchStatus) => void;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,SAAqB,iBAAiB;AACtC,SAAS,kBAAkB;AAC3B,SAAS,cAAc;AACvB,OAAO,kBAAkB;AAyBlB,IAAM,sBAA8C;AAAA,EACzD,+BAA+B;AACjC;AAEO,IAAM,kBAAN,MAAM,w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,IAAK,OAAO,SAAS,KAAM,CAAC;AAE7E,QAAM,gBAAgB,OAAO,YAAY;AACzC,SAAO;AACT;","names":[]}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Serializable
|
|
3
|
-
} from "./chunk-FQQW55X7.mjs";
|
|
4
|
-
import {
|
|
5
|
-
Hex
|
|
6
|
-
} from "./chunk-YV7M4CFP.mjs";
|
|
7
|
-
|
|
8
|
-
// src/bcs/serializable/fixedBytes.ts
|
|
9
|
-
var FixedBytes = class _FixedBytes extends Serializable {
|
|
10
|
-
constructor(value) {
|
|
11
|
-
super();
|
|
12
|
-
this.value = Hex.fromHexInput(value).toUint8Array();
|
|
13
|
-
}
|
|
14
|
-
serialize(serializer) {
|
|
15
|
-
serializer.serializeFixedBytes(this.value);
|
|
16
|
-
}
|
|
17
|
-
serializeForEntryFunction(serializer) {
|
|
18
|
-
serializer.serialize(this);
|
|
19
|
-
}
|
|
20
|
-
serializeForScriptFunction(serializer) {
|
|
21
|
-
serializer.serialize(this);
|
|
22
|
-
}
|
|
23
|
-
static deserialize(deserializer, length) {
|
|
24
|
-
const bytes = deserializer.deserializeFixedBytes(length);
|
|
25
|
-
return new _FixedBytes(bytes);
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export {
|
|
30
|
-
FixedBytes
|
|
31
|
-
};
|
|
32
|
-
//# sourceMappingURL=chunk-KK2BSALW.mjs.map
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
generateSigningMessageForTransaction
|
|
3
|
-
} from "./chunk-VJP2VWMF.mjs";
|
|
4
|
-
import {
|
|
5
|
-
AccountAuthenticatorEd25519
|
|
6
|
-
} from "./chunk-IC56GQFJ.mjs";
|
|
7
|
-
import {
|
|
8
|
-
Ed25519PrivateKey
|
|
9
|
-
} from "./chunk-RX4VG2AT.mjs";
|
|
10
|
-
import {
|
|
11
|
-
AccountAddress
|
|
12
|
-
} from "./chunk-CMNJG4NN.mjs";
|
|
13
|
-
|
|
14
|
-
// src/account/Ed25519Account.ts
|
|
15
|
-
var Ed25519Account = class _Ed25519Account {
|
|
16
|
-
// region Constructors
|
|
17
|
-
constructor(args) {
|
|
18
|
-
this.signingScheme = 0 /* Ed25519 */;
|
|
19
|
-
const { privateKey, address } = args;
|
|
20
|
-
this.privateKey = privateKey;
|
|
21
|
-
this.publicKey = privateKey.publicKey();
|
|
22
|
-
this.accountAddress = address ? AccountAddress.from(address) : this.publicKey.authKey().derivedAddress();
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Derives a signer from a randomly generated private key
|
|
26
|
-
*/
|
|
27
|
-
static generate() {
|
|
28
|
-
const privateKey = Ed25519PrivateKey.generate();
|
|
29
|
-
return new _Ed25519Account({ privateKey });
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Derives an account with bip44 path and mnemonics
|
|
33
|
-
*
|
|
34
|
-
* @param args.path the BIP44 derive hardened path e.g. m/44'/637'/0'/0'/0'
|
|
35
|
-
* Detailed description: {@link https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki}
|
|
36
|
-
* @param args.mnemonic the mnemonic seed phrase of the account
|
|
37
|
-
*/
|
|
38
|
-
static fromDerivationPath(args) {
|
|
39
|
-
const { path, mnemonic } = args;
|
|
40
|
-
const privateKey = Ed25519PrivateKey.fromDerivationPath(path, mnemonic);
|
|
41
|
-
return new _Ed25519Account({ privateKey });
|
|
42
|
-
}
|
|
43
|
-
// endregion
|
|
44
|
-
// region Account
|
|
45
|
-
/**
|
|
46
|
-
* Verify the given message and signature with the public key.
|
|
47
|
-
*
|
|
48
|
-
* @param args.message raw message data in HexInput format
|
|
49
|
-
* @param args.signature signed message Signature
|
|
50
|
-
* @returns
|
|
51
|
-
*/
|
|
52
|
-
verifySignature(args) {
|
|
53
|
-
return this.publicKey.verifySignature(args);
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Sign a message using the account's Ed25519 private key.
|
|
57
|
-
* @param message the signing message, as binary input
|
|
58
|
-
* @return the AccountAuthenticator containing the signature, together with the account's public key
|
|
59
|
-
*/
|
|
60
|
-
signWithAuthenticator(message) {
|
|
61
|
-
return new AccountAuthenticatorEd25519(this.publicKey, this.privateKey.sign(message));
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Sign a transaction using the account's Ed25519 private key.
|
|
65
|
-
* @param transaction the raw transaction
|
|
66
|
-
* @return the AccountAuthenticator containing the signature of the transaction, together with the account's public key
|
|
67
|
-
*/
|
|
68
|
-
signTransactionWithAuthenticator(transaction) {
|
|
69
|
-
return new AccountAuthenticatorEd25519(this.publicKey, this.signTransaction(transaction));
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Sign the given message using the account's Ed25519 private key.
|
|
73
|
-
* @param message in HexInput format
|
|
74
|
-
* @returns Signature
|
|
75
|
-
*/
|
|
76
|
-
sign(message) {
|
|
77
|
-
return this.privateKey.sign(message);
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Sign the given transaction using the available signing capabilities.
|
|
81
|
-
* @param transaction the transaction to be signed
|
|
82
|
-
* @returns Signature
|
|
83
|
-
*/
|
|
84
|
-
signTransaction(transaction) {
|
|
85
|
-
return this.sign(generateSigningMessageForTransaction(transaction));
|
|
86
|
-
}
|
|
87
|
-
// endregion
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
export {
|
|
91
|
-
Ed25519Account
|
|
92
|
-
};
|
|
93
|
-
//# sourceMappingURL=chunk-KMXSRHJ6.mjs.map
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
waitForTransaction
|
|
3
|
-
} from "./chunk-TBHU6ZW6.mjs";
|
|
4
|
-
import {
|
|
5
|
-
postAptosFaucet
|
|
6
|
-
} from "./chunk-NXFO2W4G.mjs";
|
|
7
|
-
import {
|
|
8
|
-
DEFAULT_TXN_TIMEOUT_SEC
|
|
9
|
-
} from "./chunk-NFJCQRVK.mjs";
|
|
10
|
-
import {
|
|
11
|
-
AccountAddress
|
|
12
|
-
} from "./chunk-CMNJG4NN.mjs";
|
|
13
|
-
|
|
14
|
-
// src/internal/faucet.ts
|
|
15
|
-
async function fundAccount(args) {
|
|
16
|
-
const { aptosConfig, accountAddress, amount, options } = args;
|
|
17
|
-
const timeout = options?.timeoutSecs || DEFAULT_TXN_TIMEOUT_SEC;
|
|
18
|
-
const { data } = await postAptosFaucet({
|
|
19
|
-
aptosConfig,
|
|
20
|
-
path: "fund",
|
|
21
|
-
body: {
|
|
22
|
-
address: AccountAddress.from(accountAddress).toString(),
|
|
23
|
-
amount
|
|
24
|
-
},
|
|
25
|
-
originMethod: "fundAccount"
|
|
26
|
-
});
|
|
27
|
-
const txnHash = data.txn_hashes[0];
|
|
28
|
-
const res = await waitForTransaction({
|
|
29
|
-
aptosConfig,
|
|
30
|
-
transactionHash: txnHash,
|
|
31
|
-
options: {
|
|
32
|
-
timeoutSecs: timeout,
|
|
33
|
-
checkSuccess: options?.checkSuccess
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
if (res.type === "user_transaction" /* User */) {
|
|
37
|
-
return res;
|
|
38
|
-
}
|
|
39
|
-
throw new Error(`Unexpected transaction received for fund account: ${res.type}`);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export {
|
|
43
|
-
fundAccount
|
|
44
|
-
};
|
|
45
|
-
//# sourceMappingURL=chunk-KVSQ57HU.mjs.map
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
EPK_HORIZON_SECS
|
|
3
|
-
} from "./chunk-4OYYOYSO.mjs";
|
|
4
|
-
import {
|
|
5
|
-
bytesToBigIntLE,
|
|
6
|
-
padAndPackBytesWithLen,
|
|
7
|
-
poseidonHash
|
|
8
|
-
} from "./chunk-76TSTAU4.mjs";
|
|
9
|
-
import {
|
|
10
|
-
EphemeralPublicKey,
|
|
11
|
-
EphemeralSignature
|
|
12
|
-
} from "./chunk-B5S6DDUD.mjs";
|
|
13
|
-
import {
|
|
14
|
-
Ed25519PrivateKey
|
|
15
|
-
} from "./chunk-RX4VG2AT.mjs";
|
|
16
|
-
import {
|
|
17
|
-
Deserializer
|
|
18
|
-
} from "./chunk-7JRMOHBP.mjs";
|
|
19
|
-
import {
|
|
20
|
-
Serializable
|
|
21
|
-
} from "./chunk-FQQW55X7.mjs";
|
|
22
|
-
import {
|
|
23
|
-
Hex
|
|
24
|
-
} from "./chunk-YV7M4CFP.mjs";
|
|
25
|
-
|
|
26
|
-
// src/account/EphemeralKeyPair.ts
|
|
27
|
-
import { randomBytes } from "@noble/hashes/utils";
|
|
28
|
-
var _EphemeralKeyPair = class _EphemeralKeyPair extends Serializable {
|
|
29
|
-
constructor(args) {
|
|
30
|
-
super();
|
|
31
|
-
const { privateKey, expiryDateSecs, blinder } = args;
|
|
32
|
-
this.privateKey = privateKey;
|
|
33
|
-
this.publicKey = new EphemeralPublicKey(privateKey.publicKey());
|
|
34
|
-
this.expiryDateSecs = expiryDateSecs || BigInt(floorToWholeHour(currentTimeInSeconds() + EPK_HORIZON_SECS));
|
|
35
|
-
this.blinder = blinder !== void 0 ? Hex.fromHexInput(blinder).toUint8Array() : generateBlinder();
|
|
36
|
-
this.nonce = this.generateNonce();
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Returns the public key of the key pair.
|
|
40
|
-
* @return EphemeralPublicKey
|
|
41
|
-
*/
|
|
42
|
-
getPublicKey() {
|
|
43
|
-
return this.publicKey;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Returns the public key of the key pair.
|
|
47
|
-
* @return boolean
|
|
48
|
-
*/
|
|
49
|
-
isExpired() {
|
|
50
|
-
const currentTimeSecs = Math.floor(Date.now() / 1e3);
|
|
51
|
-
return currentTimeSecs > this.expiryDateSecs;
|
|
52
|
-
}
|
|
53
|
-
serialize(serializer) {
|
|
54
|
-
serializer.serializeU32AsUleb128(this.publicKey.variant);
|
|
55
|
-
serializer.serializeBytes(this.privateKey.toUint8Array());
|
|
56
|
-
serializer.serializeU64(this.expiryDateSecs);
|
|
57
|
-
serializer.serializeFixedBytes(this.blinder);
|
|
58
|
-
}
|
|
59
|
-
static deserialize(deserializer) {
|
|
60
|
-
const variantIndex = deserializer.deserializeUleb128AsU32();
|
|
61
|
-
let privateKey;
|
|
62
|
-
switch (variantIndex) {
|
|
63
|
-
case 0 /* Ed25519 */:
|
|
64
|
-
privateKey = Ed25519PrivateKey.deserialize(deserializer);
|
|
65
|
-
break;
|
|
66
|
-
default:
|
|
67
|
-
throw new Error(`Unknown variant index for EphemeralPublicKey: ${variantIndex}`);
|
|
68
|
-
}
|
|
69
|
-
const expiryDateSecs = deserializer.deserializeU64();
|
|
70
|
-
const blinder = deserializer.deserializeFixedBytes(31);
|
|
71
|
-
return new _EphemeralKeyPair({ privateKey, expiryDateSecs, blinder });
|
|
72
|
-
}
|
|
73
|
-
static fromBytes(bytes) {
|
|
74
|
-
return _EphemeralKeyPair.deserialize(new Deserializer(bytes));
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Returns the public key of the key pair.
|
|
78
|
-
* @param scheme the type of keypair to use for the EphemeralKeyPair. Only Ed25519 supported for now.
|
|
79
|
-
* @return boolean
|
|
80
|
-
*/
|
|
81
|
-
static generate(args) {
|
|
82
|
-
let privateKey;
|
|
83
|
-
switch (args?.scheme) {
|
|
84
|
-
case 0 /* Ed25519 */:
|
|
85
|
-
default:
|
|
86
|
-
privateKey = Ed25519PrivateKey.generate();
|
|
87
|
-
}
|
|
88
|
-
return new _EphemeralKeyPair({ privateKey });
|
|
89
|
-
}
|
|
90
|
-
generateNonce() {
|
|
91
|
-
const fields = padAndPackBytesWithLen(this.publicKey.bcsToBytes(), 93);
|
|
92
|
-
fields.push(BigInt(this.expiryDateSecs));
|
|
93
|
-
fields.push(bytesToBigIntLE(this.blinder));
|
|
94
|
-
const nonceHash = poseidonHash(fields);
|
|
95
|
-
return nonceHash.toString();
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Sign the given message with the private key.
|
|
99
|
-
*
|
|
100
|
-
* @param data in HexInput format
|
|
101
|
-
* @returns EphemeralSignature
|
|
102
|
-
*/
|
|
103
|
-
sign(data) {
|
|
104
|
-
if (this.isExpired()) {
|
|
105
|
-
throw new Error("EphemeralKeyPair has expired");
|
|
106
|
-
}
|
|
107
|
-
return new EphemeralSignature(this.privateKey.sign(data));
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
_EphemeralKeyPair.BLINDER_LENGTH = 31;
|
|
111
|
-
var EphemeralKeyPair = _EphemeralKeyPair;
|
|
112
|
-
function generateBlinder() {
|
|
113
|
-
return randomBytes(EphemeralKeyPair.BLINDER_LENGTH);
|
|
114
|
-
}
|
|
115
|
-
function currentTimeInSeconds() {
|
|
116
|
-
return Math.floor((/* @__PURE__ */ new Date()).getTime() / 1e3);
|
|
117
|
-
}
|
|
118
|
-
function floorToWholeHour(timestampInSeconds) {
|
|
119
|
-
const date = new Date(timestampInSeconds * 1e3);
|
|
120
|
-
date.setMinutes(0);
|
|
121
|
-
date.setSeconds(0);
|
|
122
|
-
date.setMilliseconds(0);
|
|
123
|
-
return Math.floor(date.getTime() / 1e3);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
export {
|
|
127
|
-
EphemeralKeyPair
|
|
128
|
-
};
|
|
129
|
-
//# sourceMappingURL=chunk-LI2QV6RU.mjs.map
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
transferCoinTransaction
|
|
3
|
-
} from "./chunk-NW45SCPY.mjs";
|
|
4
|
-
|
|
5
|
-
// src/api/coin.ts
|
|
6
|
-
var Coin = class {
|
|
7
|
-
constructor(config) {
|
|
8
|
-
this.config = config;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Generate a transfer coin transaction that can be simulated and/or signed and submitted
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* const transferCoinTransaction = await aptos.transferCoinTransaction({
|
|
15
|
-
* sender: "0x123",
|
|
16
|
-
* recipient:"0x456",
|
|
17
|
-
* amount: 10,
|
|
18
|
-
* })
|
|
19
|
-
*
|
|
20
|
-
* @param args.sender The sender account
|
|
21
|
-
* @param args.recipient The recipient address
|
|
22
|
-
* @param args.amount The amount to transfer
|
|
23
|
-
* @param args.coinType optional. The coin struct type to transfer. Defaults to 0x1::aptos_coin::AptosCoin
|
|
24
|
-
*
|
|
25
|
-
* @returns SimpleTransaction
|
|
26
|
-
*/
|
|
27
|
-
async transferCoinTransaction(args) {
|
|
28
|
-
return transferCoinTransaction({ aptosConfig: this.config, ...args });
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export {
|
|
33
|
-
Coin
|
|
34
|
-
};
|
|
35
|
-
//# sourceMappingURL=chunk-LLLQJWRZ.mjs.map
|