@aptos-labs/ts-sdk 1.33.1 → 1.33.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -6
- package/dist/common/{accountAddress-BHsGaOsa.d.ts → accountAddress-Cf1amU98.d.ts} +279 -0
- package/dist/common/{chunk-F43XVDYJ.js → chunk-IHUCZKG2.js} +1 -1
- package/dist/common/chunk-IHUCZKG2.js.map +1 -0
- package/dist/common/cli/index.d.ts +47 -9
- package/dist/common/cli/index.js +1 -1
- package/dist/common/cli/index.js.map +1 -1
- package/dist/common/index.d.ts +1941 -225
- package/dist/common/index.js +33 -33
- package/dist/common/index.js.map +1 -1
- package/dist/esm/{Ed25519Account-B3xHXAQe.d.mts → Ed25519Account-D4j3_WIS.d.mts} +122 -12
- package/dist/esm/account/AbstractKeylessAccount.d.mts +81 -7
- package/dist/esm/account/AbstractKeylessAccount.mjs +1 -1
- package/dist/esm/account/Account.d.mts +5 -4
- package/dist/esm/account/Account.mjs +1 -1
- package/dist/esm/account/AccountUtils.d.mts +64 -0
- package/dist/esm/account/AccountUtils.mjs +2 -0
- package/dist/esm/account/Ed25519Account.d.mts +3 -2
- package/dist/esm/account/Ed25519Account.mjs +1 -1
- package/dist/esm/account/EphemeralKeyPair.d.mts +29 -1
- package/dist/esm/account/EphemeralKeyPair.mjs +1 -1
- package/dist/esm/account/FederatedKeylessAccount.d.mts +25 -5
- package/dist/esm/account/FederatedKeylessAccount.mjs +1 -1
- package/dist/esm/account/KeylessAccount.d.mts +30 -5
- package/dist/esm/account/KeylessAccount.mjs +1 -1
- package/dist/esm/account/MultiKeyAccount.d.mts +40 -5
- package/dist/esm/account/MultiKeyAccount.mjs +1 -1
- package/dist/esm/account/SingleKeyAccount.d.mts +4 -3
- package/dist/esm/account/SingleKeyAccount.mjs +1 -1
- package/dist/esm/account/index.d.mts +4 -2
- package/dist/esm/account/index.mjs +1 -1
- package/dist/esm/account/utils.d.mts +18 -0
- package/dist/esm/account/utils.mjs +2 -0
- package/dist/esm/account/utils.mjs.map +1 -0
- package/dist/esm/api/account.d.mts +25 -4
- package/dist/esm/api/account.mjs +1 -1
- package/dist/esm/api/ans.d.mts +18 -2
- package/dist/esm/api/ans.mjs +1 -1
- package/dist/esm/api/aptos.d.mts +5 -2
- package/dist/esm/api/aptos.mjs +1 -1
- package/dist/esm/api/aptosConfig.d.mts +16 -0
- package/dist/esm/api/aptosConfig.mjs +1 -1
- package/dist/esm/api/coin.d.mts +5 -1
- package/dist/esm/api/coin.mjs +1 -1
- package/dist/esm/api/digitalAsset.d.mts +29 -2
- package/dist/esm/api/digitalAsset.mjs +1 -1
- package/dist/esm/api/event.d.mts +6 -0
- package/dist/esm/api/event.mjs +1 -1
- package/dist/esm/api/faucet.d.mts +11 -2
- package/dist/esm/api/faucet.mjs +1 -1
- package/dist/esm/api/fungibleAsset.d.mts +11 -2
- package/dist/esm/api/fungibleAsset.mjs +1 -1
- package/dist/esm/api/general.d.mts +14 -1
- package/dist/esm/api/general.mjs +1 -1
- package/dist/esm/api/index.d.mts +3 -2
- package/dist/esm/api/index.mjs +1 -1
- package/dist/esm/api/keyless.d.mts +8 -2
- package/dist/esm/api/keyless.mjs +1 -1
- package/dist/esm/api/object.d.mts +3 -0
- package/dist/esm/api/object.mjs +1 -1
- package/dist/esm/api/staking.d.mts +5 -0
- package/dist/esm/api/staking.mjs +1 -1
- package/dist/esm/api/table.d.mts +5 -0
- package/dist/esm/api/table.mjs +1 -1
- package/dist/esm/api/transaction.d.mts +23 -6
- package/dist/esm/api/transaction.mjs +1 -1
- package/dist/esm/api/transactionSubmission/build.d.mts +6 -1
- package/dist/esm/api/transactionSubmission/build.mjs +1 -1
- package/dist/esm/api/transactionSubmission/helpers.d.mts +2 -0
- package/dist/esm/api/transactionSubmission/helpers.mjs +1 -1
- package/dist/esm/api/transactionSubmission/management.d.mts +8 -2
- package/dist/esm/api/transactionSubmission/management.mjs +1 -1
- package/dist/esm/api/transactionSubmission/sign.d.mts +7 -2
- package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
- package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -1
- package/dist/esm/api/transactionSubmission/simulate.d.mts +6 -1
- package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
- package/dist/esm/api/transactionSubmission/submit.d.mts +6 -1
- package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
- package/dist/esm/api/utils.d.mts +1 -0
- package/dist/esm/api/utils.mjs +1 -1
- package/dist/esm/bcs/deserializer.d.mts +42 -1
- package/dist/esm/bcs/deserializer.mjs +1 -1
- package/dist/esm/bcs/index.mjs +1 -1
- package/dist/esm/bcs/serializable/entryFunctionBytes.d.mts +10 -0
- package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +1 -1
- package/dist/esm/bcs/serializable/fixedBytes.d.mts +12 -0
- package/dist/esm/bcs/serializable/fixedBytes.mjs +1 -1
- package/dist/esm/bcs/serializable/movePrimitives.d.mts +24 -0
- package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
- package/dist/esm/bcs/serializable/moveStructs.d.mts +56 -0
- package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
- package/dist/esm/bcs/serializer.d.mts +60 -0
- package/dist/esm/bcs/serializer.mjs +1 -1
- package/dist/esm/{chunk-PMGK5IHB.mjs → chunk-2FBJWTJD.mjs} +2 -2
- package/dist/esm/chunk-2FBJWTJD.mjs.map +1 -0
- package/dist/esm/{chunk-L4SWQLAJ.mjs → chunk-2N5KYALM.mjs} +2 -2
- package/dist/esm/chunk-2N5KYALM.mjs.map +1 -0
- package/dist/esm/{chunk-7V35JAAF.mjs → chunk-2TJ6OTVD.mjs} +2 -2
- package/dist/esm/chunk-2TJ6OTVD.mjs.map +1 -0
- package/dist/esm/{chunk-GVNK3UMT.mjs → chunk-2UXW3EB7.mjs} +2 -2
- package/dist/esm/chunk-2UXW3EB7.mjs.map +1 -0
- package/dist/esm/{chunk-UJSTWN32.mjs → chunk-2WCATZVL.mjs} +2 -2
- package/dist/esm/{chunk-UJSTWN32.mjs.map → chunk-2WCATZVL.mjs.map} +1 -1
- package/dist/esm/{chunk-FZDEGDUY.mjs → chunk-35DKMW7Q.mjs} +1 -1
- package/dist/esm/chunk-35DKMW7Q.mjs.map +1 -0
- package/dist/esm/{chunk-WFK3XRQX.mjs → chunk-3RCAJICY.mjs} +2 -2
- package/dist/esm/chunk-3RCAJICY.mjs.map +1 -0
- package/dist/esm/{chunk-KCWRCWNT.mjs → chunk-43GCGE6C.mjs} +2 -2
- package/dist/esm/chunk-43GCGE6C.mjs.map +1 -0
- package/dist/esm/{chunk-4DP3PEYK.mjs → chunk-4EUS4E6S.mjs} +2 -2
- package/dist/esm/chunk-4EUS4E6S.mjs.map +1 -0
- package/dist/esm/chunk-4RXKALLC.mjs +2 -0
- package/dist/esm/chunk-4RXKALLC.mjs.map +1 -0
- package/dist/esm/chunk-4YLUM62M.mjs +2 -0
- package/dist/esm/chunk-4YLUM62M.mjs.map +1 -0
- package/dist/esm/{chunk-SNYYEVJA.mjs → chunk-4ZYPDCSP.mjs} +2 -2
- package/dist/esm/chunk-4ZYPDCSP.mjs.map +1 -0
- package/dist/esm/{chunk-F2WY2DEY.mjs → chunk-5EBUWO2M.mjs} +2 -2
- package/dist/esm/chunk-5EBUWO2M.mjs.map +1 -0
- package/dist/esm/{chunk-5LGKGWLX.mjs → chunk-5EYTHMRZ.mjs} +2 -2
- package/dist/esm/chunk-5EYTHMRZ.mjs.map +1 -0
- package/dist/esm/{chunk-DBTKJMLV.mjs → chunk-5PXDPMF2.mjs} +2 -2
- package/dist/esm/chunk-5PXDPMF2.mjs.map +1 -0
- package/dist/esm/chunk-5VMAJTTV.mjs +2 -0
- package/dist/esm/chunk-5VMAJTTV.mjs.map +1 -0
- package/dist/esm/{chunk-YEWZAR76.mjs → chunk-5YWH3XPN.mjs} +2 -2
- package/dist/esm/chunk-5YWH3XPN.mjs.map +1 -0
- package/dist/esm/{chunk-QI7OREBM.mjs → chunk-67ZVDKJF.mjs} +2 -2
- package/dist/esm/chunk-67ZVDKJF.mjs.map +1 -0
- package/dist/esm/{chunk-U6OCK6T4.mjs → chunk-6CXMDJQR.mjs} +2 -2
- package/dist/esm/chunk-6CXMDJQR.mjs.map +1 -0
- package/dist/esm/chunk-6IEZPA4H.mjs +2 -0
- package/dist/esm/chunk-6IEZPA4H.mjs.map +1 -0
- package/dist/esm/{chunk-N62NUAHT.mjs → chunk-6YHDZLRN.mjs} +2 -2
- package/dist/esm/chunk-6YHDZLRN.mjs.map +1 -0
- package/dist/esm/chunk-6YWYAVFS.mjs +2 -0
- package/dist/esm/chunk-6YWYAVFS.mjs.map +1 -0
- package/dist/esm/chunk-77AEKF7K.mjs +2 -0
- package/dist/esm/{chunk-YD2BMHH7.mjs.map → chunk-77AEKF7K.mjs.map} +1 -1
- package/dist/esm/{chunk-XOLU6UP3.mjs → chunk-7IY3DTEF.mjs} +2 -2
- package/dist/esm/chunk-7IY3DTEF.mjs.map +1 -0
- package/dist/esm/{chunk-2CJC43CV.mjs → chunk-A5L76YP7.mjs} +1 -1
- package/dist/esm/chunk-A5L76YP7.mjs.map +1 -0
- package/dist/esm/{chunk-ICMELYCL.mjs → chunk-AFEHO5PP.mjs} +2 -2
- package/dist/esm/chunk-AFEHO5PP.mjs.map +1 -0
- package/dist/esm/{chunk-NK67FECB.mjs → chunk-AXYARCYT.mjs} +2 -2
- package/dist/esm/chunk-AXYARCYT.mjs.map +1 -0
- package/dist/esm/{chunk-AOROYJ74.mjs → chunk-AZWVCBK2.mjs} +2 -2
- package/dist/esm/chunk-AZWVCBK2.mjs.map +1 -0
- package/dist/esm/{chunk-U3T4ZT7B.mjs → chunk-BGSEBFFC.mjs} +2 -2
- package/dist/esm/chunk-BGSEBFFC.mjs.map +1 -0
- package/dist/esm/{chunk-6ZOVTYLJ.mjs → chunk-BI3BTSUB.mjs} +2 -2
- package/dist/esm/chunk-BI3BTSUB.mjs.map +1 -0
- package/dist/esm/{chunk-OIOGOW6I.mjs → chunk-C3Q23D22.mjs} +1 -1
- package/dist/esm/chunk-C3Q23D22.mjs.map +1 -0
- package/dist/esm/{chunk-VQZMI3EZ.mjs → chunk-CWKNJZB6.mjs} +2 -2
- package/dist/esm/chunk-CWKNJZB6.mjs.map +1 -0
- package/dist/esm/{chunk-V4FKFCBL.mjs → chunk-DAFSKSZ5.mjs} +1 -1
- package/dist/esm/chunk-DAFSKSZ5.mjs.map +1 -0
- package/dist/esm/{chunk-IBZKCBN5.mjs → chunk-DOQV5BSA.mjs} +2 -2
- package/dist/esm/chunk-DOQV5BSA.mjs.map +1 -0
- package/dist/esm/chunk-DPW6ELCQ.mjs +2 -0
- package/dist/esm/chunk-DPW6ELCQ.mjs.map +1 -0
- package/dist/esm/{chunk-IK2NYNKG.mjs → chunk-DYATTONT.mjs} +2 -2
- package/dist/esm/chunk-DYATTONT.mjs.map +1 -0
- package/dist/esm/{chunk-ALNQK276.mjs → chunk-E5HGSOG2.mjs} +2 -2
- package/dist/esm/chunk-E5HGSOG2.mjs.map +1 -0
- package/dist/esm/{chunk-2MN7DW2J.mjs → chunk-E7JDVKFY.mjs} +2 -2
- package/dist/esm/chunk-E7JDVKFY.mjs.map +1 -0
- package/dist/esm/{chunk-AJ5JHBAE.mjs → chunk-EBMEXURY.mjs} +2 -2
- package/dist/esm/chunk-EBMEXURY.mjs.map +1 -0
- package/dist/esm/chunk-EMURYYVO.mjs +2 -0
- package/dist/esm/chunk-EMURYYVO.mjs.map +1 -0
- package/dist/esm/chunk-F2ZTBAJJ.mjs +2 -0
- package/dist/esm/chunk-F2ZTBAJJ.mjs.map +1 -0
- package/dist/esm/{chunk-UGIHQFID.mjs → chunk-FIEMUPXF.mjs} +2 -2
- package/dist/esm/chunk-FIEMUPXF.mjs.map +1 -0
- package/dist/esm/{chunk-AKIO3OIT.mjs → chunk-FN4C3CKC.mjs} +2 -2
- package/dist/esm/chunk-FN4C3CKC.mjs.map +1 -0
- package/dist/esm/{chunk-H3C3VTHS.mjs → chunk-FZD5RWSZ.mjs} +2 -2
- package/dist/esm/chunk-FZD5RWSZ.mjs.map +1 -0
- package/dist/esm/{chunk-T6ADNZE5.mjs → chunk-G4O6FXCF.mjs} +2 -2
- package/dist/esm/chunk-G4O6FXCF.mjs.map +1 -0
- package/dist/esm/{chunk-GMKKHGXK.mjs → chunk-GOXRBEIJ.mjs} +1 -1
- package/dist/esm/chunk-GOXRBEIJ.mjs.map +1 -0
- package/dist/esm/chunk-GP4TLDVZ.mjs +1 -0
- package/dist/esm/chunk-GP4TLDVZ.mjs.map +1 -0
- package/dist/esm/{chunk-BAEIZAP7.mjs → chunk-HBH2NQKU.mjs} +2 -2
- package/dist/esm/chunk-HBH2NQKU.mjs.map +1 -0
- package/dist/esm/{chunk-ZMMLM6ZJ.mjs → chunk-IDTLNF4M.mjs} +2 -2
- package/dist/esm/chunk-IDTLNF4M.mjs.map +1 -0
- package/dist/esm/{chunk-PXMNAP2Q.mjs → chunk-IEUEMBFD.mjs} +2 -2
- package/dist/esm/chunk-IEUEMBFD.mjs.map +1 -0
- package/dist/esm/{chunk-6Q2O5G3J.mjs → chunk-IF4UU2MT.mjs} +1 -1
- package/dist/esm/chunk-IF4UU2MT.mjs.map +1 -0
- package/dist/esm/{chunk-LPVGVTWT.mjs → chunk-JBEUUULP.mjs} +2 -2
- package/dist/esm/chunk-JBEUUULP.mjs.map +1 -0
- package/dist/esm/chunk-JJM6ELMS.mjs +2 -0
- package/dist/esm/chunk-JJM6ELMS.mjs.map +1 -0
- package/dist/esm/{chunk-2ESU5N3V.mjs → chunk-KOORZTHC.mjs} +2 -2
- package/dist/esm/chunk-KOORZTHC.mjs.map +1 -0
- package/dist/esm/{chunk-2QGJDHME.mjs → chunk-KVM2SGSF.mjs} +2 -2
- package/dist/esm/chunk-KVM2SGSF.mjs.map +1 -0
- package/dist/esm/{chunk-5PVZ4N42.mjs → chunk-M77M6NSB.mjs} +2 -2
- package/dist/esm/chunk-M77M6NSB.mjs.map +1 -0
- package/dist/esm/{chunk-G4KAHJXB.mjs → chunk-MCLYDS3O.mjs} +2 -2
- package/dist/esm/chunk-MCLYDS3O.mjs.map +1 -0
- package/dist/esm/{chunk-46O23AOD.mjs → chunk-MLSAZJZK.mjs} +2 -2
- package/dist/esm/chunk-MLSAZJZK.mjs.map +1 -0
- package/dist/esm/{chunk-BRV3RLKW.mjs → chunk-MT2RJ7H3.mjs} +2 -2
- package/dist/esm/chunk-MT2RJ7H3.mjs.map +1 -0
- package/dist/esm/chunk-MWBRD43V.mjs +2 -0
- package/dist/esm/chunk-MWBRD43V.mjs.map +1 -0
- package/dist/esm/{chunk-ACVIE7IE.mjs → chunk-N4DM5FYH.mjs} +2 -2
- package/dist/esm/chunk-N4DM5FYH.mjs.map +1 -0
- package/dist/esm/{chunk-LGTOOAQI.mjs → chunk-N6YTF76Q.mjs} +2 -2
- package/dist/esm/chunk-N6YTF76Q.mjs.map +1 -0
- package/dist/esm/{chunk-7N7FEBZA.mjs → chunk-NBNZ53ZV.mjs} +2 -2
- package/dist/esm/chunk-NBNZ53ZV.mjs.map +1 -0
- package/dist/esm/{chunk-CX6KECGV.mjs → chunk-NWLJ6RW7.mjs} +2 -2
- package/dist/esm/chunk-NWLJ6RW7.mjs.map +1 -0
- package/dist/esm/{chunk-VIZHWYI5.mjs → chunk-NYETBDSR.mjs} +2 -2
- package/dist/esm/chunk-NYETBDSR.mjs.map +1 -0
- package/dist/esm/{chunk-SK3LIS4Z.mjs → chunk-OEQ2U7GK.mjs} +2 -2
- package/dist/esm/chunk-OEQ2U7GK.mjs.map +1 -0
- package/dist/esm/{chunk-2C27NY4D.mjs → chunk-OHZURQPY.mjs} +2 -2
- package/dist/esm/chunk-OHZURQPY.mjs.map +1 -0
- package/dist/esm/{chunk-333QBK32.mjs → chunk-ONTWK5FU.mjs} +2 -2
- package/dist/esm/chunk-ONTWK5FU.mjs.map +1 -0
- package/dist/esm/chunk-OR6GFWLG.mjs +2 -0
- package/dist/esm/chunk-OR6GFWLG.mjs.map +1 -0
- package/dist/esm/{chunk-42H7WETG.mjs → chunk-ORMOQWWH.mjs} +2 -2
- package/dist/esm/chunk-ORMOQWWH.mjs.map +1 -0
- package/dist/esm/{chunk-S5SQJRAV.mjs → chunk-OROPNHRY.mjs} +2 -2
- package/dist/esm/chunk-OROPNHRY.mjs.map +1 -0
- package/dist/esm/{chunk-VWGB5BHW.mjs → chunk-OSBRPVVI.mjs} +2 -2
- package/dist/esm/chunk-OSBRPVVI.mjs.map +1 -0
- package/dist/esm/{chunk-NZ7M6NG2.mjs → chunk-P7A5RILV.mjs} +2 -2
- package/dist/esm/{chunk-JNO7KPMG.mjs → chunk-Q4C4U6I4.mjs} +2 -2
- package/dist/esm/chunk-Q4C4U6I4.mjs.map +1 -0
- package/dist/esm/{chunk-HMMNQFVM.mjs → chunk-QHC5DKVZ.mjs} +2 -2
- package/dist/esm/chunk-QHC5DKVZ.mjs.map +1 -0
- package/dist/esm/{chunk-F45G3GP3.mjs → chunk-QHEKBHNU.mjs} +2 -2
- package/dist/esm/chunk-QQEK7WVP.mjs +2 -0
- package/dist/esm/chunk-QQEK7WVP.mjs.map +1 -0
- package/dist/esm/{chunk-J7PJSK3J.mjs → chunk-RJ7F4JDV.mjs} +1 -1
- package/dist/esm/chunk-RJ7F4JDV.mjs.map +1 -0
- package/dist/esm/{chunk-BUAHUVAD.mjs → chunk-ROT6S6BM.mjs} +2 -2
- package/dist/esm/chunk-ROT6S6BM.mjs.map +1 -0
- package/dist/esm/{chunk-LKKI2KAP.mjs → chunk-S4LZMY2L.mjs} +2 -2
- package/dist/esm/chunk-S4LZMY2L.mjs.map +1 -0
- package/dist/esm/{chunk-33CVOPIN.mjs → chunk-S7RZGC56.mjs} +2 -2
- package/dist/esm/{chunk-33CVOPIN.mjs.map → chunk-S7RZGC56.mjs.map} +1 -1
- package/dist/esm/{chunk-SPRNSFUV.mjs → chunk-STY74NUA.mjs} +2 -2
- package/dist/esm/chunk-STY74NUA.mjs.map +1 -0
- package/dist/esm/{chunk-ZMBXHMVQ.mjs → chunk-TOBQ5UE6.mjs} +2 -2
- package/dist/esm/chunk-TOBQ5UE6.mjs.map +1 -0
- package/dist/esm/{chunk-7T26VA2W.mjs → chunk-UC23V7PU.mjs} +2 -2
- package/dist/esm/chunk-UC23V7PU.mjs.map +1 -0
- package/dist/esm/{chunk-4MTSP4S2.mjs → chunk-V6VPMNWJ.mjs} +2 -2
- package/dist/esm/chunk-V6VPMNWJ.mjs.map +1 -0
- package/dist/esm/{chunk-JMPHD4BP.mjs → chunk-VUIHJIMX.mjs} +2 -2
- package/dist/esm/chunk-VUIHJIMX.mjs.map +1 -0
- package/dist/esm/{chunk-2KSMV5KD.mjs → chunk-VV4HCOJQ.mjs} +2 -2
- package/dist/esm/chunk-VV4HCOJQ.mjs.map +1 -0
- package/dist/esm/{chunk-XZN344G4.mjs → chunk-VVXBVJXD.mjs} +2 -2
- package/dist/esm/chunk-VVXBVJXD.mjs.map +1 -0
- package/dist/esm/{chunk-IHGA5KAD.mjs → chunk-W4BSN6SK.mjs} +1 -1
- package/dist/esm/chunk-W4BSN6SK.mjs.map +1 -0
- package/dist/esm/chunk-WCMW2L3P.mjs +2 -0
- package/dist/esm/chunk-WCMW2L3P.mjs.map +1 -0
- package/dist/esm/{chunk-UFPYCROT.mjs → chunk-WQRGDSPD.mjs} +2 -2
- package/dist/esm/chunk-WQRGDSPD.mjs.map +1 -0
- package/dist/esm/chunk-WUWPN7XV.mjs +2 -0
- package/dist/esm/chunk-WUWPN7XV.mjs.map +1 -0
- package/dist/esm/{chunk-LA5HJILW.mjs → chunk-X6UNY6YM.mjs} +2 -2
- package/dist/esm/chunk-X6UNY6YM.mjs.map +1 -0
- package/dist/esm/chunk-XJJVJOX5.mjs +2 -0
- package/dist/esm/{chunk-UGTIALNW.mjs.map → chunk-XJJVJOX5.mjs.map} +1 -1
- package/dist/esm/{chunk-OPO5EYF7.mjs → chunk-XKUIMGKU.mjs} +2 -2
- package/dist/esm/chunk-XKUIMGKU.mjs.map +1 -0
- package/dist/esm/chunk-XTJOA5QN.mjs +2 -0
- package/dist/esm/chunk-XTJOA5QN.mjs.map +1 -0
- package/dist/esm/chunk-XTOIL6MB.mjs +2 -0
- package/dist/esm/chunk-XTOIL6MB.mjs.map +1 -0
- package/dist/esm/{chunk-ZMS3AOEZ.mjs → chunk-XY43TPRH.mjs} +2 -2
- package/dist/esm/chunk-XY43TPRH.mjs.map +1 -0
- package/dist/esm/{chunk-EGV3HFE3.mjs → chunk-XYB6KYKW.mjs} +2 -2
- package/dist/esm/chunk-XYB6KYKW.mjs.map +1 -0
- package/dist/esm/{chunk-RCA73RVB.mjs → chunk-XZ4JRYCE.mjs} +2 -2
- package/dist/esm/chunk-XZ4JRYCE.mjs.map +1 -0
- package/dist/esm/{chunk-4XB3BB5Z.mjs → chunk-YCQUYDZI.mjs} +2 -2
- package/dist/esm/chunk-YCQUYDZI.mjs.map +1 -0
- package/dist/esm/{chunk-HBIDHQ2M.mjs → chunk-YOZBVVKL.mjs} +1 -1
- package/dist/esm/chunk-YOZBVVKL.mjs.map +1 -0
- package/dist/esm/chunk-ZAIVZDOL.mjs +2 -0
- package/dist/esm/chunk-ZAIVZDOL.mjs.map +1 -0
- package/dist/esm/{chunk-ZXVN3HXB.mjs → chunk-ZGVNZE7J.mjs} +2 -2
- package/dist/esm/chunk-ZGVNZE7J.mjs.map +1 -0
- package/dist/esm/{chunk-YJVZFYBX.mjs → chunk-ZPV7HPA4.mjs} +2 -2
- package/dist/esm/chunk-ZPV7HPA4.mjs.map +1 -0
- package/dist/esm/cli/index.mjs +1 -1
- package/dist/esm/cli/localNode.d.mts +20 -8
- package/dist/esm/cli/localNode.mjs +1 -1
- package/dist/esm/cli/move.d.mts +26 -0
- package/dist/esm/cli/move.mjs +1 -1
- package/dist/esm/client/core.d.mts +4 -0
- package/dist/esm/client/core.mjs +1 -1
- package/dist/esm/client/get.d.mts +33 -1
- package/dist/esm/client/get.mjs +1 -1
- package/dist/esm/client/index.d.mts +1 -1
- package/dist/esm/client/index.mjs +1 -1
- package/dist/esm/client/post.d.mts +37 -0
- package/dist/esm/client/post.mjs +1 -1
- package/dist/esm/core/account/index.mjs +1 -1
- package/dist/esm/core/account/utils/address.d.mts +6 -0
- package/dist/esm/core/account/utils/address.mjs +1 -1
- package/dist/esm/core/account/utils/index.mjs +1 -1
- package/dist/esm/core/accountAddress.d.mts +46 -0
- package/dist/esm/core/accountAddress.mjs +1 -1
- package/dist/esm/core/authenticationKey.d.mts +1 -1
- package/dist/esm/core/authenticationKey.mjs +1 -1
- package/dist/esm/core/common.d.mts +14 -0
- package/dist/esm/core/common.mjs +1 -1
- package/dist/esm/core/crypto/ed25519.d.mts +57 -5
- package/dist/esm/core/crypto/ed25519.mjs +1 -1
- package/dist/esm/core/crypto/ephemeral.d.mts +23 -1
- package/dist/esm/core/crypto/ephemeral.mjs +1 -1
- package/dist/esm/core/crypto/federatedKeyless.d.mts +13 -1
- package/dist/esm/core/crypto/federatedKeyless.mjs +1 -1
- package/dist/esm/core/crypto/hdKey.d.mts +28 -0
- package/dist/esm/core/crypto/hdKey.mjs +1 -1
- package/dist/esm/core/crypto/index.d.mts +2 -2
- package/dist/esm/core/crypto/index.mjs +1 -1
- package/dist/esm/core/crypto/keyless.d.mts +131 -1
- package/dist/esm/core/crypto/keyless.mjs +1 -1
- package/dist/esm/core/crypto/multiEd25519.d.mts +41 -1
- package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
- package/dist/esm/core/crypto/multiKey.d.mts +38 -1
- package/dist/esm/core/crypto/multiKey.mjs +1 -1
- package/dist/esm/core/crypto/poseidon.d.mts +10 -0
- package/dist/esm/core/crypto/poseidon.mjs +1 -1
- package/dist/esm/core/crypto/privateKey.d.mts +9 -1
- package/dist/esm/core/crypto/privateKey.mjs +1 -1
- package/dist/esm/core/crypto/proof.d.mts +2 -0
- package/dist/esm/core/crypto/proof.mjs +1 -1
- package/dist/esm/core/crypto/publicKey.d.mts +1 -1
- package/dist/esm/core/crypto/publicKey.mjs +1 -1
- package/dist/esm/core/crypto/secp256k1.d.mts +50 -3
- package/dist/esm/core/crypto/secp256k1.mjs +1 -1
- package/dist/esm/core/crypto/signature.d.mts +6 -0
- package/dist/esm/core/crypto/signature.mjs +1 -1
- package/dist/esm/core/crypto/singleKey.d.mts +36 -2
- package/dist/esm/core/crypto/singleKey.mjs +1 -1
- package/dist/esm/core/crypto/utils.d.mts +2 -0
- package/dist/esm/core/crypto/utils.mjs +1 -1
- package/dist/esm/core/hex.d.mts +20 -0
- package/dist/esm/core/hex.mjs +1 -1
- package/dist/esm/core/index.d.mts +2 -2
- package/dist/esm/core/index.mjs +1 -1
- package/dist/esm/errors/index.mjs +1 -1
- package/dist/esm/index.d.mts +5 -4
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/internal/account.d.mts +24 -4
- package/dist/esm/internal/account.mjs +1 -1
- package/dist/esm/internal/ans.d.mts +27 -2
- package/dist/esm/internal/ans.mjs +1 -1
- package/dist/esm/internal/coin.d.mts +3 -1
- package/dist/esm/internal/coin.mjs +1 -1
- package/dist/esm/internal/digitalAsset.d.mts +31 -2
- package/dist/esm/internal/digitalAsset.mjs +1 -1
- package/dist/esm/internal/event.d.mts +5 -0
- package/dist/esm/internal/event.mjs +1 -1
- package/dist/esm/internal/faucet.d.mts +5 -0
- package/dist/esm/internal/faucet.mjs +1 -1
- package/dist/esm/internal/fungibleAsset.d.mts +8 -2
- package/dist/esm/internal/fungibleAsset.mjs +1 -1
- package/dist/esm/internal/general.d.mts +7 -0
- package/dist/esm/internal/general.mjs +1 -1
- package/dist/esm/internal/keyless.d.mts +6 -2
- package/dist/esm/internal/keyless.mjs +1 -1
- package/dist/esm/internal/object.d.mts +2 -0
- package/dist/esm/internal/object.mjs +1 -1
- package/dist/esm/internal/staking.d.mts +5 -1
- package/dist/esm/internal/staking.mjs +1 -1
- package/dist/esm/internal/table.d.mts +3 -0
- package/dist/esm/internal/table.mjs +1 -1
- package/dist/esm/internal/transaction.d.mts +14 -0
- package/dist/esm/internal/transaction.mjs +1 -1
- package/dist/esm/internal/transactionSubmission.d.mts +16 -5
- package/dist/esm/internal/transactionSubmission.mjs +1 -1
- package/dist/esm/internal/view.d.mts +2 -1
- package/dist/esm/internal/view.mjs +1 -1
- package/dist/esm/{publicKey-BVXX1nVl.d.mts → publicKey-BMtGNNLg.d.mts} +36 -0
- package/dist/esm/transactions/authenticator/account.d.mts +28 -1
- package/dist/esm/transactions/authenticator/account.mjs +1 -1
- package/dist/esm/transactions/authenticator/index.d.mts +2 -1
- package/dist/esm/transactions/authenticator/index.mjs +1 -1
- package/dist/esm/transactions/authenticator/transaction.d.mts +23 -2
- package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
- package/dist/esm/transactions/index.d.mts +2 -1
- package/dist/esm/transactions/index.mjs +1 -1
- package/dist/esm/transactions/instances/chainId.d.mts +8 -0
- package/dist/esm/transactions/instances/chainId.mjs +1 -1
- package/dist/esm/transactions/instances/identifier.d.mts +8 -0
- package/dist/esm/transactions/instances/identifier.mjs +1 -1
- package/dist/esm/transactions/instances/index.d.mts +2 -1
- package/dist/esm/transactions/instances/index.mjs +1 -1
- package/dist/esm/transactions/instances/moduleId.d.mts +10 -0
- package/dist/esm/transactions/instances/moduleId.mjs +1 -1
- package/dist/esm/transactions/instances/multiAgentTransaction.d.mts +8 -0
- package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/rawTransaction.d.mts +30 -0
- package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/rotationProofChallenge.d.mts +7 -1
- package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
- package/dist/esm/transactions/instances/signedTransaction.d.mts +10 -1
- package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/simpleTransaction.d.mts +8 -0
- package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/transactionArgument.d.mts +16 -0
- package/dist/esm/transactions/instances/transactionPayload.d.mts +48 -0
- package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
- package/dist/esm/transactions/management/accountSequenceNumber.d.mts +19 -2
- package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
- package/dist/esm/transactions/management/asyncQueue.d.mts +16 -0
- package/dist/esm/transactions/management/asyncQueue.mjs +1 -1
- package/dist/esm/transactions/management/index.d.mts +3 -2
- package/dist/esm/transactions/management/index.mjs +1 -1
- package/dist/esm/transactions/management/transactionWorker.d.mts +45 -7
- package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/helpers.d.mts +64 -1
- package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/index.d.mts +2 -1
- package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +14 -1
- package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/signingMessage.d.mts +10 -1
- package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +42 -1
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
- package/dist/esm/transactions/typeTag/index.d.mts +82 -0
- package/dist/esm/transactions/typeTag/index.mjs +1 -1
- package/dist/esm/transactions/typeTag/parser.d.mts +8 -0
- package/dist/esm/transactions/typeTag/parser.mjs +1 -1
- package/dist/esm/transactions/types.d.mts +80 -1
- package/dist/esm/types/index.mjs +1 -1
- package/dist/esm/types/indexer.d.mts +52 -0
- package/dist/esm/types/keyless.d.mts +12 -0
- package/dist/esm/utils/apiEndpoints.d.mts +30 -0
- package/dist/esm/utils/apiEndpoints.mjs +1 -1
- package/dist/esm/utils/const.d.mts +24 -0
- package/dist/esm/utils/const.mjs +1 -1
- package/dist/esm/utils/helpers.d.mts +20 -0
- package/dist/esm/utils/helpers.mjs +1 -1
- package/dist/esm/utils/index.mjs +1 -1
- package/dist/esm/utils/memoize.d.mts +4 -0
- package/dist/esm/utils/memoize.mjs +1 -1
- package/dist/esm/utils/normalizeBundle.d.mts +8 -0
- package/dist/esm/utils/normalizeBundle.mjs +1 -1
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +19 -20
- package/src/account/AbstractKeylessAccount.ts +80 -9
- package/src/account/Account.ts +51 -6
- package/src/account/AccountUtils.ts +216 -0
- package/src/account/Ed25519Account.ts +26 -0
- package/src/account/EphemeralKeyPair.ts +30 -0
- package/src/account/FederatedKeylessAccount.ts +10 -3
- package/src/account/KeylessAccount.ts +13 -1
- package/src/account/MultiKeyAccount.ts +75 -12
- package/src/account/SingleKeyAccount.ts +63 -6
- package/src/account/index.ts +1 -0
- package/src/account/utils.ts +16 -0
- package/src/api/account.ts +22 -2
- package/src/api/ans.ts +15 -0
- package/src/api/aptos.ts +3 -0
- package/src/api/aptosConfig.ts +24 -0
- package/src/api/coin.ts +3 -0
- package/src/api/digitalAsset.ts +26 -0
- package/src/api/event.ts +6 -0
- package/src/api/faucet.ts +11 -2
- package/src/api/fungibleAsset.ts +8 -0
- package/src/api/general.ts +12 -0
- package/src/api/keyless.ts +6 -0
- package/src/api/object.ts +3 -0
- package/src/api/staking.ts +5 -0
- package/src/api/table.ts +5 -0
- package/src/api/transaction.ts +19 -3
- package/src/api/transactionSubmission/build.ts +4 -0
- package/src/api/transactionSubmission/helpers.ts +2 -0
- package/src/api/transactionSubmission/management.ts +5 -0
- package/src/api/transactionSubmission/sign.ts +4 -0
- package/src/api/transactionSubmission/simulate.ts +4 -0
- package/src/api/transactionSubmission/submit.ts +4 -0
- package/src/api/utils.ts +1 -0
- package/src/bcs/deserializer.ts +47 -1
- package/src/bcs/serializable/entryFunctionBytes.ts +10 -0
- package/src/bcs/serializable/fixedBytes.ts +12 -0
- package/src/bcs/serializable/movePrimitives.ts +26 -0
- package/src/bcs/serializable/moveStructs.ts +56 -0
- package/src/bcs/serializer.ts +64 -1
- package/src/cli/localNode.ts +22 -8
- package/src/cli/move.ts +26 -0
- package/src/client/core.ts +4 -0
- package/src/client/get.ts +75 -1
- package/src/client/post.ts +37 -0
- package/src/core/account/utils/address.ts +6 -0
- package/src/core/accountAddress.ts +46 -0
- package/src/core/authenticationKey.ts +22 -0
- package/src/core/common.ts +14 -0
- package/src/core/crypto/ed25519.ts +58 -4
- package/src/core/crypto/ephemeral.ts +22 -0
- package/src/core/crypto/federatedKeyless.ts +12 -0
- package/src/core/crypto/hdKey.ts +29 -0
- package/src/core/crypto/keyless.ts +134 -0
- package/src/core/crypto/multiEd25519.ts +40 -0
- package/src/core/crypto/multiKey.ts +37 -1
- package/src/core/crypto/poseidon.ts +20 -0
- package/src/core/crypto/privateKey.ts +8 -0
- package/src/core/crypto/proof.ts +2 -0
- package/src/core/crypto/publicKey.ts +14 -0
- package/src/core/crypto/secp256k1.ts +49 -2
- package/src/core/crypto/signature.ts +8 -0
- package/src/core/crypto/singleKey.ts +34 -2
- package/src/core/crypto/utils.ts +2 -0
- package/src/core/hex.ts +20 -0
- package/src/internal/account.ts +27 -7
- package/src/internal/ans.ts +27 -0
- package/src/internal/coin.ts +1 -0
- package/src/internal/digitalAsset.ts +30 -0
- package/src/internal/event.ts +6 -0
- package/src/internal/faucet.ts +5 -0
- package/src/internal/fungibleAsset.ts +5 -0
- package/src/internal/general.ts +7 -0
- package/src/internal/keyless.ts +4 -0
- package/src/internal/object.ts +2 -0
- package/src/internal/staking.ts +5 -1
- package/src/internal/table.ts +3 -0
- package/src/internal/transaction.ts +16 -0
- package/src/internal/transactionSubmission.ts +15 -2
- package/src/transactions/authenticator/account.ts +26 -0
- package/src/transactions/authenticator/transaction.ts +20 -0
- package/src/transactions/instances/chainId.ts +8 -0
- package/src/transactions/instances/identifier.ts +8 -0
- package/src/transactions/instances/moduleId.ts +10 -0
- package/src/transactions/instances/multiAgentTransaction.ts +8 -0
- package/src/transactions/instances/rawTransaction.ts +30 -0
- package/src/transactions/instances/rotationProofChallenge.ts +6 -0
- package/src/transactions/instances/signedTransaction.ts +8 -0
- package/src/transactions/instances/simpleTransaction.ts +8 -0
- package/src/transactions/instances/transactionArgument.ts +16 -0
- package/src/transactions/instances/transactionPayload.ts +50 -0
- package/src/transactions/management/accountSequenceNumber.ts +16 -0
- package/src/transactions/management/asyncQueue.ts +16 -0
- package/src/transactions/management/transactionWorker.ts +42 -5
- package/src/transactions/transactionBuilder/helpers.ts +82 -10
- package/src/transactions/transactionBuilder/remoteAbi.ts +20 -0
- package/src/transactions/transactionBuilder/signingMessage.ts +10 -0
- package/src/transactions/transactionBuilder/transactionBuilder.ts +58 -0
- package/src/transactions/typeTag/index.ts +82 -0
- package/src/transactions/typeTag/parser.ts +24 -0
- package/src/transactions/types.ts +78 -0
- package/src/types/indexer.ts +52 -0
- package/src/types/keyless.ts +12 -0
- package/src/utils/apiEndpoints.ts +30 -2
- package/src/utils/const.ts +24 -1
- package/src/utils/helpers.ts +22 -0
- package/src/utils/memoize.ts +6 -0
- package/src/utils/normalizeBundle.ts +8 -1
- package/src/version.ts +1 -1
- package/dist/common/chunk-F43XVDYJ.js.map +0 -1
- package/dist/esm/chunk-2C27NY4D.mjs.map +0 -1
- package/dist/esm/chunk-2CJC43CV.mjs.map +0 -1
- package/dist/esm/chunk-2ESU5N3V.mjs.map +0 -1
- package/dist/esm/chunk-2KSMV5KD.mjs.map +0 -1
- package/dist/esm/chunk-2MN7DW2J.mjs.map +0 -1
- package/dist/esm/chunk-2QGJDHME.mjs.map +0 -1
- package/dist/esm/chunk-333QBK32.mjs.map +0 -1
- package/dist/esm/chunk-372SLYVR.mjs +0 -2
- package/dist/esm/chunk-372SLYVR.mjs.map +0 -1
- package/dist/esm/chunk-42H7WETG.mjs.map +0 -1
- package/dist/esm/chunk-46O23AOD.mjs.map +0 -1
- package/dist/esm/chunk-4DI5SPSK.mjs +0 -2
- package/dist/esm/chunk-4DI5SPSK.mjs.map +0 -1
- package/dist/esm/chunk-4DP3PEYK.mjs.map +0 -1
- package/dist/esm/chunk-4MTSP4S2.mjs.map +0 -1
- package/dist/esm/chunk-4O5XDQDO.mjs +0 -2
- package/dist/esm/chunk-4O5XDQDO.mjs.map +0 -1
- package/dist/esm/chunk-4OV2A6PJ.mjs +0 -2
- package/dist/esm/chunk-4OV2A6PJ.mjs.map +0 -1
- package/dist/esm/chunk-4XB3BB5Z.mjs.map +0 -1
- package/dist/esm/chunk-5B3SMBXQ.mjs +0 -2
- package/dist/esm/chunk-5B3SMBXQ.mjs.map +0 -1
- package/dist/esm/chunk-5LGKGWLX.mjs.map +0 -1
- package/dist/esm/chunk-5PVZ4N42.mjs.map +0 -1
- package/dist/esm/chunk-6Q2O5G3J.mjs.map +0 -1
- package/dist/esm/chunk-6ZOVTYLJ.mjs.map +0 -1
- package/dist/esm/chunk-7N7FEBZA.mjs.map +0 -1
- package/dist/esm/chunk-7T26VA2W.mjs.map +0 -1
- package/dist/esm/chunk-7V35JAAF.mjs.map +0 -1
- package/dist/esm/chunk-ACVIE7IE.mjs.map +0 -1
- package/dist/esm/chunk-AJ5JHBAE.mjs.map +0 -1
- package/dist/esm/chunk-AKIO3OIT.mjs.map +0 -1
- package/dist/esm/chunk-ALNQK276.mjs.map +0 -1
- package/dist/esm/chunk-AOROYJ74.mjs.map +0 -1
- package/dist/esm/chunk-BAEIZAP7.mjs.map +0 -1
- package/dist/esm/chunk-BRV3RLKW.mjs.map +0 -1
- package/dist/esm/chunk-BUAHUVAD.mjs.map +0 -1
- package/dist/esm/chunk-C2HCRGQU.mjs +0 -2
- package/dist/esm/chunk-C2HCRGQU.mjs.map +0 -1
- package/dist/esm/chunk-CDEYH77E.mjs +0 -2
- package/dist/esm/chunk-CDEYH77E.mjs.map +0 -1
- package/dist/esm/chunk-CX6KECGV.mjs.map +0 -1
- package/dist/esm/chunk-D3OEQLUE.mjs +0 -2
- package/dist/esm/chunk-D3OEQLUE.mjs.map +0 -1
- package/dist/esm/chunk-DBTKJMLV.mjs.map +0 -1
- package/dist/esm/chunk-DC2IESER.mjs +0 -2
- package/dist/esm/chunk-DC2IESER.mjs.map +0 -1
- package/dist/esm/chunk-EGV3HFE3.mjs.map +0 -1
- package/dist/esm/chunk-ELXJ5A4B.mjs +0 -2
- package/dist/esm/chunk-ELXJ5A4B.mjs.map +0 -1
- package/dist/esm/chunk-F2WY2DEY.mjs.map +0 -1
- package/dist/esm/chunk-FZDEGDUY.mjs.map +0 -1
- package/dist/esm/chunk-G4KAHJXB.mjs.map +0 -1
- package/dist/esm/chunk-GAEAYY44.mjs +0 -1
- package/dist/esm/chunk-GMKKHGXK.mjs.map +0 -1
- package/dist/esm/chunk-GVNK3UMT.mjs.map +0 -1
- package/dist/esm/chunk-H3C3VTHS.mjs.map +0 -1
- package/dist/esm/chunk-HBIDHQ2M.mjs.map +0 -1
- package/dist/esm/chunk-HMMNQFVM.mjs.map +0 -1
- package/dist/esm/chunk-IBZKCBN5.mjs.map +0 -1
- package/dist/esm/chunk-ICMELYCL.mjs.map +0 -1
- package/dist/esm/chunk-IHGA5KAD.mjs.map +0 -1
- package/dist/esm/chunk-IK2NYNKG.mjs.map +0 -1
- package/dist/esm/chunk-J3E4UMBB.mjs +0 -2
- package/dist/esm/chunk-J3E4UMBB.mjs.map +0 -1
- package/dist/esm/chunk-J7PJSK3J.mjs.map +0 -1
- package/dist/esm/chunk-JMPHD4BP.mjs.map +0 -1
- package/dist/esm/chunk-JNO7KPMG.mjs.map +0 -1
- package/dist/esm/chunk-KCWRCWNT.mjs.map +0 -1
- package/dist/esm/chunk-L4SWQLAJ.mjs.map +0 -1
- package/dist/esm/chunk-LA5HJILW.mjs.map +0 -1
- package/dist/esm/chunk-LGTOOAQI.mjs.map +0 -1
- package/dist/esm/chunk-LKKI2KAP.mjs.map +0 -1
- package/dist/esm/chunk-LPVGVTWT.mjs.map +0 -1
- package/dist/esm/chunk-MHN6XY4Z.mjs +0 -2
- package/dist/esm/chunk-MHN6XY4Z.mjs.map +0 -1
- package/dist/esm/chunk-N62NUAHT.mjs.map +0 -1
- package/dist/esm/chunk-NK67FECB.mjs.map +0 -1
- package/dist/esm/chunk-OIOGOW6I.mjs.map +0 -1
- package/dist/esm/chunk-OPO5EYF7.mjs.map +0 -1
- package/dist/esm/chunk-P6KX7AS2.mjs +0 -2
- package/dist/esm/chunk-P6KX7AS2.mjs.map +0 -1
- package/dist/esm/chunk-PMGK5IHB.mjs.map +0 -1
- package/dist/esm/chunk-PXMNAP2Q.mjs.map +0 -1
- package/dist/esm/chunk-QI7OREBM.mjs.map +0 -1
- package/dist/esm/chunk-RCA73RVB.mjs.map +0 -1
- package/dist/esm/chunk-S5SQJRAV.mjs.map +0 -1
- package/dist/esm/chunk-SK3LIS4Z.mjs.map +0 -1
- package/dist/esm/chunk-SNYYEVJA.mjs.map +0 -1
- package/dist/esm/chunk-SPRNSFUV.mjs.map +0 -1
- package/dist/esm/chunk-T6ADNZE5.mjs.map +0 -1
- package/dist/esm/chunk-TCXYTPUR.mjs +0 -2
- package/dist/esm/chunk-TCXYTPUR.mjs.map +0 -1
- package/dist/esm/chunk-U3T4ZT7B.mjs.map +0 -1
- package/dist/esm/chunk-U6OCK6T4.mjs.map +0 -1
- package/dist/esm/chunk-UFPYCROT.mjs.map +0 -1
- package/dist/esm/chunk-UGIHQFID.mjs.map +0 -1
- package/dist/esm/chunk-UGTIALNW.mjs +0 -2
- package/dist/esm/chunk-V4FKFCBL.mjs.map +0 -1
- package/dist/esm/chunk-V5NDNR36.mjs +0 -2
- package/dist/esm/chunk-V5NDNR36.mjs.map +0 -1
- package/dist/esm/chunk-VIZHWYI5.mjs.map +0 -1
- package/dist/esm/chunk-VQZMI3EZ.mjs.map +0 -1
- package/dist/esm/chunk-VWGB5BHW.mjs.map +0 -1
- package/dist/esm/chunk-WFK3XRQX.mjs.map +0 -1
- package/dist/esm/chunk-XOLU6UP3.mjs.map +0 -1
- package/dist/esm/chunk-XZN344G4.mjs.map +0 -1
- package/dist/esm/chunk-YD2BMHH7.mjs +0 -2
- package/dist/esm/chunk-YEWZAR76.mjs.map +0 -1
- package/dist/esm/chunk-YJVZFYBX.mjs.map +0 -1
- package/dist/esm/chunk-ZMBXHMVQ.mjs.map +0 -1
- package/dist/esm/chunk-ZMMLM6ZJ.mjs.map +0 -1
- package/dist/esm/chunk-ZMS3AOEZ.mjs.map +0 -1
- package/dist/esm/chunk-ZXVN3HXB.mjs.map +0 -1
- /package/dist/esm/{chunk-GAEAYY44.mjs.map → account/AccountUtils.mjs.map} +0 -0
- /package/dist/esm/{chunk-NZ7M6NG2.mjs.map → chunk-P7A5RILV.mjs.map} +0 -0
- /package/dist/esm/{chunk-F45G3GP3.mjs.map → chunk-QHEKBHNU.mjs.map} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/cli/move.ts"],"sourcesContent":["import { spawn } from \"child_process\";\nimport { platform } from \"os\";\n\nimport { AccountAddress } from \"../core\";\nimport { Network } from \"../utils\";\n\n/**\n * Class representing a Move package management utility for the Aptos blockchain.\n * This class provides methods to initialize directories, compile packages, run tests, publish modules, create objects, upgrade\n * packages, build transaction payloads, and run scripts.\n */\nexport class Move {\n /**\n * Initialize the current directory for Aptos by configuring the necessary settings.\n * Configuration will be pushed into .aptos/config.yaml.\n *\n * @param args - The arguments for initialization.\n * @param args.network - Optional Network type argument to use for default settings; defaults to local.\n * @param args.profile - Optional Profile to use from the config file; defaults to 'default'. This will override associated\n * settings such as the REST URL, the Faucet URL, and the private key arguments.\n * @param args.extraArguments - Optional extra arguments to include in the form of an array of strings.\n * Ex. [\"--assume-yes\",\"--gas-unit-price=10\"]\n * @returns stdout\n */\n async init(args: {\n network?: Network;\n profile?: string;\n extraArguments?: Array<string>;\n showStdout?: boolean;\n }): Promise<{ output: string }> {\n const { network, profile, extraArguments, showStdout } = args;\n const cliArgs = [\"aptos\", \"init\", `--network=${network ?? \"local\"}`, `--profile=${profile ?? \"default\"}`];\n\n if (extraArguments) {\n cliArgs.push(...extraArguments);\n }\n\n return this.runCommand(cliArgs, showStdout);\n }\n\n /**\n * Compile a Move package located at the specified directory path.\n * This function helps in preparing the Move package for deployment or further processing.\n *\n * @param args - The arguments for compiling the package.\n * @param args.packageDirectoryPath - Path to a Move package (the folder with a Move.toml file).\n * @param args.namedAddresses - Named addresses for the move binary. Ex. { alice: 0x1234, bob: 0x5678 }\n * @param args.extraArguments - Optional extra arguments to include in the form of an array of strings.\n * Ex. [\"--assume-yes\",\"--gas-unit-price=10\"]\n * @returns stdout\n */\n async compile(args: {\n packageDirectoryPath: string;\n namedAddresses: Record<string, AccountAddress>;\n extraArguments?: Array<string>;\n showStdout?: boolean;\n }): Promise<{ output: string }> {\n const { packageDirectoryPath, namedAddresses, extraArguments, showStdout } = args;\n const cliArgs = [\"aptos\", \"move\", \"compile\", \"--package-dir\", packageDirectoryPath];\n\n const addressesMap = this.parseNamedAddresses(namedAddresses);\n\n cliArgs.push(...this.prepareNamedAddresses(addressesMap));\n\n if (extraArguments) {\n cliArgs.push(...extraArguments);\n }\n\n return this.runCommand(cliArgs, showStdout);\n }\n\n /**\n * Run Move unit tests for a specified package.\n *\n * @param args - The arguments for running the tests.\n * @param args.packageDirectoryPath - The path to a Move package (the folder containing a Move.toml file).\n * @param args.namedAddresses - Named addresses for the move binary. Ex. { alice: 0x1234, bob: 0x5678 }\n * @param args.extraArguments - Optional extra arguments to include in the form of an array of strings.\n * Ex. [\"--assume-yes\",\"--gas-unit-price=10\"]\n * @returns The stdout output from running the tests.\n */\n async test(args: {\n packageDirectoryPath: string;\n namedAddresses: Record<string, AccountAddress>;\n extraArguments?: Array<string>;\n showStdout?: boolean;\n }): Promise<{ output: string }> {\n const { packageDirectoryPath, namedAddresses, extraArguments, showStdout } = args;\n const cliArgs = [\"aptos\", \"move\", \"test\", \"--package-dir\", packageDirectoryPath];\n\n const addressesMap = this.parseNamedAddresses(namedAddresses);\n\n cliArgs.push(...this.prepareNamedAddresses(addressesMap));\n\n if (extraArguments) {\n cliArgs.push(...extraArguments);\n }\n\n return this.runCommand(cliArgs, showStdout);\n }\n\n /**\n * Publishes the modules to the publisher account on the Aptos blockchain.\n *\n * @param args - The arguments for publishing the modules.\n * @param args.packageDirectoryPath - The path to a move package (the folder with a Move.toml file).\n * @param args.namedAddresses - Named addresses for the move binary. Ex. { alice: 0x1234, bob: 0x5678 }\n * @param args.profile - Optional profile to use from the config file.\n * @param args.extraArguments - Optional extra arguments to include in the form of an array of strings.\n * Ex. [\"--assume-yes\",\"--gas-unit-price=10\"]\n * @returns stdout\n */\n async publish(args: {\n packageDirectoryPath: string;\n namedAddresses: Record<string, AccountAddress>;\n profile?: string;\n extraArguments?: Array<string>;\n showStdout?: boolean;\n }): Promise<{ output: string }> {\n const { packageDirectoryPath, namedAddresses, profile, extraArguments, showStdout } = args;\n const cliArgs = [\n \"aptos\",\n \"move\",\n \"publish\",\n \"--package-dir\",\n packageDirectoryPath,\n `--profile=${profile ?? \"default\"}`,\n ];\n\n const addressesMap = this.parseNamedAddresses(namedAddresses);\n\n cliArgs.push(...this.prepareNamedAddresses(addressesMap));\n\n if (extraArguments) {\n cliArgs.push(...extraArguments);\n }\n\n return this.runCommand(cliArgs, showStdout);\n }\n\n /**\n * Create a new object and publish the Move package to it on the Aptos blockchain.\n *\n * @param args - The arguments for creating the object and publishing the package.\n * @param args.packageDirectoryPath - Path to a Move package (the folder with a Move.toml file).\n * @param args.addressName - Address name for the Move package.\n * @param args.namedAddresses - Named addresses for the Move binary.\n * @param args.profile - Optional profile to use from the config file.\n * @param args.extraArguments - Optional extra arguments to include in the form of an array of strings.\n * Ex. [\"--assume-yes\",\"--gas-unit-price=10\"]\n * @returns The object address.\n *\n * A complete example in CLI:\n * aptos move create-object-and-publish-package \\\n * --package-dir path_to_directory_that_has_move.toml \\\n * --address-name launchpad_addr \\\n * --named-addresses \"launchpad_addr=0x123,initial_creator_addr=0x456\" \\\n * --profile my_profile \\\n * --assume-yes\n */\n async createObjectAndPublishPackage(args: {\n packageDirectoryPath: string;\n addressName: string;\n namedAddresses: Record<string, AccountAddress>;\n profile?: string;\n extraArguments?: Array<string>;\n showStdout?: boolean;\n }): Promise<{ objectAddress: string }> {\n const { packageDirectoryPath, addressName, namedAddresses, profile, extraArguments, showStdout } = args;\n const cliArgs = [\n \"aptos\",\n \"move\",\n \"create-object-and-publish-package\",\n \"--package-dir\",\n packageDirectoryPath,\n \"--address-name\",\n addressName,\n `--profile=${profile ?? \"default\"}`,\n ];\n\n const addressesMap = this.parseNamedAddresses(namedAddresses);\n\n cliArgs.push(...this.prepareNamedAddresses(addressesMap));\n\n if (extraArguments) {\n cliArgs.push(...extraArguments);\n }\n\n const { output } = await this.runCommand(cliArgs, showStdout);\n return { objectAddress: this.extractAddressFromOutput(output) };\n }\n\n /**\n * Upgrade a Move package previously published to an object on the Aptos blockchain.\n * The caller must be the object owner to execute this function.\n *\n * @param args - The arguments for upgrading the object package.\n * @param args.packageDirectoryPath - Path to a Move package (the folder with a Move.toml file).\n * @param args.objectAddress - Address of the object that the Move package published to. Ex. 0x1000\n * @param args.namedAddresses - Named addresses for the move binary. Ex. { alice: 0x1234, bob: 0x5678 }\n * @param args.profile - Optional profile to use from the config file.\n * @param args.extraArguments - Optional extra arguments to include in the form of an array of strings.\n * Ex. [\"--assume-yes\",\"--gas-unit-price=10\"]\n * @returns stdout\n */\n async upgradeObjectPackage(args: {\n packageDirectoryPath: string;\n objectAddress: string;\n namedAddresses: Record<string, AccountAddress>;\n profile?: string;\n extraArguments?: Array<string>;\n showStdout?: boolean;\n }): Promise<{ output: string }> {\n const { packageDirectoryPath, objectAddress, namedAddresses, profile, extraArguments, showStdout } = args;\n const cliArgs = [\n \"aptos\",\n \"move\",\n \"upgrade-object-package\",\n \"--package-dir\",\n packageDirectoryPath,\n \"--object-address\",\n objectAddress,\n `--profile=${profile ?? \"default\"}`,\n ];\n\n const addressesMap = this.parseNamedAddresses(namedAddresses);\n\n cliArgs.push(...this.prepareNamedAddresses(addressesMap));\n\n if (extraArguments) {\n cliArgs.push(...extraArguments);\n }\n\n return this.runCommand(cliArgs, showStdout);\n }\n\n /**\n * Build a publication transaction payload and store it in a JSON output file.\n *\n * @param args - The arguments for building the publishing payload.\n * @param args.packageDirectoryPath - Path to a move package (the folder with a Move.toml file).\n * @param args.outputFile - Output file to write the publication transaction to.\n * @param args.namedAddresses - Named addresses for the move binary. Ex. { alice: 0x1234, bob: 0x5678 }\n * @param args.extraArguments - Optional extra arguments to include in the form of an array of strings.\n * Ex. [\"--assume-yes\",\"--gas-unit-price=10\"] *\n * @returns stdout\n */\n async buildPublishPayload(args: {\n packageDirectoryPath: string;\n outputFile: string;\n namedAddresses: Record<string, AccountAddress>;\n extraArguments?: Array<string>;\n showStdout?: boolean;\n }): Promise<{ output: string }> {\n const { outputFile, packageDirectoryPath, namedAddresses, extraArguments, showStdout } = args;\n const cliArgs = [\n \"aptos\",\n \"move\",\n \"build-publish-payload\",\n \"--json-output-file\",\n outputFile,\n \"--package-dir\",\n packageDirectoryPath,\n ];\n\n const addressesMap = this.parseNamedAddresses(namedAddresses);\n\n cliArgs.push(...this.prepareNamedAddresses(addressesMap));\n\n if (extraArguments) {\n cliArgs.push(...extraArguments);\n }\n\n return this.runCommand(cliArgs, showStdout);\n }\n\n /**\n * Runs a Move script using the provided compiled script path and optional parameters. Ensure that the script is compiled\n * before executing this function.\n *\n * @param args - The arguments for running the script.\n * @param args.compiledScriptPath - Path to a compiled Move script bytecode file.\n * Ex. \"build/my_package/bytecode_scripts/my_move_script.mv\"\n * @param args.profile - Optional profile to use from the config file.\n * @param args.extraArguments - Optional extra arguments to include in the form of an array of strings.\n * Ex. [\"--assume-yes\",\"--gas-unit-price=10\"]\n *\n * @returns The standard output from running the script.\n */\n async runScript(args: {\n compiledScriptPath: string;\n profile?: string;\n extraArguments?: Array<string>;\n showStdout?: boolean;\n }): Promise<{ output: string }> {\n const { compiledScriptPath, profile, extraArguments, showStdout } = args;\n const cliArgs = [\n \"aptos\",\n \"move\",\n \"run-script\",\n \"--compiled-script-path\",\n compiledScriptPath,\n `--profile=${profile ?? \"default\"}`,\n ];\n\n if (extraArguments) {\n cliArgs.push(...extraArguments);\n }\n\n return this.runCommand(cliArgs, showStdout);\n }\n\n async gasProfile(args: {\n network: string;\n transactionId: string;\n extraArguments?: Array<string>;\n showStdout?: boolean;\n }): Promise<{ output: string; result?: any }> {\n const { network, transactionId, extraArguments, showStdout } = args;\n const cliArgs = [\"aptos\", \"move\", \"replay\", \"--profile-gas\", \"--network\", network, \"--txn-id\", transactionId];\n\n if (extraArguments) {\n cliArgs.push(...extraArguments);\n }\n\n return this.runCommand(cliArgs, showStdout);\n }\n\n /**\n * Run a command with the specified arguments and return the output.\n *\n * @param args - An array of strings representing the command-line arguments to be passed to the command.\n * @param showStdout - Show the standard output generated by the command.\n * @returns The standard output generated by the command.\n */\n // eslint-disable-next-line class-methods-use-this\n private async runCommand(args: Array<string>, showStdout: boolean = true): Promise<{ result?: any; output: string }> {\n return new Promise((resolve, reject) => {\n const currentPlatform = platform();\n let childProcess;\n let stdout = \"\";\n // CLI final stdout is the Result/Error JSON string output\n // so we need to keep track of the last stdout\n let lastStdout = \"\";\n\n // Check if current OS is windows\n if (currentPlatform === \"win32\") {\n childProcess = spawn(\"npx\", args, { shell: true });\n } else {\n childProcess = spawn(\"npx\", args);\n }\n\n childProcess.stdout.on(\"data\", (data) => {\n lastStdout = data.toString();\n stdout += data.toString();\n });\n\n if (showStdout) {\n childProcess.stdout.pipe(process.stdout);\n childProcess.stderr.pipe(process.stderr);\n }\n process.stdin.pipe(childProcess.stdin);\n\n childProcess.on(\"close\", (code) => {\n if (code === 0) {\n try {\n // parse the last stdout as it might be the result\n const parsed = JSON.parse(lastStdout);\n if (parsed.Error) {\n reject(new Error(`Error: ${parsed.Error}`)); // Reject if the \"Error\" key exists\n } else if (parsed.Result) {\n resolve({ result: parsed.Result, output: stdout }); // Resolve if the \"Result\" key exists\n }\n } catch (error: any) {\n // resolve the stdout as it might be just a stdout\n resolve({ output: stdout });\n }\n } else {\n reject(new Error(`Child process exited with code ${code}`)); // Reject with an error if the child process exits with an error code\n }\n });\n });\n }\n\n /**\n * Convert named addresses from a Map into an array separated by a comma.\n *\n * @param namedAddresses - A Map where the key is a string representing the name and the value is an AccountAddress.\n * Ex. {'alice' => '0x123', 'bob' => '0x456'}\n * @returns An array of named addresses formatted as strings separated by a comma. Ex. \"alice=0x123,bob=0x456\"\n */\n // eslint-disable-next-line class-methods-use-this\n private prepareNamedAddresses(namedAddresses: Map<string, AccountAddress>): Array<string> {\n const totalNames = namedAddresses.size;\n const newArgs: Array<string> = [];\n\n if (totalNames === 0) {\n return newArgs;\n }\n\n newArgs.push(\"--named-addresses\");\n\n const names: Array<string> = [];\n namedAddresses.forEach((value, key) => {\n const toAppend = `${key}=${value.toString()}`;\n names.push(toAppend);\n });\n newArgs.push(names.join(\",\"));\n return newArgs;\n }\n\n /**\n * Parse named addresses from a Record type into a Map.\n *\n * This function transforms a collection of named addresses into a more accessible format by mapping each name to its\n * corresponding address.\n *\n * @param namedAddresses - A record containing named addresses where the key is the name and the value is the AccountAddress.\n * @returns A Map where each key is a name and each value is the corresponding address.\n */\n // eslint-disable-next-line class-methods-use-this\n private parseNamedAddresses(namedAddresses: Record<string, AccountAddress>): Map<string, AccountAddress> {\n const addressesMap = new Map();\n\n Object.keys(namedAddresses).forEach((key) => {\n const address = namedAddresses[key];\n addressesMap.set(key, address);\n });\n\n return addressesMap;\n }\n\n /**\n * Extracts the object address from the provided output string.\n *\n * @param output - The output string containing the object address.\n * @returns The extracted object address.\n * @throws Error if the object address cannot be extracted from the output.\n */\n // eslint-disable-next-line class-methods-use-this\n private extractAddressFromOutput(output: string): string {\n const match = output.match(\"Code was successfully deployed to object address (0x[0-9a-fA-F]+)\");\n if (match) {\n return match[1];\n }\n throw new Error(\"Failed to extract object address from output\");\n }\n}\n"],"mappings":"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","names":["spawn","platform","Move","args","network","profile","extraArguments","showStdout","cliArgs","packageDirectoryPath","namedAddresses","addressesMap","addressName","output","objectAddress","outputFile","compiledScriptPath","transactionId","resolve","reject","currentPlatform","childProcess","stdout","lastStdout","data","code","parsed","totalNames","newArgs","names","value","key","toAppend","address","match"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/transactions/instances/multiAgentTransaction.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/* eslint-disable @typescript-eslint/naming-convention */\n\nimport { Deserializer } from \"../../bcs/deserializer\";\nimport { Serializable, Serializer } from \"../../bcs/serializer\";\nimport { AccountAddress } from \"../../core\";\nimport { RawTransaction } from \"./rawTransaction\";\n\n/**\n * Represents a multi-agent transaction that can be serialized and deserialized.\n * This transaction includes a raw transaction, optional fee payer address, and multiple secondary signer addresses.\n *\n * @param rawTransaction The raw transaction to be executed.\n * @param secondarySignerAddresses An array of secondary signer addresses involved in the transaction.\n * @param feePayerAddress An optional account address that sponsors the transaction's gas fees.\n */\nexport class MultiAgentTransaction extends Serializable {\n public rawTransaction: RawTransaction;\n\n public feePayerAddress?: AccountAddress | undefined;\n\n public secondarySignerAddresses: AccountAddress[];\n\n /**\n * Represents a MultiAgentTransaction that can be submitted to the Aptos chain for execution.\n * This class encapsulates the raw transaction data, the secondary signer addresses, and an optional fee payer address.\n *\n * @param rawTransaction The raw transaction data.\n * @param secondarySignerAddresses An array of secondary signer addresses.\n * @param feePayerAddress An optional account address that sponsors the gas fees.\n */\n constructor(\n rawTransaction: RawTransaction,\n secondarySignerAddresses: AccountAddress[],\n feePayerAddress?: AccountAddress,\n ) {\n super();\n this.rawTransaction = rawTransaction;\n this.feePayerAddress = feePayerAddress;\n this.secondarySignerAddresses = secondarySignerAddresses;\n }\n\n /**\n * Serializes the transaction data, including the raw transaction, secondary signer addresses, and fee payer address.\n * This function is essential for preparing the transaction for transmission or storage in a serialized format.\n *\n * @param serializer - The serializer instance used to serialize the transaction data.\n */\n serialize(serializer: Serializer): void {\n this.rawTransaction.serialize(serializer);\n\n serializer.serializeVector<AccountAddress>(this.secondarySignerAddresses);\n\n if (this.feePayerAddress === undefined) {\n serializer.serializeBool(false);\n } else {\n serializer.serializeBool(true);\n this.feePayerAddress.serialize(serializer);\n }\n }\n\n /**\n * Deserializes a MultiAgentTransaction from the provided deserializer.\n * This function allows you to reconstruct a MultiAgentTransaction object from its serialized form, including any secondary\n * signer addresses and the fee payer address if present.\n *\n * @param deserializer - The deserializer instance used to read the serialized data.\n */\n static deserialize(deserializer: Deserializer): MultiAgentTransaction {\n const rawTransaction = RawTransaction.deserialize(deserializer);\n\n const secondarySignerAddresses = deserializer.deserializeVector(AccountAddress);\n\n const feePayerPresent = deserializer.deserializeBool();\n let feePayerAddress;\n if (feePayerPresent) {\n feePayerAddress = AccountAddress.deserialize(deserializer);\n }\n\n return new MultiAgentTransaction(rawTransaction, secondarySignerAddresses, feePayerAddress);\n }\n}\n"],"mappings":"2HAkBO,IAAMA,EAAN,MAAMC,UAA8BC,CAAa,CAetD,YACEC,EACAC,EACAC,EACA,CACA,MAAM,EACN,KAAK,eAAiBF,EACtB,KAAK,gBAAkBE,EACvB,KAAK,yBAA2BD,CAClC,CAQA,UAAUE,EAA8B,CACtC,KAAK,eAAe,UAAUA,CAAU,EAExCA,EAAW,gBAAgC,KAAK,wBAAwB,EAEpE,KAAK,kBAAoB,OAC3BA,EAAW,cAAc,EAAK,GAE9BA,EAAW,cAAc,EAAI,EAC7B,KAAK,gBAAgB,UAAUA,CAAU,EAE7C,CASA,OAAO,YAAYC,EAAmD,CACpE,IAAMJ,EAAiBK,EAAe,YAAYD,CAAY,EAExDH,EAA2BG,EAAa,kBAAkBE,CAAc,EAExEC,EAAkBH,EAAa,gBAAgB,EACjDF,EACJ,OAAIK,IACFL,EAAkBI,EAAe,YAAYF,CAAY,GAGpD,IAAIN,EAAsBE,EAAgBC,EAA0BC,CAAe,CAC5F,CACF","names":["MultiAgentTransaction","_MultiAgentTransaction","Serializable","rawTransaction","secondarySignerAddresses","feePayerAddress","serializer","deserializer","RawTransaction","AccountAddress","feePayerPresent"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=chunk-GAEAYY44.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/core/crypto/poseidon.ts"],"sourcesContent":["/* eslint-disable no-bitwise */\nimport {\n poseidon1,\n poseidon2,\n poseidon3,\n poseidon4,\n poseidon5,\n poseidon6,\n poseidon7,\n poseidon8,\n poseidon9,\n poseidon10,\n poseidon11,\n poseidon12,\n poseidon13,\n poseidon14,\n poseidon15,\n poseidon16,\n} from \"poseidon-lite\";\n\nconst numInputsToPoseidonFunc = [\n poseidon1,\n poseidon2,\n poseidon3,\n poseidon4,\n poseidon5,\n poseidon6,\n poseidon7,\n poseidon8,\n poseidon9,\n poseidon10,\n poseidon11,\n poseidon12,\n poseidon13,\n poseidon14,\n poseidon15,\n poseidon16,\n];\n\nconst BYTES_PACKED_PER_SCALAR = 31;\nconst MAX_NUM_INPUT_SCALARS = 16;\nconst MAX_NUM_INPUT_BYTES = (MAX_NUM_INPUT_SCALARS - 1) * BYTES_PACKED_PER_SCALAR;\n\n/**\n * Hashes a string to a field element via Poseidon hashing.\n * This function is useful for converting a string into a fixed-size hash that can be used in cryptographic applications.\n *\n * @param str - The string to be hashed.\n * @param maxSizeBytes - The maximum size in bytes for the resulting hash.\n * @returns bigint - The result of the hash.\n */\nexport function hashStrToField(str: string, maxSizeBytes: number): bigint {\n const textEncoder = new TextEncoder();\n const strBytes = textEncoder.encode(str);\n return hashBytesWithLen(strBytes, maxSizeBytes);\n}\n\n/**\n * Computes a Poseidon hash of the provided byte array, ensuring that the byte array does not exceed the specified maximum size.\n * This function is useful for generating a hash from a byte array while enforcing size constraints.\n *\n * @param bytes - The byte array to be hashed.\n * @param maxSizeBytes - The maximum allowed size for the byte array.\n * @throws Error if the length of the inputted bytes exceeds the specified maximum size.\n */\nfunction hashBytesWithLen(bytes: Uint8Array, maxSizeBytes: number): bigint {\n if (bytes.length > maxSizeBytes) {\n throw new Error(`Inputted bytes of length ${bytes} is longer than ${maxSizeBytes}`);\n }\n const packed = padAndPackBytesWithLen(bytes, maxSizeBytes);\n return poseidonHash(packed);\n}\n\n/**\n * Pads the input byte array with zeros to a specified maximum size and then packs the bytes.\n * This function ensures that the byte array does not exceed the specified maximum size, throwing an error if it does.\n *\n * @param bytes - The byte array to be padded and packed.\n * @param maxSizeBytes - The maximum size in bytes that the input array can have.\n * @throws Error if the input byte array exceeds the specified maximum size.\n */\nfunction padAndPackBytesNoLen(bytes: Uint8Array, maxSizeBytes: number): bigint[] {\n if (bytes.length > maxSizeBytes) {\n throw new Error(`Input bytes of length ${bytes} is longer than ${maxSizeBytes}`);\n }\n const paddedStrBytes = padUint8ArrayWithZeros(bytes, maxSizeBytes);\n return packBytes(paddedStrBytes);\n}\n\n/**\n * Pads and packs the given byte array to a specified maximum size and appends its length.\n * This function ensures that the byte array does not exceed the maximum size, throwing an error if it does.\n * It is useful for preparing byte data for further processing or transmission by ensuring a consistent format.\n *\n * @param bytes - The byte array to be padded and packed.\n * @param maxSizeBytes - The maximum allowed size for the byte array.\n * @throws Error if the length of the input bytes exceeds the maximum size.\n * @returns A new Uint8Array that contains the padded and packed bytes along with the length of the original byte array.\n */\nexport function padAndPackBytesWithLen(bytes: Uint8Array, maxSizeBytes: number): bigint[] {\n if (bytes.length > maxSizeBytes) {\n throw new Error(`Input bytes of length ${bytes} is longer than ${maxSizeBytes}`);\n }\n return padAndPackBytesNoLen(bytes, maxSizeBytes).concat([BigInt(bytes.length)]);\n}\n\n/**\n * Packs a Uint8Array into an array of BigInts, ensuring the input does not exceed the maximum allowed bytes.\n * @param bytes - The Uint8Array to be packed.\n * @throws {Error} Throws an error if the input exceeds the maximum number of bytes allowed.\n */\nfunction packBytes(bytes: Uint8Array): bigint[] {\n if (bytes.length > MAX_NUM_INPUT_BYTES) {\n throw new Error(`Can't pack more than ${MAX_NUM_INPUT_BYTES}. Was given ${bytes.length} bytes`);\n }\n return chunkUint8Array(bytes, BYTES_PACKED_PER_SCALAR).map((chunk) => bytesToBigIntLE(chunk));\n}\n\n/**\n * Splits a Uint8Array into smaller chunks of the specified size.\n * This function is useful for processing large arrays in manageable segments.\n *\n * @param array - The Uint8Array to be split into chunks.\n * @param chunkSize - The size of each chunk.\n * @returns An array of Uint8Array chunks.\n */\nfunction chunkUint8Array(array: Uint8Array, chunkSize: number): Uint8Array[] {\n const result: Uint8Array[] = [];\n for (let i = 0; i < array.length; i += chunkSize) {\n result.push(array.subarray(i, i + chunkSize));\n }\n return result;\n}\n\n/**\n * Converts a little-endian byte array into a BigInt.\n * This function is useful for interpreting byte data as a numerical value in a way that respects the little-endian format.\n *\n * @param bytes - The byte array to convert.\n * @returns The resulting BigInt representation of the byte array.\n */\nexport function bytesToBigIntLE(bytes: Uint8Array): bigint {\n let result = BigInt(0);\n for (let i = bytes.length - 1; i >= 0; i -= 1) {\n result = (result << BigInt(8)) | BigInt(bytes[i]);\n }\n return result;\n}\n\n/**\n * Converts a bigint value into a little-endian byte array of a specified length.\n * This function is useful for representing large integers in a byte format, which is often required for cryptographic operations\n * or binary data manipulation.\n *\n * @param value - The number to convert into bytes.\n * @param length - The desired length of the resulting byte array.\n * @returns A Uint8Array containing the little-endian representation of the bigint value.\n */\nexport function bigIntToBytesLE(value: bigint | number, length: number): Uint8Array {\n let val = BigInt(value);\n const bytes = new Uint8Array(length);\n for (let i = 0; i < length; i += 1) {\n bytes[i] = Number(val & BigInt(0xff));\n val >>= BigInt(8);\n }\n return bytes;\n}\n\n/**\n * Pads the input Uint8Array with zeros to achieve the specified size.\n * This function is useful for ensuring that a byte array meets a required length for further processing.\n *\n * @param inputArray - The Uint8Array to be padded.\n * @param paddedSize - The desired size of the padded array, which must be greater than or equal to the input array size.\n * @throws Error if paddedSize is less than the length of inputArray.\n */\nfunction padUint8ArrayWithZeros(inputArray: Uint8Array, paddedSize: number): Uint8Array {\n if (paddedSize < inputArray.length) {\n throw new Error(\"Padded size must be greater than or equal to the input array size.\");\n }\n\n // Create a new Uint8Array with the padded size\n const paddedArray = new Uint8Array(paddedSize);\n\n // Copy the content of the input array to the new array\n paddedArray.set(inputArray);\n\n // Fill the remaining space with zeros\n for (let i = inputArray.length; i < paddedSize; i += 1) {\n paddedArray[i] = 0;\n }\n\n return paddedArray;\n}\n\n/**\n * Hashes up to 16 scalar elements via the Poseidon hashing algorithm.\n * Each element must be scalar fields of the BN254 elliptic curve group.\n *\n * @param inputs - An array of elements to be hashed, which can be of type number, bigint, or string.\n * @returns bigint - The result of the hash.\n * @throws Error - Throws an error if the input length exceeds the maximum allowed.\n */\nexport function poseidonHash(inputs: (number | bigint | string)[]): bigint {\n if (inputs.length > numInputsToPoseidonFunc.length) {\n throw new Error(\n `Unable to hash input of length ${inputs.length}. Max input length is ${numInputsToPoseidonFunc.length}`,\n );\n }\n return numInputsToPoseidonFunc[inputs.length - 1](inputs);\n}\n"],"mappings":"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","names":["poseidon1","poseidon2","poseidon3","poseidon4","poseidon5","poseidon6","poseidon7","poseidon8","poseidon9","poseidon10","poseidon11","poseidon12","poseidon13","poseidon14","poseidon15","poseidon16","numInputsToPoseidonFunc","BYTES_PACKED_PER_SCALAR","MAX_NUM_INPUT_SCALARS","MAX_NUM_INPUT_BYTES","hashStrToField","str","maxSizeBytes","strBytes","hashBytesWithLen","bytes","packed","padAndPackBytesWithLen","poseidonHash","padAndPackBytesNoLen","paddedStrBytes","padUint8ArrayWithZeros","packBytes","chunkUint8Array","chunk","bytesToBigIntLE","array","chunkSize","result","i","bigIntToBytesLE","value","length","val","inputArray","paddedSize","paddedArray","inputs"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/internal/object.ts"],"sourcesContent":["import { AptosConfig } from \"../api/aptosConfig\";\nimport { AccountAddressInput, AccountAddress } from \"../core\";\nimport { PaginationArgs, OrderByArg, GetObjectDataQueryResponse, WhereArg } from \"../types\";\nimport { GetObjectDataQuery } from \"../types/generated/operations\";\nimport { GetObjectData } from \"../types/generated/queries\";\nimport { CurrentObjectsBoolExp } from \"../types/generated/types\";\nimport { queryIndexer } from \"./general\";\n\n/**\n * Retrieves the current objects based on specified filtering and pagination options.\n *\n * @param args - The arguments for retrieving object data.\n * @param args.aptosConfig - The configuration settings for Aptos.\n * @param [args.options] - Optional parameters for pagination and filtering.\n * @param [args.options.offset] - The number of items to skip before starting to collect the result set.\n * @param [args.options.limit] - The maximum number of items to return.\n * @param [args.options.orderBy] - The criteria for ordering the results.\n * @param [args.options.where] - The conditions to filter the results.\n * @returns The current objects that match the specified criteria.\n */\nexport async function getObjectData(args: {\n aptosConfig: AptosConfig;\n options?: PaginationArgs & OrderByArg<GetObjectDataQueryResponse[0]> & WhereArg<CurrentObjectsBoolExp>;\n}): Promise<GetObjectDataQueryResponse> {\n const { aptosConfig, options } = args;\n\n const graphqlQuery = {\n query: GetObjectData,\n variables: {\n where_condition: options?.where,\n offset: options?.offset,\n limit: options?.limit,\n order_by: options?.orderBy,\n },\n };\n const data = await queryIndexer<GetObjectDataQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getObjectData\",\n });\n\n return data.current_objects;\n}\n\n/**\n * Retrieves the object data associated with a specific object address.\n * This function allows you to access detailed information about an object in the Aptos blockchain.\n *\n * @param args - The arguments for retrieving object data.\n * @param args.aptosConfig - The configuration for connecting to the Aptos blockchain.\n * @param args.objectAddress - The address of the object whose data is being retrieved.\n * @param args.options - Optional parameters for pagination and ordering of the results.\n */\nexport async function getObjectDataByObjectAddress(args: {\n aptosConfig: AptosConfig;\n objectAddress: AccountAddressInput;\n options?: PaginationArgs & OrderByArg<GetObjectDataQueryResponse[0]>;\n}): Promise<GetObjectDataQueryResponse[0]> {\n const { aptosConfig, objectAddress, options } = args;\n const address = AccountAddress.from(objectAddress).toStringLong();\n\n const whereCondition: { object_address: { _eq: string } } = {\n object_address: { _eq: address },\n };\n return (await getObjectData({ aptosConfig, options: { ...options, where: whereCondition } }))[0];\n}\n"],"mappings":"2HAoBA,eAAsBA,EAAcC,EAGI,CACtC,GAAM,CAAE,YAAAC,EAAa,QAAAC,CAAQ,EAAIF,EAE3BG,EAAe,CACnB,MAAOC,EACP,UAAW,CACT,gBAAiBF,GAAS,MAC1B,OAAQA,GAAS,OACjB,MAAOA,GAAS,MAChB,SAAUA,GAAS,OACrB,CACF,EAOA,OANa,MAAMG,EAAiC,CAClD,YAAAJ,EACA,MAAOE,EACP,aAAc,eAChB,CAAC,GAEW,eACd,CAWA,eAAsBG,EAA6BN,EAIR,CACzC,GAAM,CAAE,YAAAC,EAAa,cAAAM,EAAe,QAAAL,CAAQ,EAAIF,EAG1CQ,EAAsD,CAC1D,eAAgB,CAAE,IAHJC,EAAe,KAAKF,CAAa,EAAE,aAAa,CAG/B,CACjC,EACA,OAAQ,MAAMR,EAAc,CAAE,YAAAE,EAAa,QAAS,CAAE,GAAGC,EAAS,MAAOM,CAAe,CAAE,CAAC,GAAG,CAAC,CACjG","names":["getObjectData","args","aptosConfig","options","graphqlQuery","GetObjectData","queryIndexer","getObjectDataByObjectAddress","objectAddress","whereCondition","AccountAddress"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/core/crypto/ed25519.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { ed25519 } from \"@noble/curves/ed25519\";\nimport { Deserializer } from \"../../bcs/deserializer\";\nimport { Serializable, Serializer } from \"../../bcs/serializer\";\nimport { AuthenticationKey } from \"../authenticationKey\";\nimport { Hex } from \"../hex\";\nimport { HexInput, SigningScheme as AuthenticationKeyScheme, PrivateKeyVariants } from \"../../types\";\nimport { CKDPriv, deriveKey, HARDENED_OFFSET, isValidHardenedPath, mnemonicToSeed, splitPath } from \"./hdKey\";\nimport { PrivateKey } from \"./privateKey\";\nimport { AccountPublicKey, PublicKey, VerifySignatureArgs } from \"./publicKey\";\nimport { Signature } from \"./signature\";\nimport { convertSigningMessage } from \"./utils\";\n\n/**\n * L is the value that greater than or equal to will produce a non-canonical signature, and must be rejected\n */\nconst L: number[] = [\n 0xed, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58, 0xd6, 0x9c, 0xf7, 0xa2, 0xde, 0xf9, 0xde, 0x14, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,\n];\n\n/**\n * Checks if an ED25519 signature is non-canonical.\n * This function helps determine the validity of a signature by verifying its canonical form.\n *\n * @param signature - The signature to be checked for canonicality.\n * @returns A boolean indicating whether the signature is non-canonical.\n *\n * Comes from Aptos Core\n * https://github.com/aptos-labs/aptos-core/blob/main/crates/aptos-crypto/src/ed25519/ed25519_sigs.rs#L47-L85\n */\nexport function isCanonicalEd25519Signature(signature: Signature): boolean {\n const s = signature.toUint8Array().slice(32);\n for (let i = L.length - 1; i >= 0; i -= 1) {\n if (s[i] < L[i]) {\n return true;\n }\n if (s[i] > L[i]) {\n return false;\n }\n }\n // As this stage S == L which implies a non-canonical S.\n return false;\n}\n\n/**\n * Represents the public key of an Ed25519 key pair.\n *\n * Since [AIP-55](https://github.com/aptos-foundation/AIPs/pull/263) Aptos supports\n * `Legacy` and `Unified` authentication keys.\n *\n * Ed25519 scheme is represented in the SDK as `Legacy authentication key` and also\n * as `AnyPublicKey` that represents any `Unified authentication key`.\n */\nexport class Ed25519PublicKey extends AccountPublicKey {\n /**\n * Length of an Ed25519 public key\n */\n static readonly LENGTH: number = 32;\n\n /**\n * Bytes of the public key\n * @private\n */\n private readonly key: Hex;\n\n /**\n * Creates an instance of the Ed25519Signature class from a hex input.\n * This constructor validates the length of the signature to ensure it meets the required specifications.\n *\n * @param hexInput - The hex input representing the Ed25519 signature.\n * @throws Error if the signature length is not equal to Ed25519Signature.LENGTH.\n */\n constructor(hexInput: HexInput) {\n super();\n\n const hex = Hex.fromHexInput(hexInput);\n if (hex.toUint8Array().length !== Ed25519PublicKey.LENGTH) {\n throw new Error(`PublicKey length should be ${Ed25519PublicKey.LENGTH}`);\n }\n this.key = hex;\n }\n\n // region AccountPublicKey\n\n /**\n * Verifies a signed message using a public key.\n *\n * @param args - The arguments for verification.\n * @param args.message - A signed message as a Hex string or Uint8Array.\n * @param args.signature - The signature of the message.\n */\n verifySignature(args: VerifySignatureArgs): boolean {\n const { message, signature } = args;\n // Verify malleability\n if (!isCanonicalEd25519Signature(signature)) {\n return false;\n }\n\n const messageToVerify = convertSigningMessage(message);\n const messageBytes = Hex.fromHexInput(messageToVerify).toUint8Array();\n const signatureBytes = signature.toUint8Array();\n const publicKeyBytes = this.key.toUint8Array();\n return ed25519.verify(signatureBytes, messageBytes, publicKeyBytes);\n }\n\n /**\n * Generates an authentication key from the public key using the Ed25519 scheme.\n * This function is essential for creating a secure authentication key that can be used for further cryptographic operations.\n *\n * @returns {AuthenticationKey} The generated authentication key.\n */\n authKey(): AuthenticationKey {\n return AuthenticationKey.fromSchemeAndBytes({\n scheme: AuthenticationKeyScheme.Ed25519,\n input: this.toUint8Array(),\n });\n }\n\n /**\n * Convert the internal data representation to a Uint8Array.\n *\n * @returns Uint8Array representation of the data.\n */\n toUint8Array(): Uint8Array {\n return this.key.toUint8Array();\n }\n\n // endregion\n\n // region Serializable\n\n /**\n * Serializes the data into a byte array using the provided serializer.\n * This allows for the conversion of data into a format suitable for transmission or storage.\n *\n * @param serializer - The serializer instance used to perform the serialization.\n */\n serialize(serializer: Serializer): void {\n serializer.serializeBytes(this.key.toUint8Array());\n }\n\n /**\n * Deserialize bytes into an Ed25519Signature object.\n * This function is used to convert serialized byte data into a usable Ed25519Signature instance.\n *\n * @param deserializer - The deserializer instance used to read the byte data.\n */\n static deserialize(deserializer: Deserializer): Ed25519PublicKey {\n const bytes = deserializer.deserializeBytes();\n return new Ed25519PublicKey(bytes);\n }\n\n // endregion\n\n /**\n * Determine if the provided public key is an instance of Ed25519PublicKey.\n *\n * @param publicKey - The public key to check.\n * @returns True if the public key is an instance of Ed25519PublicKey, otherwise false.\n * @deprecated use `instanceof Ed25519PublicKey` instead.\n */\n static isPublicKey(publicKey: AccountPublicKey): publicKey is Ed25519PublicKey {\n return publicKey instanceof Ed25519PublicKey;\n }\n\n /**\n * Determines if the provided public key is a valid Ed25519 public key.\n * This function checks for the presence of the \"key\" property and verifies that its data length matches the expected length\n * for Ed25519 public keys.\n *\n * @param publicKey - The public key to validate.\n * @returns A boolean indicating whether the public key is a valid Ed25519 public key.\n */\n static isInstance(publicKey: PublicKey): publicKey is Ed25519PublicKey {\n return \"key\" in publicKey && (publicKey.key as any)?.data?.length === Ed25519PublicKey.LENGTH;\n }\n}\n\n/**\n * Represents the private key of an Ed25519 key pair.\n */\nexport class Ed25519PrivateKey extends Serializable implements PrivateKey {\n /**\n * Length of an Ed25519 private key\n * @readonly\n */\n static readonly LENGTH: number = 32;\n\n /**\n * The Ed25519 key seed to use for BIP-32 compatibility\n * See more {@link https://github.com/satoshilabs/slips/blob/master/slip-0010.md}\n * @readonly\n */\n static readonly SLIP_0010_SEED = \"ed25519 seed\";\n\n /**\n * The Ed25519 signing key\n * @private\n */\n private readonly signingKey: Hex;\n\n // region Constructors\n\n /**\n * Create a new PrivateKey instance from a Uint8Array or String.\n *\n * [Read about AIP-80](https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-80.md)\n *\n * @param hexInput HexInput (string or Uint8Array)\n * @param strict If true, private key must AIP-80 compliant.\n */\n constructor(hexInput: HexInput, strict?: boolean) {\n super();\n\n const privateKeyHex = PrivateKey.parseHexInput(hexInput, PrivateKeyVariants.Ed25519, strict);\n if (privateKeyHex.toUint8Array().length !== Ed25519PrivateKey.LENGTH) {\n throw new Error(`PrivateKey length should be ${Ed25519PrivateKey.LENGTH}`);\n }\n\n // Create keyPair from Private key in Uint8Array format\n this.signingKey = privateKeyHex;\n }\n\n /**\n * Generate a new random private key.\n *\n * @returns Ed25519PrivateKey A newly generated Ed25519 private key.\n */\n static generate(): Ed25519PrivateKey {\n const keyPair = ed25519.utils.randomPrivateKey();\n return new Ed25519PrivateKey(keyPair, false);\n }\n\n /**\n * Derives a private key from a mnemonic seed phrase using a specified BIP44 path.\n * To derive multiple keys from the same phrase, change the path\n *\n * IMPORTANT: Ed25519 supports hardened derivation only, as it lacks a key homomorphism, making non-hardened derivation impossible.\n *\n * @param path - The BIP44 path used for key derivation.\n * @param mnemonics - The mnemonic seed phrase from which the key will be derived.\n * @throws Error if the provided path is not a valid hardened path.\n */\n static fromDerivationPath(path: string, mnemonics: string): Ed25519PrivateKey {\n if (!isValidHardenedPath(path)) {\n throw new Error(`Invalid derivation path ${path}`);\n }\n return Ed25519PrivateKey.fromDerivationPathInner(path, mnemonicToSeed(mnemonics));\n }\n\n /**\n * Derives a child private key from a given BIP44 path and seed.\n * A private inner function so we can separate from the main fromDerivationPath() method\n * to add tests to verify we create the keys correctly.\n *\n * @param path - The BIP44 path used for key derivation.\n * @param seed - The seed phrase created by the mnemonics, represented as a Uint8Array.\n * @param offset - The offset used for key derivation, defaults to HARDENED_OFFSET.\n * @returns An instance of Ed25519PrivateKey derived from the specified path and seed.\n */\n private static fromDerivationPathInner(path: string, seed: Uint8Array, offset = HARDENED_OFFSET): Ed25519PrivateKey {\n const { key, chainCode } = deriveKey(Ed25519PrivateKey.SLIP_0010_SEED, seed);\n\n const segments = splitPath(path).map((el) => parseInt(el, 10));\n\n // Derive the child key based on the path\n const { key: privateKey } = segments.reduce((parentKeys, segment) => CKDPriv(parentKeys, segment + offset), {\n key,\n chainCode,\n });\n return new Ed25519PrivateKey(privateKey, false);\n }\n\n // endregion\n\n // region PrivateKey\n\n /**\n * Derive the Ed25519PublicKey for this private key.\n *\n * @returns Ed25519PublicKey - The derived public key corresponding to the private key.\n */\n publicKey(): Ed25519PublicKey {\n const bytes = ed25519.getPublicKey(this.signingKey.toUint8Array());\n return new Ed25519PublicKey(bytes);\n }\n\n /**\n * Sign the given message with the private key.\n * This function generates a digital signature for the specified message, ensuring its authenticity and integrity.\n *\n * @param message - A message as a string or Uint8Array in HexInput format.\n * @returns A digital signature for the provided message.\n */\n sign(message: HexInput): Ed25519Signature {\n const messageToSign = convertSigningMessage(message);\n const messageBytes = Hex.fromHexInput(messageToSign).toUint8Array();\n const signatureBytes = ed25519.sign(messageBytes, this.signingKey.toUint8Array());\n return new Ed25519Signature(signatureBytes);\n }\n\n /**\n * Get the private key in bytes (Uint8Array).\n *\n * @returns Uint8Array representation of the private key\n */\n toUint8Array(): Uint8Array {\n return this.signingKey.toUint8Array();\n }\n\n /**\n * Get the private key as a hex string with the 0x prefix.\n *\n * @returns string representation of the private key.\n */\n toString(): string {\n return this.toHexString();\n }\n\n /**\n * Get the private key as a hex string with the 0x prefix.\n *\n * @returns string representation of the private key.\n */\n toHexString(): string {\n return this.signingKey.toString();\n }\n\n /**\n * Get the private key as a AIP-80 compliant hex string.\n *\n * [Read about AIP-80](https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-80.md)\n *\n * @returns AIP-80 compliant string representation of the private key.\n */\n toAIP80String(): string {\n return PrivateKey.formatPrivateKey(this.signingKey.toString(), PrivateKeyVariants.Ed25519);\n }\n\n // endregion\n\n // region Serializable\n\n serialize(serializer: Serializer): void {\n serializer.serializeBytes(this.toUint8Array());\n }\n\n static deserialize(deserializer: Deserializer): Ed25519PrivateKey {\n const bytes = deserializer.deserializeBytes();\n return new Ed25519PrivateKey(bytes, false);\n }\n\n // endregion\n\n /**\n * Determines if the provided private key is an instance of Ed25519PrivateKey.\n *\n * @param privateKey - The private key to check.\n * @returns A boolean indicating whether the private key is an Ed25519PrivateKey.\n *\n * @deprecated Use `instanceof Ed25519PrivateKey` instead.\n */\n static isPrivateKey(privateKey: PrivateKey): privateKey is Ed25519PrivateKey {\n return privateKey instanceof Ed25519PrivateKey;\n }\n}\n\n/**\n * Represents a signature of a message signed using an Ed25519 private key.\n */\nexport class Ed25519Signature extends Signature {\n /**\n * Length of an Ed25519 signature, which is 64 bytes.\n *\n * @readonly\n */\n static readonly LENGTH = 64;\n\n /**\n * The signature bytes\n * @private\n */\n private readonly data: Hex;\n\n // region Constructors\n\n constructor(hexInput: HexInput) {\n super();\n const data = Hex.fromHexInput(hexInput);\n if (data.toUint8Array().length !== Ed25519Signature.LENGTH) {\n throw new Error(`Signature length should be ${Ed25519Signature.LENGTH}`);\n }\n this.data = data;\n }\n\n // endregion\n\n // region Signature\n\n toUint8Array(): Uint8Array {\n return this.data.toUint8Array();\n }\n\n // endregion\n\n // region Serializable\n\n serialize(serializer: Serializer): void {\n serializer.serializeBytes(this.data.toUint8Array());\n }\n\n static deserialize(deserializer: Deserializer): Ed25519Signature {\n const bytes = deserializer.deserializeBytes();\n return new Ed25519Signature(bytes);\n }\n\n // endregion\n}\n"],"mappings":"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","names":["ed25519","L","isCanonicalEd25519Signature","signature","s","i","_Ed25519PublicKey","AccountPublicKey","hexInput","hex","Hex","args","message","messageToVerify","convertSigningMessage","messageBytes","signatureBytes","publicKeyBytes","ed25519","AuthenticationKey","serializer","deserializer","bytes","publicKey","Ed25519PublicKey","_Ed25519PrivateKey","Serializable","strict","privateKeyHex","PrivateKey","keyPair","path","mnemonics","isValidHardenedPath","mnemonicToSeed","seed","offset","HARDENED_OFFSET","key","chainCode","deriveKey","segments","splitPath","el","privateKey","parentKeys","segment","CKDPriv","messageToSign","Ed25519Signature","Ed25519PrivateKey","_Ed25519Signature","Signature","data"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/memoize.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * The global cache Map shared across all functions. Must keep care to ensure that the\n * cache keys are unique across all functions.\n */\nconst cache = new Map<string, { value: any; timestamp: number }>();\n\n/**\n * A memoize higher-order function to cache the response of an async function.\n * This function helps to improve performance by avoiding repeated calls to the same async function with the same arguments\n * within a specified time-to-live (TTL).\n *\n * @param func The async function to cache the result of.\n * @param key The cache key used to store the result.\n * @param ttlMs The time-to-live in milliseconds for cached data.\n * @returns The cached or latest result.\n */\nexport function memoizeAsync<T>(\n func: (...args: any[]) => Promise<T>,\n key: string,\n ttlMs?: number,\n): (...args: any[]) => Promise<T> {\n return async (...args: any[]) => {\n // Check if the cached result exists and is within TTL\n if (cache.has(key)) {\n const { value, timestamp } = cache.get(key)!;\n if (ttlMs === undefined || Date.now() - timestamp <= ttlMs) {\n return value;\n }\n }\n\n // If not cached or TTL expired, compute the result\n const result = await func(...args);\n\n // Cache the result with a timestamp\n cache.set(key, { value: result, timestamp: Date.now() });\n\n return result;\n };\n}\n\n/**\n * Caches the result of a function call to improve performance on subsequent calls with the same arguments.\n *\n * @param key - The key to cache on, all accesses by this key will return the cached value.\n * @param func - The function whose result will be cached.\n * @param ttlMs - The time-to-live in milliseconds for cached data.\n * @returns A memoized version of the provided function that returns the cached result if available and within TTL.\n */\nexport function memoize<T>(func: (...args: any[]) => T, key: string, ttlMs?: number): (...args: any[]) => T {\n return (...args: any[]) => {\n // Check if the cached result exists and is within TTL\n if (cache.has(key)) {\n const { value, timestamp } = cache.get(key)!;\n if (ttlMs === undefined || Date.now() - timestamp <= ttlMs) {\n return value;\n }\n }\n\n // If not cached or TTL expired, compute the result\n const result = func(...args);\n\n // Cache the result with a timestamp\n cache.set(key, { value: result, timestamp: Date.now() });\n\n return result;\n };\n}\n"],"mappings":"AAOA,IAAMA,EAAQ,IAAI,IAYX,SAASC,EACdC,EACAC,EACAC,EACgC,CAChC,MAAO,UAAUC,IAAgB,CAE/B,GAAIL,EAAM,IAAIG,CAAG,EAAG,CAClB,GAAM,CAAE,MAAAG,EAAO,UAAAC,CAAU,EAAIP,EAAM,IAAIG,CAAG,EAC1C,GAAIC,IAAU,QAAa,KAAK,IAAI,EAAIG,GAAaH,EACnD,OAAOE,CAEX,CAGA,IAAME,EAAS,MAAMN,EAAK,GAAGG,CAAI,EAGjC,OAAAL,EAAM,IAAIG,EAAK,CAAE,MAAOK,EAAQ,UAAW,KAAK,IAAI,CAAE,CAAC,EAEhDA,CACT,CACF,CAUO,SAASC,EAAWP,EAA6BC,EAAaC,EAAuC,CAC1G,MAAO,IAAIC,IAAgB,CAEzB,GAAIL,EAAM,IAAIG,CAAG,EAAG,CAClB,GAAM,CAAE,MAAAG,EAAO,UAAAC,CAAU,EAAIP,EAAM,IAAIG,CAAG,EAC1C,GAAIC,IAAU,QAAa,KAAK,IAAI,EAAIG,GAAaH,EACnD,OAAOE,CAEX,CAGA,IAAME,EAASN,EAAK,GAAGG,CAAI,EAG3B,OAAAL,EAAM,IAAIG,EAAK,CAAE,MAAOK,EAAQ,UAAW,KAAK,IAAI,CAAE,CAAC,EAEhDA,CACT,CACF","names":["cache","memoizeAsync","func","key","ttlMs","args","value","timestamp","result","memoize"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/transactions/authenticator/account.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/* eslint-disable @typescript-eslint/naming-convention */\n\nimport { Serializer, Deserializer, Serializable } from \"../../bcs\";\nimport { AnyPublicKey, AnySignature } from \"../../core/crypto\";\nimport { Ed25519PublicKey, Ed25519Signature } from \"../../core/crypto/ed25519\";\nimport { MultiEd25519PublicKey, MultiEd25519Signature } from \"../../core/crypto/multiEd25519\";\nimport { MultiKey, MultiKeySignature } from \"../../core/crypto/multiKey\";\nimport { AccountAuthenticatorVariant } from \"../../types\";\n\n/**\n * Represents an account authenticator that can handle multiple authentication variants.\n * This class serves as a base for different types of account authenticators, allowing for serialization\n * and deserialization of various authenticator types.\n *\n * @extends Serializable\n */\nexport abstract class AccountAuthenticator extends Serializable {\n abstract serialize(serializer: Serializer): void;\n\n /**\n * Deserializes an AccountAuthenticator from the provided deserializer.\n * This function helps in reconstructing the AccountAuthenticator object based on the variant index.\n *\n * @param deserializer - The deserializer instance used to read the serialized data.\n */\n static deserialize(deserializer: Deserializer): AccountAuthenticator {\n const index = deserializer.deserializeUleb128AsU32();\n switch (index) {\n case AccountAuthenticatorVariant.Ed25519:\n return AccountAuthenticatorEd25519.load(deserializer);\n case AccountAuthenticatorVariant.MultiEd25519:\n return AccountAuthenticatorMultiEd25519.load(deserializer);\n case AccountAuthenticatorVariant.SingleKey:\n return AccountAuthenticatorSingleKey.load(deserializer);\n case AccountAuthenticatorVariant.MultiKey:\n return AccountAuthenticatorMultiKey.load(deserializer);\n case AccountAuthenticatorVariant.NoAccountAuthenticator:\n return AccountAuthenticatorNoAccountAuthenticator.load(deserializer);\n default:\n throw new Error(`Unknown variant index for AccountAuthenticator: ${index}`);\n }\n }\n\n /**\n * Determines if the current instance is an Ed25519 account authenticator.\n *\n * @returns {boolean} True if the instance is of type AccountAuthenticatorEd25519, otherwise false.\n */\n isEd25519(): this is AccountAuthenticatorEd25519 {\n return this instanceof AccountAuthenticatorEd25519;\n }\n\n /**\n * Determines if the current instance is of type AccountAuthenticatorMultiEd25519.\n *\n * @returns {boolean} True if the instance is a multi-signature Ed25519 account authenticator, otherwise false.\n */\n isMultiEd25519(): this is AccountAuthenticatorMultiEd25519 {\n return this instanceof AccountAuthenticatorMultiEd25519;\n }\n\n /**\n * Determines if the current instance is of the type AccountAuthenticatorSingleKey.\n *\n * @returns {boolean} True if the instance is an AccountAuthenticatorSingleKey, otherwise false.\n */\n isSingleKey(): this is AccountAuthenticatorSingleKey {\n return this instanceof AccountAuthenticatorSingleKey;\n }\n\n /**\n * Determine if the current instance is of type AccountAuthenticatorMultiKey.\n *\n * @returns {boolean} Returns true if the instance is an AccountAuthenticatorMultiKey, otherwise false.\n */\n isMultiKey(): this is AccountAuthenticatorMultiKey {\n return this instanceof AccountAuthenticatorMultiKey;\n }\n}\n\n/**\n * Represents an Ed25519 transaction authenticator for multi-signer transactions.\n * This class encapsulates the account's Ed25519 public key and signature.\n *\n * @param public_key - The Ed25519 public key associated with the account.\n * @param signature - The Ed25519 signature for the account.\n */\nexport class AccountAuthenticatorEd25519 extends AccountAuthenticator {\n public readonly public_key: Ed25519PublicKey;\n\n public readonly signature: Ed25519Signature;\n\n /**\n * Creates an instance of the class with the specified public keys and signatures.\n *\n * @param public_key The public key used for verification.\n * @param signature The signatures corresponding to the public keys.\n */\n constructor(public_key: Ed25519PublicKey, signature: Ed25519Signature) {\n super();\n this.public_key = public_key;\n this.signature = signature;\n }\n\n /**\n * Serializes the account authenticator data into the provided serializer.\n * This function captures the multi-key variant, public keys, and signatures for serialization.\n *\n * @param serializer - The serializer instance used to perform the serialization.\n */\n serialize(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(AccountAuthenticatorVariant.Ed25519);\n this.public_key.serialize(serializer);\n this.signature.serialize(serializer);\n }\n\n /**\n * Loads an instance of AccountAuthenticatorMultiKey from the provided deserializer.\n * This function helps in reconstructing the authenticator object using the deserialized public keys and signatures.\n *\n * @param deserializer - The deserializer used to extract the necessary data for loading the authenticator.\n */\n static load(deserializer: Deserializer): AccountAuthenticatorEd25519 {\n const public_key = Ed25519PublicKey.deserialize(deserializer);\n const signature = Ed25519Signature.deserialize(deserializer);\n return new AccountAuthenticatorEd25519(public_key, signature);\n }\n}\n\n/**\n * Represents a transaction authenticator for Multi Ed25519, designed for multi-signer transactions.\n *\n * @param public_key - The MultiEd25519 public key of the account.\n * @param signature - The MultiEd25519 signature of the account.\n */\nexport class AccountAuthenticatorMultiEd25519 extends AccountAuthenticator {\n public readonly public_key: MultiEd25519PublicKey;\n\n public readonly signature: MultiEd25519Signature;\n\n constructor(public_key: MultiEd25519PublicKey, signature: MultiEd25519Signature) {\n super();\n this.public_key = public_key;\n this.signature = signature;\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(AccountAuthenticatorVariant.MultiEd25519);\n this.public_key.serialize(serializer);\n this.signature.serialize(serializer);\n }\n\n static load(deserializer: Deserializer): AccountAuthenticatorMultiEd25519 {\n const public_key = MultiEd25519PublicKey.deserialize(deserializer);\n const signature = MultiEd25519Signature.deserialize(deserializer);\n return new AccountAuthenticatorMultiEd25519(public_key, signature);\n }\n}\n\n/**\n * Represents an account authenticator that utilizes a single key for signing.\n * This class is designed to handle authentication using a public key and its corresponding signature.\n *\n * @param public_key - The public key used for authentication.\n * @param signature - The signature associated with the public key.\n */\nexport class AccountAuthenticatorSingleKey extends AccountAuthenticator {\n public readonly public_key: AnyPublicKey;\n\n public readonly signature: AnySignature;\n\n constructor(public_key: AnyPublicKey, signature: AnySignature) {\n super();\n this.public_key = public_key;\n this.signature = signature;\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(AccountAuthenticatorVariant.SingleKey);\n this.public_key.serialize(serializer);\n this.signature.serialize(serializer);\n }\n\n static load(deserializer: Deserializer): AccountAuthenticatorSingleKey {\n const public_key = AnyPublicKey.deserialize(deserializer);\n const signature = AnySignature.deserialize(deserializer);\n return new AccountAuthenticatorSingleKey(public_key, signature);\n }\n}\n\n/**\n * Represents an account authenticator that supports multiple keys and signatures for multi-signature scenarios.\n *\n * @param public_keys - The public keys used for authentication.\n * @param signatures - The signatures corresponding to the public keys.\n */\nexport class AccountAuthenticatorMultiKey extends AccountAuthenticator {\n public readonly public_keys: MultiKey;\n\n public readonly signatures: MultiKeySignature;\n\n constructor(public_keys: MultiKey, signatures: MultiKeySignature) {\n super();\n this.public_keys = public_keys;\n this.signatures = signatures;\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(AccountAuthenticatorVariant.MultiKey);\n this.public_keys.serialize(serializer);\n this.signatures.serialize(serializer);\n }\n\n static load(deserializer: Deserializer): AccountAuthenticatorMultiKey {\n const public_keys = MultiKey.deserialize(deserializer);\n const signatures = MultiKeySignature.deserialize(deserializer);\n return new AccountAuthenticatorMultiKey(public_keys, signatures);\n }\n}\n\n/**\n * AccountAuthenticatorNoAccountAuthenticator for no account authenticator\n * It represents the absence of a public key for transaction simulation.\n * It allows skipping the public/auth key check during the simulation.\n */\nexport class AccountAuthenticatorNoAccountAuthenticator extends AccountAuthenticator {\n // eslint-disable-next-line class-methods-use-this\n serialize(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(AccountAuthenticatorVariant.NoAccountAuthenticator);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static load(deserializer: Deserializer): AccountAuthenticatorNoAccountAuthenticator {\n return new AccountAuthenticatorNoAccountAuthenticator();\n }\n}\n"],"mappings":"yOAmBO,IAAeA,EAAf,cAA4CC,CAAa,CAS9D,OAAO,YAAYC,EAAkD,CACnE,IAAMC,EAAQD,EAAa,wBAAwB,EACnD,OAAQC,EAAO,CACb,OACE,OAAOC,EAA4B,KAAKF,CAAY,EACtD,OACE,OAAOG,EAAiC,KAAKH,CAAY,EAC3D,OACE,OAAOI,EAA8B,KAAKJ,CAAY,EACxD,OACE,OAAOK,EAA6B,KAAKL,CAAY,EACvD,OACE,OAAOM,EAA2C,KAAKN,CAAY,EACrE,QACE,MAAM,IAAI,MAAM,mDAAmDC,CAAK,EAAE,CAC9E,CACF,CAOA,WAAiD,CAC/C,OAAO,gBAAgBC,CACzB,CAOA,gBAA2D,CACzD,OAAO,gBAAgBC,CACzB,CAOA,aAAqD,CACnD,OAAO,gBAAgBC,CACzB,CAOA,YAAmD,CACjD,OAAO,gBAAgBC,CACzB,CACF,EASaH,EAAN,MAAMK,UAAoCT,CAAqB,CAWpE,YAAYU,EAA8BC,EAA6B,CACrE,MAAM,EACN,KAAK,WAAaD,EAClB,KAAK,UAAYC,CACnB,CAQA,UAAUC,EAA8B,CACtCA,EAAW,uBAAyD,EACpE,KAAK,WAAW,UAAUA,CAAU,EACpC,KAAK,UAAU,UAAUA,CAAU,CACrC,CAQA,OAAO,KAAKV,EAAyD,CACnE,IAAMQ,EAAaG,EAAiB,YAAYX,CAAY,EACtDS,EAAYG,EAAiB,YAAYZ,CAAY,EAC3D,OAAO,IAAIO,EAA4BC,EAAYC,CAAS,CAC9D,CACF,EAQaN,EAAN,MAAMU,UAAyCf,CAAqB,CAKzE,YAAYU,EAAmCC,EAAkC,CAC/E,MAAM,EACN,KAAK,WAAaD,EAClB,KAAK,UAAYC,CACnB,CAEA,UAAUC,EAA8B,CACtCA,EAAW,uBAA8D,EACzE,KAAK,WAAW,UAAUA,CAAU,EACpC,KAAK,UAAU,UAAUA,CAAU,CACrC,CAEA,OAAO,KAAKV,EAA8D,CACxE,IAAMQ,EAAaM,EAAsB,YAAYd,CAAY,EAC3DS,EAAYM,EAAsB,YAAYf,CAAY,EAChE,OAAO,IAAIa,EAAiCL,EAAYC,CAAS,CACnE,CACF,EASaL,EAAN,MAAMY,UAAsClB,CAAqB,CAKtE,YAAYU,EAA0BC,EAAyB,CAC7D,MAAM,EACN,KAAK,WAAaD,EAClB,KAAK,UAAYC,CACnB,CAEA,UAAUC,EAA8B,CACtCA,EAAW,uBAA2D,EACtE,KAAK,WAAW,UAAUA,CAAU,EACpC,KAAK,UAAU,UAAUA,CAAU,CACrC,CAEA,OAAO,KAAKV,EAA2D,CACrE,IAAMQ,EAAaS,EAAa,YAAYjB,CAAY,EAClDS,EAAYS,EAAa,YAAYlB,CAAY,EACvD,OAAO,IAAIgB,EAA8BR,EAAYC,CAAS,CAChE,CACF,EAQaJ,EAAN,MAAMc,UAAqCrB,CAAqB,CAKrE,YAAYsB,EAAuBC,EAA+B,CAChE,MAAM,EACN,KAAK,YAAcD,EACnB,KAAK,WAAaC,CACpB,CAEA,UAAUX,EAA8B,CACtCA,EAAW,uBAA0D,EACrE,KAAK,YAAY,UAAUA,CAAU,EACrC,KAAK,WAAW,UAAUA,CAAU,CACtC,CAEA,OAAO,KAAKV,EAA0D,CACpE,IAAMoB,EAAcE,EAAS,YAAYtB,CAAY,EAC/CqB,EAAaE,EAAkB,YAAYvB,CAAY,EAC7D,OAAO,IAAImB,EAA6BC,EAAaC,CAAU,CACjE,CACF,EAOaf,EAAN,MAAMkB,UAAmD1B,CAAqB,CAEnF,UAAUY,EAA8B,CACtCA,EAAW,uBAAwE,CACrF,CAGA,OAAO,KAAKV,EAAwE,CAClF,OAAO,IAAIwB,CACb,CACF","names":["AccountAuthenticator","Serializable","deserializer","index","AccountAuthenticatorEd25519","AccountAuthenticatorMultiEd25519","AccountAuthenticatorSingleKey","AccountAuthenticatorMultiKey","AccountAuthenticatorNoAccountAuthenticator","_AccountAuthenticatorEd25519","public_key","signature","serializer","Ed25519PublicKey","Ed25519Signature","_AccountAuthenticatorMultiEd25519","MultiEd25519PublicKey","MultiEd25519Signature","_AccountAuthenticatorSingleKey","AnyPublicKey","AnySignature","_AccountAuthenticatorMultiKey","public_keys","signatures","MultiKey","MultiKeySignature","_AccountAuthenticatorNoAccountAuthenticator"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/api/table.ts"],"sourcesContent":["import { getTableItem, getTableItemsData, getTableItemsMetadata } from \"../internal/table\";\nimport {\n TableItemRequest,\n LedgerVersionArg,\n AnyNumber,\n PaginationArgs,\n WhereArg,\n OrderByArg,\n GetTableItemsDataResponse,\n GetTableItemsMetadataResponse,\n} from \"../types\";\nimport { TableItemsBoolExp, TableMetadatasBoolExp } from \"../types/generated/types\";\nimport { ProcessorType } from \"../utils\";\nimport { AptosConfig } from \"./aptosConfig\";\nimport { waitForIndexerOnVersion } from \"./utils\";\n\n/**\n * A class to query all `Table` Aptos related queries.\n */\nexport class Table {\n readonly config: AptosConfig;\n\n /**\n * Initializes a new instance of the Aptos client with the specified configuration.\n * This allows you to interact with the Aptos blockchain using the provided settings.\n *\n * @param config - The configuration settings for the Aptos client.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * async function runExample() {\n * // Create a new Aptos client with testnet configuration\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * console.log(\"Aptos client initialized:\", aptos);\n * }\n * runExample().catch(console.error);\n * ```\n */\n constructor(config: AptosConfig) {\n this.config = config;\n }\n\n /**\n * Queries for a specific item in a table identified by the handle and the key for the item.\n * This function allows you to retrieve structured data from a table in the Aptos blockchain.\n *\n * @param args.handle A pointer to where that table is stored.\n * @param args.data Object that describes the table item, including key and value types.\n * @param args.data.key_type The Move type of the table key.\n * @param args.data.value_type The Move type of the table value.\n * @param args.data.key The value of the table key.\n * @param args.options.ledgerVersion The ledger version to query; if not provided, it will get the latest version.\n *\n * @returns Table item value rendered in JSON.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Retrieve a table item from the Aptos blockchain\n * const tableItem = await aptos.getTableItem({\n * handle: \"0x1b854694ae746cdbd8d44186ca4929b2b337df21d1c74633be19b2710552fdca\",\n * data: {\n * key_type: \"address\", // Move type of table key\n * value_type: \"u128\", // Move type of table value\n * key: \"0x619dc29a0aac8fa146714058e8dd6d2d0f3bdf5f6331907bf91f3acd81e6935\" // Value of table key\n * },\n * });\n *\n * console.log(tableItem);\n * }\n * runExample().catch(console.error);\n * ```\n */\n async getTableItem<T>(args: { handle: string; data: TableItemRequest; options?: LedgerVersionArg }): Promise<T> {\n return getTableItem<T>({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries for table items data with optional filtering and pagination.\n * This function allows you to retrieve specific data from a table based on provided criteria.\n *\n * @param args - The arguments for querying table items data.\n * @param args.minimumLedgerVersion - Optional minimum ledger version to wait for before querying.\n * @param args.options - Optional parameters for pagination and filtering.\n * @param args.options.where - Conditions to filter the response.\n * @param args.options.offset - The number of items to skip before starting to collect the result set.\n * @param args.options.limit - The maximum number of items to return.\n * @param args.options.orderBy - The criteria to order the results.\n *\n * Note: This query calls the indexer server.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Retrieve table items data with specific filtering options\n * const data = await aptos.getTableItemsData({\n * minimumLedgerVersion: 1, // specify your own minimum ledger version if needed\n * options: {\n * where: {\n * table_handle: { _eq: \"0x1b854694ae746cdbd8d44186ca4929b2b337df21d1c74633be19b2710552fdca\" },\n * transaction_version: { _eq: \"0\" }\n * },\n * limit: 10, // specify your own limit if needed\n * },\n * });\n *\n * console.log(data);\n * }\n * runExample().catch(console.error);\n * ```\n *\n * @returns GetTableItemsDataResponse\n */\n async getTableItemsData(args: {\n minimumLedgerVersion?: AnyNumber;\n options?: PaginationArgs & WhereArg<TableItemsBoolExp> & OrderByArg<GetTableItemsDataResponse[0]>;\n }): Promise<GetTableItemsDataResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.DEFAULT,\n });\n return getTableItemsData({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries for the metadata of table items, allowing for filtering and pagination.\n *\n * @param args - The parameters for the query.\n * @param args.minimumLedgerVersion - Optional minimum ledger version to wait for before querying.\n * @param args.options - Optional parameters for pagination and filtering.\n * @param args.options.where - Conditions to filter the response.\n * @param args.options.offset - The offset for pagination.\n * @param args.options.limit - The maximum number of items to return.\n * @param args.options.orderBy - The order in which to return the items.\n *\n * Note that this query calls the indexer server.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Fetching table items metadata with a filter condition\n * const data = await aptos.getTableItemsMetadata({\n * minimumLedgerVersion: 1, // specify your own minimum ledger version if needed\n * options: {\n * where: { handle: { _eq: \"0x1b854694ae746cdbd8d44186ca4929b2b337df21d1c74633be19b2710552fdca\" } },\n * limit: 10, // specify your own limit if needed\n * },\n * });\n *\n * console.log(data);\n * }\n * runExample().catch(console.error);\n * ```\n *\n * @returns GetTableItemsMetadataResponse\n */\n async getTableItemsMetadata(args: {\n minimumLedgerVersion?: AnyNumber;\n options?: PaginationArgs & WhereArg<TableMetadatasBoolExp> & OrderByArg<GetTableItemsMetadataResponse[0]>;\n }): Promise<GetTableItemsMetadataResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.DEFAULT,\n });\n return getTableItemsMetadata({ aptosConfig: this.config, ...args });\n }\n}\n"],"mappings":"gGAmBO,IAAMA,EAAN,KAAY,CAuBjB,YAAYC,EAAqB,CAC/B,KAAK,OAASA,CAChB,CAsCA,MAAM,aAAgBC,EAA0F,CAC9G,OAAOC,EAAgB,CAAE,YAAa,KAAK,OAAQ,GAAGD,CAAK,CAAC,CAC9D,CA2CA,MAAM,kBAAkBA,EAGe,CACrC,aAAME,EAAwB,CAC5B,OAAQ,KAAK,OACb,qBAAsBF,EAAK,qBAC3B,iCACF,CAAC,EACMG,EAAkB,CAAE,YAAa,KAAK,OAAQ,GAAGH,CAAK,CAAC,CAChE,CAuCA,MAAM,sBAAsBA,EAGe,CACzC,aAAME,EAAwB,CAC5B,OAAQ,KAAK,OACb,qBAAsBF,EAAK,qBAC3B,iCACF,CAAC,EACMI,EAAsB,CAAE,YAAa,KAAK,OAAQ,GAAGJ,CAAK,CAAC,CACpE,CACF","names":["Table","config","args","getTableItem","waitForIndexerOnVersion","getTableItemsData","getTableItemsMetadata"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/api/transactionSubmission/build.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { AccountAddressInput } from \"../../core\";\nimport { generateTransaction } from \"../../internal/transactionSubmission\";\nimport { InputGenerateTransactionPayloadData, InputGenerateTransactionOptions } from \"../../transactions\";\nimport { MultiAgentTransaction } from \"../../transactions/instances/multiAgentTransaction\";\nimport { SimpleTransaction } from \"../../transactions/instances/simpleTransaction\";\nimport { AptosConfig } from \"../aptosConfig\";\n\n/**\n * A class to handle all `Build` transaction operations.\n */\nexport class Build {\n readonly config: AptosConfig;\n\n /**\n * Initializes a new instance of the Aptos client with the specified configuration.\n * This allows you to interact with the Aptos blockchain using the provided settings.\n *\n * @param config - The configuration settings for the Aptos client.\n * @param config.network - The network to connect to (e.g., TESTNET, MAINNET).\n * @param config.nodeUrl - The URL of the Aptos node to connect to.\n * @param config.account - The account details for authentication.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * async function runExample() {\n * // Create a configuration for the Aptos client\n * const config = new AptosConfig({\n * network: Network.TESTNET, // specify the network\n * nodeUrl: \"https://testnet.aptos.dev\", // specify the node URL\n * });\n *\n * // Initialize the Aptos client\n * const aptos = new Aptos(config);\n *\n * console.log(\"Aptos client initialized:\", aptos);\n * }\n * runExample().catch(console.error);\n * ```\n */\n constructor(config: AptosConfig) {\n this.config = config;\n }\n\n /**\n * Build a simple transaction.\n *\n * This function allows you to create a transaction with specified sender and data.\n *\n * @param args.sender - The sender account address.\n * @param args.data - The transaction data.\n * @param args.options - Optional transaction configurations.\n * @param args.withFeePayer - Whether there is a fee payer for the transaction.\n *\n * @returns SimpleTransaction\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Build a simple transaction\n * const transaction = await aptos.transaction.simple({\n * sender: \"0x1\", // replace with a real sender account address\n * data: {\n * function: \"0x1::aptos_account::transfer\",\n * functionArguments: [\"0x2\", 100], // replace with a real destination account address\n * },\n * options: {\n * gasUnitPrice: 100, // specify your own gas unit price if needed\n * maxGasAmount: 1000, // specify your own max gas amount if needed\n * },\n * });\n *\n * console.log(transaction);\n * }\n * runExample().catch(console.error);\n * ```\n */\n async simple(args: {\n sender: AccountAddressInput;\n data: InputGenerateTransactionPayloadData;\n options?: InputGenerateTransactionOptions;\n withFeePayer?: boolean;\n }): Promise<SimpleTransaction> {\n return generateTransaction({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Build a multi-agent transaction that allows multiple signers to authorize a transaction.\n *\n * @param args - The parameters for creating the multi-agent transaction.\n * @param args.sender - The sender account address.\n * @param args.data - The transaction data.\n * @param args.secondarySignerAddresses - An array of the secondary signers' account addresses.\n * @param args.options - Optional transaction configurations.\n * @param args.withFeePayer - Whether there is a fee payer for the transaction.\n *\n * @returns MultiAgentTransaction\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Build a multi-agent transaction\n * const transaction = await aptos.multiAgent({\n * sender: \"0x1\", // replace with a real sender account address\n * data: {\n * // Transaction data structure\n * function: \"0x1::aptos_account::transfer\",\n * functionArguments: [\"0x2\", 100], // replace with a real destination account address and amount\n * },\n * secondarySignerAddresses: [\"0x3\", \"0x4\"], // replace with real secondary signer addresses\n * options: {\n * // Optional transaction configurations\n * maxGasAmount: \"1000\",\n * gasUnitPrice: \"1\",\n * },\n * });\n *\n * console.log(transaction);\n * }\n * runExample().catch(console.error);\n * ```\n */\n async multiAgent(args: {\n sender: AccountAddressInput;\n data: InputGenerateTransactionPayloadData;\n secondarySignerAddresses: AccountAddressInput[];\n options?: InputGenerateTransactionOptions;\n withFeePayer?: boolean;\n }): Promise<MultiAgentTransaction> {\n return generateTransaction({ aptosConfig: this.config, ...args });\n }\n}\n"],"mappings":"yCAaO,IAAMA,EAAN,KAAY,CA+BjB,YAAYC,EAAqB,CAC/B,KAAK,OAASA,CAChB,CAwCA,MAAM,OAAOC,EAKkB,CAC7B,OAAOC,EAAoB,CAAE,YAAa,KAAK,OAAQ,GAAGD,CAAK,CAAC,CAClE,CA2CA,MAAM,WAAWA,EAMkB,CACjC,OAAOC,EAAoB,CAAE,YAAa,KAAK,OAAQ,GAAGD,CAAK,CAAC,CAClE,CACF","names":["Build","config","args","generateTransaction"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/api/transactionSubmission/helpers.ts"],"sourcesContent":["/**\n * Validates the fee payer data when submitting a transaction to ensure that the fee payer authenticator is provided if a fee\n * payer address is specified.\n * This helps prevent errors in transaction submission related to fee payer authentication.\n *\n * @param target - The target object where the method is defined.\n * @param propertyKey - The name of the method being decorated.\n * @param descriptor - The property descriptor for the method.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * class TransactionHandler {\n * @ValidateFeePayerDataOnSubmission\n * async submitTransaction(methodArgs: { transaction: { feePayerAddress: string }, feePayerAuthenticator?: string }) {\n * // Logic to submit the transaction\n * }\n * }\n *\n * async function runExample() {\n * const handler = new TransactionHandler();\n *\n * // Attempt to submit a transaction without a fee payer authenticator\n * try {\n * await handler.submitTransaction({\n * transaction: { feePayerAddress: \"0x1\" }, // replace with a real fee payer address\n * });\n * } catch (error) {\n * console.error(error.message); // Should log the error message\n * }\n *\n * // Submit a transaction with a fee payer authenticator\n * await handler.submitTransaction({\n * transaction: { feePayerAddress: \"0x1\" }, // replace with a real fee payer address\n * feePayerAuthenticator: \"authenticatorValue\", // replace with a real authenticator\n * });\n *\n * console.log(\"Transaction submitted successfully.\");\n * }\n * runExample().catch(console.error);\n * ```\n */\nexport function ValidateFeePayerDataOnSubmission(target: unknown, propertyKey: string, descriptor: PropertyDescriptor) {\n const originalMethod = descriptor.value;\n /* eslint-disable-next-line func-names, no-param-reassign */\n descriptor.value = async function (...args: any[]) {\n const [methodArgs] = args;\n\n if (methodArgs.transaction.feePayerAddress && !methodArgs.feePayerAuthenticator) {\n throw new Error(\"You are submitting a Fee Payer transaction but missing the feePayerAuthenticator\");\n }\n\n return originalMethod.apply(this, args);\n };\n\n return descriptor;\n}\n\n/**\n * Validates that the fee payer public key is provided when simulating a Fee Payer transaction.\n * This ensures that all necessary data is present for the simulation to proceed correctly.\n *\n * @param target - The target object where the method is defined.\n * @param propertyKey - The name of the method being decorated.\n * @param descriptor - The property descriptor for the method.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * const methodArgs = {\n * transaction: {\n * feePayerAddress: \"0x1\", // replace with a real fee payer address\n * },\n * feePayerPublicKey: undefined, // missing fee payer public key\n * };\n *\n * try {\n * // This will throw an error due to missing feePayerPublicKey\n * await aptos.someMethod(methodArgs);\n * } catch (error) {\n * console.error(error.message); // Output the error message\n * }\n * }\n * runExample().catch(console.error);\n * ```\n */\nexport function ValidateFeePayerDataOnSimulation(target: unknown, propertyKey: string, descriptor: PropertyDescriptor) {\n const originalMethod = descriptor.value;\n /* eslint-disable-next-line func-names, no-param-reassign */\n descriptor.value = async function (...args: any[]) {\n return originalMethod.apply(this, args);\n };\n\n return descriptor;\n}\n"],"mappings":"AA8CO,SAASA,EAAiCC,EAAiBC,EAAqBC,EAAgC,CACrH,IAAMC,EAAiBD,EAAW,MAElC,OAAAA,EAAW,MAAQ,kBAAmBE,EAAa,CACjD,GAAM,CAACC,CAAU,EAAID,EAErB,GAAIC,EAAW,YAAY,iBAAmB,CAACA,EAAW,sBACxD,MAAM,IAAI,MAAM,kFAAkF,EAGpG,OAAOF,EAAe,MAAM,KAAMC,CAAI,CACxC,EAEOF,CACT,CAmCO,SAASI,EAAiCN,EAAiBC,EAAqBC,EAAgC,CACrH,IAAMC,EAAiBD,EAAW,MAElC,OAAAA,EAAW,MAAQ,kBAAmBE,EAAa,CACjD,OAAOD,EAAe,MAAM,KAAMC,CAAI,CACxC,EAEOF,CACT","names":["ValidateFeePayerDataOnSubmission","target","propertyKey","descriptor","originalMethod","args","methodArgs","ValidateFeePayerDataOnSimulation"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/transactions/authenticator/transaction.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/* eslint-disable @typescript-eslint/naming-convention */\n\nimport { AccountAuthenticator } from \"./account\";\nimport { Deserializer, Serializable, Serializer } from \"../../bcs\";\nimport { AccountAddress } from \"../../core\";\nimport { Ed25519PublicKey, Ed25519Signature } from \"../../core/crypto/ed25519\";\nimport { MultiEd25519PublicKey, MultiEd25519Signature } from \"../../core/crypto/multiEd25519\";\nimport { TransactionAuthenticatorVariant } from \"../../types\";\n\n/**\n * Represents an abstract base class for transaction authenticators.\n * This class provides methods for serializing and deserializing different types of transaction authenticators.\n *\n * @extends Serializable\n */\nexport abstract class TransactionAuthenticator extends Serializable {\n abstract serialize(serializer: Serializer): void;\n\n /**\n * Deserializes a TransactionAuthenticator from the provided deserializer.\n * This function helps in reconstructing the TransactionAuthenticator based on the variant index found in the serialized data.\n *\n * @param deserializer - The deserializer instance used to read the serialized data.\n */\n static deserialize(deserializer: Deserializer): TransactionAuthenticator {\n const index = deserializer.deserializeUleb128AsU32();\n switch (index) {\n case TransactionAuthenticatorVariant.Ed25519:\n return TransactionAuthenticatorEd25519.load(deserializer);\n case TransactionAuthenticatorVariant.MultiEd25519:\n return TransactionAuthenticatorMultiEd25519.load(deserializer);\n case TransactionAuthenticatorVariant.MultiAgent:\n return TransactionAuthenticatorMultiAgent.load(deserializer);\n case TransactionAuthenticatorVariant.FeePayer:\n return TransactionAuthenticatorFeePayer.load(deserializer);\n case TransactionAuthenticatorVariant.SingleSender:\n return TransactionAuthenticatorSingleSender.load(deserializer);\n default:\n throw new Error(`Unknown variant index for TransactionAuthenticator: ${index}`);\n }\n }\n\n isEd25519(): this is TransactionAuthenticatorEd25519 {\n return this instanceof TransactionAuthenticatorEd25519;\n }\n\n isMultiEd25519(): this is TransactionAuthenticatorMultiEd25519 {\n return this instanceof TransactionAuthenticatorMultiEd25519;\n }\n\n isMultiAgent(): this is TransactionAuthenticatorMultiAgent {\n return this instanceof TransactionAuthenticatorMultiAgent;\n }\n\n isFeePayer(): this is TransactionAuthenticatorFeePayer {\n return this instanceof TransactionAuthenticatorFeePayer;\n }\n\n isSingleSender(): this is TransactionAuthenticatorSingleSender {\n return this instanceof TransactionAuthenticatorSingleSender;\n }\n}\n\n/**\n * Represents a transaction authenticator using Ed25519 for a single signer transaction.\n * This class encapsulates the client's public key and the Ed25519 signature of a raw transaction.\n *\n * @param public_key - The client's public key.\n * @param signature - The Ed25519 signature of a raw transaction.\n * @see {@link https://aptos.dev/integration/creating-a-signed-transaction | Creating a Signed Transaction}\n * for details about generating a signature.\n */\nexport class TransactionAuthenticatorEd25519 extends TransactionAuthenticator {\n public readonly public_key: Ed25519PublicKey;\n\n public readonly signature: Ed25519Signature;\n\n /**\n * Creates an instance of the class with the specified account authenticator.\n *\n * @param public_key - The Ed25519PublicKey that will be used for authentication.\n * @param signature - The Ed25519Signature that will be used for authentication.\n */\n constructor(public_key: Ed25519PublicKey, signature: Ed25519Signature) {\n super();\n this.public_key = public_key;\n this.signature = signature;\n }\n\n /**\n * Serializes the transaction authenticator by encoding the sender information.\n *\n * @param serializer - The serializer instance used to perform the serialization.\n */\n serialize(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(TransactionAuthenticatorVariant.Ed25519);\n this.public_key.serialize(serializer);\n this.signature.serialize(serializer);\n }\n\n /**\n * Loads a TransactionAuthenticatorSingleSender instance from the provided deserializer.\n * This function helps in deserializing the sender information to create a transaction authenticator.\n *\n * @param deserializer - The deserializer used to extract the sender data.\n */\n static load(deserializer: Deserializer): TransactionAuthenticatorEd25519 {\n const public_key = Ed25519PublicKey.deserialize(deserializer);\n const signature = Ed25519Signature.deserialize(deserializer);\n return new TransactionAuthenticatorEd25519(public_key, signature);\n }\n}\n\n/**\n * Represents a transaction authenticator for multi-signature transactions using Ed25519.\n * This class is used to validate transactions that require multiple signatures from different signers.\n *\n * @param public_key - The public key of the client involved in the transaction.\n * @param signature - The multi-signature of the raw transaction.\n */\nexport class TransactionAuthenticatorMultiEd25519 extends TransactionAuthenticator {\n public readonly public_key: MultiEd25519PublicKey;\n\n public readonly signature: MultiEd25519Signature;\n\n constructor(public_key: MultiEd25519PublicKey, signature: MultiEd25519Signature) {\n super();\n this.public_key = public_key;\n this.signature = signature;\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(TransactionAuthenticatorVariant.MultiEd25519);\n this.public_key.serialize(serializer);\n this.signature.serialize(serializer);\n }\n\n static load(deserializer: Deserializer): TransactionAuthenticatorMultiEd25519 {\n const public_key = MultiEd25519PublicKey.deserialize(deserializer);\n const signature = MultiEd25519Signature.deserialize(deserializer);\n return new TransactionAuthenticatorMultiEd25519(public_key, signature);\n }\n}\n\n/**\n * Represents a transaction authenticator for a multi-agent transaction.\n *\n * This class manages the authentication process involving a primary sender and multiple secondary signers.\n *\n * @param sender - The authenticator for the sender account.\n * @param secondary_signer_addresses - An array of addresses for the secondary signers.\n * @param secondary_signers - An array of authenticators for the secondary signer accounts.\n */\nexport class TransactionAuthenticatorMultiAgent extends TransactionAuthenticator {\n public readonly sender: AccountAuthenticator;\n\n public readonly secondary_signer_addresses: Array<AccountAddress>;\n\n public readonly secondary_signers: Array<AccountAuthenticator>;\n\n constructor(\n sender: AccountAuthenticator,\n secondary_signer_addresses: Array<AccountAddress>,\n secondary_signers: Array<AccountAuthenticator>,\n ) {\n super();\n this.sender = sender;\n this.secondary_signer_addresses = secondary_signer_addresses;\n this.secondary_signers = secondary_signers;\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(TransactionAuthenticatorVariant.MultiAgent);\n this.sender.serialize(serializer);\n serializer.serializeVector<AccountAddress>(this.secondary_signer_addresses);\n serializer.serializeVector<AccountAuthenticator>(this.secondary_signers);\n }\n\n static load(deserializer: Deserializer): TransactionAuthenticatorMultiAgent {\n const sender = AccountAuthenticator.deserialize(deserializer);\n const secondary_signer_addresses = deserializer.deserializeVector(AccountAddress);\n const secondary_signers = deserializer.deserializeVector(AccountAuthenticator);\n return new TransactionAuthenticatorMultiAgent(sender, secondary_signer_addresses, secondary_signers);\n }\n}\n\n/**\n * Represents a transaction authenticator specifically for fee payer transactions.\n * It encapsulates the sender's account authenticator, addresses of secondary signers,\n * their respective authenticators, and the fee payer's account information.\n *\n * @param sender - The authenticator for the sender's account.\n * @param secondary_signer_addresses - An array of addresses for secondary signers.\n * @param secondary_signers - An array of authenticators for secondary signers' accounts.\n * @param fee_payer - An object containing the fee payer's account address and authenticator.\n */\nexport class TransactionAuthenticatorFeePayer extends TransactionAuthenticator {\n public readonly sender: AccountAuthenticator;\n\n public readonly secondary_signer_addresses: Array<AccountAddress>;\n\n public readonly secondary_signers: Array<AccountAuthenticator>;\n\n public readonly fee_payer: {\n address: AccountAddress;\n authenticator: AccountAuthenticator;\n };\n\n constructor(\n sender: AccountAuthenticator,\n secondary_signer_addresses: Array<AccountAddress>,\n secondary_signers: Array<AccountAuthenticator>,\n fee_payer: { address: AccountAddress; authenticator: AccountAuthenticator },\n ) {\n super();\n this.sender = sender;\n this.secondary_signer_addresses = secondary_signer_addresses;\n this.secondary_signers = secondary_signers;\n this.fee_payer = fee_payer;\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(TransactionAuthenticatorVariant.FeePayer);\n this.sender.serialize(serializer);\n serializer.serializeVector<AccountAddress>(this.secondary_signer_addresses);\n serializer.serializeVector<AccountAuthenticator>(this.secondary_signers);\n this.fee_payer.address.serialize(serializer);\n this.fee_payer.authenticator.serialize(serializer);\n }\n\n static load(deserializer: Deserializer): TransactionAuthenticatorMultiAgent {\n const sender = AccountAuthenticator.deserialize(deserializer);\n const secondary_signer_addresses = deserializer.deserializeVector(AccountAddress);\n const secondary_signers = deserializer.deserializeVector(AccountAuthenticator);\n const address = AccountAddress.deserialize(deserializer);\n const authenticator = AccountAuthenticator.deserialize(deserializer);\n const fee_payer = { address, authenticator };\n return new TransactionAuthenticatorFeePayer(sender, secondary_signer_addresses, secondary_signers, fee_payer);\n }\n}\n\n/**\n * Represents a single sender authenticator for transactions that require a single signer.\n * This class is responsible for managing the authentication of a transaction initiated by a single sender.\n *\n * @param sender - An instance of AccountAuthenticator that represents the account of the sender.\n */\nexport class TransactionAuthenticatorSingleSender extends TransactionAuthenticator {\n public readonly sender: AccountAuthenticator;\n\n constructor(sender: AccountAuthenticator) {\n super();\n this.sender = sender;\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(TransactionAuthenticatorVariant.SingleSender);\n this.sender.serialize(serializer);\n }\n\n static load(deserializer: Deserializer): TransactionAuthenticatorSingleSender {\n const sender = AccountAuthenticator.deserialize(deserializer);\n return new TransactionAuthenticatorSingleSender(sender);\n }\n}\n"],"mappings":"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","names":["TransactionAuthenticator","Serializable","deserializer","index","TransactionAuthenticatorEd25519","TransactionAuthenticatorMultiEd25519","TransactionAuthenticatorMultiAgent","TransactionAuthenticatorFeePayer","TransactionAuthenticatorSingleSender","_TransactionAuthenticatorEd25519","public_key","signature","serializer","Ed25519PublicKey","Ed25519Signature","_TransactionAuthenticatorMultiEd25519","MultiEd25519PublicKey","MultiEd25519Signature","_TransactionAuthenticatorMultiAgent","sender","secondary_signer_addresses","secondary_signers","AccountAuthenticator","AccountAddress","_TransactionAuthenticatorFeePayer","fee_payer","address","authenticator","_TransactionAuthenticatorSingleSender"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{c as t}from"./chunk-56CNRT2K.mjs";var s=class{constructor(e){this.buffer=new ArrayBuffer(e.length),new Uint8Array(this.buffer).set(e,0),this.offset=0}read(e){if(this.offset+e>this.buffer.byteLength)throw new Error("Reached to the end of buffer");let i=this.buffer.slice(this.offset,this.offset+e);return this.offset+=e,i}remaining(){return this.buffer.byteLength-this.offset}deserializeStr(){let e=this.deserializeBytes();return new TextDecoder().decode(e)}deserializeOptionStr(){return this.deserializeOption("string")}deserializeOption(e,i){if(this.deserializeBool()){if(e==="string")return this.deserializeStr();if(e==="bytes")return this.deserializeBytes();if(e==="fixedBytes"){if(i===void 0)throw new Error("Fixed bytes length not provided");return this.deserializeFixedBytes(i)}return this.deserialize(e)}}deserializeBytes(){let e=this.deserializeUleb128AsU32();return new Uint8Array(this.read(e))}deserializeFixedBytes(e){return new Uint8Array(this.read(e))}deserializeBool(){let e=new Uint8Array(this.read(1))[0];if(e!==1&&e!==0)throw new Error("Invalid boolean value");return e===1}deserializeU8(){return new DataView(this.read(1)).getUint8(0)}deserializeU16(){return new DataView(this.read(2)).getUint16(0,!0)}deserializeU32(){return new DataView(this.read(4)).getUint32(0,!0)}deserializeU64(){let e=this.deserializeU32(),i=this.deserializeU32();return BigInt(BigInt(i)<<BigInt(32)|BigInt(e))}deserializeU128(){let e=this.deserializeU64(),i=this.deserializeU64();return BigInt(i<<BigInt(64)|e)}deserializeU256(){let e=this.deserializeU128(),i=this.deserializeU128();return BigInt(i<<BigInt(128)|e)}deserializeUleb128AsU32(){let e=BigInt(0),i=0;for(;e<t;){let r=this.deserializeU8();if(e|=BigInt(r&127)<<BigInt(i),!(r&128))break;i+=7}if(e>t)throw new Error("Overflow while parsing uleb128-encoded uint32 value");return Number(e)}deserialize(e){return e.deserialize(this)}deserializeVector(e){let i=this.deserializeUleb128AsU32(),r=new Array;for(let n=0;n<i;n+=1)r.push(this.deserialize(e));return r}};export{s as a};
|
|
2
|
-
//# sourceMappingURL=chunk-J3E4UMBB.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
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 *\n * @template T - The type that this will deserialize into.\n */\nexport interface Deserializable<T> {\n /**\n * Deserializes the buffered bytes into an instance of the specified class type.\n * This function provides an alternative syntax for deserialization, allowing users to call\n * `deserializer.deserialize(MyClass)` instead of `MyClass.deserialize(deserializer)`.\n *\n * @param deserializer - The deserializer instance with the buffered bytes.\n * @returns The deserialized value of class type T.\n * @example\n * ```typescript\n * 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 * ```\n */\n deserialize(deserializer: Deserializer): T;\n}\n\n/**\n * A class that provides methods for deserializing various data types from a byte buffer.\n * It supports deserialization of primitive types, strings, and complex objects using a BCS (Binary Common Serialization) layout.\n */\nexport class Deserializer {\n private buffer: ArrayBuffer;\n\n private offset: number;\n\n /**\n * Creates a new instance of the class with a copy of the provided data buffer.\n * This prevents outside mutation of the buffer.\n *\n * @param data - The data to be copied into the internal buffer as a Uint8Array.\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 /**\n * Reads a specified number of bytes from the buffer and advances the offset.\n *\n * @param length - The number of bytes to read from the buffer.\n * @throws Throws an error if the read operation exceeds the buffer's length.\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 * Returns the number of bytes remaining in the buffer.\n *\n * This information is useful to determine if there's more data to be read.\n *\n * @returns The number of bytes remaining in the buffer.\n */\n remaining(): number {\n return this.buffer.byteLength - this.offset;\n }\n\n /**\n * Deserializes a UTF-8 encoded string from a byte array. It first reads the length of the string in bytes,\n * followed by the actual byte content, and decodes it 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 * ```typescript\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 * @deprecated use `deserializeOption(\"string\")` instead.\n *\n * The BCS layout for Optional<String> is 0 if none, else 1 followed by the string length and string content.\n * @returns The deserialized string if it exists, otherwise undefined.\n * @example\n * ```typescript\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 return this.deserializeOption(\"string\");\n }\n\n /**\n * Deserializes an optional value from the buffer.\n *\n * The BCS layout for Optional<T> starts with a boolean byte (0 if none, 1 if some),\n * followed by the value if present.\n *\n * @template T - The type of the value to deserialize\n * @param type - Either a Deserializable class or one of the string literals: \"string\", \"bytes\", or \"fixedBytes\"\n * @param len - Required length when type is \"fixedBytes\", ignored otherwise\n * @returns The deserialized value if present, undefined otherwise\n *\n * @throws {Error} When \"fixedBytes\" is specified without a length\n *\n * @example\n * ```typescript\n * // Deserialize an optional string\n * const deserializer = new Deserializer(new Uint8Array([1, 3, 97, 98, 99]));\n * const optStr = deserializer.deserializeOption(\"string\");\n * // optStr === \"abc\"\n *\n * // Deserialize an optional custom type\n * const deserializer = new Deserializer(new Uint8Array([0]));\n * const optValue = deserializer.deserializeOption(MyClass);\n * // optValue === undefined\n *\n * // Deserialize optional bytes\n * const deserializer = new Deserializer(new Uint8Array([1, 3, 1, 2, 3]));\n * const optBytes = deserializer.deserializeOption(\"bytes\");\n * // optBytes === Uint8Array[1, 2, 3]\n *\n * // Deserialize optional fixed bytes\n * const deserializer = new Deserializer(new Uint8Array([1, 1, 2, 3, 4]));\n * const optBytes = deserializer.deserializeOption(\"fixedBytes\", 4);\n * // optBytes === Uint8Array[1, 2, 3, 4]\n * ```\n */\n deserializeOption(type: \"string\"): string | undefined;\n deserializeOption(type: \"bytes\"): Uint8Array | undefined;\n deserializeOption(type: \"fixedBytes\", len: number): Uint8Array | undefined;\n deserializeOption<T>(type: Deserializable<T>): T | undefined;\n deserializeOption<T>(\n type: Deserializable<T> | \"string\" | \"bytes\" | \"fixedBytes\",\n len?: number,\n ): T | string | Uint8Array | undefined {\n const exists = this.deserializeBool();\n if (!exists) return undefined;\n\n if (type === \"string\") {\n return this.deserializeStr();\n }\n if (type === \"bytes\") {\n return this.deserializeBytes();\n }\n if (type === \"fixedBytes\") {\n if (len === undefined) {\n throw new Error(\"Fixed bytes length not provided\");\n }\n return this.deserializeFixedBytes(len);\n }\n\n return this.deserialize(type);\n }\n\n /**\n * Deserializes an array of bytes.\n *\n * The BCS layout for \"bytes\" consists of a bytes_length followed by the bytes themselves, where bytes_length is a u32 integer\n * encoded as a uleb128 integer, indicating the length of the bytes array.\n *\n * @returns {Uint8Array} The deserialized array of bytes.\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 of a specified length.\n *\n * @param len - The number of bytes to read from the source.\n */\n deserializeFixedBytes(len: number): Uint8Array {\n return new Uint8Array(this.read(len));\n }\n\n /**\n * Deserializes a boolean value from a byte stream.\n *\n * The BCS layout for a boolean uses one byte, where \"0x01\" represents true and \"0x00\" represents false.\n * An error is thrown if the byte value is not valid.\n *\n * @returns The deserialized boolean value.\n * @throws Throws an error if the boolean value is invalid.\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 from the binary data.\n *\n * BCS layout for \"uint8\": One byte. Binary format in little-endian representation.\n *\n * @returns {number} The deserialized uint8 number.\n */\n deserializeU8(): Uint8 {\n return new DataView(this.read(1)).getUint8(0);\n }\n\n /**\n * Deserializes a uint16 number from a binary format in little-endian representation.\n *\n * BCS layout for \"uint16\": Two bytes.\n * @example\n * ```typescript\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 from a binary format in little-endian representation.\n *\n * BCS layout for \"uint32\": Four bytes.\n * @example\n * ```typescript\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 * This function combines two 32-bit values to return a 64-bit unsigned integer in little-endian representation.\n * @example\n * ```typescript\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 from its binary representation.\n * This function combines two 64-bit values to return a single uint128 value in little-endian format.\n *\n * @returns {BigInt} The deserialized uint128 number.\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 from its binary representation.\n *\n * The BCS layout for \"uint256\" consists of thirty-two bytes in little-endian format.\n *\n * @returns {BigInt} The deserialized uint256 number.\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 * This function is used for interpreting lengths of variable-length sequences and tags of enum values in BCS encoding.\n *\n * @throws {Error} Throws an error if the parsed value exceeds the maximum uint32 number.\n * @returns {number} The deserialized uint32 value.\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 instance with a loaded byte buffer.\n *\n * @param cls The BCS-deserializable class to deserialize the buffered bytes into.\n * @returns An array of deserialized values of type T.\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 */\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":["Deserializer","data","length","bytes","value","type","len","bool","low","high","shift","MAX_U32_NUMBER","byte","cls","vector","i"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/const.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * Types of API endpoints used for routing requests in the Aptos network.\n */\nexport enum AptosApiType {\n FULLNODE = \"Fullnode\",\n INDEXER = \"Indexer\",\n FAUCET = \"Faucet\",\n PEPPER = \"Pepper\",\n PROVER = \"Prover\",\n}\n\n/**\n * The default max gas amount when none is given.\n *\n * This is the maximum number of gas units that will be used by a transaction before being rejected.\n *\n * Note that max gas amount varies based on the transaction. A larger transaction will go over this\n * default gas amount, and the value will need to be changed for the specific transaction.\n */\nexport const DEFAULT_MAX_GAS_AMOUNT = 200000;\n\n/**\n * The default transaction expiration seconds from now.\n *\n * This time is how long until the blockchain nodes will reject the transaction.\n *\n * Note that the transaction expiration time varies based on network connection and network load. It may need to be\n * increased for the transaction to be processed.\n */\nexport const DEFAULT_TXN_EXP_SEC_FROM_NOW = 20;\n\n/**\n * The default number of seconds to wait for a transaction to be processed.\n *\n * This time is the amount of time that the SDK will wait for a transaction to be processed when waiting for\n * the results of the transaction. It may take longer based on network connection and network load.\n */\nexport const DEFAULT_TXN_TIMEOUT_SEC = 20;\n\n/**\n * The default gas currency for the network.\n */\nexport const APTOS_COIN = \"0x1::aptos_coin::AptosCoin\";\nexport const APTOS_FA = \"0x000000000000000000000000000000000000000000000000000000000000000a\";\n\nexport const RAW_TRANSACTION_SALT = \"APTOS::RawTransaction\";\nexport const RAW_TRANSACTION_WITH_DATA_SALT = \"APTOS::RawTransactionWithData\";\n\n/**\n * Supported processor types for the indexer API, sourced from the processor_status table in the indexer database.\n * {@link https://cloud.hasura.io/public/graphiql?endpoint=https://api.mainnet.aptoslabs.com/v1/graphql}\n */\nexport enum ProcessorType {\n ACCOUNT_TRANSACTION_PROCESSOR = \"account_transactions_processor\",\n DEFAULT = \"default_processor\",\n EVENTS_PROCESSOR = \"events_processor\",\n // Fungible asset processor also handles coins\n FUNGIBLE_ASSET_PROCESSOR = \"fungible_asset_processor\",\n STAKE_PROCESSOR = \"stake_processor\",\n // Token V2 processor replaces Token processor (not only for digital assets)\n TOKEN_V2_PROCESSOR = \"token_v2_processor\",\n USER_TRANSACTION_PROCESSOR = \"user_transaction_processor\",\n OBJECT_PROCESSOR = \"objects_processor\",\n}\n\n/**\n * Regular expression pattern for Firebase Auth issuer URLs\n * Matches URLs in the format: https://securetoken.google.com/[project-id]\n * where project-id can contain letters, numbers, hyphens, and underscores\n */\nexport const FIREBASE_AUTH_ISS_PATTERN = /^https:\\/\\/securetoken\\.google\\.com\\/[a-zA-Z0-9-_]+$/;\n"],"mappings":"AAMO,IAAKA,OACVA,EAAA,SAAW,WACXA,EAAA,QAAU,UACVA,EAAA,OAAS,SACTA,EAAA,OAAS,SACTA,EAAA,OAAS,SALCA,OAAA,IAgBCC,EAAyB,IAUzBC,EAA+B,GAQ/BC,EAA0B,GAK1BC,EAAa,6BACbC,EAAW,qEAEXC,EAAuB,wBACvBC,EAAiC,gCAMlCC,OACVA,EAAA,8BAAgC,iCAChCA,EAAA,QAAU,oBACVA,EAAA,iBAAmB,mBAEnBA,EAAA,yBAA2B,2BAC3BA,EAAA,gBAAkB,kBAElBA,EAAA,mBAAqB,qBACrBA,EAAA,2BAA6B,6BAC7BA,EAAA,iBAAmB,oBAVTA,OAAA,IAkBCC,EAA4B","names":["AptosApiType","DEFAULT_MAX_GAS_AMOUNT","DEFAULT_TXN_EXP_SEC_FROM_NOW","DEFAULT_TXN_TIMEOUT_SEC","APTOS_COIN","APTOS_FA","RAW_TRANSACTION_SALT","RAW_TRANSACTION_WITH_DATA_SALT","ProcessorType","FIREBASE_AUTH_ISS_PATTERN"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/core/crypto/singleKey.ts"],"sourcesContent":["import { Deserializer, Serializer } from \"../../bcs\";\nimport { AnyPublicKeyVariant, AnySignatureVariant, SigningScheme as AuthenticationKeyScheme } from \"../../types\";\nimport { AuthenticationKey } from \"../authenticationKey\";\nimport { Ed25519PublicKey, Ed25519Signature } from \"./ed25519\";\nimport { AccountPublicKey, PublicKey, VerifySignatureArgs } from \"./publicKey\";\nimport { Secp256k1PublicKey, Secp256k1Signature } from \"./secp256k1\";\nimport { KeylessPublicKey, KeylessSignature } from \"./keyless\";\nimport { Signature } from \"./signature\";\nimport { FederatedKeylessPublicKey } from \"./federatedKeyless\";\n\n/**\n * Represents any public key supported by Aptos.\n *\n * Since [AIP-55](https://github.com/aptos-foundation/AIPs/pull/263) Aptos supports\n * `Legacy` and `Unified` authentication keys.\n *\n * Any unified authentication key is represented in the SDK as `AnyPublicKey`.\n */\nexport class AnyPublicKey extends AccountPublicKey {\n /**\n * Reference to the inner public key\n */\n public readonly publicKey: PublicKey;\n\n /**\n * Index of the underlying enum variant\n */\n public readonly variant: AnyPublicKeyVariant;\n\n // region Constructors\n\n /**\n * Creates an instance of the signature class based on the provided signature type.\n * This allows for the handling of different signature variants such as Ed25519, Secp256k1, and Keyless.\n *\n * @param publicKey - The publicKey object which determines the variant to be used.\n * @throws Error if the provided signature type is unsupported.\n */\n constructor(publicKey: PublicKey) {\n super();\n this.publicKey = publicKey;\n if (publicKey instanceof Ed25519PublicKey) {\n this.variant = AnyPublicKeyVariant.Ed25519;\n } else if (publicKey instanceof Secp256k1PublicKey) {\n this.variant = AnyPublicKeyVariant.Secp256k1;\n } else if (publicKey instanceof KeylessPublicKey) {\n this.variant = AnyPublicKeyVariant.Keyless;\n } else if (publicKey instanceof FederatedKeylessPublicKey) {\n this.variant = AnyPublicKeyVariant.FederatedKeyless;\n } else {\n throw new Error(\"Unsupported public key type\");\n }\n }\n\n // endregion\n\n // region AccountPublicKey\n\n /**\n * Verifies the provided signature against the given message.\n * This function helps ensure the integrity and authenticity of the message by confirming that the signature is valid.\n *\n * @param args - The arguments for signature verification.\n * @param args.message - The message that was signed.\n * @param args.signature - The signature to verify, which must be an instance of AnySignature.\n * @returns A boolean indicating whether the signature is valid for the given message.\n */\n verifySignature(args: VerifySignatureArgs): boolean {\n const { message, signature } = args;\n if (!AnySignature.isInstance(signature)) {\n return false;\n }\n\n return this.publicKey.verifySignature({\n message,\n signature: signature.signature,\n });\n }\n\n /**\n * Generates an authentication key from the current instance's byte representation.\n * This function is essential for creating a unique identifier for authentication purposes.\n *\n * @returns {AuthenticationKey} The generated authentication key.\n */\n authKey(): AuthenticationKey {\n return AuthenticationKey.fromSchemeAndBytes({\n scheme: AuthenticationKeyScheme.SingleKey,\n input: this.toUint8Array(),\n });\n }\n\n /**\n * Get the signature in bytes (Uint8Array).\n *\n * This function is a warning that it will soon return the underlying signature bytes directly.\n * Use AnySignature.bcsToBytes() instead.\n *\n * @returns Uint8Array representation of the signature.\n */\n toUint8Array() {\n return this.bcsToBytes();\n }\n\n // endregion\n\n // region Serializable\n\n /**\n * Serializes the current object using the provided serializer.\n * This function helps in converting the object into a format suitable for transmission or storage.\n *\n * @param serializer - The serializer instance used to perform the serialization.\n */\n serialize(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(this.variant);\n this.publicKey.serialize(serializer);\n }\n\n /**\n * Deserializes an AnySignature from the provided deserializer.\n * This function helps in reconstructing the AnySignature object from its serialized form, allowing for further processing or validation.\n *\n * @param deserializer - The deserializer instance used to read the serialized data.\n */\n static deserialize(deserializer: Deserializer): AnyPublicKey {\n const variantIndex = deserializer.deserializeUleb128AsU32();\n let publicKey: PublicKey;\n switch (variantIndex) {\n case AnyPublicKeyVariant.Ed25519:\n publicKey = Ed25519PublicKey.deserialize(deserializer);\n break;\n case AnyPublicKeyVariant.Secp256k1:\n publicKey = Secp256k1PublicKey.deserialize(deserializer);\n break;\n case AnyPublicKeyVariant.Keyless:\n publicKey = KeylessPublicKey.deserialize(deserializer);\n break;\n case AnyPublicKeyVariant.FederatedKeyless:\n publicKey = FederatedKeylessPublicKey.deserialize(deserializer);\n break;\n default:\n throw new Error(`Unknown variant index for AnyPublicKey: ${variantIndex}`);\n }\n return new AnyPublicKey(publicKey);\n }\n // endregion\n\n /**\n * Determines if the provided public key is an instance of AnyPublicKey.\n *\n * @param publicKey - The public key to check.\n * @deprecated Use `instanceof AnyPublicKey` instead.\n */\n static isPublicKey(publicKey: AccountPublicKey): publicKey is AnyPublicKey {\n return publicKey instanceof AnyPublicKey;\n }\n\n /**\n * Determines if the current public key is an instance of Ed25519PublicKey.\n *\n * @deprecated use `publicKey instanceof Ed25519PublicKey` instead.\n */\n isEd25519(): boolean {\n return this.publicKey instanceof Ed25519PublicKey;\n }\n\n /**\n * Checks if the public key is an instance of Secp256k1PublicKey.\n *\n * @deprecated use `publicKey instanceof Secp256k1PublicKey` instead.\n */\n isSecp256k1PublicKey(): boolean {\n return this.publicKey instanceof Secp256k1PublicKey;\n }\n\n /**\n * Determines if the provided publicKey is an instance of a valid PublicKey object.\n *\n * @param publicKey - The publicKey to be checked for validity.\n * @param publicKey.publicKey - The actual publicKey object that needs to be validated.\n * @returns True if the signature is a valid instance; otherwise, false.\n */\n static isInstance(publicKey: PublicKey): publicKey is AnyPublicKey {\n return \"publicKey\" in publicKey && \"variant\" in publicKey;\n }\n}\n\n/**\n * Represents a signature that utilizes the SingleKey authentication scheme.\n * This class is designed to encapsulate various types of signatures, which can\n * only be generated by a `SingleKeySigner` due to the shared authentication mechanism.\n *\n * @extends Signature\n */\nexport class AnySignature extends Signature {\n public readonly signature: Signature;\n\n /**\n * Index of the underlying enum variant\n */\n private readonly variant: AnySignatureVariant;\n\n // region Constructors\n\n constructor(signature: Signature) {\n super();\n this.signature = signature;\n\n if (signature instanceof Ed25519Signature) {\n this.variant = AnySignatureVariant.Ed25519;\n } else if (signature instanceof Secp256k1Signature) {\n this.variant = AnySignatureVariant.Secp256k1;\n } else if (signature instanceof KeylessSignature) {\n this.variant = AnySignatureVariant.Keyless;\n } else {\n throw new Error(\"Unsupported signature type\");\n }\n }\n\n // endregion\n\n // region AccountSignature\n\n toUint8Array() {\n // TODO: keep this warning around for a bit, and eventually change this to return `this.signature.toUint8Array()`.\n // eslint-disable-next-line no-console\n console.warn(\n \"[Aptos SDK] Calls to AnySignature.toUint8Array() will soon return the underlying signature bytes. \" +\n \"Use AnySignature.bcsToBytes() instead.\",\n );\n return this.bcsToBytes();\n }\n\n // endregion\n\n // region Serializable\n\n serialize(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(this.variant);\n this.signature.serialize(serializer);\n }\n\n static deserialize(deserializer: Deserializer): AnySignature {\n const variantIndex = deserializer.deserializeUleb128AsU32();\n let signature: Signature;\n switch (variantIndex) {\n case AnySignatureVariant.Ed25519:\n signature = Ed25519Signature.deserialize(deserializer);\n break;\n case AnySignatureVariant.Secp256k1:\n signature = Secp256k1Signature.deserialize(deserializer);\n break;\n case AnySignatureVariant.Keyless:\n signature = KeylessSignature.deserialize(deserializer);\n break;\n default:\n throw new Error(`Unknown variant index for AnySignature: ${variantIndex}`);\n }\n return new AnySignature(signature);\n }\n\n // endregion\n\n static isInstance(signature: Signature): signature is AnySignature {\n return (\n \"signature\" in signature &&\n typeof signature.signature === \"object\" &&\n signature.signature !== null &&\n \"toUint8Array\" in signature.signature\n );\n }\n}\n"],"mappings":"0SAkBO,IAAMA,EAAN,MAAMC,UAAqBC,CAAiB,CAoBjD,YAAYC,EAAsB,CAGhC,GAFA,MAAM,EACN,KAAK,UAAYA,EACbA,aAAqBC,EACvB,KAAK,QAAU,UACND,aAAqBE,EAC9B,KAAK,QAAU,UACNF,aAAqBG,EAC9B,KAAK,QAAU,UACNH,aAAqBI,EAC9B,KAAK,QAAU,MAEf,OAAM,IAAI,MAAM,6BAA6B,CAEjD,CAeA,gBAAgBC,EAAoC,CAClD,GAAM,CAAE,QAAAC,EAAS,UAAAC,CAAU,EAAIF,EAC/B,OAAKG,EAAa,WAAWD,CAAS,EAI/B,KAAK,UAAU,gBAAgB,CACpC,QAAAD,EACA,UAAWC,EAAU,SACvB,CAAC,EANQ,EAOX,CAQA,SAA6B,CAC3B,OAAOE,EAAkB,mBAAmB,CAC1C,SACA,MAAO,KAAK,aAAa,CAC3B,CAAC,CACH,CAUA,cAAe,CACb,OAAO,KAAK,WAAW,CACzB,CAYA,UAAUC,EAA8B,CACtCA,EAAW,sBAAsB,KAAK,OAAO,EAC7C,KAAK,UAAU,UAAUA,CAAU,CACrC,CAQA,OAAO,YAAYC,EAA0C,CAC3D,IAAMC,EAAeD,EAAa,wBAAwB,EACtDX,EACJ,OAAQY,EAAc,CACpB,OACEZ,EAAYC,EAAiB,YAAYU,CAAY,EACrD,MACF,OACEX,EAAYE,EAAmB,YAAYS,CAAY,EACvD,MACF,OACEX,EAAYG,EAAiB,YAAYQ,CAAY,EACrD,MACF,OACEX,EAAYI,EAA0B,YAAYO,CAAY,EAC9D,MACF,QACE,MAAM,IAAI,MAAM,2CAA2CC,CAAY,EAAE,CAC7E,CACA,OAAO,IAAId,EAAaE,CAAS,CACnC,CASA,OAAO,YAAYA,EAAwD,CACzE,OAAOA,aAAqBF,CAC9B,CAOA,WAAqB,CACnB,OAAO,KAAK,qBAAqBG,CACnC,CAOA,sBAAgC,CAC9B,OAAO,KAAK,qBAAqBC,CACnC,CASA,OAAO,WAAWF,EAAiD,CACjE,MAAO,cAAeA,GAAa,YAAaA,CAClD,CACF,EASaQ,EAAN,MAAMK,UAAqBC,CAAU,CAU1C,YAAYP,EAAsB,CAIhC,GAHA,MAAM,EACN,KAAK,UAAYA,EAEbA,aAAqBQ,EACvB,KAAK,QAAU,UACNR,aAAqBS,EAC9B,KAAK,QAAU,UACNT,aAAqBU,EAC9B,KAAK,QAAU,MAEf,OAAM,IAAI,MAAM,4BAA4B,CAEhD,CAMA,cAAe,CAGb,eAAQ,KACN,0IAEF,EACO,KAAK,WAAW,CACzB,CAMA,UAAUP,EAA8B,CACtCA,EAAW,sBAAsB,KAAK,OAAO,EAC7C,KAAK,UAAU,UAAUA,CAAU,CACrC,CAEA,OAAO,YAAYC,EAA0C,CAC3D,IAAMC,EAAeD,EAAa,wBAAwB,EACtDJ,EACJ,OAAQK,EAAc,CACpB,OACEL,EAAYQ,EAAiB,YAAYJ,CAAY,EACrD,MACF,OACEJ,EAAYS,EAAmB,YAAYL,CAAY,EACvD,MACF,OACEJ,EAAYU,EAAiB,YAAYN,CAAY,EACrD,MACF,QACE,MAAM,IAAI,MAAM,2CAA2CC,CAAY,EAAE,CAC7E,CACA,OAAO,IAAIC,EAAaN,CAAS,CACnC,CAIA,OAAO,WAAWA,EAAiD,CACjE,MACE,cAAeA,GACf,OAAOA,EAAU,WAAc,UAC/BA,EAAU,YAAc,MACxB,iBAAkBA,EAAU,SAEhC,CACF","names":["AnyPublicKey","_AnyPublicKey","AccountPublicKey","publicKey","Ed25519PublicKey","Secp256k1PublicKey","KeylessPublicKey","FederatedKeylessPublicKey","args","message","signature","AnySignature","AuthenticationKey","serializer","deserializer","variantIndex","_AnySignature","Signature","Ed25519Signature","Secp256k1Signature","KeylessSignature"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/core/accountAddress.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { bytesToHex, hexToBytes } from \"@noble/hashes/utils\";\nimport { Serializable, Serializer } from \"../bcs/serializer\";\nimport { Deserializer } from \"../bcs/deserializer\";\nimport { ParsingError, ParsingResult } from \"./common\";\nimport { TransactionArgument } from \"../transactions/instances/transactionArgument\";\nimport { HexInput, ScriptTransactionArgumentVariants } from \"../types\";\n\n/**\n * Provides reasons for an address was invalid.\n */\nexport enum AddressInvalidReason {\n INCORRECT_NUMBER_OF_BYTES = \"incorrect_number_of_bytes\",\n INVALID_HEX_CHARS = \"invalid_hex_chars\",\n TOO_SHORT = \"too_short\",\n TOO_LONG = \"too_long\",\n LEADING_ZERO_X_REQUIRED = \"leading_zero_x_required\",\n LONG_FORM_REQUIRED_UNLESS_SPECIAL = \"long_form_required_unless_special\",\n INVALID_PADDING_ZEROES = \"INVALID_PADDING_ZEROES\",\n INVALID_PADDING_STRICTNESS = \"INVALID_PADDING_STRICTNESS\",\n}\n\n/**\n * The input for an account address, which can be either a hexadecimal string or a standard account address.\n */\nexport type AccountAddressInput = HexInput | AccountAddress;\n\n/**\n * NOTE: Only use this class for account addresses. For other hex data, e.g. transaction\n * hashes, use the Hex class.\n *\n * AccountAddress is used for working with account addresses. Account addresses, when\n * represented as a string, generally look like these examples:\n * - 0x1\n * - 0xaa86fe99004361f747f91342ca13c426ca0cccb0c1217677180c9493bad6ef0c\n *\n * Proper formatting and parsing of account addresses is defined by AIP-40.\n * To learn more about the standard, read the AIP here:\n * https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.\n *\n * The comments in this class make frequent reference to the LONG and SHORT formats,\n * as well as \"special\" addresses. To learn what these refer to see AIP-40.\n */\nexport class AccountAddress extends Serializable implements TransactionArgument {\n /**\n * This is the internal representation of an account address.\n */\n readonly data: Uint8Array;\n\n /**\n * The number of bytes that make up an account address.\n */\n static readonly LENGTH: number = 32;\n\n /**\n * The length of an address string in LONG form without a leading 0x.\n */\n static readonly LONG_STRING_LENGTH: number = 64;\n\n static ZERO: AccountAddress = AccountAddress.from(\"0x0\");\n\n static ONE: AccountAddress = AccountAddress.from(\"0x1\");\n\n static TWO: AccountAddress = AccountAddress.from(\"0x2\");\n\n static THREE: AccountAddress = AccountAddress.from(\"0x3\");\n\n static FOUR: AccountAddress = AccountAddress.from(\"0x4\");\n\n static A: AccountAddress = AccountAddress.from(\"0xA\");\n\n /**\n * Creates an instance of AccountAddress from a Uint8Array.\n *\n * This function ensures that the input data is exactly 32 bytes long, which is required for a valid account address.\n *\n * @param input A Uint8Array representing an account address.\n * @throws ParsingError if the input length is not equal to 32 bytes.\n */\n constructor(input: Uint8Array) {\n super();\n if (input.length !== AccountAddress.LENGTH) {\n throw new ParsingError(\n \"AccountAddress data should be exactly 32 bytes long\",\n AddressInvalidReason.INCORRECT_NUMBER_OF_BYTES,\n );\n }\n this.data = input;\n }\n\n /**\n * Determines if the address is classified as special, which is defined as 0x0 to 0xf inclusive.\n * In other words, the last byte of the address must be < 0b10000 (16)\n * and every other byte must be zero.\n *\n * For more information on how special addresses are defined, see AIP-40:\n * https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.\n *\n * @returns true if the address is special, false otherwise.\n */\n isSpecial(): boolean {\n return (\n this.data.slice(0, this.data.length - 1).every((byte) => byte === 0) && this.data[this.data.length - 1] < 0b10000\n );\n }\n // ===\n // Methods for representing an instance of AccountAddress as other types.\n // ===\n\n /**\n * Return the AccountAddress as a string as per AIP-40.\n * https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.\n * This representation returns special addresses in SHORT form (0xf)\n * and other addresses in LONG form (0x + 64 characters).\n *\n * @returns AccountAddress as a string conforming to AIP-40.\n */\n toString(): `0x${string}` {\n return `0x${this.toStringWithoutPrefix()}`;\n }\n\n /**\n * Return the AccountAddress as a string conforming to AIP-40 but without the leading 0x.\n *\n * NOTE: Prefer to use `toString` where possible.\n *\n * @returns AccountAddress as a string without the leading 0x.\n */\n toStringWithoutPrefix(): string {\n let hex = bytesToHex(this.data);\n if (this.isSpecial()) {\n hex = hex[hex.length - 1];\n }\n return hex;\n }\n\n /**\n * Convert the account address to a string in LONG format, which is always 0x followed by 64 hex characters.\n *\n * NOTE: Prefer to use `toString` where possible, as it formats special addresses using the SHORT form (no leading 0s).\n *\n * @returns AccountAddress as a string in LONG form.\n */\n toStringLong(): `0x${string}` {\n return `0x${this.toStringLongWithoutPrefix()}`;\n }\n\n /**\n * Returns the account address as a string in LONG form without a leading 0x.\n * This function will include leading zeroes and will produce a string of 64 hex characters.\n *\n * NOTE: Prefer to use `toString` where possible, as it formats special addresses using the SHORT form (no leading 0s).\n *\n * @returns {string} The account address in LONG form.\n */\n toStringLongWithoutPrefix(): string {\n return bytesToHex(this.data);\n }\n\n /**\n * Get the inner data as a Uint8Array.\n * The inner data is already a Uint8Array, so no conversion takes place.\n *\n * @returns Hex data as Uint8Array\n */\n toUint8Array(): Uint8Array {\n return this.data;\n }\n\n /**\n * Serialize the AccountAddress to a Serializer instance's data buffer.\n * @param serializer The serializer to serialize the AccountAddress to.\n * @returns void\n * @example\n * const serializer = new Serializer();\n * const address = AccountAddress.fromString(\"0x1\");\n * address.serialize(serializer);\n * const bytes = serializer.toUint8Array();\n * // `bytes` is now the BCS-serialized address.\n */\n serialize(serializer: Serializer): void {\n serializer.serializeFixedBytes(this.data);\n }\n\n /**\n * Serializes the current instance into a byte sequence suitable for entry functions.\n * This allows for the proper encoding of data when interacting with entry functions in the blockchain.\n *\n * @param serializer - The serializer instance used to convert the data into bytes.\n */\n serializeForEntryFunction(serializer: Serializer): void {\n const bcsBytes = this.bcsToBytes();\n serializer.serializeBytes(bcsBytes);\n }\n\n /**\n * Serializes the current instance for use in a script function by encoding it into a byte sequence.\n * This process involves serializing the variant index and the instance data, making it suitable for transmission.\n *\n * @param serializer - The serializer instance used to perform the serialization.\n */\n serializeForScriptFunction(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(ScriptTransactionArgumentVariants.Address);\n serializer.serialize(this);\n }\n\n /**\n * Deserialize an AccountAddress from the byte buffer in a Deserializer instance.\n * This function allows you to convert a byte representation of an AccountAddress into an instance of AccountAddress.\n * @param deserializer The deserializer to deserialize the AccountAddress from.\n * @returns An instance of AccountAddress.\n * @example\n * const bytes = hexToBytes(\"0x0102030405060708091011121314151617181920212223242526272829303132\");\n * const deserializer = new Deserializer(bytes);\n * const address = AccountAddress.deserialize(deserializer);\n * // `address` is now an instance of AccountAddress.\n */\n static deserialize(deserializer: Deserializer): AccountAddress {\n const bytes = deserializer.deserializeFixedBytes(AccountAddress.LENGTH);\n return new AccountAddress(bytes);\n }\n\n // ===\n // Methods for creating an instance of AccountAddress from other types.\n // ===\n\n /**\n * NOTE: This function has strict parsing behavior. For relaxed behavior, please use\n * the `fromString` function.\n *\n * Creates an instance of AccountAddress from a hex string.\n *\n * This function allows only the strictest formats defined by AIP-40. In short this\n * means only the following formats are accepted:\n *\n * - LONG\n * - SHORT for special addresses\n *\n * Where:\n * - LONG is defined as 0x + 64 hex characters.\n * - SHORT for special addresses is 0x0 to 0xf inclusive without padding zeroes.\n *\n * This means the following are not accepted:\n * - SHORT for non-special addresses.\n * - Any address without a leading 0x.\n *\n * @param input - A hex string representing an account address.\n *\n * @throws {ParsingError} If the hex string does not start with 0x or is not in a valid format.\n *\n * @remarks\n *\n * This function has strict parsing behavior. For relaxed behavior, please use the `fromString` function.\n *\n * @see AIP-40 documentation for more details on address formats:\n * https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.\n *\n * @returns An instance of AccountAddress.\n */\n static fromStringStrict(input: string): AccountAddress {\n // Assert the string starts with 0x.\n if (!input.startsWith(\"0x\")) {\n throw new ParsingError(\"Hex string must start with a leading 0x.\", AddressInvalidReason.LEADING_ZERO_X_REQUIRED);\n }\n\n const address = AccountAddress.fromString(input);\n\n // Check if the address is in LONG form. If it is not, this is only allowed for\n // special addresses, in which case we check it is in proper SHORT form.\n if (input.length !== AccountAddress.LONG_STRING_LENGTH + 2) {\n if (!address.isSpecial()) {\n throw new ParsingError(\n `The given hex string ${input} is not a special address, it must be represented as 0x + 64 chars.`,\n AddressInvalidReason.LONG_FORM_REQUIRED_UNLESS_SPECIAL,\n );\n } else if (input.length !== 3) {\n // 0x + one hex char is the only valid SHORT form for special addresses.\n throw new ParsingError(\n // eslint-disable-next-line max-len\n `The given hex string ${input} is a special address not in LONG form, it must be 0x0 to 0xf without padding zeroes.`,\n AddressInvalidReason.INVALID_PADDING_ZEROES,\n );\n }\n }\n\n return address;\n }\n\n /**\n * NOTE: This function has relaxed parsing behavior. For strict behavior, please use\n * the `fromStringStrict` function. Where possible use `fromStringStrict` rather than this\n * function, `fromString`.\n *\n * Creates an instance of AccountAddress from a hex string.\n *\n * This function allows all formats defined by AIP-40. In short this means the\n * following formats are accepted:\n *\n * - LONG, with or without leading 0x\n * - SHORT*, with or without leading 0x\n *\n * Where:\n * - LONG is 64 hex characters.\n * - SHORT* is 1 to 63 hex characters inclusive. The address can have missing values up to `maxMissingChars` before it is padded.\n * - Padding zeroes are allowed, e.g. 0x0123 is valid.\n *\n * Learn more about the different address formats by reading AIP-40:\n * https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.\n *\n * @param input A hex string representing an account address.\n * @param args.maxMissingChars The number of characters that can be missing in a padded address before it is invalid.\n *\n * @returns An instance of AccountAddress.\n *\n * @throws ParsingError if the hex string is too short, too long, or contains invalid characters.\n */\n static fromString(input: string, { maxMissingChars = 4 }: { maxMissingChars?: number } = {}): AccountAddress {\n let parsedInput = input;\n // Remove leading 0x for parsing.\n if (input.startsWith(\"0x\")) {\n parsedInput = input.slice(2);\n }\n\n // Ensure the address string is at least 1 character long.\n if (parsedInput.length === 0) {\n throw new ParsingError(\n \"Hex string is too short, must be 1 to 64 chars long, excluding the leading 0x.\",\n AddressInvalidReason.TOO_SHORT,\n );\n }\n\n // Ensure the address string is not longer than 64 characters.\n if (parsedInput.length > 64) {\n throw new ParsingError(\n \"Hex string is too long, must be 1 to 64 chars long, excluding the leading 0x.\",\n AddressInvalidReason.TOO_LONG,\n );\n }\n\n // Ensure that the maxMissingChars is between or equal to 0 and 63.\n if (maxMissingChars > 63 || maxMissingChars < 0) {\n throw new ParsingError(\n `maxMissingChars must be between or equal to 0 and 63. Received ${maxMissingChars}`,\n AddressInvalidReason.INVALID_PADDING_STRICTNESS,\n );\n }\n\n let addressBytes: Uint8Array;\n try {\n // Pad the address with leading zeroes, so it is 64 chars long and then convert\n // the hex string to bytes. Every two characters in a hex string constitutes a\n // single byte. So a 64 length hex string becomes a 32 byte array.\n addressBytes = hexToBytes(parsedInput.padStart(64, \"0\"));\n } catch (error: any) {\n // At this point the only way this can fail is if the hex string contains\n // invalid characters.\n throw new ParsingError(`Hex characters are invalid: ${error?.message}`, AddressInvalidReason.INVALID_HEX_CHARS);\n }\n\n const address = new AccountAddress(addressBytes);\n\n // Cannot pad the address if it has more than maxMissingChars missing.\n if (parsedInput.length < 64 - maxMissingChars) {\n if (!address.isSpecial()) {\n throw new ParsingError(\n `Hex string is too short, must be ${64 - maxMissingChars} to 64 chars long, excluding the leading 0x. You may need to fix \nthe addresss by padding it with 0s before passing it to \\`fromString\\` (e.g. <addressString>.padStart(64, '0')). \nReceived ${input}`,\n AddressInvalidReason.TOO_SHORT,\n );\n }\n }\n\n return address;\n }\n\n /**\n * Convenience method for creating an AccountAddress from various input types.\n * This function accepts a string, Uint8Array, or an existing AccountAddress instance and returns the corresponding\n * AccountAddress.\n *\n * @param input - The input to convert into an AccountAddress. This can be a string representation of an address, a Uint8Array,\n * or an existing AccountAddress.\n * @param args.maxMissingChars The number of characters that can be missing in a padded address before it is invalid.\n */\n static from(input: AccountAddressInput, { maxMissingChars = 4 }: { maxMissingChars?: number } = {}): AccountAddress {\n if (typeof input === \"string\") {\n return AccountAddress.fromString(input, { maxMissingChars });\n }\n if (input instanceof Uint8Array) {\n return new AccountAddress(input);\n }\n return input;\n }\n\n /**\n * Create an AccountAddress from various input types, including strings, Uint8Array, and AccountAddress instances.\n *\n * @param input - The input to convert into an AccountAddress, which can be a string, a Uint8Array, or an AccountAddress.\n */\n static fromStrict(input: AccountAddressInput): AccountAddress {\n if (typeof input === \"string\") {\n return AccountAddress.fromStringStrict(input);\n }\n if (input instanceof Uint8Array) {\n return new AccountAddress(input);\n }\n return input;\n }\n // ===\n // Methods for checking validity.\n // ===\n\n /**\n * Check if the provided input is a valid AccountAddress.\n *\n * @param args - The arguments for validation.\n * @param args.input - A hex string representing an account address.\n * @param args.strict - If true, use strict parsing behavior; if false, use relaxed parsing behavior.\n *\n * @returns An object indicating whether the address is valid. If valid, valid = true; if not, valid = false with additional details.\n * If the address is invalid, invalidReason will explain why it is invalid, and invalidReasonMessage will provide the error message.\n */\n static isValid(args: { input: AccountAddressInput; strict?: boolean }): ParsingResult<AddressInvalidReason> {\n try {\n if (args.strict) {\n AccountAddress.fromStrict(args.input);\n } else {\n AccountAddress.from(args.input);\n }\n return { valid: true };\n } catch (error: any) {\n return {\n valid: false,\n invalidReason: error?.invalidReason,\n invalidReasonMessage: error?.message,\n };\n }\n }\n\n /**\n * Determine if two AccountAddresses are equal based on their underlying byte data.\n *\n * @param other - The AccountAddress to compare to.\n * @returns true if the AccountAddresses are equal, false if not.\n */\n equals(other: AccountAddress): boolean {\n if (this.data.length !== other.data.length) return false;\n return this.data.every((value, index) => value === other.data[index]);\n }\n}\n"],"mappings":"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","names":["bytesToHex","hexToBytes","AddressInvalidReason","_AccountAddress","Serializable","input","ParsingError","byte","hex","bytesToHex","serializer","bcsBytes","deserializer","bytes","address","maxMissingChars","parsedInput","addressBytes","hexToBytes","error","args","other","value","index","AccountAddress"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/core/crypto/ephemeral.ts"],"sourcesContent":["import { Serializer, Deserializer } from \"../../bcs\";\nimport { EphemeralPublicKeyVariant, EphemeralSignatureVariant, HexInput } from \"../../types\";\nimport { PublicKey } from \"./publicKey\";\nimport { Signature } from \"./signature\";\nimport { Ed25519PublicKey, Ed25519Signature } from \"./ed25519\";\nimport { Hex } from \"../hex\";\n\n/**\n * Represents ephemeral public keys for Aptos Keyless accounts.\n *\n * These keys are used only temporarily within Keyless accounts and are not utilized as public keys for account identification.\n */\nexport class EphemeralPublicKey extends PublicKey {\n /**\n * The public key itself\n */\n public readonly publicKey: PublicKey;\n\n /**\n * An enum indicating the scheme of the ephemeral public key\n */\n public readonly variant: EphemeralPublicKeyVariant;\n\n /**\n * Creates an instance of EphemeralPublicKey using the provided public key.\n * This constructor ensures that only supported signature types are accepted.\n *\n * @param publicKey - The public key to be used for the ephemeral public key.\n * @throws Error if the signature type is unsupported.\n */\n constructor(publicKey: PublicKey) {\n super();\n const publicKeyType = publicKey.constructor.name;\n switch (publicKeyType) {\n case Ed25519PublicKey.name:\n this.publicKey = publicKey;\n this.variant = EphemeralPublicKeyVariant.Ed25519;\n break;\n default:\n throw new Error(`Unsupported key for EphemeralPublicKey - ${publicKeyType}`);\n }\n }\n\n /**\n * Verifies a signed message using the ephemeral public key.\n *\n * @param args - The arguments for the verification.\n * @param args.message - The message that was signed.\n * @param args.signature - The signature that was signed by the private key of the ephemeral public key.\n * @returns true if the signature is valid, otherwise false.\n */\n verifySignature(args: { message: HexInput; signature: EphemeralSignature }): boolean {\n const { message, signature } = args;\n return this.publicKey.verifySignature({ message, signature: signature.signature });\n }\n\n /**\n * Serializes the current instance, specifically handling the Ed25519 signature type.\n * This function ensures that the signature is properly serialized using the provided serializer.\n *\n * @param serializer - The serializer instance used to serialize the signature.\n * @throws Error if the signature type is unknown.\n */\n serialize(serializer: Serializer): void {\n if (this.publicKey instanceof Ed25519PublicKey) {\n serializer.serializeU32AsUleb128(EphemeralPublicKeyVariant.Ed25519);\n this.publicKey.serialize(serializer);\n } else {\n throw new Error(\"Unknown public key type\");\n }\n }\n\n /**\n * Deserializes an EphemeralSignature from the provided deserializer.\n * This function allows you to retrieve an EphemeralSignature based on the deserialized data.\n *\n * @param deserializer - The deserializer instance used to read the serialized data.\n */\n static deserialize(deserializer: Deserializer): EphemeralPublicKey {\n const index = deserializer.deserializeUleb128AsU32();\n switch (index) {\n case EphemeralPublicKeyVariant.Ed25519:\n return new EphemeralPublicKey(Ed25519PublicKey.deserialize(deserializer));\n default:\n throw new Error(`Unknown variant index for EphemeralPublicKey: ${index}`);\n }\n }\n\n /**\n * Determines if the provided public key is an instance of `EphemeralPublicKey`.\n *\n * @param publicKey - The public key to check.\n * @returns A boolean indicating whether the public key is an ephemeral type.\n */\n static isPublicKey(publicKey: PublicKey): publicKey is EphemeralPublicKey {\n return publicKey instanceof EphemeralPublicKey;\n }\n}\n\n/**\n * Represents ephemeral signatures used in Aptos Keyless accounts.\n *\n * These signatures are utilized within the KeylessSignature framework.\n */\nexport class EphemeralSignature extends Signature {\n /**\n * The signature signed by the private key of an EphemeralKeyPair\n */\n public readonly signature: Signature;\n\n constructor(signature: Signature) {\n super();\n const signatureType = signature.constructor.name;\n switch (signatureType) {\n case Ed25519Signature.name:\n this.signature = signature;\n break;\n default:\n throw new Error(`Unsupported signature for EphemeralSignature - ${signatureType}`);\n }\n }\n\n /**\n * Deserializes an ephemeral signature from a hexadecimal input.\n * This function allows you to convert a hexadecimal representation of an ephemeral signature into its deserialized form for\n * further processing.\n *\n * @param hexInput - The hexadecimal input representing the ephemeral signature.\n */\n static fromHex(hexInput: HexInput): EphemeralSignature {\n const data = Hex.fromHexInput(hexInput);\n const deserializer = new Deserializer(data.toUint8Array());\n return EphemeralSignature.deserialize(deserializer);\n }\n\n serialize(serializer: Serializer): void {\n if (this.signature instanceof Ed25519Signature) {\n serializer.serializeU32AsUleb128(EphemeralSignatureVariant.Ed25519);\n this.signature.serialize(serializer);\n } else {\n throw new Error(\"Unknown signature type\");\n }\n }\n\n static deserialize(deserializer: Deserializer): EphemeralSignature {\n const index = deserializer.deserializeUleb128AsU32();\n switch (index) {\n case EphemeralSignatureVariant.Ed25519:\n return new EphemeralSignature(Ed25519Signature.deserialize(deserializer));\n default:\n throw new Error(`Unknown variant index for EphemeralSignature: ${index}`);\n }\n }\n}\n"],"mappings":"oNAYO,IAAMA,EAAN,MAAMC,UAA2BC,CAAU,CAkBhD,YAAYC,EAAsB,CAChC,MAAM,EACN,IAAMC,EAAgBD,EAAU,YAAY,KAC5C,OAAQC,EAAe,CACrB,KAAKC,EAAiB,KACpB,KAAK,UAAYF,EACjB,KAAK,QAAU,EACf,MACF,QACE,MAAM,IAAI,MAAM,4CAA4CC,CAAa,EAAE,CAC/E,CACF,CAUA,gBAAgBE,EAAqE,CACnF,GAAM,CAAE,QAAAC,EAAS,UAAAC,CAAU,EAAIF,EAC/B,OAAO,KAAK,UAAU,gBAAgB,CAAE,QAAAC,EAAS,UAAWC,EAAU,SAAU,CAAC,CACnF,CASA,UAAUC,EAA8B,CACtC,GAAI,KAAK,qBAAqBJ,EAC5BI,EAAW,uBAAuD,EAClE,KAAK,UAAU,UAAUA,CAAU,MAEnC,OAAM,IAAI,MAAM,yBAAyB,CAE7C,CAQA,OAAO,YAAYC,EAAgD,CACjE,IAAMC,EAAQD,EAAa,wBAAwB,EACnD,OAAQC,EAAO,CACb,OACE,OAAO,IAAIV,EAAmBI,EAAiB,YAAYK,CAAY,CAAC,EAC1E,QACE,MAAM,IAAI,MAAM,iDAAiDC,CAAK,EAAE,CAC5E,CACF,CAQA,OAAO,YAAYR,EAAuD,CACxE,OAAOA,aAAqBF,CAC9B,CACF,EAOaW,EAAN,MAAMC,UAA2BC,CAAU,CAMhD,YAAYN,EAAsB,CAChC,MAAM,EACN,IAAMO,EAAgBP,EAAU,YAAY,KAC5C,OAAQO,EAAe,CACrB,KAAKC,EAAiB,KACpB,KAAK,UAAYR,EACjB,MACF,QACE,MAAM,IAAI,MAAM,kDAAkDO,CAAa,EAAE,CACrF,CACF,CASA,OAAO,QAAQE,EAAwC,CACrD,IAAMC,EAAOC,EAAI,aAAaF,CAAQ,EAChCP,EAAe,IAAIU,EAAaF,EAAK,aAAa,CAAC,EACzD,OAAOL,EAAmB,YAAYH,CAAY,CACpD,CAEA,UAAUD,EAA8B,CACtC,GAAI,KAAK,qBAAqBO,EAC5BP,EAAW,uBAAuD,EAClE,KAAK,UAAU,UAAUA,CAAU,MAEnC,OAAM,IAAI,MAAM,wBAAwB,CAE5C,CAEA,OAAO,YAAYC,EAAgD,CACjE,IAAMC,EAAQD,EAAa,wBAAwB,EACnD,OAAQC,EAAO,CACb,OACE,OAAO,IAAIE,EAAmBG,EAAiB,YAAYN,CAAY,CAAC,EAC1E,QACE,MAAM,IAAI,MAAM,iDAAiDC,CAAK,EAAE,CAC5E,CACF,CACF","names":["EphemeralPublicKey","_EphemeralPublicKey","PublicKey","publicKey","publicKeyType","Ed25519PublicKey","args","message","signature","serializer","deserializer","index","EphemeralSignature","_EphemeralSignature","Signature","signatureType","Ed25519Signature","hexInput","data","Hex","Deserializer"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/account/Ed25519Account.ts"],"sourcesContent":["import { AccountAuthenticatorEd25519 } from \"../transactions/authenticator/account\";\nimport { HexInput, SigningScheme } from \"../types\";\nimport { AccountAddress, AccountAddressInput } from \"../core/accountAddress\";\nimport { Ed25519PrivateKey, Ed25519PublicKey, Ed25519Signature } from \"../core/crypto\";\nimport type { Account } from \"./Account\";\nimport { AnyRawTransaction } from \"../transactions/types\";\nimport { generateSigningMessageForTransaction } from \"../transactions/transactionBuilder/signingMessage\";\n\n/**\n * Arguments required to create an instance of an Ed25519 signer.\n *\n * @param privateKey - The private key used for signing.\n * @param address - Optional account address associated with the signer.\n */\nexport interface Ed25519SignerConstructorArgs {\n privateKey: Ed25519PrivateKey;\n address?: AccountAddressInput;\n}\n\n/**\n * Arguments for creating an Ed25519 signer from a derivation path.\n *\n * @param path - The derivation path for the Ed25519 key.\n * @param mnemonic - The mnemonic phrase used to generate the key.\n */\nexport interface Ed25519SignerFromDerivationPathArgs {\n path: string;\n mnemonic: string;\n}\n\n/**\n * Arguments required to verify an Ed25519 signature against a given message.\n *\n * @param message - The message to be verified, represented in hexadecimal format.\n * @param signature - The Ed25519 signature to validate.\n */\nexport interface VerifyEd25519SignatureArgs {\n message: HexInput;\n signature: Ed25519Signature;\n}\n\n/**\n * Represents an Ed25519 account that provides signing capabilities through an Ed25519 private key.\n * This class allows for the creation of accounts, signing messages and transactions, and verifying signatures.\n *\n * Note: Generating an instance of this class does not create the account on-chain.\n */\nexport class Ed25519Account implements Account {\n /**\n * Private key associated with the account\n */\n readonly privateKey: Ed25519PrivateKey;\n\n readonly publicKey: Ed25519PublicKey;\n\n readonly accountAddress: AccountAddress;\n\n readonly signingScheme = SigningScheme.Ed25519;\n\n // region Constructors\n\n /**\n * Creates an instance of the Ed25519Signer with the specified parameters.\n * This constructor initializes the private key, public key, and account address for the signer.\n *\n * @param args - The constructor arguments for the Ed25519Signer.\n * @param args.privateKey - The private key used for signing.\n * @param args.address - The optional account address; if not provided, it will derive the address from the public key.\n */\n constructor(args: Ed25519SignerConstructorArgs) {\n const { privateKey, address } = args;\n this.privateKey = privateKey;\n this.publicKey = privateKey.publicKey();\n this.accountAddress = address ? AccountAddress.from(address) : this.publicKey.authKey().derivedAddress();\n }\n\n /**\n * Generates a new Ed25519 account using a randomly generated private key.\n * This function is useful for creating a signer that can be used for cryptographic operations.\n *\n * @returns {Ed25519Account} The newly generated Ed25519 account.\n */\n static generate(): Ed25519Account {\n const privateKey = Ed25519PrivateKey.generate();\n return new Ed25519Account({ privateKey });\n }\n\n /**\n * Derives an Ed25519 account using a specified BIP44 path and mnemonic seed phrase.\n *\n * @param args - The arguments for deriving the account.\n * @param args.path - The BIP44 derive hardened path, e.g., m/44'/637'/0'/0'/0'.\n * Detailed description: {@link https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki}\n * @param args.mnemonic - The mnemonic seed phrase of the account.\n */\n static fromDerivationPath(args: Ed25519SignerFromDerivationPathArgs) {\n const { path, mnemonic } = args;\n const privateKey = Ed25519PrivateKey.fromDerivationPath(path, mnemonic);\n return new Ed25519Account({ privateKey });\n }\n // endregion\n\n // region Account\n /**\n * Verify the given message and signature with the public key.\n *\n * @param args - The arguments for verifying the signature.\n * @param args.message - Raw message data in HexInput format.\n * @param args.signature - Signed message signature.\n * @returns A boolean indicating whether the signature is valid.\n */\n verifySignature(args: VerifyEd25519SignatureArgs): boolean {\n return this.publicKey.verifySignature(args);\n }\n\n /**\n * Sign a message using the account's Ed25519 private key.\n * This function returns an AccountAuthenticator containing the signature along with the account's public key.\n *\n * @param message - The signing message, represented as hexadecimal input.\n * @returns An AccountAuthenticator containing the signature and the account's public key.\n */\n signWithAuthenticator(message: HexInput): AccountAuthenticatorEd25519 {\n return new AccountAuthenticatorEd25519(this.publicKey, this.privateKey.sign(message));\n }\n\n /**\n * Sign a transaction using the account's Ed25519 private key.\n * This function returns an AccountAuthenticator that contains the signature of the transaction along with the account's public key.\n *\n * @param transaction - The raw transaction to be signed.\n * @returns An AccountAuthenticator containing the signature and the public key.\n */\n signTransactionWithAuthenticator(transaction: AnyRawTransaction): AccountAuthenticatorEd25519 {\n return new AccountAuthenticatorEd25519(this.publicKey, this.signTransaction(transaction));\n }\n\n /**\n * Sign the given message using the account's Ed25519 private key.\n * @param message - The message to be signed in HexInput format.\n * @returns Signature - The resulting signature of the signed message.\n */\n sign(message: HexInput): Ed25519Signature {\n return this.privateKey.sign(message);\n }\n\n /**\n * Sign the given transaction using the available signing capabilities.\n * This function helps ensure that the transaction is properly authenticated before submission.\n *\n * @param transaction - The transaction to be signed.\n * @returns Signature - The resulting signature for the transaction.\n */\n signTransaction(transaction: AnyRawTransaction): Ed25519Signature {\n return this.sign(generateSigningMessageForTransaction(transaction));\n }\n\n // endregion\n}\n"],"mappings":"oKA+CO,IAAMA,EAAN,MAAMC,CAAkC,CAsB7C,YAAYC,EAAoC,CAZhD,KAAS,cAAgB,EAavB,GAAM,CAAE,WAAAC,EAAY,QAAAC,CAAQ,EAAIF,EAChC,KAAK,WAAaC,EAClB,KAAK,UAAYA,EAAW,UAAU,EACtC,KAAK,eAAiBC,EAAUC,EAAe,KAAKD,CAAO,EAAI,KAAK,UAAU,QAAQ,EAAE,eAAe,CACzG,CAQA,OAAO,UAA2B,CAChC,IAAMD,EAAaG,EAAkB,SAAS,EAC9C,OAAO,IAAIL,EAAe,CAAE,WAAAE,CAAW,CAAC,CAC1C,CAUA,OAAO,mBAAmBD,EAA2C,CACnE,GAAM,CAAE,KAAAK,EAAM,SAAAC,CAAS,EAAIN,EACrBC,EAAaG,EAAkB,mBAAmBC,EAAMC,CAAQ,EACtE,OAAO,IAAIP,EAAe,CAAE,WAAAE,CAAW,CAAC,CAC1C,CAYA,gBAAgBD,EAA2C,CACzD,OAAO,KAAK,UAAU,gBAAgBA,CAAI,CAC5C,CASA,sBAAsBO,EAAgD,CACpE,OAAO,IAAIC,EAA4B,KAAK,UAAW,KAAK,WAAW,KAAKD,CAAO,CAAC,CACtF,CASA,iCAAiCE,EAA6D,CAC5F,OAAO,IAAID,EAA4B,KAAK,UAAW,KAAK,gBAAgBC,CAAW,CAAC,CAC1F,CAOA,KAAKF,EAAqC,CACxC,OAAO,KAAK,WAAW,KAAKA,CAAO,CACrC,CASA,gBAAgBE,EAAkD,CAChE,OAAO,KAAK,KAAKC,EAAqCD,CAAW,CAAC,CACpE,CAGF","names":["Ed25519Account","_Ed25519Account","args","privateKey","address","AccountAddress","Ed25519PrivateKey","path","mnemonic","message","AccountAuthenticatorEd25519","transaction","generateSigningMessageForTransaction"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/internal/staking.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * This file contains the underlying implementations for exposed API surface in\n * the {@link api/staking}. By moving the methods out into a separate file,\n * other namespaces and processes can access these methods without depending on the entire\n * faucet namespace and without having a dependency cycle error.\n */\n\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { AccountAddress, AccountAddressInput } from \"../core\";\nimport { GetDelegatedStakingActivitiesResponse, GetNumberOfDelegatorsResponse, OrderByArg } from \"../types\";\nimport { GetDelegatedStakingActivitiesQuery, GetNumberOfDelegatorsQuery } from \"../types/generated/operations\";\nimport { GetDelegatedStakingActivities, GetNumberOfDelegators } from \"../types/generated/queries\";\nimport { queryIndexer } from \"./general\";\n\n/**\n * Retrieves the number of active delegators for a specified pool address.\n *\n * @param args - The arguments for the function.\n * @param args.aptosConfig - The configuration object for Aptos.\n * @param args.poolAddress - The address of the pool for which to retrieve the number of delegators.\n * @returns The number of active delegators for the specified pool address.\n */\nexport async function getNumberOfDelegators(args: {\n aptosConfig: AptosConfig;\n poolAddress: AccountAddressInput;\n}): Promise<number> {\n const { aptosConfig, poolAddress } = args;\n const address = AccountAddress.from(poolAddress).toStringLong();\n const query = {\n query: GetNumberOfDelegators,\n variables: { where_condition: { pool_address: { _eq: address } } },\n };\n const data = await queryIndexer<GetNumberOfDelegatorsQuery>({ aptosConfig, query });\n\n // commonjs (aka cjs) doesn't handle Nullish Coalescing for some reason\n // might be because of how ts infer the graphql generated scheme type\n return data.num_active_delegator_per_pool[0] ? data.num_active_delegator_per_pool[0].num_active_delegator : 0;\n}\n\n/**\n * Retrieves the number of active delegators for all pools.\n *\n * @param args - The arguments for the function.\n * @param args.aptosConfig - The configuration for the Aptos client.\n * @param [args.options] - Optional parameters for ordering the results.\n * @param args.options.orderBy - Specifies the order in which to return the results.\n * @returns The number of active delegators per pool.\n */\nexport async function getNumberOfDelegatorsForAllPools(args: {\n aptosConfig: AptosConfig;\n options?: OrderByArg<GetNumberOfDelegatorsResponse[0]>;\n}): Promise<GetNumberOfDelegatorsResponse> {\n const { aptosConfig, options } = args;\n const query = {\n query: GetNumberOfDelegators,\n variables: { order_by: options?.orderBy },\n };\n const data = await queryIndexer<GetNumberOfDelegatorsQuery>({\n aptosConfig,\n query,\n });\n return data.num_active_delegator_per_pool;\n}\n\n/**\n * Retrieves the delegated staking activities for a specified delegator and pool.\n *\n * @param args - The parameters for the query.\n * @param args.aptosConfig - The configuration object for Aptos.\n * @param args.delegatorAddress - The address of the delegator whose activities are being queried.\n * @param args.poolAddress - The address of the pool associated with the delegated staking activities.\n * @returns The delegated staking activities for the specified delegator and pool.\n */\nexport async function getDelegatedStakingActivities(args: {\n aptosConfig: AptosConfig;\n delegatorAddress: AccountAddressInput;\n poolAddress: AccountAddressInput;\n}): Promise<GetDelegatedStakingActivitiesResponse> {\n const { aptosConfig, delegatorAddress, poolAddress } = args;\n const query = {\n query: GetDelegatedStakingActivities,\n variables: {\n delegatorAddress: AccountAddress.from(delegatorAddress).toStringLong(),\n poolAddress: AccountAddress.from(poolAddress).toStringLong(),\n },\n };\n const data = await queryIndexer<GetDelegatedStakingActivitiesQuery>({ aptosConfig, query });\n return data.delegated_staking_activities;\n}\n"],"mappings":"kIAyBA,eAAsBA,EAAsBC,EAGxB,CAClB,GAAM,CAAE,YAAAC,EAAa,YAAAC,CAAY,EAAIF,EAC/BG,EAAUC,EAAe,KAAKF,CAAW,EAAE,aAAa,EAKxDG,EAAO,MAAMC,EAAyC,CAAE,YAAAL,EAAa,MAJ7D,CACZ,MAAOM,EACP,UAAW,CAAE,gBAAiB,CAAE,aAAc,CAAE,IAAKJ,CAAQ,CAAE,CAAE,CACnE,CACiF,CAAC,EAIlF,OAAOE,EAAK,8BAA8B,CAAC,EAAIA,EAAK,8BAA8B,CAAC,EAAE,qBAAuB,CAC9G,CAWA,eAAsBG,EAAiCR,EAGZ,CACzC,GAAM,CAAE,YAAAC,EAAa,QAAAQ,CAAQ,EAAIT,EAC3BU,EAAQ,CACZ,MAAOH,EACP,UAAW,CAAE,SAAUE,GAAS,OAAQ,CAC1C,EAKA,OAJa,MAAMH,EAAyC,CAC1D,YAAAL,EACA,MAAAS,CACF,CAAC,GACW,6BACd,CAWA,eAAsBC,EAA8BX,EAID,CACjD,GAAM,CAAE,YAAAC,EAAa,iBAAAW,EAAkB,YAAAV,CAAY,EAAIF,EACjDU,EAAQ,CACZ,MAAOG,EACP,UAAW,CACT,iBAAkBT,EAAe,KAAKQ,CAAgB,EAAE,aAAa,EACrE,YAAaR,EAAe,KAAKF,CAAW,EAAE,aAAa,CAC7D,CACF,EAEA,OADa,MAAMI,EAAiD,CAAE,YAAAL,EAAa,MAAAS,CAAM,CAAC,GAC9E,4BACd","names":["getNumberOfDelegators","args","aptosConfig","poolAddress","address","AccountAddress","data","queryIndexer","GetNumberOfDelegators","getNumberOfDelegatorsForAllPools","options","query","getDelegatedStakingActivities","delegatorAddress","GetDelegatedStakingActivities"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/transactions/instances/identifier.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Deserializer } from \"../../bcs/deserializer\";\nimport { Serializable, Serializer } from \"../../bcs/serializer\";\n\n/**\n * Represents an Identifier that can be serialized and deserialized.\n * This class is used to denote the module \"name\" in \"ModuleId\" and\n * the \"function name\" in \"EntryFunction\".\n *\n * @extends Serializable\n */\nexport class Identifier extends Serializable {\n public identifier: string;\n\n /**\n * Creates an instance of the class with a specified identifier.\n *\n * @param identifier - The unique identifier for the instance.\n */\n constructor(identifier: string) {\n super();\n this.identifier = identifier;\n }\n\n /**\n * Serializes the identifier of the current instance using the provided serializer.\n *\n * @param serializer - The serializer instance used to perform the serialization.\n */\n public serialize(serializer: Serializer): void {\n serializer.serializeStr(this.identifier);\n }\n\n /**\n * Deserializes an identifier from the provided deserializer.\n * This function is useful for reconstructing an Identifier object from a serialized format.\n *\n * @param deserializer - The deserializer instance used to read the serialized data.\n */\n static deserialize(deserializer: Deserializer): Identifier {\n const identifier = deserializer.deserializeStr();\n return new Identifier(identifier);\n }\n}\n"],"mappings":"yCAaO,IAAMA,EAAN,MAAMC,UAAmBC,CAAa,CAQ3C,YAAYC,EAAoB,CAC9B,MAAM,EACN,KAAK,WAAaA,CACpB,CAOO,UAAUC,EAA8B,CAC7CA,EAAW,aAAa,KAAK,UAAU,CACzC,CAQA,OAAO,YAAYC,EAAwC,CACzD,IAAMF,EAAaE,EAAa,eAAe,EAC/C,OAAO,IAAIJ,EAAWE,CAAU,CAClC,CACF","names":["Identifier","_Identifier","Serializable","identifier","serializer","deserializer"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/client/post.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { aptosRequest } from \"./core\";\nimport { AptosResponse, AnyNumber, ClientConfig, MimeType } from \"../types\";\nimport { AptosApiType } from \"../utils/const\";\n\n/**\n * Options for making a POST request, including the API client configuration.\n */\nexport type PostRequestOptions = {\n /**\n * The config for the API client\n */\n aptosConfig: AptosConfig;\n /**\n * The type of API endpoint to call e.g. fullnode, indexer, etc\n */\n type: AptosApiType;\n /**\n * The name of the API method\n */\n originMethod: string;\n /**\n * The URL path to the API method\n */\n path: string;\n /**\n * The content type of the request body\n */\n contentType?: MimeType;\n /**\n * The accepted content type of the response of the API\n */\n acceptType?: MimeType;\n /**\n * The query parameters for the request\n */\n params?: Record<string, string | AnyNumber | boolean | undefined>;\n /**\n * The body of the request, should match the content type of the request\n */\n body?: any;\n /**\n * Specific client overrides for this request to override aptosConfig\n */\n overrides?: ClientConfig;\n};\n\n/**\n * Options for posting a request to Aptos, excluding the type field.\n */\nexport type PostAptosRequestOptions = Omit<PostRequestOptions, \"type\">;\n\n/**\n * Executes a POST request to the specified URL with the provided options.\n *\n * @param options - The options for the POST request.\n * @param options.type - The type of the request.\n * @param options.originMethod - The original method that initiated the request.\n * @param options.path - The path for the request.\n * @param options.body - The body content to be sent with the request.\n * @param options.acceptType - The type of response expected from the server.\n * @param options.contentType - The content type of the request body.\n * @param options.params - Additional parameters to include in the request.\n * @param options.aptosConfig - Configuration settings for the Aptos request.\n * @param options.overrides - Any overrides for the default request behavior.\n * @returns The response from the POST request.\n */\nexport async function post<Req extends {}, Res extends {}>(\n options: PostRequestOptions,\n): Promise<AptosResponse<Req, Res>> {\n const { type, originMethod, path, body, acceptType, contentType, params, aptosConfig, overrides } = options;\n const url = aptosConfig.getRequestUrl(type);\n\n return aptosRequest<Req, Res>(\n {\n url,\n method: \"POST\",\n originMethod,\n path,\n body,\n contentType,\n acceptType,\n params,\n overrides,\n },\n aptosConfig,\n options.type,\n );\n}\n\n/**\n * Sends a request to the Aptos full node using the specified options.\n * This function allows you to interact with the Aptos blockchain by sending requests to the full node.\n *\n * @param options - The options for the request.\n * @param options.aptosConfig - Configuration settings for the Aptos client.\n * @param options.aptosConfig.clientConfig - Client-specific configuration settings.\n * @param options.aptosConfig.fullnodeConfig - Full node-specific configuration settings.\n * @param options.overrides - Additional overrides for the request.\n */\nexport async function postAptosFullNode<Req extends {}, Res extends {}>(\n options: PostAptosRequestOptions,\n): Promise<AptosResponse<Req, Res>> {\n const { aptosConfig } = options;\n\n return post<Req, Res>({\n ...options,\n type: AptosApiType.FULLNODE,\n overrides: {\n ...aptosConfig.clientConfig,\n ...aptosConfig.fullnodeConfig,\n ...options.overrides,\n HEADERS: { ...aptosConfig.clientConfig?.HEADERS, ...aptosConfig.fullnodeConfig?.HEADERS },\n },\n });\n}\n\n/**\n * Sends a request to the Aptos indexer with the specified options.\n * This function allows you to interact with the Aptos indexer and customize the request using various configurations.\n *\n * @param options - The options for the request to the Aptos indexer.\n * @param options.aptosConfig - Configuration settings specific to the Aptos client and indexer.\n * @param options.aptosConfig.clientConfig - The client configuration settings.\n * @param options.aptosConfig.indexerConfig - The indexer configuration settings.\n * @param options.overrides - Additional overrides for the request.\n * @param options.overrides.HEADERS - Custom headers to include in the request.\n */\nexport async function postAptosIndexer<Req extends {}, Res extends {}>(\n options: PostAptosRequestOptions,\n): Promise<AptosResponse<Req, Res>> {\n const { aptosConfig } = options;\n\n return post<Req, Res>({\n ...options,\n type: AptosApiType.INDEXER,\n overrides: {\n ...aptosConfig.clientConfig,\n ...aptosConfig.indexerConfig,\n ...options.overrides,\n HEADERS: { ...aptosConfig.clientConfig?.HEADERS, ...aptosConfig.indexerConfig?.HEADERS },\n },\n });\n}\n\n/**\n * Sends a request to the Aptos faucet to obtain test tokens.\n * This function modifies the provided configuration to ensure that the API_KEY is not included in the request.\n *\n * @param options - The options for the request.\n * @param options.aptosConfig - The configuration settings for the Aptos client.\n * @param options.aptosConfig.clientConfig - The client-specific configuration settings.\n * @param options.aptosConfig.clientConfig.HEADERS - Optional headers to include in the request.\n * @param options.aptosConfig.faucetConfig - The configuration settings specific to the faucet.\n * @param options.overrides - Additional overrides for the request configuration.\n */\nexport async function postAptosFaucet<Req extends {}, Res extends {}>(\n options: PostAptosRequestOptions,\n): Promise<AptosResponse<Req, Res>> {\n const { aptosConfig } = options;\n // Faucet does not support API_KEY\n // Create a new object with the desired modification\n const modifiedAptosConfig = {\n ...aptosConfig,\n clientConfig: { ...aptosConfig.clientConfig },\n };\n // Delete API_KEY config\n delete modifiedAptosConfig?.clientConfig?.API_KEY;\n\n return post<Req, Res>({\n ...options,\n type: AptosApiType.FAUCET,\n overrides: {\n ...modifiedAptosConfig.clientConfig,\n ...modifiedAptosConfig.faucetConfig,\n ...options.overrides,\n HEADERS: { ...modifiedAptosConfig.clientConfig?.HEADERS, ...modifiedAptosConfig.faucetConfig?.HEADERS },\n },\n });\n}\n\n/**\n * Makes a post request to the pepper service.\n *\n * @param options - The options for the request.\n * @param options.url - The URL to which the request is sent.\n * @param options.headers - The headers to include in the request.\n * @param options.body - The body of the request.\n * @returns A promise that resolves to the response from the pepper service.\n */\nexport async function postAptosPepperService<Req extends {}, Res extends {}>(\n options: PostAptosRequestOptions,\n): Promise<AptosResponse<Req, Res>> {\n return post<Req, Res>({ ...options, type: AptosApiType.PEPPER });\n}\n\n/**\n * Sends a request to the Aptos proving service with the specified options.\n *\n * @param options - The options for the request to the Aptos proving service.\n * @param options.type - The type of the request, which should be set to AptosApiType.PROVER.\n * @param options.data - The data to be included in the request.\n */\nexport async function postAptosProvingService<Req extends {}, Res extends {}>(\n options: PostAptosRequestOptions,\n): Promise<AptosResponse<Req, Res>> {\n return post<Req, Res>({ ...options, type: AptosApiType.PROVER });\n}\n"],"mappings":"yCAsEA,eAAsBA,EACpBC,EACkC,CAClC,GAAM,CAAE,KAAAC,EAAM,aAAAC,EAAc,KAAAC,EAAM,KAAAC,EAAM,WAAAC,EAAY,YAAAC,EAAa,OAAAC,EAAQ,YAAAC,EAAa,UAAAC,CAAU,EAAIT,EAC9FU,EAAMF,EAAY,cAAcP,CAAI,EAE1C,OAAOU,EACL,CACE,IAAAD,EACA,OAAQ,OACR,aAAAR,EACA,KAAAC,EACA,KAAAC,EACA,YAAAE,EACA,WAAAD,EACA,OAAAE,EACA,UAAAE,CACF,EACAD,EACAR,EAAQ,IACV,CACF,CAYA,eAAsBY,EACpBZ,EACkC,CAClC,GAAM,CAAE,YAAAQ,CAAY,EAAIR,EAExB,OAAOD,EAAe,CACpB,GAAGC,EACH,gBACA,UAAW,CACT,GAAGQ,EAAY,aACf,GAAGA,EAAY,eACf,GAAGR,EAAQ,UACX,QAAS,CAAE,GAAGQ,EAAY,cAAc,QAAS,GAAGA,EAAY,gBAAgB,OAAQ,CAC1F,CACF,CAAC,CACH,CAaA,eAAsBK,EACpBb,EACkC,CAClC,GAAM,CAAE,YAAAQ,CAAY,EAAIR,EAExB,OAAOD,EAAe,CACpB,GAAGC,EACH,eACA,UAAW,CACT,GAAGQ,EAAY,aACf,GAAGA,EAAY,cACf,GAAGR,EAAQ,UACX,QAAS,CAAE,GAAGQ,EAAY,cAAc,QAAS,GAAGA,EAAY,eAAe,OAAQ,CACzF,CACF,CAAC,CACH,CAaA,eAAsBM,EACpBd,EACkC,CAClC,GAAM,CAAE,YAAAQ,CAAY,EAAIR,EAGlBe,EAAsB,CAC1B,GAAGP,EACH,aAAc,CAAE,GAAGA,EAAY,YAAa,CAC9C,EAEA,cAAOO,GAAqB,cAAc,QAEnChB,EAAe,CACpB,GAAGC,EACH,cACA,UAAW,CACT,GAAGe,EAAoB,aACvB,GAAGA,EAAoB,aACvB,GAAGf,EAAQ,UACX,QAAS,CAAE,GAAGe,EAAoB,cAAc,QAAS,GAAGA,EAAoB,cAAc,OAAQ,CACxG,CACF,CAAC,CACH,CAWA,eAAsBC,EACpBhB,EACkC,CAClC,OAAOD,EAAe,CAAE,GAAGC,EAAS,aAA0B,CAAC,CACjE,CASA,eAAsBiB,EACpBjB,EACkC,CAClC,OAAOD,EAAe,CAAE,GAAGC,EAAS,aAA0B,CAAC,CACjE","names":["post","options","type","originMethod","path","body","acceptType","contentType","params","aptosConfig","overrides","url","aptosRequest","postAptosFullNode","postAptosIndexer","postAptosFaucet","modifiedAptosConfig","postAptosPepperService","postAptosProvingService"]}
|