@aptos-labs/ts-sdk 1.15.0-win.2 → 1.16.0-zeta.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/dist/common/{accountAddress-ccLvlUQe.d.ts → accountAddress-BtD_TE5q.d.ts} +49 -3
- package/dist/common/chunk-VLEH6QBR.js +2 -0
- package/dist/common/chunk-VLEH6QBR.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 +627 -52
- package/dist/common/index.js +28 -28
- package/dist/common/index.js.map +1 -1
- package/dist/esm/{Ed25519Account-B1VMJOY2.d.mts → Ed25519Account-9zBaZEnp.d.mts} +1 -1
- package/dist/esm/account/Account.d.mts +2 -2
- package/dist/esm/account/Account.mjs +1 -1
- package/dist/esm/account/Ed25519Account.d.mts +2 -2
- package/dist/esm/account/Ed25519Account.mjs +1 -1
- package/dist/esm/account/EphemeralKeyPair.d.mts +85 -0
- package/dist/esm/account/EphemeralKeyPair.mjs +2 -0
- package/dist/esm/account/KeylessAccount.d.mts +166 -0
- package/dist/esm/account/KeylessAccount.mjs +2 -0
- package/dist/esm/account/MultiKeyAccount.d.mts +13 -7
- package/dist/esm/account/MultiKeyAccount.mjs +1 -1
- package/dist/esm/account/SingleKeyAccount.d.mts +2 -2
- package/dist/esm/account/SingleKeyAccount.mjs +1 -1
- package/dist/esm/account/index.d.mts +10 -2
- package/dist/esm/account/index.mjs +1 -1
- package/dist/esm/api/account.d.mts +2 -2
- package/dist/esm/api/account.mjs +1 -1
- package/dist/esm/api/ans.d.mts +2 -2
- package/dist/esm/api/ans.mjs +1 -1
- package/dist/esm/api/aptos.d.mts +12 -3
- package/dist/esm/api/aptos.mjs +1 -1
- package/dist/esm/api/aptosConfig.d.mts +20 -0
- package/dist/esm/api/aptosConfig.mjs +1 -1
- package/dist/esm/api/coin.d.mts +1 -1
- package/dist/esm/api/coin.mjs +1 -1
- package/dist/esm/api/digitalAsset.d.mts +2 -2
- package/dist/esm/api/digitalAsset.mjs +1 -1
- package/dist/esm/api/event.mjs +1 -1
- package/dist/esm/api/faucet.mjs +1 -1
- package/dist/esm/api/fungibleAsset.d.mts +2 -2
- package/dist/esm/api/fungibleAsset.mjs +1 -1
- package/dist/esm/api/general.d.mts +1 -1
- package/dist/esm/api/general.mjs +1 -1
- package/dist/esm/api/index.d.mts +10 -2
- package/dist/esm/api/index.mjs +1 -1
- package/dist/esm/api/keyless.d.mts +83 -0
- package/dist/esm/api/keyless.mjs +2 -0
- package/dist/esm/api/keyless.mjs.map +1 -0
- package/dist/esm/api/staking.mjs +1 -1
- package/dist/esm/api/table.mjs +1 -1
- package/dist/esm/api/transaction.d.mts +2 -2
- package/dist/esm/api/transaction.mjs +1 -1
- package/dist/esm/api/transactionSubmission/build.d.mts +1 -1
- package/dist/esm/api/transactionSubmission/build.mjs +1 -1
- package/dist/esm/api/transactionSubmission/management.d.mts +2 -2
- package/dist/esm/api/transactionSubmission/management.mjs +1 -1
- package/dist/esm/api/transactionSubmission/sign.d.mts +2 -2
- package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
- package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -1
- package/dist/esm/api/transactionSubmission/simulate.d.mts +1 -1
- package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
- package/dist/esm/api/transactionSubmission/submit.d.mts +1 -1
- package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
- package/dist/esm/api/utils.mjs +1 -1
- package/dist/esm/bcs/cryptoHasher.d.mts +15 -0
- package/dist/esm/bcs/cryptoHasher.mjs +2 -0
- package/dist/esm/bcs/cryptoHasher.mjs.map +1 -0
- package/dist/esm/bcs/deserializer.d.mts +26 -0
- package/dist/esm/bcs/deserializer.mjs +1 -1
- package/dist/esm/bcs/index.mjs +1 -1
- package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +1 -1
- package/dist/esm/bcs/serializable/fixedBytes.mjs +1 -1
- package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
- package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
- package/dist/esm/bcs/serializer.d.mts +2 -0
- package/dist/esm/bcs/serializer.mjs +1 -1
- package/dist/esm/chunk-3FVRXELT.mjs +2 -0
- package/dist/esm/{chunk-U3YYSIIT.mjs → chunk-3VGX3TXH.mjs} +2 -2
- package/dist/esm/{chunk-4W3ZDREO.mjs → chunk-3Y6JNFPD.mjs} +2 -2
- package/dist/esm/chunk-4KEEUDZA.mjs +2 -0
- package/dist/esm/chunk-4KEEUDZA.mjs.map +1 -0
- package/dist/esm/chunk-4USAUOCE.mjs +2 -0
- package/dist/esm/{chunk-C4RK5AB6.mjs.map → chunk-4USAUOCE.mjs.map} +1 -1
- package/dist/esm/chunk-5ADNWXP2.mjs +2 -0
- package/dist/esm/chunk-5ADNWXP2.mjs.map +1 -0
- package/dist/esm/{chunk-JP4W2YJF.mjs → chunk-5RRZMXND.mjs} +2 -2
- package/dist/esm/chunk-5V2RGYYK.mjs +2 -0
- package/dist/esm/chunk-5V2RGYYK.mjs.map +1 -0
- package/dist/esm/chunk-5YI2GEG5.mjs +2 -0
- package/dist/esm/chunk-5YI2GEG5.mjs.map +1 -0
- package/dist/esm/chunk-6KNAIXZ3.mjs +2 -0
- package/dist/esm/chunk-6KNAIXZ3.mjs.map +1 -0
- package/dist/esm/{chunk-64MINNG2.mjs → chunk-6M53MDWB.mjs} +2 -2
- package/dist/esm/chunk-6RBUXB5I.mjs +2 -0
- package/dist/esm/{chunk-SRDIYE3M.mjs.map → chunk-6RBUXB5I.mjs.map} +1 -1
- package/dist/esm/{chunk-UPSCPEEE.mjs → chunk-7H3HRFVM.mjs} +2 -2
- package/dist/esm/chunk-7QGIAVW4.mjs +2 -0
- package/dist/esm/chunk-7QGIAVW4.mjs.map +1 -0
- package/dist/esm/{chunk-5EN52MUT.mjs → chunk-7STYQ5ZE.mjs} +2 -2
- package/dist/esm/chunk-7Z6DYLCA.mjs +1 -0
- package/dist/esm/chunk-7Z6DYLCA.mjs.map +1 -0
- package/dist/esm/{chunk-J77BLQCV.mjs → chunk-A3UVZHDJ.mjs} +2 -2
- package/dist/esm/{chunk-BCUSI3N6.mjs → chunk-AOCNYMMX.mjs} +2 -2
- package/dist/esm/chunk-AQ4I7VVB.mjs +1 -0
- package/dist/esm/chunk-AQ4I7VVB.mjs.map +1 -0
- package/dist/esm/{chunk-2O5VFH5O.mjs → chunk-C34M4T77.mjs} +2 -2
- package/dist/esm/chunk-C3L4ETUF.mjs +2 -0
- package/dist/esm/chunk-CNH2RAJQ.mjs +2 -0
- package/dist/esm/chunk-CNH2RAJQ.mjs.map +1 -0
- package/dist/esm/chunk-COW5IGYC.mjs +2 -0
- package/dist/esm/{chunk-TLLWFCCP.mjs → chunk-EADBYPUD.mjs} +2 -2
- package/dist/esm/{chunk-G56GPLTB.mjs → chunk-EB7AI4B4.mjs} +2 -2
- package/dist/esm/{chunk-AJU3EBVX.mjs → chunk-EIRSA5UU.mjs} +2 -2
- package/dist/esm/{chunk-SSSWFYAX.mjs → chunk-EPTCPBVW.mjs} +2 -2
- package/dist/esm/chunk-EU6CX56Q.mjs +2 -0
- package/dist/esm/chunk-EU6CX56Q.mjs.map +1 -0
- package/dist/esm/{chunk-AG3TUKNI.mjs → chunk-F5C4SZZ7.mjs} +2 -2
- package/dist/esm/{chunk-ECVKW776.mjs → chunk-FBLSW5TB.mjs} +2 -2
- package/dist/esm/chunk-FBPNHF54.mjs +2 -0
- package/dist/esm/{chunk-KAGLWBIJ.mjs → chunk-HGZGTBA4.mjs} +2 -2
- package/dist/esm/chunk-I5JWDZIP.mjs +2 -0
- package/dist/esm/chunk-I5JWDZIP.mjs.map +1 -0
- package/dist/esm/chunk-IEZO4PIG.mjs +2 -0
- package/dist/esm/{chunk-BZCARW2P.mjs → chunk-IJE5YSXW.mjs} +2 -2
- package/dist/esm/chunk-JCDZ2WXX.mjs +2 -0
- package/dist/esm/chunk-JCDZ2WXX.mjs.map +1 -0
- package/dist/esm/chunk-JKZHPY24.mjs +2 -0
- package/dist/esm/{chunk-CJDEPZ4J.mjs.map → chunk-JKZHPY24.mjs.map} +1 -1
- package/dist/esm/chunk-JM2B5E2I.mjs +2 -0
- package/dist/esm/chunk-JM2B5E2I.mjs.map +1 -0
- package/dist/esm/{chunk-DZJ2RMX3.mjs → chunk-KFUOOBMJ.mjs} +2 -2
- package/dist/esm/{chunk-CWO2JAUL.mjs → chunk-KKP4FBWZ.mjs} +2 -2
- package/dist/esm/chunk-KPZDC5ZE.mjs +2 -0
- package/dist/esm/chunk-KPZDC5ZE.mjs.map +1 -0
- package/dist/esm/{chunk-OUTRV57V.mjs → chunk-LEBJNW6Y.mjs} +2 -2
- package/dist/esm/chunk-LECNIPW7.mjs +2 -0
- package/dist/esm/chunk-LECNIPW7.mjs.map +1 -0
- package/dist/esm/{chunk-UEELI2FS.mjs → chunk-LO7B3CWN.mjs} +2 -2
- package/dist/esm/{chunk-EU7EBOVD.mjs → chunk-LQH7T3TE.mjs} +2 -2
- package/dist/esm/{chunk-VC4A47VQ.mjs → chunk-M7HZOQ6A.mjs} +2 -2
- package/dist/esm/chunk-MGOHPDX4.mjs +2 -0
- package/dist/esm/{chunk-P6GWG2CY.mjs → chunk-MKUAW7KW.mjs} +2 -2
- package/dist/esm/{chunk-I6ST47U7.mjs → chunk-MTLETLKV.mjs} +2 -2
- package/dist/esm/{chunk-QYJF7C23.mjs → chunk-MWN63XBE.mjs} +2 -2
- package/dist/esm/chunk-MWUJCP27.mjs +2 -0
- package/dist/esm/chunk-N466X3S6.mjs +2 -0
- package/dist/esm/chunk-N466X3S6.mjs.map +1 -0
- package/dist/esm/chunk-N7CE244N.mjs +2 -0
- package/dist/esm/{chunk-2XK53QFA.mjs.map → chunk-N7CE244N.mjs.map} +1 -1
- package/dist/esm/{chunk-GM56MMNJ.mjs → chunk-NC5HHEEM.mjs} +2 -2
- package/dist/esm/chunk-NCDP26DV.mjs +2 -0
- package/dist/esm/chunk-NCDP26DV.mjs.map +1 -0
- package/dist/esm/{chunk-EKOTTHRQ.mjs → chunk-NQMF46E5.mjs} +2 -2
- package/dist/esm/chunk-NWWXZ7EW.mjs +2 -0
- package/dist/esm/chunk-NWWXZ7EW.mjs.map +1 -0
- package/dist/esm/{chunk-AJIDUBBG.mjs → chunk-ONIYM7IU.mjs} +2 -2
- package/dist/esm/{chunk-GWPTNJTQ.mjs → chunk-OT37OTT7.mjs} +2 -2
- package/dist/esm/{chunk-7FIS3GNZ.mjs → chunk-OX5GWFHX.mjs} +2 -2
- package/dist/esm/{chunk-SGTNW5YI.mjs → chunk-PYUU4OEL.mjs} +2 -2
- package/dist/esm/{chunk-T4J32V4F.mjs → chunk-Q3AUNZDW.mjs} +2 -2
- package/dist/esm/chunk-QZRWRX6P.mjs +2 -0
- package/dist/esm/{chunk-YMB2XW2O.mjs.map → chunk-QZRWRX6P.mjs.map} +1 -1
- package/dist/esm/chunk-R2P2XANA.mjs +2 -0
- package/dist/esm/chunk-R2P2XANA.mjs.map +1 -0
- package/dist/esm/{chunk-25HG3O2C.mjs → chunk-REBMGDZ5.mjs} +2 -2
- package/dist/esm/{chunk-GHYE26Q5.mjs → chunk-RKHPXZM6.mjs} +2 -2
- package/dist/esm/{chunk-GHYE26Q5.mjs.map → chunk-RKHPXZM6.mjs.map} +1 -1
- package/dist/esm/chunk-RUSWW265.mjs +2 -0
- package/dist/esm/{chunk-M3YZNSJI.mjs → chunk-SBQRBBRS.mjs} +2 -2
- package/dist/esm/chunk-STYDBDYL.mjs +2 -0
- package/dist/esm/{chunk-QRS4DGP3.mjs → chunk-T23OVRNF.mjs} +2 -2
- package/dist/esm/{chunk-QRS4DGP3.mjs.map → chunk-T23OVRNF.mjs.map} +1 -1
- package/dist/esm/{chunk-TUMYQZ27.mjs → chunk-T6OEZ4KP.mjs} +2 -2
- package/dist/esm/{chunk-L7LLGJRG.mjs → chunk-TEJ7BXJK.mjs} +2 -2
- package/dist/esm/chunk-TJDC5PWD.mjs +2 -0
- package/dist/esm/{chunk-36QXVFR5.mjs → chunk-TVRJ3M7B.mjs} +2 -2
- package/dist/esm/{chunk-36QXVFR5.mjs.map → chunk-TVRJ3M7B.mjs.map} +1 -1
- package/dist/esm/{chunk-UQU5WAX2.mjs → chunk-UDU5L4XH.mjs} +2 -2
- package/dist/esm/{chunk-Y3RPWX6U.mjs → chunk-UFJGYMEB.mjs} +2 -2
- package/dist/esm/chunk-UO5LUYGO.mjs +2 -0
- package/dist/esm/chunk-UO5LUYGO.mjs.map +1 -0
- package/dist/esm/chunk-UTXJOB3O.mjs +2 -0
- package/dist/esm/{chunk-DQOIESL4.mjs → chunk-UWI5D7FD.mjs} +2 -2
- package/dist/esm/chunk-VT6XJSRO.mjs +2 -0
- package/dist/esm/chunk-VT6XJSRO.mjs.map +1 -0
- package/dist/esm/{chunk-GCBRNHAO.mjs → chunk-W36IQO5K.mjs} +2 -2
- package/dist/esm/chunk-W4IWORPF.mjs +2 -0
- package/dist/esm/chunk-W4IWORPF.mjs.map +1 -0
- package/dist/esm/{chunk-BHLICYAI.mjs → chunk-W637YAND.mjs} +2 -2
- package/dist/esm/{chunk-NNUKSGEX.mjs → chunk-WAXCU6D6.mjs} +2 -2
- package/dist/esm/chunk-WDE54GRQ.mjs +2 -0
- package/dist/esm/chunk-WDE54GRQ.mjs.map +1 -0
- package/dist/esm/{chunk-2ZGHK5BB.mjs → chunk-Y33VGXNI.mjs} +2 -2
- package/dist/esm/chunk-Y5BON557.mjs +2 -0
- package/dist/esm/chunk-YE5B2S5L.mjs +2 -0
- package/dist/esm/chunk-YE5B2S5L.mjs.map +1 -0
- package/dist/esm/{chunk-ZJMW5Z76.mjs → chunk-YHO2EBXH.mjs} +2 -2
- package/dist/esm/chunk-YZPQVZ7S.mjs +2 -0
- package/dist/esm/chunk-YZPQVZ7S.mjs.map +1 -0
- package/dist/esm/chunk-Z2ZR4PTF.mjs +2 -0
- package/dist/esm/{chunk-5WFN54GV.mjs → chunk-Z6JERVLX.mjs} +2 -2
- package/dist/esm/chunk-ZCCYHFPK.mjs +2 -0
- package/dist/esm/chunk-ZCCYHFPK.mjs.map +1 -0
- package/dist/esm/{chunk-35EWRSDK.mjs → chunk-ZNEBMSNC.mjs} +2 -2
- package/dist/esm/chunk-ZUQJLFR2.mjs +2 -0
- package/dist/esm/chunk-ZUQJLFR2.mjs.map +1 -0
- package/dist/esm/cli/index.mjs +1 -1
- package/dist/esm/cli/localNode.mjs +1 -1
- package/dist/esm/client/core.mjs +1 -1
- package/dist/esm/client/get.d.mts +2 -1
- package/dist/esm/client/get.mjs +1 -1
- package/dist/esm/client/index.d.mts +2 -2
- package/dist/esm/client/index.mjs +1 -1
- package/dist/esm/client/post.d.mts +3 -1
- package/dist/esm/client/post.mjs +1 -1
- package/dist/esm/client/types.d.mts +5 -1
- package/dist/esm/client/types.mjs +1 -1
- package/dist/esm/core/account/index.mjs +1 -1
- package/dist/esm/core/account/utils/address.mjs +1 -1
- package/dist/esm/core/account/utils/index.mjs +1 -1
- package/dist/esm/core/accountAddress.mjs +1 -1
- package/dist/esm/core/authenticationKey.d.mts +1 -1
- package/dist/esm/core/authenticationKey.mjs +1 -1
- package/dist/esm/core/common.mjs +1 -1
- package/dist/esm/core/crypto/ed25519.d.mts +1 -1
- package/dist/esm/core/crypto/ed25519.mjs +1 -1
- package/dist/esm/core/crypto/ephemeral.d.mts +73 -0
- package/dist/esm/core/crypto/ephemeral.mjs +2 -0
- package/dist/esm/core/crypto/ephemeral.mjs.map +1 -0
- package/dist/esm/core/crypto/index.d.mts +4 -1
- package/dist/esm/core/crypto/index.mjs +1 -1
- package/dist/esm/core/crypto/keyless.d.mts +232 -0
- package/dist/esm/core/crypto/keyless.mjs +2 -0
- package/dist/esm/core/crypto/keyless.mjs.map +1 -0
- package/dist/esm/core/crypto/multiEd25519.d.mts +1 -1
- package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
- package/dist/esm/core/crypto/multiKey.d.mts +1 -1
- package/dist/esm/core/crypto/multiKey.mjs +1 -1
- package/dist/esm/core/crypto/poseidon.d.mts +7 -0
- package/dist/esm/core/crypto/poseidon.mjs +2 -0
- package/dist/esm/core/crypto/poseidon.mjs.map +1 -0
- package/dist/esm/core/crypto/privateKey.d.mts +1 -1
- package/dist/esm/core/crypto/proof.d.mts +21 -0
- package/dist/esm/core/crypto/proof.mjs +2 -0
- package/dist/esm/core/crypto/proof.mjs.map +1 -0
- package/dist/esm/core/crypto/publicKey.d.mts +1 -1
- package/dist/esm/core/crypto/publicKey.mjs +1 -1
- package/dist/esm/core/crypto/secp256k1.d.mts +1 -1
- package/dist/esm/core/crypto/secp256k1.mjs +1 -1
- package/dist/esm/core/crypto/signature.mjs +1 -1
- package/dist/esm/core/crypto/singleKey.d.mts +1 -1
- package/dist/esm/core/crypto/singleKey.mjs +1 -1
- package/dist/esm/core/crypto/utils.mjs +1 -1
- package/dist/esm/core/hex.mjs +1 -1
- package/dist/esm/core/index.d.mts +4 -1
- package/dist/esm/core/index.mjs +1 -1
- package/dist/esm/index.d.mts +16 -9
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/internal/account.d.mts +2 -2
- package/dist/esm/internal/account.mjs +1 -1
- package/dist/esm/internal/ans.d.mts +2 -2
- package/dist/esm/internal/ans.mjs +1 -1
- package/dist/esm/internal/coin.d.mts +1 -1
- package/dist/esm/internal/coin.mjs +1 -1
- package/dist/esm/internal/digitalAsset.d.mts +2 -2
- package/dist/esm/internal/digitalAsset.mjs +1 -1
- package/dist/esm/internal/event.mjs +1 -1
- package/dist/esm/internal/faucet.mjs +1 -1
- package/dist/esm/internal/fungibleAsset.d.mts +2 -2
- package/dist/esm/internal/fungibleAsset.mjs +1 -1
- package/dist/esm/internal/general.mjs +1 -1
- package/dist/esm/internal/keyless.d.mts +76 -0
- package/dist/esm/internal/keyless.mjs +2 -0
- package/dist/esm/internal/keyless.mjs.map +1 -0
- package/dist/esm/internal/staking.mjs +1 -1
- package/dist/esm/internal/table.mjs +1 -1
- package/dist/esm/internal/transaction.mjs +1 -1
- package/dist/esm/internal/transactionSubmission.d.mts +2 -2
- package/dist/esm/internal/transactionSubmission.mjs +1 -1
- package/dist/esm/internal/view.d.mts +1 -1
- package/dist/esm/internal/view.mjs +1 -1
- package/dist/esm/transactions/authenticator/account.d.mts +1 -1
- package/dist/esm/transactions/authenticator/account.mjs +1 -1
- package/dist/esm/transactions/authenticator/index.d.mts +1 -1
- package/dist/esm/transactions/authenticator/index.mjs +1 -1
- package/dist/esm/transactions/authenticator/transaction.d.mts +1 -1
- package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
- package/dist/esm/transactions/index.d.mts +4 -3
- package/dist/esm/transactions/index.mjs +1 -1
- package/dist/esm/transactions/instances/chainId.mjs +1 -1
- package/dist/esm/transactions/instances/identifier.mjs +1 -1
- package/dist/esm/transactions/instances/index.d.mts +1 -1
- package/dist/esm/transactions/instances/index.mjs +1 -1
- package/dist/esm/transactions/instances/moduleId.mjs +1 -1
- package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/rotationProofChallenge.d.mts +1 -1
- package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
- package/dist/esm/transactions/instances/signedTransaction.d.mts +1 -1
- package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
- package/dist/esm/transactions/management/accountSequenceNumber.d.mts +2 -2
- package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
- package/dist/esm/transactions/management/index.d.mts +2 -2
- package/dist/esm/transactions/management/index.mjs +1 -1
- package/dist/esm/transactions/management/transactionWorker.d.mts +2 -2
- package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/helpers.d.mts +1 -1
- 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 +3 -3
- package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/signingMessage.d.mts +7 -6
- package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +2 -2
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
- package/dist/esm/transactions/typeTag/index.mjs +1 -1
- package/dist/esm/transactions/typeTag/parser.d.mts +3 -1
- package/dist/esm/transactions/typeTag/parser.mjs +1 -1
- package/dist/esm/transactions/types.d.mts +23 -5
- package/dist/esm/types/index.d.mts +19 -3
- package/dist/esm/types/index.mjs +1 -1
- package/dist/esm/types/keyless.d.mts +16 -0
- package/dist/esm/types/keyless.mjs +1 -0
- package/dist/esm/types/keyless.mjs.map +1 -0
- package/dist/esm/utils/apiEndpoints.d.mts +3 -1
- package/dist/esm/utils/apiEndpoints.mjs +1 -1
- package/dist/esm/utils/const.d.mts +3 -1
- package/dist/esm/utils/const.mjs +1 -1
- package/dist/esm/utils/helpers.d.mts +4 -1
- package/dist/esm/utils/helpers.mjs +1 -1
- package/dist/esm/utils/index.d.mts +1 -1
- package/dist/esm/utils/index.mjs +1 -1
- 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 +11 -3
- package/src/account/EphemeralKeyPair.ts +157 -0
- package/src/account/KeylessAccount.ts +366 -0
- package/src/account/MultiKeyAccount.ts +11 -0
- package/src/account/index.ts +2 -0
- package/src/api/aptos.ts +6 -0
- package/src/api/aptosConfig.ts +46 -1
- package/src/api/keyless.ts +48 -0
- package/src/bcs/cryptoHasher.ts +6 -0
- package/src/bcs/deserializer.ts +40 -0
- package/src/bcs/serializer.ts +18 -0
- package/src/cli/localNode.ts +11 -1
- package/src/client/core.ts +8 -0
- package/src/client/get.ts +6 -0
- package/src/client/post.ts +12 -0
- package/src/client/types.ts +1 -1
- package/src/core/crypto/ephemeral.ts +138 -0
- package/src/core/crypto/index.ts +2 -0
- package/src/core/crypto/keyless.ts +453 -0
- package/src/core/crypto/poseidon.ts +133 -0
- package/src/core/crypto/proof.ts +16 -0
- package/src/core/crypto/singleKey.ts +11 -0
- package/src/internal/keyless.ts +109 -0
- package/src/internal/transactionSubmission.ts +7 -2
- package/src/transactions/transactionBuilder/remoteAbi.ts +16 -2
- package/src/transactions/transactionBuilder/signingMessage.ts +4 -4
- package/src/transactions/transactionBuilder/transactionBuilder.ts +21 -3
- package/src/transactions/typeTag/parser.ts +98 -52
- package/src/transactions/types.ts +22 -3
- package/src/types/index.ts +22 -0
- package/src/types/keyless.ts +6 -0
- package/src/utils/apiEndpoints.ts +14 -0
- package/src/utils/const.ts +2 -0
- package/src/utils/helpers.ts +25 -0
- package/src/version.ts +1 -1
- package/dist/common/chunk-KSEUZTKY.js +0 -2
- package/dist/common/chunk-KSEUZTKY.js.map +0 -1
- package/dist/esm/chunk-2XK53QFA.mjs +0 -2
- package/dist/esm/chunk-3JPVQHOR.mjs +0 -2
- package/dist/esm/chunk-3JPVQHOR.mjs.map +0 -1
- package/dist/esm/chunk-4NHWV5AI.mjs +0 -2
- package/dist/esm/chunk-6IFMQ5AS.mjs +0 -2
- package/dist/esm/chunk-6IFMQ5AS.mjs.map +0 -1
- package/dist/esm/chunk-6QJOCI5Y.mjs +0 -2
- package/dist/esm/chunk-7VRZLDIJ.mjs +0 -2
- package/dist/esm/chunk-B7X6PSE7.mjs +0 -2
- package/dist/esm/chunk-BO2TLWNT.mjs +0 -2
- package/dist/esm/chunk-BVV56I3P.mjs +0 -2
- package/dist/esm/chunk-BVV56I3P.mjs.map +0 -1
- package/dist/esm/chunk-C4RK5AB6.mjs +0 -2
- package/dist/esm/chunk-C6HODGUS.mjs +0 -2
- package/dist/esm/chunk-CEHCDA3G.mjs +0 -2
- package/dist/esm/chunk-CJDEPZ4J.mjs +0 -2
- package/dist/esm/chunk-CYNQRMO5.mjs +0 -2
- package/dist/esm/chunk-CYNQRMO5.mjs.map +0 -1
- package/dist/esm/chunk-DCF2OTJS.mjs +0 -2
- package/dist/esm/chunk-DCF2OTJS.mjs.map +0 -1
- package/dist/esm/chunk-EW3AR5V3.mjs +0 -2
- package/dist/esm/chunk-EW3AR5V3.mjs.map +0 -1
- package/dist/esm/chunk-F7EMGK4M.mjs +0 -2
- package/dist/esm/chunk-HYCGMFC2.mjs +0 -2
- package/dist/esm/chunk-HYCGMFC2.mjs.map +0 -1
- package/dist/esm/chunk-JDDYOCHY.mjs +0 -2
- package/dist/esm/chunk-JDDYOCHY.mjs.map +0 -1
- package/dist/esm/chunk-JFIAWBCK.mjs +0 -2
- package/dist/esm/chunk-JFIAWBCK.mjs.map +0 -1
- package/dist/esm/chunk-L54P6EGN.mjs +0 -2
- package/dist/esm/chunk-L54P6EGN.mjs.map +0 -1
- package/dist/esm/chunk-LG7RJQ57.mjs +0 -2
- package/dist/esm/chunk-MJPUASSD.mjs +0 -2
- package/dist/esm/chunk-MJPUASSD.mjs.map +0 -1
- package/dist/esm/chunk-MV6ORORF.mjs +0 -2
- package/dist/esm/chunk-MV6ORORF.mjs.map +0 -1
- package/dist/esm/chunk-N3U47Y6Y.mjs +0 -2
- package/dist/esm/chunk-OWW6SIDP.mjs +0 -2
- package/dist/esm/chunk-OWW6SIDP.mjs.map +0 -1
- package/dist/esm/chunk-PF57EOJY.mjs +0 -2
- package/dist/esm/chunk-PYGUW7SU.mjs +0 -2
- package/dist/esm/chunk-PYGUW7SU.mjs.map +0 -1
- package/dist/esm/chunk-ROXFCLDT.mjs +0 -2
- package/dist/esm/chunk-RTSWVT2Q.mjs +0 -2
- package/dist/esm/chunk-RTSWVT2Q.mjs.map +0 -1
- package/dist/esm/chunk-S2VSJJRJ.mjs +0 -2
- package/dist/esm/chunk-S2VSJJRJ.mjs.map +0 -1
- package/dist/esm/chunk-SRDIYE3M.mjs +0 -2
- package/dist/esm/chunk-UGPALAPN.mjs +0 -2
- package/dist/esm/chunk-UO3NZ5AH.mjs +0 -1
- package/dist/esm/chunk-UVSRX4SV.mjs +0 -1
- package/dist/esm/chunk-YMB2XW2O.mjs +0 -2
- /package/dist/esm/{chunk-UO3NZ5AH.mjs.map → account/EphemeralKeyPair.mjs.map} +0 -0
- /package/dist/esm/{chunk-UVSRX4SV.mjs.map → account/KeylessAccount.mjs.map} +0 -0
- /package/dist/esm/{chunk-CEHCDA3G.mjs.map → chunk-3FVRXELT.mjs.map} +0 -0
- /package/dist/esm/{chunk-U3YYSIIT.mjs.map → chunk-3VGX3TXH.mjs.map} +0 -0
- /package/dist/esm/{chunk-4W3ZDREO.mjs.map → chunk-3Y6JNFPD.mjs.map} +0 -0
- /package/dist/esm/{chunk-JP4W2YJF.mjs.map → chunk-5RRZMXND.mjs.map} +0 -0
- /package/dist/esm/{chunk-64MINNG2.mjs.map → chunk-6M53MDWB.mjs.map} +0 -0
- /package/dist/esm/{chunk-UPSCPEEE.mjs.map → chunk-7H3HRFVM.mjs.map} +0 -0
- /package/dist/esm/{chunk-5EN52MUT.mjs.map → chunk-7STYQ5ZE.mjs.map} +0 -0
- /package/dist/esm/{chunk-J77BLQCV.mjs.map → chunk-A3UVZHDJ.mjs.map} +0 -0
- /package/dist/esm/{chunk-BCUSI3N6.mjs.map → chunk-AOCNYMMX.mjs.map} +0 -0
- /package/dist/esm/{chunk-2O5VFH5O.mjs.map → chunk-C34M4T77.mjs.map} +0 -0
- /package/dist/esm/{chunk-N3U47Y6Y.mjs.map → chunk-C3L4ETUF.mjs.map} +0 -0
- /package/dist/esm/{chunk-4NHWV5AI.mjs.map → chunk-COW5IGYC.mjs.map} +0 -0
- /package/dist/esm/{chunk-TLLWFCCP.mjs.map → chunk-EADBYPUD.mjs.map} +0 -0
- /package/dist/esm/{chunk-G56GPLTB.mjs.map → chunk-EB7AI4B4.mjs.map} +0 -0
- /package/dist/esm/{chunk-AJU3EBVX.mjs.map → chunk-EIRSA5UU.mjs.map} +0 -0
- /package/dist/esm/{chunk-SSSWFYAX.mjs.map → chunk-EPTCPBVW.mjs.map} +0 -0
- /package/dist/esm/{chunk-AG3TUKNI.mjs.map → chunk-F5C4SZZ7.mjs.map} +0 -0
- /package/dist/esm/{chunk-ECVKW776.mjs.map → chunk-FBLSW5TB.mjs.map} +0 -0
- /package/dist/esm/{chunk-LG7RJQ57.mjs.map → chunk-FBPNHF54.mjs.map} +0 -0
- /package/dist/esm/{chunk-KAGLWBIJ.mjs.map → chunk-HGZGTBA4.mjs.map} +0 -0
- /package/dist/esm/{chunk-7VRZLDIJ.mjs.map → chunk-IEZO4PIG.mjs.map} +0 -0
- /package/dist/esm/{chunk-BZCARW2P.mjs.map → chunk-IJE5YSXW.mjs.map} +0 -0
- /package/dist/esm/{chunk-DZJ2RMX3.mjs.map → chunk-KFUOOBMJ.mjs.map} +0 -0
- /package/dist/esm/{chunk-CWO2JAUL.mjs.map → chunk-KKP4FBWZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-OUTRV57V.mjs.map → chunk-LEBJNW6Y.mjs.map} +0 -0
- /package/dist/esm/{chunk-UEELI2FS.mjs.map → chunk-LO7B3CWN.mjs.map} +0 -0
- /package/dist/esm/{chunk-EU7EBOVD.mjs.map → chunk-LQH7T3TE.mjs.map} +0 -0
- /package/dist/esm/{chunk-VC4A47VQ.mjs.map → chunk-M7HZOQ6A.mjs.map} +0 -0
- /package/dist/esm/{chunk-B7X6PSE7.mjs.map → chunk-MGOHPDX4.mjs.map} +0 -0
- /package/dist/esm/{chunk-P6GWG2CY.mjs.map → chunk-MKUAW7KW.mjs.map} +0 -0
- /package/dist/esm/{chunk-I6ST47U7.mjs.map → chunk-MTLETLKV.mjs.map} +0 -0
- /package/dist/esm/{chunk-QYJF7C23.mjs.map → chunk-MWN63XBE.mjs.map} +0 -0
- /package/dist/esm/{chunk-PF57EOJY.mjs.map → chunk-MWUJCP27.mjs.map} +0 -0
- /package/dist/esm/{chunk-GM56MMNJ.mjs.map → chunk-NC5HHEEM.mjs.map} +0 -0
- /package/dist/esm/{chunk-EKOTTHRQ.mjs.map → chunk-NQMF46E5.mjs.map} +0 -0
- /package/dist/esm/{chunk-AJIDUBBG.mjs.map → chunk-ONIYM7IU.mjs.map} +0 -0
- /package/dist/esm/{chunk-GWPTNJTQ.mjs.map → chunk-OT37OTT7.mjs.map} +0 -0
- /package/dist/esm/{chunk-7FIS3GNZ.mjs.map → chunk-OX5GWFHX.mjs.map} +0 -0
- /package/dist/esm/{chunk-SGTNW5YI.mjs.map → chunk-PYUU4OEL.mjs.map} +0 -0
- /package/dist/esm/{chunk-T4J32V4F.mjs.map → chunk-Q3AUNZDW.mjs.map} +0 -0
- /package/dist/esm/{chunk-25HG3O2C.mjs.map → chunk-REBMGDZ5.mjs.map} +0 -0
- /package/dist/esm/{chunk-6QJOCI5Y.mjs.map → chunk-RUSWW265.mjs.map} +0 -0
- /package/dist/esm/{chunk-M3YZNSJI.mjs.map → chunk-SBQRBBRS.mjs.map} +0 -0
- /package/dist/esm/{chunk-UGPALAPN.mjs.map → chunk-STYDBDYL.mjs.map} +0 -0
- /package/dist/esm/{chunk-TUMYQZ27.mjs.map → chunk-T6OEZ4KP.mjs.map} +0 -0
- /package/dist/esm/{chunk-L7LLGJRG.mjs.map → chunk-TEJ7BXJK.mjs.map} +0 -0
- /package/dist/esm/{chunk-F7EMGK4M.mjs.map → chunk-TJDC5PWD.mjs.map} +0 -0
- /package/dist/esm/{chunk-UQU5WAX2.mjs.map → chunk-UDU5L4XH.mjs.map} +0 -0
- /package/dist/esm/{chunk-Y3RPWX6U.mjs.map → chunk-UFJGYMEB.mjs.map} +0 -0
- /package/dist/esm/{chunk-ROXFCLDT.mjs.map → chunk-UTXJOB3O.mjs.map} +0 -0
- /package/dist/esm/{chunk-DQOIESL4.mjs.map → chunk-UWI5D7FD.mjs.map} +0 -0
- /package/dist/esm/{chunk-GCBRNHAO.mjs.map → chunk-W36IQO5K.mjs.map} +0 -0
- /package/dist/esm/{chunk-BHLICYAI.mjs.map → chunk-W637YAND.mjs.map} +0 -0
- /package/dist/esm/{chunk-NNUKSGEX.mjs.map → chunk-WAXCU6D6.mjs.map} +0 -0
- /package/dist/esm/{chunk-2ZGHK5BB.mjs.map → chunk-Y33VGXNI.mjs.map} +0 -0
- /package/dist/esm/{chunk-C6HODGUS.mjs.map → chunk-Y5BON557.mjs.map} +0 -0
- /package/dist/esm/{chunk-ZJMW5Z76.mjs.map → chunk-YHO2EBXH.mjs.map} +0 -0
- /package/dist/esm/{chunk-BO2TLWNT.mjs.map → chunk-Z2ZR4PTF.mjs.map} +0 -0
- /package/dist/esm/{chunk-5WFN54GV.mjs.map → chunk-Z6JERVLX.mjs.map} +0 -0
- /package/dist/esm/{chunk-35EWRSDK.mjs.map → chunk-ZNEBMSNC.mjs.map} +0 -0
- /package/dist/esm/{publicKey-B3XRNhHO.d.mts → publicKey-lq5djCIY.d.mts} +0 -0
|
@@ -21,18 +21,64 @@ import {
|
|
|
21
21
|
import { AccountAddress } from "../../core";
|
|
22
22
|
import { Identifier } from "../instances/identifier";
|
|
23
23
|
|
|
24
|
+
/**
|
|
25
|
+
* Tells if the string is a valid Move identifier. It can only be alphanumeric and `_`
|
|
26
|
+
* @param str
|
|
27
|
+
*/
|
|
24
28
|
function isValidIdentifier(str: string) {
|
|
25
29
|
return !!str.match(/^[_a-zA-Z0-9]+$/);
|
|
26
30
|
}
|
|
27
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Tells if the character is a whitespace character. Does not work for multiple characters
|
|
34
|
+
* @param char
|
|
35
|
+
*/
|
|
28
36
|
function isValidWhitespaceCharacter(char: string) {
|
|
29
37
|
return !!char.match(/\s/);
|
|
30
38
|
}
|
|
31
39
|
|
|
40
|
+
/**
|
|
41
|
+
* Tells if a type is a generic type from the ABI, this will be of the form T0, T1, ...
|
|
42
|
+
* @param str
|
|
43
|
+
*/
|
|
32
44
|
function isGeneric(str: string) {
|
|
33
45
|
return !!str.match(/^T[0-9]+$/);
|
|
34
46
|
}
|
|
35
47
|
|
|
48
|
+
/**
|
|
49
|
+
* Tells if a type is a reference type (starts with &)
|
|
50
|
+
* @param str
|
|
51
|
+
*/
|
|
52
|
+
function isRef(str: string) {
|
|
53
|
+
return !!str.match(/^&.+$/);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Tells if a type is a primitive type
|
|
58
|
+
* @param str
|
|
59
|
+
*/
|
|
60
|
+
function isPrimitive(str: string) {
|
|
61
|
+
switch (str) {
|
|
62
|
+
case "signer":
|
|
63
|
+
case "address":
|
|
64
|
+
case "bool":
|
|
65
|
+
case "u8":
|
|
66
|
+
case "u16":
|
|
67
|
+
case "u32":
|
|
68
|
+
case "u64":
|
|
69
|
+
case "u128":
|
|
70
|
+
case "u256":
|
|
71
|
+
return true;
|
|
72
|
+
default:
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Consumes all whitespace in a string, similar to trim
|
|
79
|
+
* @param tagStr
|
|
80
|
+
* @param pos
|
|
81
|
+
*/
|
|
36
82
|
function consumeWhitespace(tagStr: string, pos: number) {
|
|
37
83
|
let i = pos;
|
|
38
84
|
for (; i < tagStr.length; i += 1) {
|
|
@@ -46,6 +92,9 @@ function consumeWhitespace(tagStr: string, pos: number) {
|
|
|
46
92
|
return i;
|
|
47
93
|
}
|
|
48
94
|
|
|
95
|
+
/**
|
|
96
|
+
* State for TypeTag parsing. This is pushed onto a stack to keep track of what is the current state
|
|
97
|
+
*/
|
|
49
98
|
type TypeTagState = {
|
|
50
99
|
savedExpectedTypes: number;
|
|
51
100
|
savedStr: string;
|
|
@@ -60,11 +109,13 @@ export enum TypeTagParserErrorType {
|
|
|
60
109
|
UnexpectedComma = "unexpected ','",
|
|
61
110
|
TypeArgumentCountMismatch = "type argument count doesn't match expected amount",
|
|
62
111
|
MissingTypeArgumentClose = "no matching '>' for '<'",
|
|
112
|
+
MissingTypeArgument = "no type argument before ','",
|
|
63
113
|
UnexpectedPrimitiveTypeArguments = "primitive types not expected to have type arguments",
|
|
64
114
|
UnexpectedVectorTypeArgumentCount = "vector type expected to have exactly one type argument",
|
|
65
115
|
UnexpectedStructFormat = "unexpected struct format, must be of the form 0xaddress::module_name::struct_name",
|
|
66
116
|
InvalidModuleNameCharacter = "module name must only contain alphanumeric or '_' characters",
|
|
67
117
|
InvalidStructNameCharacter = "struct name must only contain alphanumeric or '_' characters",
|
|
118
|
+
InvalidAddress = "struct address must be valid",
|
|
68
119
|
}
|
|
69
120
|
|
|
70
121
|
export class TypeTagParserError extends Error {
|
|
@@ -141,16 +192,24 @@ export function parseTypeTag(typeStr: string, options?: { allowGenerics?: boolea
|
|
|
141
192
|
expectedTypes = savedExpectedTypes;
|
|
142
193
|
} else if (char === ",") {
|
|
143
194
|
// Comma means we need to start parsing a new tag, push the previous one to the curTypes
|
|
144
|
-
// Process last type, if there is no type string, then don't parse it
|
|
145
|
-
if (currentStr.length !== 0) {
|
|
146
|
-
const newType = parseTypeTagInner(currentStr, innerTypes, allowGenerics);
|
|
147
195
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
196
|
+
// No top level commas (not in a type <> are allowed)
|
|
197
|
+
if (saved.length === 0) {
|
|
198
|
+
throw new TypeTagParserError(typeStr, TypeTagParserErrorType.UnexpectedComma);
|
|
199
|
+
}
|
|
200
|
+
// If there was no actual value before the comma, then it's missing a type argument
|
|
201
|
+
if (currentStr.length === 0) {
|
|
202
|
+
throw new TypeTagParserError(typeStr, TypeTagParserErrorType.MissingTypeArgument);
|
|
153
203
|
}
|
|
204
|
+
|
|
205
|
+
// Process characters before as a type
|
|
206
|
+
const newType = parseTypeTagInner(currentStr, innerTypes, allowGenerics);
|
|
207
|
+
|
|
208
|
+
// parse type tag and push it on the types
|
|
209
|
+
innerTypes = [];
|
|
210
|
+
curTypes.push(newType);
|
|
211
|
+
currentStr = "";
|
|
212
|
+
expectedTypes += 1;
|
|
154
213
|
} else if (isValidWhitespaceCharacter(char)) {
|
|
155
214
|
// This means we should save what we have and everything else should skip until the next
|
|
156
215
|
let parsedTypeTag = false;
|
|
@@ -207,59 +266,35 @@ export function parseTypeTag(typeStr: string, options?: { allowGenerics?: boolea
|
|
|
207
266
|
* Parses a type tag with internal types associated
|
|
208
267
|
* @param str
|
|
209
268
|
* @param types
|
|
269
|
+
* @param allowGenerics allow generic in parsing of the type tag
|
|
210
270
|
*/
|
|
211
271
|
function parseTypeTagInner(str: string, types: Array<TypeTag>, allowGenerics: boolean): TypeTag {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
272
|
+
const trimmedStr = str.trim();
|
|
273
|
+
const lowerCaseTrimmed = trimmedStr.toLowerCase();
|
|
274
|
+
if (isPrimitive(lowerCaseTrimmed)) {
|
|
275
|
+
if (types.length > 0) {
|
|
276
|
+
throw new TypeTagParserError(str, TypeTagParserErrorType.UnexpectedPrimitiveTypeArguments);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
switch (trimmedStr.toLowerCase()) {
|
|
219
281
|
case "signer":
|
|
220
|
-
if (types.length > 0) {
|
|
221
|
-
throw new TypeTagParserError(str, TypeTagParserErrorType.UnexpectedPrimitiveTypeArguments);
|
|
222
|
-
}
|
|
223
282
|
return new TypeTagSigner();
|
|
224
283
|
case "bool":
|
|
225
|
-
if (types.length > 0) {
|
|
226
|
-
throw new TypeTagParserError(str, TypeTagParserErrorType.UnexpectedPrimitiveTypeArguments);
|
|
227
|
-
}
|
|
228
284
|
return new TypeTagBool();
|
|
229
285
|
case "address":
|
|
230
|
-
if (types.length > 0) {
|
|
231
|
-
throw new TypeTagParserError(str, TypeTagParserErrorType.UnexpectedPrimitiveTypeArguments);
|
|
232
|
-
}
|
|
233
286
|
return new TypeTagAddress();
|
|
234
287
|
case "u8":
|
|
235
|
-
if (types.length > 0) {
|
|
236
|
-
throw new TypeTagParserError(str, TypeTagParserErrorType.UnexpectedPrimitiveTypeArguments);
|
|
237
|
-
}
|
|
238
288
|
return new TypeTagU8();
|
|
239
289
|
case "u16":
|
|
240
|
-
if (types.length > 0) {
|
|
241
|
-
throw new TypeTagParserError(str, TypeTagParserErrorType.UnexpectedPrimitiveTypeArguments);
|
|
242
|
-
}
|
|
243
290
|
return new TypeTagU16();
|
|
244
291
|
case "u32":
|
|
245
|
-
if (types.length > 0) {
|
|
246
|
-
throw new TypeTagParserError(str, TypeTagParserErrorType.UnexpectedPrimitiveTypeArguments);
|
|
247
|
-
}
|
|
248
292
|
return new TypeTagU32();
|
|
249
293
|
case "u64":
|
|
250
|
-
if (types.length > 0) {
|
|
251
|
-
throw new TypeTagParserError(str, TypeTagParserErrorType.UnexpectedPrimitiveTypeArguments);
|
|
252
|
-
}
|
|
253
294
|
return new TypeTagU64();
|
|
254
295
|
case "u128":
|
|
255
|
-
if (types.length > 0) {
|
|
256
|
-
throw new TypeTagParserError(str, TypeTagParserErrorType.UnexpectedPrimitiveTypeArguments);
|
|
257
|
-
}
|
|
258
296
|
return new TypeTagU128();
|
|
259
297
|
case "u256":
|
|
260
|
-
if (types.length > 0) {
|
|
261
|
-
throw new TypeTagParserError(str, TypeTagParserErrorType.UnexpectedPrimitiveTypeArguments);
|
|
262
|
-
}
|
|
263
298
|
return new TypeTagU256();
|
|
264
299
|
case "vector":
|
|
265
300
|
if (types.length !== 1) {
|
|
@@ -267,25 +302,41 @@ function parseTypeTagInner(str: string, types: Array<TypeTag>, allowGenerics: bo
|
|
|
267
302
|
}
|
|
268
303
|
return new TypeTagVector(types[0]);
|
|
269
304
|
default:
|
|
270
|
-
|
|
305
|
+
// Reference will have to handle the inner type
|
|
306
|
+
if (isRef(trimmedStr)) {
|
|
307
|
+
const actualType = trimmedStr.substring(1);
|
|
308
|
+
return new TypeTagReference(parseTypeTagInner(actualType, types, allowGenerics));
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
// Generics are always expected to be T0 or T1
|
|
312
|
+
if (isGeneric(trimmedStr)) {
|
|
271
313
|
if (allowGenerics) {
|
|
272
|
-
return new TypeTagGeneric(Number(
|
|
314
|
+
return new TypeTagGeneric(Number(trimmedStr.split("T")[1]));
|
|
273
315
|
}
|
|
274
316
|
throw new TypeTagParserError(str, TypeTagParserErrorType.UnexpectedGenericType);
|
|
275
317
|
}
|
|
276
318
|
|
|
277
319
|
// If the value doesn't contain a colon, then we'll assume it isn't trying to be a struct
|
|
278
|
-
if (!
|
|
320
|
+
if (!trimmedStr.match(/:/)) {
|
|
279
321
|
throw new TypeTagParserError(str, TypeTagParserErrorType.InvalidTypeTag);
|
|
280
322
|
}
|
|
281
323
|
|
|
282
324
|
// Parse for a struct tag
|
|
283
325
|
// eslint-disable-next-line no-case-declarations
|
|
284
|
-
const structParts =
|
|
326
|
+
const structParts = trimmedStr.split("::");
|
|
285
327
|
if (structParts.length !== 3) {
|
|
286
328
|
throw new TypeTagParserError(str, TypeTagParserErrorType.UnexpectedStructFormat);
|
|
287
329
|
}
|
|
288
330
|
|
|
331
|
+
// Validate struct address
|
|
332
|
+
// eslint-disable-next-line no-case-declarations
|
|
333
|
+
let address: AccountAddress;
|
|
334
|
+
try {
|
|
335
|
+
address = AccountAddress.fromString(structParts[0]);
|
|
336
|
+
} catch (error: any) {
|
|
337
|
+
throw new TypeTagParserError(str, TypeTagParserErrorType.InvalidAddress);
|
|
338
|
+
}
|
|
339
|
+
|
|
289
340
|
// Validate identifier characters
|
|
290
341
|
if (!isValidIdentifier(structParts[1])) {
|
|
291
342
|
throw new TypeTagParserError(str, TypeTagParserErrorType.InvalidModuleNameCharacter);
|
|
@@ -295,12 +346,7 @@ function parseTypeTagInner(str: string, types: Array<TypeTag>, allowGenerics: bo
|
|
|
295
346
|
}
|
|
296
347
|
|
|
297
348
|
return new TypeTagStruct(
|
|
298
|
-
new StructTag(
|
|
299
|
-
AccountAddress.fromString(structParts[0]),
|
|
300
|
-
new Identifier(structParts[1]),
|
|
301
|
-
new Identifier(structParts[2]),
|
|
302
|
-
types,
|
|
303
|
-
),
|
|
349
|
+
new StructTag(address, new Identifier(structParts[1]), new Identifier(structParts[2]), types),
|
|
304
350
|
);
|
|
305
351
|
}
|
|
306
352
|
}
|
|
@@ -68,6 +68,25 @@ export type ScriptFunctionArgumentTypes =
|
|
|
68
68
|
| MoveString
|
|
69
69
|
| FixedBytes;
|
|
70
70
|
|
|
71
|
+
/**
|
|
72
|
+
* TypeArgument inputs for Entry functions, view functions, and scripts
|
|
73
|
+
*
|
|
74
|
+
* This can be a string version of the type argument such as:
|
|
75
|
+
* - u8
|
|
76
|
+
* - u16
|
|
77
|
+
* - u32
|
|
78
|
+
* - u64
|
|
79
|
+
* - u128
|
|
80
|
+
* - u256
|
|
81
|
+
* - bool
|
|
82
|
+
* - address
|
|
83
|
+
* - signer
|
|
84
|
+
* - vector<Type>
|
|
85
|
+
* - address::module::struct
|
|
86
|
+
* - address::module::struct<Type1, Type2>
|
|
87
|
+
*/
|
|
88
|
+
export type TypeArgument = TypeTag | string;
|
|
89
|
+
|
|
71
90
|
/**
|
|
72
91
|
* Type that holds all raw transaction instances Aptos SDK supports
|
|
73
92
|
*/
|
|
@@ -109,7 +128,7 @@ export type InputGenerateTransactionPayloadDataWithRemoteABI =
|
|
|
109
128
|
*/
|
|
110
129
|
export type InputEntryFunctionData = {
|
|
111
130
|
function: MoveFunctionId;
|
|
112
|
-
typeArguments?: Array<
|
|
131
|
+
typeArguments?: Array<TypeArgument>;
|
|
113
132
|
functionArguments: Array<EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes>;
|
|
114
133
|
abi?: EntryFunctionABI;
|
|
115
134
|
};
|
|
@@ -144,7 +163,7 @@ export type InputMultiSigDataWithRemoteABI = {
|
|
|
144
163
|
*/
|
|
145
164
|
export type InputScriptData = {
|
|
146
165
|
bytecode: HexInput;
|
|
147
|
-
typeArguments?: Array<
|
|
166
|
+
typeArguments?: Array<TypeArgument>;
|
|
148
167
|
functionArguments: Array<ScriptFunctionArgumentTypes>;
|
|
149
168
|
};
|
|
150
169
|
|
|
@@ -153,7 +172,7 @@ export type InputScriptData = {
|
|
|
153
172
|
*/
|
|
154
173
|
export type InputViewFunctionData = {
|
|
155
174
|
function: MoveFunctionId;
|
|
156
|
-
typeArguments?: Array<
|
|
175
|
+
typeArguments?: Array<TypeArgument>;
|
|
157
176
|
functionArguments?: Array<EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes>;
|
|
158
177
|
abi?: ViewFunctionABI;
|
|
159
178
|
};
|
package/src/types/index.ts
CHANGED
|
@@ -108,11 +108,29 @@ export enum AccountAuthenticatorVariant {
|
|
|
108
108
|
export enum AnyPublicKeyVariant {
|
|
109
109
|
Ed25519 = 0,
|
|
110
110
|
Secp256k1 = 1,
|
|
111
|
+
Keyless = 3,
|
|
111
112
|
}
|
|
112
113
|
|
|
113
114
|
export enum AnySignatureVariant {
|
|
114
115
|
Ed25519 = 0,
|
|
115
116
|
Secp256k1 = 1,
|
|
117
|
+
Keyless = 3,
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export enum EphemeralPublicKeyVariant {
|
|
121
|
+
Ed25519 = 0,
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export enum EphemeralSignatureVariant {
|
|
125
|
+
Ed25519 = 0,
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export enum EphemeralCertificateVariant {
|
|
129
|
+
ZkProof = 0,
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export enum ZkpVariant {
|
|
133
|
+
Groth16 = 0,
|
|
116
134
|
}
|
|
117
135
|
|
|
118
136
|
/**
|
|
@@ -140,6 +158,10 @@ export type AptosSettings = {
|
|
|
140
158
|
|
|
141
159
|
readonly indexer?: string;
|
|
142
160
|
|
|
161
|
+
readonly pepper?: string;
|
|
162
|
+
|
|
163
|
+
readonly prover?: string;
|
|
164
|
+
|
|
143
165
|
readonly clientConfig?: ClientConfig;
|
|
144
166
|
|
|
145
167
|
readonly client?: Client;
|
|
@@ -22,6 +22,20 @@ export const NetworkToFaucetAPI: Record<string, string> = {
|
|
|
22
22
|
local: "http://127.0.0.1:8081",
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
+
export const NetworkToPepperAPI: Record<string, string> = {
|
|
26
|
+
mainnet: "https://api.mainnet.aptoslabs.com/keyless/pepper/v0",
|
|
27
|
+
testnet: "https://api.testnet.aptoslabs.com/keyless/pepper/v0",
|
|
28
|
+
devnet: "https://api.devnet.aptoslabs.com/keyless/pepper/v0",
|
|
29
|
+
local: "http://127.0.0.1:8000/v0",
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const NetworkToProverAPI: Record<string, string> = {
|
|
33
|
+
mainnet: "https://api.mainnet.aptoslabs.com/keyless/prover/v0",
|
|
34
|
+
testnet: "https://api.testnet.aptoslabs.com/keyless/prover/v0",
|
|
35
|
+
devnet: "https://api.devnet.aptoslabs.com/keyless/prover/v0",
|
|
36
|
+
local: "http://127.0.0.1:8083/v0",
|
|
37
|
+
};
|
|
38
|
+
|
|
25
39
|
export enum Network {
|
|
26
40
|
MAINNET = "mainnet",
|
|
27
41
|
TESTNET = "testnet",
|
package/src/utils/const.ts
CHANGED
package/src/utils/helpers.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// Copyright © Aptos Foundation
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
+
import { decode } from "js-base64";
|
|
5
|
+
|
|
4
6
|
/**
|
|
5
7
|
* Sleep the current thread for the given amount of time
|
|
6
8
|
* @param timeMs time in milliseconds to sleep
|
|
@@ -10,3 +12,26 @@ export async function sleep(timeMs: number): Promise<null> {
|
|
|
10
12
|
setTimeout(resolve, timeMs);
|
|
11
13
|
});
|
|
12
14
|
}
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
export function currentTimeInSeconds(): number {
|
|
18
|
+
return Math.floor(new Date().getTime() / 1000);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function floorToWholeHour(timestampInSeconds: number): number {
|
|
22
|
+
const date = new Date(timestampInSeconds * 1000);
|
|
23
|
+
// Reset minutes and seconds to zero
|
|
24
|
+
date.setMinutes(0);
|
|
25
|
+
date.setSeconds(0);
|
|
26
|
+
date.setMilliseconds(0);
|
|
27
|
+
return Math.floor(date.getTime() / 1000);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function base64UrlDecode(base64Url: string): string {
|
|
31
|
+
// Replace base64url-specific characters
|
|
32
|
+
const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/");
|
|
33
|
+
// Pad the string with '=' characters if needed
|
|
34
|
+
const paddedBase64 = base64 + "==".substring(0, (3 - (base64.length % 3)) % 3);
|
|
35
|
+
const decodedString = decode(paddedBase64);
|
|
36
|
+
return decodedString;
|
|
37
|
+
}
|
package/src/version.ts
CHANGED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var i=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var l=(r,n,s,o)=>{for(var e=o>1?void 0:o?m(n,s):n,t=r.length-1,u;t>=0;t--)(u=r[t])&&(e=(o?u(n,s,e):u(e))||e);return o&&e&&i(n,s,e),e};async function p(r){return new Promise(n=>{setTimeout(n,r)})}exports.a = l; exports.b = p;
|
|
2
|
-
//# sourceMappingURL=chunk-KSEUZTKY.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/helpers.ts"],"names":["sleep","timeMs","resolve"],"mappings":"wMAOA,eAAsBA,EAAMC,EAA+B,CACzD,OAAO,IAAI,QAASC,GAAY,CAC9B,WAAWA,EAASD,CAAM,CAC5B,CAAC,CACH","sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * Sleep the current thread for the given amount of time\n * @param timeMs time in milliseconds to sleep\n */\nexport async function sleep(timeMs: number): Promise<null> {\n return new Promise((resolve) => {\n setTimeout(resolve, timeMs);\n });\n}\n"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as d}from"./chunk-GHYE26Q5.mjs";import{a as R}from"./chunk-CJDEPZ4J.mjs";var l={400:"Bad Request",401:"Unauthorized",403:"Forbidden",404:"Not Found",429:"Too Many Requests",500:"Internal Server Error",502:"Bad Gateway",503:"Service Unavailable"};async function c(s,p){let{url:n,method:a,body:i,contentType:u,params:t,overrides:e,originMethod:o}=s,r={...e?.HEADERS,"x-aptos-client":`aptos-typescript-sdk/${R}`,"content-type":u??"application/json","x-aptos-typescript-sdk-origin-method":o};return e?.AUTH_TOKEN&&(r.Authorization=`Bearer ${e?.AUTH_TOKEN}`),e?.API_KEY&&(r.Authorization=`Bearer ${e?.API_KEY}`),p.provider({url:n,method:a,body:i,params:t,headers:r,overrides:e})}async function w(s,p,n){let{url:a,path:i}=s,u=i?`${a}/${i}`:a,t=await c({...s,url:u},p.client),e={status:t.status,statusText:t.statusText,data:t.data,headers:t.headers,config:t.config,request:t.request,url:u};if(e.status===401)throw new d(s,e,`Error: ${e.data}`);if(n==="Indexer"){let r=e.data;if(r.errors)throw new d(s,e,`Indexer error: ${r.errors[0].message}`??`Indexer unhandled Error ${t.status} : ${t.statusText}`);e.data=r.data}if(e.status>=200&&e.status<300)return e;let o;throw e&&e.data&&"message"in e.data&&"error_code"in e.data?o=JSON.stringify(e.data):e.status in l?o=l[e.status]:o=`Unhandled Error ${e.status} : ${e.statusText}`,new d(s,e,`${n} error: ${o}`)}export{c as a,w as b};
|
|
2
|
-
//# sourceMappingURL=chunk-2XK53QFA.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/helpers.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * Sleep the current thread for the given amount of time\n * @param timeMs time in milliseconds to sleep\n */\nexport async function sleep(timeMs: number): Promise<null> {\n return new Promise((resolve) => {\n setTimeout(resolve, timeMs);\n });\n}\n"],"mappings":"AAOA,eAAsBA,EAAMC,EAA+B,CACzD,OAAO,IAAI,QAASC,GAAY,CAC9B,WAAWA,EAASD,CAAM,CAC5B,CAAC,CACH","names":["sleep","timeMs","resolve"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{c as t}from"./chunk-56CNRT2K.mjs";var n=class{constructor(e){this.buffer=new ArrayBuffer(e.length),new Uint8Array(this.buffer).set(e,0),this.offset=0}read(e){if(this.offset+e>this.buffer.byteLength)throw new Error("Reached to the end of buffer");let i=this.buffer.slice(this.offset,this.offset+e);return this.offset+=e,i}deserializeStr(){let e=this.deserializeBytes();return new TextDecoder().decode(e)}deserializeBytes(){let e=this.deserializeUleb128AsU32();return new Uint8Array(this.read(e))}deserializeFixedBytes(e){return new Uint8Array(this.read(e))}deserializeBool(){let e=new Uint8Array(this.read(1))[0];if(e!==1&&e!==0)throw new Error("Invalid boolean value");return e===1}deserializeU8(){return new DataView(this.read(1)).getUint8(0)}deserializeU16(){return new DataView(this.read(2)).getUint16(0,!0)}deserializeU32(){return new DataView(this.read(4)).getUint32(0,!0)}deserializeU64(){let e=this.deserializeU32(),i=this.deserializeU32();return BigInt(BigInt(i)<<BigInt(32)|BigInt(e))}deserializeU128(){let e=this.deserializeU64(),i=this.deserializeU64();return BigInt(i<<BigInt(64)|e)}deserializeU256(){let e=this.deserializeU128(),i=this.deserializeU128();return BigInt(i<<BigInt(128)|e)}deserializeUleb128AsU32(){let e=BigInt(0),i=0;for(;e<t;){let r=this.deserializeU8();if(e|=BigInt(r&127)<<BigInt(i),!(r&128))break;i+=7}if(e>t)throw new Error("Overflow while parsing uleb128-encoded uint32 value");return Number(e)}deserialize(e){return e.deserialize(this)}deserializeVector(e){let i=this.deserializeUleb128AsU32(),r=new Array;for(let s=0;s<i;s+=1)r.push(this.deserialize(e));return r}};export{n as a};
|
|
2
|
-
//# sourceMappingURL=chunk-6IFMQ5AS.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/bcs/deserializer.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/* eslint-disable no-bitwise */\nimport { MAX_U32_NUMBER } from \"./consts\";\nimport { Uint8, Uint16, Uint32, Uint64, Uint128, Uint256 } from \"../types\";\n\n/**\n * This interface exists to define Deserializable<T> inputs for functions that\n * deserialize a byte buffer into a type T.\n * It is not intended to be implemented or extended, because Typescript has no support\n * for static methods in interfaces.\n */\nexport interface Deserializable<T> {\n deserialize(deserializer: Deserializer): T;\n}\n\nexport class Deserializer {\n private buffer: ArrayBuffer;\n\n private offset: number;\n\n constructor(data: Uint8Array) {\n // copies data to prevent outside mutation of buffer.\n this.buffer = new ArrayBuffer(data.length);\n new Uint8Array(this.buffer).set(data, 0);\n this.offset = 0;\n }\n\n private read(length: number): ArrayBuffer {\n if (this.offset + length > this.buffer.byteLength) {\n throw new Error(\"Reached to the end of buffer\");\n }\n\n const bytes = this.buffer.slice(this.offset, this.offset + length);\n this.offset += length;\n return bytes;\n }\n\n /**\n * Deserializes a string. UTF8 string is supported. Reads the string's bytes length \"l\" first,\n * and then reads \"l\" bytes of content. Decodes the byte array into a string.\n *\n * BCS layout for \"string\": string_length | string_content\n * where string_length is a u32 integer encoded as a uleb128 integer, equal to the number of bytes in string_content.\n *\n * @example\n * ```ts\n * const deserializer = new Deserializer(new Uint8Array([8, 49, 50, 51, 52, 97, 98, 99, 100]));\n * assert(deserializer.deserializeStr() === \"1234abcd\");\n * ```\n */\n deserializeStr(): string {\n const value = this.deserializeBytes();\n const textDecoder = new TextDecoder();\n return textDecoder.decode(value);\n }\n\n /**\n * Deserializes an array of bytes.\n *\n * BCS layout for \"bytes\": bytes_length | bytes\n * where bytes_length is a u32 integer encoded as a uleb128 integer, equal to the length of the bytes array.\n */\n deserializeBytes(): Uint8Array {\n const len = this.deserializeUleb128AsU32();\n return new Uint8Array(this.read(len));\n }\n\n /**\n * Deserializes an array of bytes. The number of bytes to read is already known.\n *\n */\n deserializeFixedBytes(len: number): Uint8Array {\n return new Uint8Array(this.read(len));\n }\n\n /**\n * Deserializes a boolean value.\n *\n * BCS layout for \"boolean\": One byte. \"0x01\" for true and \"0x00\" for false.\n */\n deserializeBool(): boolean {\n const bool = new Uint8Array(this.read(1))[0];\n if (bool !== 1 && bool !== 0) {\n throw new Error(\"Invalid boolean value\");\n }\n return bool === 1;\n }\n\n /**\n * Deserializes a uint8 number.\n *\n * BCS layout for \"uint8\": One byte. Binary format in little-endian representation.\n */\n deserializeU8(): Uint8 {\n return new DataView(this.read(1)).getUint8(0);\n }\n\n /**\n * Deserializes a uint16 number.\n *\n * BCS layout for \"uint16\": Two bytes. Binary format in little-endian representation.\n * @example\n * ```ts\n * const deserializer = new Deserializer(new Uint8Array([0x34, 0x12]));\n * assert(deserializer.deserializeU16() === 4660);\n * ```\n */\n deserializeU16(): Uint16 {\n return new DataView(this.read(2)).getUint16(0, true);\n }\n\n /**\n * Deserializes a uint32 number.\n *\n * BCS layout for \"uint32\": Four bytes. Binary format in little-endian representation.\n * @example\n * ```ts\n * const deserializer = new Deserializer(new Uint8Array([0x78, 0x56, 0x34, 0x12]));\n * assert(deserializer.deserializeU32() === 305419896);\n * ```\n */\n deserializeU32(): Uint32 {\n return new DataView(this.read(4)).getUint32(0, true);\n }\n\n /**\n * Deserializes a uint64 number.\n *\n * BCS layout for \"uint64\": Eight bytes. Binary format in little-endian representation.\n * @example\n * ```ts\n * const deserializer = new Deserializer(new Uint8Array([0x00, 0xEF, 0xCD, 0xAB, 0x78, 0x56, 0x34, 0x12]));\n * assert(deserializer.deserializeU64() === 1311768467750121216);\n * ```\n */\n deserializeU64(): Uint64 {\n const low = this.deserializeU32();\n const high = this.deserializeU32();\n\n // combine the two 32-bit values and return (little endian)\n return BigInt((BigInt(high) << BigInt(32)) | BigInt(low));\n }\n\n /**\n * Deserializes a uint128 number.\n *\n * BCS layout for \"uint128\": Sixteen bytes. Binary format in little-endian representation.\n */\n deserializeU128(): Uint128 {\n const low = this.deserializeU64();\n const high = this.deserializeU64();\n\n // combine the two 64-bit values and return (little endian)\n return BigInt((high << BigInt(64)) | low);\n }\n\n /**\n * Deserializes a uint256 number.\n *\n * BCS layout for \"uint256\": Thirty-two bytes. Binary format in little-endian representation.\n */\n deserializeU256(): Uint256 {\n const low = this.deserializeU128();\n const high = this.deserializeU128();\n\n // combine the two 128-bit values and return (little endian)\n return BigInt((high << BigInt(128)) | low);\n }\n\n /**\n * Deserializes a uleb128 encoded uint32 number.\n *\n * BCS use uleb128 encoding in two cases: (1) lengths of variable-length sequences and (2) tags of enum values\n */\n deserializeUleb128AsU32(): Uint32 {\n let value: bigint = BigInt(0);\n let shift = 0;\n\n while (value < MAX_U32_NUMBER) {\n const byte = this.deserializeU8();\n value |= BigInt(byte & 0x7f) << BigInt(shift);\n\n if ((byte & 0x80) === 0) {\n break;\n }\n shift += 7;\n }\n\n if (value > MAX_U32_NUMBER) {\n throw new Error(\"Overflow while parsing uleb128-encoded uint32 value\");\n }\n\n return Number(value);\n }\n\n /**\n * Helper function that primarily exists to support alternative syntax for deserialization.\n * That is, if we have a `const deserializer: new Deserializer(...)`, instead of having to use\n * `MyClass.deserialize(deserializer)`, we can call `deserializer.deserialize(MyClass)`.\n *\n * @example const deserializer = new Deserializer(new Uint8Array([1, 2, 3]));\n * const value = deserializer.deserialize(MyClass); // where MyClass has a `deserialize` function\n * // value is now an instance of MyClass\n * // equivalent to `const value = MyClass.deserialize(deserializer)`\n * @param cls The BCS-deserializable class to deserialize the buffered bytes into.\n *\n * @returns the deserialized value of class type T\n */\n deserialize<T>(cls: Deserializable<T>): T {\n // NOTE: `deserialize` in `cls.deserialize(this)` here is a static method defined in `cls`,\n // It is separate from the `deserialize` instance method defined here in Deserializer.\n return cls.deserialize(this);\n }\n\n /**\n * Deserializes an array of BCS Deserializable values given an existing Deserializer\n * instance with a loaded byte buffer.\n *\n * @param cls The BCS-deserializable class to deserialize the buffered bytes into.\n * @example\n * // serialize a vector of addresses\n * const addresses = new Array<AccountAddress>(\n * AccountAddress.from(\"0x1\"),\n * AccountAddress.from(\"0x2\"),\n * AccountAddress.from(\"0xa\"),\n * AccountAddress.from(\"0xb\"),\n * );\n * const serializer = new Serializer();\n * serializer.serializeVector(addresses);\n * const serializedBytes = serializer.toUint8Array();\n *\n * // deserialize the bytes into an array of addresses\n * const deserializer = new Deserializer(serializedBytes);\n * const deserializedAddresses = deserializer.deserializeVector(AccountAddress);\n * // deserializedAddresses is now an array of AccountAddress instances\n * @returns an array of deserialized values of type T\n */\n deserializeVector<T>(cls: Deserializable<T>): Array<T> {\n const length = this.deserializeUleb128AsU32();\n const vector = new Array<T>();\n for (let i = 0; i < length; i += 1) {\n vector.push(this.deserialize(cls));\n }\n return vector;\n }\n}\n"],"mappings":"yCAiBO,IAAMA,EAAN,KAAmB,CAKxB,YAAYC,EAAkB,CAE5B,KAAK,OAAS,IAAI,YAAYA,EAAK,MAAM,EACzC,IAAI,WAAW,KAAK,MAAM,EAAE,IAAIA,EAAM,CAAC,EACvC,KAAK,OAAS,CAChB,CAEQ,KAAKC,EAA6B,CACxC,GAAI,KAAK,OAASA,EAAS,KAAK,OAAO,WACrC,MAAM,IAAI,MAAM,8BAA8B,EAGhD,IAAMC,EAAQ,KAAK,OAAO,MAAM,KAAK,OAAQ,KAAK,OAASD,CAAM,EACjE,YAAK,QAAUA,EACRC,CACT,CAeA,gBAAyB,CACvB,IAAMC,EAAQ,KAAK,iBAAiB,EAEpC,OADoB,IAAI,YAAY,EACjB,OAAOA,CAAK,CACjC,CAQA,kBAA+B,CAC7B,IAAMC,EAAM,KAAK,wBAAwB,EACzC,OAAO,IAAI,WAAW,KAAK,KAAKA,CAAG,CAAC,CACtC,CAMA,sBAAsBA,EAAyB,CAC7C,OAAO,IAAI,WAAW,KAAK,KAAKA,CAAG,CAAC,CACtC,CAOA,iBAA2B,CACzB,IAAMC,EAAO,IAAI,WAAW,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC,EAC3C,GAAIA,IAAS,GAAKA,IAAS,EACzB,MAAM,IAAI,MAAM,uBAAuB,EAEzC,OAAOA,IAAS,CAClB,CAOA,eAAuB,CACrB,OAAO,IAAI,SAAS,KAAK,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,CAC9C,CAYA,gBAAyB,CACvB,OAAO,IAAI,SAAS,KAAK,KAAK,CAAC,CAAC,EAAE,UAAU,EAAG,EAAI,CACrD,CAYA,gBAAyB,CACvB,OAAO,IAAI,SAAS,KAAK,KAAK,CAAC,CAAC,EAAE,UAAU,EAAG,EAAI,CACrD,CAYA,gBAAyB,CACvB,IAAMC,EAAM,KAAK,eAAe,EAC1BC,EAAO,KAAK,eAAe,EAGjC,OAAO,OAAQ,OAAOA,CAAI,GAAK,OAAO,EAAE,EAAK,OAAOD,CAAG,CAAC,CAC1D,CAOA,iBAA2B,CACzB,IAAMA,EAAM,KAAK,eAAe,EAC1BC,EAAO,KAAK,eAAe,EAGjC,OAAO,OAAQA,GAAQ,OAAO,EAAE,EAAKD,CAAG,CAC1C,CAOA,iBAA2B,CACzB,IAAMA,EAAM,KAAK,gBAAgB,EAC3BC,EAAO,KAAK,gBAAgB,EAGlC,OAAO,OAAQA,GAAQ,OAAO,GAAG,EAAKD,CAAG,CAC3C,CAOA,yBAAkC,CAChC,IAAIH,EAAgB,OAAO,CAAC,EACxBK,EAAQ,EAEZ,KAAOL,EAAQM,GAAgB,CAC7B,IAAMC,EAAO,KAAK,cAAc,EAGhC,GAFAP,GAAS,OAAOO,EAAO,GAAI,GAAK,OAAOF,CAAK,EAEvC,EAAAE,EAAO,KACV,MAEFF,GAAS,CACX,CAEA,GAAIL,EAAQM,EACV,MAAM,IAAI,MAAM,qDAAqD,EAGvE,OAAO,OAAON,CAAK,CACrB,CAeA,YAAeQ,EAA2B,CAGxC,OAAOA,EAAI,YAAY,IAAI,CAC7B,CAyBA,kBAAqBA,EAAkC,CACrD,IAAMV,EAAS,KAAK,wBAAwB,EACtCW,EAAS,IAAI,MACnB,QAASC,EAAI,EAAGA,EAAIZ,EAAQY,GAAK,EAC/BD,EAAO,KAAK,KAAK,YAAYD,CAAG,CAAC,EAEnC,OAAOC,CACT,CACF","names":["Deserializer","data","length","bytes","value","len","bool","low","high","shift","MAX_U32_NUMBER","byte","cls","vector","i"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as i}from"./chunk-C4RK5AB6.mjs";import{a as b,b as g}from"./chunk-2O5VFH5O.mjs";import{a as h,c as p}from"./chunk-SGTNW5YI.mjs";import{b as a}from"./chunk-QRS4DGP3.mjs";import{a as y}from"./chunk-36QXVFR5.mjs";var n=class extends y{static deserialize(e){let r=e.deserializeUleb128AsU32();switch(r){case 0:return o.load(e);case 1:return d.load(e);case 2:return u.load(e);case 3:return l.load(e);case 4:return A.load(e);default:throw new Error(`Unknown variant index for TransactionAuthenticator: ${r}`)}}},o=class s extends n{constructor(e,r){super(),this.public_key=e,this.signature=r}serialize(e){e.serializeU32AsUleb128(0),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let r=h.deserialize(e),t=p.deserialize(e);return new s(r,t)}},d=class s extends n{constructor(e,r){super(),this.public_key=e,this.signature=r}serialize(e){e.serializeU32AsUleb128(1),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let r=b.deserialize(e),t=g.deserialize(e);return new s(r,t)}},u=class s extends n{constructor(e,r,t){super(),this.sender=e,this.secondary_signer_addresses=r,this.secondary_signers=t}serialize(e){e.serializeU32AsUleb128(2),this.sender.serialize(e),e.serializeVector(this.secondary_signer_addresses),e.serializeVector(this.secondary_signers)}static load(e){let r=i.deserialize(e),t=e.deserializeVector(a),c=e.deserializeVector(i);return new s(r,t,c)}},l=class s extends n{constructor(e,r,t,c){super(),this.sender=e,this.secondary_signer_addresses=r,this.secondary_signers=t,this.fee_payer=c}serialize(e){e.serializeU32AsUleb128(3),this.sender.serialize(e),e.serializeVector(this.secondary_signer_addresses),e.serializeVector(this.secondary_signers),this.fee_payer.address.serialize(e),this.fee_payer.authenticator.serialize(e)}static load(e){let r=i.deserialize(e),t=e.deserializeVector(a),c=e.deserializeVector(i),_=a.deserialize(e),z=i.deserialize(e),S={address:_,authenticator:z};return new s(r,t,c,S)}},A=class s extends n{constructor(e){super(),this.sender=e}serialize(e){e.serializeU32AsUleb128(4),this.sender.serialize(e)}static load(e){let r=i.deserialize(e);return new s(r)}};export{n as a,o as b,d as c,u as d,l as e,A as f};
|
|
2
|
-
//# sourceMappingURL=chunk-6QJOCI5Y.mjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as m}from"./chunk-U3YYSIIT.mjs";import{a as g}from"./chunk-35EWRSDK.mjs";import{a as p}from"./chunk-B7X6PSE7.mjs";import{b as y}from"./chunk-QRS4DGP3.mjs";import{a as v}from"./chunk-G56GPLTB.mjs";import{a as F,b as d,c as T,d as x,e as E,f as _,g as w}from"./chunk-SRDIYE3M.mjs";import{a as S}from"./chunk-N3U47Y6Y.mjs";import{a as u}from"./chunk-36QXVFR5.mjs";function D(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return d.deserialize(t);case 1:return E.deserialize(t);case 2:return _.deserialize(t);case 3:return y.deserialize(t);case 4:return v.deserialize(t,d);case 5:return F.deserialize(t);case 6:return T.deserialize(t);case 7:return x.deserialize(t);case 8:return w.deserialize(t);default:throw new Error(`Unknown variant index for ScriptTransactionArgument: ${e}`)}}var a=class extends u{static deserialize(e){let r=e.deserializeUleb128AsU32();switch(r){case 0:return A.load(e);case 2:return z.load(e);case 3:return h.load(e);default:throw new Error(`Unknown variant index for TransactionPayload: ${r}`)}}},A=class t extends a{constructor(e){super(),this.script=e}serialize(e){e.serializeU32AsUleb128(0),this.script.serialize(e)}static load(e){let r=U.deserialize(e);return new t(r)}},z=class t extends a{constructor(e){super(),this.entryFunction=e}serialize(e){e.serializeU32AsUleb128(2),this.entryFunction.serialize(e)}static load(e){let r=l.deserialize(e);return new t(r)}},h=class t extends a{constructor(e){super(),this.multiSig=e}serialize(e){e.serializeU32AsUleb128(3),this.multiSig.serialize(e)}static load(e){let r=f.deserialize(e);return new t(r)}},l=class t{constructor(e,r,i,n){this.module_name=e,this.function_name=r,this.type_args=i,this.args=n}static build(e,r,i,n){return new t(g.fromStr(e),new p(r),i,n)}serialize(e){this.module_name.serialize(e),this.function_name.serialize(e),e.serializeVector(this.type_args),e.serializeU32AsUleb128(this.args.length),this.args.forEach(r=>{r.serializeForEntryFunction(e)})}static deserialize(e){let r=g.deserialize(e),i=p.deserialize(e),n=e.deserializeVector(m),o=e.deserializeUleb128AsU32(),s=new Array;for(let c=0;c<o;c+=1){let M=e.deserializeUleb128AsU32(),B=S.deserialize(e,M);s.push(B)}return new t(r,i,n,s)}},U=class t{constructor(e,r,i){this.bytecode=e,this.type_args=r,this.args=i}serialize(e){e.serializeBytes(this.bytecode),e.serializeVector(this.type_args),e.serializeU32AsUleb128(this.args.length),this.args.forEach(r=>{r.serializeForScriptFunction(e)})}static deserialize(e){let r=e.deserializeBytes(),i=e.deserializeVector(m),n=e.deserializeUleb128AsU32(),o=new Array;for(let s=0;s<n;s+=1){let c=D(e);o.push(c)}return new t(r,i,o)}},f=class t{constructor(e,r){this.multisig_address=e,this.transaction_payload=r}serialize(e){this.multisig_address.serialize(e),this.transaction_payload===void 0?e.serializeBool(!1):(e.serializeBool(!0),this.transaction_payload.serialize(e))}static deserialize(e){let r=y.deserialize(e),i=e.deserializeBool(),n;return i&&(n=b.deserialize(e)),new t(r,n)}},b=class t extends u{constructor(e){super(),this.transaction_payload=e}serialize(e){e.serializeU32AsUleb128(0),this.transaction_payload.serialize(e)}static deserialize(e){return e.deserializeUleb128AsU32(),new t(l.deserialize(e))}};export{D as a,a as b,A as c,z as d,h as e,l as f,U as g,f as h,b as i};
|
|
2
|
-
//# sourceMappingURL=chunk-7VRZLDIJ.mjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{b as h}from"./chunk-7VRZLDIJ.mjs";import{a as y}from"./chunk-PF57EOJY.mjs";import{b as n}from"./chunk-QRS4DGP3.mjs";import{a as _}from"./chunk-36QXVFR5.mjs";var t=class i extends _{constructor(e,s,a,r,c,d,l){super(),this.sender=e,this.sequence_number=s,this.payload=a,this.max_gas_amount=r,this.gas_unit_price=c,this.expiration_timestamp_secs=d,this.chain_id=l}serialize(e){this.sender.serialize(e),e.serializeU64(this.sequence_number),this.payload.serialize(e),e.serializeU64(this.max_gas_amount),e.serializeU64(this.gas_unit_price),e.serializeU64(this.expiration_timestamp_secs),this.chain_id.serialize(e)}static deserialize(e){let s=n.deserialize(e),a=e.deserializeU64(),r=h.deserialize(e),c=e.deserializeU64(),d=e.deserializeU64(),l=e.deserializeU64(),m=y.deserialize(e);return new i(s,a,r,c,d,l,m)}},o=class extends _{static deserialize(e){let s=e.deserializeUleb128AsU32();switch(s){case 0:return u.load(e);case 1:return p.load(e);default:throw new Error(`Unknown variant index for RawTransactionWithData: ${s}`)}}},u=class i extends o{constructor(e,s){super(),this.raw_txn=e,this.secondary_signer_addresses=s}serialize(e){e.serializeU32AsUleb128(0),this.raw_txn.serialize(e),e.serializeVector(this.secondary_signer_addresses)}static load(e){let s=t.deserialize(e),a=e.deserializeVector(n);return new i(s,a)}},p=class i extends o{constructor(e,s,a){super(),this.raw_txn=e,this.secondary_signer_addresses=s,this.fee_payer_address=a}serialize(e){e.serializeU32AsUleb128(1),this.raw_txn.serialize(e),e.serializeVector(this.secondary_signer_addresses),this.fee_payer_address.serialize(e)}static load(e){let s=t.deserialize(e),a=e.deserializeVector(n),r=n.deserialize(e);return new i(s,a,r)}};export{t as a,o as b,u as c,p as d};
|
|
2
|
-
//# sourceMappingURL=chunk-BO2TLWNT.mjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{c as A}from"./chunk-MJPUASSD.mjs";import{a as x,b as c,c as w,d as g,e as M,f as C,g as O,h,i as _,k as V,l as G,m as j,n as k,o as z,p as D,r as i,s as L}from"./chunk-UPSCPEEE.mjs";import{c as I}from"./chunk-BZCARW2P.mjs";import{n as p}from"./chunk-U3YYSIIT.mjs";import{b as U}from"./chunk-QRS4DGP3.mjs";import{a as o,b as S,c as T}from"./chunk-G56GPLTB.mjs";import{a as d,b as E,c as B,d as v,e as $,f as b,g as F}from"./chunk-SRDIYE3M.mjs";var R=new TextEncoder;function Z(n){return n?.map(e=>c(e)?A(e):e)??[]}async function P(n,e,t,u){let r=await I({aptosConfig:u,accountAddress:n,moduleName:e});if(r.abi)return r.abi.exposed_functions.find(f=>f.name===t)}async function N(n,e,t,u){let r=await P(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 f=L(r),y=[];for(let s=f;s<r.params.length;s+=1)y.push(A(r.params[s],{allowGenerics:!0}));return{signers:f,typeParameters:r.generic_type_params,parameters:y}}async function a(n,e,t,u){let r=await P(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 f=[];for(let s=0;s<r.params.length;s+=1)f.push(A(r.params[s],{allowGenerics:!0}));let y=[];for(let s=0;s<r.return.length;s+=1)y.push(A(r.return[s],{allowGenerics:!0}));return{typeParameters:r.generic_type_params,parameters:f,returnTypes:y}}function nn(n,e,t,u,r){if(u>=e.parameters.length)throw new Error(`Too many arguments for '${n}', expected ${e.parameters.length}`);let f=e.parameters[u];return l(t,f,u,r)}function l(n,e,t,u){return C(n)?(m(e,n,t),n):X(n,e,t,u)}function X(n,e,t,u){if(e.isBool()){if(x(n))return new d(n);i("boolean",t)}if(e.isAddress()){if(c(n))return U.fromString(n);i("string | AccountAddress",t)}if(e.isU8()){if(w(n))return new E(n);i("number",t)}if(e.isU16()){if(w(n))return new B(n);i("number",t)}if(e.isU32()){if(w(n))return new v(n);i("number",t)}if(e.isU64()){if(g(n))return new $(BigInt(n));i("bigint | number | string",t)}if(e.isU128()){if(g(n))return new b(BigInt(n));i("bigint | number | string",t)}if(e.isU256()){if(g(n))return new F(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 l(n,u[r],t,u)}if(e.isVector()){if(e.value.isU8()){if(c(n))return o.U8(R.encode(n));if(n instanceof Uint8Array)return o.U8(n);if(n instanceof ArrayBuffer)return o.U8(new Uint8Array(n))}if(Array.isArray(n))return new o(n.map(r=>l(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 S(n);i("string",t)}if(e.isObject()){if(c(n))return U.fromString(n);i("string | AccountAddress",t)}if(e.isOption())return M(n)?new T(null):new T(l(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 m(n,e,t){if(n.isBool()){if(O(e))return;i("Bool",t)}if(n.isAddress()){if(h(e))return;i("AccountAddress",t)}if(n.isU8()){if(V(e))return;i("U8",t)}if(n.isU16()){if(G(e))return;i("U16",t)}if(n.isU32()){if(j(e))return;i("U32",t)}if(n.isU64()){if(k(e))return;i("U64",t)}if(n.isU128()){if(z(e))return;i("U128",t)}if(n.isU256()){if(D(e))return;i("U256",t)}if(n.isVector()){if(e instanceof o){e.values.length>0&&m(n.value,e.values[0],t);return}i("MoveVector",t)}if(n instanceof p){if(n.isString()){if(_(e))return;i("MoveString",t)}if(n.isObject()){if(h(e))return;i("AccountAddress",t)}if(n.isOption()){if(e instanceof T){e.value!==void 0&&m(n.value.typeArgs[0],e.value,t);return}i("MoveOption",t)}}throw new Error(`Type mismatch for argument ${t}, expected '${n.toString()}'`)}export{Z as a,P as b,N as c,a as d,nn as e,l as f};
|
|
2
|
-
//# sourceMappingURL=chunk-BVV56I3P.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 { TypeTag, TypeTagStruct } from \"../typeTag\";\nimport { AptosConfig } from \"../../api/aptosConfig\";\nimport {\n EntryFunctionArgumentTypes,\n SimpleEntryFunctionArgumentTypes,\n EntryFunctionABI,\n ViewFunctionABI,\n FunctionABI,\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 isNull,\n isNumber,\n isString,\n throwTypeMismatch,\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 */\nexport function standardizeTypeTags(typeArguments?: Array<TypeTag | string>): Array<TypeTag> {\n return (\n typeArguments?.map((typeArg: string | TypeTag): 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 a function ABI from the on-chain module ABI. It doesn't validate whether it's a view or entry function.\n * @param moduleAddress\n * @param moduleName\n * @param functionName\n * @param aptosConfig\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 module\n *\n * @param moduleAddress\n * @param moduleName\n * @param functionName\n * @param aptosConfig\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 module\n *\n * @param moduleAddress\n * @param moduleName\n * @param functionName\n * @param aptosConfig\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 * @param functionName\n * @param functionAbi\n * @param arg\n * @param position\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\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 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 * @param arg\n * @param param\n * @param position\n * @param genericTypeParams\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 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 if (isNumber(arg)) {\n return new U8(arg);\n }\n throwTypeMismatch(\"number\", position);\n }\n if (param.isU16()) {\n if (isNumber(arg)) {\n return new U16(arg);\n }\n throwTypeMismatch(\"number\", position);\n }\n if (param.isU32()) {\n if (isNumber(arg)) {\n return new U32(arg);\n }\n throwTypeMismatch(\"number\", 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 sub-type\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 // Empty option must be handled specially\n if (isNull(arg)) {\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<U8>(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 an already BCS encoded argument matches the ABI\n * @param param\n * @param arg\n * @param position\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":"kcAqCA,IAAMA,EAAe,IAAI,YAKlB,SAASC,EAAoBC,EAAyD,CAC3F,OACEA,GAAe,IAAKC,GAEdC,EAASD,CAAO,EACXE,EAAaF,CAAO,EAEtBA,CACR,GAAK,CAAC,CAEX,CASA,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,CAUA,eAAsBK,EACpBP,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,IAAIR,CAAa,KAAKC,CAAU,KAAKC,CAAY,4BAA4B,EAI/F,IAAMO,EAAaC,EAAsBF,CAAW,EAC9CG,EAAoB,CAAC,EAC3B,QAASC,EAAIH,EAAYG,EAAIJ,EAAY,OAAO,OAAQI,GAAK,EAC3DD,EAAO,KAAKb,EAAaU,EAAY,OAAOI,CAAC,EAAG,CAAE,cAAe,EAAK,CAAC,CAAC,EAG1E,MAAO,CACL,QAASH,EACT,eAAgBD,EAAY,oBAC5B,WAAYG,CACd,CACF,CAUA,eAAsBE,EACpBb,EACAC,EACAC,EACAC,EAC0B,CAC1B,IAAMK,EAAc,MAAMT,EAAiBC,EAAeC,EAAYC,EAAcC,CAAW,EAG/F,GAAI,CAACK,EACH,MAAM,IAAI,MAAM,yCAAyCR,CAAa,KAAKC,CAAU,KAAKC,CAAY,GAAG,EAI3G,GAAI,CAACM,EAAY,QACf,MAAM,IAAI,MAAM,IAAIR,CAAa,KAAKC,CAAU,KAAKC,CAAY,2BAA2B,EAI9F,IAAMS,EAAoB,CAAC,EAC3B,QAASC,EAAI,EAAGA,EAAIJ,EAAY,OAAO,OAAQI,GAAK,EAClDD,EAAO,KAAKb,EAAaU,EAAY,OAAOI,CAAC,EAAG,CAAE,cAAe,EAAK,CAAC,CAAC,EAI1E,IAAME,EAAyB,CAAC,EAChC,QAASF,EAAI,EAAGA,EAAIJ,EAAY,OAAO,OAAQI,GAAK,EAClDE,EAAY,KAAKhB,EAAaU,EAAY,OAAOI,CAAC,EAAG,CAAE,cAAe,EAAK,CAAC,CAAC,EAG/E,MAAO,CACL,eAAgBJ,EAAY,oBAC5B,WAAYG,EACZ,YAAAG,CACF,CACF,CASO,SAASC,GACdb,EACAM,EACAQ,EACAC,EACAC,EACA,CAEA,GAAID,GAAYT,EAAY,WAAW,OACrC,MAAM,IAAI,MAAM,2BAA2BN,CAAY,eAAeM,EAAY,WAAW,MAAM,EAAE,EAGvG,IAAMW,EAAQX,EAAY,WAAWS,CAAQ,EAC7C,OAAOG,EAAuBJ,EAAKG,EAAOF,EAAUC,CAAiB,CACvE,CAEO,SAASE,EACdJ,EACAG,EACAF,EACAC,EACA,CAEA,OAAIG,EAA+BL,CAAG,GAEpCM,EAAUH,EAAOH,EAAKC,CAAQ,EACvBD,GAIFO,EAASP,EAAKG,EAAOF,EAAUC,CAAiB,CACzD,CASA,SAASK,EACPP,EACAG,EACAF,EACAC,EAC4B,CAC5B,GAAIC,EAAM,OAAO,EAAG,CAClB,GAAIK,EAAOR,CAAG,EACZ,OAAO,IAAIS,EAAKT,CAAG,EAErBU,EAAkB,UAAWT,CAAQ,CACvC,CAEA,GAAIE,EAAM,UAAU,EAAG,CACrB,GAAItB,EAASmB,CAAG,EACd,OAAOW,EAAe,WAAWX,CAAG,EAEtCU,EAAkB,0BAA2BT,CAAQ,CACvD,CACA,GAAIE,EAAM,KAAK,EAAG,CAChB,GAAIS,EAASZ,CAAG,EACd,OAAO,IAAIa,EAAGb,CAAG,EAEnBU,EAAkB,SAAUT,CAAQ,CACtC,CACA,GAAIE,EAAM,MAAM,EAAG,CACjB,GAAIS,EAASZ,CAAG,EACd,OAAO,IAAIc,EAAId,CAAG,EAEpBU,EAAkB,SAAUT,CAAQ,CACtC,CACA,GAAIE,EAAM,MAAM,EAAG,CACjB,GAAIS,EAASZ,CAAG,EACd,OAAO,IAAIe,EAAIf,CAAG,EAEpBU,EAAkB,SAAUT,CAAQ,CACtC,CACA,GAAIE,EAAM,MAAM,EAAG,CACjB,GAAIa,EAAchB,CAAG,EACnB,OAAO,IAAIiB,EAAI,OAAOjB,CAAG,CAAC,EAE5BU,EAAkB,2BAA4BT,CAAQ,CACxD,CACA,GAAIE,EAAM,OAAO,EAAG,CAClB,GAAIa,EAAchB,CAAG,EACnB,OAAO,IAAIkB,EAAK,OAAOlB,CAAG,CAAC,EAE7BU,EAAkB,2BAA4BT,CAAQ,CACxD,CACA,GAAIE,EAAM,OAAO,EAAG,CAClB,GAAIa,EAAchB,CAAG,EACnB,OAAO,IAAImB,EAAK,OAAOnB,CAAG,CAAC,EAE7BU,EAAkB,2BAA4BT,CAAQ,CACxD,CAGA,GAAIE,EAAM,UAAU,EAAG,CACrB,IAAMiB,EAAejB,EAAM,MAC3B,GAAIiB,EAAe,GAAKA,GAAgBlB,EAAkB,OACxD,MAAM,IAAI,MAAM,oBAAoBC,EAAM,SAAS,CAAC,4BAA4BF,CAAQ,EAAE,EAG5F,OAAOG,EAAuBJ,EAAKE,EAAkBkB,CAAY,EAAGnB,EAAUC,CAAiB,CACjG,CAGA,GAAIC,EAAM,SAAS,EAAG,CAEpB,GAAIA,EAAM,MAAM,KAAK,EAAG,CAGtB,GAAItB,EAASmB,CAAG,EACd,OAAOqB,EAAW,GAAG5C,EAAa,OAAOuB,CAAG,CAAC,EAE/C,GAAIA,aAAe,WACjB,OAAOqB,EAAW,GAAGrB,CAAG,EAE1B,GAAIA,aAAe,YACjB,OAAOqB,EAAW,GAAG,IAAI,WAAWrB,CAAG,CAAC,CAE5C,CAIA,GAAI,MAAM,QAAQA,CAAG,EACnB,OAAO,IAAIqB,EAAWrB,EAAI,IAAKsB,GAASlB,EAAuBkB,EAAMnB,EAAM,MAAOF,EAAUC,CAAiB,CAAC,CAAC,EAGjH,MAAM,IAAI,MAAM,8BAA8BD,CAAQ,WAAWE,EAAM,SAAS,CAAC,GAAG,CACtF,CAGA,GAAIA,EAAM,SAAS,EAAG,CACpB,GAAIA,EAAM,SAAS,EAAG,CACpB,GAAItB,EAASmB,CAAG,EACd,OAAO,IAAIuB,EAAWvB,CAAG,EAE3BU,EAAkB,SAAUT,CAAQ,CACtC,CACA,GAAIE,EAAM,SAAS,EAAG,CAEpB,GAAItB,EAASmB,CAAG,EACd,OAAOW,EAAe,WAAWX,CAAG,EAEtCU,EAAkB,0BAA2BT,CAAQ,CACvD,CAEA,GAAIE,EAAM,SAAS,EAEjB,OAAIqB,EAAOxB,CAAG,EAEL,IAAIyB,EAAe,IAAI,EAGzB,IAAIA,EAAWrB,EAAuBJ,EAAKG,EAAM,MAAM,SAAS,CAAC,EAAGF,EAAUC,CAAiB,CAAC,EAGzG,MAAM,IAAI,MAAM,8CAA8CD,CAAQ,WAAWE,EAAM,SAAS,CAAC,GAAG,CACtG,CAEA,MAAM,IAAI,MAAM,8BAA8BF,CAAQ,WAAWE,EAAM,SAAS,CAAC,GAAG,CACtF,CAQA,SAASG,EAAUH,EAAgBH,EAAiCC,EAAkB,CACpF,GAAIE,EAAM,OAAO,EAAG,CAClB,GAAIuB,EAAU1B,CAAG,EACf,OAEFU,EAAkB,OAAQT,CAAQ,CACpC,CACA,GAAIE,EAAM,UAAU,EAAG,CACrB,GAAIwB,EAAa3B,CAAG,EAClB,OAEFU,EAAkB,iBAAkBT,CAAQ,CAC9C,CACA,GAAIE,EAAM,KAAK,EAAG,CAChB,GAAIyB,EAAQ5B,CAAG,EACb,OAEFU,EAAkB,KAAMT,CAAQ,CAClC,CACA,GAAIE,EAAM,MAAM,EAAG,CACjB,GAAI0B,EAAS7B,CAAG,EACd,OAEFU,EAAkB,MAAOT,CAAQ,CACnC,CACA,GAAIE,EAAM,MAAM,EAAG,CACjB,GAAI2B,EAAS9B,CAAG,EACd,OAEFU,EAAkB,MAAOT,CAAQ,CACnC,CACA,GAAIE,EAAM,MAAM,EAAG,CACjB,GAAI4B,EAAS/B,CAAG,EACd,OAEFU,EAAkB,MAAOT,CAAQ,CACnC,CACA,GAAIE,EAAM,OAAO,EAAG,CAClB,GAAI6B,EAAUhC,CAAG,EACf,OAEFU,EAAkB,OAAQT,CAAQ,CACpC,CACA,GAAIE,EAAM,OAAO,EAAG,CAClB,GAAI8B,EAAUjC,CAAG,EACf,OAEFU,EAAkB,OAAQT,CAAQ,CACpC,CACA,GAAIE,EAAM,SAAS,EAAG,CACpB,GAAIH,aAAeqB,EAAY,CAGzBrB,EAAI,OAAO,OAAS,GACtBM,EAAUH,EAAM,MAAOH,EAAI,OAAO,CAAC,EAAGC,CAAQ,EAGhD,MACF,CACAS,EAAkB,aAAcT,CAAQ,CAC1C,CAGA,GAAIE,aAAiB+B,EAAe,CAClC,GAAI/B,EAAM,SAAS,EAAG,CACpB,GAAIgC,EAAYnC,CAAG,EACjB,OAEFU,EAAkB,aAAcT,CAAQ,CAC1C,CACA,GAAIE,EAAM,SAAS,EAAG,CACpB,GAAIwB,EAAa3B,CAAG,EAClB,OAEFU,EAAkB,iBAAkBT,CAAQ,CAC9C,CACA,GAAIE,EAAM,SAAS,EAAG,CACpB,GAAIH,aAAeyB,EAAY,CAEzBzB,EAAI,QAAU,QAChBM,EAAUH,EAAM,MAAM,SAAS,CAAC,EAAGH,EAAI,MAAOC,CAAQ,EAExD,MACF,CACAS,EAAkB,aAAcT,CAAQ,CAC1C,CACF,CAEA,MAAM,IAAI,MAAM,8BAA8BA,CAAQ,eAAeE,EAAM,SAAS,CAAC,GAAG,CAC1F","names":["TEXT_ENCODER","standardizeTypeTags","typeArguments","typeArg","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","isNumber","U8","U16","U32","isLargeNumber","U64","U128","U256","genericIndex","MoveVector","item","MoveString","isNull","MoveOption","isBcsBool","isBcsAddress","isBcsU8","isBcsU16","isBcsU32","isBcsU64","isBcsU128","isBcsU256","TypeTagStruct","isBcsString"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as d,b}from"./chunk-2O5VFH5O.mjs";import{a as h,b as z}from"./chunk-EU7EBOVD.mjs";import{a as p,b as g}from"./chunk-JDDYOCHY.mjs";import{a as o,c as y}from"./chunk-SGTNW5YI.mjs";import{a as c}from"./chunk-36QXVFR5.mjs";var r=class extends c{static deserialize(i){let e=i.deserializeUleb128AsU32();switch(e){case 0:return u.load(i);case 1:return l.load(i);case 2:return n.load(i);case 3:return a.load(i);default:throw new Error(`Unknown variant index for AccountAuthenticator: ${e}`)}}isEd25519(){return this instanceof u}isMultiEd25519(){return this instanceof l}isSingleKey(){return this instanceof n}isMultiKey(){return this instanceof a}},u=class t extends r{constructor(i,e){super(),this.public_key=i,this.signature=e}serialize(i){i.serializeU32AsUleb128(0),this.public_key.serialize(i),this.signature.serialize(i)}static load(i){let e=o.deserialize(i),s=y.deserialize(i);return new t(e,s)}},l=class t extends r{constructor(i,e){super(),this.public_key=i,this.signature=e}serialize(i){i.serializeU32AsUleb128(1),this.public_key.serialize(i),this.signature.serialize(i)}static load(i){let e=d.deserialize(i),s=b.deserialize(i);return new t(e,s)}},n=class t extends r{constructor(i,e){super(),this.public_key=i,this.signature=e}serialize(i){i.serializeU32AsUleb128(2),this.public_key.serialize(i),this.signature.serialize(i)}static load(i){let e=p.deserialize(i),s=g.deserialize(i);return new t(e,s)}},a=class t extends r{constructor(i,e){super(),this.public_keys=i,this.signatures=e}serialize(i){i.serializeU32AsUleb128(3),this.public_keys.serialize(i),this.signatures.serialize(i)}static load(i){let e=h.deserialize(i),s=z.deserialize(i);return new t(e,s)}};export{r as a,u as b,l as c,n as d,a as e};
|
|
2
|
-
//# sourceMappingURL=chunk-C4RK5AB6.mjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as i}from"./chunk-BO2TLWNT.mjs";import{a as e}from"./chunk-6QJOCI5Y.mjs";import{a as r}from"./chunk-36QXVFR5.mjs";var n=class o extends r{constructor(t,a){super(),this.raw_txn=t,this.authenticator=a}serialize(t){this.raw_txn.serialize(t),this.authenticator.serialize(t)}static deserialize(t){let a=i.deserialize(t),s=e.deserialize(t);return new o(a,s)}};export{n as a};
|
|
2
|
-
//# sourceMappingURL=chunk-C6HODGUS.mjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as r}from"./chunk-36QXVFR5.mjs";import{b as i}from"./chunk-BCUSI3N6.mjs";var t=class a extends r{constructor(e){super(),this.value=i.fromHexInput(e).toUint8Array()}serialize(e){e.serializeFixedBytes(this.value)}serializeForEntryFunction(e){e.serialize(this)}serializeForScriptFunction(e){e.serialize(this)}static deserialize(e,s){let o=e.deserializeFixedBytes(s);return new a(o)}};export{t as a};
|
|
2
|
-
//# sourceMappingURL=chunk-CEHCDA3G.mjs.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var t=(S=>(S.FULLNODE="Fullnode",S.INDEXER="Indexer",S.FAUCET="Faucet",S))(t||{}),E=2e5,n=20,A=20,R="0x1::aptos_coin::AptosCoin",o="APTOS::RawTransaction",T="APTOS::RawTransactionWithData",O=(_=>(_.ACCOUNT_TRANSACTION_PROCESSOR="account_transactions_processor",_.DEFAULT="default_processor",_.EVENTS_PROCESSOR="events_processor",_.FUNGIBLE_ASSET_PROCESSOR="fungible_asset_processor",_.STAKE_PROCESSOR="stake_processor",_.TOKEN_V2_PROCESSOR="token_v2_processor",_.USER_TRANSACTION_PROCESSOR="user_transaction_processor",_))(O||{});export{t as a,E as b,n as c,A as d,R as e,o as f,T as g,O as h};
|
|
2
|
-
//# sourceMappingURL=chunk-CYNQRMO5.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/const.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * Type of API endpoint for request routing\n */\nexport enum AptosApiType {\n FULLNODE = \"Fullnode\",\n INDEXER = \"Indexer\",\n FAUCET = \"Faucet\",\n}\n\n/**\n * The default max gas amount when none is given.\n *\n * This is the maximum number of gas units that will be used by a transaction before being rejected.\n *\n * Note that max gas amount varies based on the transaction. A larger transaction will go over this\n * default gas amount, and the value will need to be changed for the specific transaction.\n */\nexport const DEFAULT_MAX_GAS_AMOUNT = 200000;\n\n/**\n * The default transaction expiration seconds from now.\n *\n * This time is how long until the blockchain nodes will reject the transaction.\n *\n * Note that the transaction expiration time varies based on network connection and network load. It may need to be\n * increased for the transaction to be processed.\n */\nexport const DEFAULT_TXN_EXP_SEC_FROM_NOW = 20;\n\n/**\n * The default number of seconds to wait for a transaction to be processed.\n *\n * This time is the amount of time that the SDK will wait for a transaction to be processed when waiting for\n * the results of the transaction. It may take longer based on network connection and network load.\n */\nexport const DEFAULT_TXN_TIMEOUT_SEC = 20;\n\n/**\n * The default gas currency for the network.\n */\nexport const APTOS_COIN = \"0x1::aptos_coin::AptosCoin\";\n\nexport const RAW_TRANSACTION_SALT = \"APTOS::RawTransaction\";\nexport const RAW_TRANSACTION_WITH_DATA_SALT = \"APTOS::RawTransactionWithData\";\n\n/**\n * The list of supported Processor types for our indexer api.\n *\n * These can be found from the processor_status table in the indexer database.\n * {@link https://cloud.hasura.io/public/graphiql?endpoint=https://api.mainnet.aptoslabs.com/v1/graphql}\n */\nexport enum ProcessorType {\n ACCOUNT_TRANSACTION_PROCESSOR = \"account_transactions_processor\",\n DEFAULT = \"default_processor\",\n EVENTS_PROCESSOR = \"events_processor\",\n // Fungible asset processor also handles coins\n FUNGIBLE_ASSET_PROCESSOR = \"fungible_asset_processor\",\n STAKE_PROCESSOR = \"stake_processor\",\n // Token V2 processor replaces Token processor (not only for digital assets)\n TOKEN_V2_PROCESSOR = \"token_v2_processor\",\n USER_TRANSACTION_PROCESSOR = \"user_transaction_processor\",\n}\n"],"mappings":"AAMO,IAAKA,OACVA,EAAA,SAAW,WACXA,EAAA,QAAU,UACVA,EAAA,OAAS,SAHCA,OAAA,IAcCC,EAAyB,IAUzBC,EAA+B,GAQ/BC,EAA0B,GAK1BC,EAAa,6BAEbC,EAAuB,wBACvBC,EAAiC,gCAQlCC,OACVA,EAAA,8BAAgC,iCAChCA,EAAA,QAAU,oBACVA,EAAA,iBAAmB,mBAEnBA,EAAA,yBAA2B,2BAC3BA,EAAA,gBAAkB,kBAElBA,EAAA,mBAAqB,qBACrBA,EAAA,2BAA6B,6BATnBA,OAAA","names":["AptosApiType","DEFAULT_MAX_GAS_AMOUNT","DEFAULT_TXN_EXP_SEC_FROM_NOW","DEFAULT_TXN_TIMEOUT_SEC","APTOS_COIN","RAW_TRANSACTION_SALT","RAW_TRANSACTION_WITH_DATA_SALT","ProcessorType"]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as u}from"./chunk-QYJF7C23.mjs";import{a as m}from"./chunk-AJIDUBBG.mjs";import{a as h}from"./chunk-TUMYQZ27.mjs";import{a as A}from"./chunk-RTSWVT2Q.mjs";import{a as r}from"./chunk-JP4W2YJF.mjs";import{a}from"./chunk-DZJ2RMX3.mjs";import{a as c}from"./chunk-GCBRNHAO.mjs";import{a as f}from"./chunk-25HG3O2C.mjs";import{a as g}from"./chunk-UEELI2FS.mjs";import{a as l}from"./chunk-VC4A47VQ.mjs";import{a as s}from"./chunk-CWO2JAUL.mjs";import{a as p}from"./chunk-SSSWFYAX.mjs";var t=class{constructor(i){this.config=new A(i),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 f(this.config),this.fungibleAsset=new g(this.config),this.general=new l(this.config),this.staking=new u(this.config),this.transaction=new h(this.config),this.table=new m(this.config)}};function n(y,i,d){Object.getOwnPropertyNames(i.prototype).forEach(e=>{let o=Object.getOwnPropertyDescriptor(i.prototype,e);o&&(o.value=function(...b){return this[d][e](...b)},Object.defineProperty(y.prototype,e,o))})}n(t,s,"account");n(t,p,"ans");n(t,r,"coin");n(t,a,"digitalAsset");n(t,c,"event");n(t,f,"faucet");n(t,g,"fungibleAsset");n(t,l,"general");n(t,u,"staking");n(t,h,"transaction");n(t,m,"table");export{t as a};
|
|
2
|
-
//# sourceMappingURL=chunk-DCF2OTJS.mjs.map
|