@aptos-labs/ts-sdk 1.17.0 → 1.18.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-Lv-GSihU.d.ts} +107 -13
- 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/cli/index.js.map +1 -1
- package/dist/common/index.d.ts +808 -117
- package/dist/common/index.js +30 -28
- package/dist/common/index.js.map +1 -1
- package/dist/esm/account/Account.mjs +1 -1
- 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 +175 -0
- package/dist/esm/account/KeylessAccount.mjs +2 -0
- package/dist/esm/account/MultiKeyAccount.d.mts +11 -5
- package/dist/esm/account/MultiKeyAccount.mjs +1 -1
- package/dist/esm/account/SingleKeyAccount.mjs +1 -1
- package/dist/esm/account/index.d.mts +6 -0
- 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 +9 -1
- 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 +2 -2
- 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.mjs +1 -1
- package/dist/esm/api/general.mjs +1 -1
- package/dist/esm/api/index.d.mts +7 -0
- package/dist/esm/api/index.mjs +1 -1
- package/dist/esm/api/keyless.d.mts +104 -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.mjs +1 -1
- package/dist/esm/api/transactionSubmission/build.d.mts +2 -2
- package/dist/esm/api/transactionSubmission/build.mjs +1 -1
- 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 +2 -2
- package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
- package/dist/esm/api/transactionSubmission/submit.d.mts +2 -2
- 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-TQLED4KC.mjs → chunk-2DSPX6BX.mjs} +2 -2
- package/dist/esm/chunk-2QWQ6RX5.mjs +2 -0
- package/dist/esm/chunk-2QWQ6RX5.mjs.map +1 -0
- package/dist/esm/chunk-362JBD4O.mjs +2 -0
- package/dist/esm/{chunk-SUAMDMAA.mjs.map → chunk-362JBD4O.mjs.map} +1 -1
- package/dist/esm/{chunk-RWXHA4QZ.mjs → chunk-3VUSIKCF.mjs} +2 -2
- package/dist/esm/chunk-3ZCQQ3L2.mjs +2 -0
- package/dist/esm/chunk-3ZCQQ3L2.mjs.map +1 -0
- package/dist/esm/chunk-42SZQH5Z.mjs +2 -0
- package/dist/esm/chunk-42SZQH5Z.mjs.map +1 -0
- package/dist/esm/{chunk-MCRRHBFQ.mjs → chunk-4EPLOSKY.mjs} +2 -2
- package/dist/esm/{chunk-BSVNV6SJ.mjs → chunk-4IBJW3PB.mjs} +2 -2
- package/dist/esm/{chunk-J6HKAEKY.mjs → chunk-5X2BJDOB.mjs} +2 -2
- package/dist/esm/{chunk-5UKBTF7N.mjs → chunk-5YHI7WOB.mjs} +2 -2
- package/dist/esm/{chunk-J5I4OZAS.mjs → chunk-6DYDZSEW.mjs} +2 -2
- package/dist/esm/{chunk-J4Z6XR5D.mjs → chunk-6JL2U7JB.mjs} +2 -2
- package/dist/esm/{chunk-RNL5TAQT.mjs → chunk-6UDHM6YZ.mjs} +2 -2
- package/dist/esm/{chunk-2X7A4HUS.mjs → chunk-6ZQWPHLV.mjs} +2 -2
- package/dist/esm/{chunk-4NHWV5AI.mjs → chunk-76OH2Z4Q.mjs} +2 -2
- package/dist/esm/{chunk-5EN52MUT.mjs → chunk-77NXCSLY.mjs} +2 -2
- package/dist/esm/{chunk-ND6OMSQU.mjs → chunk-7Y45UTRL.mjs} +2 -2
- package/dist/esm/chunk-7Z6DYLCA.mjs +1 -0
- package/dist/esm/chunk-7Z6DYLCA.mjs.map +1 -0
- package/dist/esm/{chunk-T2AGN5YT.mjs → chunk-A2Z7I2EY.mjs} +2 -2
- package/dist/esm/{chunk-36QXVFR5.mjs → chunk-A63SMUOU.mjs} +2 -2
- package/dist/esm/{chunk-36QXVFR5.mjs.map → chunk-A63SMUOU.mjs.map} +1 -1
- package/dist/esm/chunk-AQ4I7VVB.mjs +1 -0
- package/dist/esm/chunk-AQ4I7VVB.mjs.map +1 -0
- package/dist/esm/{chunk-3XFID2N4.mjs → chunk-AVH5SYTL.mjs} +2 -2
- package/dist/esm/{chunk-3N6N3KOS.mjs → chunk-AYKZA676.mjs} +2 -2
- package/dist/esm/{chunk-QRS4DGP3.mjs → chunk-BF46IXHH.mjs} +2 -2
- package/dist/esm/chunk-BLVYB7Y3.mjs +2 -0
- package/dist/esm/chunk-BLVYB7Y3.mjs.map +1 -0
- package/dist/esm/{chunk-PF57EOJY.mjs → chunk-BOYYQAB4.mjs} +2 -2
- package/dist/esm/{chunk-RPND23OR.mjs → chunk-BS7EVBWX.mjs} +2 -2
- package/dist/esm/{chunk-JX75UKJX.mjs → chunk-BVB3QII3.mjs} +2 -2
- package/dist/esm/{chunk-KZZWY4YI.mjs → chunk-C5V4EBVP.mjs} +2 -2
- package/dist/esm/{chunk-3BNA74V5.mjs → chunk-CZ6TC4GO.mjs} +2 -2
- package/dist/esm/{chunk-2HF2XEHO.mjs → chunk-DLDGUTFV.mjs} +2 -2
- package/dist/esm/{chunk-YR7JRJ25.mjs → chunk-DPO352QL.mjs} +2 -2
- package/dist/esm/{chunk-GM56MMNJ.mjs → chunk-DW2KZREM.mjs} +2 -2
- package/dist/esm/chunk-DZXM2MQY.mjs +2 -0
- package/dist/esm/chunk-DZXM2MQY.mjs.map +1 -0
- package/dist/esm/{chunk-6YV3366Z.mjs → chunk-EAW6AWYD.mjs} +2 -2
- package/dist/esm/{chunk-NUK6JT5I.mjs → chunk-EYIJYUN7.mjs} +2 -2
- package/dist/esm/{chunk-AF5WNJOP.mjs → chunk-F74FF323.mjs} +2 -2
- package/dist/esm/chunk-FM6ALU5B.mjs +2 -0
- package/dist/esm/chunk-FM6ALU5B.mjs.map +1 -0
- package/dist/esm/{chunk-ISIUQQMV.mjs → chunk-FNFQA7NS.mjs} +2 -2
- package/dist/esm/chunk-FTIW5GGG.mjs +2 -0
- package/dist/esm/{chunk-BRVWHCP3.mjs.map → chunk-FTIW5GGG.mjs.map} +1 -1
- package/dist/esm/{chunk-G2XVNF2T.mjs → chunk-FYB7C42X.mjs} +2 -2
- package/dist/esm/chunk-GFRNBBTY.mjs +2 -0
- package/dist/esm/chunk-GFRNBBTY.mjs.map +1 -0
- package/dist/esm/{chunk-CEHCDA3G.mjs → chunk-H6YNXJNF.mjs} +2 -2
- package/dist/esm/{chunk-47IIBESV.mjs → chunk-HCN7YJGB.mjs} +2 -2
- package/dist/esm/chunk-HHE63GFW.mjs +2 -0
- package/dist/esm/chunk-HHE63GFW.mjs.map +1 -0
- package/dist/esm/{chunk-S3EDNXZE.mjs → chunk-HIHKTLLM.mjs} +20 -18
- package/dist/esm/chunk-HIHKTLLM.mjs.map +1 -0
- package/dist/esm/chunk-IVVWQKCF.mjs +2 -0
- package/dist/esm/chunk-IVVWQKCF.mjs.map +1 -0
- package/dist/esm/{chunk-53INTTOI.mjs → chunk-JPDT6E3B.mjs} +2 -2
- package/dist/esm/{chunk-J4VNDDKJ.mjs → chunk-JSWBLHMX.mjs} +2 -2
- package/dist/esm/{chunk-73QJNN7O.mjs → chunk-K4CTCBLY.mjs} +2 -2
- package/dist/esm/{chunk-AQAH67IV.mjs → chunk-K7DBDI2I.mjs} +2 -2
- package/dist/esm/{chunk-PIVZMT5D.mjs → chunk-L22R3OIW.mjs} +2 -2
- package/dist/esm/{chunk-4GWNWSZP.mjs → chunk-LVSOUCFD.mjs} +2 -2
- package/dist/esm/{chunk-AHW3SKT7.mjs → chunk-M3JHXCGV.mjs} +2 -2
- package/dist/esm/{chunk-ZRKXS7XG.mjs → chunk-MHZ64FIW.mjs} +2 -2
- package/dist/esm/{chunk-UGPALAPN.mjs → chunk-MLDQ2TY2.mjs} +2 -2
- package/dist/esm/chunk-MQGW234H.mjs +2 -0
- package/dist/esm/chunk-MQGW234H.mjs.map +1 -0
- package/dist/esm/chunk-NCUBVHUW.mjs +2 -0
- package/dist/esm/chunk-NCUBVHUW.mjs.map +1 -0
- package/dist/esm/chunk-NMD45OTM.mjs +2 -0
- package/dist/esm/chunk-NMD45OTM.mjs.map +1 -0
- package/dist/esm/{chunk-R5VVKRJ2.mjs → chunk-NNQYSSLH.mjs} +2 -2
- package/dist/esm/{chunk-CZOD4SCZ.mjs → chunk-NSQLZBCA.mjs} +2 -2
- package/dist/esm/{chunk-KAGLWBIJ.mjs → chunk-OPGMT27G.mjs} +2 -2
- package/dist/esm/{chunk-N3U47Y6Y.mjs → chunk-P5V7OZNN.mjs} +2 -2
- package/dist/esm/{chunk-337U6Q6K.mjs → chunk-PTA3VHTQ.mjs} +2 -2
- package/dist/esm/chunk-Q6LFIZ3L.mjs +2 -0
- package/dist/esm/chunk-Q6LFIZ3L.mjs.map +1 -0
- package/dist/esm/chunk-QAMV4L3K.mjs +2 -0
- package/dist/esm/chunk-QAMV4L3K.mjs.map +1 -0
- package/dist/esm/{chunk-BEVXJJJF.mjs → chunk-QL2QFRKV.mjs} +2 -2
- package/dist/esm/chunk-QVWBJJRF.mjs +2 -0
- package/dist/esm/chunk-QVWBJJRF.mjs.map +1 -0
- package/dist/esm/{chunk-U3YYSIIT.mjs → chunk-RFA7BIDN.mjs} +2 -2
- package/dist/esm/{chunk-G56GPLTB.mjs → chunk-RJ4RKVVQ.mjs} +2 -2
- package/dist/esm/{chunk-BBVIJO6X.mjs → chunk-S32JHML7.mjs} +2 -2
- package/dist/esm/chunk-SCHZ67F3.mjs +2 -0
- package/dist/esm/chunk-SCHZ67F3.mjs.map +1 -0
- package/dist/esm/chunk-SFUTXSDK.mjs +2 -0
- package/dist/esm/chunk-SFUTXSDK.mjs.map +1 -0
- package/dist/esm/{chunk-3SPIFLBZ.mjs → chunk-SLFAROVZ.mjs} +2 -2
- package/dist/esm/{chunk-CT2BQQTZ.mjs → chunk-TG2LLWVU.mjs} +2 -2
- package/dist/esm/{chunk-35EWRSDK.mjs → chunk-TY4IEDJD.mjs} +2 -2
- package/dist/esm/chunk-U4A56FN2.mjs +2 -0
- package/dist/esm/{chunk-7UBKXR37.mjs.map → chunk-U4A56FN2.mjs.map} +1 -1
- package/dist/esm/chunk-U6X2FYNI.mjs +2 -0
- package/dist/esm/chunk-U6X2FYNI.mjs.map +1 -0
- package/dist/esm/{chunk-G2UPF44Z.mjs → chunk-UAZUO75M.mjs} +2 -2
- package/dist/esm/{chunk-HLC4HAYY.mjs → chunk-UGVNOSD3.mjs} +2 -2
- package/dist/esm/{chunk-LGNSPATO.mjs → chunk-VCMP3MXN.mjs} +2 -2
- package/dist/esm/{chunk-PZ4SAXY7.mjs → chunk-VTKPSYKA.mjs} +2 -2
- package/dist/esm/chunk-VTKPSYKA.mjs.map +1 -0
- package/dist/esm/chunk-WQHW4WQN.mjs +2 -0
- package/dist/esm/chunk-WQHW4WQN.mjs.map +1 -0
- package/dist/esm/chunk-WV5AD4IE.mjs +2 -0
- package/dist/esm/{chunk-CE65OKFI.mjs → chunk-XWVU4G57.mjs} +2 -2
- package/dist/esm/{chunk-ZHCSSCC5.mjs → chunk-XYLM277Z.mjs} +2 -2
- package/dist/esm/chunk-YE5B2S5L.mjs +2 -0
- package/dist/esm/chunk-YE5B2S5L.mjs.map +1 -0
- package/dist/esm/{chunk-FAFJKSVZ.mjs → chunk-YMUCYX3B.mjs} +2 -2
- package/dist/esm/{chunk-SRDIYE3M.mjs → chunk-YPHH6CAO.mjs} +2 -2
- package/dist/esm/chunk-YTQVMLFD.mjs +2 -0
- package/dist/esm/chunk-YTQVMLFD.mjs.map +1 -0
- package/dist/esm/{chunk-B7X6PSE7.mjs → chunk-YUNDX5I7.mjs} +2 -2
- package/dist/esm/chunk-Z4YHE4A5.mjs +2 -0
- package/dist/esm/{chunk-4BJA3QUQ.mjs.map → chunk-Z4YHE4A5.mjs.map} +1 -1
- package/dist/esm/cli/index.mjs +1 -1
- package/dist/esm/cli/localNode.mjs +1 -1
- package/dist/esm/cli/move.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/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.mjs +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 +6 -0
- 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.mjs +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/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.mjs +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.mjs +1 -1
- package/dist/esm/core/index.d.mts +6 -0
- package/dist/esm/core/index.mjs +1 -1
- package/dist/esm/index.d.mts +11 -4
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/internal/account.mjs +1 -1
- package/dist/esm/internal/ans.mjs +1 -1
- package/dist/esm/internal/coin.mjs +1 -1
- 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.mjs +1 -1
- package/dist/esm/internal/general.mjs +1 -1
- package/dist/esm/internal/keyless.d.mts +72 -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.mjs +1 -1
- package/dist/esm/internal/view.mjs +1 -1
- package/dist/esm/transactions/authenticator/account.mjs +1 -1
- package/dist/esm/transactions/authenticator/index.mjs +1 -1
- package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
- 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.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.mjs +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.mjs +1 -1
- package/dist/esm/transactions/management/index.mjs +1 -1
- package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/signingMessage.d.mts +3 -0
- package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +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.mjs +1 -1
- package/dist/esm/types/generated/operations.d.mts +14 -12
- package/dist/esm/types/generated/queries.d.mts +4 -4
- package/dist/esm/types/generated/queries.mjs +1 -1
- package/dist/esm/types/generated/types.d.mts +20 -2
- package/dist/esm/types/generated/types.mjs +1 -1
- package/dist/esm/types/generated/types.mjs.map +1 -1
- package/dist/esm/types/index.d.mts +21 -5
- package/dist/esm/types/index.mjs +1 -1
- package/dist/esm/types/keyless.d.mts +51 -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 +9 -3
- package/src/account/EphemeralKeyPair.ts +150 -0
- package/src/account/KeylessAccount.ts +370 -0
- package/src/account/MultiKeyAccount.ts +12 -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 +78 -0
- package/src/bcs/deserializer.ts +40 -0
- package/src/bcs/serializer.ts +57 -0
- package/src/cli/move.ts +4 -7
- 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/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/keyless.ts +129 -0
- package/src/internal/queries/getFungibleAssetMetadata.graphql +2 -0
- package/src/internal/transactionSubmission.ts +6 -1
- package/src/transactions/management/accountSequenceNumber.ts +5 -8
- package/src/transactions/transactionBuilder/signingMessage.ts +3 -0
- package/src/transactions/transactionBuilder/transactionBuilder.ts +16 -1
- package/src/types/generated/operations.ts +14 -12
- package/src/types/generated/queries.ts +30 -3
- package/src/types/generated/types.ts +20 -2
- 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-3JPVQHOR.mjs +0 -2
- package/dist/esm/chunk-3JPVQHOR.mjs.map +0 -1
- package/dist/esm/chunk-4BJA3QUQ.mjs +0 -2
- package/dist/esm/chunk-6IFMQ5AS.mjs +0 -2
- package/dist/esm/chunk-6IFMQ5AS.mjs.map +0 -1
- package/dist/esm/chunk-746MU2AB.mjs +0 -2
- package/dist/esm/chunk-746MU2AB.mjs.map +0 -1
- package/dist/esm/chunk-7UBKXR37.mjs +0 -2
- package/dist/esm/chunk-BRVWHCP3.mjs +0 -2
- package/dist/esm/chunk-CYNQRMO5.mjs +0 -2
- package/dist/esm/chunk-CYNQRMO5.mjs.map +0 -1
- package/dist/esm/chunk-D2LNQMKD.mjs +0 -2
- package/dist/esm/chunk-D2LNQMKD.mjs.map +0 -1
- package/dist/esm/chunk-DLAIJ2UM.mjs +0 -2
- package/dist/esm/chunk-DLAIJ2UM.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-IENCDVPF.mjs +0 -2
- package/dist/esm/chunk-IENCDVPF.mjs.map +0 -1
- package/dist/esm/chunk-MM5VMKFE.mjs +0 -2
- package/dist/esm/chunk-MM5VMKFE.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-PZ4SAXY7.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-S3EDNXZE.mjs.map +0 -1
- package/dist/esm/chunk-SUAMDMAA.mjs +0 -2
- package/dist/esm/chunk-UO3NZ5AH.mjs +0 -1
- package/dist/esm/chunk-UTKM2WYS.mjs +0 -2
- package/dist/esm/chunk-UTKM2WYS.mjs.map +0 -1
- package/dist/esm/chunk-UVSRX4SV.mjs +0 -1
- package/dist/esm/chunk-W33BZ6IQ.mjs +0 -2
- package/dist/esm/chunk-W33BZ6IQ.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-TQLED4KC.mjs.map → chunk-2DSPX6BX.mjs.map} +0 -0
- /package/dist/esm/{chunk-RWXHA4QZ.mjs.map → chunk-3VUSIKCF.mjs.map} +0 -0
- /package/dist/esm/{chunk-MCRRHBFQ.mjs.map → chunk-4EPLOSKY.mjs.map} +0 -0
- /package/dist/esm/{chunk-BSVNV6SJ.mjs.map → chunk-4IBJW3PB.mjs.map} +0 -0
- /package/dist/esm/{chunk-J6HKAEKY.mjs.map → chunk-5X2BJDOB.mjs.map} +0 -0
- /package/dist/esm/{chunk-5UKBTF7N.mjs.map → chunk-5YHI7WOB.mjs.map} +0 -0
- /package/dist/esm/{chunk-J5I4OZAS.mjs.map → chunk-6DYDZSEW.mjs.map} +0 -0
- /package/dist/esm/{chunk-J4Z6XR5D.mjs.map → chunk-6JL2U7JB.mjs.map} +0 -0
- /package/dist/esm/{chunk-RNL5TAQT.mjs.map → chunk-6UDHM6YZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-2X7A4HUS.mjs.map → chunk-6ZQWPHLV.mjs.map} +0 -0
- /package/dist/esm/{chunk-4NHWV5AI.mjs.map → chunk-76OH2Z4Q.mjs.map} +0 -0
- /package/dist/esm/{chunk-5EN52MUT.mjs.map → chunk-77NXCSLY.mjs.map} +0 -0
- /package/dist/esm/{chunk-ND6OMSQU.mjs.map → chunk-7Y45UTRL.mjs.map} +0 -0
- /package/dist/esm/{chunk-T2AGN5YT.mjs.map → chunk-A2Z7I2EY.mjs.map} +0 -0
- /package/dist/esm/{chunk-3XFID2N4.mjs.map → chunk-AVH5SYTL.mjs.map} +0 -0
- /package/dist/esm/{chunk-3N6N3KOS.mjs.map → chunk-AYKZA676.mjs.map} +0 -0
- /package/dist/esm/{chunk-QRS4DGP3.mjs.map → chunk-BF46IXHH.mjs.map} +0 -0
- /package/dist/esm/{chunk-PF57EOJY.mjs.map → chunk-BOYYQAB4.mjs.map} +0 -0
- /package/dist/esm/{chunk-RPND23OR.mjs.map → chunk-BS7EVBWX.mjs.map} +0 -0
- /package/dist/esm/{chunk-JX75UKJX.mjs.map → chunk-BVB3QII3.mjs.map} +0 -0
- /package/dist/esm/{chunk-KZZWY4YI.mjs.map → chunk-C5V4EBVP.mjs.map} +0 -0
- /package/dist/esm/{chunk-3BNA74V5.mjs.map → chunk-CZ6TC4GO.mjs.map} +0 -0
- /package/dist/esm/{chunk-2HF2XEHO.mjs.map → chunk-DLDGUTFV.mjs.map} +0 -0
- /package/dist/esm/{chunk-YR7JRJ25.mjs.map → chunk-DPO352QL.mjs.map} +0 -0
- /package/dist/esm/{chunk-GM56MMNJ.mjs.map → chunk-DW2KZREM.mjs.map} +0 -0
- /package/dist/esm/{chunk-6YV3366Z.mjs.map → chunk-EAW6AWYD.mjs.map} +0 -0
- /package/dist/esm/{chunk-NUK6JT5I.mjs.map → chunk-EYIJYUN7.mjs.map} +0 -0
- /package/dist/esm/{chunk-AF5WNJOP.mjs.map → chunk-F74FF323.mjs.map} +0 -0
- /package/dist/esm/{chunk-ISIUQQMV.mjs.map → chunk-FNFQA7NS.mjs.map} +0 -0
- /package/dist/esm/{chunk-G2XVNF2T.mjs.map → chunk-FYB7C42X.mjs.map} +0 -0
- /package/dist/esm/{chunk-CEHCDA3G.mjs.map → chunk-H6YNXJNF.mjs.map} +0 -0
- /package/dist/esm/{chunk-47IIBESV.mjs.map → chunk-HCN7YJGB.mjs.map} +0 -0
- /package/dist/esm/{chunk-53INTTOI.mjs.map → chunk-JPDT6E3B.mjs.map} +0 -0
- /package/dist/esm/{chunk-J4VNDDKJ.mjs.map → chunk-JSWBLHMX.mjs.map} +0 -0
- /package/dist/esm/{chunk-73QJNN7O.mjs.map → chunk-K4CTCBLY.mjs.map} +0 -0
- /package/dist/esm/{chunk-AQAH67IV.mjs.map → chunk-K7DBDI2I.mjs.map} +0 -0
- /package/dist/esm/{chunk-PIVZMT5D.mjs.map → chunk-L22R3OIW.mjs.map} +0 -0
- /package/dist/esm/{chunk-4GWNWSZP.mjs.map → chunk-LVSOUCFD.mjs.map} +0 -0
- /package/dist/esm/{chunk-AHW3SKT7.mjs.map → chunk-M3JHXCGV.mjs.map} +0 -0
- /package/dist/esm/{chunk-ZRKXS7XG.mjs.map → chunk-MHZ64FIW.mjs.map} +0 -0
- /package/dist/esm/{chunk-UGPALAPN.mjs.map → chunk-MLDQ2TY2.mjs.map} +0 -0
- /package/dist/esm/{chunk-R5VVKRJ2.mjs.map → chunk-NNQYSSLH.mjs.map} +0 -0
- /package/dist/esm/{chunk-CZOD4SCZ.mjs.map → chunk-NSQLZBCA.mjs.map} +0 -0
- /package/dist/esm/{chunk-KAGLWBIJ.mjs.map → chunk-OPGMT27G.mjs.map} +0 -0
- /package/dist/esm/{chunk-N3U47Y6Y.mjs.map → chunk-P5V7OZNN.mjs.map} +0 -0
- /package/dist/esm/{chunk-337U6Q6K.mjs.map → chunk-PTA3VHTQ.mjs.map} +0 -0
- /package/dist/esm/{chunk-BEVXJJJF.mjs.map → chunk-QL2QFRKV.mjs.map} +0 -0
- /package/dist/esm/{chunk-U3YYSIIT.mjs.map → chunk-RFA7BIDN.mjs.map} +0 -0
- /package/dist/esm/{chunk-G56GPLTB.mjs.map → chunk-RJ4RKVVQ.mjs.map} +0 -0
- /package/dist/esm/{chunk-BBVIJO6X.mjs.map → chunk-S32JHML7.mjs.map} +0 -0
- /package/dist/esm/{chunk-3SPIFLBZ.mjs.map → chunk-SLFAROVZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-CT2BQQTZ.mjs.map → chunk-TG2LLWVU.mjs.map} +0 -0
- /package/dist/esm/{chunk-35EWRSDK.mjs.map → chunk-TY4IEDJD.mjs.map} +0 -0
- /package/dist/esm/{chunk-G2UPF44Z.mjs.map → chunk-UAZUO75M.mjs.map} +0 -0
- /package/dist/esm/{chunk-HLC4HAYY.mjs.map → chunk-UGVNOSD3.mjs.map} +0 -0
- /package/dist/esm/{chunk-LGNSPATO.mjs.map → chunk-VCMP3MXN.mjs.map} +0 -0
- /package/dist/esm/{chunk-ROXFCLDT.mjs.map → chunk-WV5AD4IE.mjs.map} +0 -0
- /package/dist/esm/{chunk-CE65OKFI.mjs.map → chunk-XWVU4G57.mjs.map} +0 -0
- /package/dist/esm/{chunk-ZHCSSCC5.mjs.map → chunk-XYLM277Z.mjs.map} +0 -0
- /package/dist/esm/{chunk-FAFJKSVZ.mjs.map → chunk-YMUCYX3B.mjs.map} +0 -0
- /package/dist/esm/{chunk-SRDIYE3M.mjs.map → chunk-YPHH6CAO.mjs.map} +0 -0
- /package/dist/esm/{chunk-B7X6PSE7.mjs.map → chunk-YUNDX5I7.mjs.map} +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
|
}
|
|
@@ -0,0 +1,129 @@
|
|
|
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 {
|
|
13
|
+
EphemeralSignature,
|
|
14
|
+
Groth16Zkp,
|
|
15
|
+
Hex,
|
|
16
|
+
KeylessPublicKey,
|
|
17
|
+
ZeroKnowledgeSig,
|
|
18
|
+
ZkProof,
|
|
19
|
+
getKeylessConfig,
|
|
20
|
+
} from "../core";
|
|
21
|
+
import { HexInput, ZkpVariant } from "../types";
|
|
22
|
+
import { EphemeralKeyPair, KeylessAccount, ProofFetchCallback } from "../account";
|
|
23
|
+
import { PepperFetchRequest, PepperFetchResponse, ProverRequest, ProverResponse } from "../types/keyless";
|
|
24
|
+
import { nowInSeconds } from "../utils/helpers";
|
|
25
|
+
import { lookupOriginalAccountAddress } from "./account";
|
|
26
|
+
|
|
27
|
+
export async function getPepper(args: {
|
|
28
|
+
aptosConfig: AptosConfig;
|
|
29
|
+
jwt: string;
|
|
30
|
+
ephemeralKeyPair: EphemeralKeyPair;
|
|
31
|
+
uidKey?: string;
|
|
32
|
+
derivationPath?: string;
|
|
33
|
+
}): Promise<Uint8Array> {
|
|
34
|
+
const { aptosConfig, jwt, ephemeralKeyPair, uidKey = "sub", derivationPath } = args;
|
|
35
|
+
|
|
36
|
+
const body = {
|
|
37
|
+
jwt_b64: jwt,
|
|
38
|
+
epk: ephemeralKeyPair.getPublicKey().bcsToHex().toStringWithoutPrefix(),
|
|
39
|
+
exp_date_secs: ephemeralKeyPair.expiryDateSecs,
|
|
40
|
+
epk_blinder: Hex.fromHexInput(ephemeralKeyPair.blinder).toStringWithoutPrefix(),
|
|
41
|
+
uid_key: uidKey,
|
|
42
|
+
derivation_path: derivationPath,
|
|
43
|
+
};
|
|
44
|
+
const { data } = await postAptosPepperService<PepperFetchRequest, PepperFetchResponse>({
|
|
45
|
+
aptosConfig,
|
|
46
|
+
path: "fetch",
|
|
47
|
+
body,
|
|
48
|
+
originMethod: "getPepper",
|
|
49
|
+
overrides: { WITH_CREDENTIALS: false },
|
|
50
|
+
});
|
|
51
|
+
return Hex.fromHexInput(data.pepper).toUint8Array();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export async function getProof(args: {
|
|
55
|
+
aptosConfig: AptosConfig;
|
|
56
|
+
jwt: string;
|
|
57
|
+
ephemeralKeyPair: EphemeralKeyPair;
|
|
58
|
+
pepper?: HexInput;
|
|
59
|
+
uidKey?: string;
|
|
60
|
+
}): Promise<ZeroKnowledgeSig> {
|
|
61
|
+
const { aptosConfig, jwt, ephemeralKeyPair, pepper = await getPepper(args), uidKey = "sub" } = args;
|
|
62
|
+
if (Hex.fromHexInput(pepper).toUint8Array().length !== KeylessAccount.PEPPER_LENGTH) {
|
|
63
|
+
throw new Error(`Pepper needs to be ${KeylessAccount.PEPPER_LENGTH} bytes`);
|
|
64
|
+
}
|
|
65
|
+
const { maxExpHorizonSecs } = await getKeylessConfig({ aptosConfig });
|
|
66
|
+
if (maxExpHorizonSecs < ephemeralKeyPair.expiryDateSecs - nowInSeconds()) {
|
|
67
|
+
throw Error(`The EphemeralKeyPair is too long lived. It's lifespan must be less than ${maxExpHorizonSecs}`);
|
|
68
|
+
}
|
|
69
|
+
const json = {
|
|
70
|
+
jwt_b64: jwt,
|
|
71
|
+
epk: ephemeralKeyPair.getPublicKey().bcsToHex().toStringWithoutPrefix(),
|
|
72
|
+
epk_blinder: Hex.fromHexInput(ephemeralKeyPair.blinder).toStringWithoutPrefix(),
|
|
73
|
+
exp_date_secs: ephemeralKeyPair.expiryDateSecs,
|
|
74
|
+
exp_horizon_secs: maxExpHorizonSecs,
|
|
75
|
+
pepper: Hex.fromHexInput(pepper).toStringWithoutPrefix(),
|
|
76
|
+
uid_key: uidKey,
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const { data } = await postAptosProvingService<ProverRequest, ProverResponse>({
|
|
80
|
+
aptosConfig,
|
|
81
|
+
path: "prove",
|
|
82
|
+
body: json,
|
|
83
|
+
originMethod: "getProof",
|
|
84
|
+
overrides: { WITH_CREDENTIALS: false },
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
const proofPoints = data.proof;
|
|
88
|
+
const groth16Zkp = new Groth16Zkp({
|
|
89
|
+
a: proofPoints.a,
|
|
90
|
+
b: proofPoints.b,
|
|
91
|
+
c: proofPoints.c,
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
const signedProof = new ZeroKnowledgeSig({
|
|
95
|
+
proof: new ZkProof(groth16Zkp, ZkpVariant.Groth16),
|
|
96
|
+
trainingWheelsSignature: EphemeralSignature.fromHex(data.training_wheels_signature),
|
|
97
|
+
expHorizonSecs: maxExpHorizonSecs,
|
|
98
|
+
});
|
|
99
|
+
return signedProof;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export async function deriveKeylessAccount(args: {
|
|
103
|
+
aptosConfig: AptosConfig;
|
|
104
|
+
jwt: string;
|
|
105
|
+
ephemeralKeyPair: EphemeralKeyPair;
|
|
106
|
+
uidKey?: string;
|
|
107
|
+
pepper?: HexInput;
|
|
108
|
+
proofFetchCallback?: ProofFetchCallback;
|
|
109
|
+
}): Promise<KeylessAccount> {
|
|
110
|
+
const { aptosConfig, jwt, uidKey, proofFetchCallback, pepper = await getPepper(args) } = args;
|
|
111
|
+
const proofPromise = getProof({ ...args, pepper });
|
|
112
|
+
// If a callback is provided, pass in the proof as a promise to KeylessAccount.create. This will make the proof be fetched in the
|
|
113
|
+
// background and the callback will handle the outcome of the fetch. This allows the developer to not have to block on the proof fetch
|
|
114
|
+
// allowing for faster rendering of UX.
|
|
115
|
+
//
|
|
116
|
+
// If no callback is provided, the just await the proof fetch and continue syncronously.
|
|
117
|
+
const proof = proofFetchCallback ? proofPromise : await proofPromise;
|
|
118
|
+
|
|
119
|
+
// Look up the original address to handle key rotations
|
|
120
|
+
const publicKey = KeylessPublicKey.fromJwtAndPepper({ jwt, pepper, uidKey });
|
|
121
|
+
const address = await lookupOriginalAccountAddress({
|
|
122
|
+
aptosConfig,
|
|
123
|
+
authenticationKey: publicKey.authKey().derivedAddress(),
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
const keylessAccount = KeylessAccount.create({ ...args, address, proof, pepper, proofFetchCallback });
|
|
127
|
+
|
|
128
|
+
return keylessAccount;
|
|
129
|
+
}
|
|
@@ -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()}`,
|
|
@@ -61,6 +61,9 @@ export function generateSigningMessage(bytes: Uint8Array, domainSeparator: strin
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
/**
|
|
64
|
+
* @deprecated
|
|
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,14 @@
|
|
|
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
|
+
KeylessSignature,
|
|
17
|
+
Secp256k1PublicKey,
|
|
18
|
+
Secp256k1Signature,
|
|
19
|
+
} from "../../core/crypto";
|
|
13
20
|
import { Ed25519PublicKey, Ed25519Signature } from "../../core/crypto/ed25519";
|
|
14
21
|
import { getInfo } from "../../internal/account";
|
|
15
22
|
import { getLedgerInfo } from "../../internal/general";
|
|
@@ -445,6 +452,11 @@ export function generateSignedTransactionForSimulation(args: InputSimulateTransa
|
|
|
445
452
|
}
|
|
446
453
|
|
|
447
454
|
export function getAuthenticatorForSimulation(publicKey: PublicKey) {
|
|
455
|
+
if (publicKey instanceof KeylessPublicKey || publicKey instanceof Secp256k1PublicKey) {
|
|
456
|
+
// eslint-disable-next-line no-param-reassign
|
|
457
|
+
publicKey = new AnyPublicKey(publicKey);
|
|
458
|
+
}
|
|
459
|
+
|
|
448
460
|
// TODO add support for AnyMultiKey
|
|
449
461
|
if (publicKey instanceof AnyPublicKey) {
|
|
450
462
|
if (publicKey.publicKey instanceof Ed25519PublicKey) {
|
|
@@ -453,6 +465,9 @@ export function getAuthenticatorForSimulation(publicKey: PublicKey) {
|
|
|
453
465
|
if (publicKey.publicKey instanceof Secp256k1PublicKey) {
|
|
454
466
|
return new AccountAuthenticatorSingleKey(publicKey, new AnySignature(new Secp256k1Signature(new Uint8Array(64))));
|
|
455
467
|
}
|
|
468
|
+
if (publicKey.publicKey instanceof KeylessPublicKey) {
|
|
469
|
+
return new AccountAuthenticatorSingleKey(publicKey, new AnySignature(KeylessSignature.getSimulationSignature()));
|
|
470
|
+
}
|
|
456
471
|
}
|
|
457
472
|
|
|
458
473
|
// legacy code
|
|
@@ -49,13 +49,13 @@ export type CurrentTokenOwnershipFieldsFragment = {
|
|
|
49
49
|
last_transaction_timestamp: any;
|
|
50
50
|
last_transaction_version: any;
|
|
51
51
|
maximum?: any | null;
|
|
52
|
-
supply
|
|
52
|
+
supply?: any | null;
|
|
53
53
|
token_data_id: string;
|
|
54
54
|
token_name: string;
|
|
55
55
|
token_properties: any;
|
|
56
56
|
token_standard: string;
|
|
57
57
|
token_uri: string;
|
|
58
|
-
decimals
|
|
58
|
+
decimals?: any | null;
|
|
59
59
|
current_collection?: {
|
|
60
60
|
collection_id: string;
|
|
61
61
|
collection_name: string;
|
|
@@ -206,13 +206,13 @@ export type GetAccountOwnedTokensQuery = {
|
|
|
206
206
|
last_transaction_timestamp: any;
|
|
207
207
|
last_transaction_version: any;
|
|
208
208
|
maximum?: any | null;
|
|
209
|
-
supply
|
|
209
|
+
supply?: any | null;
|
|
210
210
|
token_data_id: string;
|
|
211
211
|
token_name: string;
|
|
212
212
|
token_properties: any;
|
|
213
213
|
token_standard: string;
|
|
214
214
|
token_uri: string;
|
|
215
|
-
decimals
|
|
215
|
+
decimals?: any | null;
|
|
216
216
|
current_collection?: {
|
|
217
217
|
collection_id: string;
|
|
218
218
|
collection_name: string;
|
|
@@ -262,13 +262,13 @@ export type GetAccountOwnedTokensByTokenDataQuery = {
|
|
|
262
262
|
last_transaction_timestamp: any;
|
|
263
263
|
last_transaction_version: any;
|
|
264
264
|
maximum?: any | null;
|
|
265
|
-
supply
|
|
265
|
+
supply?: any | null;
|
|
266
266
|
token_data_id: string;
|
|
267
267
|
token_name: string;
|
|
268
268
|
token_properties: any;
|
|
269
269
|
token_standard: string;
|
|
270
270
|
token_uri: string;
|
|
271
|
-
decimals
|
|
271
|
+
decimals?: any | null;
|
|
272
272
|
current_collection?: {
|
|
273
273
|
collection_id: string;
|
|
274
274
|
collection_name: string;
|
|
@@ -318,13 +318,13 @@ export type GetAccountOwnedTokensFromCollectionQuery = {
|
|
|
318
318
|
last_transaction_timestamp: any;
|
|
319
319
|
last_transaction_version: any;
|
|
320
320
|
maximum?: any | null;
|
|
321
|
-
supply
|
|
321
|
+
supply?: any | null;
|
|
322
322
|
token_data_id: string;
|
|
323
323
|
token_name: string;
|
|
324
324
|
token_properties: any;
|
|
325
325
|
token_standard: string;
|
|
326
326
|
token_uri: string;
|
|
327
|
-
decimals
|
|
327
|
+
decimals?: any | null;
|
|
328
328
|
current_collection?: {
|
|
329
329
|
collection_id: string;
|
|
330
330
|
collection_name: string;
|
|
@@ -496,6 +496,8 @@ export type GetFungibleAssetMetadataQuery = {
|
|
|
496
496
|
name: string;
|
|
497
497
|
symbol: string;
|
|
498
498
|
token_standard: string;
|
|
499
|
+
supply_v2?: any | null;
|
|
500
|
+
maximum_v2?: any | null;
|
|
499
501
|
}>;
|
|
500
502
|
};
|
|
501
503
|
|
|
@@ -620,13 +622,13 @@ export type GetCurrentTokenOwnershipQuery = {
|
|
|
620
622
|
last_transaction_timestamp: any;
|
|
621
623
|
last_transaction_version: any;
|
|
622
624
|
maximum?: any | null;
|
|
623
|
-
supply
|
|
625
|
+
supply?: any | null;
|
|
624
626
|
token_data_id: string;
|
|
625
627
|
token_name: string;
|
|
626
628
|
token_properties: any;
|
|
627
629
|
token_standard: string;
|
|
628
630
|
token_uri: string;
|
|
629
|
-
decimals
|
|
631
|
+
decimals?: any | null;
|
|
630
632
|
current_collection?: {
|
|
631
633
|
collection_id: string;
|
|
632
634
|
collection_name: string;
|
|
@@ -663,13 +665,13 @@ export type GetTokenDataQuery = {
|
|
|
663
665
|
last_transaction_timestamp: any;
|
|
664
666
|
last_transaction_version: any;
|
|
665
667
|
maximum?: any | null;
|
|
666
|
-
supply
|
|
668
|
+
supply?: any | null;
|
|
667
669
|
token_data_id: string;
|
|
668
670
|
token_name: string;
|
|
669
671
|
token_properties: any;
|
|
670
672
|
token_standard: string;
|
|
671
673
|
token_uri: string;
|
|
672
|
-
decimals
|
|
674
|
+
decimals?: any | null;
|
|
673
675
|
current_collection?: {
|
|
674
676
|
collection_id: string;
|
|
675
677
|
collection_name: string;
|