@aptos-labs/ts-sdk 1.16.0 → 1.17.0-zeta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common/{accountAddress-ccLvlUQe.d.ts → accountAddress-jP2Ua0t9.d.ts} +97 -5
- package/dist/common/chunk-BHKSQXUZ.js +2 -0
- package/dist/common/chunk-BHKSQXUZ.js.map +1 -0
- package/dist/common/cli/index.d.ts +1 -1
- package/dist/common/cli/index.js +1 -1
- package/dist/common/index.d.ts +857 -122
- 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 +90 -0
- package/dist/esm/account/EphemeralKeyPair.mjs +2 -0
- package/dist/esm/account/KeylessAccount.d.mts +206 -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 +9 -2
- package/dist/esm/account/index.mjs +1 -1
- package/dist/esm/api/account.d.mts +4 -4
- package/dist/esm/api/account.mjs +1 -1
- package/dist/esm/api/ans.d.mts +4 -4
- 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 +5 -5
- package/dist/esm/api/coin.mjs +1 -1
- package/dist/esm/api/digitalAsset.d.mts +6 -6
- package/dist/esm/api/digitalAsset.mjs +1 -1
- package/dist/esm/api/event.d.mts +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 +3 -3
- package/dist/esm/api/fungibleAsset.mjs +1 -1
- package/dist/esm/api/general.d.mts +3 -3
- 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 +85 -0
- package/dist/esm/api/keyless.mjs +2 -0
- package/dist/esm/api/keyless.mjs.map +1 -0
- package/dist/esm/api/staking.d.mts +2 -2
- package/dist/esm/api/staking.mjs +1 -1
- package/dist/esm/api/table.d.mts +1 -1
- package/dist/esm/api/table.mjs +1 -1
- package/dist/esm/api/transaction.d.mts +3 -3
- package/dist/esm/api/transaction.mjs +1 -1
- package/dist/esm/api/transactionSubmission/build.d.mts +3 -3
- 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 +4 -4
- 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 +3 -3
- package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
- package/dist/esm/api/transactionSubmission/submit.d.mts +3 -3
- package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
- package/dist/esm/api/utils.mjs +1 -1
- package/dist/esm/bcs/deserializer.d.mts +32 -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 +42 -0
- package/dist/esm/bcs/serializer.mjs +1 -1
- package/dist/esm/chunk-2G4IGSGM.mjs +2 -0
- package/dist/esm/{chunk-XHEZAVN3.mjs.map → chunk-2G4IGSGM.mjs.map} +1 -1
- package/dist/esm/{chunk-BCLP2ENK.mjs → chunk-2H24BEJI.mjs} +2 -2
- package/dist/esm/chunk-37FFZSIM.mjs +2 -0
- package/dist/esm/chunk-37FFZSIM.mjs.map +1 -0
- package/dist/esm/{chunk-DO444YYD.mjs → chunk-3AIEYUPP.mjs} +2 -2
- package/dist/esm/chunk-3IFR6T3V.mjs +2 -0
- package/dist/esm/chunk-3IFR6T3V.mjs.map +1 -0
- package/dist/esm/chunk-3RJZNUCQ.mjs +2 -0
- package/dist/esm/chunk-3SACE4I2.mjs +2 -0
- package/dist/esm/{chunk-T2WZWN6W.mjs.map → chunk-3SACE4I2.mjs.map} +1 -1
- package/dist/esm/chunk-472OGHMG.mjs +2 -0
- package/dist/esm/chunk-474YDCFP.mjs +2 -0
- package/dist/esm/chunk-474YDCFP.mjs.map +1 -0
- package/dist/esm/chunk-4BJA3QUQ.mjs +2 -0
- package/dist/esm/{chunk-NYXLPBKE.mjs.map → chunk-4BJA3QUQ.mjs.map} +1 -1
- package/dist/esm/chunk-4CUDBBTC.mjs +2 -0
- package/dist/esm/chunk-4CUDBBTC.mjs.map +1 -0
- package/dist/esm/chunk-4VPCPASN.mjs +2 -0
- package/dist/esm/chunk-4W7T4HRZ.mjs +2 -0
- package/dist/esm/chunk-4W7T4HRZ.mjs.map +1 -0
- package/dist/esm/chunk-54LCK6EN.mjs +2 -0
- package/dist/esm/chunk-54LCK6EN.mjs.map +1 -0
- package/dist/esm/{chunk-DBC2JY65.mjs → chunk-5C5GZJ57.mjs} +2 -2
- package/dist/esm/chunk-5SEAQESO.mjs +2 -0
- package/dist/esm/chunk-5SEAQESO.mjs.map +1 -0
- package/dist/esm/{chunk-HZ3YB6TN.mjs → chunk-5UXARGTJ.mjs} +2 -2
- package/dist/esm/{chunk-I3MG3W4J.mjs → chunk-5X5GQF3E.mjs} +2 -2
- package/dist/esm/{chunk-GHYE26Q5.mjs → chunk-6FBKUTGF.mjs} +2 -2
- package/dist/esm/chunk-7BW2N4IE.mjs +2 -0
- package/dist/esm/{chunk-MEXWNZY6.mjs → chunk-7M6OCGHL.mjs} +2 -2
- package/dist/esm/chunk-7Z6DYLCA.mjs +1 -0
- package/dist/esm/chunk-7Z6DYLCA.mjs.map +1 -0
- 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-VJL6AF64.mjs → chunk-ASK3DESW.mjs} +2 -2
- package/dist/esm/{chunk-JWTZDA6A.mjs → chunk-BO44HPGU.mjs} +2 -2
- package/dist/esm/chunk-CKQ74DYE.mjs +2 -0
- package/dist/esm/chunk-CKQ74DYE.mjs.map +1 -0
- package/dist/esm/chunk-DJPYZIJY.mjs +2 -0
- package/dist/esm/chunk-DJPYZIJY.mjs.map +1 -0
- package/dist/esm/{chunk-JNDRFTEA.mjs → chunk-DPWEHSHH.mjs} +2 -2
- package/dist/esm/{chunk-WNVUG2UF.mjs → chunk-EFMAZTIM.mjs} +2 -2
- package/dist/esm/chunk-EQF5MW2W.mjs +2 -0
- package/dist/esm/chunk-EQF5MW2W.mjs.map +1 -0
- package/dist/esm/{chunk-UF5B4XMN.mjs → chunk-ET4WC6TJ.mjs} +2 -2
- package/dist/esm/{chunk-UEI62FBQ.mjs → chunk-F3ZVWLDH.mjs} +2 -2
- package/dist/esm/{chunk-UEI62FBQ.mjs.map → chunk-F3ZVWLDH.mjs.map} +1 -1
- package/dist/esm/chunk-FBPNHF54.mjs +2 -0
- package/dist/esm/{chunk-YJIRT3GJ.mjs → chunk-FGGRPEQ3.mjs} +2 -2
- package/dist/esm/chunk-FIG65OJD.mjs +2 -0
- package/dist/esm/{chunk-ISIUQQMV.mjs → chunk-FNFQA7NS.mjs} +2 -2
- package/dist/esm/{chunk-XXBMHWNV.mjs → chunk-FR6UGCOX.mjs} +2 -2
- package/dist/esm/chunk-FR6UGCOX.mjs.map +1 -0
- package/dist/esm/chunk-GRHLQDHF.mjs +2 -0
- package/dist/esm/chunk-GSCM444Z.mjs +2 -0
- package/dist/esm/{chunk-QKV2H27T.mjs → chunk-HJAB473N.mjs} +2 -2
- package/dist/esm/chunk-HP6YVTTT.mjs +2 -0
- package/dist/esm/{chunk-LGOZUIGE.mjs.map → chunk-HP6YVTTT.mjs.map} +1 -1
- package/dist/esm/chunk-IBDBKQMF.mjs +2 -0
- package/dist/esm/chunk-IBDBKQMF.mjs.map +1 -0
- package/dist/esm/chunk-IBN7ETCB.mjs +2 -0
- package/dist/esm/{chunk-5NSXEM3O.mjs.map → chunk-IBN7ETCB.mjs.map} +1 -1
- package/dist/esm/chunk-IEVABWIO.mjs +2 -0
- package/dist/esm/chunk-IEVABWIO.mjs.map +1 -0
- package/dist/esm/{chunk-YTJ73ZX3.mjs → chunk-IFAWCHUG.mjs} +2 -2
- package/dist/esm/chunk-IT7YNITU.mjs +2 -0
- package/dist/esm/chunk-IVVWQKCF.mjs +2 -0
- package/dist/esm/chunk-IVVWQKCF.mjs.map +1 -0
- package/dist/esm/{chunk-TZCETTAW.mjs → chunk-IXFYYWAC.mjs} +2 -2
- package/dist/esm/{chunk-FW6TF3O2.mjs → chunk-J7HG6SQO.mjs} +2 -2
- package/dist/esm/{chunk-HMTYASEZ.mjs → chunk-JLXE5JF6.mjs} +2 -2
- package/dist/esm/{chunk-AKJZL3HT.mjs → chunk-KDLQ2V3L.mjs} +2 -2
- package/dist/esm/{chunk-OOH7MH2H.mjs → chunk-KGKEU2WI.mjs} +2 -2
- package/dist/esm/chunk-L5CPAOUM.mjs +2 -0
- package/dist/esm/chunk-L5CPAOUM.mjs.map +1 -0
- package/dist/esm/{chunk-FLUCRNGU.mjs → chunk-L5ZHZWHI.mjs} +2 -2
- package/dist/esm/chunk-M3KFXIQ6.mjs +2 -0
- package/dist/esm/chunk-M3KFXIQ6.mjs.map +1 -0
- package/dist/esm/{chunk-S5AGI7RQ.mjs → chunk-MLX6DFMR.mjs} +2 -2
- package/dist/esm/chunk-MNTLX37G.mjs +2 -0
- package/dist/esm/chunk-MNTLX37G.mjs.map +1 -0
- package/dist/esm/{chunk-RC6B45PP.mjs → chunk-MRUDDEJ3.mjs} +2 -2
- package/dist/esm/chunk-NMD45OTM.mjs +2 -0
- package/dist/esm/chunk-NMD45OTM.mjs.map +1 -0
- package/dist/esm/chunk-NW3WUTTD.mjs +2 -0
- package/dist/esm/{chunk-LVYNEPH4.mjs → chunk-O6QLAP7N.mjs} +2 -2
- package/dist/esm/{chunk-LKVJZTBM.mjs → chunk-OHZHYL3E.mjs} +2 -2
- package/dist/esm/chunk-OHZHYL3E.mjs.map +1 -0
- package/dist/esm/{chunk-QIELBIZW.mjs → chunk-P67NJHS5.mjs} +2 -2
- package/dist/esm/{chunk-TAVPFLW5.mjs → chunk-PBMSO6WI.mjs} +2 -2
- package/dist/esm/chunk-Q6LFIZ3L.mjs +2 -0
- package/dist/esm/chunk-Q6LFIZ3L.mjs.map +1 -0
- package/dist/esm/{chunk-43HKFNUB.mjs → chunk-QFVQSFBZ.mjs} +2 -2
- package/dist/esm/{chunk-YMHX6GC2.mjs → chunk-R5THMTSP.mjs} +2 -2
- package/dist/esm/chunk-SCHZ67F3.mjs +2 -0
- package/dist/esm/chunk-SCHZ67F3.mjs.map +1 -0
- package/dist/esm/{chunk-AR3GW64L.mjs → chunk-SNDFJWYM.mjs} +2 -2
- package/dist/esm/{chunk-JHBMHOSV.mjs → chunk-T5YEMU53.mjs} +2 -2
- package/dist/esm/{chunk-DPWXEJP6.mjs → chunk-TAT3K5M7.mjs} +2 -2
- package/dist/esm/{chunk-LM7CN4LT.mjs → chunk-TCK35M7E.mjs} +2 -2
- package/dist/esm/chunk-TJDC5PWD.mjs +2 -0
- package/dist/esm/{chunk-LF6IQT54.mjs → chunk-TUCCV62K.mjs} +2 -2
- package/dist/esm/{chunk-OLKEU7WZ.mjs → chunk-U2R36WTE.mjs} +2 -2
- package/dist/esm/chunk-U5F4NL24.mjs +2 -0
- package/dist/esm/{chunk-4KMISR2H.mjs → chunk-UMLUOYFK.mjs} +2 -2
- package/dist/esm/{chunk-4KMISR2H.mjs.map → chunk-UMLUOYFK.mjs.map} +1 -1
- package/dist/esm/chunk-VAKWRPVP.mjs +2 -0
- package/dist/esm/chunk-VAKWRPVP.mjs.map +1 -0
- package/dist/esm/chunk-VJFCEX7W.mjs +2 -0
- package/dist/esm/chunk-VJFCEX7W.mjs.map +1 -0
- package/dist/esm/chunk-WA2NTBYY.mjs +2 -0
- package/dist/esm/{chunk-X6BYF2UD.mjs → chunk-WIYDJE6F.mjs} +2 -2
- package/dist/esm/chunk-XBVVP7O2.mjs +2 -0
- package/dist/esm/chunk-XBVVP7O2.mjs.map +1 -0
- package/dist/esm/chunk-XH33BXEY.mjs +2 -0
- package/dist/esm/chunk-XH33BXEY.mjs.map +1 -0
- package/dist/esm/{chunk-CX4BEIQT.mjs → chunk-XVZBWW46.mjs} +2 -2
- package/dist/esm/{chunk-V367QLY3.mjs → chunk-Y4E6NTAS.mjs} +2 -2
- package/dist/esm/{chunk-6SK246YU.mjs → chunk-YA4XTZNZ.mjs} +2 -2
- package/dist/esm/chunk-YD5IB4TH.mjs +2 -0
- package/dist/esm/chunk-YD5IB4TH.mjs.map +1 -0
- package/dist/esm/{chunk-A7J2UMLS.mjs → chunk-YDNOKWV3.mjs} +2 -2
- package/dist/esm/chunk-YE5B2S5L.mjs +2 -0
- package/dist/esm/chunk-YE5B2S5L.mjs.map +1 -0
- package/dist/esm/{chunk-4D42AAH3.mjs → chunk-YRUF6N3U.mjs} +2 -2
- package/dist/esm/chunk-YTQVMLFD.mjs +2 -0
- package/dist/esm/chunk-YTQVMLFD.mjs.map +1 -0
- package/dist/esm/{chunk-ZMXURV35.mjs → chunk-ZIDLP5MI.mjs} +2 -2
- package/dist/esm/{chunk-OO5EJW3B.mjs → chunk-ZMHGGT4E.mjs} +2 -2
- package/dist/esm/{chunk-AWPRGMUP.mjs → chunk-ZV5MKFV7.mjs} +2 -2
- 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 +8 -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 +9 -1
- package/dist/esm/client/post.mjs +1 -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/cryptoHashable.d.mts +21 -0
- package/dist/esm/core/crypto/cryptoHashable.mjs +2 -0
- package/dist/esm/core/crypto/cryptoHashable.mjs.map +1 -0
- 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 +7 -1
- package/dist/esm/core/crypto/index.mjs +1 -1
- package/dist/esm/core/crypto/keyless.d.mts +321 -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 +19 -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 +7 -1
- package/dist/esm/core/index.mjs +1 -1
- package/dist/esm/index.d.mts +15 -7
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/internal/account.d.mts +3 -3
- 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 +4 -4
- 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.d.mts +1 -1
- package/dist/esm/internal/event.mjs +1 -1
- package/dist/esm/internal/faucet.d.mts +3 -3
- package/dist/esm/internal/faucet.mjs +1 -1
- package/dist/esm/internal/fungibleAsset.d.mts +3 -3
- package/dist/esm/internal/fungibleAsset.mjs +1 -1
- package/dist/esm/internal/general.d.mts +2 -16
- package/dist/esm/internal/general.mjs +1 -1
- package/dist/esm/internal/keyless.d.mts +73 -0
- package/dist/esm/internal/keyless.mjs +2 -0
- package/dist/esm/internal/keyless.mjs.map +1 -0
- package/dist/esm/internal/staking.d.mts +2 -2
- package/dist/esm/internal/staking.mjs +1 -1
- package/dist/esm/internal/table.mjs +1 -1
- package/dist/esm/internal/transaction.d.mts +16 -2
- package/dist/esm/internal/transaction.mjs +1 -1
- package/dist/esm/internal/transactionSubmission.d.mts +6 -6
- 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 +2 -2
- 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 +1 -1
- 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 +4 -1
- package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +1 -1
- 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 +21 -5
- package/dist/esm/types/index.mjs +1 -1
- package/dist/esm/types/keyless.d.mts +52 -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 -4
- package/src/account/EphemeralKeyPair.ts +158 -0
- package/src/account/KeylessAccount.ts +360 -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/general.ts +1 -2
- package/src/api/keyless.ts +51 -0
- package/src/bcs/deserializer.ts +46 -0
- package/src/bcs/serializer.ts +58 -0
- package/src/client/core.ts +4 -0
- package/src/client/get.ts +12 -0
- package/src/client/post.ts +18 -0
- package/src/core/crypto/cryptoHashable.ts +16 -0
- package/src/core/crypto/ephemeral.ts +138 -0
- package/src/core/crypto/index.ts +2 -0
- package/src/core/crypto/keyless.ts +679 -0
- package/src/core/crypto/poseidon.ts +144 -0
- package/src/core/crypto/proof.ts +16 -0
- package/src/core/crypto/singleKey.ts +11 -0
- package/src/internal/general.ts +1 -38
- package/src/internal/keyless.ts +121 -0
- package/src/internal/transaction.ts +92 -0
- package/src/internal/transactionSubmission.ts +6 -1
- package/src/transactions/management/accountSequenceNumber.ts +5 -8
- package/src/transactions/transactionBuilder/remoteAbi.ts +3 -2
- package/src/transactions/transactionBuilder/signingMessage.ts +4 -1
- package/src/transactions/transactionBuilder/transactionBuilder.ts +22 -2
- package/src/transactions/typeTag/parser.ts +98 -52
- package/src/transactions/types.ts +22 -3
- package/src/types/index.ts +24 -2
- package/src/types/keyless.ts +42 -0
- package/src/utils/apiEndpoints.ts +16 -0
- package/src/utils/const.ts +2 -0
- package/src/utils/helpers.ts +22 -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-2XVDVF5C.mjs +0 -2
- package/dist/esm/chunk-3JPVQHOR.mjs +0 -2
- package/dist/esm/chunk-3JPVQHOR.mjs.map +0 -1
- package/dist/esm/chunk-43YYG5VO.mjs +0 -2
- package/dist/esm/chunk-43YYG5VO.mjs.map +0 -1
- package/dist/esm/chunk-5NSXEM3O.mjs +0 -2
- package/dist/esm/chunk-5SQAHWDI.mjs +0 -2
- package/dist/esm/chunk-5TTCAW72.mjs +0 -2
- package/dist/esm/chunk-5TTCAW72.mjs.map +0 -1
- package/dist/esm/chunk-6IFMQ5AS.mjs +0 -2
- package/dist/esm/chunk-6IFMQ5AS.mjs.map +0 -1
- package/dist/esm/chunk-6JFZZLRC.mjs +0 -2
- package/dist/esm/chunk-6JFZZLRC.mjs.map +0 -1
- package/dist/esm/chunk-AFTMLXYT.mjs +0 -2
- package/dist/esm/chunk-CCQRMKD2.mjs +0 -2
- package/dist/esm/chunk-CCQRMKD2.mjs.map +0 -1
- package/dist/esm/chunk-CYNQRMO5.mjs +0 -2
- package/dist/esm/chunk-CYNQRMO5.mjs.map +0 -1
- package/dist/esm/chunk-EUUIYMYC.mjs +0 -2
- package/dist/esm/chunk-F7EMGK4M.mjs +0 -2
- package/dist/esm/chunk-F7J7ZW4H.mjs +0 -2
- package/dist/esm/chunk-FNKDXPPQ.mjs +0 -2
- package/dist/esm/chunk-FVN6MJTH.mjs +0 -2
- package/dist/esm/chunk-FVN6MJTH.mjs.map +0 -1
- package/dist/esm/chunk-FWPK5KC2.mjs +0 -2
- package/dist/esm/chunk-FWPK5KC2.mjs.map +0 -1
- package/dist/esm/chunk-HYCGMFC2.mjs +0 -2
- package/dist/esm/chunk-HYCGMFC2.mjs.map +0 -1
- package/dist/esm/chunk-JE7INUQ2.mjs +0 -2
- package/dist/esm/chunk-JE7INUQ2.mjs.map +0 -1
- package/dist/esm/chunk-LG7RJQ57.mjs +0 -2
- package/dist/esm/chunk-LGOZUIGE.mjs +0 -2
- package/dist/esm/chunk-LKVJZTBM.mjs.map +0 -1
- package/dist/esm/chunk-LX53BIRN.mjs +0 -2
- package/dist/esm/chunk-NYXLPBKE.mjs +0 -2
- package/dist/esm/chunk-OIH4KBXW.mjs +0 -2
- package/dist/esm/chunk-OIH4KBXW.mjs.map +0 -1
- package/dist/esm/chunk-OWW6SIDP.mjs +0 -2
- package/dist/esm/chunk-OWW6SIDP.mjs.map +0 -1
- package/dist/esm/chunk-P2CIREOD.mjs +0 -2
- package/dist/esm/chunk-R5NNAF5B.mjs +0 -2
- package/dist/esm/chunk-R5NNAF5B.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-T2WZWN6W.mjs +0 -2
- package/dist/esm/chunk-UO3NZ5AH.mjs +0 -1
- package/dist/esm/chunk-UVSRX4SV.mjs +0 -1
- package/dist/esm/chunk-V3DEJBS6.mjs +0 -2
- package/dist/esm/chunk-V6J6AW5T.mjs +0 -2
- package/dist/esm/chunk-V6J6AW5T.mjs.map +0 -1
- package/dist/esm/chunk-VEB6NALT.mjs +0 -2
- package/dist/esm/chunk-VEB6NALT.mjs.map +0 -1
- package/dist/esm/chunk-WZSVQBPA.mjs +0 -2
- package/dist/esm/chunk-XHEZAVN3.mjs +0 -2
- package/dist/esm/chunk-XXBMHWNV.mjs.map +0 -1
- /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-BCLP2ENK.mjs.map → chunk-2H24BEJI.mjs.map} +0 -0
- /package/dist/esm/{chunk-DO444YYD.mjs.map → chunk-3AIEYUPP.mjs.map} +0 -0
- /package/dist/esm/{chunk-ROXFCLDT.mjs.map → chunk-3RJZNUCQ.mjs.map} +0 -0
- /package/dist/esm/{chunk-LX53BIRN.mjs.map → chunk-472OGHMG.mjs.map} +0 -0
- /package/dist/esm/{chunk-AFTMLXYT.mjs.map → chunk-4VPCPASN.mjs.map} +0 -0
- /package/dist/esm/{chunk-DBC2JY65.mjs.map → chunk-5C5GZJ57.mjs.map} +0 -0
- /package/dist/esm/{chunk-HZ3YB6TN.mjs.map → chunk-5UXARGTJ.mjs.map} +0 -0
- /package/dist/esm/{chunk-I3MG3W4J.mjs.map → chunk-5X5GQF3E.mjs.map} +0 -0
- /package/dist/esm/{chunk-GHYE26Q5.mjs.map → chunk-6FBKUTGF.mjs.map} +0 -0
- /package/dist/esm/{chunk-2XVDVF5C.mjs.map → chunk-7BW2N4IE.mjs.map} +0 -0
- /package/dist/esm/{chunk-MEXWNZY6.mjs.map → chunk-7M6OCGHL.mjs.map} +0 -0
- /package/dist/esm/{chunk-BCUSI3N6.mjs.map → chunk-AOCNYMMX.mjs.map} +0 -0
- /package/dist/esm/{chunk-VJL6AF64.mjs.map → chunk-ASK3DESW.mjs.map} +0 -0
- /package/dist/esm/{chunk-JWTZDA6A.mjs.map → chunk-BO44HPGU.mjs.map} +0 -0
- /package/dist/esm/{chunk-JNDRFTEA.mjs.map → chunk-DPWEHSHH.mjs.map} +0 -0
- /package/dist/esm/{chunk-WNVUG2UF.mjs.map → chunk-EFMAZTIM.mjs.map} +0 -0
- /package/dist/esm/{chunk-UF5B4XMN.mjs.map → chunk-ET4WC6TJ.mjs.map} +0 -0
- /package/dist/esm/{chunk-LG7RJQ57.mjs.map → chunk-FBPNHF54.mjs.map} +0 -0
- /package/dist/esm/{chunk-YJIRT3GJ.mjs.map → chunk-FGGRPEQ3.mjs.map} +0 -0
- /package/dist/esm/{chunk-5SQAHWDI.mjs.map → chunk-FIG65OJD.mjs.map} +0 -0
- /package/dist/esm/{chunk-ISIUQQMV.mjs.map → chunk-FNFQA7NS.mjs.map} +0 -0
- /package/dist/esm/{chunk-FNKDXPPQ.mjs.map → chunk-GRHLQDHF.mjs.map} +0 -0
- /package/dist/esm/{chunk-WZSVQBPA.mjs.map → chunk-GSCM444Z.mjs.map} +0 -0
- /package/dist/esm/{chunk-QKV2H27T.mjs.map → chunk-HJAB473N.mjs.map} +0 -0
- /package/dist/esm/{chunk-YTJ73ZX3.mjs.map → chunk-IFAWCHUG.mjs.map} +0 -0
- /package/dist/esm/{chunk-EUUIYMYC.mjs.map → chunk-IT7YNITU.mjs.map} +0 -0
- /package/dist/esm/{chunk-TZCETTAW.mjs.map → chunk-IXFYYWAC.mjs.map} +0 -0
- /package/dist/esm/{chunk-FW6TF3O2.mjs.map → chunk-J7HG6SQO.mjs.map} +0 -0
- /package/dist/esm/{chunk-HMTYASEZ.mjs.map → chunk-JLXE5JF6.mjs.map} +0 -0
- /package/dist/esm/{chunk-AKJZL3HT.mjs.map → chunk-KDLQ2V3L.mjs.map} +0 -0
- /package/dist/esm/{chunk-OOH7MH2H.mjs.map → chunk-KGKEU2WI.mjs.map} +0 -0
- /package/dist/esm/{chunk-FLUCRNGU.mjs.map → chunk-L5ZHZWHI.mjs.map} +0 -0
- /package/dist/esm/{chunk-S5AGI7RQ.mjs.map → chunk-MLX6DFMR.mjs.map} +0 -0
- /package/dist/esm/{chunk-RC6B45PP.mjs.map → chunk-MRUDDEJ3.mjs.map} +0 -0
- /package/dist/esm/{chunk-P2CIREOD.mjs.map → chunk-NW3WUTTD.mjs.map} +0 -0
- /package/dist/esm/{chunk-LVYNEPH4.mjs.map → chunk-O6QLAP7N.mjs.map} +0 -0
- /package/dist/esm/{chunk-QIELBIZW.mjs.map → chunk-P67NJHS5.mjs.map} +0 -0
- /package/dist/esm/{chunk-TAVPFLW5.mjs.map → chunk-PBMSO6WI.mjs.map} +0 -0
- /package/dist/esm/{chunk-43HKFNUB.mjs.map → chunk-QFVQSFBZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-YMHX6GC2.mjs.map → chunk-R5THMTSP.mjs.map} +0 -0
- /package/dist/esm/{chunk-AR3GW64L.mjs.map → chunk-SNDFJWYM.mjs.map} +0 -0
- /package/dist/esm/{chunk-JHBMHOSV.mjs.map → chunk-T5YEMU53.mjs.map} +0 -0
- /package/dist/esm/{chunk-DPWXEJP6.mjs.map → chunk-TAT3K5M7.mjs.map} +0 -0
- /package/dist/esm/{chunk-LM7CN4LT.mjs.map → chunk-TCK35M7E.mjs.map} +0 -0
- /package/dist/esm/{chunk-F7EMGK4M.mjs.map → chunk-TJDC5PWD.mjs.map} +0 -0
- /package/dist/esm/{chunk-LF6IQT54.mjs.map → chunk-TUCCV62K.mjs.map} +0 -0
- /package/dist/esm/{chunk-OLKEU7WZ.mjs.map → chunk-U2R36WTE.mjs.map} +0 -0
- /package/dist/esm/{chunk-V3DEJBS6.mjs.map → chunk-U5F4NL24.mjs.map} +0 -0
- /package/dist/esm/{chunk-F7J7ZW4H.mjs.map → chunk-WA2NTBYY.mjs.map} +0 -0
- /package/dist/esm/{chunk-X6BYF2UD.mjs.map → chunk-WIYDJE6F.mjs.map} +0 -0
- /package/dist/esm/{chunk-CX4BEIQT.mjs.map → chunk-XVZBWW46.mjs.map} +0 -0
- /package/dist/esm/{chunk-V367QLY3.mjs.map → chunk-Y4E6NTAS.mjs.map} +0 -0
- /package/dist/esm/{chunk-6SK246YU.mjs.map → chunk-YA4XTZNZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-A7J2UMLS.mjs.map → chunk-YDNOKWV3.mjs.map} +0 -0
- /package/dist/esm/{chunk-4D42AAH3.mjs.map → chunk-YRUF6N3U.mjs.map} +0 -0
- /package/dist/esm/{chunk-ZMXURV35.mjs.map → chunk-ZIDLP5MI.mjs.map} +0 -0
- /package/dist/esm/{chunk-OO5EJW3B.mjs.map → chunk-ZMHGGT4E.mjs.map} +0 -0
- /package/dist/esm/{chunk-AWPRGMUP.mjs.map → chunk-ZV5MKFV7.mjs.map} +0 -0
- /package/dist/esm/{publicKey-B3XRNhHO.d.mts → publicKey-lq5djCIY.d.mts} +0 -0
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/* eslint-disable no-bitwise */
|
|
2
|
+
import {
|
|
3
|
+
poseidon1,
|
|
4
|
+
poseidon2,
|
|
5
|
+
poseidon3,
|
|
6
|
+
poseidon4,
|
|
7
|
+
poseidon5,
|
|
8
|
+
poseidon6,
|
|
9
|
+
poseidon7,
|
|
10
|
+
poseidon8,
|
|
11
|
+
poseidon9,
|
|
12
|
+
poseidon10,
|
|
13
|
+
poseidon11,
|
|
14
|
+
poseidon12,
|
|
15
|
+
poseidon13,
|
|
16
|
+
poseidon14,
|
|
17
|
+
poseidon15,
|
|
18
|
+
poseidon16,
|
|
19
|
+
} from "poseidon-lite";
|
|
20
|
+
|
|
21
|
+
const numInputsToPoseidonFunc = [
|
|
22
|
+
poseidon1,
|
|
23
|
+
poseidon2,
|
|
24
|
+
poseidon3,
|
|
25
|
+
poseidon4,
|
|
26
|
+
poseidon5,
|
|
27
|
+
poseidon6,
|
|
28
|
+
poseidon7,
|
|
29
|
+
poseidon8,
|
|
30
|
+
poseidon9,
|
|
31
|
+
poseidon10,
|
|
32
|
+
poseidon11,
|
|
33
|
+
poseidon12,
|
|
34
|
+
poseidon13,
|
|
35
|
+
poseidon14,
|
|
36
|
+
poseidon15,
|
|
37
|
+
poseidon16,
|
|
38
|
+
];
|
|
39
|
+
|
|
40
|
+
const BYTES_PACKED_PER_SCALAR = 31;
|
|
41
|
+
const MAX_NUM_INPUT_SCALARS = 16;
|
|
42
|
+
const MAX_NUM_INPUT_BYTES = (MAX_NUM_INPUT_SCALARS - 1) * BYTES_PACKED_PER_SCALAR;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Hashes a string to a field element via poseidon
|
|
46
|
+
*
|
|
47
|
+
* @returns bigint result of the hash
|
|
48
|
+
*/
|
|
49
|
+
export function hashStrToField(str: string, maxSizeBytes: number): bigint {
|
|
50
|
+
const textEncoder = new TextEncoder();
|
|
51
|
+
const strBytes = textEncoder.encode(str);
|
|
52
|
+
return hashBytesWithLen(strBytes, maxSizeBytes);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function hashBytesWithLen(bytes: Uint8Array, maxSizeBytes: number): bigint {
|
|
56
|
+
if (bytes.length > maxSizeBytes) {
|
|
57
|
+
throw new Error(`Inputted bytes of length ${bytes} is longer than ${maxSizeBytes}`);
|
|
58
|
+
}
|
|
59
|
+
const packed = padAndPackBytesWithLen(bytes, maxSizeBytes);
|
|
60
|
+
return poseidonHash(packed);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function padAndPackBytesNoLen(bytes: Uint8Array, maxSizeBytes: number): bigint[] {
|
|
64
|
+
if (bytes.length > maxSizeBytes) {
|
|
65
|
+
throw new Error(`Input bytes of length ${bytes} is longer than ${maxSizeBytes}`);
|
|
66
|
+
}
|
|
67
|
+
const paddedStrBytes = padUint8ArrayWithZeros(bytes, maxSizeBytes);
|
|
68
|
+
return packBytes(paddedStrBytes);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export function padAndPackBytesWithLen(bytes: Uint8Array, maxSizeBytes: number): bigint[] {
|
|
72
|
+
if (bytes.length > maxSizeBytes) {
|
|
73
|
+
throw new Error(`Input bytes of length ${bytes} is longer than ${maxSizeBytes}`);
|
|
74
|
+
}
|
|
75
|
+
return padAndPackBytesNoLen(bytes, maxSizeBytes).concat([BigInt(bytes.length)]);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function packBytes(bytes: Uint8Array): bigint[] {
|
|
79
|
+
if (bytes.length > MAX_NUM_INPUT_BYTES) {
|
|
80
|
+
throw new Error(`Can't pack more than ${MAX_NUM_INPUT_BYTES}. Was given ${bytes.length} bytes`);
|
|
81
|
+
}
|
|
82
|
+
return chunkUint8Array(bytes, BYTES_PACKED_PER_SCALAR).map((chunk) => bytesToBigIntLE(chunk));
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function chunkUint8Array(array: Uint8Array, chunkSize: number): Uint8Array[] {
|
|
86
|
+
const result: Uint8Array[] = [];
|
|
87
|
+
for (let i = 0; i < array.length; i += chunkSize) {
|
|
88
|
+
result.push(array.subarray(i, i + chunkSize));
|
|
89
|
+
}
|
|
90
|
+
return result;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export function bytesToBigIntLE(bytes: Uint8Array): bigint {
|
|
94
|
+
let result = BigInt(0);
|
|
95
|
+
for (let i = bytes.length - 1; i >= 0; i -= 1) {
|
|
96
|
+
result = (result << BigInt(8)) | BigInt(bytes[i]);
|
|
97
|
+
}
|
|
98
|
+
return result;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export function bigIntToBytesLE(value: bigint, length: number): Uint8Array {
|
|
102
|
+
const bytes = new Uint8Array(length);
|
|
103
|
+
for (let i = 0; i < length; i += 1) {
|
|
104
|
+
bytes[i] = Number(value & BigInt(0xff));
|
|
105
|
+
// eslint-disable-next-line no-param-reassign
|
|
106
|
+
value >>= BigInt(8);
|
|
107
|
+
}
|
|
108
|
+
return bytes;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function padUint8ArrayWithZeros(inputArray: Uint8Array, paddedSize: number): Uint8Array {
|
|
112
|
+
if (paddedSize < inputArray.length) {
|
|
113
|
+
throw new Error("Padded size must be greater than or equal to the input array size.");
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// Create a new Uint8Array with the padded size
|
|
117
|
+
const paddedArray = new Uint8Array(paddedSize);
|
|
118
|
+
|
|
119
|
+
// Copy the content of the input array to the new array
|
|
120
|
+
paddedArray.set(inputArray);
|
|
121
|
+
|
|
122
|
+
// Fill the remaining space with zeros
|
|
123
|
+
for (let i = inputArray.length; i < paddedSize; i += 1) {
|
|
124
|
+
paddedArray[i] = 0;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return paddedArray;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Hashes up to 16 scalar elements via the poseidon hashing algorithm.
|
|
132
|
+
*
|
|
133
|
+
* Each element must be scalar fields of the BN254 elliptic curve group.
|
|
134
|
+
*
|
|
135
|
+
* @returns bigint result of the hash
|
|
136
|
+
*/
|
|
137
|
+
export function poseidonHash(inputs: (number | bigint | string)[]): bigint {
|
|
138
|
+
if (inputs.length > numInputsToPoseidonFunc.length) {
|
|
139
|
+
throw new Error(
|
|
140
|
+
`Unable to hash input of length ${inputs.length}. Max input length is ${numInputsToPoseidonFunc.length}`,
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
return numInputsToPoseidonFunc[inputs.length - 1](inputs);
|
|
144
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Serializable } from "../../bcs";
|
|
2
|
+
import { Hex } from "../hex";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* An abstract representation of a crypto proof.
|
|
6
|
+
* associated to a specific zero knowledge proof schemes e.g. Groth16, PLONK
|
|
7
|
+
*/
|
|
8
|
+
export abstract class Proof extends Serializable {
|
|
9
|
+
/**
|
|
10
|
+
* Get the proof as a hex string with a 0x prefix e.g. 0x123456...
|
|
11
|
+
*/
|
|
12
|
+
toString(): string {
|
|
13
|
+
const bytes = this.bcsToBytes();
|
|
14
|
+
return Hex.fromHexInput(bytes).toString();
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -4,6 +4,7 @@ import { AuthenticationKey } from "../authenticationKey";
|
|
|
4
4
|
import { Ed25519PublicKey, Ed25519Signature } from "./ed25519";
|
|
5
5
|
import { AccountPublicKey, PublicKey, VerifySignatureArgs } from "./publicKey";
|
|
6
6
|
import { Secp256k1PublicKey, Secp256k1Signature } from "./secp256k1";
|
|
7
|
+
import { KeylessPublicKey, KeylessSignature } from "./keyless";
|
|
7
8
|
import { Signature } from "./signature";
|
|
8
9
|
|
|
9
10
|
/**
|
|
@@ -34,6 +35,8 @@ export class AnyPublicKey extends AccountPublicKey {
|
|
|
34
35
|
this.variant = AnyPublicKeyVariant.Ed25519;
|
|
35
36
|
} else if (publicKey instanceof Secp256k1PublicKey) {
|
|
36
37
|
this.variant = AnyPublicKeyVariant.Secp256k1;
|
|
38
|
+
} else if (publicKey instanceof KeylessPublicKey) {
|
|
39
|
+
this.variant = AnyPublicKeyVariant.Keyless;
|
|
37
40
|
} else {
|
|
38
41
|
throw new Error("Unsupported public key type");
|
|
39
42
|
}
|
|
@@ -85,6 +88,9 @@ export class AnyPublicKey extends AccountPublicKey {
|
|
|
85
88
|
case AnyPublicKeyVariant.Secp256k1:
|
|
86
89
|
publicKey = Secp256k1PublicKey.deserialize(deserializer);
|
|
87
90
|
break;
|
|
91
|
+
case AnyPublicKeyVariant.Keyless:
|
|
92
|
+
publicKey = KeylessPublicKey.deserialize(deserializer);
|
|
93
|
+
break;
|
|
88
94
|
default:
|
|
89
95
|
throw new Error(`Unknown variant index for AnyPublicKey: ${variantIndex}`);
|
|
90
96
|
}
|
|
@@ -138,6 +144,8 @@ export class AnySignature extends Signature {
|
|
|
138
144
|
this.variant = AnySignatureVariant.Ed25519;
|
|
139
145
|
} else if (signature instanceof Secp256k1Signature) {
|
|
140
146
|
this.variant = AnySignatureVariant.Secp256k1;
|
|
147
|
+
} else if (signature instanceof KeylessSignature) {
|
|
148
|
+
this.variant = AnySignatureVariant.Keyless;
|
|
141
149
|
} else {
|
|
142
150
|
throw new Error("Unsupported signature type");
|
|
143
151
|
}
|
|
@@ -170,6 +178,9 @@ export class AnySignature extends Signature {
|
|
|
170
178
|
case AnySignatureVariant.Secp256k1:
|
|
171
179
|
signature = Secp256k1Signature.deserialize(deserializer);
|
|
172
180
|
break;
|
|
181
|
+
case AnySignatureVariant.Keyless:
|
|
182
|
+
signature = KeylessSignature.deserialize(deserializer);
|
|
183
|
+
break;
|
|
173
184
|
default:
|
|
174
185
|
throw new Error(`Unknown variant index for AnySignature: ${variantIndex}`);
|
|
175
186
|
}
|
package/src/internal/general.ts
CHANGED
|
@@ -10,14 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
import { AptosConfig } from "../api/aptosConfig";
|
|
12
12
|
import { getAptosFullNode, postAptosIndexer } from "../client";
|
|
13
|
-
import {
|
|
14
|
-
AnyNumber,
|
|
15
|
-
Block,
|
|
16
|
-
GetChainTopUserTransactionsResponse,
|
|
17
|
-
GetProcessorStatusResponse,
|
|
18
|
-
GraphqlQuery,
|
|
19
|
-
LedgerInfo,
|
|
20
|
-
} from "../types";
|
|
13
|
+
import { GetChainTopUserTransactionsResponse, GetProcessorStatusResponse, GraphqlQuery, LedgerInfo } from "../types";
|
|
21
14
|
import { GetChainTopUserTransactionsQuery, GetProcessorStatusQuery } from "../types/generated/operations";
|
|
22
15
|
import { GetChainTopUserTransactions, GetProcessorStatus } from "../types/generated/queries";
|
|
23
16
|
import { ProcessorType } from "../utils/const";
|
|
@@ -32,36 +25,6 @@ export async function getLedgerInfo(args: { aptosConfig: AptosConfig }): Promise
|
|
|
32
25
|
return data;
|
|
33
26
|
}
|
|
34
27
|
|
|
35
|
-
export async function getBlockByVersion(args: {
|
|
36
|
-
aptosConfig: AptosConfig;
|
|
37
|
-
ledgerVersion: AnyNumber;
|
|
38
|
-
options?: { withTransactions?: boolean };
|
|
39
|
-
}): Promise<Block> {
|
|
40
|
-
const { aptosConfig, ledgerVersion, options } = args;
|
|
41
|
-
const { data } = await getAptosFullNode<{}, Block>({
|
|
42
|
-
aptosConfig,
|
|
43
|
-
originMethod: "getBlockByVersion",
|
|
44
|
-
path: `blocks/by_version/${ledgerVersion}`,
|
|
45
|
-
params: { with_transactions: options?.withTransactions },
|
|
46
|
-
});
|
|
47
|
-
return data;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export async function getBlockByHeight(args: {
|
|
51
|
-
aptosConfig: AptosConfig;
|
|
52
|
-
blockHeight: AnyNumber;
|
|
53
|
-
options?: { withTransactions?: boolean };
|
|
54
|
-
}): Promise<Block> {
|
|
55
|
-
const { aptosConfig, blockHeight, options } = args;
|
|
56
|
-
const { data } = await getAptosFullNode<{}, Block>({
|
|
57
|
-
aptosConfig,
|
|
58
|
-
originMethod: "getBlockByHeight",
|
|
59
|
-
path: `blocks/by_height/${blockHeight}`,
|
|
60
|
-
params: { with_transactions: options?.withTransactions },
|
|
61
|
-
});
|
|
62
|
-
return data;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
28
|
export async function getChainTopUserTransactions(args: {
|
|
66
29
|
aptosConfig: AptosConfig;
|
|
67
30
|
limit: number;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
// Copyright © Aptos Foundation
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* This file contains the underlying implementations for exposed API surface in
|
|
6
|
+
* the {@link api/keyless}. By moving the methods out into a separate file,
|
|
7
|
+
* other namespaces and processes can access these methods without depending on the entire
|
|
8
|
+
* keyless namespace and without having a dependency cycle error.
|
|
9
|
+
*/
|
|
10
|
+
import { AptosConfig } from "../api/aptosConfig";
|
|
11
|
+
import { postAptosPepperService, postAptosProvingService } from "../client";
|
|
12
|
+
import { EphemeralSignature, Groth16Zkp, Hex, ZeroKnowledgeSig, ZkProof, getKeylessConfig } from "../core";
|
|
13
|
+
import { HexInput, ZkpVariant } from "../types";
|
|
14
|
+
import { EphemeralKeyPair, KeylessAccount, ProofFetchCallback } from "../account";
|
|
15
|
+
import { PepperFetchRequest, PepperFetchResponse, ProverRequest, ProverResponse } from "../types/keyless";
|
|
16
|
+
import { nowInSeconds } from "../utils/helpers";
|
|
17
|
+
|
|
18
|
+
export async function getPepper(args: {
|
|
19
|
+
aptosConfig: AptosConfig;
|
|
20
|
+
jwt: string;
|
|
21
|
+
ephemeralKeyPair: EphemeralKeyPair;
|
|
22
|
+
uidKey?: string;
|
|
23
|
+
derivationPath?: string;
|
|
24
|
+
}): Promise<Uint8Array> {
|
|
25
|
+
const { aptosConfig, jwt, ephemeralKeyPair, uidKey = "sub", derivationPath } = args;
|
|
26
|
+
|
|
27
|
+
const body = {
|
|
28
|
+
jwt_b64: jwt,
|
|
29
|
+
epk: ephemeralKeyPair.getPublicKey().bcsToHex().toStringWithoutPrefix(),
|
|
30
|
+
exp_date_secs: ephemeralKeyPair.expiryDateSecs,
|
|
31
|
+
epk_blinder: Hex.fromHexInput(ephemeralKeyPair.blinder).toStringWithoutPrefix(),
|
|
32
|
+
uid_key: uidKey,
|
|
33
|
+
derivation_path: derivationPath,
|
|
34
|
+
};
|
|
35
|
+
const { data } = await postAptosPepperService<PepperFetchRequest, PepperFetchResponse>({
|
|
36
|
+
aptosConfig,
|
|
37
|
+
path: "fetch",
|
|
38
|
+
body,
|
|
39
|
+
originMethod: "getPepper",
|
|
40
|
+
overrides: { WITH_CREDENTIALS: false },
|
|
41
|
+
});
|
|
42
|
+
return Hex.fromHexInput(data.pepper).toUint8Array();
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export async function getProof(args: {
|
|
46
|
+
aptosConfig: AptosConfig;
|
|
47
|
+
jwt: string;
|
|
48
|
+
ephemeralKeyPair: EphemeralKeyPair;
|
|
49
|
+
pepper: HexInput;
|
|
50
|
+
uidKey?: string;
|
|
51
|
+
}): Promise<ZeroKnowledgeSig> {
|
|
52
|
+
const { aptosConfig, jwt, ephemeralKeyPair, pepper, uidKey = "sub" } = args;
|
|
53
|
+
const { maxExpHorizonSecs } = await getKeylessConfig({ aptosConfig });
|
|
54
|
+
if (maxExpHorizonSecs < ephemeralKeyPair.expiryDateSecs - nowInSeconds()) {
|
|
55
|
+
throw Error(`The EphemeralKeyPair is too long lived. It's lifespan must be less than ${maxExpHorizonSecs}`);
|
|
56
|
+
}
|
|
57
|
+
const json = {
|
|
58
|
+
jwt_b64: jwt,
|
|
59
|
+
epk: ephemeralKeyPair.getPublicKey().bcsToHex().toStringWithoutPrefix(),
|
|
60
|
+
epk_blinder: Hex.fromHexInput(ephemeralKeyPair.blinder).toStringWithoutPrefix(),
|
|
61
|
+
exp_date_secs: ephemeralKeyPair.expiryDateSecs,
|
|
62
|
+
exp_horizon_secs: maxExpHorizonSecs,
|
|
63
|
+
pepper: Hex.fromHexInput(pepper).toStringWithoutPrefix(),
|
|
64
|
+
uid_key: uidKey,
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const { data } = await postAptosProvingService<ProverRequest, ProverResponse>({
|
|
68
|
+
aptosConfig,
|
|
69
|
+
path: "prove",
|
|
70
|
+
body: json,
|
|
71
|
+
originMethod: "getProof",
|
|
72
|
+
overrides: { WITH_CREDENTIALS: false },
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
const proofPoints = data.proof;
|
|
76
|
+
const groth16Zkp = new Groth16Zkp({
|
|
77
|
+
a: proofPoints.a,
|
|
78
|
+
b: proofPoints.b,
|
|
79
|
+
c: proofPoints.c,
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
const signedProof = new ZeroKnowledgeSig({
|
|
83
|
+
proof: new ZkProof(groth16Zkp, ZkpVariant.Groth16),
|
|
84
|
+
trainingWheelsSignature: EphemeralSignature.fromHex(data.training_wheels_signature),
|
|
85
|
+
expHorizonSecs: maxExpHorizonSecs,
|
|
86
|
+
});
|
|
87
|
+
return signedProof;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export async function deriveKeylessAccount(args: {
|
|
91
|
+
aptosConfig: AptosConfig;
|
|
92
|
+
jwt: string;
|
|
93
|
+
ephemeralKeyPair: EphemeralKeyPair;
|
|
94
|
+
uidKey?: string;
|
|
95
|
+
pepper?: HexInput;
|
|
96
|
+
proofFetchCallback?: ProofFetchCallback;
|
|
97
|
+
}): Promise<KeylessAccount> {
|
|
98
|
+
const { proofFetchCallback } = args;
|
|
99
|
+
let { pepper } = args;
|
|
100
|
+
if (pepper === undefined) {
|
|
101
|
+
pepper = await getPepper(args);
|
|
102
|
+
} else {
|
|
103
|
+
pepper = Hex.fromHexInput(pepper).toUint8Array();
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (pepper.length !== KeylessAccount.PEPPER_LENGTH) {
|
|
107
|
+
throw new Error(`Pepper needs to be ${KeylessAccount.PEPPER_LENGTH} bytes`);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const proofPromise = getProof({ ...args, pepper });
|
|
111
|
+
// If a callback is provided, pass in the proof as a promise to KeylessAccount.create. This will make the proof be fetched in the
|
|
112
|
+
// background and the callback will handle the outcome of the fetch. This allows the developer to not have to block on the proof fetch
|
|
113
|
+
// allowing for faster rendering of UX.
|
|
114
|
+
//
|
|
115
|
+
// If no callback is provided, the just await the proof fetch and continue syncronously.
|
|
116
|
+
const proof = proofFetchCallback ? proofPromise : await proofPromise;
|
|
117
|
+
|
|
118
|
+
const keylessAccount = KeylessAccount.create({ ...args, proof, pepper, proofFetchCallback });
|
|
119
|
+
|
|
120
|
+
return keylessAccount;
|
|
121
|
+
}
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
type TransactionResponse,
|
|
20
20
|
WaitForTransactionOptions,
|
|
21
21
|
CommittedTransactionResponse,
|
|
22
|
+
Block,
|
|
22
23
|
} from "../types";
|
|
23
24
|
import { DEFAULT_TXN_TIMEOUT_SEC, ProcessorType } from "../utils/const";
|
|
24
25
|
import { sleep } from "../utils/helpers";
|
|
@@ -279,3 +280,94 @@ export class FailedTransactionError extends Error {
|
|
|
279
280
|
this.transaction = transaction;
|
|
280
281
|
}
|
|
281
282
|
}
|
|
283
|
+
|
|
284
|
+
export async function getBlockByVersion(args: {
|
|
285
|
+
aptosConfig: AptosConfig;
|
|
286
|
+
ledgerVersion: AnyNumber;
|
|
287
|
+
options?: { withTransactions?: boolean };
|
|
288
|
+
}): Promise<Block> {
|
|
289
|
+
const { aptosConfig, ledgerVersion, options } = args;
|
|
290
|
+
const { data: block } = await getAptosFullNode<{}, Block>({
|
|
291
|
+
aptosConfig,
|
|
292
|
+
originMethod: "getBlockByVersion",
|
|
293
|
+
path: `blocks/by_version/${ledgerVersion}`,
|
|
294
|
+
params: { with_transactions: options?.withTransactions },
|
|
295
|
+
});
|
|
296
|
+
|
|
297
|
+
return fillBlockTransactions({ block, ...args });
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
export async function getBlockByHeight(args: {
|
|
301
|
+
aptosConfig: AptosConfig;
|
|
302
|
+
blockHeight: AnyNumber;
|
|
303
|
+
options?: { withTransactions?: boolean };
|
|
304
|
+
}): Promise<Block> {
|
|
305
|
+
const { aptosConfig, blockHeight, options } = args;
|
|
306
|
+
const { data: block } = await getAptosFullNode<{}, Block>({
|
|
307
|
+
aptosConfig,
|
|
308
|
+
originMethod: "getBlockByHeight",
|
|
309
|
+
path: `blocks/by_height/${blockHeight}`,
|
|
310
|
+
params: { with_transactions: options?.withTransactions },
|
|
311
|
+
});
|
|
312
|
+
return fillBlockTransactions({ block, ...args });
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Fills in the block with transactions if not enough were returned
|
|
317
|
+
* @param args
|
|
318
|
+
*/
|
|
319
|
+
async function fillBlockTransactions(args: {
|
|
320
|
+
aptosConfig: AptosConfig;
|
|
321
|
+
block: Block;
|
|
322
|
+
options?: { withTransactions?: boolean };
|
|
323
|
+
}) {
|
|
324
|
+
const { aptosConfig, block, options } = args;
|
|
325
|
+
if (options?.withTransactions) {
|
|
326
|
+
// Transactions should be filled, but this ensures it
|
|
327
|
+
block.transactions = block.transactions ?? [];
|
|
328
|
+
|
|
329
|
+
const lastTxn = block.transactions[block.transactions.length - 1];
|
|
330
|
+
const firstVersion = BigInt(block.first_version);
|
|
331
|
+
const lastVersion = BigInt(block.last_version);
|
|
332
|
+
|
|
333
|
+
// Convert the transaction to the type
|
|
334
|
+
const curVersion: string | undefined = (lastTxn as any)?.version;
|
|
335
|
+
let latestVersion;
|
|
336
|
+
|
|
337
|
+
// This time, if we don't have any transactions, we will try once with the start of the block
|
|
338
|
+
if (curVersion === undefined) {
|
|
339
|
+
latestVersion = firstVersion - 1n;
|
|
340
|
+
} else {
|
|
341
|
+
latestVersion = BigInt(curVersion);
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
// If we have all the transactions in the block, we can skip out, otherwise we need to fill the transactions
|
|
345
|
+
if (latestVersion === lastVersion) {
|
|
346
|
+
return block;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
// For now, we will grab all the transactions in groups of 100, but we can make this more efficient by trying larger
|
|
350
|
+
// amounts
|
|
351
|
+
const fetchFutures = [];
|
|
352
|
+
const pageSize = 100n;
|
|
353
|
+
for (let i = latestVersion + 1n; i < lastVersion; i += BigInt(100)) {
|
|
354
|
+
fetchFutures.push(
|
|
355
|
+
getTransactions({
|
|
356
|
+
aptosConfig,
|
|
357
|
+
options: {
|
|
358
|
+
offset: i,
|
|
359
|
+
limit: Math.min(Number(pageSize), Number(lastVersion - i + 1n)),
|
|
360
|
+
},
|
|
361
|
+
}),
|
|
362
|
+
);
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
// Combine all the futures
|
|
366
|
+
const responses = await Promise.all(fetchFutures);
|
|
367
|
+
for (const txns of responses) {
|
|
368
|
+
block.transactions.push(...txns);
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
return block;
|
|
373
|
+
}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import { AptosConfig } from "../api/aptosConfig";
|
|
9
9
|
import { MoveVector, U8 } from "../bcs";
|
|
10
10
|
import { postAptosFullNode } from "../client";
|
|
11
|
-
import { Account } from "../account";
|
|
11
|
+
import { Account, KeylessAccount, MultiKeyAccount } from "../account";
|
|
12
12
|
import { AccountAddress, AccountAddressInput } from "../core/accountAddress";
|
|
13
13
|
import { PrivateKey } from "../core/crypto";
|
|
14
14
|
import { AccountAuthenticator } from "../transactions/authenticator/account";
|
|
@@ -275,6 +275,11 @@ export async function signAndSubmitTransaction(args: {
|
|
|
275
275
|
transaction: AnyRawTransaction;
|
|
276
276
|
}): Promise<PendingTransactionResponse> {
|
|
277
277
|
const { aptosConfig, signer, transaction } = args;
|
|
278
|
+
// If the signer contains a KeylessAccount, await proof fetching in case the proof
|
|
279
|
+
// was fetched asyncronously.
|
|
280
|
+
if (signer instanceof KeylessAccount || signer instanceof MultiKeyAccount) {
|
|
281
|
+
await signer.waitForProofFetch();
|
|
282
|
+
}
|
|
278
283
|
const authenticator = signTransaction({ signer, transaction });
|
|
279
284
|
return submitTransaction({
|
|
280
285
|
aptosConfig,
|
|
@@ -26,10 +26,7 @@
|
|
|
26
26
|
import { AptosConfig } from "../../api/aptosConfig";
|
|
27
27
|
import { Account } from "../../account";
|
|
28
28
|
import { getInfo } from "../../internal/account";
|
|
29
|
-
import { sleep } from "../../utils/helpers";
|
|
30
|
-
|
|
31
|
-
// returns `now` time in seconds
|
|
32
|
-
const now = () => Math.floor(Date.now() / 1000);
|
|
29
|
+
import { nowInSeconds, sleep } from "../../utils/helpers";
|
|
33
30
|
|
|
34
31
|
export class AccountSequenceNumber {
|
|
35
32
|
readonly aptosConfig: AptosConfig;
|
|
@@ -96,10 +93,10 @@ export class AccountSequenceNumber {
|
|
|
96
93
|
if (this.currentNumber! - this.lastUncommintedNumber! >= this.maximumInFlight) {
|
|
97
94
|
await this.update();
|
|
98
95
|
|
|
99
|
-
const startTime =
|
|
96
|
+
const startTime = nowInSeconds();
|
|
100
97
|
while (this.currentNumber! - this.lastUncommintedNumber! >= this.maximumInFlight) {
|
|
101
98
|
await sleep(this.sleepTime);
|
|
102
|
-
if (
|
|
99
|
+
if (nowInSeconds() - startTime > this.maxWaitTime) {
|
|
103
100
|
/* eslint-disable no-console */
|
|
104
101
|
console.warn(
|
|
105
102
|
`Waited over 30 seconds for a transaction to commit, resyncing ${this.account.accountAddress.toString()}`,
|
|
@@ -164,9 +161,9 @@ export class AccountSequenceNumber {
|
|
|
164
161
|
|
|
165
162
|
try {
|
|
166
163
|
await this.update();
|
|
167
|
-
const startTime =
|
|
164
|
+
const startTime = nowInSeconds();
|
|
168
165
|
while (this.lastUncommintedNumber !== this.currentNumber) {
|
|
169
|
-
if (
|
|
166
|
+
if (nowInSeconds() - startTime > this.maxWaitTime) {
|
|
170
167
|
/* eslint-disable no-console */
|
|
171
168
|
console.warn(
|
|
172
169
|
`Waited over 30 seconds for a transaction to commit, resyncing ${this.account.accountAddress.toString()}`,
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
EntryFunctionABI,
|
|
11
11
|
ViewFunctionABI,
|
|
12
12
|
FunctionABI,
|
|
13
|
+
TypeArgument,
|
|
13
14
|
} from "../types";
|
|
14
15
|
import { Bool, MoveOption, MoveString, MoveVector, U128, U16, U256, U32, U64, U8 } from "../../bcs";
|
|
15
16
|
import { AccountAddress } from "../../core";
|
|
@@ -40,9 +41,9 @@ const TEXT_ENCODER = new TextEncoder();
|
|
|
40
41
|
/**
|
|
41
42
|
* Convert type arguments to only type tags, allowing for string representations of type tags
|
|
42
43
|
*/
|
|
43
|
-
export function standardizeTypeTags(typeArguments?: Array<
|
|
44
|
+
export function standardizeTypeTags(typeArguments?: Array<TypeArgument>): Array<TypeTag> {
|
|
44
45
|
return (
|
|
45
|
-
typeArguments?.map((typeArg:
|
|
46
|
+
typeArguments?.map((typeArg: TypeArgument): TypeTag => {
|
|
46
47
|
// Convert to TypeTag if it's a string representation
|
|
47
48
|
if (isString(typeArg)) {
|
|
48
49
|
return parseTypeTag(typeArg);
|
|
@@ -8,7 +8,7 @@ import { sha3_256 as sha3Hash } from "@noble/hashes/sha3";
|
|
|
8
8
|
import { RAW_TRANSACTION_SALT, RAW_TRANSACTION_WITH_DATA_SALT } from "../../utils/const";
|
|
9
9
|
import { FeePayerRawTransaction, MultiAgentRawTransaction } from "../instances";
|
|
10
10
|
import { AnyRawTransaction, AnyRawTransactionInstance } from "../types";
|
|
11
|
-
import { Serializable } from "../../bcs";
|
|
11
|
+
import { Serializable } from "../../bcs/serializer";
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Derive the raw transaction type - FeePayerRawTransaction or MultiAgentRawTransaction or RawTransaction
|
|
@@ -61,6 +61,9 @@ export function generateSigningMessage(bytes: Uint8Array, domainSeparator: strin
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
/**
|
|
64
|
+
* @deprected
|
|
65
|
+
* Use CryptoHashable instead by having your class implement it and call hash() to get the signing message.
|
|
66
|
+
*
|
|
64
67
|
* Generates the 'signing message' form of a serilizable value. It bcs serializes the value and uses the name of
|
|
65
68
|
* its constructor as the domain separator.
|
|
66
69
|
*
|
|
@@ -9,7 +9,13 @@
|
|
|
9
9
|
import { sha3_256 as sha3Hash } from "@noble/hashes/sha3";
|
|
10
10
|
import { AptosConfig } from "../../api/aptosConfig";
|
|
11
11
|
import { AccountAddress, AccountAddressInput, Hex, PublicKey } from "../../core";
|
|
12
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
AnyPublicKey,
|
|
14
|
+
AnySignature,
|
|
15
|
+
KeylessPublicKey,
|
|
16
|
+
Secp256k1PublicKey,
|
|
17
|
+
Secp256k1Signature,
|
|
18
|
+
} from "../../core/crypto";
|
|
13
19
|
import { Ed25519PublicKey, Ed25519Signature } from "../../core/crypto/ed25519";
|
|
14
20
|
import { getInfo } from "../../internal/account";
|
|
15
21
|
import { getLedgerInfo } from "../../internal/general";
|
|
@@ -216,7 +222,11 @@ export function generateViewFunctionPayloadWithABI(args: InputViewFunctionDataWi
|
|
|
216
222
|
|
|
217
223
|
function generateTransactionPayloadScript(args: InputScriptData) {
|
|
218
224
|
return new TransactionPayloadScript(
|
|
219
|
-
new Script(
|
|
225
|
+
new Script(
|
|
226
|
+
Hex.fromHexInput(args.bytecode).toUint8Array(),
|
|
227
|
+
standardizeTypeTags(args.typeArguments),
|
|
228
|
+
args.functionArguments,
|
|
229
|
+
),
|
|
220
230
|
);
|
|
221
231
|
}
|
|
222
232
|
|
|
@@ -441,6 +451,11 @@ export function generateSignedTransactionForSimulation(args: InputSimulateTransa
|
|
|
441
451
|
}
|
|
442
452
|
|
|
443
453
|
export function getAuthenticatorForSimulation(publicKey: PublicKey) {
|
|
454
|
+
if (publicKey instanceof KeylessPublicKey || publicKey instanceof Secp256k1PublicKey) {
|
|
455
|
+
// eslint-disable-next-line no-param-reassign
|
|
456
|
+
publicKey = new AnyPublicKey(publicKey);
|
|
457
|
+
}
|
|
458
|
+
|
|
444
459
|
// TODO add support for AnyMultiKey
|
|
445
460
|
if (publicKey instanceof AnyPublicKey) {
|
|
446
461
|
if (publicKey.publicKey instanceof Ed25519PublicKey) {
|
|
@@ -449,6 +464,11 @@ export function getAuthenticatorForSimulation(publicKey: PublicKey) {
|
|
|
449
464
|
if (publicKey.publicKey instanceof Secp256k1PublicKey) {
|
|
450
465
|
return new AccountAuthenticatorSingleKey(publicKey, new AnySignature(new Secp256k1Signature(new Uint8Array(64))));
|
|
451
466
|
}
|
|
467
|
+
if (publicKey.publicKey instanceof KeylessPublicKey) {
|
|
468
|
+
// TODO: Replace with the line below one simulation works properly for Keyless
|
|
469
|
+
// return new AccountAuthenticatorSingleKey(publicKey, new AnySignature(KeylessSignature.getSimulationSignature()));
|
|
470
|
+
return new AccountAuthenticatorSingleKey(publicKey, new AnySignature(new Ed25519Signature(new Uint8Array(64))));
|
|
471
|
+
}
|
|
452
472
|
}
|
|
453
473
|
|
|
454
474
|
// legacy code
|