@aptos-labs/ts-sdk 1.8.0 → 1.9.1-plugin.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/common/index.d.ts +1204 -969
- package/dist/common/index.js +26 -26
- package/dist/common/index.js.map +1 -1
- package/dist/esm/api/account.d.mts +12 -6
- package/dist/esm/api/account.mjs +1 -1
- package/dist/esm/api/ans.d.mts +11 -12
- package/dist/esm/api/ans.mjs +1 -1
- package/dist/esm/api/aptos.d.mts +13 -14
- package/dist/esm/api/aptos.mjs +1 -1
- package/dist/esm/api/aptosConfig.d.mts +7 -0
- package/dist/esm/api/aptosConfig.mjs +1 -1
- package/dist/esm/api/coin.d.mts +13 -13
- package/dist/esm/api/coin.mjs +1 -1
- package/dist/esm/api/digitalAsset.d.mts +20 -10
- package/dist/esm/api/digitalAsset.mjs +1 -1
- package/dist/esm/api/event.mjs +1 -1
- package/dist/esm/api/faucet.mjs +1 -1
- package/dist/esm/api/fungibleAsset.d.mts +9 -10
- package/dist/esm/api/fungibleAsset.mjs +1 -1
- package/dist/esm/api/general.mjs +1 -1
- package/dist/esm/api/index.d.mts +13 -14
- package/dist/esm/api/index.mjs +1 -1
- package/dist/esm/api/staking.mjs +1 -1
- package/dist/esm/api/transaction.d.mts +5 -6
- package/dist/esm/api/transaction.mjs +1 -1
- package/dist/esm/api/transactionSubmission/build.d.mts +8 -8
- package/dist/esm/api/transactionSubmission/build.mjs +1 -1
- package/dist/esm/api/transactionSubmission/management.d.mts +11 -12
- package/dist/esm/api/transactionSubmission/management.mjs +1 -1
- package/dist/esm/api/transactionSubmission/sign.d.mts +11 -12
- 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 +11 -11
- package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
- package/dist/esm/api/transactionSubmission/submit.d.mts +6 -6
- package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
- package/dist/esm/api/utils.mjs +1 -1
- package/dist/esm/assetUploader/assetUploader.d.mts +109 -0
- package/dist/esm/assetUploader/assetUploader.mjs +2 -0
- package/dist/esm/assetUploader/index.d.mts +24 -0
- package/dist/esm/assetUploader/index.mjs +2 -0
- package/dist/esm/assetUploader/irys.d.mts +64 -0
- package/dist/esm/assetUploader/irys.mjs +2 -0
- 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.mjs +1 -1
- package/dist/esm/chunk-2RRFFRBV.mjs +2 -0
- package/dist/esm/chunk-2RRFFRBV.mjs.map +1 -0
- package/dist/esm/chunk-4LUWUDBX.mjs +2 -0
- package/dist/esm/{chunk-O57QZZF2.mjs → chunk-53UNV6UP.mjs} +2 -2
- package/dist/esm/chunk-53UNV6UP.mjs.map +1 -0
- package/dist/esm/{chunk-7D5LHQNS.mjs → chunk-5PIO6MFF.mjs} +2 -2
- package/dist/esm/{chunk-VKZCIGKY.mjs → chunk-6TUHLGW3.mjs} +2 -2
- package/dist/esm/{chunk-ENDUXRTK.mjs → chunk-7KPEDF2R.mjs} +2 -2
- package/dist/esm/chunk-AJRBTHDS.mjs +2 -0
- package/dist/esm/chunk-AJRBTHDS.mjs.map +1 -0
- package/dist/esm/chunk-AXVVJKE4.mjs +2 -0
- package/dist/esm/chunk-BKWJ4G7T.mjs +2 -0
- package/dist/esm/{chunk-VRSUCKJA.mjs.map → chunk-BKWJ4G7T.mjs.map} +1 -1
- package/dist/esm/{chunk-NL72WE3E.mjs → chunk-BZMO6Q6L.mjs} +2 -2
- package/dist/esm/chunk-CNEVWSWR.mjs +2 -0
- package/dist/esm/chunk-CNEVWSWR.mjs.map +1 -0
- package/dist/esm/chunk-CUWAGKEP.mjs +2 -0
- package/dist/esm/chunk-CUWAGKEP.mjs.map +1 -0
- package/dist/esm/chunk-DQHNZBA5.mjs +2 -0
- package/dist/esm/chunk-DQHNZBA5.mjs.map +1 -0
- package/dist/esm/{chunk-XBVORX5O.mjs → chunk-FAAWSTXC.mjs} +2 -2
- package/dist/esm/{chunk-AFPJ2XXN.mjs → chunk-FHWAJCJR.mjs} +2 -2
- package/dist/esm/{chunk-VPQ46CAO.mjs → chunk-GE7VQ5NZ.mjs} +2 -2
- package/dist/esm/{chunk-6FBKUTGF.mjs → chunk-GHYE26Q5.mjs} +2 -2
- package/dist/esm/chunk-GTCDSGOA.mjs +2 -0
- package/dist/esm/chunk-GTCDSGOA.mjs.map +1 -0
- package/dist/esm/chunk-H2FRCXQ6.mjs +2 -0
- package/dist/esm/chunk-H2FRCXQ6.mjs.map +1 -0
- package/dist/esm/chunk-HEPV52CH.mjs +2 -0
- package/dist/esm/chunk-HEPV52CH.mjs.map +1 -0
- package/dist/esm/chunk-HIUJDWMR.mjs +2 -0
- package/dist/esm/{chunk-MEPX7Z2Z.mjs.map → chunk-HIUJDWMR.mjs.map} +1 -1
- package/dist/esm/{chunk-2H5Z5EHH.mjs → chunk-HKAJ5N25.mjs} +2 -2
- package/dist/esm/chunk-HRKLPZL5.mjs +2 -0
- package/dist/esm/chunk-HRKLPZL5.mjs.map +1 -0
- package/dist/esm/{chunk-PJNPLRPR.mjs → chunk-HWTX3HVX.mjs} +2 -2
- package/dist/esm/chunk-IFVMIUMO.mjs +2 -0
- package/dist/esm/{chunk-6SRENFWH.mjs → chunk-IMYKTNDV.mjs} +2 -2
- package/dist/esm/{chunk-PMWH5IGI.mjs → chunk-ITALFUWD.mjs} +2 -2
- package/dist/esm/chunk-JB7ZOUYL.mjs +2 -0
- package/dist/esm/{chunk-2WFMD6C6.mjs → chunk-JMR7G5DT.mjs} +2 -2
- package/dist/esm/{chunk-S64WKSMI.mjs → chunk-JOIUR5QW.mjs} +2 -2
- package/dist/esm/{chunk-F7CR75CJ.mjs → chunk-JPG25VX2.mjs} +2 -2
- package/dist/esm/{chunk-F7CR75CJ.mjs.map → chunk-JPG25VX2.mjs.map} +1 -1
- package/dist/esm/{chunk-4OI7MPFH.mjs → chunk-K5XJKIFT.mjs} +2 -2
- package/dist/esm/chunk-KUX6GQ2E.mjs +1 -0
- package/dist/esm/{chunk-Q5HK3U64.mjs → chunk-L4PAU62E.mjs} +2 -2
- package/dist/esm/chunk-L7ORFGZ7.mjs +1 -0
- package/dist/esm/chunk-LG7RJQ57.mjs +2 -0
- package/dist/esm/chunk-LKKOIIBF.mjs +2 -0
- package/dist/esm/chunk-LKKOIIBF.mjs.map +1 -0
- package/dist/esm/chunk-M6TKSJ4I.mjs +2 -0
- package/dist/esm/chunk-ML7VTAHR.mjs +2 -0
- package/dist/esm/chunk-ML7VTAHR.mjs.map +1 -0
- package/dist/esm/{chunk-2DNPRIS5.mjs → chunk-MVWTTVQZ.mjs} +2 -2
- package/dist/esm/chunk-NA2H44NE.mjs +2 -0
- package/dist/esm/{chunk-CVEJHRAU.mjs → chunk-NCDLIACO.mjs} +1 -1
- package/dist/esm/chunk-NCDLIACO.mjs.map +1 -0
- package/dist/esm/chunk-NF35PRGD.mjs +2 -0
- package/dist/esm/{chunk-XZYPAQCU.mjs.map → chunk-NF35PRGD.mjs.map} +1 -1
- package/dist/esm/{chunk-R56OJ4XC.mjs → chunk-NYGCJ6EJ.mjs} +2 -2
- package/dist/esm/{chunk-PIXE7MN5.mjs → chunk-NZGON5TY.mjs} +2 -2
- package/dist/esm/chunk-O4EVRHDH.mjs +2 -0
- package/dist/esm/chunk-O4EVRHDH.mjs.map +1 -0
- package/dist/esm/{chunk-Y4AKS4CY.mjs → chunk-O5Q3RSEJ.mjs} +2 -2
- package/dist/esm/chunk-OP4VV2UO.mjs +2 -0
- package/dist/esm/chunk-OP4VV2UO.mjs.map +1 -0
- package/dist/esm/chunk-OYQRQC4Z.mjs +2 -0
- package/dist/esm/chunk-OYQRQC4Z.mjs.map +1 -0
- package/dist/esm/chunk-P3CMSOX6.mjs +2 -0
- package/dist/esm/chunk-P3CMSOX6.mjs.map +1 -0
- package/dist/esm/{chunk-LATJGGVX.mjs → chunk-PATJMQAG.mjs} +2 -2
- package/dist/esm/chunk-PEOCYUOO.mjs +2 -0
- package/dist/esm/chunk-PEOCYUOO.mjs.map +1 -0
- package/dist/esm/chunk-PISONN6H.mjs +2 -0
- package/dist/esm/chunk-PISONN6H.mjs.map +1 -0
- package/dist/esm/chunk-Q6YMSZLY.mjs +2 -0
- package/dist/esm/{chunk-SRZTA6QH.mjs.map → chunk-Q6YMSZLY.mjs.map} +1 -1
- package/dist/esm/chunk-QE4ASJ5K.mjs +1 -0
- package/dist/esm/chunk-QE4ASJ5K.mjs.map +1 -0
- package/dist/esm/{chunk-SXIFL5DQ.mjs → chunk-RC5K63LK.mjs} +2 -2
- package/dist/esm/chunk-RZNFFGTD.mjs +2 -0
- package/dist/esm/chunk-RZNFFGTD.mjs.map +1 -0
- package/dist/esm/{chunk-QGIJNA37.mjs → chunk-SKF6E6X7.mjs} +2 -2
- package/dist/esm/{chunk-ENKMOALS.mjs → chunk-SPKBGDFY.mjs} +2 -2
- package/dist/esm/chunk-SPKBGDFY.mjs.map +1 -0
- package/dist/esm/chunk-TWHTXYMB.mjs +2 -0
- package/dist/esm/{chunk-JQVT2K7G.mjs → chunk-UCFIV5UD.mjs} +2 -2
- package/dist/esm/{chunk-JJ6Y35DF.mjs → chunk-UFD443TT.mjs} +2 -2
- package/dist/esm/chunk-UVSRX4SV.mjs +1 -0
- package/dist/esm/chunk-UVSRX4SV.mjs.map +1 -0
- package/dist/esm/{chunk-M3WNE7MU.mjs → chunk-UVTSJ2KP.mjs} +2 -2
- package/dist/esm/{chunk-KJGQ4ILY.mjs → chunk-UZ3SFWTM.mjs} +2 -2
- package/dist/esm/{chunk-V2FPYAK7.mjs → chunk-VPN3KEVB.mjs} +2 -2
- package/dist/esm/chunk-VQM4LMCW.mjs +2 -0
- package/dist/esm/{chunk-W4UDMBMU.mjs → chunk-VWWR2UAQ.mjs} +2 -2
- package/dist/esm/{chunk-F7MOQC7Z.mjs → chunk-VZJ62XF7.mjs} +2 -2
- package/dist/esm/{chunk-N4RBQZ2B.mjs → chunk-W2XLZW4Y.mjs} +2 -2
- package/dist/esm/{chunk-FRLPX47J.mjs → chunk-XH4B5K6W.mjs} +2 -2
- package/dist/esm/{chunk-4M46AWXX.mjs → chunk-XSCYT6TT.mjs} +2 -2
- package/dist/esm/{chunk-EUHPML5E.mjs → chunk-XSYZX66A.mjs} +2 -2
- package/dist/esm/{chunk-SPOHAEHR.mjs → chunk-YTHL7EKV.mjs} +2 -2
- package/dist/esm/{chunk-Q3HAJVCM.mjs → chunk-YXUOYXGZ.mjs} +2 -2
- package/dist/esm/chunk-ZAMLI7FP.mjs +2 -0
- package/dist/esm/chunk-ZAMLI7FP.mjs.map +1 -0
- package/dist/esm/client/core.mjs +1 -1
- package/dist/esm/client/get.mjs +1 -1
- package/dist/esm/client/index.mjs +1 -1
- package/dist/esm/client/post.mjs +1 -1
- package/dist/esm/client/types.mjs +1 -1
- package/dist/esm/core/account/Account.d.mts +20 -0
- package/dist/esm/core/account/Account.mjs +2 -0
- package/dist/esm/core/account/Account.mjs.map +1 -0
- package/dist/esm/core/account/Ed25519Account.d.mts +20 -0
- package/dist/esm/core/account/Ed25519Account.mjs +2 -0
- package/dist/esm/core/account/Ed25519Account.mjs.map +1 -0
- package/dist/esm/core/account/SingleKeyAccount.d.mts +20 -0
- package/dist/esm/core/account/SingleKeyAccount.mjs +2 -0
- package/dist/esm/core/account/SingleKeyAccount.mjs.map +1 -0
- package/dist/esm/core/account/index.d.mts +305 -0
- package/dist/esm/core/account/index.mjs +2 -0
- package/dist/esm/core/account/index.mjs.map +1 -0
- package/dist/esm/core/accountAddress.mjs +1 -1
- package/dist/esm/core/authenticationKey.d.mts +7 -68
- package/dist/esm/core/authenticationKey.mjs +1 -1
- package/dist/esm/core/common.mjs +1 -1
- package/dist/esm/core/crypto/ed25519.d.mts +49 -61
- package/dist/esm/core/crypto/ed25519.mjs +1 -1
- package/dist/esm/core/crypto/index.d.mts +9 -6
- package/dist/esm/core/crypto/index.mjs +1 -1
- package/dist/esm/core/crypto/multiEd25519.d.mts +17 -14
- package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
- package/dist/esm/core/crypto/multiKey.d.mts +70 -17
- package/dist/esm/core/crypto/multiKey.mjs +1 -1
- package/dist/esm/core/crypto/privateKey.d.mts +35 -0
- package/dist/esm/core/crypto/privateKey.mjs +2 -0
- package/dist/esm/core/crypto/privateKey.mjs.map +1 -0
- package/dist/esm/core/crypto/publicKey.d.mts +13 -0
- package/dist/esm/core/crypto/publicKey.mjs +2 -0
- package/dist/esm/core/crypto/publicKey.mjs.map +1 -0
- package/dist/esm/core/crypto/secp256k1.d.mts +43 -67
- package/dist/esm/core/crypto/secp256k1.mjs +1 -1
- package/dist/esm/core/crypto/signature.d.mts +28 -0
- package/dist/esm/core/crypto/signature.mjs +2 -0
- package/dist/esm/core/crypto/signature.mjs.map +1 -0
- package/dist/esm/core/crypto/singleKey.d.mts +68 -0
- package/dist/esm/core/crypto/singleKey.mjs +2 -0
- package/dist/esm/core/crypto/singleKey.mjs.map +1 -0
- package/dist/esm/core/hex.mjs +1 -1
- package/dist/esm/core/index.d.mts +9 -8
- package/dist/esm/core/index.mjs +1 -1
- package/dist/esm/index.d.mts +10 -8
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/internal/account.d.mts +9 -3
- package/dist/esm/internal/account.mjs +1 -1
- package/dist/esm/internal/ans.d.mts +10 -11
- package/dist/esm/internal/ans.mjs +1 -1
- package/dist/esm/internal/coin.d.mts +12 -12
- package/dist/esm/internal/coin.mjs +1 -1
- package/dist/esm/internal/digitalAsset.d.mts +17 -14
- package/dist/esm/internal/digitalAsset.mjs +1 -1
- package/dist/esm/internal/event.d.mts +2 -2
- package/dist/esm/internal/event.mjs +1 -1
- package/dist/esm/internal/faucet.d.mts +4 -4
- package/dist/esm/internal/faucet.mjs +1 -1
- package/dist/esm/internal/fungibleAsset.d.mts +10 -11
- package/dist/esm/internal/fungibleAsset.mjs +1 -1
- package/dist/esm/internal/general.mjs +1 -1
- package/dist/esm/internal/staking.d.mts +3 -3
- package/dist/esm/internal/staking.mjs +1 -1
- package/dist/esm/internal/transaction.mjs +1 -1
- package/dist/esm/internal/transactionSubmission.d.mts +12 -13
- package/dist/esm/internal/transactionSubmission.mjs +1 -1
- package/dist/esm/publicKey-B3XRNhHO.d.mts +113 -0
- package/dist/esm/transactions/authenticator/account.d.mts +6 -4
- package/dist/esm/transactions/authenticator/account.mjs +1 -1
- package/dist/esm/transactions/authenticator/index.d.mts +6 -6
- package/dist/esm/transactions/authenticator/index.mjs +1 -1
- package/dist/esm/transactions/authenticator/transaction.d.mts +5 -5
- package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
- package/dist/esm/transactions/index.d.mts +6 -7
- 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 +4 -4
- package/dist/esm/transactions/instances/index.mjs +1 -1
- package/dist/esm/transactions/instances/moduleId.d.mts +1 -1
- package/dist/esm/transactions/instances/moduleId.mjs +1 -1
- package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/rotationProofChallenge.d.mts +2 -1
- package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
- package/dist/esm/transactions/instances/signedTransaction.d.mts +8 -8
- package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/transactionPayload.d.mts +1 -1
- package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
- package/dist/esm/transactions/management/accountSequenceNumber.d.mts +11 -5
- package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
- package/dist/esm/transactions/management/index.d.mts +11 -12
- package/dist/esm/transactions/management/index.mjs +1 -1
- package/dist/esm/transactions/management/transactionWorker.d.mts +11 -12
- package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/helpers.d.mts +10 -10
- package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/index.d.mts +9 -10
- package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +8 -8
- package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +9 -10
- 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/transactions/types.d.mts +9 -9
- package/dist/esm/types/index.d.mts +1 -0
- package/dist/esm/types/index.mjs +1 -1
- package/dist/esm/utils/const.d.mts +1 -2
- package/dist/esm/utils/const.mjs +1 -1
- package/dist/esm/utils/index.d.mts +1 -1
- package/dist/esm/utils/index.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/api/aptosConfig.ts +11 -2
- package/src/api/digitalAsset.ts +20 -0
- package/src/assetUploader/assetUploader.ts +87 -0
- package/src/assetUploader/index.ts +1 -0
- package/src/assetUploader/irys.ts +102 -0
- package/src/core/account/Account.ts +245 -0
- package/src/core/account/Ed25519Account.ts +88 -0
- package/src/core/account/SingleKeyAccount.ts +120 -0
- package/src/core/account/index.ts +3 -0
- package/src/core/authenticationKey.ts +18 -52
- package/src/core/crypto/ed25519.ts +118 -104
- package/src/core/crypto/index.ts +6 -5
- package/src/core/crypto/multiEd25519.ts +98 -44
- package/src/core/crypto/multiKey.ts +192 -34
- package/src/core/crypto/privateKey.ts +25 -0
- package/src/core/crypto/publicKey.ts +52 -0
- package/src/core/crypto/secp256k1.ts +108 -111
- package/src/core/crypto/signature.ts +46 -0
- package/src/core/crypto/singleKey.ts +180 -0
- package/src/index.ts +1 -0
- package/src/internal/account.ts +5 -3
- package/src/internal/digitalAsset.ts +26 -0
- package/src/internal/queries/currentTokenOwnershipFieldsFragment.graphql +0 -1
- package/src/transactions/authenticator/account.ts +1 -2
- package/src/transactions/instances/rotationProofChallenge.ts +1 -1
- package/src/transactions/transactionBuilder/transactionBuilder.ts +3 -21
- package/src/transactions/types.ts +1 -1
- package/src/types/index.ts +2 -0
- package/src/utils/const.ts +0 -4
- package/src/version.ts +1 -1
- package/dist/browser/index.d.ts +0 -6997
- package/dist/browser/index.global.js +0 -483
- package/dist/browser/index.global.js.map +0 -1
- package/dist/esm/chunk-2QV6HI3M.mjs +0 -2
- package/dist/esm/chunk-2QV6HI3M.mjs.map +0 -1
- package/dist/esm/chunk-7IGH7N52.mjs +0 -2
- package/dist/esm/chunk-7IGH7N52.mjs.map +0 -1
- package/dist/esm/chunk-B2ZKW23W.mjs +0 -2
- package/dist/esm/chunk-CCUD52OF.mjs +0 -2
- package/dist/esm/chunk-CCUD52OF.mjs.map +0 -1
- package/dist/esm/chunk-CVEJHRAU.mjs.map +0 -1
- package/dist/esm/chunk-ENKMOALS.mjs.map +0 -1
- package/dist/esm/chunk-ERWQOVBF.mjs +0 -2
- package/dist/esm/chunk-ERWQOVBF.mjs.map +0 -1
- package/dist/esm/chunk-FBFMQZTM.mjs +0 -2
- package/dist/esm/chunk-FBFMQZTM.mjs.map +0 -1
- package/dist/esm/chunk-FBPNHF54.mjs +0 -2
- package/dist/esm/chunk-FP5DPRYL.mjs +0 -2
- package/dist/esm/chunk-FP5DPRYL.mjs.map +0 -1
- package/dist/esm/chunk-GD4ULEBC.mjs +0 -2
- package/dist/esm/chunk-GD5TZLBF.mjs +0 -2
- package/dist/esm/chunk-HHJBCGAQ.mjs +0 -2
- package/dist/esm/chunk-HHJBCGAQ.mjs.map +0 -1
- package/dist/esm/chunk-I7WRJY7K.mjs +0 -2
- package/dist/esm/chunk-I7WRJY7K.mjs.map +0 -1
- package/dist/esm/chunk-IHCIKE42.mjs +0 -2
- package/dist/esm/chunk-LHJSG5NE.mjs +0 -2
- package/dist/esm/chunk-LHJSG5NE.mjs.map +0 -1
- package/dist/esm/chunk-MEPX7Z2Z.mjs +0 -2
- package/dist/esm/chunk-NWRKJFHV.mjs +0 -2
- package/dist/esm/chunk-O57QZZF2.mjs.map +0 -1
- package/dist/esm/chunk-PPTG6BDV.mjs +0 -2
- package/dist/esm/chunk-QKTV6AZ7.mjs +0 -2
- package/dist/esm/chunk-QRQAR6XO.mjs +0 -2
- package/dist/esm/chunk-S3FBGS3W.mjs +0 -2
- package/dist/esm/chunk-S3FBGS3W.mjs.map +0 -1
- package/dist/esm/chunk-SBMJNU2O.mjs +0 -2
- package/dist/esm/chunk-SBMJNU2O.mjs.map +0 -1
- package/dist/esm/chunk-SRZTA6QH.mjs +0 -2
- package/dist/esm/chunk-UCHGKGCF.mjs +0 -2
- package/dist/esm/chunk-UCHGKGCF.mjs.map +0 -1
- package/dist/esm/chunk-UIVJXLRM.mjs +0 -1
- package/dist/esm/chunk-V6JFR2CB.mjs +0 -2
- package/dist/esm/chunk-V6JFR2CB.mjs.map +0 -1
- package/dist/esm/chunk-VRSUCKJA.mjs +0 -2
- package/dist/esm/chunk-XZYPAQCU.mjs +0 -2
- package/dist/esm/chunk-YL2EDK5M.mjs +0 -2
- package/dist/esm/chunk-YL2EDK5M.mjs.map +0 -1
- package/dist/esm/chunk-ZFIMVSCR.mjs +0 -2
- package/dist/esm/chunk-ZFIMVSCR.mjs.map +0 -1
- package/dist/esm/core/account.d.mts +0 -184
- package/dist/esm/core/account.mjs +0 -2
- package/dist/esm/core/crypto/anyPublicKey.d.mts +0 -59
- package/dist/esm/core/crypto/anyPublicKey.mjs +0 -2
- package/dist/esm/core/crypto/anySignature.d.mts +0 -31
- package/dist/esm/core/crypto/anySignature.mjs +0 -2
- package/dist/esm/core/crypto/asymmetricCrypto.d.mts +0 -74
- package/dist/esm/core/crypto/asymmetricCrypto.mjs +0 -2
- package/src/core/account.ts +0 -282
- package/src/core/crypto/anyPublicKey.ts +0 -92
- package/src/core/crypto/anySignature.ts +0 -56
- package/src/core/crypto/asymmetricCrypto.ts +0 -77
- /package/dist/esm/{chunk-UIVJXLRM.mjs.map → assetUploader/assetUploader.mjs.map} +0 -0
- /package/dist/esm/{core/account.mjs.map → assetUploader/index.mjs.map} +0 -0
- /package/dist/esm/{core/crypto/anyPublicKey.mjs.map → assetUploader/irys.mjs.map} +0 -0
- /package/dist/esm/{chunk-PPTG6BDV.mjs.map → chunk-4LUWUDBX.mjs.map} +0 -0
- /package/dist/esm/{chunk-7D5LHQNS.mjs.map → chunk-5PIO6MFF.mjs.map} +0 -0
- /package/dist/esm/{chunk-VKZCIGKY.mjs.map → chunk-6TUHLGW3.mjs.map} +0 -0
- /package/dist/esm/{chunk-ENDUXRTK.mjs.map → chunk-7KPEDF2R.mjs.map} +0 -0
- /package/dist/esm/{chunk-GD4ULEBC.mjs.map → chunk-AXVVJKE4.mjs.map} +0 -0
- /package/dist/esm/{chunk-NL72WE3E.mjs.map → chunk-BZMO6Q6L.mjs.map} +0 -0
- /package/dist/esm/{chunk-XBVORX5O.mjs.map → chunk-FAAWSTXC.mjs.map} +0 -0
- /package/dist/esm/{chunk-AFPJ2XXN.mjs.map → chunk-FHWAJCJR.mjs.map} +0 -0
- /package/dist/esm/{chunk-VPQ46CAO.mjs.map → chunk-GE7VQ5NZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-6FBKUTGF.mjs.map → chunk-GHYE26Q5.mjs.map} +0 -0
- /package/dist/esm/{chunk-2H5Z5EHH.mjs.map → chunk-HKAJ5N25.mjs.map} +0 -0
- /package/dist/esm/{chunk-PJNPLRPR.mjs.map → chunk-HWTX3HVX.mjs.map} +0 -0
- /package/dist/esm/{chunk-B2ZKW23W.mjs.map → chunk-IFVMIUMO.mjs.map} +0 -0
- /package/dist/esm/{chunk-6SRENFWH.mjs.map → chunk-IMYKTNDV.mjs.map} +0 -0
- /package/dist/esm/{chunk-PMWH5IGI.mjs.map → chunk-ITALFUWD.mjs.map} +0 -0
- /package/dist/esm/{chunk-NWRKJFHV.mjs.map → chunk-JB7ZOUYL.mjs.map} +0 -0
- /package/dist/esm/{chunk-2WFMD6C6.mjs.map → chunk-JMR7G5DT.mjs.map} +0 -0
- /package/dist/esm/{chunk-S64WKSMI.mjs.map → chunk-JOIUR5QW.mjs.map} +0 -0
- /package/dist/esm/{chunk-4OI7MPFH.mjs.map → chunk-K5XJKIFT.mjs.map} +0 -0
- /package/dist/esm/{core/crypto/anySignature.mjs.map → chunk-KUX6GQ2E.mjs.map} +0 -0
- /package/dist/esm/{chunk-Q5HK3U64.mjs.map → chunk-L4PAU62E.mjs.map} +0 -0
- /package/dist/esm/{core/crypto/asymmetricCrypto.mjs.map → chunk-L7ORFGZ7.mjs.map} +0 -0
- /package/dist/esm/{chunk-FBPNHF54.mjs.map → chunk-LG7RJQ57.mjs.map} +0 -0
- /package/dist/esm/{chunk-IHCIKE42.mjs.map → chunk-M6TKSJ4I.mjs.map} +0 -0
- /package/dist/esm/{chunk-2DNPRIS5.mjs.map → chunk-MVWTTVQZ.mjs.map} +0 -0
- /package/dist/esm/{chunk-GD5TZLBF.mjs.map → chunk-NA2H44NE.mjs.map} +0 -0
- /package/dist/esm/{chunk-R56OJ4XC.mjs.map → chunk-NYGCJ6EJ.mjs.map} +0 -0
- /package/dist/esm/{chunk-PIXE7MN5.mjs.map → chunk-NZGON5TY.mjs.map} +0 -0
- /package/dist/esm/{chunk-Y4AKS4CY.mjs.map → chunk-O5Q3RSEJ.mjs.map} +0 -0
- /package/dist/esm/{chunk-LATJGGVX.mjs.map → chunk-PATJMQAG.mjs.map} +0 -0
- /package/dist/esm/{chunk-SXIFL5DQ.mjs.map → chunk-RC5K63LK.mjs.map} +0 -0
- /package/dist/esm/{chunk-QGIJNA37.mjs.map → chunk-SKF6E6X7.mjs.map} +0 -0
- /package/dist/esm/{chunk-QKTV6AZ7.mjs.map → chunk-TWHTXYMB.mjs.map} +0 -0
- /package/dist/esm/{chunk-JQVT2K7G.mjs.map → chunk-UCFIV5UD.mjs.map} +0 -0
- /package/dist/esm/{chunk-JJ6Y35DF.mjs.map → chunk-UFD443TT.mjs.map} +0 -0
- /package/dist/esm/{chunk-M3WNE7MU.mjs.map → chunk-UVTSJ2KP.mjs.map} +0 -0
- /package/dist/esm/{chunk-KJGQ4ILY.mjs.map → chunk-UZ3SFWTM.mjs.map} +0 -0
- /package/dist/esm/{chunk-V2FPYAK7.mjs.map → chunk-VPN3KEVB.mjs.map} +0 -0
- /package/dist/esm/{chunk-QRQAR6XO.mjs.map → chunk-VQM4LMCW.mjs.map} +0 -0
- /package/dist/esm/{chunk-W4UDMBMU.mjs.map → chunk-VWWR2UAQ.mjs.map} +0 -0
- /package/dist/esm/{chunk-F7MOQC7Z.mjs.map → chunk-VZJ62XF7.mjs.map} +0 -0
- /package/dist/esm/{chunk-N4RBQZ2B.mjs.map → chunk-W2XLZW4Y.mjs.map} +0 -0
- /package/dist/esm/{chunk-FRLPX47J.mjs.map → chunk-XH4B5K6W.mjs.map} +0 -0
- /package/dist/esm/{chunk-4M46AWXX.mjs.map → chunk-XSCYT6TT.mjs.map} +0 -0
- /package/dist/esm/{chunk-EUHPML5E.mjs.map → chunk-XSYZX66A.mjs.map} +0 -0
- /package/dist/esm/{chunk-SPOHAEHR.mjs.map → chunk-YTHL7EKV.mjs.map} +0 -0
- /package/dist/esm/{chunk-Q3HAJVCM.mjs.map → chunk-YXUOYXGZ.mjs.map} +0 -0
package/dist/common/index.d.ts
CHANGED
|
@@ -1,35 +1,5 @@
|
|
|
1
1
|
import EventEmitter from 'eventemitter3';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* This error is used to explain why parsing failed.
|
|
5
|
-
*/
|
|
6
|
-
declare class ParsingError<T> extends Error {
|
|
7
|
-
/**
|
|
8
|
-
* This provides a programmatic way to access why parsing failed. Downstream devs
|
|
9
|
-
* might want to use this to build their own error messages if the default error
|
|
10
|
-
* messages are not suitable for their use case. This should be an enum.
|
|
11
|
-
*/
|
|
12
|
-
invalidReason: T;
|
|
13
|
-
constructor(message: string, invalidReason: T);
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Whereas ParsingError is thrown when parsing fails, e.g. in a fromString function,
|
|
17
|
-
* this type is returned from "defensive" functions like isValid.
|
|
18
|
-
*/
|
|
19
|
-
type ParsingResult<T> = {
|
|
20
|
-
/**
|
|
21
|
-
* True if valid, false otherwise.
|
|
22
|
-
*/
|
|
23
|
-
valid: boolean;
|
|
24
|
-
/**
|
|
25
|
-
* If valid is false, this will be a code explaining why parsing failed.
|
|
26
|
-
*/
|
|
27
|
-
invalidReason?: T;
|
|
28
|
-
/**
|
|
29
|
-
* If valid is false, this will be a string explaining why parsing failed.
|
|
30
|
-
*/
|
|
31
|
-
invalidReasonMessage?: string;
|
|
32
|
-
};
|
|
2
|
+
import { FundResponse, UploadResponse } from '@irys/sdk/build/cjs/common/types';
|
|
33
3
|
|
|
34
4
|
declare const NetworkToIndexerAPI: Record<string, string>;
|
|
35
5
|
declare const NetworkToNodeAPI: Record<string, string>;
|
|
@@ -925,6 +895,7 @@ type AptosSettings = {
|
|
|
925
895
|
readonly indexer?: string;
|
|
926
896
|
readonly clientConfig?: ClientConfig;
|
|
927
897
|
readonly client?: Client;
|
|
898
|
+
readonly assetUploaderProvider?: string;
|
|
928
899
|
};
|
|
929
900
|
/**
|
|
930
901
|
*
|
|
@@ -1731,6 +1702,180 @@ type GenerateAccountWithSingleSignerSecp256k1Key = {
|
|
|
1731
1702
|
};
|
|
1732
1703
|
type GenerateAccount = GenerateAccountWithEd25519 | GenerateAccountWithSingleSignerSecp256k1Key;
|
|
1733
1704
|
|
|
1705
|
+
/**
|
|
1706
|
+
* This interface exists to define Deserializable<T> inputs for functions that
|
|
1707
|
+
* deserialize a byte buffer into a type T.
|
|
1708
|
+
* It is not intended to be implemented or extended, because Typescript has no support
|
|
1709
|
+
* for static methods in interfaces.
|
|
1710
|
+
*/
|
|
1711
|
+
interface Deserializable<T> {
|
|
1712
|
+
deserialize(deserializer: Deserializer): T;
|
|
1713
|
+
}
|
|
1714
|
+
declare class Deserializer {
|
|
1715
|
+
private buffer;
|
|
1716
|
+
private offset;
|
|
1717
|
+
constructor(data: Uint8Array);
|
|
1718
|
+
private read;
|
|
1719
|
+
/**
|
|
1720
|
+
* Deserializes a string. UTF8 string is supported. Reads the string's bytes length "l" first,
|
|
1721
|
+
* and then reads "l" bytes of content. Decodes the byte array into a string.
|
|
1722
|
+
*
|
|
1723
|
+
* BCS layout for "string": string_length | string_content
|
|
1724
|
+
* where string_length is a u32 integer encoded as a uleb128 integer, equal to the number of bytes in string_content.
|
|
1725
|
+
*
|
|
1726
|
+
* @example
|
|
1727
|
+
* ```ts
|
|
1728
|
+
* const deserializer = new Deserializer(new Uint8Array([8, 49, 50, 51, 52, 97, 98, 99, 100]));
|
|
1729
|
+
* assert(deserializer.deserializeStr() === "1234abcd");
|
|
1730
|
+
* ```
|
|
1731
|
+
*/
|
|
1732
|
+
deserializeStr(): string;
|
|
1733
|
+
/**
|
|
1734
|
+
* Deserializes an array of bytes.
|
|
1735
|
+
*
|
|
1736
|
+
* BCS layout for "bytes": bytes_length | bytes
|
|
1737
|
+
* where bytes_length is a u32 integer encoded as a uleb128 integer, equal to the length of the bytes array.
|
|
1738
|
+
*/
|
|
1739
|
+
deserializeBytes(): Uint8Array;
|
|
1740
|
+
/**
|
|
1741
|
+
* Deserializes an array of bytes. The number of bytes to read is already known.
|
|
1742
|
+
*
|
|
1743
|
+
*/
|
|
1744
|
+
deserializeFixedBytes(len: number): Uint8Array;
|
|
1745
|
+
/**
|
|
1746
|
+
* Deserializes a boolean value.
|
|
1747
|
+
*
|
|
1748
|
+
* BCS layout for "boolean": One byte. "0x01" for true and "0x00" for false.
|
|
1749
|
+
*/
|
|
1750
|
+
deserializeBool(): boolean;
|
|
1751
|
+
/**
|
|
1752
|
+
* Deserializes a uint8 number.
|
|
1753
|
+
*
|
|
1754
|
+
* BCS layout for "uint8": One byte. Binary format in little-endian representation.
|
|
1755
|
+
*/
|
|
1756
|
+
deserializeU8(): Uint8;
|
|
1757
|
+
/**
|
|
1758
|
+
* Deserializes a uint16 number.
|
|
1759
|
+
*
|
|
1760
|
+
* BCS layout for "uint16": Two bytes. Binary format in little-endian representation.
|
|
1761
|
+
* @example
|
|
1762
|
+
* ```ts
|
|
1763
|
+
* const deserializer = new Deserializer(new Uint8Array([0x34, 0x12]));
|
|
1764
|
+
* assert(deserializer.deserializeU16() === 4660);
|
|
1765
|
+
* ```
|
|
1766
|
+
*/
|
|
1767
|
+
deserializeU16(): Uint16;
|
|
1768
|
+
/**
|
|
1769
|
+
* Deserializes a uint32 number.
|
|
1770
|
+
*
|
|
1771
|
+
* BCS layout for "uint32": Four bytes. Binary format in little-endian representation.
|
|
1772
|
+
* @example
|
|
1773
|
+
* ```ts
|
|
1774
|
+
* const deserializer = new Deserializer(new Uint8Array([0x78, 0x56, 0x34, 0x12]));
|
|
1775
|
+
* assert(deserializer.deserializeU32() === 305419896);
|
|
1776
|
+
* ```
|
|
1777
|
+
*/
|
|
1778
|
+
deserializeU32(): Uint32;
|
|
1779
|
+
/**
|
|
1780
|
+
* Deserializes a uint64 number.
|
|
1781
|
+
*
|
|
1782
|
+
* BCS layout for "uint64": Eight bytes. Binary format in little-endian representation.
|
|
1783
|
+
* @example
|
|
1784
|
+
* ```ts
|
|
1785
|
+
* const deserializer = new Deserializer(new Uint8Array([0x00, 0xEF, 0xCD, 0xAB, 0x78, 0x56, 0x34, 0x12]));
|
|
1786
|
+
* assert(deserializer.deserializeU64() === 1311768467750121216);
|
|
1787
|
+
* ```
|
|
1788
|
+
*/
|
|
1789
|
+
deserializeU64(): Uint64;
|
|
1790
|
+
/**
|
|
1791
|
+
* Deserializes a uint128 number.
|
|
1792
|
+
*
|
|
1793
|
+
* BCS layout for "uint128": Sixteen bytes. Binary format in little-endian representation.
|
|
1794
|
+
*/
|
|
1795
|
+
deserializeU128(): Uint128;
|
|
1796
|
+
/**
|
|
1797
|
+
* Deserializes a uint256 number.
|
|
1798
|
+
*
|
|
1799
|
+
* BCS layout for "uint256": Thirty-two bytes. Binary format in little-endian representation.
|
|
1800
|
+
*/
|
|
1801
|
+
deserializeU256(): Uint256;
|
|
1802
|
+
/**
|
|
1803
|
+
* Deserializes a uleb128 encoded uint32 number.
|
|
1804
|
+
*
|
|
1805
|
+
* BCS use uleb128 encoding in two cases: (1) lengths of variable-length sequences and (2) tags of enum values
|
|
1806
|
+
*/
|
|
1807
|
+
deserializeUleb128AsU32(): Uint32;
|
|
1808
|
+
/**
|
|
1809
|
+
* Helper function that primarily exists to support alternative syntax for deserialization.
|
|
1810
|
+
* That is, if we have a `const deserializer: new Deserializer(...)`, instead of having to use
|
|
1811
|
+
* `MyClass.deserialize(deserializer)`, we can call `deserializer.deserialize(MyClass)`.
|
|
1812
|
+
*
|
|
1813
|
+
* @example const deserializer = new Deserializer(new Uint8Array([1, 2, 3]));
|
|
1814
|
+
* const value = deserializer.deserialize(MyClass); // where MyClass has a `deserialize` function
|
|
1815
|
+
* // value is now an instance of MyClass
|
|
1816
|
+
* // equivalent to `const value = MyClass.deserialize(deserializer)`
|
|
1817
|
+
* @param cls The BCS-deserializable class to deserialize the buffered bytes into.
|
|
1818
|
+
*
|
|
1819
|
+
* @returns the deserialized value of class type T
|
|
1820
|
+
*/
|
|
1821
|
+
deserialize<T>(cls: Deserializable<T>): T;
|
|
1822
|
+
/**
|
|
1823
|
+
* Deserializes an array of BCS Deserializable values given an existing Deserializer
|
|
1824
|
+
* instance with a loaded byte buffer.
|
|
1825
|
+
*
|
|
1826
|
+
* @param cls The BCS-deserializable class to deserialize the buffered bytes into.
|
|
1827
|
+
* @example
|
|
1828
|
+
* // serialize a vector of addresses
|
|
1829
|
+
* const addresses = new Array<AccountAddress>(
|
|
1830
|
+
* AccountAddress.from("0x1"),
|
|
1831
|
+
* AccountAddress.from("0x2"),
|
|
1832
|
+
* AccountAddress.from("0xa"),
|
|
1833
|
+
* AccountAddress.from("0xb"),
|
|
1834
|
+
* );
|
|
1835
|
+
* const serializer = new Serializer();
|
|
1836
|
+
* serializer.serializeVector(addresses);
|
|
1837
|
+
* const serializedBytes = serializer.toUint8Array();
|
|
1838
|
+
*
|
|
1839
|
+
* // deserialize the bytes into an array of addresses
|
|
1840
|
+
* const deserializer = new Deserializer(serializedBytes);
|
|
1841
|
+
* const deserializedAddresses = deserializer.deserializeVector(AccountAddress);
|
|
1842
|
+
* // deserializedAddresses is now an array of AccountAddress instances
|
|
1843
|
+
* @returns an array of deserialized values of type T
|
|
1844
|
+
*/
|
|
1845
|
+
deserializeVector<T>(cls: Deserializable<T>): Array<T>;
|
|
1846
|
+
}
|
|
1847
|
+
|
|
1848
|
+
/**
|
|
1849
|
+
* This error is used to explain why parsing failed.
|
|
1850
|
+
*/
|
|
1851
|
+
declare class ParsingError<T> extends Error {
|
|
1852
|
+
/**
|
|
1853
|
+
* This provides a programmatic way to access why parsing failed. Downstream devs
|
|
1854
|
+
* might want to use this to build their own error messages if the default error
|
|
1855
|
+
* messages are not suitable for their use case. This should be an enum.
|
|
1856
|
+
*/
|
|
1857
|
+
invalidReason: T;
|
|
1858
|
+
constructor(message: string, invalidReason: T);
|
|
1859
|
+
}
|
|
1860
|
+
/**
|
|
1861
|
+
* Whereas ParsingError is thrown when parsing fails, e.g. in a fromString function,
|
|
1862
|
+
* this type is returned from "defensive" functions like isValid.
|
|
1863
|
+
*/
|
|
1864
|
+
type ParsingResult<T> = {
|
|
1865
|
+
/**
|
|
1866
|
+
* True if valid, false otherwise.
|
|
1867
|
+
*/
|
|
1868
|
+
valid: boolean;
|
|
1869
|
+
/**
|
|
1870
|
+
* If valid is false, this will be a code explaining why parsing failed.
|
|
1871
|
+
*/
|
|
1872
|
+
invalidReason?: T;
|
|
1873
|
+
/**
|
|
1874
|
+
* If valid is false, this will be a string explaining why parsing failed.
|
|
1875
|
+
*/
|
|
1876
|
+
invalidReasonMessage?: string;
|
|
1877
|
+
};
|
|
1878
|
+
|
|
1734
1879
|
/**
|
|
1735
1880
|
* This enum is used to explain why parsing might have failed.
|
|
1736
1881
|
*/
|
|
@@ -2011,169 +2156,26 @@ declare function ensureBoolean(value: unknown): asserts value is boolean;
|
|
|
2011
2156
|
declare const outOfRangeErrorMessage: (value: AnyNumber, min: AnyNumber, max: AnyNumber) => string;
|
|
2012
2157
|
declare function validateNumberInRange<T extends AnyNumber>(value: T, minValue: T, maxValue: T): void;
|
|
2013
2158
|
|
|
2014
|
-
|
|
2015
|
-
* This interface exists to define Deserializable<T> inputs for functions that
|
|
2016
|
-
* deserialize a byte buffer into a type T.
|
|
2017
|
-
* It is not intended to be implemented or extended, because Typescript has no support
|
|
2018
|
-
* for static methods in interfaces.
|
|
2019
|
-
*/
|
|
2020
|
-
interface Deserializable<T> {
|
|
2021
|
-
deserialize(deserializer: Deserializer): T;
|
|
2159
|
+
interface TransactionArgument extends EntryFunctionArgument, ScriptFunctionArgument {
|
|
2022
2160
|
}
|
|
2023
|
-
|
|
2024
|
-
private buffer;
|
|
2025
|
-
private offset;
|
|
2026
|
-
constructor(data: Uint8Array);
|
|
2027
|
-
private read;
|
|
2161
|
+
interface EntryFunctionArgument {
|
|
2028
2162
|
/**
|
|
2029
|
-
*
|
|
2030
|
-
* and then reads "l" bytes of content. Decodes the byte array into a string.
|
|
2031
|
-
*
|
|
2032
|
-
* BCS layout for "string": string_length | string_content
|
|
2033
|
-
* where string_length is a u32 integer encoded as a uleb128 integer, equal to the number of bytes in string_content.
|
|
2034
|
-
*
|
|
2035
|
-
* @example
|
|
2036
|
-
* ```ts
|
|
2037
|
-
* const deserializer = new Deserializer(new Uint8Array([8, 49, 50, 51, 52, 97, 98, 99, 100]));
|
|
2038
|
-
* assert(deserializer.deserializeStr() === "1234abcd");
|
|
2039
|
-
* ```
|
|
2163
|
+
* Serialize an argument to BCS-serialized bytes.
|
|
2040
2164
|
*/
|
|
2041
|
-
|
|
2165
|
+
serialize(serializer: Serializer): void;
|
|
2042
2166
|
/**
|
|
2043
|
-
*
|
|
2044
|
-
*
|
|
2045
|
-
* BCS layout for "bytes": bytes_length | bytes
|
|
2046
|
-
* where bytes_length is a u32 integer encoded as a uleb128 integer, equal to the length of the bytes array.
|
|
2167
|
+
* Serialize an argument as a type-agnostic, fixed byte sequence. The byte sequence contains
|
|
2168
|
+
* the number of the following bytes followed by the BCS-serialized bytes for a typed argument.
|
|
2047
2169
|
*/
|
|
2048
|
-
|
|
2170
|
+
serializeForEntryFunction(serializer: Serializer): void;
|
|
2171
|
+
bcsToBytes(): Uint8Array;
|
|
2172
|
+
bcsToHex(): Hex;
|
|
2173
|
+
}
|
|
2174
|
+
interface ScriptFunctionArgument {
|
|
2049
2175
|
/**
|
|
2050
|
-
*
|
|
2051
|
-
*
|
|
2176
|
+
* Serialize an argument to BCS-serialized bytes.
|
|
2052
2177
|
*/
|
|
2053
|
-
|
|
2054
|
-
/**
|
|
2055
|
-
* Deserializes a boolean value.
|
|
2056
|
-
*
|
|
2057
|
-
* BCS layout for "boolean": One byte. "0x01" for true and "0x00" for false.
|
|
2058
|
-
*/
|
|
2059
|
-
deserializeBool(): boolean;
|
|
2060
|
-
/**
|
|
2061
|
-
* Deserializes a uint8 number.
|
|
2062
|
-
*
|
|
2063
|
-
* BCS layout for "uint8": One byte. Binary format in little-endian representation.
|
|
2064
|
-
*/
|
|
2065
|
-
deserializeU8(): Uint8;
|
|
2066
|
-
/**
|
|
2067
|
-
* Deserializes a uint16 number.
|
|
2068
|
-
*
|
|
2069
|
-
* BCS layout for "uint16": Two bytes. Binary format in little-endian representation.
|
|
2070
|
-
* @example
|
|
2071
|
-
* ```ts
|
|
2072
|
-
* const deserializer = new Deserializer(new Uint8Array([0x34, 0x12]));
|
|
2073
|
-
* assert(deserializer.deserializeU16() === 4660);
|
|
2074
|
-
* ```
|
|
2075
|
-
*/
|
|
2076
|
-
deserializeU16(): Uint16;
|
|
2077
|
-
/**
|
|
2078
|
-
* Deserializes a uint32 number.
|
|
2079
|
-
*
|
|
2080
|
-
* BCS layout for "uint32": Four bytes. Binary format in little-endian representation.
|
|
2081
|
-
* @example
|
|
2082
|
-
* ```ts
|
|
2083
|
-
* const deserializer = new Deserializer(new Uint8Array([0x78, 0x56, 0x34, 0x12]));
|
|
2084
|
-
* assert(deserializer.deserializeU32() === 305419896);
|
|
2085
|
-
* ```
|
|
2086
|
-
*/
|
|
2087
|
-
deserializeU32(): Uint32;
|
|
2088
|
-
/**
|
|
2089
|
-
* Deserializes a uint64 number.
|
|
2090
|
-
*
|
|
2091
|
-
* BCS layout for "uint64": Eight bytes. Binary format in little-endian representation.
|
|
2092
|
-
* @example
|
|
2093
|
-
* ```ts
|
|
2094
|
-
* const deserializer = new Deserializer(new Uint8Array([0x00, 0xEF, 0xCD, 0xAB, 0x78, 0x56, 0x34, 0x12]));
|
|
2095
|
-
* assert(deserializer.deserializeU64() === 1311768467750121216);
|
|
2096
|
-
* ```
|
|
2097
|
-
*/
|
|
2098
|
-
deserializeU64(): Uint64;
|
|
2099
|
-
/**
|
|
2100
|
-
* Deserializes a uint128 number.
|
|
2101
|
-
*
|
|
2102
|
-
* BCS layout for "uint128": Sixteen bytes. Binary format in little-endian representation.
|
|
2103
|
-
*/
|
|
2104
|
-
deserializeU128(): Uint128;
|
|
2105
|
-
/**
|
|
2106
|
-
* Deserializes a uint256 number.
|
|
2107
|
-
*
|
|
2108
|
-
* BCS layout for "uint256": Thirty-two bytes. Binary format in little-endian representation.
|
|
2109
|
-
*/
|
|
2110
|
-
deserializeU256(): Uint256;
|
|
2111
|
-
/**
|
|
2112
|
-
* Deserializes a uleb128 encoded uint32 number.
|
|
2113
|
-
*
|
|
2114
|
-
* BCS use uleb128 encoding in two cases: (1) lengths of variable-length sequences and (2) tags of enum values
|
|
2115
|
-
*/
|
|
2116
|
-
deserializeUleb128AsU32(): Uint32;
|
|
2117
|
-
/**
|
|
2118
|
-
* Helper function that primarily exists to support alternative syntax for deserialization.
|
|
2119
|
-
* That is, if we have a `const deserializer: new Deserializer(...)`, instead of having to use
|
|
2120
|
-
* `MyClass.deserialize(deserializer)`, we can call `deserializer.deserialize(MyClass)`.
|
|
2121
|
-
*
|
|
2122
|
-
* @example const deserializer = new Deserializer(new Uint8Array([1, 2, 3]));
|
|
2123
|
-
* const value = deserializer.deserialize(MyClass); // where MyClass has a `deserialize` function
|
|
2124
|
-
* // value is now an instance of MyClass
|
|
2125
|
-
* // equivalent to `const value = MyClass.deserialize(deserializer)`
|
|
2126
|
-
* @param cls The BCS-deserializable class to deserialize the buffered bytes into.
|
|
2127
|
-
*
|
|
2128
|
-
* @returns the deserialized value of class type T
|
|
2129
|
-
*/
|
|
2130
|
-
deserialize<T>(cls: Deserializable<T>): T;
|
|
2131
|
-
/**
|
|
2132
|
-
* Deserializes an array of BCS Deserializable values given an existing Deserializer
|
|
2133
|
-
* instance with a loaded byte buffer.
|
|
2134
|
-
*
|
|
2135
|
-
* @param cls The BCS-deserializable class to deserialize the buffered bytes into.
|
|
2136
|
-
* @example
|
|
2137
|
-
* // serialize a vector of addresses
|
|
2138
|
-
* const addresses = new Array<AccountAddress>(
|
|
2139
|
-
* AccountAddress.from("0x1"),
|
|
2140
|
-
* AccountAddress.from("0x2"),
|
|
2141
|
-
* AccountAddress.from("0xa"),
|
|
2142
|
-
* AccountAddress.from("0xb"),
|
|
2143
|
-
* );
|
|
2144
|
-
* const serializer = new Serializer();
|
|
2145
|
-
* serializer.serializeVector(addresses);
|
|
2146
|
-
* const serializedBytes = serializer.toUint8Array();
|
|
2147
|
-
*
|
|
2148
|
-
* // deserialize the bytes into an array of addresses
|
|
2149
|
-
* const deserializer = new Deserializer(serializedBytes);
|
|
2150
|
-
* const deserializedAddresses = deserializer.deserializeVector(AccountAddress);
|
|
2151
|
-
* // deserializedAddresses is now an array of AccountAddress instances
|
|
2152
|
-
* @returns an array of deserialized values of type T
|
|
2153
|
-
*/
|
|
2154
|
-
deserializeVector<T>(cls: Deserializable<T>): Array<T>;
|
|
2155
|
-
}
|
|
2156
|
-
|
|
2157
|
-
interface TransactionArgument extends EntryFunctionArgument, ScriptFunctionArgument {
|
|
2158
|
-
}
|
|
2159
|
-
interface EntryFunctionArgument {
|
|
2160
|
-
/**
|
|
2161
|
-
* Serialize an argument to BCS-serialized bytes.
|
|
2162
|
-
*/
|
|
2163
|
-
serialize(serializer: Serializer): void;
|
|
2164
|
-
/**
|
|
2165
|
-
* Serialize an argument as a type-agnostic, fixed byte sequence. The byte sequence contains
|
|
2166
|
-
* the number of the following bytes followed by the BCS-serialized bytes for a typed argument.
|
|
2167
|
-
*/
|
|
2168
|
-
serializeForEntryFunction(serializer: Serializer): void;
|
|
2169
|
-
bcsToBytes(): Uint8Array;
|
|
2170
|
-
bcsToHex(): Hex;
|
|
2171
|
-
}
|
|
2172
|
-
interface ScriptFunctionArgument {
|
|
2173
|
-
/**
|
|
2174
|
-
* Serialize an argument to BCS-serialized bytes.
|
|
2175
|
-
*/
|
|
2176
|
-
serialize(serializer: Serializer): void;
|
|
2178
|
+
serialize(serializer: Serializer): void;
|
|
2177
2179
|
/**
|
|
2178
2180
|
* Serialize an argument to BCS-serialized bytes as a type aware byte sequence.
|
|
2179
2181
|
* The byte sequence contains an enum variant index followed by the BCS-serialized
|
|
@@ -2184,238 +2186,6 @@ interface ScriptFunctionArgument {
|
|
|
2184
2186
|
bcsToHex(): Hex;
|
|
2185
2187
|
}
|
|
2186
2188
|
|
|
2187
|
-
/**
|
|
2188
|
-
* This enum is used to explain why an address was invalid.
|
|
2189
|
-
*/
|
|
2190
|
-
declare enum AddressInvalidReason {
|
|
2191
|
-
INCORRECT_NUMBER_OF_BYTES = "incorrect_number_of_bytes",
|
|
2192
|
-
INVALID_HEX_CHARS = "invalid_hex_chars",
|
|
2193
|
-
TOO_SHORT = "too_short",
|
|
2194
|
-
TOO_LONG = "too_long",
|
|
2195
|
-
LEADING_ZERO_X_REQUIRED = "leading_zero_x_required",
|
|
2196
|
-
LONG_FORM_REQUIRED_UNLESS_SPECIAL = "long_form_required_unless_special",
|
|
2197
|
-
INVALID_PADDING_ZEROES = "INVALID_PADDING_ZEROES"
|
|
2198
|
-
}
|
|
2199
|
-
type AccountAddressInput = HexInput | AccountAddress;
|
|
2200
|
-
/**
|
|
2201
|
-
* NOTE: Only use this class for account addresses. For other hex data, e.g. transaction
|
|
2202
|
-
* hashes, use the Hex class.
|
|
2203
|
-
*
|
|
2204
|
-
* AccountAddress is used for working with account addresses. Account addresses, when
|
|
2205
|
-
* represented as a string, generally look like these examples:
|
|
2206
|
-
* - 0x1
|
|
2207
|
-
* - 0xaa86fe99004361f747f91342ca13c426ca0cccb0c1217677180c9493bad6ef0c
|
|
2208
|
-
*
|
|
2209
|
-
* Proper formatting and parsing of account addresses is defined by AIP-40.
|
|
2210
|
-
* To learn more about the standard, read the AIP here:
|
|
2211
|
-
* https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.
|
|
2212
|
-
*
|
|
2213
|
-
* The comments in this class make frequent reference to the LONG and SHORT formats,
|
|
2214
|
-
* as well as "special" addresses. To learn what these refer to see AIP-40.
|
|
2215
|
-
*/
|
|
2216
|
-
declare class AccountAddress extends Serializable implements TransactionArgument {
|
|
2217
|
-
/**
|
|
2218
|
-
* This is the internal representation of an account address.
|
|
2219
|
-
*/
|
|
2220
|
-
readonly data: Uint8Array;
|
|
2221
|
-
/**
|
|
2222
|
-
* The number of bytes that make up an account address.
|
|
2223
|
-
*/
|
|
2224
|
-
static readonly LENGTH: number;
|
|
2225
|
-
/**
|
|
2226
|
-
* The length of an address string in LONG form without a leading 0x.
|
|
2227
|
-
*/
|
|
2228
|
-
static readonly LONG_STRING_LENGTH: number;
|
|
2229
|
-
static ZERO: AccountAddress;
|
|
2230
|
-
static ONE: AccountAddress;
|
|
2231
|
-
static TWO: AccountAddress;
|
|
2232
|
-
static THREE: AccountAddress;
|
|
2233
|
-
static FOUR: AccountAddress;
|
|
2234
|
-
/**
|
|
2235
|
-
* Creates an instance of AccountAddress from a Uint8Array.
|
|
2236
|
-
*
|
|
2237
|
-
* @param args.data A Uint8Array representing an account address.
|
|
2238
|
-
*/
|
|
2239
|
-
constructor(input: Uint8Array);
|
|
2240
|
-
/**
|
|
2241
|
-
* Returns whether an address is special, where special is defined as 0x0 to 0xf
|
|
2242
|
-
* inclusive. In other words, the last byte of the address must be < 0b10000 (16)
|
|
2243
|
-
* and every other byte must be zero.
|
|
2244
|
-
*
|
|
2245
|
-
* For more information on how special addresses are defined see AIP-40:
|
|
2246
|
-
* https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.
|
|
2247
|
-
*
|
|
2248
|
-
* @returns true if the address is special, false if not.
|
|
2249
|
-
*/
|
|
2250
|
-
isSpecial(): boolean;
|
|
2251
|
-
/**
|
|
2252
|
-
* Return the AccountAddress as a string as per AIP-40.
|
|
2253
|
-
* https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.
|
|
2254
|
-
*
|
|
2255
|
-
* In short, it means that special addresses are represented in SHORT form, meaning
|
|
2256
|
-
* 0x0 through to 0xf inclusive, and every other address is represented in LONG form,
|
|
2257
|
-
* meaning 0x + 64 hex characters.
|
|
2258
|
-
*
|
|
2259
|
-
* @returns AccountAddress as a string conforming to AIP-40.
|
|
2260
|
-
*/
|
|
2261
|
-
toString(): `0x${string}`;
|
|
2262
|
-
/**
|
|
2263
|
-
* NOTE: Prefer to use `toString` where possible.
|
|
2264
|
-
*
|
|
2265
|
-
* Return the AccountAddress as a string as per AIP-40 but without the leading 0x.
|
|
2266
|
-
*
|
|
2267
|
-
* Learn more by reading the docstring of `toString`.
|
|
2268
|
-
*
|
|
2269
|
-
* @returns AccountAddress as a string conforming to AIP-40 but without the leading 0x.
|
|
2270
|
-
*/
|
|
2271
|
-
toStringWithoutPrefix(): string;
|
|
2272
|
-
/**
|
|
2273
|
-
* NOTE: Prefer to use `toString` where possible.
|
|
2274
|
-
*
|
|
2275
|
-
* Whereas toString will format special addresses (as defined by isSpecial) using the
|
|
2276
|
-
* SHORT form (no leading 0s), this format the address in the LONG format
|
|
2277
|
-
* unconditionally.
|
|
2278
|
-
*
|
|
2279
|
-
* This means it will be 0x + 64 hex characters.
|
|
2280
|
-
*
|
|
2281
|
-
* @returns AccountAddress as a string in LONG form.
|
|
2282
|
-
*/
|
|
2283
|
-
toStringLong(): `0x${string}`;
|
|
2284
|
-
/**
|
|
2285
|
-
* NOTE: Prefer to use `toString` where possible.
|
|
2286
|
-
*
|
|
2287
|
-
* Whereas toString will format special addresses (as defined by isSpecial) using the
|
|
2288
|
-
* SHORT form (no leading 0s), this function will include leading zeroes. The string
|
|
2289
|
-
* will not have a leading zero.
|
|
2290
|
-
*
|
|
2291
|
-
* This means it will be 64 hex characters without a leading 0x.
|
|
2292
|
-
*
|
|
2293
|
-
* @returns AccountAddress as a string in LONG form without a leading 0x.
|
|
2294
|
-
*/
|
|
2295
|
-
toStringLongWithoutPrefix(): string;
|
|
2296
|
-
/**
|
|
2297
|
-
* Get the inner hex data. The inner data is already a Uint8Array so no conversion
|
|
2298
|
-
* is taking place here, it just returns the inner data.
|
|
2299
|
-
*
|
|
2300
|
-
* @returns Hex data as Uint8Array
|
|
2301
|
-
*/
|
|
2302
|
-
toUint8Array(): Uint8Array;
|
|
2303
|
-
/**
|
|
2304
|
-
* Serialize the AccountAddress to a Serializer instance's data buffer.
|
|
2305
|
-
* @param serializer The serializer to serialize the AccountAddress to.
|
|
2306
|
-
* @returns void
|
|
2307
|
-
* @example
|
|
2308
|
-
* const serializer = new Serializer();
|
|
2309
|
-
* const address = AccountAddress.fromString("0x1");
|
|
2310
|
-
* address.serialize(serializer);
|
|
2311
|
-
* const bytes = serializer.toUint8Array();
|
|
2312
|
-
* // `bytes` is now the BCS-serialized address.
|
|
2313
|
-
*/
|
|
2314
|
-
serialize(serializer: Serializer): void;
|
|
2315
|
-
serializeForEntryFunction(serializer: Serializer): void;
|
|
2316
|
-
serializeForScriptFunction(serializer: Serializer): void;
|
|
2317
|
-
/**
|
|
2318
|
-
* Deserialize an AccountAddress from the byte buffer in a Deserializer instance.
|
|
2319
|
-
* @param deserializer The deserializer to deserialize the AccountAddress from.
|
|
2320
|
-
* @returns An instance of AccountAddress.
|
|
2321
|
-
* @example
|
|
2322
|
-
* const bytes = hexToBytes("0x0102030405060708091011121314151617181920212223242526272829303132");
|
|
2323
|
-
* const deserializer = new Deserializer(bytes);
|
|
2324
|
-
* const address = AccountAddress.deserialize(deserializer);
|
|
2325
|
-
* // `address` is now an instance of AccountAddress.
|
|
2326
|
-
*/
|
|
2327
|
-
static deserialize(deserializer: Deserializer): AccountAddress;
|
|
2328
|
-
/**
|
|
2329
|
-
* NOTE: This function has strict parsing behavior. For relaxed behavior, please use
|
|
2330
|
-
* the `fromString` function.
|
|
2331
|
-
*
|
|
2332
|
-
* Creates an instance of AccountAddress from a hex string.
|
|
2333
|
-
*
|
|
2334
|
-
* This function allows only the strictest formats defined by AIP-40. In short this
|
|
2335
|
-
* means only the following formats are accepted:
|
|
2336
|
-
*
|
|
2337
|
-
* - LONG
|
|
2338
|
-
* - SHORT for special addresses
|
|
2339
|
-
*
|
|
2340
|
-
* Where:
|
|
2341
|
-
* - LONG is defined as 0x + 64 hex characters.
|
|
2342
|
-
* - SHORT for special addresses is 0x0 to 0xf inclusive without padding zeroes.
|
|
2343
|
-
*
|
|
2344
|
-
* This means the following are not accepted:
|
|
2345
|
-
* - SHORT for non-special addresses.
|
|
2346
|
-
* - Any address without a leading 0x.
|
|
2347
|
-
*
|
|
2348
|
-
* Learn more about the different address formats by reading AIP-40:
|
|
2349
|
-
* https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.
|
|
2350
|
-
*
|
|
2351
|
-
* @param input A hex string representing an account address.
|
|
2352
|
-
*
|
|
2353
|
-
* @returns An instance of AccountAddress.
|
|
2354
|
-
*/
|
|
2355
|
-
static fromStringStrict(input: string): AccountAddress;
|
|
2356
|
-
/**
|
|
2357
|
-
* NOTE: This function has relaxed parsing behavior. For strict behavior, please use
|
|
2358
|
-
* the `fromStringStrict` function. Where possible use `fromStringStrict` rather than this
|
|
2359
|
-
* function, `fromString` is only provided for backwards compatibility.
|
|
2360
|
-
*
|
|
2361
|
-
* Creates an instance of AccountAddress from a hex string.
|
|
2362
|
-
*
|
|
2363
|
-
* This function allows all formats defined by AIP-40. In short this means the
|
|
2364
|
-
* following formats are accepted:
|
|
2365
|
-
*
|
|
2366
|
-
* - LONG, with or without leading 0x
|
|
2367
|
-
* - SHORT, with or without leading 0x
|
|
2368
|
-
*
|
|
2369
|
-
* Where:
|
|
2370
|
-
* - LONG is 64 hex characters.
|
|
2371
|
-
* - SHORT is 1 to 63 hex characters inclusive.
|
|
2372
|
-
* - Padding zeroes are allowed, e.g. 0x0123 is valid.
|
|
2373
|
-
*
|
|
2374
|
-
* Learn more about the different address formats by reading AIP-40:
|
|
2375
|
-
* https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.
|
|
2376
|
-
*
|
|
2377
|
-
* @param input A hex string representing an account address.
|
|
2378
|
-
*
|
|
2379
|
-
* @returns An instance of AccountAddress.
|
|
2380
|
-
*/
|
|
2381
|
-
static fromString(input: string): AccountAddress;
|
|
2382
|
-
/**
|
|
2383
|
-
* Convenience method for creating an AccountAddress from all known inputs.
|
|
2384
|
-
*
|
|
2385
|
-
* This handles, Uint8array, string, and AccountAddress itself
|
|
2386
|
-
* @param input
|
|
2387
|
-
*/
|
|
2388
|
-
static from(input: AccountAddressInput): AccountAddress;
|
|
2389
|
-
/**
|
|
2390
|
-
* Convenience method for creating an AccountAddress from all known inputs.
|
|
2391
|
-
*
|
|
2392
|
-
* This handles, Uint8array, string, and AccountAddress itself
|
|
2393
|
-
* @param input
|
|
2394
|
-
*/
|
|
2395
|
-
static fromStrict(input: AccountAddressInput): AccountAddress;
|
|
2396
|
-
/**
|
|
2397
|
-
* Check if the string is a valid AccountAddress.
|
|
2398
|
-
*
|
|
2399
|
-
* @param args.input A hex string representing an account address.
|
|
2400
|
-
* @param args.strict If true, use strict parsing behavior. If false, use relaxed parsing behavior.
|
|
2401
|
-
*
|
|
2402
|
-
* @returns valid = true if the string is valid, valid = false if not. If the string
|
|
2403
|
-
* is not valid, invalidReason will be set explaining why it is invalid.
|
|
2404
|
-
*/
|
|
2405
|
-
static isValid(args: {
|
|
2406
|
-
input: AccountAddressInput;
|
|
2407
|
-
strict?: boolean;
|
|
2408
|
-
}): ParsingResult<AddressInvalidReason>;
|
|
2409
|
-
/**
|
|
2410
|
-
* Return whether AccountAddresses are equal. AccountAddresses are considered equal
|
|
2411
|
-
* if their underlying byte data is identical.
|
|
2412
|
-
*
|
|
2413
|
-
* @param other The AccountAddress to compare to.
|
|
2414
|
-
* @returns true if the AccountAddresses are equal, false if not.
|
|
2415
|
-
*/
|
|
2416
|
-
equals(other: AccountAddress): boolean;
|
|
2417
|
-
}
|
|
2418
|
-
|
|
2419
2189
|
/**
|
|
2420
2190
|
* This class exists to represent a contiguous sequence of already serialized BCS-bytes.
|
|
2421
2191
|
*
|
|
@@ -2812,67 +2582,235 @@ declare class MoveOption<T extends Serializable & EntryFunctionArgument> extends
|
|
|
2812
2582
|
}
|
|
2813
2583
|
|
|
2814
2584
|
/**
|
|
2815
|
-
*
|
|
2816
|
-
* verify signatures and for authentication keys.
|
|
2585
|
+
* This enum is used to explain why an address was invalid.
|
|
2817
2586
|
*/
|
|
2818
|
-
declare
|
|
2587
|
+
declare enum AddressInvalidReason {
|
|
2588
|
+
INCORRECT_NUMBER_OF_BYTES = "incorrect_number_of_bytes",
|
|
2589
|
+
INVALID_HEX_CHARS = "invalid_hex_chars",
|
|
2590
|
+
TOO_SHORT = "too_short",
|
|
2591
|
+
TOO_LONG = "too_long",
|
|
2592
|
+
LEADING_ZERO_X_REQUIRED = "leading_zero_x_required",
|
|
2593
|
+
LONG_FORM_REQUIRED_UNLESS_SPECIAL = "long_form_required_unless_special",
|
|
2594
|
+
INVALID_PADDING_ZEROES = "INVALID_PADDING_ZEROES"
|
|
2595
|
+
}
|
|
2596
|
+
type AccountAddressInput = HexInput | AccountAddress;
|
|
2597
|
+
/**
|
|
2598
|
+
* NOTE: Only use this class for account addresses. For other hex data, e.g. transaction
|
|
2599
|
+
* hashes, use the Hex class.
|
|
2600
|
+
*
|
|
2601
|
+
* AccountAddress is used for working with account addresses. Account addresses, when
|
|
2602
|
+
* represented as a string, generally look like these examples:
|
|
2603
|
+
* - 0x1
|
|
2604
|
+
* - 0xaa86fe99004361f747f91342ca13c426ca0cccb0c1217677180c9493bad6ef0c
|
|
2605
|
+
*
|
|
2606
|
+
* Proper formatting and parsing of account addresses is defined by AIP-40.
|
|
2607
|
+
* To learn more about the standard, read the AIP here:
|
|
2608
|
+
* https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.
|
|
2609
|
+
*
|
|
2610
|
+
* The comments in this class make frequent reference to the LONG and SHORT formats,
|
|
2611
|
+
* as well as "special" addresses. To learn what these refer to see AIP-40.
|
|
2612
|
+
*/
|
|
2613
|
+
declare class AccountAddress extends Serializable implements TransactionArgument {
|
|
2819
2614
|
/**
|
|
2820
|
-
*
|
|
2821
|
-
|
|
2822
|
-
|
|
2615
|
+
* This is the internal representation of an account address.
|
|
2616
|
+
*/
|
|
2617
|
+
readonly data: Uint8Array;
|
|
2618
|
+
/**
|
|
2619
|
+
* The number of bytes that make up an account address.
|
|
2620
|
+
*/
|
|
2621
|
+
static readonly LENGTH: number;
|
|
2622
|
+
/**
|
|
2623
|
+
* The length of an address string in LONG form without a leading 0x.
|
|
2624
|
+
*/
|
|
2625
|
+
static readonly LONG_STRING_LENGTH: number;
|
|
2626
|
+
static ZERO: AccountAddress;
|
|
2627
|
+
static ONE: AccountAddress;
|
|
2628
|
+
static TWO: AccountAddress;
|
|
2629
|
+
static THREE: AccountAddress;
|
|
2630
|
+
static FOUR: AccountAddress;
|
|
2631
|
+
/**
|
|
2632
|
+
* Creates an instance of AccountAddress from a Uint8Array.
|
|
2633
|
+
*
|
|
2634
|
+
* @param args.data A Uint8Array representing an account address.
|
|
2635
|
+
*/
|
|
2636
|
+
constructor(input: Uint8Array);
|
|
2637
|
+
/**
|
|
2638
|
+
* Returns whether an address is special, where special is defined as 0x0 to 0xf
|
|
2639
|
+
* inclusive. In other words, the last byte of the address must be < 0b10000 (16)
|
|
2640
|
+
* and every other byte must be zero.
|
|
2641
|
+
*
|
|
2642
|
+
* For more information on how special addresses are defined see AIP-40:
|
|
2643
|
+
* https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.
|
|
2644
|
+
*
|
|
2645
|
+
* @returns true if the address is special, false if not.
|
|
2646
|
+
*/
|
|
2647
|
+
isSpecial(): boolean;
|
|
2648
|
+
/**
|
|
2649
|
+
* Return the AccountAddress as a string as per AIP-40.
|
|
2650
|
+
* https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.
|
|
2651
|
+
*
|
|
2652
|
+
* In short, it means that special addresses are represented in SHORT form, meaning
|
|
2653
|
+
* 0x0 through to 0xf inclusive, and every other address is represented in LONG form,
|
|
2654
|
+
* meaning 0x + 64 hex characters.
|
|
2655
|
+
*
|
|
2656
|
+
* @returns AccountAddress as a string conforming to AIP-40.
|
|
2657
|
+
*/
|
|
2658
|
+
toString(): `0x${string}`;
|
|
2659
|
+
/**
|
|
2660
|
+
* NOTE: Prefer to use `toString` where possible.
|
|
2661
|
+
*
|
|
2662
|
+
* Return the AccountAddress as a string as per AIP-40 but without the leading 0x.
|
|
2663
|
+
*
|
|
2664
|
+
* Learn more by reading the docstring of `toString`.
|
|
2665
|
+
*
|
|
2666
|
+
* @returns AccountAddress as a string conforming to AIP-40 but without the leading 0x.
|
|
2667
|
+
*/
|
|
2668
|
+
toStringWithoutPrefix(): string;
|
|
2669
|
+
/**
|
|
2670
|
+
* NOTE: Prefer to use `toString` where possible.
|
|
2671
|
+
*
|
|
2672
|
+
* Whereas toString will format special addresses (as defined by isSpecial) using the
|
|
2673
|
+
* SHORT form (no leading 0s), this format the address in the LONG format
|
|
2674
|
+
* unconditionally.
|
|
2675
|
+
*
|
|
2676
|
+
* This means it will be 0x + 64 hex characters.
|
|
2677
|
+
*
|
|
2678
|
+
* @returns AccountAddress as a string in LONG form.
|
|
2679
|
+
*/
|
|
2680
|
+
toStringLong(): `0x${string}`;
|
|
2681
|
+
/**
|
|
2682
|
+
* NOTE: Prefer to use `toString` where possible.
|
|
2683
|
+
*
|
|
2684
|
+
* Whereas toString will format special addresses (as defined by isSpecial) using the
|
|
2685
|
+
* SHORT form (no leading 0s), this function will include leading zeroes. The string
|
|
2686
|
+
* will not have a leading zero.
|
|
2687
|
+
*
|
|
2688
|
+
* This means it will be 64 hex characters without a leading 0x.
|
|
2689
|
+
*
|
|
2690
|
+
* @returns AccountAddress as a string in LONG form without a leading 0x.
|
|
2691
|
+
*/
|
|
2692
|
+
toStringLongWithoutPrefix(): string;
|
|
2693
|
+
/**
|
|
2694
|
+
* Get the inner hex data. The inner data is already a Uint8Array so no conversion
|
|
2695
|
+
* is taking place here, it just returns the inner data.
|
|
2696
|
+
*
|
|
2697
|
+
* @returns Hex data as Uint8Array
|
|
2823
2698
|
*/
|
|
2824
|
-
|
|
2825
|
-
message: HexInput;
|
|
2826
|
-
signature: Signature;
|
|
2827
|
-
}): boolean;
|
|
2699
|
+
toUint8Array(): Uint8Array;
|
|
2828
2700
|
/**
|
|
2829
|
-
*
|
|
2701
|
+
* Serialize the AccountAddress to a Serializer instance's data buffer.
|
|
2702
|
+
* @param serializer The serializer to serialize the AccountAddress to.
|
|
2703
|
+
* @returns void
|
|
2704
|
+
* @example
|
|
2705
|
+
* const serializer = new Serializer();
|
|
2706
|
+
* const address = AccountAddress.fromString("0x1");
|
|
2707
|
+
* address.serialize(serializer);
|
|
2708
|
+
* const bytes = serializer.toUint8Array();
|
|
2709
|
+
* // `bytes` is now the BCS-serialized address.
|
|
2830
2710
|
*/
|
|
2831
|
-
|
|
2711
|
+
serialize(serializer: Serializer): void;
|
|
2712
|
+
serializeForEntryFunction(serializer: Serializer): void;
|
|
2713
|
+
serializeForScriptFunction(serializer: Serializer): void;
|
|
2832
2714
|
/**
|
|
2833
|
-
*
|
|
2715
|
+
* Deserialize an AccountAddress from the byte buffer in a Deserializer instance.
|
|
2716
|
+
* @param deserializer The deserializer to deserialize the AccountAddress from.
|
|
2717
|
+
* @returns An instance of AccountAddress.
|
|
2718
|
+
* @example
|
|
2719
|
+
* const bytes = hexToBytes("0x0102030405060708091011121314151617181920212223242526272829303132");
|
|
2720
|
+
* const deserializer = new Deserializer(bytes);
|
|
2721
|
+
* const address = AccountAddress.deserialize(deserializer);
|
|
2722
|
+
* // `address` is now an instance of AccountAddress.
|
|
2834
2723
|
*/
|
|
2835
|
-
|
|
2836
|
-
abstract serialize(serializer: Serializer): void;
|
|
2837
|
-
}
|
|
2838
|
-
/**
|
|
2839
|
-
* An abstract representation of a private key. This is used to sign transactions and
|
|
2840
|
-
* derive the public key associated.
|
|
2841
|
-
*/
|
|
2842
|
-
declare abstract class PrivateKey extends Serializable {
|
|
2724
|
+
static deserialize(deserializer: Deserializer): AccountAddress;
|
|
2843
2725
|
/**
|
|
2844
|
-
*
|
|
2845
|
-
*
|
|
2726
|
+
* NOTE: This function has strict parsing behavior. For relaxed behavior, please use
|
|
2727
|
+
* the `fromString` function.
|
|
2728
|
+
*
|
|
2729
|
+
* Creates an instance of AccountAddress from a hex string.
|
|
2730
|
+
*
|
|
2731
|
+
* This function allows only the strictest formats defined by AIP-40. In short this
|
|
2732
|
+
* means only the following formats are accepted:
|
|
2733
|
+
*
|
|
2734
|
+
* - LONG
|
|
2735
|
+
* - SHORT for special addresses
|
|
2736
|
+
*
|
|
2737
|
+
* Where:
|
|
2738
|
+
* - LONG is defined as 0x + 64 hex characters.
|
|
2739
|
+
* - SHORT for special addresses is 0x0 to 0xf inclusive without padding zeroes.
|
|
2740
|
+
*
|
|
2741
|
+
* This means the following are not accepted:
|
|
2742
|
+
* - SHORT for non-special addresses.
|
|
2743
|
+
* - Any address without a leading 0x.
|
|
2744
|
+
*
|
|
2745
|
+
* Learn more about the different address formats by reading AIP-40:
|
|
2746
|
+
* https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.
|
|
2747
|
+
*
|
|
2748
|
+
* @param input A hex string representing an account address.
|
|
2749
|
+
*
|
|
2750
|
+
* @returns An instance of AccountAddress.
|
|
2846
2751
|
*/
|
|
2847
|
-
|
|
2752
|
+
static fromStringStrict(input: string): AccountAddress;
|
|
2848
2753
|
/**
|
|
2849
|
-
*
|
|
2754
|
+
* NOTE: This function has relaxed parsing behavior. For strict behavior, please use
|
|
2755
|
+
* the `fromStringStrict` function. Where possible use `fromStringStrict` rather than this
|
|
2756
|
+
* function, `fromString` is only provided for backwards compatibility.
|
|
2757
|
+
*
|
|
2758
|
+
* Creates an instance of AccountAddress from a hex string.
|
|
2759
|
+
*
|
|
2760
|
+
* This function allows all formats defined by AIP-40. In short this means the
|
|
2761
|
+
* following formats are accepted:
|
|
2762
|
+
*
|
|
2763
|
+
* - LONG, with or without leading 0x
|
|
2764
|
+
* - SHORT, with or without leading 0x
|
|
2765
|
+
*
|
|
2766
|
+
* Where:
|
|
2767
|
+
* - LONG is 64 hex characters.
|
|
2768
|
+
* - SHORT is 1 to 63 hex characters inclusive.
|
|
2769
|
+
* - Padding zeroes are allowed, e.g. 0x0123 is valid.
|
|
2770
|
+
*
|
|
2771
|
+
* Learn more about the different address formats by reading AIP-40:
|
|
2772
|
+
* https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.
|
|
2773
|
+
*
|
|
2774
|
+
* @param input A hex string representing an account address.
|
|
2775
|
+
*
|
|
2776
|
+
* @returns An instance of AccountAddress.
|
|
2850
2777
|
*/
|
|
2851
|
-
|
|
2778
|
+
static fromString(input: string): AccountAddress;
|
|
2852
2779
|
/**
|
|
2853
|
-
*
|
|
2780
|
+
* Convenience method for creating an AccountAddress from all known inputs.
|
|
2781
|
+
*
|
|
2782
|
+
* This handles, Uint8array, string, and AccountAddress itself
|
|
2783
|
+
* @param input
|
|
2854
2784
|
*/
|
|
2855
|
-
|
|
2856
|
-
abstract serialize(serializer: Serializer): void;
|
|
2785
|
+
static from(input: AccountAddressInput): AccountAddress;
|
|
2857
2786
|
/**
|
|
2858
|
-
*
|
|
2787
|
+
* Convenience method for creating an AccountAddress from all known inputs.
|
|
2788
|
+
*
|
|
2789
|
+
* This handles, Uint8array, string, and AccountAddress itself
|
|
2790
|
+
* @param input
|
|
2859
2791
|
*/
|
|
2860
|
-
|
|
2861
|
-
}
|
|
2862
|
-
/**
|
|
2863
|
-
* An abstract representation of a signature. This is the product of signing a
|
|
2864
|
-
* message and can be used with the PublicKey to verify the signature.
|
|
2865
|
-
*/
|
|
2866
|
-
declare abstract class Signature extends Serializable {
|
|
2792
|
+
static fromStrict(input: AccountAddressInput): AccountAddress;
|
|
2867
2793
|
/**
|
|
2868
|
-
*
|
|
2794
|
+
* Check if the string is a valid AccountAddress.
|
|
2795
|
+
*
|
|
2796
|
+
* @param args.input A hex string representing an account address.
|
|
2797
|
+
* @param args.strict If true, use strict parsing behavior. If false, use relaxed parsing behavior.
|
|
2798
|
+
*
|
|
2799
|
+
* @returns valid = true if the string is valid, valid = false if not. If the string
|
|
2800
|
+
* is not valid, invalidReason will be set explaining why it is invalid.
|
|
2869
2801
|
*/
|
|
2870
|
-
|
|
2802
|
+
static isValid(args: {
|
|
2803
|
+
input: AccountAddressInput;
|
|
2804
|
+
strict?: boolean;
|
|
2805
|
+
}): ParsingResult<AddressInvalidReason>;
|
|
2871
2806
|
/**
|
|
2872
|
-
*
|
|
2807
|
+
* Return whether AccountAddresses are equal. AccountAddresses are considered equal
|
|
2808
|
+
* if their underlying byte data is identical.
|
|
2809
|
+
*
|
|
2810
|
+
* @param other The AccountAddress to compare to.
|
|
2811
|
+
* @returns true if the AccountAddresses are equal, false if not.
|
|
2873
2812
|
*/
|
|
2874
|
-
|
|
2875
|
-
abstract serialize(serializer: Serializer): void;
|
|
2813
|
+
equals(other: AccountAddress): boolean;
|
|
2876
2814
|
}
|
|
2877
2815
|
|
|
2878
2816
|
/**
|
|
@@ -2905,7 +2843,12 @@ declare class AuthenticationKey extends Serializable {
|
|
|
2905
2843
|
static deserialize(deserializer: Deserializer): AuthenticationKey;
|
|
2906
2844
|
toString(): string;
|
|
2907
2845
|
toUint8Array(): Uint8Array;
|
|
2846
|
+
static fromSchemeAndBytes(args: {
|
|
2847
|
+
scheme: AuthenticationKeyScheme;
|
|
2848
|
+
input: HexInput;
|
|
2849
|
+
}): AuthenticationKey;
|
|
2908
2850
|
/**
|
|
2851
|
+
* @deprecated Use `fromPublicKey` instead
|
|
2909
2852
|
* Derives an AuthenticationKey from the public key seed bytes and an explicit derivation scheme.
|
|
2910
2853
|
*
|
|
2911
2854
|
* This facilitates targeting a specific scheme for deriving an authentication key from a public key.
|
|
@@ -2913,7 +2856,7 @@ declare class AuthenticationKey extends Serializable {
|
|
|
2913
2856
|
* @param args - the public key and scheme to use for the derivation
|
|
2914
2857
|
*/
|
|
2915
2858
|
static fromPublicKeyAndScheme(args: {
|
|
2916
|
-
publicKey:
|
|
2859
|
+
publicKey: AccountPublicKey;
|
|
2917
2860
|
scheme: AuthenticationKeyScheme;
|
|
2918
2861
|
}): AuthenticationKey;
|
|
2919
2862
|
/**
|
|
@@ -2924,7 +2867,7 @@ declare class AuthenticationKey extends Serializable {
|
|
|
2924
2867
|
* @returns AuthenticationKey
|
|
2925
2868
|
*/
|
|
2926
2869
|
static fromPublicKey(args: {
|
|
2927
|
-
publicKey:
|
|
2870
|
+
publicKey: AccountPublicKey;
|
|
2928
2871
|
}): AuthenticationKey;
|
|
2929
2872
|
/**
|
|
2930
2873
|
* Derives an account address from an AuthenticationKey. Since an AccountAddress is also 32 bytes,
|
|
@@ -2936,172 +2879,81 @@ declare class AuthenticationKey extends Serializable {
|
|
|
2936
2879
|
}
|
|
2937
2880
|
|
|
2938
2881
|
/**
|
|
2939
|
-
*
|
|
2940
|
-
*
|
|
2941
|
-
* Use this class to create accounts, sign transactions, and more.
|
|
2942
|
-
* Note: Creating an account instance does not create the account on-chain.
|
|
2943
|
-
*
|
|
2944
|
-
* Since [AIP-55](https://github.com/aptos-foundation/AIPs/pull/263) Aptos supports
|
|
2945
|
-
* `Legacy` and `Unified` authentications.
|
|
2946
|
-
*
|
|
2947
|
-
* @Legacy includes `ED25519` and `MultiED25519`
|
|
2948
|
-
* @Unified includes `SingleSender` and `MultiSender`, where currently
|
|
2949
|
-
* `SingleSender` supports `ED25519` and `Secp256k1`, and `MultiSender` supports
|
|
2950
|
-
* `MultiED25519`.
|
|
2951
|
-
*
|
|
2952
|
-
* In TypeScript SDK, we support all of these options:
|
|
2953
|
-
*
|
|
2954
|
-
* @generate default to generate Legacy Ed25519 keys, with an optional `legacy` boolean argument
|
|
2955
|
-
* that lets you generate new keys conforming to the Unified authentication.
|
|
2956
|
-
*
|
|
2957
|
-
* @fromPrivateKey derives an account by a provided private key and address, with an optional
|
|
2958
|
-
* `legacy` boolean argument that lets you generate new keys conforming to the Unified authentication.
|
|
2959
|
-
*
|
|
2960
|
-
* @fromDerivationPath derives an account with bip44 path and mnemonics,
|
|
2882
|
+
* An abstract representation of a crypto signature,
|
|
2883
|
+
* associated to a specific signature scheme e.g. Ed25519 or Secp256k1
|
|
2961
2884
|
*
|
|
2885
|
+
* This is the product of signing a message directly from a PrivateKey
|
|
2886
|
+
* and can be verified against a CryptoPublicKey.
|
|
2962
2887
|
*/
|
|
2963
|
-
declare class
|
|
2964
|
-
/**
|
|
2965
|
-
* Public key associated with the account
|
|
2966
|
-
*/
|
|
2967
|
-
readonly publicKey: PublicKey;
|
|
2968
|
-
/**
|
|
2969
|
-
* Private key associated with the account
|
|
2970
|
-
*/
|
|
2971
|
-
readonly privateKey: PrivateKey;
|
|
2972
|
-
/**
|
|
2973
|
-
* Account address associated with the account
|
|
2974
|
-
*/
|
|
2975
|
-
readonly accountAddress: AccountAddress;
|
|
2888
|
+
declare abstract class Signature extends Serializable {
|
|
2976
2889
|
/**
|
|
2977
|
-
*
|
|
2890
|
+
* Get the raw signature bytes
|
|
2978
2891
|
*/
|
|
2979
|
-
|
|
2892
|
+
abstract toUint8Array(): Uint8Array;
|
|
2980
2893
|
/**
|
|
2981
|
-
*
|
|
2982
|
-
*
|
|
2983
|
-
* Need to update this to use the new crypto library if new schemes are added.
|
|
2984
|
-
*
|
|
2985
|
-
* @param args.privateKey PrivateKey - private key of the account
|
|
2986
|
-
* @param args.address AccountAddress - address of the account
|
|
2987
|
-
* @param args.legacy optional. If set to false, the keypair authentication keys will be derived with a unified scheme.
|
|
2988
|
-
* Defaults to deriving an authentication key with the legacy scheme.
|
|
2989
|
-
*
|
|
2990
|
-
* This method is private because it should only be called by the factory static methods.
|
|
2991
|
-
* @returns Account
|
|
2894
|
+
* Get the signature as a hex string with a 0x prefix e.g. 0x123456...
|
|
2992
2895
|
*/
|
|
2993
|
-
|
|
2896
|
+
toString(): string;
|
|
2897
|
+
}
|
|
2898
|
+
|
|
2899
|
+
/**
|
|
2900
|
+
* Arguments for verifying a signature
|
|
2901
|
+
*/
|
|
2902
|
+
interface VerifySignatureArgs {
|
|
2903
|
+
message: HexInput;
|
|
2904
|
+
signature: Signature;
|
|
2905
|
+
}
|
|
2906
|
+
/**
|
|
2907
|
+
* An abstract representation of a public key.
|
|
2908
|
+
*
|
|
2909
|
+
* Provides a common interface for verifying any signature.
|
|
2910
|
+
*/
|
|
2911
|
+
declare abstract class PublicKey extends Serializable {
|
|
2994
2912
|
/**
|
|
2995
|
-
*
|
|
2996
|
-
*
|
|
2997
|
-
*
|
|
2998
|
-
*
|
|
2999
|
-
* @param args optional. Unify GenerateAccount type for Legacy and Unified keys
|
|
3000
|
-
*
|
|
3001
|
-
* Account input type to generate an account using Legacy
|
|
3002
|
-
* Ed25519 or MultiEd25519 keys or without a specified `scheme`.
|
|
3003
|
-
* ```
|
|
3004
|
-
* GenerateAccountWithLegacyKey = {
|
|
3005
|
-
* scheme?: SigningSchemeInput.Ed25519 | SigningSchemeInput.MultiEd25519;
|
|
3006
|
-
* legacy: true;
|
|
3007
|
-
* };
|
|
3008
|
-
* ```
|
|
3009
|
-
*
|
|
3010
|
-
* Account input type to generate an account using Unified
|
|
3011
|
-
* Secp256k1Ecdsa key
|
|
3012
|
-
* In this case `legacy` is always false
|
|
3013
|
-
* ```
|
|
3014
|
-
* GenerateAccountWithUnifiedKey = {
|
|
3015
|
-
* scheme: SigningSchemeInput.Secp256k1Ecdsa;
|
|
3016
|
-
* legacy?: false;
|
|
3017
|
-
* };
|
|
3018
|
-
* ```
|
|
3019
|
-
*
|
|
3020
|
-
* @returns Account with the given signing scheme
|
|
2913
|
+
* Verifies that the private key associated with this public key signed the message with the given signature.
|
|
2914
|
+
* @param args.message The message that was signed
|
|
2915
|
+
* @param args.signature The signature to verify
|
|
3021
2916
|
*/
|
|
3022
|
-
|
|
2917
|
+
abstract verifySignature(args: VerifySignatureArgs): boolean;
|
|
3023
2918
|
/**
|
|
3024
|
-
*
|
|
3025
|
-
*
|
|
3026
|
-
* This is used as a local calculation and therefore is used to instantiate an `Account`
|
|
3027
|
-
* that has not had its authentication key rotated.
|
|
3028
|
-
*
|
|
3029
|
-
* @param privateKey PrivateKey - private key of the account
|
|
3030
|
-
* @param args.legacy optional. If set to false, the keypair generated is a Unified keypair. Defaults
|
|
3031
|
-
* to generating a Legacy Ed25519 keypair
|
|
3032
|
-
*
|
|
3033
|
-
* @returns Account
|
|
2919
|
+
* Get the raw public key bytes
|
|
3034
2920
|
*/
|
|
3035
|
-
|
|
3036
|
-
privateKey: PrivateKey;
|
|
3037
|
-
legacy?: boolean;
|
|
3038
|
-
}): Account$1;
|
|
2921
|
+
abstract toUint8Array(): Uint8Array;
|
|
3039
2922
|
/**
|
|
3040
|
-
*
|
|
3041
|
-
* This is primarily used to instantiate an `Account` that has had its authentication key rotated.
|
|
3042
|
-
*
|
|
3043
|
-
* @param args.privateKey PrivateKey - the underlying private key for the account
|
|
3044
|
-
* @param args.address AccountAddress - The account address the `Account` will sign for
|
|
3045
|
-
* @param args.legacy optional. If set to false, the keypair generated is a Unified keypair. Defaults
|
|
3046
|
-
* to generating a Legacy Ed25519 keypair
|
|
3047
|
-
*
|
|
3048
|
-
* @returns Account
|
|
2923
|
+
* Get the public key as a hex string with a 0x prefix e.g. 0x123456...
|
|
3049
2924
|
*/
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
2925
|
+
toString(): string;
|
|
2926
|
+
}
|
|
2927
|
+
/**
|
|
2928
|
+
* An abstract representation of an account public key.
|
|
2929
|
+
*
|
|
2930
|
+
* Provides a common interface for deriving an authentication key.
|
|
2931
|
+
*/
|
|
2932
|
+
declare abstract class AccountPublicKey extends PublicKey {
|
|
3055
2933
|
/**
|
|
3056
|
-
*
|
|
3057
|
-
*
|
|
3058
|
-
* @param args.scheme The signing scheme to derive with
|
|
3059
|
-
* @param args.path the BIP44 derive hardened path (e.g. m/44'/637'/0'/0'/0') for Ed25519,
|
|
3060
|
-
* or non-hardened path (e.g. m/44'/637'/0'/0/0) for secp256k1
|
|
3061
|
-
* Detailed description: {@link https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki}
|
|
3062
|
-
* @param args.mnemonic the mnemonic seed phrase of the account
|
|
3063
|
-
* @param args.legacy optional. If set to false, the keypair generated is a Unified keypair. Defaults
|
|
3064
|
-
* to generating a Legacy Ed25519 keypair
|
|
3065
|
-
*
|
|
3066
|
-
* @returns Account
|
|
2934
|
+
* Get the authentication key associated with this public key
|
|
3067
2935
|
*/
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
2936
|
+
abstract authKey(): AuthenticationKey;
|
|
2937
|
+
}
|
|
2938
|
+
|
|
2939
|
+
/**
|
|
2940
|
+
* An abstract representation of a private key.
|
|
2941
|
+
* It is associated to a signature scheme and provides signing capabilities.
|
|
2942
|
+
*/
|
|
2943
|
+
interface PrivateKey {
|
|
3074
2944
|
/**
|
|
3075
|
-
*
|
|
3076
|
-
*
|
|
3077
|
-
* See here for more info: {@link https://aptos.dev/concepts/accounts#single-signer-authentication}
|
|
3078
|
-
*
|
|
3079
|
-
* @param args.publicKey PublicKey - public key of the account
|
|
3080
|
-
* @returns The authentication key for the associated account
|
|
2945
|
+
* Sign the given message with the private key.
|
|
2946
|
+
* @param message in HexInput format
|
|
3081
2947
|
*/
|
|
3082
|
-
|
|
3083
|
-
publicKey: PublicKey;
|
|
3084
|
-
}): AuthenticationKey;
|
|
2948
|
+
sign(message: HexInput): Signature;
|
|
3085
2949
|
/**
|
|
3086
|
-
*
|
|
3087
|
-
*
|
|
3088
|
-
* TODO: Add sign transaction or specific types
|
|
3089
|
-
*
|
|
3090
|
-
* @param data in HexInput format
|
|
3091
|
-
* @returns Signature
|
|
2950
|
+
* Derive the public key associated with the private key
|
|
3092
2951
|
*/
|
|
3093
|
-
|
|
2952
|
+
publicKey(): PublicKey;
|
|
3094
2953
|
/**
|
|
3095
|
-
*
|
|
3096
|
-
*
|
|
3097
|
-
* @param args.message raw message data in HexInput format
|
|
3098
|
-
* @param args.signature signed message Signature
|
|
3099
|
-
* @returns
|
|
2954
|
+
* Get the private key in bytes (Uint8Array).
|
|
3100
2955
|
*/
|
|
3101
|
-
|
|
3102
|
-
message: HexInput;
|
|
3103
|
-
signature: Signature;
|
|
3104
|
-
}): boolean;
|
|
2956
|
+
toUint8Array(): Uint8Array;
|
|
3105
2957
|
}
|
|
3106
2958
|
|
|
3107
2959
|
/**
|
|
@@ -3113,7 +2965,7 @@ declare class Account$1 {
|
|
|
3113
2965
|
* Ed25519 scheme is represented in the SDK as `Legacy authentication key` and also
|
|
3114
2966
|
* as `AnyPublicKey` that represents any `Unified authentication key`
|
|
3115
2967
|
*/
|
|
3116
|
-
declare class Ed25519PublicKey extends
|
|
2968
|
+
declare class Ed25519PublicKey extends AccountPublicKey {
|
|
3117
2969
|
/**
|
|
3118
2970
|
* Length of an Ed25519 public key
|
|
3119
2971
|
*/
|
|
@@ -3129,36 +2981,30 @@ declare class Ed25519PublicKey extends PublicKey {
|
|
|
3129
2981
|
* @param hexInput A HexInput (string or Uint8Array)
|
|
3130
2982
|
*/
|
|
3131
2983
|
constructor(hexInput: HexInput);
|
|
2984
|
+
/**
|
|
2985
|
+
* Verifies a signed data with a public key
|
|
2986
|
+
* @param args.message a signed message
|
|
2987
|
+
* @param args.signature the signature of the message
|
|
2988
|
+
*/
|
|
2989
|
+
verifySignature(args: VerifySignatureArgs): boolean;
|
|
2990
|
+
authKey(): AuthenticationKey;
|
|
3132
2991
|
/**
|
|
3133
2992
|
* Get the public key in bytes (Uint8Array).
|
|
3134
2993
|
*
|
|
3135
2994
|
* @returns Uint8Array representation of the public key
|
|
3136
2995
|
*/
|
|
3137
2996
|
toUint8Array(): Uint8Array;
|
|
3138
|
-
/**
|
|
3139
|
-
* Get the public key as a hex string with the 0x prefix.
|
|
3140
|
-
*
|
|
3141
|
-
* @returns string representation of the public key
|
|
3142
|
-
*/
|
|
3143
|
-
toString(): string;
|
|
3144
|
-
/**
|
|
3145
|
-
* Verifies a signed data with a public key
|
|
3146
|
-
* @param args.message a signed message
|
|
3147
|
-
* @param args.signature the signature of the message
|
|
3148
|
-
*/
|
|
3149
|
-
verifySignature(args: {
|
|
3150
|
-
message: HexInput;
|
|
3151
|
-
signature: Ed25519Signature;
|
|
3152
|
-
}): boolean;
|
|
3153
2997
|
serialize(serializer: Serializer): void;
|
|
3154
2998
|
static deserialize(deserializer: Deserializer): Ed25519PublicKey;
|
|
3155
|
-
|
|
3156
|
-
|
|
2999
|
+
/**
|
|
3000
|
+
* @deprecated use `instanceof Ed25519PublicKey` instead.
|
|
3001
|
+
*/
|
|
3002
|
+
static isPublicKey(publicKey: AccountPublicKey): publicKey is Ed25519PublicKey;
|
|
3157
3003
|
}
|
|
3158
3004
|
/**
|
|
3159
3005
|
* Represents the private key of an Ed25519 key pair.
|
|
3160
3006
|
*/
|
|
3161
|
-
declare class Ed25519PrivateKey extends PrivateKey {
|
|
3007
|
+
declare class Ed25519PrivateKey extends Serializable implements PrivateKey {
|
|
3162
3008
|
/**
|
|
3163
3009
|
* Length of an Ed25519 private key
|
|
3164
3010
|
*/
|
|
@@ -3179,39 +3025,12 @@ declare class Ed25519PrivateKey extends PrivateKey {
|
|
|
3179
3025
|
* @param hexInput HexInput (string or Uint8Array)
|
|
3180
3026
|
*/
|
|
3181
3027
|
constructor(hexInput: HexInput);
|
|
3182
|
-
/**
|
|
3183
|
-
* Get the private key in bytes (Uint8Array).
|
|
3184
|
-
*
|
|
3185
|
-
* @returns Uint8Array representation of the private key
|
|
3186
|
-
*/
|
|
3187
|
-
toUint8Array(): Uint8Array;
|
|
3188
|
-
/**
|
|
3189
|
-
* Get the private key as a hex string with the 0x prefix.
|
|
3190
|
-
*
|
|
3191
|
-
* @returns string representation of the private key
|
|
3192
|
-
*/
|
|
3193
|
-
toString(): string;
|
|
3194
|
-
/**
|
|
3195
|
-
* Sign the given message with the private key.
|
|
3196
|
-
*
|
|
3197
|
-
* @param message in HexInput format
|
|
3198
|
-
* @returns Signature
|
|
3199
|
-
*/
|
|
3200
|
-
sign(message: HexInput): Ed25519Signature;
|
|
3201
|
-
serialize(serializer: Serializer): void;
|
|
3202
|
-
static deserialize(deserializer: Deserializer): Ed25519PrivateKey;
|
|
3203
3028
|
/**
|
|
3204
3029
|
* Generate a new random private key.
|
|
3205
3030
|
*
|
|
3206
3031
|
* @returns Ed25519PrivateKey
|
|
3207
3032
|
*/
|
|
3208
3033
|
static generate(): Ed25519PrivateKey;
|
|
3209
|
-
/**
|
|
3210
|
-
* Derive the Ed25519PublicKey for this private key.
|
|
3211
|
-
*
|
|
3212
|
-
* @returns Ed25519PublicKey
|
|
3213
|
-
*/
|
|
3214
|
-
publicKey(): Ed25519PublicKey;
|
|
3215
3034
|
/**
|
|
3216
3035
|
* Derives a private key from a mnemonic seed phrase.
|
|
3217
3036
|
*
|
|
@@ -3234,6 +3053,36 @@ declare class Ed25519PrivateKey extends PrivateKey {
|
|
|
3234
3053
|
* @returns
|
|
3235
3054
|
*/
|
|
3236
3055
|
private static fromDerivationPathInner;
|
|
3056
|
+
/**
|
|
3057
|
+
* Derive the Ed25519PublicKey for this private key.
|
|
3058
|
+
*
|
|
3059
|
+
* @returns Ed25519PublicKey
|
|
3060
|
+
*/
|
|
3061
|
+
publicKey(): Ed25519PublicKey;
|
|
3062
|
+
/**
|
|
3063
|
+
* Sign the given message with the private key.
|
|
3064
|
+
*
|
|
3065
|
+
* @param message in HexInput format
|
|
3066
|
+
* @returns Signature
|
|
3067
|
+
*/
|
|
3068
|
+
sign(message: HexInput): Ed25519Signature;
|
|
3069
|
+
/**
|
|
3070
|
+
* Get the private key in bytes (Uint8Array).
|
|
3071
|
+
*
|
|
3072
|
+
* @returns Uint8Array representation of the private key
|
|
3073
|
+
*/
|
|
3074
|
+
toUint8Array(): Uint8Array;
|
|
3075
|
+
/**
|
|
3076
|
+
* Get the private key as a hex string with the 0x prefix.
|
|
3077
|
+
*
|
|
3078
|
+
* @returns string representation of the private key
|
|
3079
|
+
*/
|
|
3080
|
+
toString(): string;
|
|
3081
|
+
serialize(serializer: Serializer): void;
|
|
3082
|
+
static deserialize(deserializer: Deserializer): Ed25519PrivateKey;
|
|
3083
|
+
/**
|
|
3084
|
+
* @deprecated use `instanceof Ed25519PrivateKey` instead.
|
|
3085
|
+
*/
|
|
3237
3086
|
static isPrivateKey(privateKey: PrivateKey): privateKey is Ed25519PrivateKey;
|
|
3238
3087
|
}
|
|
3239
3088
|
/**
|
|
@@ -3250,28 +3099,79 @@ declare class Ed25519Signature extends Signature {
|
|
|
3250
3099
|
*/
|
|
3251
3100
|
private readonly data;
|
|
3252
3101
|
constructor(hexInput: HexInput);
|
|
3253
|
-
/**
|
|
3254
|
-
* Get the signature in bytes (Uint8Array).
|
|
3255
|
-
*
|
|
3256
|
-
* @returns Uint8Array representation of the signature
|
|
3257
|
-
*/
|
|
3258
3102
|
toUint8Array(): Uint8Array;
|
|
3259
|
-
/**
|
|
3260
|
-
* Get the signature as a hex string with the 0x prefix.
|
|
3261
|
-
*
|
|
3262
|
-
* @returns string representation of the signature
|
|
3263
|
-
*/
|
|
3264
|
-
toString(): string;
|
|
3265
3103
|
serialize(serializer: Serializer): void;
|
|
3266
3104
|
static deserialize(deserializer: Deserializer): Ed25519Signature;
|
|
3267
|
-
static load(deserializer: Deserializer): Ed25519Signature;
|
|
3268
|
-
static isSignature(signature: Signature): signature is Ed25519Signature;
|
|
3269
3105
|
}
|
|
3270
3106
|
|
|
3107
|
+
type DerivedKeys = {
|
|
3108
|
+
key: Uint8Array;
|
|
3109
|
+
chainCode: Uint8Array;
|
|
3110
|
+
};
|
|
3111
|
+
/**
|
|
3112
|
+
* Aptos derive path is 637
|
|
3113
|
+
*/
|
|
3114
|
+
declare const APTOS_HARDENED_REGEX: RegExp;
|
|
3115
|
+
declare const APTOS_BIP44_REGEX: RegExp;
|
|
3116
|
+
/**
|
|
3117
|
+
* A list of supported key types and associated seeds
|
|
3118
|
+
*/
|
|
3119
|
+
declare enum KeyType {
|
|
3120
|
+
ED25519 = "ed25519 seed"
|
|
3121
|
+
}
|
|
3122
|
+
declare const HARDENED_OFFSET = 2147483648;
|
|
3123
|
+
/**
|
|
3124
|
+
* Aptos derive path is 637
|
|
3125
|
+
*
|
|
3126
|
+
* Parse and validate a path that is compliant to BIP-44 in form m/44'/637'/{account_index}'/{change_index}/{address_index}
|
|
3127
|
+
* for Secp256k1
|
|
3128
|
+
*
|
|
3129
|
+
* Note that for secp256k1, last two components must be non-hardened.
|
|
3130
|
+
*
|
|
3131
|
+
* @param path path string (e.g. `m/44'/637'/0'/0/0`).
|
|
3132
|
+
*/
|
|
3133
|
+
declare function isValidBIP44Path(path: string): boolean;
|
|
3134
|
+
/**
|
|
3135
|
+
* Aptos derive path is 637
|
|
3136
|
+
*
|
|
3137
|
+
* Parse and validate a path that is compliant to SLIP-0010 and BIP-44
|
|
3138
|
+
* in form m/44'/637'/{account_index}'/{change_index}'/{address_index}'.
|
|
3139
|
+
* See SLIP-0010 {@link https://github.com/satoshilabs/slips/blob/master/slip-0044.md}
|
|
3140
|
+
* See BIP-44 {@link https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki}
|
|
3141
|
+
*
|
|
3142
|
+
* Note that for Ed25519, all components must be hardened.
|
|
3143
|
+
* This is because non-hardened [PK] derivation would not work due to Ed25519's lack of a key homomorphism.
|
|
3144
|
+
* Specifically, you cannot derive the PK associated with derivation path a/b/c given the PK of a/b.
|
|
3145
|
+
* This is because the PK in Ed25519 is, more or less, computed as 𝑔𝐻(𝑠𝑘),
|
|
3146
|
+
* with the hash function breaking the homomorphism.
|
|
3147
|
+
*
|
|
3148
|
+
* @param path path string (e.g. `m/44'/637'/0'/0'/0'`).
|
|
3149
|
+
*/
|
|
3150
|
+
declare function isValidHardenedPath(path: string): boolean;
|
|
3151
|
+
declare const deriveKey: (hashSeed: Uint8Array | string, data: Uint8Array | string) => DerivedKeys;
|
|
3152
|
+
/**
|
|
3153
|
+
* Derive a child key from the private key
|
|
3154
|
+
* @param key
|
|
3155
|
+
* @param chainCode
|
|
3156
|
+
* @param index
|
|
3157
|
+
* @constructor
|
|
3158
|
+
*/
|
|
3159
|
+
declare const CKDPriv: ({ key, chainCode }: DerivedKeys, index: number) => DerivedKeys;
|
|
3160
|
+
/**
|
|
3161
|
+
* Splits derive path into segments
|
|
3162
|
+
* @param path
|
|
3163
|
+
*/
|
|
3164
|
+
declare const splitPath: (path: string) => Array<string>;
|
|
3165
|
+
/**
|
|
3166
|
+
* Normalizes the mnemonic by removing extra whitespace and making it lowercase
|
|
3167
|
+
* @param mnemonic the mnemonic seed phrase
|
|
3168
|
+
*/
|
|
3169
|
+
declare const mnemonicToSeed: (mnemonic: string) => Uint8Array;
|
|
3170
|
+
|
|
3271
3171
|
/**
|
|
3272
3172
|
* Represents the public key of a K-of-N Ed25519 multi-sig transaction.
|
|
3273
3173
|
*/
|
|
3274
|
-
declare class MultiEd25519PublicKey extends
|
|
3174
|
+
declare class MultiEd25519PublicKey extends AccountPublicKey {
|
|
3275
3175
|
/**
|
|
3276
3176
|
* Maximum number of public keys supported
|
|
3277
3177
|
*/
|
|
@@ -3285,56 +3185,203 @@ declare class MultiEd25519PublicKey extends PublicKey {
|
|
|
3285
3185
|
*/
|
|
3286
3186
|
static readonly MIN_THRESHOLD = 1;
|
|
3287
3187
|
/**
|
|
3288
|
-
* List of Ed25519 public keys for this
|
|
3188
|
+
* List of Ed25519 public keys for this LegacyMultiEd25519PublicKey
|
|
3289
3189
|
*/
|
|
3290
3190
|
readonly publicKeys: Ed25519PublicKey[];
|
|
3291
3191
|
/**
|
|
3292
|
-
* The minimum number of valid signatures required, for the number of public keys specified
|
|
3192
|
+
* The minimum number of valid signatures required, for the number of public keys specified
|
|
3193
|
+
*/
|
|
3194
|
+
readonly threshold: number;
|
|
3195
|
+
/**
|
|
3196
|
+
* Public key for a K-of-N multi-sig transaction. A K-of-N multi-sig transaction means that for such a
|
|
3197
|
+
* transaction to be executed, at least K out of the N authorized signers have signed the transaction
|
|
3198
|
+
* and passed the check conducted by the chain.
|
|
3199
|
+
*
|
|
3200
|
+
* @see {@link
|
|
3201
|
+
* https://aptos.dev/integration/creating-a-signed-transaction/ | Creating a Signed Transaction}
|
|
3202
|
+
*
|
|
3203
|
+
* @param args.publicKeys A list of public keys
|
|
3204
|
+
* @param args.threshold At least "threshold" signatures must be valid
|
|
3205
|
+
*/
|
|
3206
|
+
constructor(args: {
|
|
3207
|
+
publicKeys: Ed25519PublicKey[];
|
|
3208
|
+
threshold: number;
|
|
3209
|
+
});
|
|
3210
|
+
verifySignature(args: VerifySignatureArgs): boolean;
|
|
3211
|
+
authKey(): AuthenticationKey;
|
|
3212
|
+
/**
|
|
3213
|
+
* Converts a PublicKeys into Uint8Array (bytes) with: bytes = p1_bytes | ... | pn_bytes | threshold
|
|
3214
|
+
*/
|
|
3215
|
+
toUint8Array(): Uint8Array;
|
|
3216
|
+
serialize(serializer: Serializer): void;
|
|
3217
|
+
static deserialize(deserializer: Deserializer): MultiEd25519PublicKey;
|
|
3218
|
+
}
|
|
3219
|
+
/**
|
|
3220
|
+
* Represents the signature of a K-of-N Ed25519 multi-sig transaction.
|
|
3221
|
+
*/
|
|
3222
|
+
declare class MultiEd25519Signature extends Signature {
|
|
3223
|
+
/**
|
|
3224
|
+
* Maximum number of Ed25519 signatures supported
|
|
3225
|
+
*/
|
|
3226
|
+
static MAX_SIGNATURES_SUPPORTED: number;
|
|
3227
|
+
/**
|
|
3228
|
+
* Number of bytes in the bitmap representing who signed the transaction (32-bits)
|
|
3229
|
+
*/
|
|
3230
|
+
static BITMAP_LEN: number;
|
|
3231
|
+
/**
|
|
3232
|
+
* The list of underlying Ed25519 signatures
|
|
3233
|
+
*/
|
|
3234
|
+
readonly signatures: Ed25519Signature[];
|
|
3235
|
+
/**
|
|
3236
|
+
* 32-bit Bitmap representing who signed the transaction
|
|
3237
|
+
*
|
|
3238
|
+
* This is represented where each public key can be masked to determine whether the message was signed by that key.
|
|
3239
|
+
*/
|
|
3240
|
+
readonly bitmap: Uint8Array;
|
|
3241
|
+
/**
|
|
3242
|
+
* Signature for a K-of-N multi-sig transaction.
|
|
3243
|
+
*
|
|
3244
|
+
* @see {@link
|
|
3245
|
+
* https://aptos.dev/integration/creating-a-signed-transaction/#multisignature-transactions | Creating a Signed Transaction}
|
|
3246
|
+
*
|
|
3247
|
+
* @param args.signatures A list of signatures
|
|
3248
|
+
* @param args.bitmap 4 bytes, at most 32 signatures are supported. If Nth bit value is `1`, the Nth
|
|
3249
|
+
* signature should be provided in `signatures`. Bits are read from left to right.
|
|
3250
|
+
* Alternatively, you can specify an array of bitmap positions.
|
|
3251
|
+
* Valid position should range between 0 and 31.
|
|
3252
|
+
* @see MultiEd25519Signature.createBitmap
|
|
3253
|
+
*/
|
|
3254
|
+
constructor(args: {
|
|
3255
|
+
signatures: Ed25519Signature[];
|
|
3256
|
+
bitmap: Uint8Array | number[];
|
|
3257
|
+
});
|
|
3258
|
+
/**
|
|
3259
|
+
* Converts a MultiSignature into Uint8Array (bytes) with `bytes = s1_bytes | ... | sn_bytes | bitmap`
|
|
3260
|
+
*/
|
|
3261
|
+
toUint8Array(): Uint8Array;
|
|
3262
|
+
serialize(serializer: Serializer): void;
|
|
3263
|
+
static deserialize(deserializer: Deserializer): MultiEd25519Signature;
|
|
3264
|
+
/**
|
|
3265
|
+
* Helper method to create a bitmap out of the specified bit positions
|
|
3266
|
+
* @param args.bits The bitmap positions that should be set. A position starts at index 0.
|
|
3267
|
+
* Valid position should range between 0 and 31.
|
|
3268
|
+
* @example
|
|
3269
|
+
* Here's an example of valid `bits`
|
|
3270
|
+
* ```
|
|
3271
|
+
* [0, 2, 31]
|
|
3272
|
+
* ```
|
|
3273
|
+
* `[0, 2, 31]` means the 1st, 3rd and 32nd bits should be set in the bitmap.
|
|
3274
|
+
* The result bitmap should be 0b1010000000000000000000000000001
|
|
3275
|
+
*
|
|
3276
|
+
* @returns bitmap that is 32bit long
|
|
3277
|
+
*/
|
|
3278
|
+
static createBitmap(args: {
|
|
3279
|
+
bits: number[];
|
|
3280
|
+
}): Uint8Array;
|
|
3281
|
+
}
|
|
3282
|
+
|
|
3283
|
+
/**
|
|
3284
|
+
* Represents any public key supported by Aptos.
|
|
3285
|
+
*
|
|
3286
|
+
* Since [AIP-55](https://github.com/aptos-foundation/AIPs/pull/263) Aptos supports
|
|
3287
|
+
* `Legacy` and `Unified` authentication keys.
|
|
3288
|
+
*
|
|
3289
|
+
* Any unified authentication key is represented in the SDK as `AnyPublicKey`.
|
|
3290
|
+
*/
|
|
3291
|
+
declare class AnyPublicKey extends AccountPublicKey {
|
|
3292
|
+
/**
|
|
3293
|
+
* Reference to the inner public key
|
|
3294
|
+
*/
|
|
3295
|
+
readonly publicKey: PublicKey;
|
|
3296
|
+
/**
|
|
3297
|
+
* Index of the underlying enum variant
|
|
3298
|
+
*/
|
|
3299
|
+
readonly variant: AnyPublicKeyVariant;
|
|
3300
|
+
constructor(publicKey: PublicKey);
|
|
3301
|
+
verifySignature(args: VerifySignatureArgs): boolean;
|
|
3302
|
+
authKey(): AuthenticationKey;
|
|
3303
|
+
toUint8Array(): Uint8Array;
|
|
3304
|
+
serialize(serializer: Serializer): void;
|
|
3305
|
+
static deserialize(deserializer: Deserializer): AnyPublicKey;
|
|
3306
|
+
/**
|
|
3307
|
+
* @deprecated use `instanceof AnyPublicKey` instead.
|
|
3308
|
+
*/
|
|
3309
|
+
static isPublicKey(publicKey: AccountPublicKey): publicKey is AnyPublicKey;
|
|
3310
|
+
/**
|
|
3311
|
+
* @deprecated use `publicKey instanceof Ed25519PublicKey` instead.
|
|
3312
|
+
*/
|
|
3313
|
+
isEd25519(): boolean;
|
|
3314
|
+
/**
|
|
3315
|
+
* @deprecated use `publicKey instanceof Secp256k1PublicKey` instead.
|
|
3316
|
+
*/
|
|
3317
|
+
isSecp256k1PublicKey(): boolean;
|
|
3318
|
+
}
|
|
3319
|
+
/**
|
|
3320
|
+
* Instance of signature that uses the SingleKey authentication scheme.
|
|
3321
|
+
* This signature can only be generated by a `SingleKeySigner`, since it uses the
|
|
3322
|
+
* same authentication scheme.
|
|
3323
|
+
*/
|
|
3324
|
+
declare class AnySignature extends Signature {
|
|
3325
|
+
readonly signature: Signature;
|
|
3326
|
+
/**
|
|
3327
|
+
* Index of the underlying enum variant
|
|
3328
|
+
*/
|
|
3329
|
+
private readonly variant;
|
|
3330
|
+
constructor(signature: Signature);
|
|
3331
|
+
toUint8Array(): Uint8Array;
|
|
3332
|
+
serialize(serializer: Serializer): void;
|
|
3333
|
+
static deserialize(deserializer: Deserializer): AnySignature;
|
|
3334
|
+
}
|
|
3335
|
+
|
|
3336
|
+
/**
|
|
3337
|
+
* Represents the public key of a multi-agent account.
|
|
3338
|
+
*
|
|
3339
|
+
* The public keys of each individual agent can be any type of public key supported by Aptos.
|
|
3340
|
+
* Since [AIP-55](https://github.com/aptos-foundation/AIPs/pull/263) Aptos supports
|
|
3341
|
+
* `Legacy` and `Unified` authentication keys.
|
|
3342
|
+
*/
|
|
3343
|
+
declare class MultiKey extends AccountPublicKey {
|
|
3344
|
+
/**
|
|
3345
|
+
* List of any public keys
|
|
3293
3346
|
*/
|
|
3294
|
-
readonly
|
|
3347
|
+
readonly publicKeys: AnyPublicKey[];
|
|
3295
3348
|
/**
|
|
3296
|
-
*
|
|
3297
|
-
* transaction to be executed, at least K out of the N authorized signers have signed the transaction
|
|
3298
|
-
* and passed the check conducted by the chain.
|
|
3299
|
-
*
|
|
3300
|
-
* @see {@link
|
|
3301
|
-
* https://aptos.dev/integration/creating-a-signed-transaction/ | Creating a Signed Transaction}
|
|
3302
|
-
*
|
|
3303
|
-
* @param args.publicKeys A list of public keys
|
|
3304
|
-
* @param args.threshold At least "threshold" signatures must be valid
|
|
3349
|
+
* The minimum number of valid signatures required, for the number of public keys specified
|
|
3305
3350
|
*/
|
|
3351
|
+
readonly signaturesRequired: number;
|
|
3306
3352
|
constructor(args: {
|
|
3307
|
-
publicKeys:
|
|
3308
|
-
|
|
3353
|
+
publicKeys: Array<PublicKey>;
|
|
3354
|
+
signaturesRequired: number;
|
|
3309
3355
|
});
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
*/
|
|
3356
|
+
verifySignature(args: VerifySignatureArgs): boolean;
|
|
3357
|
+
authKey(): AuthenticationKey;
|
|
3313
3358
|
toUint8Array(): Uint8Array;
|
|
3314
|
-
toString(): string;
|
|
3315
|
-
verifySignature(args: {
|
|
3316
|
-
message: HexInput;
|
|
3317
|
-
signature: MultiEd25519Signature;
|
|
3318
|
-
}): boolean;
|
|
3319
3359
|
serialize(serializer: Serializer): void;
|
|
3320
|
-
static deserialize(deserializer: Deserializer):
|
|
3321
|
-
}
|
|
3322
|
-
/**
|
|
3323
|
-
* Represents the signature of a K-of-N Ed25519 multi-sig transaction.
|
|
3324
|
-
*/
|
|
3325
|
-
declare class MultiEd25519Signature extends Signature {
|
|
3360
|
+
static deserialize(deserializer: Deserializer): MultiKey;
|
|
3326
3361
|
/**
|
|
3327
|
-
*
|
|
3362
|
+
* Create a bitmap that holds the mapping from the original public keys
|
|
3363
|
+
* to the signatures passed in
|
|
3364
|
+
*
|
|
3365
|
+
* @param args.bits array of the index mapping to the matching public keys
|
|
3366
|
+
* @returns Uint8array bit map
|
|
3328
3367
|
*/
|
|
3329
|
-
|
|
3368
|
+
createBitmap(args: {
|
|
3369
|
+
bits: number[];
|
|
3370
|
+
}): Uint8Array;
|
|
3371
|
+
}
|
|
3372
|
+
declare class MultiKeySignature extends Signature {
|
|
3330
3373
|
/**
|
|
3331
3374
|
* Number of bytes in the bitmap representing who signed the transaction (32-bits)
|
|
3332
3375
|
*/
|
|
3333
3376
|
static BITMAP_LEN: number;
|
|
3377
|
+
/**
|
|
3378
|
+
* Maximum number of Ed25519 signatures supported
|
|
3379
|
+
*/
|
|
3380
|
+
static MAX_SIGNATURES_SUPPORTED: number;
|
|
3334
3381
|
/**
|
|
3335
3382
|
* The list of underlying Ed25519 signatures
|
|
3336
3383
|
*/
|
|
3337
|
-
readonly signatures:
|
|
3384
|
+
readonly signatures: AnySignature[];
|
|
3338
3385
|
/**
|
|
3339
3386
|
* 32-bit Bitmap representing who signed the transaction
|
|
3340
3387
|
*
|
|
@@ -3352,14 +3399,9 @@ declare class MultiEd25519Signature extends Signature {
|
|
|
3352
3399
|
* signature should be provided in `signatures`. Bits are read from left to right
|
|
3353
3400
|
*/
|
|
3354
3401
|
constructor(args: {
|
|
3355
|
-
signatures:
|
|
3356
|
-
bitmap: Uint8Array;
|
|
3402
|
+
signatures: Array<Signature | AnySignature>;
|
|
3403
|
+
bitmap: Uint8Array | number[];
|
|
3357
3404
|
});
|
|
3358
|
-
/**
|
|
3359
|
-
* Converts a MultiSignature into Uint8Array (bytes) with `bytes = s1_bytes | ... | sn_bytes | bitmap`
|
|
3360
|
-
*/
|
|
3361
|
-
toUint8Array(): Uint8Array;
|
|
3362
|
-
toString(): string;
|
|
3363
3405
|
/**
|
|
3364
3406
|
* Helper method to create a bitmap out of the specified bit positions
|
|
3365
3407
|
* @param args.bits The bitmap positions that should be set. A position starts at index 0.
|
|
@@ -3377,8 +3419,9 @@ declare class MultiEd25519Signature extends Signature {
|
|
|
3377
3419
|
static createBitmap(args: {
|
|
3378
3420
|
bits: number[];
|
|
3379
3421
|
}): Uint8Array;
|
|
3422
|
+
toUint8Array(): Uint8Array;
|
|
3380
3423
|
serialize(serializer: Serializer): void;
|
|
3381
|
-
static deserialize(deserializer: Deserializer):
|
|
3424
|
+
static deserialize(deserializer: Deserializer): MultiKeySignature;
|
|
3382
3425
|
}
|
|
3383
3426
|
|
|
3384
3427
|
/**
|
|
@@ -3395,38 +3438,20 @@ declare class Secp256k1PublicKey extends PublicKey {
|
|
|
3395
3438
|
* @param hexInput A HexInput (string or Uint8Array)
|
|
3396
3439
|
*/
|
|
3397
3440
|
constructor(hexInput: HexInput);
|
|
3398
|
-
|
|
3399
|
-
* Get the public key in bytes (Uint8Array).
|
|
3400
|
-
*
|
|
3401
|
-
* @returns Uint8Array representation of the public key
|
|
3402
|
-
*/
|
|
3441
|
+
verifySignature(args: VerifySignatureArgs): boolean;
|
|
3403
3442
|
toUint8Array(): Uint8Array;
|
|
3404
|
-
/**
|
|
3405
|
-
* Get the public key as a hex string with the 0x prefix.
|
|
3406
|
-
*
|
|
3407
|
-
* @returns string representation of the public key
|
|
3408
|
-
*/
|
|
3409
|
-
toString(): string;
|
|
3410
|
-
/**
|
|
3411
|
-
* Verifies a signed data with a public key
|
|
3412
|
-
*
|
|
3413
|
-
* @param args.message message
|
|
3414
|
-
* @param args.signature The signature
|
|
3415
|
-
* @returns true if the signature is valid
|
|
3416
|
-
*/
|
|
3417
|
-
verifySignature(args: {
|
|
3418
|
-
message: HexInput;
|
|
3419
|
-
signature: Secp256k1Signature;
|
|
3420
|
-
}): boolean;
|
|
3421
3443
|
serialize(serializer: Serializer): void;
|
|
3422
3444
|
static deserialize(deserializer: Deserializer): Secp256k1PublicKey;
|
|
3423
|
-
|
|
3445
|
+
/**
|
|
3446
|
+
* @deprecated use `instanceof Secp256k1PublicKey` instead
|
|
3447
|
+
* @param publicKey
|
|
3448
|
+
*/
|
|
3424
3449
|
static isPublicKey(publicKey: PublicKey): publicKey is Secp256k1PublicKey;
|
|
3425
3450
|
}
|
|
3426
3451
|
/**
|
|
3427
3452
|
* A Secp256k1 ecdsa private key
|
|
3428
3453
|
*/
|
|
3429
|
-
declare class Secp256k1PrivateKey extends PrivateKey {
|
|
3454
|
+
declare class Secp256k1PrivateKey extends Serializable implements PrivateKey {
|
|
3430
3455
|
/**
|
|
3431
3456
|
* Length of Secp256k1 ecdsa private key
|
|
3432
3457
|
*/
|
|
@@ -3442,39 +3467,12 @@ declare class Secp256k1PrivateKey extends PrivateKey {
|
|
|
3442
3467
|
* @param hexInput A HexInput (string or Uint8Array)
|
|
3443
3468
|
*/
|
|
3444
3469
|
constructor(hexInput: HexInput);
|
|
3445
|
-
/**
|
|
3446
|
-
* Get the private key in bytes (Uint8Array).
|
|
3447
|
-
*
|
|
3448
|
-
* @returns
|
|
3449
|
-
*/
|
|
3450
|
-
toUint8Array(): Uint8Array;
|
|
3451
|
-
/**
|
|
3452
|
-
* Get the private key as a hex string with the 0x prefix.
|
|
3453
|
-
*
|
|
3454
|
-
* @returns string representation of the private key
|
|
3455
|
-
*/
|
|
3456
|
-
toString(): string;
|
|
3457
|
-
/**
|
|
3458
|
-
* Sign the given message with the private key.
|
|
3459
|
-
*
|
|
3460
|
-
* @param message in HexInput format
|
|
3461
|
-
* @returns Signature
|
|
3462
|
-
*/
|
|
3463
|
-
sign(message: HexInput): Secp256k1Signature;
|
|
3464
|
-
serialize(serializer: Serializer): void;
|
|
3465
|
-
static deserialize(deserializer: Deserializer): Secp256k1PrivateKey;
|
|
3466
3470
|
/**
|
|
3467
3471
|
* Generate a new random private key.
|
|
3468
3472
|
*
|
|
3469
3473
|
* @returns Secp256k1PrivateKey
|
|
3470
3474
|
*/
|
|
3471
3475
|
static generate(): Secp256k1PrivateKey;
|
|
3472
|
-
/**
|
|
3473
|
-
* Derive the Secp256k1PublicKey from this private key.
|
|
3474
|
-
*
|
|
3475
|
-
* @returns Secp256k1PublicKey
|
|
3476
|
-
*/
|
|
3477
|
-
publicKey(): Secp256k1PublicKey;
|
|
3478
3476
|
/**
|
|
3479
3477
|
* Derives a private key from a mnemonic seed phrase.
|
|
3480
3478
|
*
|
|
@@ -3494,10 +3492,40 @@ declare class Secp256k1PrivateKey extends PrivateKey {
|
|
|
3494
3492
|
* @returns The generated key
|
|
3495
3493
|
*/
|
|
3496
3494
|
private static fromDerivationPathInner;
|
|
3495
|
+
/**
|
|
3496
|
+
* Sign the given message with the private key.
|
|
3497
|
+
*
|
|
3498
|
+
* @param message in HexInput format
|
|
3499
|
+
* @returns Signature
|
|
3500
|
+
*/
|
|
3501
|
+
sign(message: HexInput): Secp256k1Signature;
|
|
3502
|
+
/**
|
|
3503
|
+
* Derive the Secp256k1PublicKey from this private key.
|
|
3504
|
+
*
|
|
3505
|
+
* @returns Secp256k1PublicKey
|
|
3506
|
+
*/
|
|
3507
|
+
publicKey(): Secp256k1PublicKey;
|
|
3508
|
+
/**
|
|
3509
|
+
* Get the private key in bytes (Uint8Array).
|
|
3510
|
+
*
|
|
3511
|
+
* @returns
|
|
3512
|
+
*/
|
|
3513
|
+
toUint8Array(): Uint8Array;
|
|
3514
|
+
/**
|
|
3515
|
+
* Get the private key as a hex string with the 0x prefix.
|
|
3516
|
+
*
|
|
3517
|
+
* @returns string representation of the private key
|
|
3518
|
+
*/
|
|
3519
|
+
toString(): string;
|
|
3520
|
+
serialize(serializer: Serializer): void;
|
|
3521
|
+
static deserialize(deserializer: Deserializer): Secp256k1PrivateKey;
|
|
3522
|
+
/**
|
|
3523
|
+
* @deprecated use `instanceof Secp256k1PrivateKey` instead
|
|
3524
|
+
*/
|
|
3497
3525
|
static isPrivateKey(privateKey: PrivateKey): privateKey is Secp256k1PrivateKey;
|
|
3498
3526
|
}
|
|
3499
3527
|
/**
|
|
3500
|
-
* A signature of a message signed using
|
|
3528
|
+
* A signature of a message signed using a Secp256k1 ecdsa private key
|
|
3501
3529
|
*/
|
|
3502
3530
|
declare class Secp256k1Signature extends Signature {
|
|
3503
3531
|
/**
|
|
@@ -3515,188 +3543,360 @@ declare class Secp256k1Signature extends Signature {
|
|
|
3515
3543
|
* @param hexInput A HexInput (string or Uint8Array)
|
|
3516
3544
|
*/
|
|
3517
3545
|
constructor(hexInput: HexInput);
|
|
3518
|
-
/**
|
|
3519
|
-
* Get the signature in bytes (Uint8Array).
|
|
3520
|
-
*
|
|
3521
|
-
* @returns Uint8Array representation of the signature
|
|
3522
|
-
*/
|
|
3523
3546
|
toUint8Array(): Uint8Array;
|
|
3524
|
-
/**
|
|
3525
|
-
* Get the signature as a hex string with the 0x prefix.
|
|
3526
|
-
*
|
|
3527
|
-
* @returns string representation of the signature
|
|
3528
|
-
*/
|
|
3529
|
-
toString(): string;
|
|
3530
3547
|
serialize(serializer: Serializer): void;
|
|
3531
3548
|
static deserialize(deserializer: Deserializer): Secp256k1Signature;
|
|
3532
|
-
static load(deserializer: Deserializer): Secp256k1Signature;
|
|
3533
|
-
static isSignature(signature: Signature): signature is Secp256k1Signature;
|
|
3534
3549
|
}
|
|
3535
3550
|
|
|
3536
|
-
declare class
|
|
3537
|
-
|
|
3538
|
-
|
|
3551
|
+
declare abstract class AccountAuthenticator extends Serializable {
|
|
3552
|
+
abstract serialize(serializer: Serializer): void;
|
|
3553
|
+
static deserialize(deserializer: Deserializer): AccountAuthenticator;
|
|
3554
|
+
isEd25519(): this is AccountAuthenticatorEd25519;
|
|
3555
|
+
isMultiEd25519(): this is AccountAuthenticatorMultiEd25519;
|
|
3556
|
+
isSingleKey(): this is AccountAuthenticatorSingleKey;
|
|
3557
|
+
isMultiKey(): this is AccountAuthenticatorMultiKey;
|
|
3558
|
+
}
|
|
3559
|
+
/**
|
|
3560
|
+
* Transaction authenticator Ed25519 for a multi signer transaction
|
|
3561
|
+
*
|
|
3562
|
+
* @param public_key Account's Ed25519 public key.
|
|
3563
|
+
* @param signature Account's Ed25519 signature
|
|
3564
|
+
*
|
|
3565
|
+
*/
|
|
3566
|
+
declare class AccountAuthenticatorEd25519 extends AccountAuthenticator {
|
|
3567
|
+
readonly public_key: Ed25519PublicKey;
|
|
3568
|
+
readonly signature: Ed25519Signature;
|
|
3569
|
+
constructor(public_key: Ed25519PublicKey, signature: Ed25519Signature);
|
|
3570
|
+
serialize(serializer: Serializer): void;
|
|
3571
|
+
static load(deserializer: Deserializer): AccountAuthenticatorEd25519;
|
|
3572
|
+
}
|
|
3573
|
+
/**
|
|
3574
|
+
* Transaction authenticator Multi Ed25519 for a multi signers transaction
|
|
3575
|
+
*
|
|
3576
|
+
* @param public_key Account's MultiEd25519 public key.
|
|
3577
|
+
* @param signature Account's MultiEd25519 signature
|
|
3578
|
+
*
|
|
3579
|
+
*/
|
|
3580
|
+
declare class AccountAuthenticatorMultiEd25519 extends AccountAuthenticator {
|
|
3581
|
+
readonly public_key: MultiEd25519PublicKey;
|
|
3582
|
+
readonly signature: MultiEd25519Signature;
|
|
3583
|
+
constructor(public_key: MultiEd25519PublicKey, signature: MultiEd25519Signature);
|
|
3584
|
+
serialize(serializer: Serializer): void;
|
|
3585
|
+
static load(deserializer: Deserializer): AccountAuthenticatorMultiEd25519;
|
|
3586
|
+
}
|
|
3587
|
+
/**
|
|
3588
|
+
* AccountAuthenticatorSingleKey for a single signer
|
|
3589
|
+
*
|
|
3590
|
+
* @param public_key AnyPublicKey
|
|
3591
|
+
* @param signature AnySignature
|
|
3592
|
+
*
|
|
3593
|
+
*/
|
|
3594
|
+
declare class AccountAuthenticatorSingleKey extends AccountAuthenticator {
|
|
3595
|
+
readonly public_key: AnyPublicKey;
|
|
3596
|
+
readonly signature: AnySignature;
|
|
3597
|
+
constructor(public_key: AnyPublicKey, signature: AnySignature);
|
|
3598
|
+
serialize(serializer: Serializer): void;
|
|
3599
|
+
static load(deserializer: Deserializer): AccountAuthenticatorSingleKey;
|
|
3600
|
+
}
|
|
3601
|
+
/**
|
|
3602
|
+
* AccountAuthenticatorMultiKey for a multi signer
|
|
3603
|
+
*
|
|
3604
|
+
* @param public_keys MultiKey
|
|
3605
|
+
* @param signatures Signature
|
|
3606
|
+
*
|
|
3607
|
+
*/
|
|
3608
|
+
declare class AccountAuthenticatorMultiKey extends AccountAuthenticator {
|
|
3609
|
+
readonly public_keys: MultiKey;
|
|
3610
|
+
readonly signatures: Array<AnySignature>;
|
|
3611
|
+
readonly signatures_bitmap: Uint8Array;
|
|
3612
|
+
constructor(public_keys: MultiKey, signatures: Array<AnySignature>, signatures_bitmap: Uint8Array);
|
|
3613
|
+
serialize(serializer: Serializer): void;
|
|
3614
|
+
static load(deserializer: Deserializer): AccountAuthenticatorMultiKey;
|
|
3615
|
+
}
|
|
3616
|
+
|
|
3617
|
+
interface SingleKeySignerConstructorArgs {
|
|
3618
|
+
privateKey: PrivateKey;
|
|
3619
|
+
address?: AccountAddressInput;
|
|
3620
|
+
}
|
|
3621
|
+
interface SingleKeySignerGenerateArgs {
|
|
3622
|
+
scheme?: SigningSchemeInput;
|
|
3623
|
+
}
|
|
3624
|
+
type SingleKeySignerFromDerivationPathArgs = SingleKeySignerGenerateArgs & {
|
|
3625
|
+
path: string;
|
|
3626
|
+
mnemonic: string;
|
|
3627
|
+
};
|
|
3628
|
+
interface VerifySingleKeySignatureArgs {
|
|
3629
|
+
message: HexInput;
|
|
3630
|
+
signature: AnySignature;
|
|
3631
|
+
}
|
|
3632
|
+
/**
|
|
3633
|
+
* Signer implementation for the SingleKey authentication scheme.
|
|
3634
|
+
* This extends a SingleKeyAccount by adding signing capabilities through a valid private key.
|
|
3635
|
+
* Currently, the only supported signature schemes are Ed25519 and Secp256k1.
|
|
3636
|
+
*
|
|
3637
|
+
* Note: Generating a signer instance does not create the account on-chain.
|
|
3638
|
+
*/
|
|
3639
|
+
declare class SingleKeyAccount implements Account$1 {
|
|
3539
3640
|
/**
|
|
3540
|
-
*
|
|
3541
|
-
*
|
|
3542
|
-
* @returns Uint8Array representation of the public key
|
|
3641
|
+
* Private key associated with the account
|
|
3543
3642
|
*/
|
|
3544
|
-
|
|
3643
|
+
readonly privateKey: PrivateKey;
|
|
3644
|
+
readonly publicKey: AnyPublicKey;
|
|
3645
|
+
readonly accountAddress: AccountAddress;
|
|
3646
|
+
readonly signingScheme = SigningScheme.SingleKey;
|
|
3647
|
+
constructor(args: SingleKeySignerConstructorArgs);
|
|
3648
|
+
/**
|
|
3649
|
+
* Derives an account from a randomly generated private key.
|
|
3650
|
+
* Default generation is using an Ed25519 key
|
|
3651
|
+
* @returns Account with the given signature scheme
|
|
3652
|
+
*/
|
|
3653
|
+
static generate(args?: SingleKeySignerGenerateArgs): SingleKeyAccount;
|
|
3545
3654
|
/**
|
|
3546
|
-
*
|
|
3655
|
+
* Derives an account with bip44 path and mnemonics,
|
|
3656
|
+
* Default to using an Ed25519 signature scheme.
|
|
3547
3657
|
*
|
|
3548
|
-
* @
|
|
3658
|
+
* @param args.scheme The signature scheme to derive the private key with
|
|
3659
|
+
* @param args.path the BIP44 derive hardened path (e.g. m/44'/637'/0'/0'/0') for Ed25519,
|
|
3660
|
+
* or non-hardened path (e.g. m/44'/637'/0'/0/0) for secp256k1
|
|
3661
|
+
* Detailed description: {@link https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki}
|
|
3662
|
+
* @param args.mnemonic the mnemonic seed phrase of the account
|
|
3549
3663
|
*/
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3664
|
+
static fromDerivationPath(args: SingleKeySignerFromDerivationPathArgs): SingleKeyAccount;
|
|
3665
|
+
verifySignature(args: VerifySingleKeySignatureArgs): boolean;
|
|
3666
|
+
signWithAuthenticator(message: HexInput): AccountAuthenticatorSingleKey;
|
|
3667
|
+
sign(message: HexInput): AnySignature;
|
|
3553
3668
|
}
|
|
3554
3669
|
|
|
3555
3670
|
/**
|
|
3556
|
-
*
|
|
3671
|
+
* Arguments for creating an `Ed25519Account` from an `Ed25519PrivateKey`.
|
|
3672
|
+
* This is the default input type when passing an `Ed25519PrivateKey`.
|
|
3673
|
+
* In order to use the SingleKey authentication scheme, `legacy` needs to be explicitly set to false.
|
|
3674
|
+
*/
|
|
3675
|
+
interface CreateEd25519AccountFromPrivateKeyArgs {
|
|
3676
|
+
privateKey: Ed25519PrivateKey;
|
|
3677
|
+
address?: AccountAddressInput;
|
|
3678
|
+
legacy?: true;
|
|
3679
|
+
}
|
|
3680
|
+
/**
|
|
3681
|
+
* Arguments for creating an `SingleKeyAccount` from an `Ed25519PrivateKey`.
|
|
3682
|
+
* The `legacy` argument needs to be explicitly set to false in order to
|
|
3683
|
+
* use the `SingleKey` authentication scheme.
|
|
3684
|
+
*/
|
|
3685
|
+
interface CreateEd25519SingleKeyAccountFromPrivateKeyArgs {
|
|
3686
|
+
privateKey: Ed25519PrivateKey;
|
|
3687
|
+
address?: AccountAddressInput;
|
|
3688
|
+
legacy: false;
|
|
3689
|
+
}
|
|
3690
|
+
/**
|
|
3691
|
+
* Arguments for creating an `SingleKeyAccount` from any supported private key
|
|
3692
|
+
* that is not an `Ed25519PrivateKey`.
|
|
3693
|
+
* The `legacy` argument defaults to false and cannot be explicitly set to true.
|
|
3694
|
+
*/
|
|
3695
|
+
interface CreateSingleKeyAccountFromPrivateKeyArgs {
|
|
3696
|
+
privateKey: Exclude<PrivateKey, Ed25519PrivateKey>;
|
|
3697
|
+
address?: AccountAddressInput;
|
|
3698
|
+
legacy?: false;
|
|
3699
|
+
}
|
|
3700
|
+
/**
|
|
3701
|
+
* Arguments for creating an opaque `Account` from any supported private key.
|
|
3702
|
+
* This is used when the private key type is not known at compilation time.
|
|
3703
|
+
*/
|
|
3704
|
+
interface CreateAccountFromPrivateKeyArgs {
|
|
3705
|
+
privateKey: PrivateKey;
|
|
3706
|
+
address?: AccountAddressInput;
|
|
3707
|
+
legacy?: boolean;
|
|
3708
|
+
}
|
|
3709
|
+
/**
|
|
3710
|
+
* Arguments for generating an `Ed25519Account`.
|
|
3711
|
+
* This is the input type used by default.
|
|
3712
|
+
*/
|
|
3713
|
+
interface GenerateEd25519AccountArgs {
|
|
3714
|
+
scheme?: SigningSchemeInput.Ed25519;
|
|
3715
|
+
legacy?: true;
|
|
3716
|
+
}
|
|
3717
|
+
/**
|
|
3718
|
+
* Arguments for generating an `SingleKeyAccount` with ah underlying `Ed25519PrivateKey`.
|
|
3719
|
+
* The `legacy` argument needs to be explicitly set to false,
|
|
3720
|
+
* otherwise an `Ed25519Account` will be returned instead.
|
|
3721
|
+
*/
|
|
3722
|
+
interface GenerateEd25519SingleKeyAccountArgs {
|
|
3723
|
+
scheme?: SigningSchemeInput.Ed25519;
|
|
3724
|
+
legacy: false;
|
|
3725
|
+
}
|
|
3726
|
+
/**
|
|
3727
|
+
* Arguments for generating an `SingleKeyAccount` with any supported private key
|
|
3728
|
+
* that is not an `Ed25519PrivateKey`.
|
|
3729
|
+
* The `legacy` argument defaults to false and cannot be explicitly set to true.
|
|
3730
|
+
*/
|
|
3731
|
+
interface GenerateSingleKeyAccountArgs {
|
|
3732
|
+
scheme: Exclude<SigningSchemeInput, SigningSchemeInput.Ed25519>;
|
|
3733
|
+
legacy?: false;
|
|
3734
|
+
}
|
|
3735
|
+
/**
|
|
3736
|
+
* Arguments for generating an opaque `Account`.
|
|
3737
|
+
* This is used when the input signature scheme is not known at compilation time.
|
|
3738
|
+
*/
|
|
3739
|
+
interface GenerateAccountArgs {
|
|
3740
|
+
scheme?: SigningSchemeInput;
|
|
3741
|
+
legacy?: boolean;
|
|
3742
|
+
}
|
|
3743
|
+
/**
|
|
3744
|
+
* Arguments for deriving a private key from a mnemonic phrase and a BIP44 path.
|
|
3745
|
+
*/
|
|
3746
|
+
interface PrivateKeyFromDerivationPathArgs {
|
|
3747
|
+
path: string;
|
|
3748
|
+
mnemonic: string;
|
|
3749
|
+
}
|
|
3750
|
+
/**
|
|
3751
|
+
* Interface for a generic Aptos account.
|
|
3557
3752
|
*
|
|
3558
|
-
*
|
|
3559
|
-
*
|
|
3753
|
+
* The interface is defined as abstract class to provide a single entrypoint for account generation,
|
|
3754
|
+
* either through `Account.generate()` or `Account.fromDerivationPath`.
|
|
3755
|
+
* Despite this being an abstract class, it should be treated as an interface and enforced using
|
|
3756
|
+
* the `implements` keyword.
|
|
3560
3757
|
*
|
|
3561
|
-
*
|
|
3758
|
+
* Note: Generating an account instance does not create the account on-chain.
|
|
3562
3759
|
*/
|
|
3563
|
-
declare class
|
|
3760
|
+
declare abstract class Account$1 {
|
|
3564
3761
|
/**
|
|
3565
|
-
*
|
|
3762
|
+
* Private key associated with the account.
|
|
3763
|
+
* Note: this will be removed in the next major release,
|
|
3764
|
+
* as not all accounts have a private key.
|
|
3566
3765
|
*/
|
|
3567
|
-
readonly
|
|
3568
|
-
constructor(publicKey: PublicKey);
|
|
3766
|
+
abstract readonly privateKey: PrivateKey;
|
|
3569
3767
|
/**
|
|
3570
|
-
*
|
|
3768
|
+
* Public key associated with the account
|
|
3769
|
+
*/
|
|
3770
|
+
abstract readonly publicKey: AccountPublicKey;
|
|
3771
|
+
/**
|
|
3772
|
+
* Account address associated with the account
|
|
3773
|
+
*/
|
|
3774
|
+
abstract readonly accountAddress: AccountAddress;
|
|
3775
|
+
/**
|
|
3776
|
+
* Signing scheme used to sign transactions
|
|
3777
|
+
*/
|
|
3778
|
+
abstract signingScheme: SigningScheme;
|
|
3779
|
+
/**
|
|
3780
|
+
* Derives an account from a randomly generated private key.
|
|
3781
|
+
* @param args.scheme The signature scheme to use, to generate the private key
|
|
3782
|
+
* @param args.legacy Whether to use a legacy authentication scheme, when applicable
|
|
3783
|
+
* @returns An account compatible with the provided signature scheme
|
|
3784
|
+
*/
|
|
3785
|
+
static generate(args?: GenerateEd25519AccountArgs): Ed25519Account;
|
|
3786
|
+
static generate(args: GenerateEd25519SingleKeyAccountArgs): SingleKeyAccount;
|
|
3787
|
+
static generate(args: GenerateSingleKeyAccountArgs): SingleKeyAccount;
|
|
3788
|
+
static generate(args: GenerateAccountArgs): Account$1;
|
|
3789
|
+
/**
|
|
3790
|
+
* Creates an account from the provided private key.
|
|
3571
3791
|
*
|
|
3572
|
-
* @
|
|
3792
|
+
* @param args.privateKey a valid private key
|
|
3793
|
+
* @param args.address the account's address. If not provided, it will be derived from the public key.
|
|
3794
|
+
* @param args.legacy Whether to use a legacy authentication scheme, when applicable
|
|
3573
3795
|
*/
|
|
3574
|
-
|
|
3796
|
+
static fromPrivateKey(args: CreateEd25519AccountFromPrivateKeyArgs): Ed25519Account;
|
|
3797
|
+
static fromPrivateKey(args: CreateEd25519SingleKeyAccountFromPrivateKeyArgs): SingleKeyAccount;
|
|
3798
|
+
static fromPrivateKey(args: CreateSingleKeyAccountFromPrivateKeyArgs): SingleKeyAccount;
|
|
3799
|
+
static fromPrivateKey(args: CreateAccountFromPrivateKeyArgs): Account$1;
|
|
3575
3800
|
/**
|
|
3576
|
-
*
|
|
3801
|
+
* @deprecated use `fromPrivateKey` instead.
|
|
3802
|
+
* Instantiates an account given a private key and a specified account address.
|
|
3803
|
+
* This is primarily used to instantiate an `Account` that has had its authentication key rotated.
|
|
3804
|
+
*
|
|
3805
|
+
* @param args.privateKey PrivateKey - the underlying private key for the account
|
|
3806
|
+
* @param args.address AccountAddress - The account address the `Account` will sign for
|
|
3807
|
+
* @param args.legacy optional. If set to false, the keypair generated is a Unified keypair. Defaults
|
|
3808
|
+
* to generating a Legacy Ed25519 keypair
|
|
3577
3809
|
*
|
|
3578
|
-
* @returns
|
|
3810
|
+
* @returns Account
|
|
3579
3811
|
*/
|
|
3580
|
-
|
|
3812
|
+
static fromPrivateKeyAndAddress(args: CreateAccountFromPrivateKeyArgs): Account$1;
|
|
3581
3813
|
/**
|
|
3582
|
-
*
|
|
3814
|
+
* Derives an account with bip44 path and mnemonics
|
|
3583
3815
|
*
|
|
3584
|
-
* @param args.
|
|
3585
|
-
* @param args.
|
|
3586
|
-
*
|
|
3816
|
+
* @param args.scheme The signature scheme to derive the private key with
|
|
3817
|
+
* @param args.path the BIP44 derive hardened path (e.g. m/44'/637'/0'/0'/0') for Ed25519,
|
|
3818
|
+
* or non-hardened path (e.g. m/44'/637'/0'/0/0) for secp256k1
|
|
3819
|
+
* Detailed description: {@link https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki}
|
|
3820
|
+
* @param args.mnemonic the mnemonic seed phrase of the account
|
|
3587
3821
|
*/
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
serialize(serializer: Serializer): void;
|
|
3593
|
-
static deserialize(deserializer: Deserializer): AnyPublicKey;
|
|
3594
|
-
static isPublicKey(publicKey: PublicKey): publicKey is AnyPublicKey;
|
|
3595
|
-
isEd25519(): this is Ed25519PublicKey;
|
|
3596
|
-
isSecp256k1PublicKey(): this is Secp256k1PublicKey;
|
|
3597
|
-
}
|
|
3598
|
-
|
|
3599
|
-
declare class MultiKey extends PublicKey {
|
|
3822
|
+
static fromDerivationPath(args: GenerateEd25519AccountArgs & PrivateKeyFromDerivationPathArgs): Ed25519Account;
|
|
3823
|
+
static fromDerivationPath(args: GenerateEd25519SingleKeyAccountArgs & PrivateKeyFromDerivationPathArgs): SingleKeyAccount;
|
|
3824
|
+
static fromDerivationPath(args: GenerateSingleKeyAccountArgs & PrivateKeyFromDerivationPathArgs): SingleKeyAccount;
|
|
3825
|
+
static fromDerivationPath(args: GenerateAccountArgs & PrivateKeyFromDerivationPathArgs): Account$1;
|
|
3600
3826
|
/**
|
|
3601
|
-
*
|
|
3827
|
+
* @deprecated use `publicKey.authKey()` instead.
|
|
3828
|
+
* This key enables account owners to rotate their private key(s)
|
|
3829
|
+
* associated with the account without changing the address that hosts their account.
|
|
3830
|
+
* See here for more info: {@link https://aptos.dev/concepts/accounts#single-signer-authentication}
|
|
3831
|
+
*
|
|
3832
|
+
* @param args.publicKey PublicKey - public key of the account
|
|
3833
|
+
* @returns The authentication key for the associated account
|
|
3602
3834
|
*/
|
|
3603
|
-
|
|
3835
|
+
static authKey(args: {
|
|
3836
|
+
publicKey: AccountPublicKey;
|
|
3837
|
+
}): AuthenticationKey;
|
|
3604
3838
|
/**
|
|
3605
|
-
*
|
|
3839
|
+
* Sign a message using the available signing capabilities.
|
|
3840
|
+
* @param message the signing message, as binary input
|
|
3841
|
+
* @return the AccountAuthenticator containing the signature, together with the account's public key
|
|
3606
3842
|
*/
|
|
3607
|
-
|
|
3608
|
-
constructor(args: {
|
|
3609
|
-
publicKeys: PublicKey[];
|
|
3610
|
-
signaturesRequired: number;
|
|
3611
|
-
});
|
|
3612
|
-
toUint8Array(): Uint8Array;
|
|
3843
|
+
abstract signWithAuthenticator(message: HexInput): AccountAuthenticator;
|
|
3613
3844
|
/**
|
|
3614
|
-
*
|
|
3615
|
-
*
|
|
3616
|
-
*
|
|
3617
|
-
* @param args.bits array of the index mapping to the matching public keys
|
|
3618
|
-
* @returns Uint8array bit map
|
|
3845
|
+
* Sign the given message with the private key.
|
|
3846
|
+
* @param message in HexInput format
|
|
3847
|
+
* @returns AccountSignature
|
|
3619
3848
|
*/
|
|
3620
|
-
|
|
3621
|
-
bits: number[];
|
|
3622
|
-
}): Uint8Array;
|
|
3849
|
+
abstract sign(message: HexInput): Signature;
|
|
3623
3850
|
/**
|
|
3624
|
-
*
|
|
3625
|
-
*
|
|
3626
|
-
* @returns string
|
|
3851
|
+
* @param args.message raw message data in HexInput format
|
|
3852
|
+
* @param args.signature signed message signature
|
|
3627
3853
|
*/
|
|
3628
|
-
|
|
3629
|
-
verifySignature(args: {
|
|
3630
|
-
message: HexInput;
|
|
3631
|
-
signature: AnySignature;
|
|
3632
|
-
}): boolean;
|
|
3633
|
-
serialize(serializer: Serializer): void;
|
|
3634
|
-
static deserialize(deserializer: Deserializer): MultiKey;
|
|
3854
|
+
verifySignature(args: VerifySignatureArgs): boolean;
|
|
3635
3855
|
}
|
|
3636
3856
|
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
}
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
*/
|
|
3649
|
-
declare enum KeyType {
|
|
3650
|
-
ED25519 = "ed25519 seed"
|
|
3857
|
+
interface Ed25519SignerConstructorArgs {
|
|
3858
|
+
privateKey: Ed25519PrivateKey;
|
|
3859
|
+
address?: AccountAddressInput;
|
|
3860
|
+
}
|
|
3861
|
+
interface Ed25519SignerFromDerivationPathArgs {
|
|
3862
|
+
path: string;
|
|
3863
|
+
mnemonic: string;
|
|
3864
|
+
}
|
|
3865
|
+
interface VerifyEd25519SignatureArgs {
|
|
3866
|
+
message: HexInput;
|
|
3867
|
+
signature: Ed25519Signature;
|
|
3651
3868
|
}
|
|
3652
|
-
declare const HARDENED_OFFSET = 2147483648;
|
|
3653
|
-
/**
|
|
3654
|
-
* Aptos derive path is 637
|
|
3655
|
-
*
|
|
3656
|
-
* Parse and validate a path that is compliant to BIP-44 in form m/44'/637'/{account_index}'/{change_index}/{address_index}
|
|
3657
|
-
* for Secp256k1
|
|
3658
|
-
*
|
|
3659
|
-
* Note that for secp256k1, last two components must be non-hardened.
|
|
3660
|
-
*
|
|
3661
|
-
* @param path path string (e.g. `m/44'/637'/0'/0/0`).
|
|
3662
|
-
*/
|
|
3663
|
-
declare function isValidBIP44Path(path: string): boolean;
|
|
3664
3869
|
/**
|
|
3665
|
-
*
|
|
3666
|
-
*
|
|
3667
|
-
* Parse and validate a path that is compliant to SLIP-0010 and BIP-44
|
|
3668
|
-
* in form m/44'/637'/{account_index}'/{change_index}'/{address_index}'.
|
|
3669
|
-
* See SLIP-0010 {@link https://github.com/satoshilabs/slips/blob/master/slip-0044.md}
|
|
3670
|
-
* See BIP-44 {@link https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki}
|
|
3671
|
-
*
|
|
3672
|
-
* Note that for Ed25519, all components must be hardened.
|
|
3673
|
-
* This is because non-hardened [PK] derivation would not work due to Ed25519's lack of a key homomorphism.
|
|
3674
|
-
* Specifically, you cannot derive the PK associated with derivation path a/b/c given the PK of a/b.
|
|
3675
|
-
* This is because the PK in Ed25519 is, more or less, computed as 𝑔𝐻(𝑠𝑘),
|
|
3676
|
-
* with the hash function breaking the homomorphism.
|
|
3870
|
+
* Signer implementation for the Ed25519 authentication scheme.
|
|
3871
|
+
* This extends an {@link Ed25519Account} by adding signing capabilities through an {@link Ed25519PrivateKey}.
|
|
3677
3872
|
*
|
|
3678
|
-
*
|
|
3679
|
-
*/
|
|
3680
|
-
declare function isValidHardenedPath(path: string): boolean;
|
|
3681
|
-
declare const deriveKey: (hashSeed: Uint8Array | string, data: Uint8Array | string) => DerivedKeys;
|
|
3682
|
-
/**
|
|
3683
|
-
* Derive a child key from the private key
|
|
3684
|
-
* @param key
|
|
3685
|
-
* @param chainCode
|
|
3686
|
-
* @param index
|
|
3687
|
-
* @constructor
|
|
3688
|
-
*/
|
|
3689
|
-
declare const CKDPriv: ({ key, chainCode }: DerivedKeys, index: number) => DerivedKeys;
|
|
3690
|
-
/**
|
|
3691
|
-
* Splits derive path into segments
|
|
3692
|
-
* @param path
|
|
3693
|
-
*/
|
|
3694
|
-
declare const splitPath: (path: string) => Array<string>;
|
|
3695
|
-
/**
|
|
3696
|
-
* Normalizes the mnemonic by removing extra whitespace and making it lowercase
|
|
3697
|
-
* @param mnemonic the mnemonic seed phrase
|
|
3873
|
+
* Note: Generating a signer instance does not create the account on-chain.
|
|
3698
3874
|
*/
|
|
3699
|
-
declare
|
|
3875
|
+
declare class Ed25519Account implements Account$1 {
|
|
3876
|
+
/**
|
|
3877
|
+
* Private key associated with the account
|
|
3878
|
+
*/
|
|
3879
|
+
readonly privateKey: Ed25519PrivateKey;
|
|
3880
|
+
readonly publicKey: Ed25519PublicKey;
|
|
3881
|
+
readonly accountAddress: AccountAddress;
|
|
3882
|
+
readonly signingScheme = SigningScheme.Ed25519;
|
|
3883
|
+
constructor(args: Ed25519SignerConstructorArgs);
|
|
3884
|
+
/**
|
|
3885
|
+
* Derives a signer from a randomly generated private key
|
|
3886
|
+
*/
|
|
3887
|
+
static generate(): Ed25519Account;
|
|
3888
|
+
/**
|
|
3889
|
+
* Derives an account with bip44 path and mnemonics
|
|
3890
|
+
*
|
|
3891
|
+
* @param args.path the BIP44 derive hardened path e.g. m/44'/637'/0'/0'/0'
|
|
3892
|
+
* Detailed description: {@link https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki}
|
|
3893
|
+
* @param args.mnemonic the mnemonic seed phrase of the account
|
|
3894
|
+
*/
|
|
3895
|
+
static fromDerivationPath(args: Ed25519SignerFromDerivationPathArgs): Ed25519Account;
|
|
3896
|
+
verifySignature(args: VerifyEd25519SignatureArgs): boolean;
|
|
3897
|
+
signWithAuthenticator(message: HexInput): AccountAuthenticatorEd25519;
|
|
3898
|
+
sign(message: HexInput): Ed25519Signature;
|
|
3899
|
+
}
|
|
3700
3900
|
|
|
3701
3901
|
/**
|
|
3702
3902
|
* Type of API endpoint for request routing
|
|
@@ -3706,7 +3906,6 @@ declare enum AptosApiType {
|
|
|
3706
3906
|
INDEXER = 1,
|
|
3707
3907
|
FAUCET = 2
|
|
3708
3908
|
}
|
|
3709
|
-
declare const DEFAULT_NETWORK = Network.DEVNET;
|
|
3710
3909
|
/**
|
|
3711
3910
|
* The default max gas amount when none is given.
|
|
3712
3911
|
*
|
|
@@ -3776,7 +3975,14 @@ declare class AptosConfig {
|
|
|
3776
3975
|
* The optional hardcoded indexer URL to send requests to instead of using the network
|
|
3777
3976
|
*/
|
|
3778
3977
|
readonly indexer?: string;
|
|
3978
|
+
/**
|
|
3979
|
+
* Optional client config to set
|
|
3980
|
+
*/
|
|
3779
3981
|
readonly clientConfig?: ClientConfig;
|
|
3982
|
+
/**
|
|
3983
|
+
* Optional asset uploader provider, default to "irys"
|
|
3984
|
+
*/
|
|
3985
|
+
readonly assetUploaderProvider?: string;
|
|
3780
3986
|
constructor(settings?: AptosSettings);
|
|
3781
3987
|
/**
|
|
3782
3988
|
* Returns the URL endpoint to send the request to.
|
|
@@ -4563,72 +4769,6 @@ declare class RotationProofChallenge extends Serializable {
|
|
|
4563
4769
|
serialize(serializer: Serializer): void;
|
|
4564
4770
|
}
|
|
4565
4771
|
|
|
4566
|
-
declare abstract class AccountAuthenticator extends Serializable {
|
|
4567
|
-
abstract serialize(serializer: Serializer): void;
|
|
4568
|
-
static deserialize(deserializer: Deserializer): AccountAuthenticator;
|
|
4569
|
-
isEd25519(): this is AccountAuthenticatorEd25519;
|
|
4570
|
-
isMultiEd25519(): this is AccountAuthenticatorMultiEd25519;
|
|
4571
|
-
isSingleKey(): this is AccountAuthenticatorSingleKey;
|
|
4572
|
-
isMultiKey(): this is AccountAuthenticatorMultiKey;
|
|
4573
|
-
}
|
|
4574
|
-
/**
|
|
4575
|
-
* Transaction authenticator Ed25519 for a multi signer transaction
|
|
4576
|
-
*
|
|
4577
|
-
* @param public_key Account's Ed25519 public key.
|
|
4578
|
-
* @param signature Account's Ed25519 signature
|
|
4579
|
-
*
|
|
4580
|
-
*/
|
|
4581
|
-
declare class AccountAuthenticatorEd25519 extends AccountAuthenticator {
|
|
4582
|
-
readonly public_key: Ed25519PublicKey;
|
|
4583
|
-
readonly signature: Ed25519Signature;
|
|
4584
|
-
constructor(public_key: Ed25519PublicKey, signature: Ed25519Signature);
|
|
4585
|
-
serialize(serializer: Serializer): void;
|
|
4586
|
-
static load(deserializer: Deserializer): AccountAuthenticatorEd25519;
|
|
4587
|
-
}
|
|
4588
|
-
/**
|
|
4589
|
-
* Transaction authenticator Multi Ed25519 for a multi signers transaction
|
|
4590
|
-
*
|
|
4591
|
-
* @param public_key Account's MultiEd25519 public key.
|
|
4592
|
-
* @param signature Account's MultiEd25519 signature
|
|
4593
|
-
*
|
|
4594
|
-
*/
|
|
4595
|
-
declare class AccountAuthenticatorMultiEd25519 extends AccountAuthenticator {
|
|
4596
|
-
readonly public_key: MultiEd25519PublicKey;
|
|
4597
|
-
readonly signature: MultiEd25519Signature;
|
|
4598
|
-
constructor(public_key: MultiEd25519PublicKey, signature: MultiEd25519Signature);
|
|
4599
|
-
serialize(serializer: Serializer): void;
|
|
4600
|
-
static load(deserializer: Deserializer): AccountAuthenticatorMultiEd25519;
|
|
4601
|
-
}
|
|
4602
|
-
/**
|
|
4603
|
-
* AccountAuthenticatorSingleKey for a single signer
|
|
4604
|
-
*
|
|
4605
|
-
* @param public_key AnyPublicKey
|
|
4606
|
-
* @param signature AnySignature
|
|
4607
|
-
*
|
|
4608
|
-
*/
|
|
4609
|
-
declare class AccountAuthenticatorSingleKey extends AccountAuthenticator {
|
|
4610
|
-
readonly public_key: AnyPublicKey;
|
|
4611
|
-
readonly signature: AnySignature;
|
|
4612
|
-
constructor(public_key: AnyPublicKey, signature: AnySignature);
|
|
4613
|
-
serialize(serializer: Serializer): void;
|
|
4614
|
-
static load(deserializer: Deserializer): AccountAuthenticatorSingleKey;
|
|
4615
|
-
}
|
|
4616
|
-
/**
|
|
4617
|
-
* AccountAuthenticatorMultiKey for a multi signer
|
|
4618
|
-
*
|
|
4619
|
-
* @param public_keys MultiKey
|
|
4620
|
-
* @param signatures Signature
|
|
4621
|
-
*
|
|
4622
|
-
*/
|
|
4623
|
-
declare class AccountAuthenticatorMultiKey extends AccountAuthenticator {
|
|
4624
|
-
readonly public_keys: MultiKey;
|
|
4625
|
-
readonly signatures: Array<AnySignature>;
|
|
4626
|
-
readonly signatures_bitmap: Uint8Array;
|
|
4627
|
-
constructor(public_keys: MultiKey, signatures: Array<AnySignature>, signatures_bitmap: Uint8Array);
|
|
4628
|
-
serialize(serializer: Serializer): void;
|
|
4629
|
-
static load(deserializer: Deserializer): AccountAuthenticatorMultiKey;
|
|
4630
|
-
}
|
|
4631
|
-
|
|
4632
4772
|
declare abstract class TransactionAuthenticator extends Serializable {
|
|
4633
4773
|
abstract serialize(serializer: Serializer): void;
|
|
4634
4774
|
static deserialize(deserializer: Deserializer): TransactionAuthenticator;
|
|
@@ -5011,6 +5151,17 @@ declare class DigitalAsset {
|
|
|
5011
5151
|
minimumLedgerVersion?: AnyNumber;
|
|
5012
5152
|
options?: TokenStandardArg;
|
|
5013
5153
|
}): Promise<GetCollectionDataResponse>;
|
|
5154
|
+
/**
|
|
5155
|
+
* Queries data of a specific collection by the collection ID.
|
|
5156
|
+
*
|
|
5157
|
+
* @param args.collectionId the ID of the collection, it's the same thing as the address of the collection object
|
|
5158
|
+
* @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying
|
|
5159
|
+
* @returns GetCollectionDataResponse response type
|
|
5160
|
+
*/
|
|
5161
|
+
getCollectionDataByCollectionId(args: {
|
|
5162
|
+
collectionId: AccountAddressInput;
|
|
5163
|
+
minimumLedgerVersion?: AnyNumber;
|
|
5164
|
+
}): Promise<GetCollectionDataResponse>;
|
|
5014
5165
|
/**
|
|
5015
5166
|
* Queries a collection's ID.
|
|
5016
5167
|
*
|
|
@@ -6994,4 +7145,88 @@ declare function postAptosFullNode<Req extends {}, Res extends {}>(options: Post
|
|
|
6994
7145
|
declare function postAptosIndexer<Req extends {}, Res extends {}>(options: PostAptosRequestOptions): Promise<AptosResponse<Req, Res>>;
|
|
6995
7146
|
declare function postAptosFaucet<Req extends {}, Res extends {}>(options: PostAptosRequestOptions): Promise<AptosResponse<Req, Res>>;
|
|
6996
7147
|
|
|
6997
|
-
|
|
7148
|
+
/**
|
|
7149
|
+
* Shared interfae for asset uploader providers to implement
|
|
7150
|
+
*
|
|
7151
|
+
* When extending the SDK to use different providers, we need to have those
|
|
7152
|
+
* function arguments inputs and outputs use generics.
|
|
7153
|
+
*/
|
|
7154
|
+
interface IAssetUploader {
|
|
7155
|
+
fundNode(args: {
|
|
7156
|
+
account: Account$1;
|
|
7157
|
+
amount: number;
|
|
7158
|
+
}): Promise<FundResponse>;
|
|
7159
|
+
uploadData(args: {
|
|
7160
|
+
account: Account$1;
|
|
7161
|
+
data: string | Buffer;
|
|
7162
|
+
options?: any;
|
|
7163
|
+
}): Promise<UploadResponse>;
|
|
7164
|
+
uploadFile(args: {
|
|
7165
|
+
account: Account$1;
|
|
7166
|
+
filePathToUpload: string;
|
|
7167
|
+
options?: any;
|
|
7168
|
+
}): Promise<UploadResponse>;
|
|
7169
|
+
uploadFolder(args: {
|
|
7170
|
+
account: Account$1;
|
|
7171
|
+
folderToUpload: string;
|
|
7172
|
+
options?: any;
|
|
7173
|
+
}): Promise<UploadResponse | undefined>;
|
|
7174
|
+
}
|
|
7175
|
+
declare class AssetUploader {
|
|
7176
|
+
readonly config: AptosConfig;
|
|
7177
|
+
readonly assetUploader: IAssetUploader;
|
|
7178
|
+
constructor(config: AptosConfig);
|
|
7179
|
+
/**
|
|
7180
|
+
* Funds the node you connected to with the specified amount of tokens
|
|
7181
|
+
*
|
|
7182
|
+
* @param args.account The account to sign and pay the fund transaction with
|
|
7183
|
+
* @param args.amount The amount to fund the node in
|
|
7184
|
+
*
|
|
7185
|
+
* @return FundResponse
|
|
7186
|
+
*/
|
|
7187
|
+
fundNode(args: {
|
|
7188
|
+
account: Account$1;
|
|
7189
|
+
amount: number;
|
|
7190
|
+
}): Promise<FundResponse>;
|
|
7191
|
+
/**
|
|
7192
|
+
* Upload a data
|
|
7193
|
+
*
|
|
7194
|
+
* @param args.account The account to sign and pay the fund transaction with
|
|
7195
|
+
* @param args.data The data to upload
|
|
7196
|
+
*
|
|
7197
|
+
* @return UploadResponse
|
|
7198
|
+
*/
|
|
7199
|
+
uploadData(args: {
|
|
7200
|
+
account: Account$1;
|
|
7201
|
+
data: string | Buffer;
|
|
7202
|
+
options?: any;
|
|
7203
|
+
}): Promise<UploadResponse>;
|
|
7204
|
+
/**
|
|
7205
|
+
* Upload a file
|
|
7206
|
+
*
|
|
7207
|
+
* @param args.account The account to sign and pay the upload file transaction with
|
|
7208
|
+
* @param args.filePathToUpload The file to upload as the file path
|
|
7209
|
+
*
|
|
7210
|
+
* @return UploadResponse
|
|
7211
|
+
*/
|
|
7212
|
+
uploadFile(args: {
|
|
7213
|
+
account: Account$1;
|
|
7214
|
+
filePathToUpload: string;
|
|
7215
|
+
options?: any;
|
|
7216
|
+
}): Promise<UploadResponse>;
|
|
7217
|
+
/**
|
|
7218
|
+
* Upload a folder
|
|
7219
|
+
*
|
|
7220
|
+
* @param args.account The account to sign and pay the upload folder transaction with
|
|
7221
|
+
* @param args.folderToUpload The folder to upload as the folder path
|
|
7222
|
+
*
|
|
7223
|
+
* @return UploadResponse | undefined
|
|
7224
|
+
*/
|
|
7225
|
+
uploadFolder(args: {
|
|
7226
|
+
account: Account$1;
|
|
7227
|
+
folderToUpload: string;
|
|
7228
|
+
options?: any;
|
|
7229
|
+
}): Promise<UploadResponse | undefined>;
|
|
7230
|
+
}
|
|
7231
|
+
|
|
7232
|
+
export { APTOS_BIP44_REGEX, APTOS_COIN, APTOS_HARDENED_REGEX, Account$1 as Account, AccountAddress, type AccountAddressInput, AccountAuthenticator, AccountAuthenticatorEd25519, AccountAuthenticatorMultiEd25519, AccountAuthenticatorMultiKey, AccountAuthenticatorSingleKey, AccountAuthenticatorVariant, type AccountData, AccountPublicKey, AccountSequenceNumber, type AccountSignature, AddressInvalidReason, type AnyNumber, AnyPublicKey, AnyPublicKeyVariant, type AnyRawTransaction, type AnyRawTransactionInstance, AnySignature, AnySignatureVariant, type AnyTransactionPayloadInstance, Aptos, AptosApiError, AptosApiType, AptosConfig, type AptosRequest, type AptosResponse, type AptosSettings, AssetUploader, AuthenticationKey, type AuthenticationKeyScheme, type Block, type BlockMetadataTransactionResponse, Bool, CKDPriv, ChainId, type Client, type ClientConfig, type ClientRequest, type ClientResponse, type CommittedTransactionResponse, type CreateAccountFromPrivateKeyArgs, type CreateEd25519AccountFromPrivateKeyArgs, type CreateEd25519SingleKeyAccountFromPrivateKeyArgs, type CreateSingleKeyAccountFromPrivateKeyArgs, DEFAULT_MAX_GAS_AMOUNT, DEFAULT_TXN_EXP_SEC_FROM_NOW, DEFAULT_TXN_TIMEOUT_SEC, type DecodedTableData, type DeletedTableData, DeriveScheme, type DerivedKeys, type Deserializable, Deserializer, type DirectWriteSet, Ed25519Account, Ed25519PrivateKey, Ed25519PublicKey, Ed25519Signature, type Ed25519SignerConstructorArgs, type Ed25519SignerFromDerivationPathArgs, EntryFunction, type EntryFunctionABI, type EntryFunctionArgument, type EntryFunctionArgumentTypes, EntryFunctionBytes, type EntryFunctionPayloadResponse, type Event$1 as Event, type EventGuid, type ExecutionFinishEventData, type FailureEventData, FeePayerRawTransaction, FixedBytes, type GasEstimation, type GenerateAccount, type GenerateAccountArgs, type GenerateAccountWithEd25519, type GenerateAccountWithSingleSignerSecp256k1Key, type GenerateEd25519AccountArgs, type GenerateEd25519SingleKeyAccountArgs, type GenerateSingleKeyAccountArgs, type GenesisPayload, type GenesisTransactionResponse, type GetANSNameResponse, type GetAccountCoinsDataResponse, type GetAccountCollectionsWithOwnedTokenResponse, type GetAccountOwnedObjectsResponse, type GetAccountOwnedTokensFromCollectionResponse, type GetAccountOwnedTokensQueryResponse, type GetAptosRequestOptions, type GetChainTopUserTransactionsResponse, type GetCollectionDataResponse, type GetCurrentFungibleAssetBalancesResponse, type GetCurrentTokenOwnershipResponse, type GetDelegatedStakingActivitiesResponse, type GetEventsResponse, type GetFungibleAssetActivitiesResponse, type GetFungibleAssetMetadataResponse, type GetNumberOfDelegatorsResponse, type GetOwnedTokensResponse, type GetProcessorStatusResponse, type GetRequestOptions, type GetTokenActivityResponse, type GetTokenDataResponse, type GraphqlQuery, HARDENED_OFFSET, Hex, type HexInput, HexInvalidReason, type IAssetUploader, Identifier, type InputEntryFunctionData, type InputEntryFunctionDataWithABI, type InputEntryFunctionDataWithRemoteABI, type InputGenerateMultiAgentRawTransactionArgs, type InputGenerateMultiAgentRawTransactionData, type InputGenerateRawTransactionArgs, type InputGenerateSingleSignerRawTransactionArgs, type InputGenerateSingleSignerRawTransactionData, type InputGenerateTransactionData, type InputGenerateTransactionOptions, type InputGenerateTransactionPayloadData, type InputGenerateTransactionPayloadDataWithABI, type InputGenerateTransactionPayloadDataWithRemoteABI, type InputMultiSigData, type InputMultiSigDataWithABI, type InputMultiSigDataWithRemoteABI, type InputScriptData, type InputSimulateTransactionData, type InputSimulateTransactionOptions, type InputSubmitTransactionData, type InputViewRequestData, KeyType, type LedgerInfo, type LedgerVersionArg, MimeType, ModuleId, MoveAbility, type MoveAddressType, type MoveFunction, type MoveFunctionGenericTypeParam, type MoveFunctionId, MoveFunctionVisibility, type MoveModule, type MoveModuleBytecode, type MoveModuleId, type MoveObjectType, MoveOption, type MoveOptionType, type MoveResource, type MoveScriptBytecode, MoveString, type MoveStruct, type MoveStructField, type MoveStructId, type MoveStructType, type MoveType, type MoveUint128Type, type MoveUint16Type, type MoveUint256Type, type MoveUint32Type, type MoveUint64Type, type MoveUint8Type, type MoveValue, MoveVector, MultiAgentRawTransaction, type MultiAgentTransaction, MultiEd25519PublicKey, MultiEd25519Signature, MultiKey, MultiKeySignature, MultiSig, MultiSigTransactionPayload, type MultisigPayloadResponse, Network, NetworkToChainId, NetworkToFaucetAPI, NetworkToIndexerAPI, NetworkToNetworkName, NetworkToNodeAPI, type OrderBy, type OrderByArg, type OrderByValue, type PaginationArgs, ParsingError, type ParsingResult, type PendingTransactionResponse, type PostAptosRequestOptions, type PostRequestOptions, type PrivateKey, type PrivateKeyFromDerivationPathArgs, ProcessorType, PublicKey, RAW_TRANSACTION_SALT, RAW_TRANSACTION_WITH_DATA_SALT, RawTransaction, RawTransactionWithData, RoleType, RotationProofChallenge, Script, type ScriptFunctionArgument, type ScriptFunctionArgumentTypes, type ScriptPayloadResponse, ScriptTransactionArgumentVariants, type ScriptWriteSet, Secp256k1PrivateKey, Secp256k1PublicKey, Secp256k1Signature, Serializable, Serializer, Signature, SignedTransaction, SigningScheme, SigningSchemeInput, type SimpleEntryFunctionArgumentTypes, type SimpleTransaction, SingleKeyAccount, type SingleKeySignerConstructorArgs, type SingleKeySignerFromDerivationPathArgs, type SingleKeySignerGenerateArgs, type StateCheckpointTransactionResponse, StructTag, type SuccessEventData, type TableItemRequest, type TokenStandard, type TokenStandardArg, type TransactionArgument, TransactionAuthenticator, TransactionAuthenticatorEd25519, TransactionAuthenticatorFeePayer, TransactionAuthenticatorMultiAgent, TransactionAuthenticatorMultiEd25519, TransactionAuthenticatorSingleSender, TransactionAuthenticatorVariant, type TransactionEd25519Signature, type TransactionFeePayerSignature, type TransactionMultiAgentSignature, type TransactionMultiEd25519Signature, TransactionPayload, TransactionPayloadEntryFunction, TransactionPayloadMultiSig, type TransactionPayloadResponse, TransactionPayloadScript, TransactionPayloadVariants, type TransactionResponse, TransactionResponseType, type TransactionSecp256k1Signature, type TransactionSignature, TransactionVariants, TransactionWorker, type TransactionWorkerEvents, TransactionWorkerEventsEnum, TypeTag, TypeTagAddress, TypeTagBool, TypeTagGeneric, TypeTagParserError, TypeTagParserErrorType, TypeTagReference, TypeTagSigner, TypeTagStruct, TypeTagU128, TypeTagU16, TypeTagU256, TypeTagU32, TypeTagU64, TypeTagU8, TypeTagVariants, TypeTagVector, U128, U16, U256, U32, U64, U8, type Uint128, type Uint16, type Uint256, type Uint32, type Uint64, type Uint8, type UserTransactionResponse, type ValidatorTransactionResponse, type VerifyEd25519SignatureArgs, type VerifySignatureArgs, type VerifySingleKeySignatureArgs, type ViewRequest, type WaitForTransactionOptions, type WhereArg, type WriteSet, type WriteSetChange, type WriteSetChangeDeleteModule, type WriteSetChangeDeleteResource, type WriteSetChangeDeleteTableItem, type WriteSetChangeWriteModule, type WriteSetChangeWriteResource, type WriteSetChangeWriteTableItem, aptosCoinStructTag, aptosRequest, buildTransaction, checkOrConvertArgument, convertArgument, deriveKey, deriveTransactionType, deserializeFromScriptArgument, ensureBoolean, fetchEntryFunctionAbi, findFirstNonSignerArg, generateMultiSignersSignedTransaction, generateRawTransaction, generateSignedTransaction, generateSignedTransactionForSimulation, generateSigningMessage, generateTransactionPayload, generateTransactionPayloadWithABI, get, getAptosFullNode, getAuthenticatorForSimulation, getFunctionParts, isBcsAddress, isBcsBool, isBcsFixedBytes, isBcsString, isBcsU128, isBcsU16, isBcsU256, isBcsU32, isBcsU64, isBcsU8, isBlockMetadataTransactionResponse, isBool, isEd25519Signature, isEncodedEntryFunctionArgument, isFeePayerSignature, isGenesisTransactionResponse, isLargeNumber, isMultiAgentSignature, isMultiEd25519Signature, isNull, isNumber, isPendingTransactionResponse, isScriptDataInput, isSecp256k1Signature, isStateCheckpointTransactionResponse, isString, isUserTransactionResponse, isValidBIP44Path, isValidHardenedPath, isValidatorTransactionResponse, mnemonicToSeed, objectStructTag, optionStructTag, outOfRangeErrorMessage, paginateWithCursor, parseTypeTag, post, postAptosFaucet, postAptosFullNode, postAptosIndexer, promiseFulfilledStatus, request, sign, splitPath, standardizeTypeTags, stringStructTag, throwTypeMismatch, validateNumberInRange };
|