@aptos-labs/ts-sdk 1.33.2 → 1.35.0
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 +15 -9
- package/dist/common/{accountAddress-Cf1amU98.d.ts → accountAddress-CuHovHdK.d.ts} +22 -2
- package/dist/common/chunk-RX5UBAME.js +4 -0
- package/dist/common/chunk-RX5UBAME.js.map +1 -0
- package/dist/common/cli/index.d.ts +1 -1
- package/dist/common/cli/index.js +1 -1
- package/dist/common/cli/index.js.map +1 -1
- package/dist/common/index.d.ts +3139 -2533
- package/dist/common/index.js +33 -35
- package/dist/common/index.js.map +1 -1
- package/dist/esm/account/AbstractKeylessAccount.d.mts +1 -0
- package/dist/esm/account/AbstractKeylessAccount.mjs +1 -1
- package/dist/esm/account/AbstractedAccount.d.mts +91 -0
- package/dist/esm/account/AbstractedAccount.mjs +2 -0
- package/dist/esm/account/Account.d.mts +2 -1
- package/dist/esm/account/Account.mjs +1 -1
- package/dist/esm/account/AccountUtils.d.mts +17 -16
- package/dist/esm/account/AccountUtils.mjs +1 -1
- package/dist/esm/account/Ed25519Account.d.mts +3 -2
- package/dist/esm/account/Ed25519Account.mjs +1 -1
- package/dist/esm/account/EphemeralKeyPair.d.mts +1 -0
- package/dist/esm/account/EphemeralKeyPair.mjs +1 -1
- package/dist/esm/account/FederatedKeylessAccount.d.mts +1 -0
- package/dist/esm/account/FederatedKeylessAccount.mjs +1 -1
- package/dist/esm/account/KeylessAccount.d.mts +1 -0
- package/dist/esm/account/KeylessAccount.mjs +1 -1
- package/dist/esm/account/MultiEd25519Account.d.mts +108 -0
- package/dist/esm/account/MultiEd25519Account.mjs +2 -0
- package/dist/esm/account/MultiKeyAccount.d.mts +2 -2
- package/dist/esm/account/MultiKeyAccount.mjs +1 -1
- package/dist/esm/account/SingleKeyAccount.d.mts +1 -0
- package/dist/esm/account/SingleKeyAccount.mjs +1 -1
- package/dist/esm/account/index.d.mts +4 -0
- package/dist/esm/account/index.mjs +1 -1
- package/dist/esm/account/utils.d.mts +1 -0
- package/dist/esm/account/utils.mjs +1 -1
- package/dist/esm/api/account/abstraction.d.mts +209 -0
- package/dist/esm/api/account/abstraction.mjs +2 -0
- package/dist/esm/api/account.d.mts +4 -1
- package/dist/esm/api/account.mjs +1 -1
- package/dist/esm/api/ans.d.mts +1 -0
- package/dist/esm/api/ans.mjs +1 -1
- package/dist/esm/api/aptos.d.mts +6 -1
- package/dist/esm/api/aptos.mjs +1 -1
- package/dist/esm/api/aptosConfig.d.mts +1 -0
- package/dist/esm/api/aptosConfig.mjs +1 -1
- package/dist/esm/api/coin.d.mts +3 -2
- package/dist/esm/api/coin.mjs +1 -1
- package/dist/esm/api/digitalAsset.d.mts +1 -0
- package/dist/esm/api/digitalAsset.mjs +1 -1
- package/dist/esm/api/event.d.mts +1 -0
- package/dist/esm/api/event.mjs +1 -1
- package/dist/esm/api/experimental.d.mts +83 -0
- package/dist/esm/api/experimental.mjs +2 -0
- package/dist/esm/api/experimental.mjs.map +1 -0
- package/dist/esm/api/faucet.d.mts +1 -0
- package/dist/esm/api/faucet.mjs +1 -1
- package/dist/esm/api/fungibleAsset.d.mts +1 -0
- package/dist/esm/api/fungibleAsset.mjs +1 -1
- package/dist/esm/api/general.d.mts +1 -0
- package/dist/esm/api/general.mjs +1 -1
- package/dist/esm/api/index.d.mts +4 -0
- package/dist/esm/api/index.mjs +1 -1
- package/dist/esm/api/keyless.d.mts +2 -1
- package/dist/esm/api/keyless.mjs +1 -1
- package/dist/esm/api/object.d.mts +1 -0
- package/dist/esm/api/object.mjs +1 -1
- package/dist/esm/api/staking.d.mts +1 -0
- package/dist/esm/api/staking.mjs +1 -1
- package/dist/esm/api/table.d.mts +1 -0
- package/dist/esm/api/table.mjs +1 -1
- package/dist/esm/api/transaction.d.mts +2 -0
- package/dist/esm/api/transaction.mjs +1 -1
- package/dist/esm/api/transactionSubmission/build.d.mts +66 -0
- package/dist/esm/api/transactionSubmission/build.mjs +1 -1
- package/dist/esm/api/transactionSubmission/management.d.mts +1 -0
- package/dist/esm/api/transactionSubmission/management.mjs +1 -1
- package/dist/esm/api/transactionSubmission/sign.d.mts +1 -0
- 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 +1 -0
- package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
- package/dist/esm/api/transactionSubmission/submit.d.mts +1 -0
- 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/consts.d.mts +1 -0
- package/dist/esm/bcs/deserializer.d.mts +1 -0
- package/dist/esm/bcs/deserializer.mjs +1 -1
- package/dist/esm/bcs/index.d.mts +1 -0
- package/dist/esm/bcs/index.mjs +1 -1
- package/dist/esm/bcs/serializable/entryFunctionBytes.d.mts +1 -0
- package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +1 -1
- package/dist/esm/bcs/serializable/fixedBytes.d.mts +1 -0
- package/dist/esm/bcs/serializable/fixedBytes.mjs +1 -1
- package/dist/esm/bcs/serializable/movePrimitives.d.mts +1 -0
- package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
- package/dist/esm/bcs/serializable/moveStructs.d.mts +1 -0
- package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
- package/dist/esm/bcs/serializer.d.mts +1 -0
- package/dist/esm/bcs/serializer.mjs +1 -1
- package/dist/esm/{chunk-7IY3DTEF.mjs → chunk-27ESCVVC.mjs} +2 -2
- package/dist/esm/chunk-2SAYQUUX.mjs +2 -0
- package/dist/esm/chunk-2SAYQUUX.mjs.map +1 -0
- package/dist/esm/{chunk-VUIHJIMX.mjs → chunk-2TRQERBL.mjs} +2 -2
- package/dist/esm/chunk-2V636AYW.mjs +2 -0
- package/dist/esm/{chunk-XTJOA5QN.mjs → chunk-2YKERRHD.mjs} +2 -2
- package/dist/esm/chunk-2ZLFQBT2.mjs +2 -0
- package/dist/esm/chunk-2ZLFQBT2.mjs.map +1 -0
- package/dist/esm/{chunk-5YWH3XPN.mjs → chunk-3LDVJ2YK.mjs} +2 -2
- package/dist/esm/chunk-3OLFJ65O.mjs +2 -0
- package/dist/esm/chunk-3OLFJ65O.mjs.map +1 -0
- package/dist/esm/{chunk-ONTWK5FU.mjs → chunk-44EHAKKW.mjs} +2 -2
- package/dist/esm/{chunk-OEQ2U7GK.mjs → chunk-53IBOHXB.mjs} +2 -2
- package/dist/esm/{chunk-YCQUYDZI.mjs → chunk-5H5D6QVX.mjs} +2 -2
- package/dist/esm/{chunk-G4O6FXCF.mjs → chunk-5W2ERBGY.mjs} +2 -2
- package/dist/esm/{chunk-NYETBDSR.mjs → chunk-67A5U2X6.mjs} +2 -2
- package/dist/esm/{chunk-AXYARCYT.mjs → chunk-6IJZRG3U.mjs} +2 -2
- package/dist/esm/{chunk-N4DM5FYH.mjs → chunk-6KZT3KFZ.mjs} +2 -2
- package/dist/esm/chunk-752TOOCA.mjs +2 -0
- package/dist/esm/chunk-752TOOCA.mjs.map +1 -0
- package/dist/esm/{chunk-2WCATZVL.mjs → chunk-7A2KHJ3D.mjs} +2 -2
- package/dist/esm/{chunk-ROT6S6BM.mjs → chunk-7CRQNXR5.mjs} +2 -2
- package/dist/esm/{chunk-FZD5RWSZ.mjs → chunk-7OUPEQRN.mjs} +2 -2
- package/dist/esm/chunk-A3VO773Q.mjs +2 -0
- package/dist/esm/{chunk-OHZURQPY.mjs → chunk-AEGA5N2W.mjs} +2 -2
- package/dist/esm/{chunk-BI3BTSUB.mjs → chunk-AIPHJFJL.mjs} +2 -2
- package/dist/esm/chunk-AQWKKSRN.mjs +2 -0
- package/dist/esm/chunk-AQWKKSRN.mjs.map +1 -0
- package/dist/esm/{chunk-4EUS4E6S.mjs → chunk-B23VO5TB.mjs} +2 -2
- package/dist/esm/chunk-BHVSIRNF.mjs +2 -0
- package/dist/esm/chunk-BHVSIRNF.mjs.map +1 -0
- package/dist/esm/chunk-BMPHQ3E7.mjs +2 -0
- package/dist/esm/chunk-BPHCRTHD.mjs +2 -0
- package/dist/esm/chunk-BPHCRTHD.mjs.map +1 -0
- package/dist/esm/{chunk-DYATTONT.mjs → chunk-BQYKFATL.mjs} +2 -2
- package/dist/esm/chunk-BY3XFRUM.mjs +2 -0
- package/dist/esm/{chunk-77AEKF7K.mjs.map → chunk-BY3XFRUM.mjs.map} +1 -1
- package/dist/esm/chunk-CGTMSLVZ.mjs +2 -0
- package/dist/esm/chunk-CGTMSLVZ.mjs.map +1 -0
- package/dist/esm/{chunk-QQEK7WVP.mjs → chunk-CPAAEEF4.mjs} +2 -2
- package/dist/esm/{chunk-ZAIVZDOL.mjs → chunk-CPFQUFVD.mjs} +2 -2
- package/dist/esm/chunk-CXLNTATW.mjs +2 -0
- package/dist/esm/chunk-CXLNTATW.mjs.map +1 -0
- package/dist/esm/{chunk-ZPV7HPA4.mjs → chunk-DAJFOJ3L.mjs} +2 -2
- package/dist/esm/chunk-DOVH6HPL.mjs +2 -0
- package/dist/esm/{chunk-KOORZTHC.mjs → chunk-E5PAUR4N.mjs} +2 -2
- package/dist/esm/{chunk-E7JDVKFY.mjs → chunk-EGCL6KA6.mjs} +2 -2
- package/dist/esm/{chunk-TOBQ5UE6.mjs → chunk-ERLDXTIY.mjs} +2 -2
- package/dist/esm/chunk-FJ5J7CVW.mjs +2 -0
- package/dist/esm/chunk-FJ5J7CVW.mjs.map +1 -0
- package/dist/esm/{chunk-X6UNY6YM.mjs → chunk-FOEPRHAC.mjs} +2 -2
- package/dist/esm/{chunk-XYB6KYKW.mjs → chunk-G5F5ZOH5.mjs} +2 -2
- package/dist/esm/chunk-GFPEB22G.mjs +1 -0
- package/dist/esm/chunk-GFPEB22G.mjs.map +1 -0
- package/dist/esm/{chunk-AZWVCBK2.mjs → chunk-GI4AR6DQ.mjs} +2 -2
- package/dist/esm/{chunk-3RCAJICY.mjs → chunk-GRRBXHVG.mjs} +2 -2
- package/dist/esm/{chunk-5EYTHMRZ.mjs → chunk-GTVMJJQQ.mjs} +2 -2
- package/dist/esm/{chunk-2TJ6OTVD.mjs → chunk-GU4MD5ST.mjs} +2 -2
- package/dist/esm/chunk-H4YAL2IL.mjs +2 -0
- package/dist/esm/{chunk-ZGVNZE7J.mjs → chunk-HBTJN4RJ.mjs} +2 -2
- package/dist/esm/{chunk-IDTLNF4M.mjs → chunk-HHWJHOFZ.mjs} +2 -2
- package/dist/esm/{chunk-XZ4JRYCE.mjs → chunk-HKL4MFNL.mjs} +2 -2
- package/dist/esm/{chunk-IEUEMBFD.mjs → chunk-HVIF6DW6.mjs} +2 -2
- package/dist/esm/{chunk-MWBRD43V.mjs → chunk-HYJQHVDZ.mjs} +2 -2
- package/dist/esm/chunk-HYJQHVDZ.mjs.map +1 -0
- package/dist/esm/{chunk-JJM6ELMS.mjs → chunk-ILUFGYLO.mjs} +2 -2
- package/dist/esm/chunk-IMTC3J2M.mjs +2 -0
- package/dist/esm/chunk-IMTC3J2M.mjs.map +1 -0
- package/dist/esm/chunk-IMYNN4TW.mjs +2 -0
- package/dist/esm/chunk-IMYNN4TW.mjs.map +1 -0
- package/dist/esm/{chunk-DOQV5BSA.mjs → chunk-IOHESHLR.mjs} +2 -2
- package/dist/esm/{chunk-NBNZ53ZV.mjs → chunk-JNNFNYDO.mjs} +2 -2
- package/dist/esm/{chunk-2UXW3EB7.mjs → chunk-K233I26C.mjs} +2 -2
- package/dist/esm/{chunk-VV4HCOJQ.mjs → chunk-KK5HUWF6.mjs} +2 -2
- package/dist/esm/chunk-KSLLV3ZC.mjs +2 -0
- package/dist/esm/chunk-KSLLV3ZC.mjs.map +1 -0
- package/dist/esm/{chunk-67ZVDKJF.mjs → chunk-L6KVC7CJ.mjs} +2 -2
- package/dist/esm/{chunk-Q4C4U6I4.mjs → chunk-LQOSHBB7.mjs} +2 -2
- package/dist/esm/{chunk-XKUIMGKU.mjs → chunk-LS3IDL2N.mjs} +2 -2
- package/dist/esm/{chunk-2N5KYALM.mjs → chunk-MAWGZICD.mjs} +2 -2
- package/dist/esm/{chunk-S7RZGC56.mjs → chunk-MFLHAVIW.mjs} +2 -2
- package/dist/esm/chunk-OLGEN23M.mjs +2 -0
- package/dist/esm/chunk-OLGEN23M.mjs.map +1 -0
- package/dist/esm/{chunk-MCLYDS3O.mjs → chunk-ONGH5DXZ.mjs} +2 -2
- package/dist/esm/chunk-OPD5EKOA.mjs +2 -0
- package/dist/esm/chunk-OPD5EKOA.mjs.map +1 -0
- package/dist/esm/{chunk-4ZYPDCSP.mjs → chunk-P5CM4C2G.mjs} +2 -2
- package/dist/esm/chunk-PC25RPDV.mjs +2 -0
- package/dist/esm/chunk-PC25RPDV.mjs.map +1 -0
- package/dist/esm/{chunk-N6YTF76Q.mjs → chunk-PDAWVDI7.mjs} +2 -2
- package/dist/esm/chunk-PIPDQFL2.mjs +2 -0
- package/dist/esm/chunk-PIPDQFL2.mjs.map +1 -0
- package/dist/esm/{chunk-43GCGE6C.mjs → chunk-PWGTRRSJ.mjs} +2 -2
- package/dist/esm/{chunk-P7A5RILV.mjs → chunk-PYY2RXFP.mjs} +2 -2
- package/dist/esm/chunk-PYY2RXFP.mjs.map +1 -0
- package/dist/esm/chunk-QUJM5W4L.mjs +2 -0
- package/dist/esm/chunk-QUJM5W4L.mjs.map +1 -0
- package/dist/esm/{chunk-2FBJWTJD.mjs → chunk-QYJKCRVA.mjs} +2 -2
- package/dist/esm/chunk-R6QCPXQG.mjs +2 -0
- package/dist/esm/chunk-R6QCPXQG.mjs.map +1 -0
- package/dist/esm/{chunk-6YHDZLRN.mjs → chunk-RDPWCN4B.mjs} +2 -2
- package/dist/esm/{chunk-MT2RJ7H3.mjs → chunk-RIINVEZA.mjs} +2 -2
- package/dist/esm/{chunk-EBMEXURY.mjs → chunk-RXHER6EA.mjs} +2 -2
- package/dist/esm/chunk-SJDHW55X.mjs +2 -0
- package/dist/esm/chunk-SJDHW55X.mjs.map +1 -0
- package/dist/esm/{chunk-UC23V7PU.mjs → chunk-T7X4GZDU.mjs} +2 -2
- package/dist/esm/{chunk-QHEKBHNU.mjs → chunk-TH5JCPN2.mjs} +2 -2
- package/dist/esm/{chunk-ORMOQWWH.mjs → chunk-TKXEVD7A.mjs} +2 -2
- package/dist/esm/{chunk-FN4C3CKC.mjs → chunk-TTY5GFMN.mjs} +2 -2
- package/dist/esm/chunk-TWETGZ3W.mjs +2 -0
- package/dist/esm/chunk-TWETGZ3W.mjs.map +1 -0
- package/dist/esm/{chunk-E5HGSOG2.mjs → chunk-U4DEYWFT.mjs} +2 -2
- package/dist/esm/chunk-UIRAXHDH.mjs +1 -0
- package/dist/esm/chunk-UIRAXHDH.mjs.map +1 -0
- package/dist/esm/{chunk-OROPNHRY.mjs → chunk-UJJGIPOA.mjs} +2 -2
- package/dist/esm/{chunk-CWKNJZB6.mjs → chunk-US2HZFOM.mjs} +2 -2
- package/dist/esm/{chunk-XY43TPRH.mjs → chunk-VDYUMBOT.mjs} +2 -2
- package/dist/esm/chunk-VHY6ZATX.mjs +2 -0
- package/dist/esm/chunk-VHY6ZATX.mjs.map +1 -0
- package/dist/esm/chunk-VWZEJTGP.mjs +4 -0
- package/dist/esm/chunk-VWZEJTGP.mjs.map +1 -0
- package/dist/esm/{chunk-WUWPN7XV.mjs → chunk-W2C5KRUQ.mjs} +2 -2
- package/dist/esm/{chunk-OR6GFWLG.mjs → chunk-W4SMZ6IW.mjs} +2 -2
- package/dist/esm/chunk-WFKPVKU3.mjs +2 -0
- package/dist/esm/chunk-WFKPVKU3.mjs.map +1 -0
- package/dist/esm/{chunk-5VMAJTTV.mjs → chunk-WHVCUVZP.mjs} +2 -2
- package/dist/esm/{chunk-WQRGDSPD.mjs → chunk-WLDYBSOG.mjs} +2 -2
- package/dist/esm/chunk-XRVZAEQO.mjs +2 -0
- package/dist/esm/chunk-XRVZAEQO.mjs.map +1 -0
- package/dist/esm/chunk-XSBUL2WP.mjs +2 -0
- package/dist/esm/chunk-XSBUL2WP.mjs.map +1 -0
- package/dist/esm/{chunk-BGSEBFFC.mjs → chunk-XW3BXTCZ.mjs} +2 -2
- package/dist/esm/{chunk-6CXMDJQR.mjs → chunk-Y65PKZLK.mjs} +2 -2
- package/dist/esm/{chunk-NWLJ6RW7.mjs → chunk-YAGIE4GN.mjs} +2 -2
- package/dist/esm/{chunk-M77M6NSB.mjs → chunk-YLUULY6G.mjs} +2 -2
- package/dist/esm/{chunk-5EBUWO2M.mjs → chunk-YWSDONJJ.mjs} +2 -2
- package/dist/esm/{chunk-V6VPMNWJ.mjs → chunk-YXYYII5S.mjs} +2 -2
- package/dist/esm/{chunk-XTOIL6MB.mjs → chunk-ZD2TY5N3.mjs} +2 -2
- package/dist/esm/{chunk-FIEMUPXF.mjs → chunk-ZS2IVRHT.mjs} +2 -2
- package/dist/esm/cli/index.d.mts +1 -0
- package/dist/esm/cli/index.mjs +1 -1
- package/dist/esm/cli/localNode.mjs +1 -1
- package/dist/esm/cli/move.d.mts +1 -0
- package/dist/esm/client/core.d.mts +37 -1
- package/dist/esm/client/core.mjs +1 -1
- package/dist/esm/client/get.d.mts +36 -1
- package/dist/esm/client/get.mjs +1 -1
- package/dist/esm/client/index.d.mts +4 -3
- package/dist/esm/client/index.mjs +1 -1
- package/dist/esm/client/post.d.mts +35 -1
- package/dist/esm/client/post.mjs +1 -1
- package/dist/esm/core/account/index.d.mts +1 -0
- package/dist/esm/core/account/index.mjs +1 -1
- package/dist/esm/core/account/utils/address.d.mts +1 -0
- package/dist/esm/core/account/utils/address.mjs +1 -1
- package/dist/esm/core/account/utils/index.d.mts +1 -0
- package/dist/esm/core/account/utils/index.mjs +1 -1
- package/dist/esm/core/accountAddress.d.mts +1 -0
- package/dist/esm/core/accountAddress.mjs +1 -1
- package/dist/esm/core/authenticationKey.d.mts +1 -0
- package/dist/esm/core/authenticationKey.mjs +1 -1
- package/dist/esm/core/crypto/abstraction.d.mts +30 -0
- package/dist/esm/core/crypto/abstraction.mjs +2 -0
- package/dist/esm/core/crypto/abstraction.mjs.map +1 -0
- package/dist/esm/core/crypto/ed25519.d.mts +1 -0
- package/dist/esm/core/crypto/ed25519.mjs +1 -1
- package/dist/esm/core/crypto/ephemeral.d.mts +1 -0
- package/dist/esm/core/crypto/ephemeral.mjs +1 -1
- package/dist/esm/core/crypto/federatedKeyless.d.mts +1 -0
- package/dist/esm/core/crypto/federatedKeyless.mjs +1 -1
- package/dist/esm/core/crypto/index.d.mts +2 -1
- package/dist/esm/core/crypto/index.mjs +1 -1
- package/dist/esm/core/crypto/keyless.d.mts +1 -0
- package/dist/esm/core/crypto/keyless.mjs +1 -1
- package/dist/esm/core/crypto/multiEd25519.d.mts +18 -2
- package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
- package/dist/esm/core/crypto/multiKey.d.mts +34 -15
- package/dist/esm/core/crypto/multiKey.mjs +1 -1
- package/dist/esm/core/crypto/privateKey.d.mts +1 -0
- package/dist/esm/core/crypto/privateKey.mjs +1 -1
- package/dist/esm/core/crypto/proof.d.mts +1 -0
- package/dist/esm/core/crypto/proof.mjs +1 -1
- package/dist/esm/core/crypto/publicKey.d.mts +1 -0
- package/dist/esm/core/crypto/publicKey.mjs +1 -1
- package/dist/esm/core/crypto/secp256k1.d.mts +1 -0
- package/dist/esm/core/crypto/secp256k1.mjs +1 -1
- package/dist/esm/core/crypto/signature.d.mts +1 -0
- package/dist/esm/core/crypto/signature.mjs +1 -1
- package/dist/esm/core/crypto/singleKey.d.mts +1 -0
- package/dist/esm/core/crypto/singleKey.mjs +1 -1
- package/dist/esm/core/crypto/utils.d.mts +1 -0
- package/dist/esm/core/crypto/utils.mjs +1 -1
- package/dist/esm/core/hex.d.mts +1 -0
- package/dist/esm/core/hex.mjs +1 -1
- package/dist/esm/core/index.d.mts +2 -1
- package/dist/esm/core/index.mjs +1 -1
- package/dist/esm/errors/index.d.mts +1 -0
- package/dist/esm/errors/index.mjs +1 -1
- package/dist/esm/index.d.mts +16 -9
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/internal/abstraction.d.mts +55 -0
- package/dist/esm/internal/abstraction.mjs +2 -0
- package/dist/esm/internal/abstraction.mjs.map +1 -0
- package/dist/esm/internal/account.d.mts +1 -0
- package/dist/esm/internal/account.mjs +1 -1
- package/dist/esm/internal/ans.d.mts +1 -0
- package/dist/esm/internal/ans.mjs +1 -1
- package/dist/esm/internal/coin.d.mts +1 -0
- package/dist/esm/internal/coin.mjs +1 -1
- package/dist/esm/internal/digitalAsset.d.mts +1 -0
- package/dist/esm/internal/digitalAsset.mjs +1 -1
- package/dist/esm/internal/event.d.mts +1 -0
- package/dist/esm/internal/event.mjs +1 -1
- package/dist/esm/internal/experimental.d.mts +52 -0
- package/dist/esm/internal/experimental.mjs +2 -0
- package/dist/esm/internal/experimental.mjs.map +1 -0
- package/dist/esm/internal/faucet.d.mts +1 -0
- package/dist/esm/internal/faucet.mjs +1 -1
- package/dist/esm/internal/fungibleAsset.d.mts +1 -0
- package/dist/esm/internal/fungibleAsset.mjs +1 -1
- package/dist/esm/internal/general.d.mts +1 -0
- package/dist/esm/internal/general.mjs +1 -1
- package/dist/esm/internal/keyless.d.mts +1 -0
- package/dist/esm/internal/keyless.mjs +1 -1
- package/dist/esm/internal/object.d.mts +1 -0
- package/dist/esm/internal/object.mjs +1 -1
- package/dist/esm/internal/staking.d.mts +1 -0
- package/dist/esm/internal/staking.mjs +1 -1
- package/dist/esm/internal/table.d.mts +1 -0
- package/dist/esm/internal/table.mjs +1 -1
- package/dist/esm/internal/transaction.d.mts +1 -0
- package/dist/esm/internal/transaction.mjs +1 -1
- package/dist/esm/internal/transactionSubmission.d.mts +1 -0
- package/dist/esm/internal/transactionSubmission.mjs +1 -1
- package/dist/esm/internal/view.d.mts +1 -0
- package/dist/esm/internal/view.mjs +1 -1
- package/dist/esm/transactions/authenticator/account.d.mts +12 -3
- 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 +3 -2
- package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
- package/dist/esm/transactions/index.d.mts +6 -4
- package/dist/esm/transactions/index.mjs +1 -1
- package/dist/esm/transactions/instances/chainId.d.mts +1 -0
- package/dist/esm/transactions/instances/chainId.mjs +1 -1
- package/dist/esm/transactions/instances/identifier.d.mts +1 -0
- package/dist/esm/transactions/instances/identifier.mjs +1 -1
- package/dist/esm/transactions/instances/index.d.mts +1 -0
- package/dist/esm/transactions/instances/index.mjs +1 -1
- package/dist/esm/transactions/instances/moduleId.d.mts +1 -0
- package/dist/esm/transactions/instances/moduleId.mjs +1 -1
- package/dist/esm/transactions/instances/multiAgentTransaction.d.mts +1 -0
- package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/rawTransaction.d.mts +1 -0
- package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/rotationProofChallenge.d.mts +1 -0
- package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
- package/dist/esm/transactions/instances/signedTransaction.d.mts +5 -4
- package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/simpleTransaction.d.mts +1 -0
- package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/transactionArgument.d.mts +1 -0
- package/dist/esm/transactions/instances/transactionPayload.d.mts +1 -0
- package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
- package/dist/esm/transactions/management/accountSequenceNumber.d.mts +1 -0
- package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
- package/dist/esm/transactions/management/index.d.mts +1 -0
- package/dist/esm/transactions/management/index.mjs +1 -1
- package/dist/esm/transactions/management/transactionWorker.d.mts +1 -0
- package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
- package/dist/esm/transactions/scriptComposer/index.d.mts +53 -0
- package/dist/esm/transactions/scriptComposer/index.mjs +2 -0
- package/dist/esm/transactions/scriptComposer/index.mjs.map +1 -0
- package/dist/esm/transactions/transactionBuilder/helpers.d.mts +3 -17
- package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/index.d.mts +3 -2
- package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +23 -2
- package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/signingMessage.d.mts +1 -0
- package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +1 -0
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
- package/dist/esm/transactions/typeTag/index.d.mts +1 -0
- package/dist/esm/transactions/typeTag/index.mjs +1 -1
- package/dist/esm/transactions/typeTag/parser.d.mts +1 -0
- package/dist/esm/transactions/typeTag/parser.mjs +1 -1
- package/dist/esm/transactions/types.d.mts +10 -1
- package/dist/esm/types/abstraction.d.mts +8 -0
- package/dist/esm/types/abstraction.mjs +2 -0
- package/dist/esm/types/abstraction.mjs.map +1 -0
- package/dist/esm/types/index.d.mts +1 -0
- package/dist/esm/types/index.mjs +1 -1
- package/dist/esm/types/types.d.mts +22 -1
- package/dist/esm/types/types.mjs +1 -1
- package/dist/esm/utils/helpers.d.mts +19 -2
- package/dist/esm/utils/helpers.mjs +1 -1
- package/dist/esm/utils/index.d.mts +2 -1
- package/dist/esm/utils/index.mjs +1 -1
- package/dist/esm/utils/normalizeBundle.d.mts +1 -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 +21 -19
- package/src/account/AbstractedAccount.ts +111 -0
- package/src/account/MultiEd25519Account.ts +154 -0
- package/src/account/MultiKeyAccount.ts +1 -2
- package/src/account/index.ts +2 -0
- package/src/api/account/abstraction.ts +239 -0
- package/src/api/account.ts +7 -2
- package/src/api/aptos.ts +9 -0
- package/src/api/aptosConfig.ts +2 -2
- package/src/api/experimental.ts +64 -0
- package/src/api/transactionSubmission/build.ts +85 -2
- package/src/client/core.ts +120 -0
- package/src/client/get.ts +73 -1
- package/src/client/post.ts +70 -1
- package/src/core/crypto/abstraction.ts +47 -0
- package/src/core/crypto/multiEd25519.ts +19 -3
- package/src/core/crypto/multiKey.ts +76 -52
- package/src/core/hex.ts +3 -1
- package/src/internal/abstraction.ts +79 -0
- package/src/internal/experimental.ts +55 -0
- package/src/internal/view.ts +4 -4
- package/src/transactions/authenticator/account.ts +52 -1
- package/src/transactions/index.ts +1 -0
- package/src/transactions/scriptComposer/index.ts +87 -0
- package/src/transactions/transactionBuilder/helpers.ts +1 -22
- package/src/transactions/transactionBuilder/remoteAbi.ts +62 -1
- package/src/transactions/transactionBuilder/transactionBuilder.ts +9 -1
- package/src/transactions/types.ts +11 -0
- package/src/types/abstraction.ts +6 -0
- package/src/types/index.ts +1 -0
- package/src/types/types.ts +21 -0
- package/src/utils/helpers.ts +28 -1
- package/src/version.ts +1 -1
- package/dist/common/chunk-IHUCZKG2.js +0 -2
- package/dist/common/chunk-IHUCZKG2.js.map +0 -1
- package/dist/esm/chunk-4YLUM62M.mjs +0 -2
- package/dist/esm/chunk-5PXDPMF2.mjs +0 -4
- package/dist/esm/chunk-5PXDPMF2.mjs.map +0 -1
- package/dist/esm/chunk-6IEZPA4H.mjs +0 -2
- package/dist/esm/chunk-6IEZPA4H.mjs.map +0 -1
- package/dist/esm/chunk-6YWYAVFS.mjs +0 -2
- package/dist/esm/chunk-6YWYAVFS.mjs.map +0 -1
- package/dist/esm/chunk-77AEKF7K.mjs +0 -2
- package/dist/esm/chunk-AFEHO5PP.mjs +0 -2
- package/dist/esm/chunk-AFEHO5PP.mjs.map +0 -1
- package/dist/esm/chunk-DAFSKSZ5.mjs +0 -2
- package/dist/esm/chunk-DAFSKSZ5.mjs.map +0 -1
- package/dist/esm/chunk-DPW6ELCQ.mjs +0 -2
- package/dist/esm/chunk-EMURYYVO.mjs +0 -2
- package/dist/esm/chunk-F2ZTBAJJ.mjs +0 -2
- package/dist/esm/chunk-F2ZTBAJJ.mjs.map +0 -1
- package/dist/esm/chunk-FD6FGKYY.mjs +0 -1
- package/dist/esm/chunk-GP4TLDVZ.mjs +0 -1
- package/dist/esm/chunk-HBH2NQKU.mjs +0 -2
- package/dist/esm/chunk-HBH2NQKU.mjs.map +0 -1
- package/dist/esm/chunk-I5OYNCZS.mjs +0 -1
- package/dist/esm/chunk-JBEUUULP.mjs +0 -2
- package/dist/esm/chunk-JBEUUULP.mjs.map +0 -1
- package/dist/esm/chunk-KVM2SGSF.mjs +0 -2
- package/dist/esm/chunk-KVM2SGSF.mjs.map +0 -1
- package/dist/esm/chunk-MLSAZJZK.mjs +0 -2
- package/dist/esm/chunk-MLSAZJZK.mjs.map +0 -1
- package/dist/esm/chunk-MWBRD43V.mjs.map +0 -1
- package/dist/esm/chunk-OSBRPVVI.mjs +0 -2
- package/dist/esm/chunk-OSBRPVVI.mjs.map +0 -1
- package/dist/esm/chunk-P7A5RILV.mjs.map +0 -1
- package/dist/esm/chunk-QHC5DKVZ.mjs +0 -2
- package/dist/esm/chunk-QHC5DKVZ.mjs.map +0 -1
- package/dist/esm/chunk-S4LZMY2L.mjs +0 -2
- package/dist/esm/chunk-S4LZMY2L.mjs.map +0 -1
- package/dist/esm/chunk-STY74NUA.mjs +0 -2
- package/dist/esm/chunk-STY74NUA.mjs.map +0 -1
- package/dist/esm/chunk-U2PRGW4O.mjs +0 -2
- package/dist/esm/chunk-U2PRGW4O.mjs.map +0 -1
- package/dist/esm/chunk-VVXBVJXD.mjs +0 -2
- package/dist/esm/chunk-VVXBVJXD.mjs.map +0 -1
- package/dist/esm/chunk-WCMW2L3P.mjs +0 -2
- package/dist/esm/chunk-XJJVJOX5.mjs +0 -2
- /package/dist/esm/{chunk-FD6FGKYY.mjs.map → account/AbstractedAccount.mjs.map} +0 -0
- /package/dist/esm/{chunk-GP4TLDVZ.mjs.map → account/MultiEd25519Account.mjs.map} +0 -0
- /package/dist/esm/{chunk-I5OYNCZS.mjs.map → api/account/abstraction.mjs.map} +0 -0
- /package/dist/esm/{chunk-7IY3DTEF.mjs.map → chunk-27ESCVVC.mjs.map} +0 -0
- /package/dist/esm/{chunk-VUIHJIMX.mjs.map → chunk-2TRQERBL.mjs.map} +0 -0
- /package/dist/esm/{chunk-XJJVJOX5.mjs.map → chunk-2V636AYW.mjs.map} +0 -0
- /package/dist/esm/{chunk-XTJOA5QN.mjs.map → chunk-2YKERRHD.mjs.map} +0 -0
- /package/dist/esm/{chunk-5YWH3XPN.mjs.map → chunk-3LDVJ2YK.mjs.map} +0 -0
- /package/dist/esm/{chunk-ONTWK5FU.mjs.map → chunk-44EHAKKW.mjs.map} +0 -0
- /package/dist/esm/{chunk-OEQ2U7GK.mjs.map → chunk-53IBOHXB.mjs.map} +0 -0
- /package/dist/esm/{chunk-YCQUYDZI.mjs.map → chunk-5H5D6QVX.mjs.map} +0 -0
- /package/dist/esm/{chunk-G4O6FXCF.mjs.map → chunk-5W2ERBGY.mjs.map} +0 -0
- /package/dist/esm/{chunk-NYETBDSR.mjs.map → chunk-67A5U2X6.mjs.map} +0 -0
- /package/dist/esm/{chunk-AXYARCYT.mjs.map → chunk-6IJZRG3U.mjs.map} +0 -0
- /package/dist/esm/{chunk-N4DM5FYH.mjs.map → chunk-6KZT3KFZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-2WCATZVL.mjs.map → chunk-7A2KHJ3D.mjs.map} +0 -0
- /package/dist/esm/{chunk-ROT6S6BM.mjs.map → chunk-7CRQNXR5.mjs.map} +0 -0
- /package/dist/esm/{chunk-FZD5RWSZ.mjs.map → chunk-7OUPEQRN.mjs.map} +0 -0
- /package/dist/esm/{chunk-WCMW2L3P.mjs.map → chunk-A3VO773Q.mjs.map} +0 -0
- /package/dist/esm/{chunk-OHZURQPY.mjs.map → chunk-AEGA5N2W.mjs.map} +0 -0
- /package/dist/esm/{chunk-BI3BTSUB.mjs.map → chunk-AIPHJFJL.mjs.map} +0 -0
- /package/dist/esm/{chunk-4EUS4E6S.mjs.map → chunk-B23VO5TB.mjs.map} +0 -0
- /package/dist/esm/{chunk-4YLUM62M.mjs.map → chunk-BMPHQ3E7.mjs.map} +0 -0
- /package/dist/esm/{chunk-DYATTONT.mjs.map → chunk-BQYKFATL.mjs.map} +0 -0
- /package/dist/esm/{chunk-QQEK7WVP.mjs.map → chunk-CPAAEEF4.mjs.map} +0 -0
- /package/dist/esm/{chunk-ZAIVZDOL.mjs.map → chunk-CPFQUFVD.mjs.map} +0 -0
- /package/dist/esm/{chunk-ZPV7HPA4.mjs.map → chunk-DAJFOJ3L.mjs.map} +0 -0
- /package/dist/esm/{chunk-DPW6ELCQ.mjs.map → chunk-DOVH6HPL.mjs.map} +0 -0
- /package/dist/esm/{chunk-KOORZTHC.mjs.map → chunk-E5PAUR4N.mjs.map} +0 -0
- /package/dist/esm/{chunk-E7JDVKFY.mjs.map → chunk-EGCL6KA6.mjs.map} +0 -0
- /package/dist/esm/{chunk-TOBQ5UE6.mjs.map → chunk-ERLDXTIY.mjs.map} +0 -0
- /package/dist/esm/{chunk-X6UNY6YM.mjs.map → chunk-FOEPRHAC.mjs.map} +0 -0
- /package/dist/esm/{chunk-XYB6KYKW.mjs.map → chunk-G5F5ZOH5.mjs.map} +0 -0
- /package/dist/esm/{chunk-AZWVCBK2.mjs.map → chunk-GI4AR6DQ.mjs.map} +0 -0
- /package/dist/esm/{chunk-3RCAJICY.mjs.map → chunk-GRRBXHVG.mjs.map} +0 -0
- /package/dist/esm/{chunk-5EYTHMRZ.mjs.map → chunk-GTVMJJQQ.mjs.map} +0 -0
- /package/dist/esm/{chunk-2TJ6OTVD.mjs.map → chunk-GU4MD5ST.mjs.map} +0 -0
- /package/dist/esm/{chunk-EMURYYVO.mjs.map → chunk-H4YAL2IL.mjs.map} +0 -0
- /package/dist/esm/{chunk-ZGVNZE7J.mjs.map → chunk-HBTJN4RJ.mjs.map} +0 -0
- /package/dist/esm/{chunk-IDTLNF4M.mjs.map → chunk-HHWJHOFZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-XZ4JRYCE.mjs.map → chunk-HKL4MFNL.mjs.map} +0 -0
- /package/dist/esm/{chunk-IEUEMBFD.mjs.map → chunk-HVIF6DW6.mjs.map} +0 -0
- /package/dist/esm/{chunk-JJM6ELMS.mjs.map → chunk-ILUFGYLO.mjs.map} +0 -0
- /package/dist/esm/{chunk-DOQV5BSA.mjs.map → chunk-IOHESHLR.mjs.map} +0 -0
- /package/dist/esm/{chunk-NBNZ53ZV.mjs.map → chunk-JNNFNYDO.mjs.map} +0 -0
- /package/dist/esm/{chunk-2UXW3EB7.mjs.map → chunk-K233I26C.mjs.map} +0 -0
- /package/dist/esm/{chunk-VV4HCOJQ.mjs.map → chunk-KK5HUWF6.mjs.map} +0 -0
- /package/dist/esm/{chunk-67ZVDKJF.mjs.map → chunk-L6KVC7CJ.mjs.map} +0 -0
- /package/dist/esm/{chunk-Q4C4U6I4.mjs.map → chunk-LQOSHBB7.mjs.map} +0 -0
- /package/dist/esm/{chunk-XKUIMGKU.mjs.map → chunk-LS3IDL2N.mjs.map} +0 -0
- /package/dist/esm/{chunk-2N5KYALM.mjs.map → chunk-MAWGZICD.mjs.map} +0 -0
- /package/dist/esm/{chunk-S7RZGC56.mjs.map → chunk-MFLHAVIW.mjs.map} +0 -0
- /package/dist/esm/{chunk-MCLYDS3O.mjs.map → chunk-ONGH5DXZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-4ZYPDCSP.mjs.map → chunk-P5CM4C2G.mjs.map} +0 -0
- /package/dist/esm/{chunk-N6YTF76Q.mjs.map → chunk-PDAWVDI7.mjs.map} +0 -0
- /package/dist/esm/{chunk-43GCGE6C.mjs.map → chunk-PWGTRRSJ.mjs.map} +0 -0
- /package/dist/esm/{chunk-2FBJWTJD.mjs.map → chunk-QYJKCRVA.mjs.map} +0 -0
- /package/dist/esm/{chunk-6YHDZLRN.mjs.map → chunk-RDPWCN4B.mjs.map} +0 -0
- /package/dist/esm/{chunk-MT2RJ7H3.mjs.map → chunk-RIINVEZA.mjs.map} +0 -0
- /package/dist/esm/{chunk-EBMEXURY.mjs.map → chunk-RXHER6EA.mjs.map} +0 -0
- /package/dist/esm/{chunk-UC23V7PU.mjs.map → chunk-T7X4GZDU.mjs.map} +0 -0
- /package/dist/esm/{chunk-QHEKBHNU.mjs.map → chunk-TH5JCPN2.mjs.map} +0 -0
- /package/dist/esm/{chunk-ORMOQWWH.mjs.map → chunk-TKXEVD7A.mjs.map} +0 -0
- /package/dist/esm/{chunk-FN4C3CKC.mjs.map → chunk-TTY5GFMN.mjs.map} +0 -0
- /package/dist/esm/{chunk-E5HGSOG2.mjs.map → chunk-U4DEYWFT.mjs.map} +0 -0
- /package/dist/esm/{chunk-OROPNHRY.mjs.map → chunk-UJJGIPOA.mjs.map} +0 -0
- /package/dist/esm/{chunk-CWKNJZB6.mjs.map → chunk-US2HZFOM.mjs.map} +0 -0
- /package/dist/esm/{chunk-XY43TPRH.mjs.map → chunk-VDYUMBOT.mjs.map} +0 -0
- /package/dist/esm/{chunk-WUWPN7XV.mjs.map → chunk-W2C5KRUQ.mjs.map} +0 -0
- /package/dist/esm/{chunk-OR6GFWLG.mjs.map → chunk-W4SMZ6IW.mjs.map} +0 -0
- /package/dist/esm/{chunk-5VMAJTTV.mjs.map → chunk-WHVCUVZP.mjs.map} +0 -0
- /package/dist/esm/{chunk-WQRGDSPD.mjs.map → chunk-WLDYBSOG.mjs.map} +0 -0
- /package/dist/esm/{chunk-BGSEBFFC.mjs.map → chunk-XW3BXTCZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-6CXMDJQR.mjs.map → chunk-Y65PKZLK.mjs.map} +0 -0
- /package/dist/esm/{chunk-NWLJ6RW7.mjs.map → chunk-YAGIE4GN.mjs.map} +0 -0
- /package/dist/esm/{chunk-M77M6NSB.mjs.map → chunk-YLUULY6G.mjs.map} +0 -0
- /package/dist/esm/{chunk-5EBUWO2M.mjs.map → chunk-YWSDONJJ.mjs.map} +0 -0
- /package/dist/esm/{chunk-V6VPMNWJ.mjs.map → chunk-YXYYII5S.mjs.map} +0 -0
- /package/dist/esm/{chunk-XTOIL6MB.mjs.map → chunk-ZD2TY5N3.mjs.map} +0 -0
- /package/dist/esm/{chunk-FIEMUPXF.mjs.map → chunk-ZS2IVRHT.mjs.map} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/transactions/transactionBuilder/transactionBuilder.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * This file handles the transaction creation lifecycle.\n * It holds different operations to generate a transaction payload, a raw transaction,\n * and a signed transaction that can be simulated, signed and submitted to chain.\n */\nimport { sha3_256 as sha3Hash } from \"@noble/hashes/sha3\";\nimport { AptosConfig } from \"../../api/aptosConfig\";\nimport { AccountAddress, AccountAddressInput, Hex, PublicKey } from \"../../core\";\nimport {\n AnyPublicKey,\n AnySignature,\n KeylessPublicKey,\n KeylessSignature,\n Secp256k1PublicKey,\n FederatedKeylessPublicKey,\n MultiKey,\n MultiKeySignature,\n} from \"../../core/crypto\";\nimport { Ed25519PublicKey, Ed25519Signature } from \"../../core/crypto/ed25519\";\nimport { getInfo } from \"../../internal/account\";\nimport { getLedgerInfo } from \"../../internal/general\";\nimport { getGasPriceEstimation } from \"../../internal/transaction\";\nimport { NetworkToChainId } from \"../../utils/apiEndpoints\";\nimport { DEFAULT_MAX_GAS_AMOUNT, DEFAULT_TXN_EXP_SEC_FROM_NOW } from \"../../utils/const\";\nimport { normalizeBundle } from \"../../utils/normalizeBundle\";\nimport {\n AccountAuthenticator,\n AccountAuthenticatorEd25519,\n AccountAuthenticatorMultiKey,\n AccountAuthenticatorNoAccountAuthenticator,\n AccountAuthenticatorSingleKey,\n} from \"../authenticator/account\";\nimport {\n TransactionAuthenticator,\n TransactionAuthenticatorEd25519,\n TransactionAuthenticatorFeePayer,\n TransactionAuthenticatorMultiAgent,\n TransactionAuthenticatorSingleSender,\n} from \"../authenticator/transaction\";\nimport {\n ChainId,\n EntryFunction,\n FeePayerRawTransaction,\n MultiAgentRawTransaction,\n MultiSig,\n MultiSigTransactionPayload,\n RawTransaction,\n Script,\n TransactionPayloadEntryFunction,\n TransactionPayloadMultiSig,\n TransactionPayloadScript,\n} from \"../instances\";\nimport { SignedTransaction } from \"../instances/signedTransaction\";\nimport {\n AnyRawTransaction,\n AnyTransactionPayloadInstance,\n EntryFunctionArgumentTypes,\n InputGenerateMultiAgentRawTransactionArgs,\n InputGenerateRawTransactionArgs,\n InputGenerateSingleSignerRawTransactionArgs,\n InputGenerateTransactionOptions,\n InputScriptData,\n InputSimulateTransactionData,\n InputMultiSigDataWithRemoteABI,\n InputEntryFunctionDataWithRemoteABI,\n InputGenerateTransactionPayloadDataWithRemoteABI,\n InputSubmitTransactionData,\n InputGenerateTransactionPayloadDataWithABI,\n InputEntryFunctionDataWithABI,\n InputMultiSigDataWithABI,\n InputViewFunctionDataWithRemoteABI,\n InputViewFunctionDataWithABI,\n FunctionABI,\n} from \"../types\";\nimport { convertArgument, fetchEntryFunctionAbi, fetchViewFunctionAbi, standardizeTypeTags } from \"./remoteAbi\";\nimport { memoizeAsync } from \"../../utils/memoize\";\nimport { getFunctionParts, isScriptDataInput } from \"./helpers\";\nimport { SimpleTransaction } from \"../instances/simpleTransaction\";\nimport { MultiAgentTransaction } from \"../instances/multiAgentTransaction\";\n\n/**\n * Builds a transaction payload based on the provided arguments and returns a transaction payload.\n * This function uses the RemoteABI by default, but can also utilize a specified ABI.\n * When we call our `generateTransactionPayload` function with the relevant type properties,\n * Typescript can infer the return type based on the appropriate function overload.\n * @param args - The input data for generating the transaction payload.\n * @param args.function - The function to be called, specified in the format \"moduleAddress::moduleName::functionName\".\n * @param args.functionArguments - The arguments to pass to the function.\n * @param args.typeArguments - The type arguments for the function.\n * @param args.aptosConfig - The configuration settings for Aptos.\n * @param args.abi - The ABI to use for the transaction, if not using the RemoteABI.\n *\n * @returns TransactionPayload - The generated transaction payload, which can be of type TransactionPayloadScript,\n * TransactionPayloadMultiSig, or TransactionPayloadEntryFunction.\n * @group Implementation\n * @category Transactions\n */\nexport async function generateTransactionPayload(args: InputScriptData): Promise<TransactionPayloadScript>;\n/**\n * @group Implementation\n * @category Transactions\n */\nexport async function generateTransactionPayload(\n args: InputEntryFunctionDataWithRemoteABI,\n): Promise<TransactionPayloadEntryFunction>;\n/**\n * @group Implementation\n * @category Transactions\n */\nexport async function generateTransactionPayload(\n args: InputMultiSigDataWithRemoteABI,\n): Promise<TransactionPayloadMultiSig>;\n\n/**\n * Builds a transaction payload based on the data argument and returns\n * a transaction payload - TransactionPayloadScript | TransactionPayloadMultiSig | TransactionPayloadEntryFunction\n *\n * This uses the RemoteABI by default, and the remote ABI can be skipped by using generateTransactionPayloadWithABI\n *\n * @param args.data GenerateTransactionPayloadData\n *\n * @return TransactionPayload\n * @group Implementation\n * @category Transactions\n */\nexport async function generateTransactionPayload(\n args: InputGenerateTransactionPayloadDataWithRemoteABI,\n): Promise<AnyTransactionPayloadInstance> {\n if (isScriptDataInput(args)) {\n return generateTransactionPayloadScript(args);\n }\n const { moduleAddress, moduleName, functionName } = getFunctionParts(args.function);\n\n const functionAbi = await fetchAbi({\n key: \"entry-function\",\n moduleAddress,\n moduleName,\n functionName,\n aptosConfig: args.aptosConfig,\n abi: args.abi,\n fetch: fetchEntryFunctionAbi,\n });\n\n // Fill in the ABI\n return generateTransactionPayloadWithABI({ ...args, abi: functionAbi });\n}\n\n/**\n * Generates a transaction payload using the provided ABI and function details.\n * This function helps create a properly structured transaction payload for executing a specific function on a module.\n *\n * @param args - The input data required to generate the transaction payload.\n * @param args.abi - The ABI of the function to be executed.\n * @param args.function - The fully qualified name of the function in the format `moduleAddress::moduleName::functionName`.\n * @param args.typeArguments - An array of type arguments that correspond to the function's type parameters.\n * @param args.functionArguments - An array of arguments to be passed to the function.\n * @param args.multisigAddress - (Optional) The address for a multisig transaction if applicable.\n *\n * @throws Error if the type argument count does not match the ABI or if the number of function arguments is incorrect.\n * @group Implementation\n * @category Transactions\n */\nexport function generateTransactionPayloadWithABI(args: InputEntryFunctionDataWithABI): TransactionPayloadEntryFunction;\n/**\n * @group Implementation\n * @category Transactions\n */\nexport function generateTransactionPayloadWithABI(args: InputMultiSigDataWithABI): TransactionPayloadMultiSig;\n/**\n * @group Implementation\n * @category Transactions\n */\nexport function generateTransactionPayloadWithABI(\n args: InputGenerateTransactionPayloadDataWithABI,\n): AnyTransactionPayloadInstance {\n const functionAbi = args.abi;\n const { moduleAddress, moduleName, functionName } = getFunctionParts(args.function);\n\n // Ensure that all type arguments are typed properly\n const typeArguments = standardizeTypeTags(args.typeArguments);\n\n // Check the type argument count against the ABI\n if (typeArguments.length !== functionAbi.typeParameters.length) {\n throw new Error(\n `Type argument count mismatch, expected ${functionAbi.typeParameters.length}, received ${typeArguments.length}`,\n );\n }\n\n // Check all BCS types, and convert any non-BCS types\n const functionArguments: Array<EntryFunctionArgumentTypes> = args.functionArguments.map((arg, i) =>\n /**\n * Converts the argument for a specified function using its ABI and type arguments.\n * This function helps ensure that the correct number of arguments is provided for the function call.\n *\n * @param args - The arguments for the function call.\n * @param args.function - The specific function to be invoked.\n * @param functionAbi - The ABI (Application Binary Interface) of the function, which includes parameter details.\n * @param arg - The argument to be converted.\n * @param i - The index of the argument in the function call.\n * @param typeArguments - Additional type arguments that may be required for the conversion.\n * @group Implementation\n * @category Transactions\n */\n // TODO: Fix JSDoc\n convertArgument(args.function, functionAbi, arg, i, typeArguments),\n );\n\n // Check that all arguments are accounted for\n if (functionArguments.length !== functionAbi.parameters.length) {\n throw new Error(\n // eslint-disable-next-line max-len\n `Too few arguments for '${moduleAddress}::${moduleName}::${functionName}', expected ${functionAbi.parameters.length} but got ${functionArguments.length}`,\n );\n }\n\n // Generate entry function payload\n const entryFunctionPayload = EntryFunction.build(\n `${moduleAddress}::${moduleName}`,\n functionName,\n typeArguments,\n functionArguments,\n );\n\n // Send it as multi sig if it's a multisig payload\n if (\"multisigAddress\" in args) {\n const multisigAddress = AccountAddress.from(args.multisigAddress);\n return new TransactionPayloadMultiSig(\n new MultiSig(multisigAddress, new MultiSigTransactionPayload(entryFunctionPayload)),\n );\n }\n\n // Otherwise send as an entry function\n return new TransactionPayloadEntryFunction(entryFunctionPayload);\n}\n\n/**\n * Generates the payload for a view function call using the provided arguments.\n * This function helps in preparing the necessary data to interact with a specific view function on the blockchain.\n *\n * @param args - The input data required to generate the view function payload.\n * @param args.function - The function identifier in the format \"moduleAddress::moduleName::functionName\".\n * @param args.aptosConfig - Configuration settings for the Aptos client.\n * @param args.abi - The ABI (Application Binary Interface) of the module.\n *\n * @returns The generated payload for the view function call.\n * @group Implementation\n * @category Transactions\n */\nexport async function generateViewFunctionPayload(args: InputViewFunctionDataWithRemoteABI): Promise<EntryFunction> {\n const { moduleAddress, moduleName, functionName } = getFunctionParts(args.function);\n\n const functionAbi = await fetchAbi({\n key: \"view-function\",\n moduleAddress,\n moduleName,\n functionName,\n aptosConfig: args.aptosConfig,\n abi: args.abi,\n fetch: fetchViewFunctionAbi,\n });\n\n // Fill in the ABI\n return generateViewFunctionPayloadWithABI({ abi: functionAbi, ...args });\n}\n\n/**\n * Generates a payload for a view function call using the provided ABI and arguments.\n * This function ensures that the type arguments and function arguments are correctly formatted\n * and match the expected counts as defined in the ABI.\n *\n * @param args - The input data for generating the view function payload.\n * @param args.abi - The ABI of the function to be called.\n * @param args.function - The full name of the function in the format \"moduleAddress::moduleName::functionName\".\n * @param args.typeArguments - An array of type arguments to be used in the function call.\n * @param args.functionArguments - An array of arguments to be passed to the function.\n *\n * @throws Error if the type argument count does not match the ABI or if the function arguments\n * do not match the expected parameters defined in the ABI.\n * @group Implementation\n * @category Transactions\n */\nexport function generateViewFunctionPayloadWithABI(args: InputViewFunctionDataWithABI): EntryFunction {\n const functionAbi = args.abi;\n const { moduleAddress, moduleName, functionName } = getFunctionParts(args.function);\n\n // Ensure that all type arguments are typed properly\n const typeArguments = standardizeTypeTags(args.typeArguments);\n\n // Check the type argument count against the ABI\n if (typeArguments.length !== functionAbi.typeParameters.length) {\n throw new Error(\n `Type argument count mismatch, expected ${functionAbi.typeParameters.length}, received ${typeArguments.length}`,\n );\n }\n\n // Check all BCS types, and convert any non-BCS types\n const functionArguments: Array<EntryFunctionArgumentTypes> =\n args?.functionArguments?.map((arg, i) => convertArgument(args.function, functionAbi, arg, i, typeArguments)) ?? [];\n\n // Check that all arguments are accounted for\n if (functionArguments.length !== functionAbi.parameters.length) {\n throw new Error(\n // eslint-disable-next-line max-len\n `Too few arguments for '${moduleAddress}::${moduleName}::${functionName}', expected ${functionAbi.parameters.length} but got ${functionArguments.length}`,\n );\n }\n\n // Generate entry function payload\n return EntryFunction.build(`${moduleAddress}::${moduleName}`, functionName, typeArguments, functionArguments);\n}\n\n/**\n * Generates a transaction payload script based on the provided input data.\n * This function helps in creating a structured script for transaction processing.\n *\n * @param args - The input data required to generate the transaction payload script.\n * @param args.bytecode - The bytecode to be converted into a Uint8Array.\n * @param args.typeArguments - The type arguments that will be standardized.\n * @param args.functionArguments - The arguments for the function being called.\n * @returns A new instance of TransactionPayloadScript.\n * @group Implementation\n * @category Transactions\n */\nfunction generateTransactionPayloadScript(args: InputScriptData) {\n return new TransactionPayloadScript(\n new Script(\n Hex.fromHexInput(args.bytecode).toUint8Array(),\n standardizeTypeTags(args.typeArguments),\n args.functionArguments,\n ),\n );\n}\n\n/**\n * Generates a raw transaction that can be sent to the Aptos network.\n *\n * @param args - The arguments for generating the raw transaction.\n * @param args.aptosConfig - The configuration for the Aptos network.\n * @param args.sender - The transaction's sender account address as a hex input.\n * @param args.payload - The transaction payload, which can be created using generateTransactionPayload().\n * @param args.options - Optional parameters for transaction generation.\n * @param args.feePayerAddress - The address of the fee payer for sponsored transactions.\n *\n * @returns RawTransaction - The generated raw transaction.\n * @group Implementation\n * @category Transactions\n */\nexport async function generateRawTransaction(args: {\n aptosConfig: AptosConfig;\n sender: AccountAddressInput;\n payload: AnyTransactionPayloadInstance;\n options?: InputGenerateTransactionOptions;\n feePayerAddress?: AccountAddressInput;\n}): Promise<RawTransaction> {\n const { aptosConfig, sender, payload, options, feePayerAddress } = args;\n\n const getChainId = async () => {\n if (NetworkToChainId[aptosConfig.network]) {\n return { chainId: NetworkToChainId[aptosConfig.network] };\n }\n const info = await getLedgerInfo({ aptosConfig });\n return { chainId: info.chain_id };\n };\n\n const getGasUnitPrice = async () => {\n if (options?.gasUnitPrice) {\n return { gasEstimate: options.gasUnitPrice };\n }\n const estimation = await getGasPriceEstimation({ aptosConfig });\n return { gasEstimate: estimation.gas_estimate };\n };\n\n const getSequenceNumberForAny = async () => {\n const getSequenceNumber = async () => {\n if (options?.accountSequenceNumber !== undefined) {\n return options.accountSequenceNumber;\n }\n\n return (await getInfo({ aptosConfig, accountAddress: sender })).sequence_number;\n };\n\n /**\n * Check if is sponsored transaction to honor AIP-52\n * {@link https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-52.md}\n * @group Implementation\n * @category Transactions\n */\n if (feePayerAddress && AccountAddress.from(feePayerAddress).equals(AccountAddress.ZERO)) {\n // Handle sponsored transaction generation with the option that\n // the main signer has not been created on chain\n try {\n // Check if main signer has been created on chain, if not assign sequence number 0\n return await getSequenceNumber();\n } catch (e: any) {\n return 0;\n }\n } else {\n return getSequenceNumber();\n }\n };\n const [{ chainId }, { gasEstimate }, sequenceNumber] = await Promise.all([\n getChainId(),\n getGasUnitPrice(),\n getSequenceNumberForAny(),\n ]);\n\n const { maxGasAmount, gasUnitPrice, expireTimestamp } = {\n maxGasAmount: options?.maxGasAmount ? BigInt(options.maxGasAmount) : BigInt(DEFAULT_MAX_GAS_AMOUNT),\n gasUnitPrice: options?.gasUnitPrice ?? BigInt(gasEstimate),\n expireTimestamp: options?.expireTimestamp ?? BigInt(Math.floor(Date.now() / 1000) + DEFAULT_TXN_EXP_SEC_FROM_NOW),\n };\n\n return new RawTransaction(\n AccountAddress.from(sender),\n BigInt(sequenceNumber),\n payload,\n BigInt(maxGasAmount),\n BigInt(gasUnitPrice),\n BigInt(expireTimestamp),\n new ChainId(chainId),\n );\n}\n\n/**\n * Generates a transaction based on the provided arguments.\n * This function can create both simple and multi-agent transactions, allowing for flexible transaction handling.\n *\n * @param args - The input arguments for generating the transaction.\n * @param args.aptosConfig - The configuration settings for Aptos.\n * @param args.sender - The transaction's sender account address as a hex input.\n * @param args.payload - The transaction payload, which can be created using `generateTransactionPayload()`.\n * @param args.options - Optional. Transaction options object.\n * @param args.secondarySignerAddresses - Optional. An array of addresses for additional signers in a multi-signature transaction.\n * @param args.feePayerAddress - Optional. The address of the fee payer for sponsored transactions.\n * @returns An instance of a transaction, which may include secondary signer addresses and a fee payer address.\n * @group Implementation\n * @category Transactions\n */\nexport async function buildTransaction(args: InputGenerateSingleSignerRawTransactionArgs): Promise<SimpleTransaction>;\n/**\n * @group Implementation\n * @category Transactions\n */\nexport async function buildTransaction(args: InputGenerateMultiAgentRawTransactionArgs): Promise<MultiAgentTransaction>;\n\n/**\n * Generates a transaction based on the provided arguments\n *\n * Note: we can start with one function to support all different payload/transaction types,\n * and if to complex to use, we could have function for each type\n *\n * @param args.aptosConfig AptosConfig\n * @param args.sender The transaction's sender account address as a hex input\n * @param args.payload The transaction payload - can create by using generateTransactionPayload()\n * @param args.options optional. Transaction options object\n * @param args.secondarySignerAddresses optional. For when want to create a multi signers transaction\n * @param args.feePayerAddress optional. For when want to create a fee payer (aka sponsored) transaction\n *\n * @return An instance of a RawTransaction, plus optional secondary/fee payer addresses\n * ```\n * {\n * rawTransaction: RawTransaction,\n * secondarySignerAddresses?: Array<AccountAddress>,\n * feePayerAddress?: AccountAddress\n * }\n * ```\n * @group Implementation\n * @category Transactions\n */\nexport async function buildTransaction(args: InputGenerateRawTransactionArgs): Promise<AnyRawTransaction> {\n const { aptosConfig, sender, payload, options, feePayerAddress } = args;\n // generate raw transaction\n const rawTxn = await generateRawTransaction({\n aptosConfig,\n sender,\n payload,\n options,\n feePayerAddress,\n });\n\n // if multi agent transaction\n if (\"secondarySignerAddresses\" in args) {\n const signers: Array<AccountAddress> =\n args.secondarySignerAddresses?.map((signer) => AccountAddress.from(signer)) ?? [];\n\n return new MultiAgentTransaction(\n rawTxn,\n signers,\n args.feePayerAddress ? AccountAddress.from(args.feePayerAddress) : undefined,\n );\n }\n // return the raw transaction\n return new SimpleTransaction(rawTxn, args.feePayerAddress ? AccountAddress.from(args.feePayerAddress) : undefined);\n}\n\n/**\n * Generate a signed transaction for simulation before submitting it to the chain.\n * This function helps in preparing a transaction that can be simulated, allowing users to verify its validity and expected behavior.\n *\n * @param args - The input data required to generate the signed transaction for simulation.\n * @param args.transaction - An Aptos transaction type to sign.\n * @param args.signerPublicKey - The public key of the signer.\n * @param args.secondarySignersPublicKeys - Optional. The public keys of secondary signers if it is a multi-signer transaction.\n * @param args.feePayerPublicKey - Optional. The public key of the fee payer in a sponsored transaction.\n * @param args.options - Optional. Additional options for simulating the transaction.\n *\n * @returns A signed serialized transaction that can be simulated.\n * @group Implementation\n * @category Transactions\n */\nexport function generateSignedTransactionForSimulation(args: InputSimulateTransactionData): Uint8Array {\n const { signerPublicKey, transaction, secondarySignersPublicKeys, feePayerPublicKey } = args;\n\n const accountAuthenticator = getAuthenticatorForSimulation(signerPublicKey);\n\n // fee payer transaction\n if (transaction.feePayerAddress) {\n const transactionToSign = new FeePayerRawTransaction(\n transaction.rawTransaction,\n transaction.secondarySignerAddresses ?? [],\n transaction.feePayerAddress,\n );\n let secondaryAccountAuthenticators: Array<AccountAuthenticator> = [];\n if (transaction.secondarySignerAddresses) {\n if (secondarySignersPublicKeys) {\n secondaryAccountAuthenticators = secondarySignersPublicKeys.map((publicKey) =>\n getAuthenticatorForSimulation(publicKey),\n );\n } else {\n secondaryAccountAuthenticators = Array.from({ length: transaction.secondarySignerAddresses.length }, () =>\n getAuthenticatorForSimulation(undefined),\n );\n }\n }\n const feePayerAuthenticator = getAuthenticatorForSimulation(feePayerPublicKey);\n\n const transactionAuthenticator = new TransactionAuthenticatorFeePayer(\n accountAuthenticator,\n transaction.secondarySignerAddresses ?? [],\n secondaryAccountAuthenticators,\n {\n address: transaction.feePayerAddress,\n authenticator: feePayerAuthenticator,\n },\n );\n return new SignedTransaction(transactionToSign.raw_txn, transactionAuthenticator).bcsToBytes();\n }\n\n // multi agent transaction\n if (transaction.secondarySignerAddresses) {\n const transactionToSign = new MultiAgentRawTransaction(\n transaction.rawTransaction,\n transaction.secondarySignerAddresses,\n );\n\n let secondaryAccountAuthenticators: Array<AccountAuthenticator> = [];\n\n if (secondarySignersPublicKeys) {\n secondaryAccountAuthenticators = secondarySignersPublicKeys.map((publicKey) =>\n getAuthenticatorForSimulation(publicKey),\n );\n } else {\n secondaryAccountAuthenticators = Array.from({ length: transaction.secondarySignerAddresses.length }, () =>\n getAuthenticatorForSimulation(undefined),\n );\n }\n\n const transactionAuthenticator = new TransactionAuthenticatorMultiAgent(\n accountAuthenticator,\n transaction.secondarySignerAddresses,\n secondaryAccountAuthenticators,\n );\n\n return new SignedTransaction(transactionToSign.raw_txn, transactionAuthenticator).bcsToBytes();\n }\n\n // single signer raw transaction\n let transactionAuthenticator;\n if (accountAuthenticator instanceof AccountAuthenticatorEd25519) {\n transactionAuthenticator = new TransactionAuthenticatorEd25519(\n accountAuthenticator.public_key,\n accountAuthenticator.signature,\n );\n } else if (\n accountAuthenticator instanceof AccountAuthenticatorSingleKey ||\n accountAuthenticator instanceof AccountAuthenticatorMultiKey\n ) {\n transactionAuthenticator = new TransactionAuthenticatorSingleSender(accountAuthenticator);\n } else if (accountAuthenticator instanceof AccountAuthenticatorNoAccountAuthenticator) {\n transactionAuthenticator = new TransactionAuthenticatorSingleSender(accountAuthenticator);\n } else {\n throw new Error(\"Invalid public key\");\n }\n return new SignedTransaction(transaction.rawTransaction, transactionAuthenticator).bcsToBytes();\n}\n\n/**\n * @group Implementation\n * @category Transactions\n */\nexport function getAuthenticatorForSimulation(publicKey?: PublicKey) {\n if (!publicKey) {\n return new AccountAuthenticatorNoAccountAuthenticator();\n }\n\n // Wrap the public key types below with AnyPublicKey as they are only support through single sender.\n // Learn more about AnyPublicKey here - https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-55.md\n const convertToAnyPublicKey =\n KeylessPublicKey.isInstance(publicKey) ||\n FederatedKeylessPublicKey.isInstance(publicKey) ||\n Secp256k1PublicKey.isInstance(publicKey);\n const accountPublicKey = convertToAnyPublicKey ? new AnyPublicKey(publicKey) : publicKey;\n\n // No need to for the signature to be matching in scheme. All that matters for simulations is that it's not valid\n const invalidSignature = new Ed25519Signature(new Uint8Array(64));\n\n if (Ed25519PublicKey.isInstance(accountPublicKey)) {\n return new AccountAuthenticatorEd25519(accountPublicKey, invalidSignature);\n }\n\n if (AnyPublicKey.isInstance(accountPublicKey)) {\n if (KeylessPublicKey.isInstance(accountPublicKey.publicKey)) {\n return new AccountAuthenticatorSingleKey(\n accountPublicKey,\n new AnySignature(KeylessSignature.getSimulationSignature()),\n );\n }\n return new AccountAuthenticatorSingleKey(accountPublicKey, new AnySignature(invalidSignature));\n }\n\n if (MultiKey.isInstance(accountPublicKey)) {\n return new AccountAuthenticatorMultiKey(\n accountPublicKey,\n new MultiKeySignature({\n signatures: accountPublicKey.publicKeys.map(() => new AnySignature(invalidSignature)),\n bitmap: accountPublicKey.createBitmap({\n bits: Array(accountPublicKey.publicKeys.length)\n .fill(0)\n .map((_, i) => i),\n }),\n }),\n );\n }\n\n throw new Error(\"Unsupported PublicKey used for simulations\");\n}\n\n/**\n * Generate a signed transaction ready for submission to the blockchain.\n * This function prepares the transaction by authenticating the sender and any additional signers based on the provided arguments.\n *\n * @param args - The input data required to generate the signed transaction.\n * @param args.transaction - An Aptos transaction type containing the details of the transaction.\n * @param args.senderAuthenticator - The account authenticator of the transaction sender.\n * @param args.feePayerAuthenticator - The authenticator for the fee payer, required if the transaction has a fee payer address.\n * @param args.additionalSignersAuthenticators - Optional authenticators for additional signers in a multi-signer transaction.\n *\n * @returns A Uint8Array representing the signed transaction in bytes.\n *\n * @throws Error if the feePayerAuthenticator is not provided for a fee payer transaction.\n * @throws Error if additionalSignersAuthenticators are not provided for a multi-signer transaction.\n * @group Implementation\n * @category Transactions\n */\nexport function generateSignedTransaction(args: InputSubmitTransactionData): Uint8Array {\n const { transaction, feePayerAuthenticator, additionalSignersAuthenticators } = args;\n const senderAuthenticator = normalizeBundle(AccountAuthenticator, args.senderAuthenticator);\n\n let txnAuthenticator: TransactionAuthenticator;\n if (transaction.feePayerAddress) {\n if (!feePayerAuthenticator) {\n throw new Error(\"Must provide a feePayerAuthenticator argument to generate a signed fee payer transaction\");\n }\n txnAuthenticator = new TransactionAuthenticatorFeePayer(\n senderAuthenticator,\n transaction.secondarySignerAddresses ?? [],\n additionalSignersAuthenticators ?? [],\n {\n address: transaction.feePayerAddress,\n authenticator: feePayerAuthenticator,\n },\n );\n } else if (transaction.secondarySignerAddresses) {\n if (!additionalSignersAuthenticators) {\n throw new Error(\n \"Must provide a additionalSignersAuthenticators argument to generate a signed multi agent transaction\",\n );\n }\n txnAuthenticator = new TransactionAuthenticatorMultiAgent(\n senderAuthenticator,\n transaction.secondarySignerAddresses,\n additionalSignersAuthenticators,\n );\n } else if (senderAuthenticator instanceof AccountAuthenticatorEd25519) {\n txnAuthenticator = new TransactionAuthenticatorEd25519(\n senderAuthenticator.public_key,\n senderAuthenticator.signature,\n );\n } else {\n txnAuthenticator = new TransactionAuthenticatorSingleSender(senderAuthenticator);\n }\n\n return new SignedTransaction(transaction.rawTransaction, txnAuthenticator).bcsToBytes();\n}\n\n/**\n * Hashes the set of values using a SHA-3 256 hash algorithm.\n * @param input - An array of UTF-8 strings or Uint8Array byte arrays to be hashed.\n * @group Implementation\n * @category Transactions\n */\nexport function hashValues(input: (Uint8Array | string)[]): Uint8Array {\n const hash = sha3Hash.create();\n for (const item of input) {\n hash.update(item);\n }\n return hash.digest();\n}\n\n/**\n * The domain separated prefix for hashing transactions\n * @group Implementation\n * @category Transactions\n */\nconst TRANSACTION_PREFIX = hashValues([\"APTOS::Transaction\"]);\n\n/**\n * Generates a user transaction hash for the provided transaction payload, which must already have an authenticator.\n * This function helps ensure the integrity and uniqueness of the transaction by producing a hash based on the signed transaction data.\n *\n * @param args - The input data required to submit the transaction.\n * @param args.authenticator - The authenticator for the transaction.\n * @param args.payload - The payload containing the transaction details.\n * @param args.sender - The address of the sender initiating the transaction.\n * @param args.sequenceNumber - The sequence number of the transaction for the sender.\n * @group Implementation\n * @category Transactions\n */\nexport function generateUserTransactionHash(args: InputSubmitTransactionData): string {\n const signedTransaction = generateSignedTransaction(args);\n\n // Transaction signature is defined as, the domain separated prefix based on struct (Transaction)\n // Then followed by the type of the transaction for the enum, UserTransaction is 0\n // Then followed by BCS encoded bytes of the signed transaction\n return new Hex(hashValues([TRANSACTION_PREFIX, new Uint8Array([0]), signedTransaction])).toString();\n}\n\n/**\n * Fetches and caches ABIs while allowing for pass-through on provided ABIs.\n *\n * @param key - A unique identifier for the cached ABI.\n * @param moduleAddress - The address of the module from which to fetch the ABI.\n * @param moduleName - The name of the module containing the function.\n * @param functionName - The name of the function whose ABI is being fetched.\n * @param aptosConfig - Configuration settings for Aptos.\n * @param abi - An optional ABI to use if already available.\n * @param fetch - A function to fetch the ABI if it is not provided.\n * @group Implementation\n * @category Transactions\n */\nasync function fetchAbi<T extends FunctionABI>({\n key,\n moduleAddress,\n moduleName,\n functionName,\n aptosConfig,\n abi,\n fetch,\n}: {\n key: string;\n moduleAddress: string;\n moduleName: string;\n functionName: string;\n aptosConfig: AptosConfig;\n abi?: T;\n fetch: (moduleAddress: string, moduleName: string, functionName: string, aptosConfig: AptosConfig) => Promise<T>;\n}): Promise<T> {\n if (abi !== undefined) {\n return abi;\n }\n\n // We fetch the entry function ABI, and then pretend that we already had the ABI\n return memoizeAsync(\n async () => fetch(moduleAddress, moduleName, functionName, aptosConfig),\n `${key}-${aptosConfig.network}-${moduleAddress}-${moduleName}-${functionName}`,\n 1000 * 60 * 5, // 5 minutes\n )();\n}\n"],"mappings":"krCAQA,OAAS,YAAYA,OAAgB,qBAwHrC,eAAsBC,GACpBC,EACwC,CACxC,GAAIC,GAAkBD,CAAI,EACxB,OAAOE,GAAiCF,CAAI,EAE9C,GAAM,CAAE,cAAAG,EAAe,WAAAC,EAAY,aAAAC,CAAa,EAAIC,EAAiBN,EAAK,QAAQ,EAE5EO,EAAc,MAAMC,GAAS,CACjC,IAAK,iBACL,cAAAL,EACA,WAAAC,EACA,aAAAC,EACA,YAAaL,EAAK,YAClB,IAAKA,EAAK,IACV,MAAOS,EACT,CAAC,EAGD,OAAOC,GAAkC,CAAE,GAAGV,EAAM,IAAKO,CAAY,CAAC,CACxE,CA2BO,SAASG,GACdV,EAC+B,CAC/B,IAAMO,EAAcP,EAAK,IACnB,CAAE,cAAAG,EAAe,WAAAC,EAAY,aAAAC,CAAa,EAAIC,EAAiBN,EAAK,QAAQ,EAG5EW,EAAgBC,EAAoBZ,EAAK,aAAa,EAG5D,GAAIW,EAAc,SAAWJ,EAAY,eAAe,OACtD,MAAM,IAAI,MACR,0CAA0CA,EAAY,eAAe,MAAM,cAAcI,EAAc,MAAM,EAC/G,EAIF,IAAME,EAAuDb,EAAK,kBAAkB,IAAI,CAACc,EAAKC,IAe5FC,EAAgBhB,EAAK,SAAUO,EAAaO,EAAKC,EAAGJ,CAAa,CACnE,EAGA,GAAIE,EAAkB,SAAWN,EAAY,WAAW,OACtD,MAAM,IAAI,MAER,0BAA0BJ,CAAa,KAAKC,CAAU,KAAKC,CAAY,eAAeE,EAAY,WAAW,MAAM,YAAYM,EAAkB,MAAM,EACzJ,EAIF,IAAMI,EAAuBC,EAAc,MACzC,GAAGf,CAAa,KAAKC,CAAU,GAC/BC,EACAM,EACAE,CACF,EAGA,GAAI,oBAAqBb,EAAM,CAC7B,I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,CACxF,CAQO,SAASC,GAAWC,EAA4C,CACrE,IAAMC,EAAOC,GAAS,OAAO,EAC7B,QAAWC,KAAQH,EACjBC,EAAK,OAAOE,CAAI,EAElB,OAAOF,EAAK,OAAO,CACrB,CAOA,IAAMG,GAAqBL,GAAW,CAAC,oBAAoB,CAAC,EAcrD,SAASM,GAA4B3G,EAA0C,CACpF,IAAM4G,EAAoBb,GAA0B/F,CAAI,EAKxD,OAAO,IAAI8B,EAAIuE,GAAW,CAACK,GAAoB,IAAI,WAAW,CAAC,CAAC,CAAC,EAAGE,CAAiB,CAAC,CAAC,EAAE,SAAS,CACpG,CAeA,eAAepG,GAAgC,CAC7C,IAAAqG,EACA,cAAA1G,EACA,WAAAC,EACA,aAAAC,EACA,YAAA2B,EACA,IAAA8E,EACA,MAAAC,CACF,EAQe,CACb,OAAID,IAAQ,OACHA,EAIFE,EACL,SAAYD,EAAM5G,EAAeC,EAAYC,EAAc2B,CAAW,EACtE,GAAG6E,CAAG,IAAI7E,EAAY,OAAO,IAAI7B,CAAa,IAAIC,CAAU,IAAIC,CAAY,GAC5E,IAAO,GAAK,CACd,EAAE,CACJ","names":["sha3Hash","generateTransactionPayload","args","isScriptDataInput","generateTransactionPayloadScript","moduleAddress","moduleName","functionName","getFunctionParts","functionAbi","fetchAbi","fetchEntryFunctionAbi","generateTransactionPayloadWithABI","typeArguments","standardizeTypeTags","functionArguments","arg","i","convertArgument","entryFunctionPayload","EntryFunction","multisigAddress","AccountAddress","TransactionPayloadMultiSig","MultiSig","MultiSigTransactionPayload","TransactionPayloadEntryFunction","generateViewFunctionPayload","fetchViewFunctionAbi","generateViewFunctionPayloadWithABI","TransactionPayloadScript","Script","Hex","generateRawTransaction","aptosConfig","sender","payload","options","feePayerAddress","getChainId","NetworkToChainId","getLedgerInfo","getGasUnitPrice","getGasPriceEstimation","getSequenceNumberForAny","getSequenceNumber","getInfo","chainId","gasEstimate","sequenceNumber","maxGasAmount","gasUnitPrice","expireTimestamp","RawTransaction","ChainId","buildTransaction","rawTxn","signers","signer","MultiAgentTransaction","SimpleTransaction","generateSignedTransactionForSimulation","signerPublicKey","transaction","secondarySignersPublicKeys","feePayerPublicKey","accountAuthenticator","getAuthenticatorForSimulation","transactionToSign","FeePayerRawTransaction","secondaryAccountAuthenticators","publicKey","feePayerAuthenticator","transactionAuthenticator","TransactionAuthenticatorFeePayer","SignedTransaction","MultiAgentRawTransaction","TransactionAuthenticatorMultiAgent","AccountAuthenticatorEd25519","TransactionAuthenticatorEd25519","AccountAuthenticatorSingleKey","AccountAuthenticatorMultiKey","TransactionAuthenticatorSingleSender","AccountAuthenticatorNoAccountAuthenticator","accountPublicKey","KeylessPublicKey","FederatedKeylessPublicKey","Secp256k1PublicKey","AnyPublicKey","invalidSignature","Ed25519Signature","Ed25519PublicKey","AnySignature","KeylessSignature","MultiKey","MultiKeySignature","_","generateSignedTransaction","additionalSignersAuthenticators","senderAuthenticator","normalizeBundle","AccountAuthenticator","txnAuthenticator","hashValues","input","hash","sha3Hash","item","TRANSACTION_PREFIX","generateUserTransactionHash","signedTransaction","key","abi","fetch","memoizeAsync"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as u}from"./chunk-E5HGSOG2.mjs";import{a as A}from"./chunk-6CXMDJQR.mjs";import{a as h}from"./chunk-5YWH3XPN.mjs";import{a as y}from"./chunk-DOQV5BSA.mjs";import{a as m}from"./chunk-67ZVDKJF.mjs";import{a as d}from"./chunk-F2ZTBAJJ.mjs";import{a as r}from"./chunk-ZPV7HPA4.mjs";import{a}from"./chunk-WQRGDSPD.mjs";import{a as c}from"./chunk-E7JDVKFY.mjs";import{a as l}from"./chunk-OROPNHRY.mjs";import{a as f}from"./chunk-2FBJWTJD.mjs";import{a as g}from"./chunk-AXYARCYT.mjs";import{a as s}from"./chunk-5PXDPMF2.mjs";import{a as p}from"./chunk-XY43TPRH.mjs";var t=class{constructor(n){this.config=new d(n),this.account=new s(this.config),this.ans=new p(this.config),this.coin=new r(this.config),this.digitalAsset=new a(this.config),this.event=new c(this.config),this.faucet=new l(this.config),this.fungibleAsset=new f(this.config),this.general=new g(this.config),this.staking=new h(this.config),this.transaction=new m(this.config),this.table=new y(this.config),this.keyless=new u(this.config),this.object=new A(this.config)}};function e(b,n,w){Object.getOwnPropertyNames(n.prototype).forEach(i=>{let o=Object.getOwnPropertyDescriptor(n.prototype,i);o&&(o.value=function(...j){return this[w][i](...j)},Object.defineProperty(b.prototype,i,o))})}e(t,s,"account");e(t,p,"ans");e(t,r,"coin");e(t,a,"digitalAsset");e(t,c,"event");e(t,l,"faucet");e(t,f,"fungibleAsset");e(t,g,"general");e(t,h,"staking");e(t,m,"transaction");e(t,y,"table");e(t,u,"keyless");e(t,A,"object");export{t as a};
|
|
2
|
-
//# sourceMappingURL=chunk-KVM2SGSF.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/api/aptos.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Account } from \"./account\";\nimport { AptosConfig } from \"./aptosConfig\";\nimport { Coin } from \"./coin\";\nimport { DigitalAsset } from \"./digitalAsset\";\nimport { Event } from \"./event\";\nimport { Faucet } from \"./faucet\";\nimport { FungibleAsset } from \"./fungibleAsset\";\nimport { General } from \"./general\";\nimport { ANS } from \"./ans\";\nimport { Staking } from \"./staking\";\nimport { Transaction } from \"./transaction\";\nimport { Table } from \"./table\";\nimport { Keyless } from \"./keyless\";\nimport { AptosObject } from \"./object\";\n\n/**\n * The main entry point for interacting with the Aptos APIs,\n * providing access to various functionalities organized into\n * distinct namespaces.\n *\n * To utilize the SDK, instantiate a new Aptos object to gain\n * access to the complete range of SDK features.\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 connecting to the Aptos testnet\n * const config = new AptosConfig({ network: Network.TESTNET });\n *\n * // Initialize the Aptos client with the configuration\n * const aptos = new Aptos(config);\n *\n * console.log(\"Aptos client initialized:\", aptos);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Client\n */\nexport class Aptos {\n readonly config: AptosConfig;\n\n readonly account: Account;\n\n readonly ans: ANS;\n\n readonly coin: Coin;\n\n readonly digitalAsset: DigitalAsset;\n\n readonly event: Event;\n\n readonly faucet: Faucet;\n\n readonly fungibleAsset: FungibleAsset;\n\n readonly general: General;\n\n readonly staking: Staking;\n\n readonly transaction: Transaction;\n\n readonly table: Table;\n\n readonly keyless: Keyless;\n\n readonly object: AptosObject;\n\n /**\n * Initializes a new instance of the Aptos client with the provided configuration settings.\n * This allows you to interact with various Aptos functionalities such as accounts, transactions, and events.\n *\n * @param settings - 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 default settings\n * const config = new AptosConfig({ network: Network.TESTNET }); // Specify your own settings if needed\n * const aptos = new Aptos(config);\n *\n * console.log(\"Aptos client initialized:\", aptos);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Client\n */\n constructor(settings?: AptosConfig) {\n this.config = new AptosConfig(settings);\n this.account = new Account(this.config);\n this.ans = new ANS(this.config);\n this.coin = new Coin(this.config);\n this.digitalAsset = new DigitalAsset(this.config);\n this.event = new Event(this.config);\n this.faucet = new Faucet(this.config);\n this.fungibleAsset = new FungibleAsset(this.config);\n this.general = new General(this.config);\n this.staking = new Staking(this.config);\n this.transaction = new Transaction(this.config);\n this.table = new Table(this.config);\n this.keyless = new Keyless(this.config);\n this.object = new AptosObject(this.config);\n }\n}\n\n// extends Aptos interface so all the methods and properties\n// from the other classes will be recognized by typescript.\nexport interface Aptos\n extends Account,\n ANS,\n Coin,\n DigitalAsset,\n Event,\n Faucet,\n FungibleAsset,\n General,\n Keyless,\n Staking,\n Table,\n AptosObject,\n Omit<Transaction, \"build\" | \"simulate\" | \"submit\" | \"batch\"> {}\n\n/**\nIn TypeScript, we can’t inherit or extend from more than one class,\nMixins helps us to get around that by creating a partial classes\nthat we can combine to form a single class that contains all the methods and properties from the partial classes.\n{@link https://www.typescriptlang.org/docs/handbook/mixins.html#alternative-pattern}\n\nHere, we combine any subclass and the Aptos class.\n * @group Client\n*/\nfunction applyMixin(targetClass: any, baseClass: any, baseClassProp: string) {\n // Mixin instance methods\n Object.getOwnPropertyNames(baseClass.prototype).forEach((propertyName) => {\n const propertyDescriptor = Object.getOwnPropertyDescriptor(baseClass.prototype, propertyName);\n if (!propertyDescriptor) return;\n // eslint-disable-next-line func-names\n propertyDescriptor.value = function (...args: any) {\n return (this as any)[baseClassProp][propertyName](...args);\n };\n Object.defineProperty(targetClass.prototype, propertyName, propertyDescriptor);\n });\n}\n\napplyMixin(Aptos, Account, \"account\");\napplyMixin(Aptos, ANS, \"ans\");\napplyMixin(Aptos, Coin, \"coin\");\napplyMixin(Aptos, DigitalAsset, \"digitalAsset\");\napplyMixin(Aptos, Event, \"event\");\napplyMixin(Aptos, Faucet, \"faucet\");\napplyMixin(Aptos, FungibleAsset, \"fungibleAsset\");\napplyMixin(Aptos, General, \"general\");\napplyMixin(Aptos, Staking, \"staking\");\napplyMixin(Aptos, Transaction, \"transaction\");\napplyMixin(Aptos, Table, \"table\");\napplyMixin(Aptos, Keyless, \"keyless\");\napplyMixin(Aptos, AptosObject, \"object\");\n"],"mappings":"yjBA2CO,IAAMA,EAAN,KAAY,CAkDjB,YAAYC,EAAwB,CAClC,KAAK,OAAS,IAAIC,EAAYD,CAAQ,EACtC,KAAK,QAAU,IAAIE,EAAQ,KAAK,MAAM,EACtC,KAAK,IAAM,IAAIC,EAAI,KAAK,MAAM,EAC9B,KAAK,KAAO,IAAIC,EAAK,KAAK,MAAM,EAChC,KAAK,aAAe,IAAIC,EAAa,KAAK,MAAM,EAChD,KAAK,MAAQ,IAAIC,EAAM,KAAK,MAAM,EAClC,KAAK,OAAS,IAAIC,EAAO,KAAK,MAAM,EACpC,KAAK,cAAgB,IAAIC,EAAc,KAAK,MAAM,EAClD,KAAK,QAAU,IAAIC,EAAQ,KAAK,MAAM,EACtC,KAAK,QAAU,IAAIC,EAAQ,KAAK,MAAM,EACtC,KAAK,YAAc,IAAIC,EAAY,KAAK,MAAM,EAC9C,KAAK,MAAQ,IAAIC,EAAM,KAAK,MAAM,EAClC,KAAK,QAAU,IAAIC,EAAQ,KAAK,MAAM,EACtC,KAAK,OAAS,IAAIC,EAAY,KAAK,MAAM,CAC3C,CACF,EA4BA,SAASC,EAAWC,EAAkBC,EAAgBC,EAAuB,CAE3E,OAAO,oBAAoBD,EAAU,SAAS,EAAE,QAASE,GAAiB,CACxE,IAAMC,EAAqB,OAAO,yBAAyBH,EAAU,UAAWE,CAAY,EACvFC,IAELA,EAAmB,MAAQ,YAAaC,EAAW,CACjD,OAAQ,KAAaH,CAAa,EAAEC,CAAY,EAAE,GAAGE,CAAI,CAC3D,EACA,OAAO,eAAeL,EAAY,UAAWG,EAAcC,CAAkB,EAC/E,CAAC,CACH,CAEAL,EAAWhB,EAAOG,EAAS,SAAS,EACpCa,EAAWhB,EAAOI,EAAK,KAAK,EAC5BY,EAAWhB,EAAOK,EAAM,MAAM,EAC9BW,EAAWhB,EAAOM,EAAc,cAAc,EAC9CU,EAAWhB,EAAOO,EAAO,OAAO,EAChCS,EAAWhB,EAAOQ,EAAQ,QAAQ,EAClCQ,EAAWhB,EAAOS,EAAe,eAAe,EAChDO,EAAWhB,EAAOU,EAAS,SAAS,EACpCM,EAAWhB,EAAOW,EAAS,SAAS,EACpCK,EAAWhB,EAAOY,EAAa,aAAa,EAC5CI,EAAWhB,EAAOa,EAAO,OAAO,EAChCG,EAAWhB,EAAOc,EAAS,SAAS,EACpCE,EAAWhB,EAAOe,EAAa,QAAQ","names":["Aptos","settings","AptosConfig","Account","ANS","Coin","DigitalAsset","Event","Faucet","FungibleAsset","General","Staking","Transaction","Table","Keyless","AptosObject","applyMixin","targetClass","baseClass","baseClassProp","propertyName","propertyDescriptor","args"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{c as l}from"./chunk-AZWVCBK2.mjs";import{a as k,b as c,d as A,e as g,f as P,g as z,h as D,i as m,j as L,l as R,m as X,n as q,o as H,p as J,q as K,s as i,t as Q}from"./chunk-HBH2NQKU.mjs";import{c as j}from"./chunk-WUWPN7XV.mjs";import{b as S,c as I,d as x,e as M,f as O,g as C,h as _,i as V,n as G}from"./chunk-G4O6FXCF.mjs";import{b as d}from"./chunk-Q4C4U6I4.mjs";import{a as y,c as F,d as s}from"./chunk-IDTLNF4M.mjs";import{a as w,b as h,c as B,d as E,e as v,f as $,g as b}from"./chunk-ORMOQWWH.mjs";var Y=new TextEncoder;function sn(n){return n?.map(e=>c(e)?l(e):e)??[]}async function W(n,e,t,u){let r=await j({aptosConfig:u,accountAddress:n,moduleName:e});if(r.abi)return r.abi.exposed_functions.find(o=>o.name===t)}async function fn(n,e,t,u){let r=await W(n,e,t,u);if(!r)throw new Error(`Could not find entry function ABI for '${n}::${e}::${t}'`);if(!r.is_entry)throw new Error(`'${n}::${e}::${t}' is not an entry function`);let o=Q(r),T=[];for(let f=o;f<r.params.length;f+=1)T.push(l(r.params[f],{allowGenerics:!0}));return{signers:o,typeParameters:r.generic_type_params,parameters:T}}async function on(n,e,t,u){let r=await W(n,e,t,u);if(!r)throw new Error(`Could not find view function ABI for '${n}::${e}::${t}'`);if(!r.is_view)throw new Error(`'${n}::${e}::${t}' is not an view function`);let o=[];for(let f=0;f<r.params.length;f+=1)o.push(l(r.params[f],{allowGenerics:!0}));let T=[];for(let f=0;f<r.return.length;f+=1)T.push(l(r.return[f],{allowGenerics:!0}));return{typeParameters:r.generic_type_params,parameters:o,returnTypes:T}}function cn(n,e,t,u,r){if(u>=e.parameters.length)throw new Error(`Too many arguments for '${n}', expected ${e.parameters.length}`);let o=e.parameters[u];return U(t,o,u,r)}function U(n,e,t,u){return z(n)?(p(e,n,t),n):Z(n,e,t,u)}function Z(n,e,t,u){if(e.isBool()){if(k(n))return new w(n);if(c(n)){if(n==="true")return new w(!0);if(n==="false")return new w(!1)}i("boolean",t)}if(e.isAddress()){if(c(n))return d.fromString(n);i("string | AccountAddress",t)}if(e.isU8()){let r=A(n);if(r!==void 0)return new h(r);i("number | string",t)}if(e.isU16()){let r=A(n);if(r!==void 0)return new B(r);i("number | string",t)}if(e.isU32()){let r=A(n);if(r!==void 0)return new E(r);i("number | string",t)}if(e.isU64()){if(g(n))return new v(BigInt(n));i("bigint | number | string",t)}if(e.isU128()){if(g(n))return new $(BigInt(n));i("bigint | number | string",t)}if(e.isU256()){if(g(n))return new b(BigInt(n));i("bigint | number | string",t)}if(e.isGeneric()){let r=e.value;if(r<0||r>=u.length)throw new Error(`Generic argument ${e.toString()} is invalid for argument ${t}`);return U(n,u[r],t,u)}if(e.isVector()){if(e.value.isU8()){if(c(n))return y.U8(Y.encode(n));if(n instanceof Uint8Array)return y.U8(n);if(n instanceof ArrayBuffer)return y.U8(new Uint8Array(n))}if(Array.isArray(n))return new y(n.map(r=>U(r,e.value,t,u)));throw new Error(`Type mismatch for argument ${t}, type '${e.toString()}'`)}if(e.isStruct()){if(e.isString()){if(c(n))return new F(n);i("string",t)}if(e.isObject()){if(c(n))return d.fromString(n);i("string | AccountAddress",t)}if(e.isOption()){if(P(n)){let r=e.value.typeArgs[0];return r instanceof S?new s(null):r instanceof V?new s(null):r instanceof I?new s(null):r instanceof x?new s(null):r instanceof M?new s(null):r instanceof O?new s(null):r instanceof C?new s(null):r instanceof _?new s(null):new s(null)}return new s(U(n,e.value.typeArgs[0],t,u))}throw new Error(`Unsupported struct input type for argument ${t}, type '${e.toString()}'`)}throw new Error(`Type mismatch for argument ${t}, type '${e.toString()}'`)}function p(n,e,t){if(n.isBool()){if(D(e))return;i("Bool",t)}if(n.isAddress()){if(m(e))return;i("AccountAddress",t)}if(n.isU8()){if(R(e))return;i("U8",t)}if(n.isU16()){if(X(e))return;i("U16",t)}if(n.isU32()){if(q(e))return;i("U32",t)}if(n.isU64()){if(H(e))return;i("U64",t)}if(n.isU128()){if(J(e))return;i("U128",t)}if(n.isU256()){if(K(e))return;i("U256",t)}if(n.isVector()){if(e instanceof y){e.values.length>0&&p(n.value,e.values[0],t);return}i("MoveVector",t)}if(n instanceof G){if(n.isString()){if(L(e))return;i("MoveString",t)}if(n.isObject()){if(m(e))return;i("AccountAddress",t)}if(n.isOption()){if(e instanceof s){e.value!==void 0&&p(n.value.typeArgs[0],e.value,t);return}i("MoveOption",t)}}throw new Error(`Type mismatch for argument ${t}, expected '${n.toString()}'`)}export{sn as a,W as b,fn as c,on as d,cn as e,U as f};
|
|
2
|
-
//# sourceMappingURL=chunk-MLSAZJZK.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/transactions/transactionBuilder/remoteAbi.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { parseTypeTag } from \"../typeTag/parser\";\nimport {\n TypeTag,\n TypeTagAddress,\n TypeTagBool,\n TypeTagStruct,\n TypeTagU128,\n TypeTagU16,\n TypeTagU256,\n TypeTagU32,\n TypeTagU64,\n TypeTagU8,\n} from \"../typeTag\";\nimport { AptosConfig } from \"../../api/aptosConfig\";\nimport {\n EntryFunctionArgumentTypes,\n SimpleEntryFunctionArgumentTypes,\n EntryFunctionABI,\n ViewFunctionABI,\n FunctionABI,\n TypeArgument,\n} from \"../types\";\nimport { Bool, MoveOption, MoveString, MoveVector, U128, U16, U256, U32, U64, U8 } from \"../../bcs\";\nimport { AccountAddress } from \"../../core\";\nimport { getModule } from \"../../internal/account\";\nimport {\n findFirstNonSignerArg,\n isBcsAddress,\n isBcsBool,\n isBcsString,\n isBcsU128,\n isBcsU16,\n isBcsU256,\n isBcsU32,\n isBcsU64,\n isBcsU8,\n isBool,\n isEncodedEntryFunctionArgument,\n isLargeNumber,\n isEmptyOption,\n isString,\n throwTypeMismatch,\n convertNumber,\n} from \"./helpers\";\nimport { MoveFunction } from \"../../types\";\n\nconst TEXT_ENCODER = new TextEncoder();\n\n/**\n * Convert type arguments to only type tags, allowing for string representations of type tags.\n *\n * @param typeArguments - An optional array of type arguments that may include string representations.\n * @returns An array of TypeTag objects derived from the provided type arguments.\n * @group Implementation\n * @category Transactions\n */\nexport function standardizeTypeTags(typeArguments?: Array<TypeArgument>): Array<TypeTag> {\n return (\n typeArguments?.map((typeArg: TypeArgument): TypeTag => {\n // Convert to TypeTag if it's a string representation\n if (isString(typeArg)) {\n return parseTypeTag(typeArg);\n }\n return typeArg;\n }) ?? []\n );\n}\n\n/**\n * Fetches the ABI of a specified function from the on-chain module ABI. This function allows you to access the details of a\n * specific function within a module.\n *\n * @param moduleAddress - The address of the module from which to fetch the function ABI.\n * @param moduleName - The name of the module containing the function.\n * @param functionName - The name of the function whose ABI is to be fetched.\n * @param aptosConfig - The configuration settings for Aptos.\n * @group Implementation\n * @category Transactions\n */\nexport async function fetchFunctionAbi(\n moduleAddress: string,\n moduleName: string,\n functionName: string,\n aptosConfig: AptosConfig,\n): Promise<MoveFunction | undefined> {\n // This fetch from the API is currently cached\n const module = await getModule({ aptosConfig, accountAddress: moduleAddress, moduleName });\n\n if (module.abi) {\n return module.abi.exposed_functions.find((func) => func.name === functionName);\n }\n\n return undefined;\n}\n\n/**\n * Fetches the ABI for an entry function from the specified module address.\n * This function validates if the ABI corresponds to an entry function and retrieves its parameters.\n *\n * @param moduleAddress - The address of the module containing the entry function.\n * @param moduleName - The name of the module containing the entry function.\n * @param functionName - The name of the entry function to fetch the ABI for.\n * @param aptosConfig - The configuration settings for Aptos.\n * @returns An object containing the number of signers, type parameters, and function parameters.\n * @throws Error if the ABI cannot be found or if the function is not an entry function.\n * @group Implementation\n * @category Transactions\n */\nexport async function fetchEntryFunctionAbi(\n moduleAddress: string,\n moduleName: string,\n functionName: string,\n aptosConfig: AptosConfig,\n): Promise<EntryFunctionABI> {\n const functionAbi = await fetchFunctionAbi(moduleAddress, moduleName, functionName, aptosConfig);\n\n // If there's no ABI, then the function is invalid\n if (!functionAbi) {\n throw new Error(`Could not find entry function ABI for '${moduleAddress}::${moduleName}::${functionName}'`);\n }\n\n // Non-entry functions also can't be used\n if (!functionAbi.is_entry) {\n throw new Error(`'${moduleAddress}::${moduleName}::${functionName}' is not an entry function`);\n }\n\n // Remove the signer arguments\n const numSigners = findFirstNonSignerArg(functionAbi);\n const params: TypeTag[] = [];\n for (let i = numSigners; i < functionAbi.params.length; i += 1) {\n params.push(parseTypeTag(functionAbi.params[i], { allowGenerics: true }));\n }\n\n return {\n signers: numSigners,\n typeParameters: functionAbi.generic_type_params,\n parameters: params,\n };\n}\n\n/**\n * Fetches the ABI for a view function from the specified module address.\n * This function ensures that the ABI is valid and retrieves the type parameters, parameters, and return types for the view function.\n *\n * @param moduleAddress - The address of the module containing the view function.\n * @param moduleName - The name of the module containing the view function.\n * @param functionName - The name of the view function for which to fetch the ABI.\n * @param aptosConfig - The configuration settings for Aptos.\n * @returns An object containing the type parameters, parameters, and return types of the view function.\n * @throws Error if the ABI cannot be found or if the function is not a view function.\n * @group Implementation\n * @category Transactions\n */\nexport async function fetchViewFunctionAbi(\n moduleAddress: string,\n moduleName: string,\n functionName: string,\n aptosConfig: AptosConfig,\n): Promise<ViewFunctionABI> {\n const functionAbi = await fetchFunctionAbi(moduleAddress, moduleName, functionName, aptosConfig);\n\n // If there's no ABI, then the function is invalid\n if (!functionAbi) {\n throw new Error(`Could not find view function ABI for '${moduleAddress}::${moduleName}::${functionName}'`);\n }\n\n // Non-view functions can't be used\n if (!functionAbi.is_view) {\n throw new Error(`'${moduleAddress}::${moduleName}::${functionName}' is not an view function`);\n }\n\n // Type tag parameters for the function\n const params: TypeTag[] = [];\n for (let i = 0; i < functionAbi.params.length; i += 1) {\n params.push(parseTypeTag(functionAbi.params[i], { allowGenerics: true }));\n }\n\n // The return types of the view function\n const returnTypes: TypeTag[] = [];\n for (let i = 0; i < functionAbi.return.length; i += 1) {\n returnTypes.push(parseTypeTag(functionAbi.return[i], { allowGenerics: true }));\n }\n\n return {\n typeParameters: functionAbi.generic_type_params,\n parameters: params,\n returnTypes,\n };\n}\n\n/**\n * Converts a non-BCS encoded argument into BCS encoded, if necessary.\n * This function checks the provided argument against the expected parameter type and converts it accordingly.\n *\n * @param functionName - The name of the function for which the argument is being converted.\n * @param functionAbi - The ABI (Application Binary Interface) of the function, which defines its parameters.\n * @param arg - The argument to be converted, which can be of various types.\n * @param position - The index of the argument in the function's parameter list.\n * @param genericTypeParams - An array of type tags for any generic type parameters.\n * @group Implementation\n * @category Transactions\n */\nexport function convertArgument(\n functionName: string,\n functionAbi: FunctionABI,\n arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes,\n position: number,\n genericTypeParams: Array<TypeTag>,\n) {\n // Ensure not too many arguments\n if (position >= functionAbi.parameters.length) {\n throw new Error(`Too many arguments for '${functionName}', expected ${functionAbi.parameters.length}`);\n }\n\n const param = functionAbi.parameters[position];\n return checkOrConvertArgument(arg, param, position, genericTypeParams);\n}\n\n/**\n * Checks if the provided argument is BCS encoded and converts it if necessary, ensuring type compatibility with the ABI.\n * This function helps in validating and converting arguments for entry functions based on their expected types.\n *\n * @param arg - The argument to check or convert, which can be either a simple or entry function argument type.\n * @param param - The expected type tag for the argument.\n * @param position - The position of the argument in the function call.\n * @param genericTypeParams - An array of generic type parameters that may be used for conversion.\n * @group Implementation\n * @category Transactions\n */\nexport function checkOrConvertArgument(\n arg: SimpleEntryFunctionArgumentTypes | EntryFunctionArgumentTypes,\n param: TypeTag,\n position: number,\n genericTypeParams: Array<TypeTag>,\n) {\n // If the argument is bcs encoded, we can just use it directly\n if (isEncodedEntryFunctionArgument(arg)) {\n // Ensure the type matches the ABI\n\n /**\n * Checks the type of the provided argument against the expected type.\n * This function helps validate that the argument conforms to the specified type requirements.\n *\n * @param typeArgs - The expected type arguments.\n * @param arg - The argument to be checked.\n * @param position - The position of the argument in the context of the check.\n * @group Implementation\n * @category Transactions\n */\n checkType(param, arg, position);\n return arg;\n }\n\n // If it is not BCS encoded, we will need to convert it with the ABI\n return parseArg(arg, param, position, genericTypeParams);\n}\n\n/**\n * Parses a non-BCS encoded argument into a BCS encoded argument recursively.\n * This function helps convert various types of input arguments into their corresponding BCS encoded formats based on the\n * specified parameter type.\n *\n * @param arg - The argument to be parsed, which can be of various types.\n * @param param - The type tag that defines the expected type of the argument.\n * @param position - The position of the argument in the function call, used for error reporting.\n * @param genericTypeParams - An array of type tags for generic type parameters, used when the parameter type is generic.\n * @group Implementation\n * @category Transactions\n */\nfunction parseArg(\n arg: SimpleEntryFunctionArgumentTypes,\n param: TypeTag,\n position: number,\n genericTypeParams: Array<TypeTag>,\n): EntryFunctionArgumentTypes {\n if (param.isBool()) {\n if (isBool(arg)) {\n return new Bool(arg);\n }\n if (isString(arg)) {\n if (arg === \"true\") return new Bool(true);\n if (arg === \"false\") return new Bool(false);\n }\n\n /**\n * Throws a type mismatch error for the specified move option.\n *\n * @param moveOption - The name of the move option that caused the type mismatch.\n * @param position - The position where the error occurred.\n * @group Implementation\n * @category Transactions\n */\n throwTypeMismatch(\"boolean\", position);\n }\n // TODO: support uint8array?\n if (param.isAddress()) {\n if (isString(arg)) {\n return AccountAddress.fromString(arg);\n }\n throwTypeMismatch(\"string | AccountAddress\", position);\n }\n if (param.isU8()) {\n const num = convertNumber(arg);\n if (num !== undefined) {\n return new U8(num);\n }\n throwTypeMismatch(\"number | string\", position);\n }\n if (param.isU16()) {\n const num = convertNumber(arg);\n if (num !== undefined) {\n return new U16(num);\n }\n throwTypeMismatch(\"number | string\", position);\n }\n if (param.isU32()) {\n const num = convertNumber(arg);\n if (num !== undefined) {\n return new U32(num);\n }\n throwTypeMismatch(\"number | string\", position);\n }\n if (param.isU64()) {\n if (isLargeNumber(arg)) {\n return new U64(BigInt(arg));\n }\n throwTypeMismatch(\"bigint | number | string\", position);\n }\n if (param.isU128()) {\n if (isLargeNumber(arg)) {\n return new U128(BigInt(arg));\n }\n throwTypeMismatch(\"bigint | number | string\", position);\n }\n if (param.isU256()) {\n if (isLargeNumber(arg)) {\n return new U256(BigInt(arg));\n }\n throwTypeMismatch(\"bigint | number | string\", position);\n }\n\n // Generic needs to use the subtype\n if (param.isGeneric()) {\n const genericIndex = param.value;\n if (genericIndex < 0 || genericIndex >= genericTypeParams.length) {\n throw new Error(`Generic argument ${param.toString()} is invalid for argument ${position}`);\n }\n\n return checkOrConvertArgument(arg, genericTypeParams[genericIndex], position, genericTypeParams);\n }\n\n // We have to special case some vectors for Vector<u8>\n if (param.isVector()) {\n // Check special case for Vector<u8>\n if (param.value.isU8()) {\n // We don't allow vector<u8>, but we convert strings to UTF8 Uint8Array\n // This is legacy behavior from the original SDK\n if (isString(arg)) {\n return MoveVector.U8(TEXT_ENCODER.encode(arg));\n }\n if (arg instanceof Uint8Array) {\n return MoveVector.U8(arg);\n }\n if (arg instanceof ArrayBuffer) {\n return MoveVector.U8(new Uint8Array(arg));\n }\n }\n\n // TODO: Support Uint16Array, Uint32Array, BigUint64Array?\n\n if (Array.isArray(arg)) {\n return new MoveVector(arg.map((item) => checkOrConvertArgument(item, param.value, position, genericTypeParams)));\n }\n\n throw new Error(`Type mismatch for argument ${position}, type '${param.toString()}'`);\n }\n\n // Handle structs as they're more complex\n if (param.isStruct()) {\n if (param.isString()) {\n if (isString(arg)) {\n return new MoveString(arg);\n }\n throwTypeMismatch(\"string\", position);\n }\n if (param.isObject()) {\n // The inner type of Object doesn't matter, since it's just syntactic sugar\n if (isString(arg)) {\n return AccountAddress.fromString(arg);\n }\n throwTypeMismatch(\"string | AccountAddress\", position);\n }\n\n if (param.isOption()) {\n if (isEmptyOption(arg)) {\n // Here we attempt to reconstruct the underlying type\n // Note, for some reason the `isBool` etc. does not work with the compiler\n const innerParam = param.value.typeArgs[0];\n if (innerParam instanceof TypeTagBool) {\n return new MoveOption<Bool>(null);\n }\n if (innerParam instanceof TypeTagAddress) {\n return new MoveOption<AccountAddress>(null);\n }\n if (innerParam instanceof TypeTagU8) {\n return new MoveOption<U8>(null);\n }\n if (innerParam instanceof TypeTagU16) {\n return new MoveOption<U16>(null);\n }\n if (innerParam instanceof TypeTagU32) {\n return new MoveOption<U32>(null);\n }\n if (innerParam instanceof TypeTagU64) {\n return new MoveOption<U64>(null);\n }\n if (innerParam instanceof TypeTagU128) {\n return new MoveOption<U128>(null);\n }\n if (innerParam instanceof TypeTagU256) {\n return new MoveOption<U256>(null);\n }\n\n // In all other cases, we will use a placeholder, it doesn't actually matter what the type is, but it will be obvious\n // Note: This is a placeholder U8 type, and does not match the actual type, as that can't be dynamically grabbed\n return new MoveOption<MoveString>(null);\n }\n\n return new MoveOption(checkOrConvertArgument(arg, param.value.typeArgs[0], position, genericTypeParams));\n }\n\n throw new Error(`Unsupported struct input type for argument ${position}, type '${param.toString()}'`);\n }\n\n throw new Error(`Type mismatch for argument ${position}, type '${param.toString()}'`);\n}\n\n/**\n * Checks that the type of the BCS encoded argument matches the ABI\n * @param param\n * @param arg\n * @param position\n * @group Implementation\n * @category Transactions\n */\nfunction checkType(param: TypeTag, arg: EntryFunctionArgumentTypes, position: number) {\n if (param.isBool()) {\n if (isBcsBool(arg)) {\n return;\n }\n throwTypeMismatch(\"Bool\", position);\n }\n if (param.isAddress()) {\n if (isBcsAddress(arg)) {\n return;\n }\n throwTypeMismatch(\"AccountAddress\", position);\n }\n if (param.isU8()) {\n if (isBcsU8(arg)) {\n return;\n }\n throwTypeMismatch(\"U8\", position);\n }\n if (param.isU16()) {\n if (isBcsU16(arg)) {\n return;\n }\n throwTypeMismatch(\"U16\", position);\n }\n if (param.isU32()) {\n if (isBcsU32(arg)) {\n return;\n }\n throwTypeMismatch(\"U32\", position);\n }\n if (param.isU64()) {\n if (isBcsU64(arg)) {\n return;\n }\n throwTypeMismatch(\"U64\", position);\n }\n if (param.isU128()) {\n if (isBcsU128(arg)) {\n return;\n }\n throwTypeMismatch(\"U128\", position);\n }\n if (param.isU256()) {\n if (isBcsU256(arg)) {\n return;\n }\n throwTypeMismatch(\"U256\", position);\n }\n if (param.isVector()) {\n if (arg instanceof MoveVector) {\n // If there's anything in it, check that the inner types match\n // Note that since it's typed, the first item should be the same as the rest\n if (arg.values.length > 0) {\n checkType(param.value, arg.values[0], position);\n }\n\n return;\n }\n throwTypeMismatch(\"MoveVector\", position);\n }\n\n // Handle structs as they're more complex\n if (param instanceof TypeTagStruct) {\n if (param.isString()) {\n if (isBcsString(arg)) {\n return;\n }\n throwTypeMismatch(\"MoveString\", position);\n }\n if (param.isObject()) {\n if (isBcsAddress(arg)) {\n return;\n }\n throwTypeMismatch(\"AccountAddress\", position);\n }\n if (param.isOption()) {\n if (arg instanceof MoveOption) {\n // If there's a value, we can check the inner type (otherwise it doesn't really matter)\n if (arg.value !== undefined) {\n checkType(param.value.typeArgs[0], arg.value, position);\n }\n return;\n }\n throwTypeMismatch(\"MoveOption\", position);\n }\n }\n\n throw new Error(`Type mismatch for argument ${position}, expected '${param.toString()}'`);\n}\n"],"mappings":"+fAiDA,IAAMA,EAAe,IAAI,YAUlB,SAASC,GAAoBC,EAAqD,CACvF,OACEA,GAAe,IAAKC,GAEdC,EAASD,CAAO,EACXE,EAAaF,CAAO,EAEtBA,CACR,GAAK,CAAC,CAEX,CAaA,eAAsBG,EACpBC,EACAC,EACAC,EACAC,EACmC,CAEnC,IAAMC,EAAS,MAAMC,EAAU,CAAE,YAAAF,EAAa,eAAgBH,EAAe,WAAAC,CAAW,CAAC,EAEzF,GAAIG,EAAO,IACT,OAAOA,EAAO,IAAI,kBAAkB,KAAME,GAASA,EAAK,OAASJ,CAAY,CAIjF,CAeA,eAAsBK,GACpBP,EACAC,EACAC,EACAC,EAC2B,CAC3B,IAAMK,EAAc,MAAMT,EAAiBC,EAAeC,EAAYC,EAAcC,CAAW,EAG/F,GAAI,CAACK,EACH,MAAM,IAAI,MAAM,0CAA0CR,CAAa,KAAKC,CAAU,KAAKC,CAAY,GAAG,EAI5G,GAAI,CAACM,EAAY,SACf,MAAM,IAAI,MAAM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","isString","parseTypeTag","fetchFunctionAbi","moduleAddress","moduleName","functionName","aptosConfig","module","getModule","func","fetchEntryFunctionAbi","functionAbi","numSigners","findFirstNonSignerArg","params","i","fetchViewFunctionAbi","returnTypes","convertArgument","arg","position","genericTypeParams","param","checkOrConvertArgument","isEncodedEntryFunctionArgument","checkType","parseArg","isBool","Bool","throwTypeMismatch","AccountAddress","num","convertNumber","U8","U16","U32","isLargeNumber","U64","U128","U256","genericIndex","MoveVector","item","MoveString","isEmptyOption","innerParam","TypeTagBool","MoveOption","TypeTagAddress","TypeTagU8","TypeTagU16","TypeTagU32","TypeTagU64","TypeTagU128","TypeTagU256","isBcsBool","isBcsAddress","isBcsU8","isBcsU16","isBcsU32","isBcsU64","isBcsU128","isBcsU256","TypeTagStruct","isBcsString"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/account/MultiKeyAccount.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { Account } from \"./Account\";\nimport { MultiKey, MultiKeySignature, PublicKey } from \"../core/crypto\";\nimport { AccountAddress, AccountAddressInput } from \"../core/accountAddress\";\nimport { HexInput, SigningScheme } from \"../types\";\nimport { AccountAuthenticatorMultiKey } from \"../transactions/authenticator/account\";\nimport { AnyRawTransaction } from \"../transactions/types\";\nimport { AbstractKeylessAccount, KeylessSigner } from \"./AbstractKeylessAccount\";\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { SingleKeyAccount, SingleKeySigner, SingleKeySignerOrLegacyEd25519Account } from \"./SingleKeyAccount\";\nimport { Ed25519Account } from \"./Ed25519Account\";\n\n/**\n * Arguments required to verify a multi-key signature against a given message.\n *\n * @param message - The original message that was signed.\n * @param signature - The multi-key signature to be verified.\n * @group Implementation\n * @category Account (On-Chain Model)\n */\nexport interface VerifyMultiKeySignatureArgs {\n message: HexInput;\n signature: MultiKeySignature;\n}\n\n/**\n * Signer implementation for the MultiKey authentication scheme.\n *\n * This account utilizes an M of N signing scheme, where M and N are specified in the {@link MultiKey}.\n * It signs messages using an array of M accounts, each corresponding to a public key in the {@link MultiKey}.\n *\n * Note: Generating a signer instance does not create the account on-chain.\n * @group Implementation\n * @category Account (On-Chain Model)\n */\nexport class MultiKeyAccount implements Account, KeylessSigner {\n /**\n * Public key associated with the account\n * @group Implementation\n * @category Account (On-Chain Model)\n */\n readonly publicKey: MultiKey;\n\n /**\n * Account address associated with the account\n * @group Implementation\n * @category Account (On-Chain Model)\n */\n readonly accountAddress: AccountAddress;\n\n /**\n * Signing scheme used to sign transactions\n * @group Implementation\n * @category Account (On-Chain Model)\n */\n readonly signingScheme: SigningScheme = SigningScheme.MultiKey;\n\n /**\n * The signers used to sign messages. These signers should correspond to public keys in the\n * MultiKeyAccount's public key. The number of signers should be equal or greater\n * than this.publicKey.signaturesRequired\n * @group Implementation\n * @category Account (On-Chain Model)\n */\n readonly signers: Account[];\n\n /**\n * An array of indices where for signer[i], signerIndicies[i] is the index of the corresponding public key in\n * publicKey.publicKeys. Used to derive the right public key to use for verification.\n * @group Implementation\n * @category Account (On-Chain Model)\n */\n // TODO: Rename Indicies to Indices\n readonly signerIndicies: number[];\n\n readonly signaturesBitmap: Uint8Array;\n\n /**\n * Constructs a MultiKeyAccount instance, which requires multiple signatures for transactions.\n *\n * @param args - The arguments for creating a MultiKeyAccount.\n * @param args.multiKey - The multikey of the account consisting of N public keys and a number M representing the required signatures.\n * @param args.signers - An array of M signers that will be used to sign the transaction.\n * @param args.address - An optional account address input. If not provided, the derived address from the public key will be used.\n * @group Implementation\n * @category Account (On-Chain Model)\n */\n constructor(args: {\n multiKey: MultiKey;\n signers: SingleKeySignerOrLegacyEd25519Account[];\n address?: AccountAddressInput;\n }) {\n const { multiKey, address } = args;\n\n const signers: SingleKeySigner[] = args.signers.map((signer) =>\n signer instanceof Ed25519Account ? SingleKeyAccount.fromEd25519Account(signer) : signer,\n );\n\n if (multiKey.signaturesRequired > signers.length) {\n throw new Error(\n // eslint-disable-next-line max-len\n `Not enough signers provided to satisfy the required signatures. Need ${multiKey.signaturesRequired} signers, but only ${signers.length} provided`,\n );\n } else if (multiKey.signaturesRequired < signers.length) {\n throw new Error(\n // eslint-disable-next-line max-len\n `More signers provided than required. Need ${multiKey.signaturesRequired} signers, but ${signers.length} provided`,\n );\n }\n\n this.publicKey = multiKey;\n\n this.accountAddress = address ? AccountAddress.from(address) : this.publicKey.authKey().derivedAddress();\n\n // For each signer, find its corresponding position in the MultiKey's public keys array\n const bitPositions: number[] = [];\n for (const signer of signers) {\n bitPositions.push(this.publicKey.getIndex(signer.getAnyPublicKey()));\n }\n\n // Create pairs of [signer, position] and sort them by position\n // This sorting is critical because:\n // 1. The on-chain verification expects signatures to be in ascending order by bit position\n // 2. The bitmap must match the order of signatures when verifying\n const signersAndBitPosition: [Account, number][] = signers.map((signer, index) => [signer, bitPositions[index]]);\n signersAndBitPosition.sort((a, b) => a[1] - b[1]);\n\n // Extract the sorted signers and their positions into separate arrays\n this.signers = signersAndBitPosition.map((value) => value[0]);\n this.signerIndicies = signersAndBitPosition.map((value) => value[1]);\n\n // Create a bitmap representing which public keys from the MultiKey are being used\n // This bitmap is used during signature verification to identify which public keys\n // should be used to verify each signature\n this.signaturesBitmap = this.publicKey.createBitmap({ bits: bitPositions });\n }\n\n /**\n * Static constructor to create a MultiKeyAccount using the provided public keys and signers.\n *\n * @param args - The arguments for creating a MultiKeyAccount.\n * @param args.publicKeys - The N public keys of the MultiKeyAccount.\n * @param args.signaturesRequired - The number of signatures required to authorize a transaction.\n * @param args.signers - An array of M signers that will be used to sign the transaction.\n * @returns MultiKeyAccount - The newly created MultiKeyAccount.\n * @group Implementation\n * @category Account (On-Chain Model)\n */\n static fromPublicKeysAndSigners(args: {\n publicKeys: PublicKey[];\n signaturesRequired: number;\n signers: SingleKeySignerOrLegacyEd25519Account[];\n }): MultiKeyAccount {\n const { publicKeys, signaturesRequired, signers } = args;\n const multiKey = new MultiKey({ publicKeys, signaturesRequired });\n return new MultiKeyAccount({ multiKey, signers });\n }\n\n /**\n * Determines if the provided account is a multi-key account.\n *\n * @param account - The account to check.\n * @returns A boolean indicating whether the account is a multi-key account.\n * @group Implementation\n * @category Account (On-Chain Model)\n */\n static isMultiKeySigner(account: Account): account is MultiKeyAccount {\n return account instanceof MultiKeyAccount;\n }\n\n /**\n * Sign a message using the account's signers and return an AccountAuthenticator containing the signature along with the\n * account's public key.\n * @param message - The signing message, represented as binary input in hexadecimal format.\n * @returns An instance of AccountAuthenticatorMultiKey that includes the signature and the public key.\n * @group Implementation\n * @category Account (On-Chain Model)\n */\n signWithAuthenticator(message: HexInput): AccountAuthenticatorMultiKey {\n return new AccountAuthenticatorMultiKey(this.publicKey, this.sign(message));\n }\n\n /**\n * Sign a transaction using the account's signers, returning an AccountAuthenticator that contains the signature and the\n * account's public key.\n * @param transaction - The raw transaction to be signed.\n * @returns An AccountAuthenticatorMultiKey containing the signature of the transaction along with the account's public key.\n * @group Implementation\n * @category Account (On-Chain Model)\n */\n signTransactionWithAuthenticator(transaction: AnyRawTransaction): AccountAuthenticatorMultiKey {\n return new AccountAuthenticatorMultiKey(this.publicKey, this.signTransaction(transaction));\n }\n\n /**\n * Waits for any proofs on KeylessAccount signers to be fetched. This ensures that signing with the KeylessAccount does not\n * fail due to missing proofs.\n * @return {Promise<void>} A promise that resolves when all proofs have been fetched.\n * @group Implementation\n * @category Account (On-Chain Model)\n */\n async waitForProofFetch(): Promise<void> {\n const keylessSigners = this.signers.filter(\n (signer) => signer instanceof AbstractKeylessAccount,\n ) as AbstractKeylessAccount[];\n const promises = keylessSigners.map(async (signer) => signer.waitForProofFetch());\n await Promise.all(promises);\n }\n\n /**\n * Validates that the Keyless Account can be used to sign transactions.\n * @return\n * @group Implementation\n * @category Account (On-Chain Model)\n */\n async checkKeylessAccountValidity(aptosConfig: AptosConfig): Promise<void> {\n const keylessSigners = this.signers.filter(\n (signer) => signer instanceof AbstractKeylessAccount,\n ) as AbstractKeylessAccount[];\n const promises = keylessSigners.map((signer) => signer.checkKeylessAccountValidity(aptosConfig));\n await Promise.all(promises);\n }\n\n /**\n * Sign the given message using the MultiKeyAccount's signers\n * @param data - The data to be signed in HexInput format.\n * @returns MultiKeySignature\n * @group Implementation\n * @category Account (On-Chain Model)\n */\n sign(data: HexInput): MultiKeySignature {\n const signatures = [];\n for (const signer of this.signers) {\n signatures.push(signer.sign(data));\n }\n return new MultiKeySignature({ signatures, bitmap: this.signaturesBitmap });\n }\n\n /**\n * Sign the given transaction using the MultiKeyAccount's signers.\n * This function aggregates signatures from all signers associated with the MultiKeyAccount.\n *\n * @param transaction - The transaction to be signed.\n * @returns MultiKeySignature - An object containing the aggregated signatures and a bitmap of the signatures.\n * @group Implementation\n * @category Account (On-Chain Model)\n */\n signTransaction(transaction: AnyRawTransaction): MultiKeySignature {\n const signatures = [];\n for (const signer of this.signers) {\n signatures.push(signer.signTransaction(transaction));\n }\n return new MultiKeySignature({ signatures, bitmap: this.signaturesBitmap });\n }\n\n /**\n * Verify the given message and signature with the public keys.\n *\n * This function checks if the provided signatures are valid for the given message using the corresponding public keys.\n *\n * @param args - The arguments for verifying the signature.\n * @param args.message - The raw message data in HexInput format.\n * @param args.signature - The signed message MultiKeySignature containing multiple signatures.\n * @returns A boolean indicating whether the signatures are valid for the message.\n * @group Implementation\n * @category Account (On-Chain Model)\n */\n verifySignature(args: VerifyMultiKeySignatureArgs): boolean {\n const { message, signature } = args;\n const isSignerIndicesSorted = this.signerIndicies.every(\n (value, i) => i === 0 || value >= this.signerIndicies[i - 1],\n );\n if (!isSignerIndicesSorted) {\n return false;\n }\n for (let i = 0; i < signature.signatures.length; i += 1) {\n const singleSignature = signature.signatures[i];\n const publicKey = this.publicKey.publicKeys[this.signerIndicies[i]];\n if (!publicKey.verifySignature({ message, signature: singleSignature })) {\n return false;\n }\n }\n return true;\n }\n}\n"],"mappings":"6PAqCO,IAAMA,EAAN,MAAMC,CAAkD,CAoD7D,YAAYC,EAIT,CApCH,KAAS,cA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U,WAAW,OAAQC,GAAK,EAAG,CACvD,IAAMC,EAAkBF,EAAU,WAAWC,CAAC,EAE9C,GAAI,CADc,KAAK,UAAU,WAAW,KAAK,eAAeA,CAAC,CAAC,EACnD,gBAAgB,CAAE,QAAAV,EAAS,UAAWW,CAAgB,CAAC,EACpE,MAAO,EAEX,CACA,MAAO,EACT,CACF","names":["MultiKeyAccount","_MultiKeyAccount","args","multiKey","address","signers","signer","Ed25519Account","SingleKeyAccount","AccountAddress","bitPositions","signersAndBitPosition","index","a","b","value","publicKeys","signaturesRequired","MultiKey","account","message","AccountAuthenticatorMultiKey","transaction","promises","AbstractKeylessAccount","aptosConfig","data","signatures","MultiKeySignature","signature","i","singleSignature"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{e as r}from"./chunk-QHEKBHNU.mjs";import{a as d}from"./chunk-77AEKF7K.mjs";async function A(s,u){let{url:t,method:n,body:i,contentType:a,params:o,overrides:e,originMethod:R}=s,p={...e?.HEADERS,"x-aptos-client":`aptos-typescript-sdk/${d}`,"content-type":a??"application/json","x-aptos-typescript-sdk-origin-method":R};return e?.AUTH_TOKEN&&(p.Authorization=`Bearer ${e?.AUTH_TOKEN}`),e?.API_KEY&&(p.Authorization=`Bearer ${e?.API_KEY}`),u.provider({url:t,method:n,body:i,params:o,headers:p,overrides:e})}async function P(s,u,t){let{url:n,path:i}=s,a=i?`${n}/${i}`:n,o=await A({...s,url:a},u.client),e={status:o.status,statusText:o.statusText??"No status text provided",data:o.data,headers:o.headers,config:o.config,request:o.request,url:a};if(e.status===401)throw new r({apiType:t,aptosRequest:s,aptosResponse:e});if(t==="Indexer"){let R=e.data;if(R.errors)throw new r({apiType:t,aptosRequest:s,aptosResponse:e});e.data=R.data}else if((t==="Pepper"||t==="Prover")&&e.status>=400)throw new r({apiType:t,aptosRequest:s,aptosResponse:e});if(e.status>=200&&e.status<300)return e;throw new r({apiType:t,aptosRequest:s,aptosResponse:e})}export{A as a,P as b};
|
|
2
|
-
//# sourceMappingURL=chunk-OSBRPVVI.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/client/core.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { VERSION } from \"../version\";\nimport { AnyNumber, AptosRequest, AptosResponse, Client, ClientRequest, ClientResponse, MimeType } from \"../types\";\nimport { AptosApiType } from \"../utils\";\nimport { AptosApiError } from \"../errors\";\n\n/**\n * Sends a request using the specified options and returns the response.\n *\n * @param options - The options for the request.\n * @param options.url - The URL to send the request to.\n * @param options.method - The HTTP method to use for the request.\n * @param options.body - The body of the request.\n * @param options.contentType - The content type of the request.\n * @param options.params - The query parameters to include in the request.\n * @param options.overrides - Additional overrides for the request.\n * @param options.overrides.HEADERS - Custom headers to include in the request.\n * @param options.overrides.AUTH_TOKEN - The authorization token for the request.\n * @param options.overrides.API_KEY - The API key for the request.\n * @param options.originMethod - The origin method for the request.\n * @param client - The client used to make the request.\n *\n * @returns The response from the request.\n * @group Implementation\n * @category Client\n */\nexport async function request<Req, Res>(options: ClientRequest<Req>, client: Client): Promise<ClientResponse<Res>> {\n const { url, method, body, contentType, params, overrides, originMethod } = options;\n const headers: Record<string, string | AnyNumber | boolean | undefined> = {\n ...overrides?.HEADERS,\n \"x-aptos-client\": `aptos-typescript-sdk/${VERSION}`,\n \"content-type\": contentType ?? MimeType.JSON,\n \"x-aptos-typescript-sdk-origin-method\": originMethod,\n };\n\n if (overrides?.AUTH_TOKEN) {\n headers.Authorization = `Bearer ${overrides?.AUTH_TOKEN}`;\n }\n if (overrides?.API_KEY) {\n headers.Authorization = `Bearer ${overrides?.API_KEY}`;\n }\n\n /*\n * make a call using the @aptos-labs/aptos-client package\n * {@link https://www.npmjs.com/package/@aptos-labs/aptos-client}\n */\n return client.provider<Req, Res>({\n url,\n method,\n body,\n params,\n headers,\n overrides,\n });\n}\n\n/**\n * The main function to use when making an API request, returning the response or throwing an AptosApiError on failure.\n *\n * @param aptosRequestOpts - Options for the Aptos request, including the URL and path.\n * @param aptosConfig - The configuration information for the SDK client instance.\n * @param apiType - The type of API being accessed, which determines how the response is handled.\n * @returns The response from the API request or throws an AptosApiError if the request fails.\n * @group Implementation\n * @category Client\n */\nexport async function aptosRequest<Req extends {}, Res extends {}>(\n aptosRequestOpts: AptosRequest,\n aptosConfig: AptosConfig,\n apiType: AptosApiType,\n): Promise<AptosResponse<Req, Res>> {\n const { url, path } = aptosRequestOpts;\n const fullUrl = path ? `${url}/${path}` : url;\n const clientResponse = await request<Req, Res>({ ...aptosRequestOpts, url: fullUrl }, aptosConfig.client);\n\n const aptosResponse: AptosResponse<Req, Res> = {\n status: clientResponse.status,\n statusText: clientResponse.statusText ?? \"No status text provided\",\n data: clientResponse.data,\n headers: clientResponse.headers,\n config: clientResponse.config,\n request: clientResponse.request,\n url: fullUrl,\n };\n\n // Handle case for `Unauthorized` error (i.e. API_KEY error)\n if (aptosResponse.status === 401) {\n throw new AptosApiError({ apiType, aptosRequest: aptosRequestOpts, aptosResponse });\n }\n\n // to support both fullnode and indexer responses,\n // check if it is an indexer query, and adjust response.data\n if (apiType === AptosApiType.INDEXER) {\n const indexerResponse = aptosResponse.data as any;\n // Handle Indexer general errors\n if (indexerResponse.errors) {\n throw new AptosApiError({\n apiType,\n aptosRequest: aptosRequestOpts,\n aptosResponse,\n });\n }\n aptosResponse.data = indexerResponse.data as Res;\n } else if (apiType === AptosApiType.PEPPER || apiType === AptosApiType.PROVER) {\n if (aptosResponse.status >= 400) {\n throw new AptosApiError({ apiType, aptosRequest: aptosRequestOpts, aptosResponse });\n }\n }\n\n if (aptosResponse.status >= 200 && aptosResponse.status < 300) {\n return aptosResponse;\n }\n\n // We have to explicitly check for all request types, because if the error is a non-indexer error, but\n // comes from an indexer request (e.g. 404), we'll need to mention it appropriately\n throw new AptosApiError({ apiType, aptosRequest: aptosRequestOpts, aptosResponse });\n}\n"],"mappings":"k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AAc,CAAE,QAAAL,EAAS,aAAcF,EAAkB,cAAAM,CAAc,CAAC,EAItF,GAAIA,EAAc,QAAU,KAAOA,EAAc,OAAS,IACxD,OAAOA,EAKT,MAAM,IAAIC,EAAc,CAAE,QAAAL,EAAS,aAAcF,EAAkB,cAAAM,CAAc,CAAC,CACpF","names":["request","options","client","url","method","body","contentType","params","overrides","originMethod","headers","VERSION","aptosRequest","aptosRequestOpts","aptosConfig","apiType","path","fullUrl","clientResponse","aptosResponse","AptosApiError","indexerResponse"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/internal/view.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { LedgerVersionArg, MimeType, MoveValue } from \"../types\";\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport {\n generateViewFunctionPayload,\n InputViewFunctionData,\n InputViewFunctionJsonData,\n ViewFunctionJsonPayload,\n} from \"../transactions\";\nimport { Serializer } from \"../bcs\";\nimport { postAptosFullNode } from \"../client\";\n\nexport async function view<T extends Array<MoveValue> = Array<MoveValue>>(args: {\n aptosConfig: AptosConfig;\n payload: InputViewFunctionData;\n options?: LedgerVersionArg;\n}): Promise<T> {\n const { aptosConfig, payload, options } = args;\n const viewFunctionPayload = await generateViewFunctionPayload({\n ...payload,\n aptosConfig,\n });\n\n const serializer = new Serializer();\n viewFunctionPayload.serialize(serializer);\n const bytes = serializer.toUint8Array();\n\n const { data } = await postAptosFullNode<Uint8Array, MoveValue[]>({\n aptosConfig,\n path: \"view\",\n originMethod: \"view\",\n contentType: MimeType.BCS_VIEW_FUNCTION,\n params: { ledger_version: options?.ledgerVersion },\n body: bytes,\n });\n\n return data as T;\n}\n\nexport async function viewJson<T extends Array<MoveValue> = Array<MoveValue>>(args: {\n aptosConfig: AptosConfig;\n payload: InputViewFunctionJsonData;\n options?: LedgerVersionArg;\n}): Promise<T> {\n const { aptosConfig, payload, options } = args;\n const { data } = await postAptosFullNode<ViewFunctionJsonPayload, MoveValue[]>({\n aptosConfig,\n originMethod: \"viewJson\",\n path: \"view\",\n params: { ledger_version: options?.ledgerVersion },\n body: {\n function: payload.function,\n type_arguments: payload.typeArguments ?? [],\n arguments: payload.functionArguments ?? [],\n },\n });\n\n return data as T;\n}\n"],"mappings":"2HAcA,eAAsBA,EAAoDC,EAI3D,CACb,GAAM,CAAE,YAAAC,EAAa,QAAAC,EAAS,QAAAC,CAAQ,EAAIH,EACpCI,EAAsB,MAAMC,EAA4B,CAC5D,GAAGH,EACH,YAAAD,CACF,CAAC,EAEKK,EAAa,IAAIC,EACvBH,EAAoB,UAAUE,CAAU,EACxC,IAAME,EAAQF,EAAW,aAAa,EAEhC,CAAE,KAAAG,CAAK,EAAI,MAAMC,EAA2C,CAChE,YAAAT,EACA,KAAM,OACN,aAAc,OACd,oDACA,OAAQ,CAAE,eAAgBE,GAAS,aAAc,EACjD,KAAMK,CACR,CAAC,EAED,OAAOC,CACT,CAEA,eAAsBE,EAAwDX,EAI/D,CACb,GAAM,CAAE,YAAAC,EAAa,QAAAC,EAAS,QAAAC,CAAQ,EAAIH,EACpC,CAAE,KAAAS,CAAK,EAAI,MAAMC,EAAwD,CAC7E,YAAAT,EACA,aAAc,WACd,KAAM,OACN,OAAQ,CAAE,eAAgBE,GAAS,aAAc,EACjD,KAAM,CACJ,SAAUD,EAAQ,SAClB,eAAgBA,EAAQ,eAAiB,CAAC,EAC1C,UAAWA,EAAQ,mBAAqB,CAAC,CAC3C,CACF,CAAC,EAED,OAAOO,CACT","names":["view","args","aptosConfig","payload","options","viewFunctionPayload","generateViewFunctionPayload","serializer","Serializer","bytes","data","postAptosFullNode","viewJson"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as b,b as p}from"./chunk-VVXBVJXD.mjs";import{a as z,b as A}from"./chunk-6YWYAVFS.mjs";import{a as h,b as g}from"./chunk-VUIHJIMX.mjs";import{b as d,d as y}from"./chunk-FZD5RWSZ.mjs";import{a as o}from"./chunk-EBMEXURY.mjs";var s=class extends o{static deserialize(e){let i=e.deserializeUleb128AsU32();switch(i){case 0:return u.load(e);case 1:return l.load(e);case 2:return n.load(e);case 3:return a.load(e);case 4:return c.load(e);default:throw new Error(`Unknown variant index for AccountAuthenticator: ${i}`)}}isEd25519(){return this instanceof u}isMultiEd25519(){return this instanceof l}isSingleKey(){return this instanceof n}isMultiKey(){return this instanceof a}},u=class t extends s{constructor(e,i){super(),this.public_key=e,this.signature=i}serialize(e){e.serializeU32AsUleb128(0),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let i=d.deserialize(e),r=y.deserialize(e);return new t(i,r)}},l=class t extends s{constructor(e,i){super(),this.public_key=e,this.signature=i}serialize(e){e.serializeU32AsUleb128(1),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let i=b.deserialize(e),r=p.deserialize(e);return new t(i,r)}},n=class t extends s{constructor(e,i){super(),this.public_key=e,this.signature=i}serialize(e){e.serializeU32AsUleb128(2),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let i=h.deserialize(e),r=g.deserialize(e);return new t(i,r)}},a=class t extends s{constructor(e,i){super(),this.public_keys=e,this.signatures=i}serialize(e){e.serializeU32AsUleb128(3),this.public_keys.serialize(e),this.signatures.serialize(e)}static load(e){let i=z.deserialize(e),r=A.deserialize(e);return new t(i,r)}},c=class t extends s{serialize(e){e.serializeU32AsUleb128(4)}static load(e){return new t}};export{s as a,u as b,l as c,n as d,a as e,c as f};
|
|
2
|
-
//# sourceMappingURL=chunk-QHC5DKVZ.mjs.map
|
|
@@ -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 * @group Implementation\n * @category Transactions\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 * @group Implementation\n * @category Transactions\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 * @group Implementation\n * @category Transactions\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 * @group Implementation\n * @category Transactions\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 * @group Implementation\n * @category Transactions\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 * @group Implementation\n * @category Transactions\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 * @group Implementation\n * @category Transactions\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 * @group Implementation\n * @category Transactions\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 * @group Implementation\n * @category Transactions\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 * @group Implementation\n * @category Transactions\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 * @group Implementation\n * @category Transactions\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 * @group Implementation\n * @category Transactions\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 * @group Implementation\n * @category Transactions\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":"yOAqBO,IAAeA,EAAf,cAA4CC,CAAa,CAW9D,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,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AW,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,EAUaJ,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,2 +0,0 @@
|
|
|
1
|
-
import{b as p}from"./chunk-OSBRPVVI.mjs";async function o(e){let{type:t,originMethod:s,path:i,body:r,acceptType:R,contentType:f,params:c,aptosConfig:n,overrides:A}=e,d=n.getRequestUrl(t);return p({url:d,method:"POST",originMethod:s,path:i,body:r,contentType:f,acceptType:R,params:c,overrides:A},n,e.type)}async function q(e){let{aptosConfig:t}=e;return o({...e,type:"Fullnode",overrides:{...t.clientConfig,...t.fullnodeConfig,...e.overrides,HEADERS:{...t.clientConfig?.HEADERS,...t.fullnodeConfig?.HEADERS}}})}async function C(e){let{aptosConfig:t}=e;return o({...e,type:"Indexer",overrides:{...t.clientConfig,...t.indexerConfig,...e.overrides,HEADERS:{...t.clientConfig?.HEADERS,...t.indexerConfig?.HEADERS}}})}async function E(e){let{aptosConfig:t}=e,s={...t,clientConfig:{...t.clientConfig}};return delete s?.clientConfig?.API_KEY,o({...e,type:"Faucet",overrides:{...s.clientConfig,...s.faucetConfig,...e.overrides,HEADERS:{...s.clientConfig?.HEADERS,...s.faucetConfig?.HEADERS}}})}async function a(e){return o({...e,type:"Pepper"})}async function m(e){return o({...e,type:"Prover"})}export{o as a,q as b,C as c,E as d,a as e,m as f};
|
|
2
|
-
//# sourceMappingURL=chunk-S4LZMY2L.mjs.map
|
|
@@ -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 * @group Implementation\n * @category Client\n */\nexport type PostRequestOptions = {\n /**\n * The config for the API client\n * @group Implementation\n * @category Client\n */\n aptosConfig: AptosConfig;\n /**\n * The type of API endpoint to call e.g. fullnode, indexer, etc\n * @group Implementation\n * @category Client\n */\n type: AptosApiType;\n /**\n * The name of the API method\n * @group Implementation\n * @category Client\n */\n originMethod: string;\n /**\n * The URL path to the API method\n * @group Implementation\n * @category Client\n */\n path: string;\n /**\n * The content type of the request body\n * @group Implementation\n * @category Client\n */\n contentType?: MimeType;\n /**\n * The accepted content type of the response of the API\n * @group Implementation\n * @category Client\n */\n acceptType?: MimeType;\n /**\n * The query parameters for the request\n * @group Implementation\n * @category Client\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 * @group Implementation\n * @category Client\n */\n body?: any;\n /**\n * Specific client overrides for this request to override aptosConfig\n * @group Implementation\n * @category Client\n */\n overrides?: ClientConfig;\n};\n\n/**\n * Options for posting a request to Aptos, excluding the type field.\n * @group Implementation\n * @category Client\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 * @group Implementation\n * @category Client\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 * @group Implementation\n * @category Client\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 * @group Implementation\n * @category Client\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 * Note that only devnet has a publicly accessible faucet. For testnet, you must use\n * the minting page at https://aptos.dev/network/faucet.\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 * @group Implementation\n * @category Client\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 * @group Implementation\n * @category Client\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 * @group Implementation\n * @category Client\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":"yCA8FA,eAAsBA,EACpBC,EACkC,CAClC,GAAM,CAAE,KAAAC,EAAM,aAAAC,EAAc,KAAAC,EAAM,KAAAC,EAAM,WAAAC,EAAY,YAAAC,EAAa,OAAAC,EAAQ,YAAAC,EAAa,U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ClC,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"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as i}from"./chunk-IF4UU2MT.mjs";import{bytesToHex as o,hexToBytes as s}from"@noble/hashes/utils";var u=(n=>(n.TOO_SHORT="too_short",n.INVALID_LENGTH="invalid_length",n.INVALID_HEX_CHARS="invalid_hex_chars",n))(u||{}),a=class e{constructor(t){this.data=t}toUint8Array(){return this.data}toStringWithoutPrefix(){return o(this.data)}toString(){return`0x${this.toStringWithoutPrefix()}`}static fromHexString(t){let r=t;if(r.startsWith("0x")&&(r=r.slice(2)),r.length===0)throw new i("Hex string is too short, must be at least 1 char long, excluding the optional leading 0x.","too_short");if(r.length%2!==0)throw new i("Hex string must be an even number of hex characters.","invalid_length");try{return new e(s(r))}catch(n){throw new i(`Hex string contains invalid hex characters: ${n?.message}`,"invalid_hex_chars")}}static fromHexInput(t){return t instanceof Uint8Array?new e(t):e.fromHexString(t)}static hexInputToUint8Array(t){return t instanceof Uint8Array?t:e.fromHexString(t).toUint8Array()}static hexInputToString(t){return e.fromHexInput(t).toString()}static hexInputToStringWithoutPrefix(t){return e.fromHexInput(t).toStringWithoutPrefix()}static isValid(t){try{return e.fromHexString(t),{valid:!0}}catch(r){return{valid:!1,invalidReason:r?.invalidReason,invalidReasonMessage:r?.message}}}equals(t){return this.data.length!==t.data.length?!1:this.data.every((r,n)=>r===t.data[n])}},l=e=>new TextDecoder().decode(a.fromHexInput(e).toUint8Array());export{u as a,a as b,l as c};
|
|
2
|
-
//# sourceMappingURL=chunk-STY74NUA.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/core/hex.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { bytesToHex, hexToBytes } from \"@noble/hashes/utils\";\nimport { ParsingError, ParsingResult } from \"./common\";\nimport { HexInput } from \"../types\";\n\n/**\n * Provides reasons for parsing failures related to hexadecimal values.\n * @group Implementation\n * @category Serialization\n */\nexport enum HexInvalidReason {\n TOO_SHORT = \"too_short\",\n INVALID_LENGTH = \"invalid_length\",\n INVALID_HEX_CHARS = \"invalid_hex_chars\",\n}\n\n/**\n * NOTE: Do not use this class when working with account addresses; use AccountAddress instead.\n * When accepting hex data as input to a function, prefer to accept HexInput and\n *\n * A helper class for working with hex data. Hex data, when represented as a string,\n * generally looks like this, for example: 0xaabbcc, 45cd32, etc.\n *\n * then use the static helper methods of this class to convert it into the desired\n * format. This enables the greatest flexibility for the developer.\n *\n * Example usage:\n * ```typescript\n * getTransactionByHash(txnHash: HexInput): Promise<Transaction> {\n * const txnHashString = Hex.fromHexInput(txnHash).toString();\n * return await getTransactionByHashInner(txnHashString);\n * }\n * ```\n * This call to `Hex.fromHexInput().toString()` converts the HexInput to a hex string\n * with a leading 0x prefix, regardless of what the input format was.\n *\n * Other ways to chain the functions together:\n * - `Hex.fromHexString({ hexInput: \"0x1f\" }).toUint8Array()`\n * - `new Hex([1, 3]).toStringWithoutPrefix()`\n * @group Implementation\n * @category Serialization\n */\nexport class Hex {\n private readonly data: Uint8Array;\n\n /**\n * Create a new Hex instance from a Uint8Array.\n *\n * @param data - The Uint8Array containing the data to initialize the Hex instance.\n * @group Implementation\n * @category Serialization\n */\n constructor(data: Uint8Array) {\n this.data = data;\n }\n\n // ===\n // Methods for representing an instance of Hex as other types.\n // ===\n\n /**\n * Get the inner hex data as a Uint8Array. The inner data is already a Uint8Array, so no conversion takes place.\n *\n * @returns Hex data as Uint8Array\n * @group Implementation\n * @category Serialization\n */\n toUint8Array(): Uint8Array {\n return this.data;\n }\n\n /**\n * Get the hex data as a string without the 0x prefix.\n *\n * @returns Hex string without 0x prefix\n * @group Implementation\n * @category Serialization\n */\n toStringWithoutPrefix(): string {\n return bytesToHex(this.data);\n }\n\n /**\n * Get the hex data as a string with the 0x prefix.\n *\n * @returns Hex string with 0x prefix\n * @group Implementation\n * @category Serialization\n */\n toString(): string {\n return `0x${this.toStringWithoutPrefix()}`;\n }\n\n // ===\n // Methods for creating an instance of Hex from other types.\n // ===\n\n /**\n * Converts a hex string into a Hex instance, allowing for both prefixed and non-prefixed formats.\n *\n * @param str - A hex string, with or without the 0x prefix.\n *\n * @throws ParsingError - If the hex string is too short, has an odd number of characters, or contains invalid hex characters.\n *\n * @returns Hex - The resulting Hex instance created from the provided string.\n * @group Implementation\n * @category Serialization\n */\n static fromHexString(str: string): Hex {\n let input = str;\n\n if (input.startsWith(\"0x\")) {\n input = input.slice(2);\n }\n\n if (input.length === 0) {\n throw new ParsingError(\n \"Hex string is too short, must be at least 1 char long, excluding the optional leading 0x.\",\n HexInvalidReason.TOO_SHORT,\n );\n }\n\n if (input.length % 2 !== 0) {\n throw new ParsingError(\"Hex string must be an even number of hex characters.\", HexInvalidReason.INVALID_LENGTH);\n }\n\n try {\n return new Hex(hexToBytes(input));\n } catch (error: any) {\n throw new ParsingError(\n `Hex string contains invalid hex characters: ${error?.message}`,\n HexInvalidReason.INVALID_HEX_CHARS,\n );\n }\n }\n\n /**\n * Converts an instance of HexInput, which can be a string or a Uint8Array, into a Hex instance.\n * This function is useful for transforming hexadecimal representations into a structured Hex object for further manipulation.\n *\n * @param hexInput - A HexInput which can be a string or Uint8Array.\n * @returns A Hex instance created from the provided hexInput.\n * @group Implementation\n * @category Serialization\n */\n static fromHexInput(hexInput: HexInput): Hex {\n if (hexInput instanceof Uint8Array) return new Hex(hexInput);\n return Hex.fromHexString(hexInput);\n }\n\n /**\n * Converts an instance of HexInput, which can be a string or a Uint8Array, into a Uint8Array.\n *\n * @param hexInput - A HexInput which can be a string or Uint8Array.\n * @returns A Uint8Array created from the provided hexInput.\n */\n static hexInputToUint8Array(hexInput: HexInput): Uint8Array {\n if (hexInput instanceof Uint8Array) return hexInput;\n return Hex.fromHexString(hexInput).toUint8Array();\n }\n\n /**\n * Converts a HexInput (string or Uint8Array) to a hex string with '0x' prefix.\n *\n * @param hexInput - The input to convert, either a hex string (with/without '0x' prefix) or Uint8Array\n * @returns A hex string with '0x' prefix (e.g., \"0x1234\")\n *\n * @example\n * ```typescript\n * Hex.hexInputToString(\"1234\") // returns \"0x1234\"\n * Hex.hexInputToString(\"0x1234\") // returns \"0x1234\"\n * Hex.hexInputToString(new Uint8Array([0x12, 0x34])) // returns \"0x1234\"\n * ```\n */\n static hexInputToString(hexInput: HexInput): string {\n return Hex.fromHexInput(hexInput).toString();\n }\n\n /**\n * Converts a HexInput (string or Uint8Array) to a hex string without '0x' prefix.\n *\n * @param hexInput - The input to convert, either a hex string (with/without '0x' prefix) or Uint8Array\n * @returns A hex string without '0x' prefix (e.g., \"1234\")\n *\n * @example\n * ```typescript\n * Hex.hexInputToStringWithoutPrefix(\"1234\") // returns \"1234\"\n * Hex.hexInputToStringWithoutPrefix(\"0x1234\") // returns \"1234\"\n * Hex.hexInputToStringWithoutPrefix(new Uint8Array([0x12, 0x34])) // returns \"1234\"\n * ```\n */\n static hexInputToStringWithoutPrefix(hexInput: HexInput): string {\n return Hex.fromHexInput(hexInput).toStringWithoutPrefix();\n }\n\n // ===\n // Methods for checking validity.\n // ===\n\n /**\n * Check if the provided string is a valid hexadecimal representation.\n *\n * @param str - A hex string representing byte data.\n *\n * @returns An object containing:\n * - valid: A boolean indicating whether the string is valid.\n * - invalidReason: The reason for invalidity if the string is not valid.\n * - invalidReasonMessage: A message explaining why the string is invalid.\n * @group Implementation\n * @category Serialization\n */\n static isValid(str: string): ParsingResult<HexInvalidReason> {\n try {\n Hex.fromHexString(str);\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 Hex instances are equal by comparing their underlying byte data.\n *\n * @param other The Hex instance to compare to.\n * @returns true if the Hex instances are equal, false if not.\n * @group Implementation\n * @category Serialization\n */\n equals(other: Hex): 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\nexport const hexToAsciiString = (hex: string) => new TextDecoder().decode(Hex.fromHexInput(hex).toUint8Array());\n"],"mappings":"yCAGA,OAAS,cAAAA,EAAY,cAAAC,MAAkB,sBAShC,IAAKC,OACVA,EAAA,UAAY,YACZA,EAAA,eAAiB,iBACjBA,EAAA,kBAAoB,oBAHVA,OAAA,IAgCCC,EAAN,MAAMC,CAAI,CAUf,YAAYC,EAAkB,CAC5B,KAAK,KAAOA,CACd,CAaA,cAA2B,CACzB,OAAO,KAAK,IACd,CASA,uBAAgC,CAC9B,OAAOC,EAAW,KAAK,IAAI,CAC7B,CASA,UAAmB,CACjB,MAAO,KAAK,KAAK,sBAAsB,CAAC,EAC1C,CAiBA,OAAO,cAAcC,EAAkB,CACrC,IAAIC,EAAQD,EAMZ,GAJIC,EAAM,WAAW,IAAI,IACvBA,EAAQA,EAAM,MAAM,CAAC,GAGnBA,EAAM,SAAW,EACnB,MAAM,IAAIC,EACR,4FACA,WACF,EAGF,GAAID,EAAM,OAAS,IAAM,EACvB,MAAM,IAAIC,EAAa,uDAAwD,gBAA+B,EAGhH,GAAI,CACF,OAAO,IAAIL,EAAIM,EAAWF,CAAK,CAAC,CAClC,OAASG,EAAY,CACnB,MAAM,IAAIF,EACR,+CAA+CE,GAAO,OAAO,GAC7D,mBACF,CACF,CACF,CAWA,OAAO,aAAaC,EAAyB,CAC3C,OAAIA,aAAoB,WAAmB,IAAIR,EAAIQ,CAAQ,EACpDR,EAAI,cAAcQ,CAAQ,CACnC,CAQA,OAAO,qBAAqBA,EAAgC,CAC1D,OAAIA,aAAoB,WAAmBA,EACpCR,EAAI,cAAcQ,CAAQ,EAAE,aAAa,CAClD,CAeA,OAAO,iBAAiBA,EAA4B,CAClD,OAAOR,EAAI,aAAaQ,CAAQ,EAAE,SAAS,CAC7C,CAeA,OAAO,8BAA8BA,EAA4B,CAC/D,OAAOR,EAAI,aAAaQ,CAAQ,EAAE,sBAAsB,CAC1D,CAkBA,OAAO,QAAQL,EAA8C,CAC3D,GAAI,CACF,OAAAH,EAAI,cAAcG,CAAG,EACd,CAAE,MAAO,EAAK,CACvB,OAASI,EAAY,CACnB,MAAO,CACL,MAAO,GACP,cAAeA,GAAO,cACtB,qBAAsBA,GAAO,OAC/B,CACF,CACF,CAUA,OAAOE,EAAqB,CAC1B,OAAI,KAAK,KAAK,SAAWA,EAAM,KAAK,OAAe,GAC5C,KAAK,KAAK,MAAM,CAACC,EAAOC,IAAUD,IAAUD,EAAM,KAAKE,CAAK,CAAC,CACtE,CACF,EAEaC,EAAoBC,GAAgB,IAAI,YAAY,EAAE,OAAOd,EAAI,aAAac,CAAG,EAAE,aAAa,CAAC","names":["bytesToHex","hexToBytes","HexInvalidReason","Hex","_Hex","data","bytesToHex","str","input","ParsingError","hexToBytes","error","hexInput","other","value","index","hexToAsciiString","hex"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var g=(t=>(t.JSON="application/json",t.BCS="application/x-bcs",t.BCS_SIGNED_TRANSACTION="application/x.aptos.signed_transaction+bcs",t.BCS_VIEW_FUNCTION="application/x.aptos.view_function+bcs",t))(g||{}),d=(n=>(n[n.Bool=0]="Bool",n[n.U8=1]="U8",n[n.U64=2]="U64",n[n.U128=3]="U128",n[n.Address=4]="Address",n[n.Signer=5]="Signer",n[n.Vector=6]="Vector",n[n.Struct=7]="Struct",n[n.U16=8]="U16",n[n.U32=9]="U32",n[n.U256=10]="U256",n[n.Reference=254]="Reference",n[n.Generic=255]="Generic",n))(d||{}),u=(r=>(r[r.U8=0]="U8",r[r.U64=1]="U64",r[r.U128=2]="U128",r[r.Address=3]="Address",r[r.U8Vector=4]="U8Vector",r[r.Bool=5]="Bool",r[r.U16=6]="U16",r[r.U32=7]="U32",r[r.U256=8]="U256",r[r.Serialized=9]="Serialized",r))(u||{}),y=(o=>(o[o.Script=0]="Script",o[o.EntryFunction=2]="EntryFunction",o[o.Multisig=3]="Multisig",o))(y||{}),c=(i=>(i[i.MultiAgentTransaction=0]="MultiAgentTransaction",i[i.FeePayerTransaction=1]="FeePayerTransaction",i))(c||{}),l=(e=>(e[e.Ed25519=0]="Ed25519",e[e.MultiEd25519=1]="MultiEd25519",e[e.MultiAgent=2]="MultiAgent",e[e.FeePayer=3]="FeePayer",e[e.SingleSender=4]="SingleSender",e))(l||{}),_=(e=>(e[e.Ed25519=0]="Ed25519",e[e.MultiEd25519=1]="MultiEd25519",e[e.SingleKey=2]="SingleKey",e[e.MultiKey=3]="MultiKey",e[e.NoAccountAuthenticator=4]="NoAccountAuthenticator",e))(_||{}),x=(i=>(i.Ed25519="ed25519",i.Secp256k1="secp256k1",i))(x||{}),h=(t=>(t[t.Ed25519=0]="Ed25519",t[t.Secp256k1=1]="Secp256k1",t[t.Keyless=3]="Keyless",t[t.FederatedKeyless=4]="FederatedKeyless",t))(h||{}),v=(o=>(o[o.Ed25519=0]="Ed25519",o[o.Secp256k1=1]="Secp256k1",o[o.Keyless=3]="Keyless",o))(v||{}),R=(p=>(p[p.Ed25519=0]="Ed25519",p))(R||{}),M=(p=>(p[p.Ed25519=0]="Ed25519",p))(M||{}),m=(p=>(p[p.ZkProof=0]="ZkProof",p))(m||{}),b=(p=>(p[p.Groth16=0]="Groth16",p))(b||{}),k=(a=>(a.Pending="pending_transaction",a.User="user_transaction",a.Genesis="genesis_transaction",a.BlockMetadata="block_metadata_transaction",a.StateCheckpoint="state_checkpoint_transaction",a.Validator="validator_transaction",a.BlockEpilogue="block_epilogue_transaction",a))(k||{});function W(s){return s.type==="pending_transaction"}function F(s){return s.type==="user_transaction"}function I(s){return s.type==="genesis_transaction"}function B(s){return s.type==="block_metadata_transaction"}function G(s){return s.type==="state_checkpoint_transaction"}function A(s){return s.type==="validator_transaction"}function O(s){return s.type==="block_epilogue_transaction"}function P(s){return"signature"in s&&s.signature==="ed25519_signature"}function N(s){return"signature"in s&&s.signature==="secp256k1_ecdsa_signature"}function D(s){return s.type==="multi_agent_signature"}function q(s){return s.type==="fee_payer_signature"}function H(s){return s.type==="multi_ed25519_signature"}var S=(o=>(o.PRIVATE="private",o.PUBLIC="public",o.FRIEND="friend",o))(S||{}),f=(t=>(t.STORE="store",t.DROP="drop",t.KEY="key",t.COPY="copy",t))(f||{}),C=(i=>(i.VALIDATOR="validator",i.FULL_NODE="full_node",i))(C||{}),T=(t=>(t[t.Ed25519=0]="Ed25519",t[t.MultiEd25519=1]="MultiEd25519",t[t.SingleKey=2]="SingleKey",t[t.MultiKey=3]="MultiKey",t))(T||{}),E=(i=>(i[i.Ed25519=0]="Ed25519",i[i.Secp256k1Ecdsa=2]="Secp256k1Ecdsa",i))(E||{}),U=(e=>(e[e.DeriveAuid=251]="DeriveAuid",e[e.DeriveObjectAddressFromObject=252]="DeriveObjectAddressFromObject",e[e.DeriveObjectAddressFromGuid=253]="DeriveObjectAddressFromGuid",e[e.DeriveObjectAddressFromSeed=254]="DeriveObjectAddressFromSeed",e[e.DeriveResourceAccountAddress=255]="DeriveResourceAccountAddress",e))(U||{});export{g as a,d as b,u as c,y as d,c as e,l as f,_ as g,x as h,h as i,v as j,R as k,M as l,m,b as n,k as o,W as p,F as q,I as r,B as s,G as t,A as u,O as v,P as w,N as x,D as y,q as z,H as A,S as B,f as C,C as D,T as E,E as F,U as G};
|
|
2
|
-
//# sourceMappingURL=chunk-U2PRGW4O.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/types/types.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Network } from \"../utils/apiEndpoints\";\nimport { OrderBy, TokenStandard } from \"./indexer\";\n\n/**\n * Different MIME types used for data interchange in transactions and responses.\n */\nexport enum MimeType {\n /**\n * JSON representation, used for transaction submission and accept type JSON output\n */\n JSON = \"application/json\",\n /**\n * BCS representation, used for accept type BCS output\n */\n BCS = \"application/x-bcs\",\n /**\n * BCS representation, used for transaction submission in BCS input\n */\n BCS_SIGNED_TRANSACTION = \"application/x.aptos.signed_transaction+bcs\",\n BCS_VIEW_FUNCTION = \"application/x.aptos.view_function+bcs\",\n}\n\n/**\n * Hexadecimal data input for functions, supporting both string and Uint8Array formats.\n */\nexport type HexInput = string | Uint8Array;\n\n/**\n * Variants of type tags used in the system, encompassing various data types and structures.\n * {@link https://github.com/aptos-labs/aptos-core/blob/main/third_party/move/move-core/types/src/language_storage.rs#L27}\n */\nexport enum TypeTagVariants {\n Bool = 0,\n U8 = 1,\n U64 = 2,\n U128 = 3,\n Address = 4,\n Signer = 5,\n Vector = 6,\n Struct = 7,\n U16 = 8,\n U32 = 9,\n U256 = 10,\n Reference = 254, // This is specifically a placeholder and does not represent a real type\n Generic = 255, // This is specifically a placeholder and does not represent a real type\n}\n\n/**\n * Variants of script transaction arguments used in Rust, encompassing various data types for transaction processing.\n * {@link https://github.com/aptos-labs/aptos-core/blob/main/third_party/move/move-core/types/src/transaction_argument.rs#L11}\n */\nexport enum ScriptTransactionArgumentVariants {\n U8 = 0,\n U64 = 1,\n U128 = 2,\n Address = 3,\n U8Vector = 4,\n Bool = 5,\n U16 = 6,\n U32 = 7,\n U256 = 8,\n Serialized = 9,\n}\n\n/**\n * The payload for various transaction types in the system.\n * {@link https://github.com/aptos-labs/aptos-core/blob/main/types/src/transaction/mod.rs#L478}\n */\nexport enum TransactionPayloadVariants {\n Script = 0,\n EntryFunction = 2,\n Multisig = 3,\n}\n\n/**\n * Variants of transactions used in the system.\n * {@link https://github.com/aptos-labs/aptos-core/blob/main/types/src/transaction/mod.rs#L440}\n */\nexport enum TransactionVariants {\n MultiAgentTransaction = 0,\n FeePayerTransaction = 1,\n}\n\n/**\n * Variants of transaction authenticators used in the system.\n * {@link https://github.com/aptos-labs/aptos-core/blob/main/types/src/transaction/authenticator.rs#L44}\n */\nexport enum TransactionAuthenticatorVariant {\n Ed25519 = 0,\n MultiEd25519 = 1,\n MultiAgent = 2,\n FeePayer = 3,\n SingleSender = 4,\n}\n\n/**\n * Variants of account authenticators used in transactions.\n * {@link https://github.com/aptos-labs/aptos-core/blob/main/types/src/transaction/authenticator.rs#L414}\n */\nexport enum AccountAuthenticatorVariant {\n Ed25519 = 0,\n MultiEd25519 = 1,\n SingleKey = 2,\n MultiKey = 3,\n NoAccountAuthenticator = 4,\n}\n\n/**\n * Variants of private keys that can comply with the AIP-80 standard.\n * {@link https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-80.md}\n */\nexport enum PrivateKeyVariants {\n Ed25519 = \"ed25519\",\n Secp256k1 = \"secp256k1\",\n}\n\n/**\n * Variants of public keys used in cryptographic operations.\n */\nexport enum AnyPublicKeyVariant {\n Ed25519 = 0,\n Secp256k1 = 1,\n Keyless = 3,\n FederatedKeyless = 4,\n}\n\n/**\n * Variants of signature types used for cryptographic operations.\n */\nexport enum AnySignatureVariant {\n Ed25519 = 0,\n Secp256k1 = 1,\n Keyless = 3,\n}\n\n/**\n * Variants of ephemeral public keys used in cryptographic operations.\n */\nexport enum EphemeralPublicKeyVariant {\n Ed25519 = 0,\n}\n\n/**\n * Variants of ephemeral signatures used for secure communication.\n */\nexport enum EphemeralSignatureVariant {\n Ed25519 = 0,\n}\n\n/**\n * Variants of ephemeral certificates used in secure transactions.\n */\nexport enum EphemeralCertificateVariant {\n ZkProof = 0,\n}\n\n/**\n * Variants of zero-knowledge proofs used in cryptographic operations.\n */\nexport enum ZkpVariant {\n Groth16 = 0,\n}\n\n/**\n * BCS types\n */\nexport type Uint8 = number;\n\n/**\n * A 16-bit unsigned integer.\n */\nexport type Uint16 = number;\n\n/**\n * A 32-bit unsigned integer.\n */\nexport type Uint32 = number;\n\n/**\n * A 64-bit unsigned integer value.\n */\nexport type Uint64 = bigint;\n\n/**\n * A 128-bit unsigned integer used for precise arithmetic operations.\n */\nexport type Uint128 = bigint;\n\n/**\n * A 256-bit unsigned integer used for precise numerical calculations.\n */\nexport type Uint256 = bigint;\n\n/**\n * A number or a bigint value.\n */\nexport type AnyNumber = number | bigint;\n\n/**\n * Configuration options for initializing the SDK, allowing customization of its behavior and interaction with the Aptos network.\n */\nexport type AptosSettings = {\n readonly network?: Network;\n\n readonly fullnode?: string;\n\n readonly faucet?: string;\n\n readonly indexer?: string;\n\n readonly pepper?: string;\n\n readonly prover?: string;\n\n readonly clientConfig?: ClientConfig;\n\n readonly client?: Client;\n\n readonly fullnodeConfig?: FullNodeConfig;\n\n readonly indexerConfig?: IndexerConfig;\n\n readonly faucetConfig?: FaucetConfig;\n};\n\n/**\n * Defines the parameters for paginating query results, including the starting position and maximum number of items to return.\n * @param offset Specifies the starting position of the query result. Default is 0.\n * @param limit Specifies the maximum number of items to return. Default is 25.\n */\nexport interface PaginationArgs {\n offset?: AnyNumber;\n limit?: number;\n}\n\n/**\n * Represents the arguments for specifying a token standard.\n *\n * @param tokenStandard - Optional standard of the token.\n */\nexport interface TokenStandardArg {\n tokenStandard?: TokenStandard;\n}\n\nexport interface OrderByArg<T extends {}> {\n orderBy?: OrderBy<T>;\n}\n\nexport interface WhereArg<T extends {}> {\n where?: T;\n}\n\n/**\n * QUERY TYPES\n */\n\n/**\n * A configuration object for requests to the server, including API key, extra headers, and cookie handling options.\n */\nexport type ClientConfig = ClientHeadersType & {\n WITH_CREDENTIALS?: boolean;\n API_KEY?: string;\n};\n\n/**\n * A configuration object for a Fullnode, allowing for the inclusion of extra headers in requests.\n */\nexport type FullNodeConfig = ClientHeadersType;\n\n/**\n * An Indexer configuration object for sending requests with additional headers.\n */\nexport type IndexerConfig = ClientHeadersType;\n\n/**\n * A configuration object for a faucet, including optional authentication and headers for requests.\n */\nexport type FaucetConfig = ClientHeadersType & {\n AUTH_TOKEN?: string;\n};\n\n/**\n * General type definition for client headers.\n */\nexport type ClientHeadersType = {\n HEADERS?: Record<string, string | number | boolean>;\n};\n\n/**\n * Represents a client for making requests to a service provider.\n *\n * @param Req - The type of the request payload.\n * @param Res - The type of the response payload.\n */\nexport interface ClientRequest<Req> {\n url: string;\n method: \"GET\" | \"POST\";\n originMethod?: string;\n body?: Req;\n contentType?: string;\n params?: any;\n overrides?: ClientConfig & FullNodeConfig & IndexerConfig & FaucetConfig;\n headers?: Record<string, any>;\n}\n\nexport interface ClientResponse<Res> {\n status: number;\n statusText: string;\n data: Res;\n config?: any;\n request?: any;\n response?: any;\n headers?: any;\n}\n\nexport interface Client {\n /**\n * Sends a request to the specified URL with the given options.\n *\n * @param requestOptions - The options for the request.\n * @param requestOptions.url - The URL to send the request to.\n * @param requestOptions.method - The HTTP method to use, either \"GET\" or \"POST\".\n * @param requestOptions.path - An optional path to append to the URL.\n * @param requestOptions.body - The body of the request, applicable for POST requests.\n * @param requestOptions.contentType - The content type of the request body.\n * @param requestOptions.acceptType - The expected content type of the response.\n * @param requestOptions.params - Optional parameters to include in the request.\n * @param requestOptions.originMethod - An optional method to specify the origin of the request.\n * @param requestOptions.overrides - Optional configuration overrides for the request.\n */\n provider<Req, Res>(requestOptions: ClientRequest<Req>): Promise<ClientResponse<Res>>;\n}\n\n/**\n * The API request type\n *\n * @param url - the url to make the request to, i.e. https://fullnode.devnet.aptoslabs.com/v1\n * @param method - the request method \"GET\" | \"POST\"\n * @param endpoint (optional) - the endpoint to make the request to, i.e. transactions\n * @param body (optional) - the body of the request\n * @param contentType (optional) - the content type to set the `content-type` header to,\n * by default is set to `application/json`\n * @param params (optional) - query params to add to the request\n * @param originMethod (optional) - the local method the request came from\n * @param overrides (optional) - a `ClientConfig` object type to override request data\n */\nexport type AptosRequest = {\n url: string;\n method: \"GET\" | \"POST\";\n path?: string;\n body?: any;\n contentType?: string;\n acceptType?: string;\n params?: Record<string, string | AnyNumber | boolean | undefined>;\n originMethod?: string;\n overrides?: ClientConfig & FullNodeConfig & IndexerConfig & FaucetConfig;\n};\n\n/**\n * The API response type\n *\n * @param status - the response status. i.e. 200\n * @param statusText - the response message\n * @param data the response data\n * @param url the url the request was made to\n * @param headers the response headers\n * @param config (optional) - the request object\n * @param request (optional) - the request object\n */\nexport interface AptosResponse<Req, Res> {\n status: number;\n statusText: string;\n data: Res;\n url: string;\n headers: any;\n config?: any;\n request?: Req;\n}\n\n/**\n * The ledger version of transactions, defaulting to the latest version if not specified.\n */\nexport type LedgerVersionArg = {\n ledgerVersion?: AnyNumber;\n};\n\n/**\n * RESPONSE TYPES\n */\n\n/**\n * The output of the estimate gas API, including the deprioritized estimate for the gas unit price.\n */\nexport type GasEstimation = {\n /**\n * The deprioritized estimate for the gas unit price\n */\n deprioritized_gas_estimate?: number;\n /**\n * The current estimate for the gas unit price\n */\n gas_estimate: number;\n /**\n * The prioritized estimate for the gas unit price\n */\n prioritized_gas_estimate?: number;\n};\n\nexport type MoveResource<T = {}> = {\n type: MoveStructId;\n data: T;\n};\n\n/**\n * The data associated with an account, including its sequence number.\n */\nexport type AccountData = {\n sequence_number: string;\n authentication_key: string;\n};\n\n/**\n * A Move module containing an address.\n */\nexport type MoveModuleBytecode = {\n bytecode: string;\n abi?: MoveModule;\n};\n\n/**\n * TRANSACTION TYPES\n */\n\n/**\n * Different types of transaction responses that can occur in the system.\n */\nexport enum TransactionResponseType {\n Pending = \"pending_transaction\",\n User = \"user_transaction\",\n Genesis = \"genesis_transaction\",\n BlockMetadata = \"block_metadata_transaction\",\n StateCheckpoint = \"state_checkpoint_transaction\",\n Validator = \"validator_transaction\",\n BlockEpilogue = \"block_epilogue_transaction\",\n}\n\n/**\n * The response for a transaction, which can be either pending or committed.\n */\nexport type TransactionResponse = PendingTransactionResponse | CommittedTransactionResponse;\n\n/**\n * The response for a committed transaction, which can be one of several transaction types.\n */\nexport type CommittedTransactionResponse =\n | UserTransactionResponse\n | GenesisTransactionResponse\n | BlockMetadataTransactionResponse\n | StateCheckpointTransactionResponse\n | ValidatorTransactionResponse\n | BlockEpilogueTransactionResponse;\n\n/**\n * Determine if the given transaction response is currently pending.\n *\n * @param response - The transaction response to evaluate.\n * @returns A boolean indicating whether the transaction is pending.\n */\nexport function isPendingTransactionResponse(response: TransactionResponse): response is PendingTransactionResponse {\n return response.type === TransactionResponseType.Pending;\n}\n\n/**\n * Determines if the given transaction response is a user transaction.\n *\n * @param response - The transaction response to evaluate.\n * @returns A boolean indicating whether the transaction is of type User.\n */\nexport function isUserTransactionResponse(response: TransactionResponse): response is UserTransactionResponse {\n return response.type === TransactionResponseType.User;\n}\n\n/**\n * Determines if the given transaction response is a Genesis transaction.\n *\n * @param response - The transaction response to evaluate.\n * @returns A boolean indicating whether the transaction is a Genesis transaction.\n */\nexport function isGenesisTransactionResponse(response: TransactionResponse): response is GenesisTransactionResponse {\n return response.type === TransactionResponseType.Genesis;\n}\n\n/**\n * Determine if the given transaction response is of type BlockMetadata.\n *\n * @param response - The transaction response to evaluate.\n * @returns A boolean indicating whether the response is a BlockMetadata transaction.\n */\nexport function isBlockMetadataTransactionResponse(\n response: TransactionResponse,\n): response is BlockMetadataTransactionResponse {\n return response.type === TransactionResponseType.BlockMetadata;\n}\n\n/**\n * Determines if the provided transaction response is a state checkpoint transaction.\n *\n * @param response - The transaction response to evaluate.\n * @returns A boolean indicating whether the transaction response is of type StateCheckpoint.\n */\nexport function isStateCheckpointTransactionResponse(\n response: TransactionResponse,\n): response is StateCheckpointTransactionResponse {\n return response.type === TransactionResponseType.StateCheckpoint;\n}\n\n/**\n * Determine if the given transaction response is of type Validator.\n *\n * @param response - The transaction response to evaluate.\n * @returns A boolean indicating whether the transaction response is a Validator type.\n */\nexport function isValidatorTransactionResponse(\n response: TransactionResponse,\n): response is ValidatorTransactionResponse {\n return response.type === TransactionResponseType.Validator;\n}\n\n/**\n * Determines if the given transaction response is of the type Block Epilogue.\n *\n * @param response - The transaction response to evaluate.\n * @returns A boolean indicating whether the response is a Block Epilogue transaction.\n */\nexport function isBlockEpilogueTransactionResponse(\n response: TransactionResponse,\n): response is BlockEpilogueTransactionResponse {\n return response.type === TransactionResponseType.BlockEpilogue;\n}\n\n/**\n * The response for a pending transaction, indicating that the transaction is still being processed.\n */\nexport type PendingTransactionResponse = {\n type: TransactionResponseType.Pending;\n hash: string;\n sender: string;\n sequence_number: string;\n max_gas_amount: string;\n gas_unit_price: string;\n expiration_timestamp_secs: string;\n payload: TransactionPayloadResponse;\n signature?: TransactionSignature;\n};\n\n/**\n * The response structure for a user transaction.\n */\nexport type UserTransactionResponse = {\n type: TransactionResponseType.User;\n version: string;\n hash: string;\n state_change_hash: string;\n event_root_hash: string;\n state_checkpoint_hash: string | null;\n gas_used: string;\n /**\n * Whether the transaction was successful\n */\n success: boolean;\n /**\n * The VM status of the transaction, can tell useful information in a failure\n */\n vm_status: string;\n accumulator_root_hash: string;\n /**\n * Final state of resources changed by the transaction\n */\n changes: Array<WriteSetChange>;\n sender: string;\n sequence_number: string;\n max_gas_amount: string;\n gas_unit_price: string;\n expiration_timestamp_secs: string;\n payload: TransactionPayloadResponse;\n signature?: TransactionSignature;\n /**\n * Events generated by the transaction\n */\n events: Array<Event>;\n timestamp: string;\n};\n\n/**\n * The response for a genesis transaction, indicating the type of transaction.\n */\nexport type GenesisTransactionResponse = {\n type: TransactionResponseType.Genesis;\n version: string;\n hash: string;\n state_change_hash: string;\n event_root_hash: string;\n state_checkpoint_hash?: string;\n gas_used: string;\n /**\n * Whether the transaction was successful\n */\n success: boolean;\n /**\n * The VM status of the transaction, can tell useful information in a failure\n */\n vm_status: string;\n accumulator_root_hash: string;\n /**\n * Final state of resources changed by the transaction\n */\n changes: Array<WriteSetChange>;\n payload: GenesisPayload;\n /**\n * Events emitted during genesis\n */\n events: Array<Event>;\n};\n\n/**\n * The structure representing a blockchain block with its height.\n */\nexport type BlockMetadataTransactionResponse = {\n type: TransactionResponseType.BlockMetadata;\n version: string;\n hash: string;\n state_change_hash: string;\n event_root_hash: string;\n state_checkpoint_hash: string | null;\n gas_used: string;\n /**\n * Whether the transaction was successful\n */\n success: boolean;\n /**\n * The VM status of the transaction, can tell useful information in a failure\n */\n vm_status: string;\n accumulator_root_hash: string;\n /**\n * Final state of resources changed by the transaction\n */\n changes: Array<WriteSetChange>;\n id: string;\n epoch: string;\n round: string;\n /**\n * The events emitted at the block creation\n */\n events: Array<Event>;\n /**\n * Previous block votes\n */\n previous_block_votes_bitvec: Array<number>;\n proposer: string;\n /**\n * The indices of the proposers who failed to propose\n */\n failed_proposer_indices: Array<number>;\n timestamp: string;\n};\n\n/**\n * The response for a state checkpoint transaction, indicating the type of transaction.\n */\nexport type StateCheckpointTransactionResponse = {\n type: TransactionResponseType.StateCheckpoint;\n version: string;\n hash: string;\n state_change_hash: string;\n event_root_hash: string;\n state_checkpoint_hash: string | null;\n gas_used: string;\n /**\n * Whether the transaction was successful\n */\n success: boolean;\n /**\n * The VM status of the transaction, can tell useful information in a failure\n */\n vm_status: string;\n accumulator_root_hash: string;\n /**\n * Final state of resources changed by the transaction\n */\n changes: Array<WriteSetChange>;\n timestamp: string;\n};\n\n/**\n * The response for a validator transaction, indicating the type of transaction.\n */\nexport type ValidatorTransactionResponse = {\n type: TransactionResponseType.Validator;\n version: string;\n hash: string;\n state_change_hash: string;\n event_root_hash: string;\n state_checkpoint_hash: string | null;\n gas_used: string;\n /**\n * Whether the transaction was successful\n */\n success: boolean;\n /**\n * The VM status of the transaction, can tell useful information in a failure\n */\n vm_status: string;\n accumulator_root_hash: string;\n /**\n * Final state of resources changed by the transaction\n */\n changes: Array<WriteSetChange>;\n /**\n * The events emitted by the validator transaction\n */\n events: Array<Event>;\n timestamp: string;\n};\n\n/**\n * Describes the gas state of the block, indicating whether the block gas limit has been reached.\n */\nexport type BlockEndInfo = {\n block_gas_limit_reached: boolean;\n block_output_limit_reached: boolean;\n block_effective_block_gas_units: number;\n block_approx_output_size: number;\n};\n\n/**\n * A transaction executed at the end of a block that tracks data from the entire block.\n */\nexport type BlockEpilogueTransactionResponse = {\n type: TransactionResponseType.BlockEpilogue;\n version: string;\n hash: string;\n state_change_hash: string;\n event_root_hash: string;\n state_checkpoint_hash: string | null;\n gas_used: string;\n /**\n * Whether the transaction was successful\n */\n success: boolean;\n /**\n * The VM status of the transaction, can tell useful information in a failure\n */\n vm_status: string;\n accumulator_root_hash: string;\n /**\n * Final state of resources changed by the transaction\n */\n changes: Array<WriteSetChange>;\n timestamp: string;\n block_end_info: BlockEndInfo | null;\n};\n\n/**\n * WRITESET CHANGE TYPES\n */\n\n/**\n * A union type that encompasses both script and direct write sets for data operations.\n */\nexport type WriteSetChange =\n | WriteSetChangeDeleteModule\n | WriteSetChangeDeleteResource\n | WriteSetChangeDeleteTableItem\n | WriteSetChangeWriteModule\n | WriteSetChangeWriteResource\n | WriteSetChangeWriteTableItem;\n\n/**\n * The structure for a module deletion change in a write set.\n */\nexport type WriteSetChangeDeleteModule = {\n type: string;\n address: string;\n /**\n * State key hash\n */\n state_key_hash: string;\n module: MoveModuleId;\n};\n\n/**\n * The payload for a resource deletion in a write set change.\n */\nexport type WriteSetChangeDeleteResource = {\n type: string;\n address: string;\n state_key_hash: string;\n resource: string;\n};\n\n/**\n * The payload for a write set change that deletes a table item.\n */\nexport type WriteSetChangeDeleteTableItem = {\n type: string;\n state_key_hash: string;\n handle: string;\n key: string;\n data?: DeletedTableData;\n};\n\n/**\n * The structure for a write module change in a write set.\n */\nexport type WriteSetChangeWriteModule = {\n type: string;\n address: string;\n state_key_hash: string;\n data: MoveModuleBytecode;\n};\n\n/**\n * The resource associated with a write set change, identified by its type.\n */\nexport type WriteSetChangeWriteResource = {\n type: string;\n address: string;\n state_key_hash: string;\n data: MoveResource;\n};\n\n/**\n * The structure for a write operation on a table in a write set change.\n */\nexport type WriteSetChangeWriteTableItem = {\n type: string;\n state_key_hash: string;\n handle: string;\n key: string;\n value: string;\n data?: DecodedTableData;\n};\n\n/**\n * The decoded data for a table, including its key in JSON format.\n */\nexport type DecodedTableData = {\n /**\n * Key of table in JSON\n */\n key: any;\n /**\n * Type of key\n */\n key_type: string;\n /**\n * Value of table in JSON\n */\n value: any;\n /**\n * Type of value\n */\n value_type: string;\n};\n\n/**\n * Data for a deleted table entry.\n */\nexport type DeletedTableData = {\n /**\n * Deleted key\n */\n key: any;\n /**\n * Deleted key type\n */\n key_type: string;\n};\n\n/**\n * The payload for a transaction response, which can be an entry function, script, or multisig payload.\n */\nexport type TransactionPayloadResponse = EntryFunctionPayloadResponse | ScriptPayloadResponse | MultisigPayloadResponse;\n\n/**\n * The response payload for an entry function, containing the type of the entry.\n */\nexport type EntryFunctionPayloadResponse = {\n type: string;\n function: MoveFunctionId;\n /**\n * Type arguments of the function\n */\n type_arguments: Array<string>;\n /**\n * Arguments of the function\n */\n arguments: Array<any>;\n};\n\n/**\n * The payload for a script response, containing the type of the script.\n */\nexport type ScriptPayloadResponse = {\n type: string;\n code: MoveScriptBytecode;\n /**\n * Type arguments of the function\n */\n type_arguments: Array<string>;\n /**\n * Arguments of the function\n */\n arguments: Array<any>;\n};\n\n/**\n * The response payload for a multisig transaction, containing the type of the transaction.\n */\nexport type MultisigPayloadResponse = {\n type: string;\n multisig_address: string;\n transaction_payload?: EntryFunctionPayloadResponse;\n};\n\n/**\n * The payload for the genesis block containing the type of the payload.\n */\nexport type GenesisPayload = {\n type: string;\n write_set: WriteSet;\n};\n\n/**\n * The bytecode for a Move script.\n */\nexport type MoveScriptBytecode = {\n bytecode: string;\n abi?: MoveFunction;\n};\n\n/**\n * JSON representations of transaction signatures returned from the node API.\n */\nexport type TransactionSignature =\n | TransactionEd25519Signature\n | TransactionSecp256k1Signature\n | TransactionMultiEd25519Signature\n | TransactionMultiAgentSignature\n | TransactionFeePayerSignature;\n\n/**\n * Determine if the provided signature is an Ed25519 signature.\n * This function checks for the presence of the \"signature\" property\n * and verifies that its value is \"ed25519_signature\".\n *\n * @param signature - The transaction signature to be checked.\n * @returns A boolean indicating whether the signature is an Ed25519 signature.\n */\nexport function isEd25519Signature(signature: TransactionSignature): signature is TransactionFeePayerSignature {\n return \"signature\" in signature && signature.signature === \"ed25519_signature\";\n}\n\n/**\n * Determine if the provided signature is a valid secp256k1 ECDSA signature.\n *\n * @param signature - The transaction signature to validate.\n * @returns A boolean indicating whether the signature is a secp256k1 ECDSA signature.\n */\nexport function isSecp256k1Signature(signature: TransactionSignature): signature is TransactionFeePayerSignature {\n return \"signature\" in signature && signature.signature === \"secp256k1_ecdsa_signature\";\n}\n\n/**\n * Determine if the provided transaction signature is a multi-agent signature.\n *\n * @param signature - The transaction signature to evaluate.\n * @returns A boolean indicating whether the signature is a multi-agent signature.\n */\nexport function isMultiAgentSignature(signature: TransactionSignature): signature is TransactionMultiAgentSignature {\n return signature.type === \"multi_agent_signature\";\n}\n\n/**\n * Determine if the provided signature is a fee payer signature.\n *\n * @param signature - The transaction signature to evaluate.\n * @returns A boolean indicating whether the signature is a fee payer signature.\n */\nexport function isFeePayerSignature(signature: TransactionSignature): signature is TransactionFeePayerSignature {\n return signature.type === \"fee_payer_signature\";\n}\n\n/**\n * Determine if the provided signature is of type \"multi_ed25519_signature\".\n *\n * @param signature - The transaction signature to check.\n * @returns A boolean indicating whether the signature is a multi-ed25519 signature.\n */\nexport function isMultiEd25519Signature(\n signature: TransactionSignature,\n): signature is TransactionMultiEd25519Signature {\n return signature.type === \"multi_ed25519_signature\";\n}\n\n/**\n * The signature for a transaction using the Ed25519 algorithm.\n */\nexport type TransactionEd25519Signature = {\n type: string;\n public_key: string;\n signature: \"ed25519_signature\";\n};\n\n/**\n * The structure for a Secp256k1 signature in a transaction.\n */\nexport type TransactionSecp256k1Signature = {\n type: string;\n public_key: string;\n signature: \"secp256k1_ecdsa_signature\";\n};\n\n/**\n * The structure for a multi-signature transaction using Ed25519.\n */\nexport type TransactionMultiEd25519Signature = {\n type: \"multi_ed25519_signature\";\n /**\n * The public keys for the Ed25519 signature\n */\n public_keys: Array<string>;\n /**\n * Signature associated with the public keys in the same order\n */\n signatures: Array<string>;\n /**\n * The number of signatures required for a successful transaction\n */\n threshold: number;\n bitmap: string;\n};\n\n/**\n * The structure for a multi-agent signature in a transaction.\n */\nexport type TransactionMultiAgentSignature = {\n type: \"multi_agent_signature\";\n sender: AccountSignature;\n /**\n * The other involved parties' addresses\n */\n secondary_signer_addresses: Array<string>;\n /**\n * The associated signatures, in the same order as the secondary addresses\n */\n secondary_signers: Array<AccountSignature>;\n};\n\n/**\n * The signature of the fee payer in a transaction.\n */\nexport type TransactionFeePayerSignature = {\n type: \"fee_payer_signature\";\n sender: AccountSignature;\n /**\n * The other involved parties' addresses\n */\n secondary_signer_addresses: Array<string>;\n /**\n * The associated signatures, in the same order as the secondary addresses\n */\n secondary_signers: Array<AccountSignature>;\n fee_payer_address: string;\n fee_payer_signer: AccountSignature;\n};\n\n/**\n * The union of all single account signatures, including Ed25519, Secp256k1, and MultiEd25519 signatures.\n */\nexport type AccountSignature =\n | TransactionEd25519Signature\n | TransactionSecp256k1Signature\n | TransactionMultiEd25519Signature;\n\nexport type WriteSet = ScriptWriteSet | DirectWriteSet;\n\n/**\n * The set of properties for writing scripts, including the type of script.\n */\nexport type ScriptWriteSet = {\n type: string;\n execute_as: string;\n script: ScriptPayloadResponse;\n};\n\n/**\n * The set of direct write operations, identified by a type string.\n */\nexport type DirectWriteSet = {\n type: string;\n changes: Array<WriteSetChange>;\n events: Array<Event>;\n};\n\n/**\n * The structure for an event's unique identifier, including its creation number.\n */\n\n/**\n * The structure for an event, identified by a unique GUID.\n */\nexport type EventGuid = {\n creation_number: string;\n account_address: string;\n};\n\nexport type Event = {\n guid: EventGuid;\n sequence_number: string;\n type: string;\n /**\n * The JSON representation of the event\n */\n data: any;\n};\n\n/**\n * A number representing a Move uint8 type.\n */\nexport type MoveUint8Type = number;\n\n/**\n * A 16-bit unsigned integer used in the Move programming language.\n */\nexport type MoveUint16Type = number;\n\n/**\n * A 32-bit unsigned integer type used in Move programming.\n */\nexport type MoveUint32Type = number;\n\n/**\n * A string representation of a 64-bit unsigned integer used in Move programming.\n */\nexport type MoveUint64Type = string;\n\n/**\n * A string representing a 128-bit unsigned integer in the Move programming language.\n */\nexport type MoveUint128Type = string;\n\n/**\n * A string representation of a 256-bit unsigned integer used in Move programming.\n */\nexport type MoveUint256Type = string;\n\n/**\n * A string representing a Move address.\n */\nexport type MoveAddressType = string;\n\n/**\n * The type for identifying objects to be moved within the system.\n */\nexport type MoveObjectType = string;\n\n/**\n * The type for move options, which can be a MoveType, null, or undefined.\n */\nexport type MoveOptionType = MoveType | null | undefined;\n\n/**\n * A structure representing a move with a name.\n */\nexport type MoveStructId = `${string}::${string}::${string}`;\n\n/**\n * The move function containing its name. Same as MoveStructId since it reads weird to take a StructId for a Function.\n */\nexport type MoveFunctionId = MoveStructId;\n\n// TODO: Add support for looking up ABI to add proper typing\nexport type MoveStructType = {};\n\n/**\n * A union type that encompasses various data types used in Move, including primitive types, address types, object types, and\n * arrays of MoveType.\n */\nexport type MoveType =\n | boolean\n | string\n | MoveUint8Type\n | MoveUint16Type\n | MoveUint32Type\n | MoveUint64Type\n | MoveUint128Type\n | MoveUint256Type\n | MoveAddressType\n | MoveObjectType\n | MoveStructType\n | Array<MoveType>;\n\n/**\n * Possible Move values acceptable by move functions (entry, view)\n *\n * Map of a Move value to the corresponding TypeScript value\n *\n * `Bool -> boolean`\n *\n * `u8, u16, u32 -> number`\n *\n * `u64, u128, u256 -> string`\n *\n * `String -> string`\n *\n * `Address -> 0x${string}`\n *\n * `Struct - 0x${string}::${string}::${string}`\n *\n * `Object -> 0x${string}`\n *\n * `Vector -> Array<MoveValue>`\n *\n * `Option -> MoveValue | null | undefined`\n */\nexport type MoveValue =\n | boolean\n | string\n | MoveUint8Type\n | MoveUint16Type\n | MoveUint32Type\n | MoveUint64Type\n | MoveUint128Type\n | MoveUint256Type\n | MoveAddressType\n | MoveObjectType\n | MoveStructId\n | MoveOptionType\n | Array<MoveValue>;\n\n/**\n * A string representation of a Move module, formatted as `module_name::function_name`.\n * Module names are case-sensitive.\n */\nexport type MoveModuleId = `${string}::${string}`;\n\n/**\n * Specifies the visibility levels for move functions, controlling access permissions.\n */\nexport enum MoveFunctionVisibility {\n PRIVATE = \"private\",\n PUBLIC = \"public\",\n FRIEND = \"friend\",\n}\n\n/**\n * Abilities related to moving items within the system.\n */\nexport enum MoveAbility {\n STORE = \"store\",\n DROP = \"drop\",\n KEY = \"key\",\n COPY = \"copy\",\n}\n\n/**\n * Move abilities associated with the generic type parameter of a function.\n */\nexport type MoveFunctionGenericTypeParam = {\n constraints: Array<MoveAbility>;\n};\n\n/**\n * A field in a Move struct, identified by its name.\n */\nexport type MoveStructField = {\n name: string;\n type: string;\n};\n\n/**\n * A Move module\n */\nexport type MoveModule = {\n address: string;\n name: string;\n /**\n * Friends of the module\n */\n friends: Array<MoveModuleId>;\n /**\n * Public functions of the module\n */\n exposed_functions: Array<MoveFunction>;\n /**\n * Structs of the module\n */\n structs: Array<MoveStruct>;\n};\n\n/**\n * A move struct\n */\nexport type MoveStruct = {\n name: string;\n /**\n * Whether the struct is a native struct of Move\n */\n is_native: boolean;\n /**\n * Whether the struct is a module event (aka v2 event). This will be false for v1\n * events because the value is derived from the #[event] attribute on the struct in\n * the Move source code. This attribute is only relevant for v2 events.\n */\n is_event: boolean;\n /**\n * Abilities associated with the struct\n */\n abilities: Array<MoveAbility>;\n /**\n * Generic types associated with the struct\n */\n generic_type_params: Array<MoveFunctionGenericTypeParam>;\n /**\n * Fields associated with the struct\n */\n fields: Array<MoveStructField>;\n};\n\n/**\n * Move function\n */\nexport type MoveFunction = {\n name: string;\n visibility: MoveFunctionVisibility;\n /**\n * Whether the function can be called as an entry function directly in a transaction\n */\n is_entry: boolean;\n /**\n * Whether the function is a view function or not\n */\n is_view: boolean;\n /**\n * Generic type params associated with the Move function\n */\n generic_type_params: Array<MoveFunctionGenericTypeParam>;\n /**\n * Parameters associated with the move function\n */\n params: Array<string>;\n /**\n * Return type of the function\n */\n return: Array<string>;\n};\n\n/**\n * Roles that can be assigned within the system, indicating different levels of access and functionality.\n */\nexport enum RoleType {\n VALIDATOR = \"validator\",\n FULL_NODE = \"full_node\",\n}\n\n/**\n * Information about the current blockchain ledger, including its chain ID.\n */\nexport type LedgerInfo = {\n /**\n * Chain ID of the current chain\n */\n chain_id: number;\n epoch: string;\n ledger_version: string;\n oldest_ledger_version: string;\n ledger_timestamp: string;\n node_role: RoleType;\n oldest_block_height: string;\n block_height: string;\n /**\n * Git hash of the build of the API endpoint. Can be used to determine the exact\n * software version used by the API endpoint.\n */\n git_hash?: string;\n};\n\n/**\n * A Block type\n */\nexport type Block = {\n block_height: string;\n block_hash: string;\n block_timestamp: string;\n first_version: string;\n last_version: string;\n /**\n * The transactions in the block in sequential order\n */\n transactions?: Array<TransactionResponse>;\n};\n\n// REQUEST TYPES\n\n/**\n * The request payload for the GetTableItem API.\n */\nexport type TableItemRequest = {\n key_type: MoveValue;\n value_type: MoveValue;\n /**\n * The value of the table item's key\n */\n key: any;\n};\n\n/**\n * A list of supported Authentication Key schemes in Aptos, consisting of combinations of signing schemes and derive schemes.\n */\nexport type AuthenticationKeyScheme = SigningScheme | DeriveScheme;\n\n/**\n * Different schemes for signing keys used in cryptographic operations.\n */\nexport enum SigningScheme {\n /**\n * For Ed25519PublicKey\n */\n Ed25519 = 0,\n /**\n * For MultiEd25519PublicKey\n */\n MultiEd25519 = 1,\n /**\n * For SingleKey ecdsa\n */\n SingleKey = 2,\n\n MultiKey = 3,\n}\n\n/**\n * Specifies the signing schemes available for cryptographic operations.\n */\nexport enum SigningSchemeInput {\n /**\n * For Ed25519PublicKey\n */\n Ed25519 = 0,\n /**\n * For Secp256k1Ecdsa\n */\n Secp256k1Ecdsa = 2,\n}\n\n/**\n * Specifies the schemes for deriving account addresses from various data sources.\n */\nexport enum DeriveScheme {\n /**\n * Derives an address using an AUID, used for objects\n */\n DeriveAuid = 251,\n /**\n * Derives an address from another object address\n */\n DeriveObjectAddressFromObject = 252,\n /**\n * Derives an address from a GUID, used for objects\n */\n DeriveObjectAddressFromGuid = 253,\n /**\n * Derives an address from seed bytes, used for named objects\n */\n DeriveObjectAddressFromSeed = 254,\n /**\n * Derives an address from seed bytes, used for resource accounts\n */\n DeriveResourceAccountAddress = 255,\n}\n\n/**\n * Options for configuring the behavior of the waitForTransaction() function.\n */\nexport type WaitForTransactionOptions = {\n timeoutSecs?: number;\n checkSuccess?: boolean;\n // Default behavior is to wait for the indexer. Set this to false to disable waiting.\n waitForIndexer?: boolean;\n};\n\n/**\n * Input type to generate an account using the Ed25519 signing scheme.\n */\nexport type GenerateAccountWithEd25519 = {\n scheme: SigningSchemeInput.Ed25519;\n legacy: boolean;\n};\n\n/**\n * Input type to generate an account with a Single Signer using Secp256k1.\n */\nexport type GenerateAccountWithSingleSignerSecp256k1Key = {\n scheme: SigningSchemeInput.Secp256k1Ecdsa;\n legacy?: false;\n};\n\nexport type GenerateAccount = GenerateAccountWithEd25519 | GenerateAccountWithSingleSignerSecp256k1Key;\n"],"mappings":"AASO,IAAKA,OAIVA,EAAA,KAAO,mBAIPA,EAAA,IAAM,oBAINA,EAAA,uBAAyB,6CACzBA,EAAA,kBAAoB,wCAbVA,OAAA,IAyBAC,OACVA,IAAA,KAAO,GAAP,OACAA,IAAA,GAAK,GAAL,KACAA,IAAA,IAAM,GAAN,MACAA,IAAA,KAAO,GAAP,OACAA,IAAA,QAAU,GAAV,UACAA,IAAA,OAAS,GAAT,SACAA,IAAA,OAAS,GAAT,SACAA,IAAA,OAAS,GAAT,SACAA,IAAA,IAAM,GAAN,MACAA,IAAA,IAAM,GAAN,MACAA,IAAA,KAAO,IAAP,OACAA,IAAA,UAAY,KAAZ,YACAA,IAAA,QAAU,KAAV,UAbUA,OAAA,IAoBAC,OACVA,IAAA,GAAK,GAAL,KACAA,IAAA,IAAM,GAAN,MACAA,IAAA,KAAO,GAAP,OACAA,IAAA,QAAU,GAAV,UACAA,IAAA,SAAW,GAAX,WACAA,IAAA,KAAO,GAAP,OACAA,IAAA,IAAM,GAAN,MACAA,IAAA,IAAM,GAAN,MACAA,IAAA,KAAO,GAAP,OACAA,IAAA,WAAa,GAAb,aAVUA,OAAA,IAiBAC,OACVA,IAAA,OAAS,GAAT,SACAA,IAAA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C8C,CAC9C,OAAOA,EAAS,OAAS,4BAC3B,CAQO,SAASI,EACdJ,EACgD,CAChD,OAAOA,EAAS,OAAS,8BAC3B,CAQO,SAASK,EACdL,EAC0C,CAC1C,OAAOA,EAAS,OAAS,uBAC3B,CAQO,SAASM,EACdN,EAC8C,CAC9C,OAAOA,EAAS,OAAS,4BAC3B,CAsaO,SAASO,EAAmBC,EAA4E,CAC7G,MAAO,cAAeA,GAAaA,EAAU,YAAc,mBAC7D,CAQO,SAASC,EAAqBD,EAA4E,CAC/G,MAAO,cAAeA,GAAaA,EAAU,YAAc,2BAC7D,CAQO,SAASE,EAAsBF,EAA8E,CAClH,OAAOA,EAAU,OAAS,uBAC5B,CAQO,SAASG,EAAoBH,EAA4E,CAC9G,OAAOA,EAAU,OAAS,qBAC5B,CAQO,SAASI,EACdJ,EAC+C,CAC/C,OAAOA,EAAU,OAAS,yBAC5B,CAuPO,IAAKK,OACVA,EAAA,QAAU,UACVA,EAAA,OAAS,SACTA,EAAA,OAAS,SAHCA,OAAA,IASAC,OACVA,EAAA,MAAQ,QACRA,EAAA,KAAO,OACPA,EAAA,IAAM,MACNA,EAAA,KAAO,OAJGA,OAAA,IAsGAC,OACVA,EAAA,UAAY,YACZA,EAAA,UAAY,YAFFA,OAAA,IAgEAC,OAIVA,IAAA,QAAU,GAAV,UAIAA,IAAA,aAAe,GAAf,eAIAA,IAAA,UAAY,GAAZ,YAEAA,IAAA,SAAW,GAAX,WAdUA,OAAA,IAoBAC,OAIVA,IAAA,QAAU,GAAV,UAIAA,IAAA,eAAiB,GAAjB,iBARUA,OAAA,IAcAC,OAIVA,IAAA,WAAa,KAAb,aAIAA,IAAA,8BAAgC,KAAhC,gCAIAA,IAAA,4BAA8B,KAA9B,8BAIAA,IAAA,4BAA8B,KAA9B,8BAIAA,IAAA,6BAA+B,KAA/B,+BApBUA,OAAA","names":["MimeType","TypeTagVariants","ScriptTransactionArgumentVariants","TransactionPayloadVariants","TransactionVariants","TransactionAuthenticatorVariant","AccountAuthenticatorVariant","PrivateKeyVariants","AnyPublicKeyVariant","AnySignatureVariant","EphemeralPublicKeyVariant","EphemeralSignatureVariant","EphemeralCertificateVariant","ZkpVariant","TransactionResponseType","isPendingTransactionResponse","response","isUserTransactionResponse","isGenesisTransactionResponse","isBlockMetadataTransactionResponse","isStateCheckpointTransactionResponse","isValidatorTransactionResponse","isBlockEpilogueTransactionResponse","isEd25519Signature","signature","isSecp256k1Signature","isMultiAgentSignature","isFeePayerSignature","isMultiEd25519Signature","MoveFunctionVisibility","MoveAbility","RoleType","SigningScheme","SigningSchemeInput","DeriveScheme"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{b as h,d as l}from"./chunk-FZD5RWSZ.mjs";import{b as E}from"./chunk-EMURYYVO.mjs";import{a as p}from"./chunk-WCMW2L3P.mjs";import{a as g}from"./chunk-FN4C3CKC.mjs";var o=class o extends E{constructor(r){super();let{publicKeys:e,threshold:t}=r;if(e.length>o.MAX_KEYS||e.length<o.MIN_KEYS)throw new Error(`Must have between ${o.MIN_KEYS} and ${o.MAX_KEYS} public keys, inclusive`);if(t<o.MIN_THRESHOLD||t>e.length)throw new Error(`Threshold must be between ${o.MIN_THRESHOLD} and ${e.length}, inclusive`);this.publicKeys=e,this.threshold=t}verifySignature(r){let{message:e,signature:t}=r;if(!(t instanceof y))return!1;let s=[];for(let i=0;i<4;i+=1)for(let n=0;n<8;n+=1)if((t.bitmap[i]&1<<7-n)!==0){let u=i*8+n;s.push(u)}if(s.length!==t.signatures.length)throw new Error("Bitmap and signatures length mismatch");if(s.length<this.threshold)throw new Error("Not enough signatures");for(let i=0;i<s.length;i+=1)if(!this.publicKeys[s[i]].verifySignature({message:e,signature:t.signatures[i]}))return!1;return!0}authKey(){return g.fromSchemeAndBytes({scheme:1,input:this.toUint8Array()})}toUint8Array(){let r=new Uint8Array(this.publicKeys.length*h.LENGTH+1);return this.publicKeys.forEach((e,t)=>{r.set(e.toUint8Array(),t*h.LENGTH)}),r[this.publicKeys.length*h.LENGTH]=this.threshold,r}serialize(r){r.serializeBytes(this.toUint8Array())}static deserialize(r){let e=r.deserializeBytes(),t=e[e.length-1],s=[];for(let i=0;i<e.length-1;i+=h.LENGTH){let n=i;s.push(new h(e.subarray(n,n+h.LENGTH)))}return new o({publicKeys:s,threshold:t})}};o.MAX_KEYS=32,o.MIN_KEYS=2,o.MIN_THRESHOLD=1;var d=o,a=class a extends p{constructor(r){super();let{signatures:e,bitmap:t}=r;if(e.length>a.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${a.MAX_SIGNATURES_SUPPORTED}`);if(this.signatures=e,!(t instanceof Uint8Array))this.bitmap=a.createBitmap({bits:t});else{if(t.length!==a.BITMAP_LEN)throw new Error(`"bitmap" length should be ${a.BITMAP_LEN}`);this.bitmap=t}}toUint8Array(){let r=new Uint8Array(this.signatures.length*l.LENGTH+a.BITMAP_LEN);return this.signatures.forEach((e,t)=>{r.set(e.toUint8Array(),t*l.LENGTH)}),r.set(this.bitmap,this.signatures.length*l.LENGTH),r}serialize(r){r.serializeBytes(this.toUint8Array())}static deserialize(r){let e=r.deserializeBytes(),t=e.subarray(e.length-4),s=[];for(let i=0;i<e.length-t.length;i+=l.LENGTH){let n=i;s.push(new l(e.subarray(n,n+l.LENGTH)))}return new a({signatures:s,bitmap:t})}static createBitmap(r){let{bits:e}=r,t=128,s=new Uint8Array([0,0,0,0]),i=new Set;return e.forEach((n,c)=>{if(n>=a.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${a.MAX_SIGNATURES_SUPPORTED-1}.`);if(i.has(n))throw new Error("Duplicate bits detected.");if(c>0&&n<=e[c-1])throw new Error("The bits need to be sorted in ascending order.");i.add(n);let u=Math.floor(n/8),b=s[u];b|=t>>n%8,s[u]=b}),s}};a.MAX_SIGNATURES_SUPPORTED=32,a.BITMAP_LEN=4;var y=a;export{d as a,y as b};
|
|
2
|
-
//# sourceMappingURL=chunk-VVXBVJXD.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/core/crypto/multiEd25519.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Deserializer, Serializer } from \"../../bcs\";\nimport { SigningScheme as AuthenticationKeyScheme } from \"../../types\";\nimport { AuthenticationKey } from \"../authenticationKey\";\nimport { Ed25519PublicKey, Ed25519Signature } from \"./ed25519\";\nimport { AccountPublicKey, VerifySignatureArgs } from \"./publicKey\";\nimport { Signature } from \"./signature\";\n\n/**\n * Represents the public key of a K-of-N Ed25519 multi-sig transaction.\n *\n * A K-of-N multi-sig transaction requires at least K out of N authorized signers to sign the transaction\n * for it to be executed. This class encapsulates the logic for managing the public keys and the threshold\n * for valid signatures.\n *\n * @see {@link https://aptos.dev/integration/creating-a-signed-transaction/ | Creating a Signed Transaction}\n * @group Implementation\n * @category Serialization\n */\nexport class MultiEd25519PublicKey extends AccountPublicKey {\n /**\n * Maximum number of public keys supported\n * @group Implementation\n * @category Serialization\n */\n static readonly MAX_KEYS = 32;\n\n /**\n * Minimum number of public keys needed\n * @group Implementation\n * @category Serialization\n */\n static readonly MIN_KEYS = 2;\n\n /**\n * Minimum threshold for the number of valid signatures required\n * @group Implementation\n * @category Serialization\n */\n static readonly MIN_THRESHOLD = 1;\n\n /**\n * List of Ed25519 public keys for this LegacyMultiEd25519PublicKey\n * @group Implementation\n * @category Serialization\n */\n public readonly publicKeys: Ed25519PublicKey[];\n\n /**\n * The minimum number of valid signatures required, for the number of public keys specified\n * @group Implementation\n * @category Serialization\n */\n public readonly threshold: number;\n\n /**\n * Public key for a K-of-N multi-sig transaction. A K-of-N multi-sig transaction means that for such a\n * transaction to be executed, at least K out of the N authorized signers have signed the transaction\n * and passed the check conducted by the chain.\n *\n * @see {@link\n * https://aptos.dev/integration/creating-a-signed-transaction/ | Creating a Signed Transaction}\n * @param args - A wrapper to let you choose the param order.\n * @param args.publicKeys A list of public keys\n * @param args.threshold At least \"threshold\" signatures must be valid\n * @group Implementation\n * @category Serialization\n */\n constructor(args: { publicKeys: Ed25519PublicKey[]; threshold: number }) {\n super();\n const { publicKeys, threshold } = args;\n\n // Validate number of public keys\n if (publicKeys.length > MultiEd25519PublicKey.MAX_KEYS || publicKeys.length < MultiEd25519PublicKey.MIN_KEYS) {\n throw new Error(\n `Must have between ${MultiEd25519PublicKey.MIN_KEYS} and ` +\n `${MultiEd25519PublicKey.MAX_KEYS} public keys, inclusive`,\n );\n }\n\n // Validate threshold: must be between 1 and the number of public keys, inclusive\n if (threshold < MultiEd25519PublicKey.MIN_THRESHOLD || threshold > publicKeys.length) {\n throw new Error(\n `Threshold must be between ${MultiEd25519PublicKey.MIN_THRESHOLD} and ${publicKeys.length}, inclusive`,\n );\n }\n\n this.publicKeys = publicKeys;\n this.threshold = threshold;\n }\n\n // region AccountPublicKey\n\n /**\n * Verifies a multi-signature against a given message.\n * This function ensures that the provided signatures meet the required threshold and are valid for the given message.\n *\n * @param args - The arguments for verifying the signature.\n * @param args.message - The message that was signed.\n * @param args.signature - The multi-signature containing multiple signatures and a bitmap indicating which signatures are valid.\n * @returns True if the signature is valid; otherwise, false.\n * @throws Error if the bitmap and signatures length mismatch or if there are not enough valid signatures.\n * @group Implementation\n * @category Serialization\n */\n verifySignature(args: VerifySignatureArgs): boolean {\n const { message, signature } = args;\n if (!(signature instanceof MultiEd25519Signature)) {\n return false;\n }\n\n const indices: number[] = [];\n for (let i = 0; i < 4; i += 1) {\n for (let j = 0; j < 8; j += 1) {\n // eslint-disable-next-line no-bitwise\n const bitIsSet = (signature.bitmap[i] & (1 << (7 - j))) !== 0;\n if (bitIsSet) {\n const index = i * 8 + j;\n indices.push(index);\n }\n }\n }\n\n if (indices.length !== signature.signatures.length) {\n throw new Error(\"Bitmap and signatures length mismatch\");\n }\n\n if (indices.length < this.threshold) {\n throw new Error(\"Not enough signatures\");\n }\n\n for (let i = 0; i < indices.length; i += 1) {\n const publicKey = this.publicKeys[indices[i]];\n if (!publicKey.verifySignature({ message, signature: signature.signatures[i] })) {\n return false;\n }\n }\n return true;\n }\n\n /**\n * Generates an authentication key based on the current instance's byte representation.\n * This function is essential for creating a secure authentication key that can be used for various cryptographic operations.\n *\n * @returns {AuthenticationKey} The generated authentication key.\n * @group Implementation\n * @category Serialization\n */\n authKey(): AuthenticationKey {\n return AuthenticationKey.fromSchemeAndBytes({\n scheme: AuthenticationKeyScheme.MultiEd25519,\n input: this.toUint8Array(),\n });\n }\n\n /**\n * Converts a PublicKeys into Uint8Array (bytes) with: bytes = p1_bytes | ... | pn_bytes | threshold\n * @group Implementation\n * @category Serialization\n */\n toUint8Array(): Uint8Array {\n const bytes = new Uint8Array(this.publicKeys.length * Ed25519PublicKey.LENGTH + 1);\n this.publicKeys.forEach((k: Ed25519PublicKey, i: number) => {\n bytes.set(k.toUint8Array(), i * Ed25519PublicKey.LENGTH);\n });\n\n bytes[this.publicKeys.length * Ed25519PublicKey.LENGTH] = this.threshold;\n\n return bytes;\n }\n\n // endregion\n\n // region Serializable\n\n /**\n * Serializes the current instance into bytes using the provided serializer.\n * This allows for the conversion of the instance's data into a format suitable for transmission or storage.\n *\n * @param serializer - The serializer used to convert the instance into bytes.\n * @group Implementation\n * @category Serialization\n */\n serialize(serializer: Serializer): void {\n serializer.serializeBytes(this.toUint8Array());\n }\n\n /**\n * Deserializes a MultiEd25519Signature from the provided deserializer.\n * This function helps in reconstructing a MultiEd25519Signature object from its serialized byte representation.\n *\n * @param deserializer - The deserializer instance used to read the serialized data.\n * @group Implementation\n * @category Serialization\n */\n static deserialize(deserializer: Deserializer): MultiEd25519PublicKey {\n const bytes = deserializer.deserializeBytes();\n const threshold = bytes[bytes.length - 1];\n\n const keys: Ed25519PublicKey[] = [];\n\n for (let i = 0; i < bytes.length - 1; i += Ed25519PublicKey.LENGTH) {\n const begin = i;\n keys.push(new Ed25519PublicKey(bytes.subarray(begin, begin + Ed25519PublicKey.LENGTH)));\n }\n return new MultiEd25519PublicKey({ publicKeys: keys, threshold });\n }\n\n // endregion\n}\n\n/**\n * Represents the signature of a K-of-N Ed25519 multi-sig transaction.\n *\n * @see {@link https://aptos.dev/integration/creating-a-signed-transaction/#multisignature-transactions | Creating a Signed Transaction}\n * @group Implementation\n * @category Serialization\n */\nexport class MultiEd25519Signature extends Signature {\n /**\n * Maximum number of Ed25519 signatures supported\n * @group Implementation\n * @category Serialization\n */\n static MAX_SIGNATURES_SUPPORTED = 32;\n\n /**\n * Number of bytes in the bitmap representing who signed the transaction (32-bits)\n * @group Implementation\n * @category Serialization\n */\n static BITMAP_LEN: number = 4;\n\n /**\n * The list of underlying Ed25519 signatures\n * @group Implementation\n * @category Serialization\n */\n public readonly signatures: Ed25519Signature[];\n\n /**\n * 32-bit Bitmap representing who signed the transaction\n *\n * This is represented where each public key can be masked to determine whether the message was signed by that key.\n * @group Implementation\n * @category Serialization\n */\n public readonly bitmap: Uint8Array;\n\n /**\n * Signature for a K-of-N multi-sig transaction.\n *\n * @see {@link\n * https://aptos.dev/integration/creating-a-signed-transaction/#multisignature-transactions | Creating a Signed Transaction}\n *\n * @param args.signatures A list of signatures\n * @param args.bitmap 4 bytes, at most 32 signatures are supported. If Nth bit value is `1`, the Nth\n * signature should be provided in `signatures`. Bits are read from left to right.\n * Alternatively, you can specify an array of bitmap positions.\n * Valid position should range between 0 and 31.\n * @see MultiEd25519Signature.createBitmap\n * @group Implementation\n * @category Serialization\n */\n constructor(args: { signatures: Ed25519Signature[]; bitmap: Uint8Array | number[] }) {\n super();\n const { signatures, bitmap } = args;\n\n if (signatures.length > MultiEd25519Signature.MAX_SIGNATURES_SUPPORTED) {\n throw new Error(\n `The number of signatures cannot be greater than ${MultiEd25519Signature.MAX_SIGNATURES_SUPPORTED}`,\n );\n }\n this.signatures = signatures;\n\n if (!(bitmap instanceof Uint8Array)) {\n this.bitmap = MultiEd25519Signature.createBitmap({ bits: bitmap });\n } else if (bitmap.length !== MultiEd25519Signature.BITMAP_LEN) {\n throw new Error(`\"bitmap\" length should be ${MultiEd25519Signature.BITMAP_LEN}`);\n } else {\n this.bitmap = bitmap;\n }\n }\n\n // region AccountSignature\n\n /**\n * Converts a MultiSignature into Uint8Array (bytes) with `bytes = s1_bytes | ... | sn_bytes | bitmap`\n * @group Implementation\n * @category Serialization\n */\n toUint8Array(): Uint8Array {\n const bytes = new Uint8Array(this.signatures.length * Ed25519Signature.LENGTH + MultiEd25519Signature.BITMAP_LEN);\n this.signatures.forEach((k: Ed25519Signature, i: number) => {\n bytes.set(k.toUint8Array(), i * Ed25519Signature.LENGTH);\n });\n\n bytes.set(this.bitmap, this.signatures.length * Ed25519Signature.LENGTH);\n\n return bytes;\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): MultiEd25519Signature {\n const bytes = deserializer.deserializeBytes();\n const bitmap = bytes.subarray(bytes.length - 4);\n\n const signatures: Ed25519Signature[] = [];\n\n for (let i = 0; i < bytes.length - bitmap.length; i += Ed25519Signature.LENGTH) {\n const begin = i;\n signatures.push(new Ed25519Signature(bytes.subarray(begin, begin + Ed25519Signature.LENGTH)));\n }\n return new MultiEd25519Signature({ signatures, bitmap });\n }\n\n // endregion\n\n /**\n * Helper method to create a bitmap out of the specified bit positions.\n * This function allows you to set specific bits in a 32-bit long bitmap based on the provided positions.\n *\n * @param args The arguments for creating the bitmap.\n * @param args.bits The bitmap positions that should be set. A position starts at index 0. Valid positions should range between 0 and 31.\n *\n * @example\n * Here's an example of valid `bits`\n * ```\n * [0, 2, 31]\n * ```\n * `[0, 2, 31]` means the 1st, 3rd and 32nd bits should be set in the bitmap.\n * The result bitmap should be 0b1010000000000000000000000000001\n *\n * @returns bitmap that is 32 bits long.\n * @group Implementation\n * @category Serialization\n */\n static createBitmap(args: { bits: number[] }): Uint8Array {\n const { bits } = args;\n // Bits are read from left to right. e.g. 0b10000000 represents the first bit is set in one byte.\n // The decimal value of 0b10000000 is 128.\n const firstBitInByte = 128;\n const bitmap = new Uint8Array([0, 0, 0, 0]);\n\n // Check if duplicates exist in bits\n const dupCheckSet = new Set();\n\n bits.forEach((bit: number, index) => {\n if (bit >= MultiEd25519Signature.MAX_SIGNATURES_SUPPORTED) {\n throw new Error(`Cannot have a signature larger than ${MultiEd25519Signature.MAX_SIGNATURES_SUPPORTED - 1}.`);\n }\n\n if (dupCheckSet.has(bit)) {\n throw new Error(\"Duplicate bits detected.\");\n }\n\n if (index > 0 && bit <= bits[index - 1]) {\n throw new Error(\"The bits need to be sorted in ascending order.\");\n }\n\n dupCheckSet.add(bit);\n\n const byteOffset = Math.floor(bit / 8);\n\n let byte = bitmap[byteOffset];\n\n // eslint-disable-next-line no-bitwise\n byte |= firstBitInByte >> bit % 8;\n\n bitmap[byteOffset] = byte;\n });\n\n return bitmap;\n }\n}\n"],"mappings":"2KAqBO,IAAMA,EAAN,MAAMA,UAA8BC,CAAiB,CAiD1D,YAAYC,EAA6D,CACvE,MAAM,EACN,GAAM,CAAE,WAAAC,EAAY,UAAAC,CAAU,EAAIF,EAGlC,GAAIC,EAAW,OAASH,EAAsB,UAAYG,EAAW,OAASH,EAAsB,SAClG,MAAM,IAAI,MACR,qBAAqBA,EAAsB,QAAQ,QAC9CA,EAAsB,QAAQ,yBACrC,EAIF,GAAII,EAAYJ,EAAsB,eAAiBI,EAAYD,EAAW,OAC5E,MAAM,IAAI,MACR,6BAA6BH,EAAsB,aAAa,QAAQG,EAAW,MAAM,aAC3F,EAGF,KAAK,WAAaA,EAClB,KAAK,UAAYC,CACnB,CAgBA,gBAAgBF,EAAoC,CAClD,GAAM,CAAE,QAAAG,EAAS,UAAAC,CAAU,EAAIJ,EAC/B,GAAI,EAAEI,aAAqBC,GACzB,MAAO,GAGT,IAAMC,EAAoB,CAAC,EAC3B,QAAS,EAAI,EAAG,EAAI,EAAG,GAAK,EAC1B,QAASC,EAAI,EAAGA,EAAI,EAAGA,GAAK,EAG1B,IADkBH,EA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AAO,IAAIJ,EAAsB,CAAE,WAAAE,EAAY,OAAAC,CAAO,CAAC,CACzD,CAuBA,OAAO,aAAatB,EAAsC,CACxD,GAAM,CAAE,KAAAwB,CAAK,EAAIxB,EAGXyB,EAAiB,IACjBH,EAAS,IAAI,WAAW,CAAC,EAAG,EAAG,EAAG,CAAC,CAAC,EAGpCI,EAAc,IAAI,IAExB,OAAAF,EAAK,QAAQ,CAACG,EAAanB,IAAU,CACnC,GAAImB,GAAOR,EAAsB,yBAC/B,MAAM,IAAI,MAAM,uCAAuCA,EAAsB,yBAA2B,CAAC,GAAG,EAG9G,GAAIO,EAAY,IAAIC,CAAG,EACrB,MAAM,IAAI,MAAM,0BAA0B,EAG5C,GAAInB,EAAQ,GAAKmB,GAAOH,EAAKhB,EAAQ,CAAC,EACpC,MAAM,IAAI,MAAM,gDAAgD,EAGlEkB,EAAY,IAAIC,CAAG,EAEnB,IAAMC,EAAa,KAAK,MAAMD,EAAM,CAAC,EAEjCE,EAAOP,EAAOM,CAAU,EAG5BC,GAAQJ,GAAkBE,EAAM,EAEhCL,EAAOM,CAAU,EAAIC,CACvB,CAAC,EAEMP,CACT,CACF,EAnKaH,EAMJ,yBAA2B,GANvBA,EAaJ,WAAqB,EAbvB,IAAMd,EAANc","names":["_MultiEd25519PublicKey","AccountPublicKey","args","publicKeys","threshold","message","signature","MultiEd25519Signature","indices","j","index","AuthenticationKey","bytes","Ed25519PublicKey","k","i","serializer","deserializer","keys","begin","MultiEd25519PublicKey","_MultiEd25519Signature","Signature","signatures","bitmap","Ed25519Signature","bits","firstBitInByte","dupCheckSet","bit","byteOffset","byte"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as r}from"./chunk-EBMEXURY.mjs";import{b as t}from"./chunk-STY74NUA.mjs";var o=class extends r{toUint8Array(){return this.bcsToBytes()}toString(){let i=this.toUint8Array();return t.fromHexInput(i).toString()}};export{o as a};
|
|
2
|
-
//# sourceMappingURL=chunk-WCMW2L3P.mjs.map
|