@aptos-labs/ts-sdk 1.7.0 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/index.d.ts +1226 -975
- package/dist/browser/index.global.js +32 -30
- package/dist/browser/index.global.js.map +1 -1
- package/dist/common/index.d.ts +1226 -975
- package/dist/common/index.js +27 -25
- 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.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.d.mts +14 -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/bcs/index.mjs +1 -1
- package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
- package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
- package/dist/esm/chunk-2E2JOGE5.mjs +2 -0
- package/dist/esm/chunk-2E2JOGE5.mjs.map +1 -0
- package/dist/esm/chunk-3EUOBVCT.mjs +2 -0
- package/dist/esm/{chunk-A2QH4A6D.mjs.map → chunk-3EUOBVCT.mjs.map} +1 -1
- package/dist/esm/{chunk-RNO5ZG3C.mjs → chunk-52RTAMN7.mjs} +2 -2
- package/dist/esm/chunk-7BDYKJXX.mjs +2 -0
- package/dist/esm/chunk-7BDYKJXX.mjs.map +1 -0
- package/dist/esm/{chunk-WQI2RH2S.mjs → chunk-7U36LMP4.mjs} +2 -2
- package/dist/esm/{chunk-NWRKJFHV.mjs → chunk-ARIC32W7.mjs} +2 -2
- package/dist/esm/{chunk-RIL4SHXC.mjs → chunk-B7M3OWHV.mjs} +2 -2
- package/dist/esm/{chunk-C7ZX475J.mjs → chunk-BBUAAJRA.mjs} +2 -2
- package/dist/esm/chunk-C3HM7HQP.mjs +2 -0
- package/dist/esm/chunk-C3HM7HQP.mjs.map +1 -0
- package/dist/esm/{chunk-DRF6AMEZ.mjs → chunk-CHA5DSSD.mjs} +2 -2
- package/dist/esm/chunk-CVEJHRAU.mjs +2 -0
- package/dist/esm/chunk-CVEJHRAU.mjs.map +1 -0
- package/dist/esm/chunk-DE5OOOVY.mjs +2 -0
- package/dist/esm/{chunk-3UYBNX3P.mjs.map → chunk-DE5OOOVY.mjs.map} +1 -1
- package/dist/esm/{chunk-IKCBGNRD.mjs → chunk-DGOT2VR5.mjs} +2 -2
- package/dist/esm/{chunk-GVHOHNHT.mjs → chunk-EF2F7NWO.mjs} +2 -2
- package/dist/esm/{chunk-J6RCCKOA.mjs → chunk-EQZ757ES.mjs} +2 -2
- package/dist/esm/{chunk-CX5ULWJQ.mjs → chunk-F67Y7YH6.mjs} +2 -2
- package/dist/esm/{chunk-JLL7BCD4.mjs → chunk-FVMVV4V3.mjs} +2 -2
- package/dist/esm/chunk-FWDKABRW.mjs +2 -0
- package/dist/esm/chunk-FWDKABRW.mjs.map +1 -0
- package/dist/esm/chunk-G62HQC77.mjs +2 -0
- package/dist/esm/chunk-G62HQC77.mjs.map +1 -0
- package/dist/esm/{chunk-ESX5X52V.mjs → chunk-GQOOXOTN.mjs} +2 -2
- package/dist/esm/chunk-GRJJBGHT.mjs +2 -0
- package/dist/esm/chunk-GRJJBGHT.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-XQIWF5HY.mjs → chunk-I3TCHVQQ.mjs} +2 -2
- package/dist/esm/{chunk-3NOQE6U3.mjs → chunk-ILJWEPDW.mjs} +2 -2
- package/dist/esm/chunk-INORE66K.mjs +2 -0
- package/dist/esm/chunk-INORE66K.mjs.map +1 -0
- package/dist/esm/{chunk-5L6SRCJP.mjs → chunk-J6MWD4XN.mjs} +2 -2
- package/dist/esm/{chunk-YGMT4GQ5.mjs → chunk-JEHR6GKW.mjs} +2 -2
- package/dist/esm/chunk-JEHR6GKW.mjs.map +1 -0
- package/dist/esm/chunk-KUX6GQ2E.mjs +1 -0
- package/dist/esm/{chunk-6UNBJAV6.mjs → chunk-KWJTVJ7C.mjs} +2 -2
- package/dist/esm/chunk-KWJTVJ7C.mjs.map +1 -0
- package/dist/esm/{chunk-WK36MJRI.mjs → chunk-LLL2LFYH.mjs} +2 -2
- package/dist/esm/chunk-LMXP3JUU.mjs +2 -0
- package/dist/esm/chunk-LMXP3JUU.mjs.map +1 -0
- package/dist/esm/{chunk-5WXR2O3T.mjs → chunk-N65SOKJQ.mjs} +2 -2
- package/dist/esm/{chunk-XOBXX273.mjs → chunk-NL3XVNS5.mjs} +2 -2
- package/dist/esm/{chunk-Q7JKS6WV.mjs → chunk-NURFZOR4.mjs} +2 -2
- package/dist/esm/{chunk-MKERJNYN.mjs → chunk-OG56TYZE.mjs} +2 -2
- package/dist/esm/chunk-Q6WOHF4A.mjs +2 -0
- package/dist/esm/chunk-Q6WOHF4A.mjs.map +1 -0
- package/dist/esm/chunk-QA4XWNIH.mjs +2 -0
- package/dist/esm/chunk-QA4XWNIH.mjs.map +1 -0
- package/dist/esm/chunk-QE4ASJ5K.mjs +1 -0
- package/dist/esm/chunk-QR72RXBS.mjs +2 -0
- package/dist/esm/chunk-QR72RXBS.mjs.map +1 -0
- package/dist/esm/{chunk-TVURQPLA.mjs → chunk-R4VJDSIP.mjs} +2 -2
- package/dist/esm/{chunk-O57QZZF2.mjs → chunk-S2F6CSH4.mjs} +2 -2
- package/dist/esm/chunk-S2F6CSH4.mjs.map +1 -0
- package/dist/esm/{chunk-BQSE5HHW.mjs → chunk-S4SEFF4K.mjs} +3 -1
- package/dist/esm/chunk-S4SEFF4K.mjs.map +1 -0
- package/dist/esm/{chunk-OVSV4Y32.mjs → chunk-SXIFL5DQ.mjs} +2 -2
- package/dist/esm/{chunk-OVSV4Y32.mjs.map → chunk-SXIFL5DQ.mjs.map} +1 -1
- package/dist/esm/{chunk-Z6XNTGNK.mjs → chunk-TN5BUH4F.mjs} +2 -2
- package/dist/esm/chunk-TNVR7SNR.mjs +2 -0
- package/dist/esm/chunk-TNVR7SNR.mjs.map +1 -0
- package/dist/esm/chunk-TX7UK75Q.mjs +2 -0
- package/dist/esm/chunk-TX7UK75Q.mjs.map +1 -0
- package/dist/esm/{chunk-YE3DZD6T.mjs → chunk-UIUSDBCL.mjs} +2 -2
- package/dist/esm/{chunk-7JTOGYO7.mjs → chunk-UMLDKLDL.mjs} +2 -2
- package/dist/esm/chunk-UVSRX4SV.mjs +1 -0
- package/dist/esm/{chunk-6Y3VBRMN.mjs → chunk-VEVBHH3M.mjs} +2 -2
- package/dist/esm/{chunk-T5IFXLOP.mjs → chunk-VMXBMAYK.mjs} +2 -2
- package/dist/esm/chunk-WKUXBIYB.mjs +2 -0
- package/dist/esm/chunk-WKUXBIYB.mjs.map +1 -0
- package/dist/esm/chunk-WME5D6YR.mjs +2 -0
- package/dist/esm/chunk-WME5D6YR.mjs.map +1 -0
- package/dist/esm/chunk-WTHNSNAX.mjs +2 -0
- package/dist/esm/chunk-WTHNSNAX.mjs.map +1 -0
- package/dist/esm/{chunk-WC2WSKYZ.mjs → chunk-X5C3LYI7.mjs} +2 -2
- package/dist/esm/chunk-XKD7W5NO.mjs +2 -0
- package/dist/esm/{chunk-UJAX75ON.mjs.map → chunk-XKD7W5NO.mjs.map} +1 -1
- package/dist/esm/{chunk-OWZLBIDD.mjs → chunk-XTPFQ4MH.mjs} +2 -2
- package/dist/esm/{chunk-D2GNCG27.mjs → chunk-Y5AJLNUD.mjs} +2 -2
- package/dist/esm/chunk-YDAA4RG4.mjs +2 -0
- package/dist/esm/chunk-YDAA4RG4.mjs.map +1 -0
- package/dist/esm/{chunk-ZFPA45OK.mjs → chunk-YR2R3LW4.mjs} +2 -2
- package/dist/esm/chunk-YZZO6VDC.mjs +2 -0
- package/dist/esm/chunk-YZZO6VDC.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/core/account/Account.d.mts +20 -0
- package/dist/esm/core/account/Account.mjs +2 -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/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/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/index.d.mts +9 -8
- package/dist/esm/core/index.mjs +1 -1
- package/dist/esm/index.d.mts +9 -9
- 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 +9 -9
- package/dist/esm/internal/coin.mjs +1 -1
- package/dist/esm/internal/digitalAsset.d.mts +15 -12
- package/dist/esm/internal/digitalAsset.mjs +1 -1
- package/dist/esm/internal/event.d.mts +7 -2
- package/dist/esm/internal/event.mjs +1 -1
- package/dist/esm/internal/faucet.d.mts +1 -1
- package/dist/esm/internal/faucet.mjs +1 -1
- package/dist/esm/internal/fungibleAsset.d.mts +9 -10
- package/dist/esm/internal/fungibleAsset.mjs +1 -1
- package/dist/esm/internal/general.mjs +1 -1
- package/dist/esm/internal/staking.d.mts +1 -1
- package/dist/esm/internal/staking.mjs +1 -1
- package/dist/esm/internal/transaction.mjs +1 -1
- package/dist/esm/internal/transactionSubmission.d.mts +10 -11
- package/dist/esm/internal/transactionSubmission.mjs +1 -1
- package/dist/esm/publicKey-lq5djCIY.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/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/generated/operations.d.mts +6 -0
- package/dist/esm/types/generated/queries.d.mts +6 -6
- package/dist/esm/types/generated/queries.mjs +1 -1
- package/dist/esm/types/generated/types.d.mts +594 -56
- package/dist/esm/types/generated/types.mjs +1 -1
- package/dist/esm/types/generated/types.mjs.map +1 -1
- package/dist/esm/types/index.d.mts +35 -6
- 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 +16 -16
- package/src/api/aptosConfig.ts +2 -2
- package/src/api/digitalAsset.ts +20 -0
- package/src/api/event.ts +27 -1
- 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/internal/account.ts +5 -3
- package/src/internal/digitalAsset.ts +26 -0
- package/src/internal/event.ts +33 -1
- package/src/internal/queries/currentTokenOwnershipFieldsFragment.graphql +1 -0
- package/src/internal/queries/getTokenData.graphql +1 -0
- 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/generated/operations.ts +6 -0
- package/src/types/generated/queries.ts +2 -0
- package/src/types/generated/types.ts +662 -55
- package/src/types/index.ts +40 -4
- package/src/utils/const.ts +0 -4
- package/src/version.ts +1 -1
- package/dist/esm/chunk-2QV6HI3M.mjs +0 -2
- package/dist/esm/chunk-2QV6HI3M.mjs.map +0 -1
- package/dist/esm/chunk-3UYBNX3P.mjs +0 -2
- package/dist/esm/chunk-4SAUEZTN.mjs +0 -2
- package/dist/esm/chunk-4SAUEZTN.mjs.map +0 -1
- package/dist/esm/chunk-6UNBJAV6.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-A2QH4A6D.mjs +0 -2
- package/dist/esm/chunk-AA3GRJNL.mjs +0 -2
- package/dist/esm/chunk-AA3GRJNL.mjs.map +0 -1
- package/dist/esm/chunk-ALFESCPU.mjs +0 -2
- package/dist/esm/chunk-ALFESCPU.mjs.map +0 -1
- package/dist/esm/chunk-BQSE5HHW.mjs.map +0 -1
- package/dist/esm/chunk-CCUD52OF.mjs +0 -2
- package/dist/esm/chunk-CCUD52OF.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-FP5DPRYL.mjs +0 -2
- package/dist/esm/chunk-FP5DPRYL.mjs.map +0 -1
- 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-INV6U3KS.mjs +0 -2
- package/dist/esm/chunk-INV6U3KS.mjs.map +0 -1
- package/dist/esm/chunk-O57QZZF2.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-SZYATFM7.mjs +0 -2
- package/dist/esm/chunk-SZYATFM7.mjs.map +0 -1
- 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-UJAX75ON.mjs +0 -2
- package/dist/esm/chunk-V6JFR2CB.mjs +0 -2
- package/dist/esm/chunk-V6JFR2CB.mjs.map +0 -1
- package/dist/esm/chunk-YGMT4GQ5.mjs.map +0 -1
- package/dist/esm/chunk-ZFIMVSCR.mjs +0 -2
- package/dist/esm/chunk-ZFIMVSCR.mjs.map +0 -1
- package/dist/esm/chunk-ZIZ7PVK2.mjs +0 -2
- package/dist/esm/chunk-ZIZ7PVK2.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-RNO5ZG3C.mjs.map → chunk-52RTAMN7.mjs.map} +0 -0
- /package/dist/esm/{chunk-WQI2RH2S.mjs.map → chunk-7U36LMP4.mjs.map} +0 -0
- /package/dist/esm/{chunk-NWRKJFHV.mjs.map → chunk-ARIC32W7.mjs.map} +0 -0
- /package/dist/esm/{chunk-RIL4SHXC.mjs.map → chunk-B7M3OWHV.mjs.map} +0 -0
- /package/dist/esm/{chunk-C7ZX475J.mjs.map → chunk-BBUAAJRA.mjs.map} +0 -0
- /package/dist/esm/{chunk-DRF6AMEZ.mjs.map → chunk-CHA5DSSD.mjs.map} +0 -0
- /package/dist/esm/{chunk-IKCBGNRD.mjs.map → chunk-DGOT2VR5.mjs.map} +0 -0
- /package/dist/esm/{chunk-GVHOHNHT.mjs.map → chunk-EF2F7NWO.mjs.map} +0 -0
- /package/dist/esm/{chunk-J6RCCKOA.mjs.map → chunk-EQZ757ES.mjs.map} +0 -0
- /package/dist/esm/{chunk-CX5ULWJQ.mjs.map → chunk-F67Y7YH6.mjs.map} +0 -0
- /package/dist/esm/{chunk-JLL7BCD4.mjs.map → chunk-FVMVV4V3.mjs.map} +0 -0
- /package/dist/esm/{chunk-ESX5X52V.mjs.map → chunk-GQOOXOTN.mjs.map} +0 -0
- /package/dist/esm/{chunk-XQIWF5HY.mjs.map → chunk-I3TCHVQQ.mjs.map} +0 -0
- /package/dist/esm/{chunk-3NOQE6U3.mjs.map → chunk-ILJWEPDW.mjs.map} +0 -0
- /package/dist/esm/{chunk-5L6SRCJP.mjs.map → chunk-J6MWD4XN.mjs.map} +0 -0
- /package/dist/esm/{chunk-UIVJXLRM.mjs.map → chunk-KUX6GQ2E.mjs.map} +0 -0
- /package/dist/esm/{chunk-WK36MJRI.mjs.map → chunk-LLL2LFYH.mjs.map} +0 -0
- /package/dist/esm/{chunk-5WXR2O3T.mjs.map → chunk-N65SOKJQ.mjs.map} +0 -0
- /package/dist/esm/{chunk-XOBXX273.mjs.map → chunk-NL3XVNS5.mjs.map} +0 -0
- /package/dist/esm/{chunk-Q7JKS6WV.mjs.map → chunk-NURFZOR4.mjs.map} +0 -0
- /package/dist/esm/{chunk-MKERJNYN.mjs.map → chunk-OG56TYZE.mjs.map} +0 -0
- /package/dist/esm/{core/account.mjs.map → chunk-QE4ASJ5K.mjs.map} +0 -0
- /package/dist/esm/{chunk-TVURQPLA.mjs.map → chunk-R4VJDSIP.mjs.map} +0 -0
- /package/dist/esm/{chunk-Z6XNTGNK.mjs.map → chunk-TN5BUH4F.mjs.map} +0 -0
- /package/dist/esm/{chunk-YE3DZD6T.mjs.map → chunk-UIUSDBCL.mjs.map} +0 -0
- /package/dist/esm/{chunk-7JTOGYO7.mjs.map → chunk-UMLDKLDL.mjs.map} +0 -0
- /package/dist/esm/{core/crypto/anyPublicKey.mjs.map → chunk-UVSRX4SV.mjs.map} +0 -0
- /package/dist/esm/{chunk-6Y3VBRMN.mjs.map → chunk-VEVBHH3M.mjs.map} +0 -0
- /package/dist/esm/{chunk-T5IFXLOP.mjs.map → chunk-VMXBMAYK.mjs.map} +0 -0
- /package/dist/esm/{chunk-WC2WSKYZ.mjs.map → chunk-X5C3LYI7.mjs.map} +0 -0
- /package/dist/esm/{chunk-OWZLBIDD.mjs.map → chunk-XTPFQ4MH.mjs.map} +0 -0
- /package/dist/esm/{chunk-D2GNCG27.mjs.map → chunk-Y5AJLNUD.mjs.map} +0 -0
- /package/dist/esm/{chunk-ZFPA45OK.mjs.map → chunk-YR2R3LW4.mjs.map} +0 -0
- /package/dist/esm/core/{crypto/anySignature.mjs.map → account/Account.mjs.map} +0 -0
- /package/dist/esm/core/{crypto/asymmetricCrypto.mjs.map → account/Ed25519Account.mjs.map} +0 -0
package/dist/browser/index.d.ts
CHANGED
|
@@ -1,36 +1,5 @@
|
|
|
1
1
|
import EventEmitter from 'eventemitter3';
|
|
2
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
|
-
};
|
|
33
|
-
|
|
34
3
|
declare const NetworkToIndexerAPI: Record<string, string>;
|
|
35
4
|
declare const NetworkToNodeAPI: Record<string, string>;
|
|
36
5
|
declare const NetworkToFaucetAPI: Record<string, string>;
|
|
@@ -158,6 +127,29 @@ type BigintComparisonExp = {
|
|
|
158
127
|
_neq?: InputMaybe<Scalars["bigint"]["input"]>;
|
|
159
128
|
_nin?: InputMaybe<Array<Scalars["bigint"]["input"]>>;
|
|
160
129
|
};
|
|
130
|
+
type CurrentAptosNamesAggregateBoolExp = {
|
|
131
|
+
bool_and?: InputMaybe<CurrentAptosNamesAggregateBoolExpBoolAnd>;
|
|
132
|
+
bool_or?: InputMaybe<CurrentAptosNamesAggregateBoolExpBoolOr>;
|
|
133
|
+
count?: InputMaybe<CurrentAptosNamesAggregateBoolExpCount>;
|
|
134
|
+
};
|
|
135
|
+
type CurrentAptosNamesAggregateBoolExpBoolAnd = {
|
|
136
|
+
arguments: CurrentAptosNamesSelectColumnCurrentAptosNamesAggregateBoolExpBoolAndArgumentsColumns;
|
|
137
|
+
distinct?: InputMaybe<Scalars["Boolean"]["input"]>;
|
|
138
|
+
filter?: InputMaybe<CurrentAptosNamesBoolExp>;
|
|
139
|
+
predicate: BooleanComparisonExp;
|
|
140
|
+
};
|
|
141
|
+
type CurrentAptosNamesAggregateBoolExpBoolOr = {
|
|
142
|
+
arguments: CurrentAptosNamesSelectColumnCurrentAptosNamesAggregateBoolExpBoolOrArgumentsColumns;
|
|
143
|
+
distinct?: InputMaybe<Scalars["Boolean"]["input"]>;
|
|
144
|
+
filter?: InputMaybe<CurrentAptosNamesBoolExp>;
|
|
145
|
+
predicate: BooleanComparisonExp;
|
|
146
|
+
};
|
|
147
|
+
type CurrentAptosNamesAggregateBoolExpCount = {
|
|
148
|
+
arguments?: InputMaybe<Array<CurrentAptosNamesSelectColumn>>;
|
|
149
|
+
distinct?: InputMaybe<Scalars["Boolean"]["input"]>;
|
|
150
|
+
filter?: InputMaybe<CurrentAptosNamesBoolExp>;
|
|
151
|
+
predicate: IntComparisonExp;
|
|
152
|
+
};
|
|
161
153
|
/** Boolean expression to filter rows from the table "current_aptos_names". All fields are combined with a logical 'AND'. */
|
|
162
154
|
type CurrentAptosNamesBoolExp = {
|
|
163
155
|
_and?: InputMaybe<Array<CurrentAptosNamesBoolExp>>;
|
|
@@ -176,6 +168,45 @@ type CurrentAptosNamesBoolExp = {
|
|
|
176
168
|
token_name?: InputMaybe<StringComparisonExp>;
|
|
177
169
|
token_standard?: InputMaybe<StringComparisonExp>;
|
|
178
170
|
};
|
|
171
|
+
/** select columns of table "current_aptos_names" */
|
|
172
|
+
declare enum CurrentAptosNamesSelectColumn {
|
|
173
|
+
/** column name */
|
|
174
|
+
Domain = "domain",
|
|
175
|
+
/** column name */
|
|
176
|
+
DomainWithSuffix = "domain_with_suffix",
|
|
177
|
+
/** column name */
|
|
178
|
+
ExpirationTimestamp = "expiration_timestamp",
|
|
179
|
+
/** column name */
|
|
180
|
+
IsActive = "is_active",
|
|
181
|
+
/** column name */
|
|
182
|
+
IsPrimary = "is_primary",
|
|
183
|
+
/** column name */
|
|
184
|
+
LastTransactionVersion = "last_transaction_version",
|
|
185
|
+
/** column name */
|
|
186
|
+
OwnerAddress = "owner_address",
|
|
187
|
+
/** column name */
|
|
188
|
+
RegisteredAddress = "registered_address",
|
|
189
|
+
/** column name */
|
|
190
|
+
Subdomain = "subdomain",
|
|
191
|
+
/** column name */
|
|
192
|
+
TokenName = "token_name",
|
|
193
|
+
/** column name */
|
|
194
|
+
TokenStandard = "token_standard"
|
|
195
|
+
}
|
|
196
|
+
/** select "current_aptos_names_aggregate_bool_exp_bool_and_arguments_columns" columns of table "current_aptos_names" */
|
|
197
|
+
declare enum CurrentAptosNamesSelectColumnCurrentAptosNamesAggregateBoolExpBoolAndArgumentsColumns {
|
|
198
|
+
/** column name */
|
|
199
|
+
IsActive = "is_active",
|
|
200
|
+
/** column name */
|
|
201
|
+
IsPrimary = "is_primary"
|
|
202
|
+
}
|
|
203
|
+
/** select "current_aptos_names_aggregate_bool_exp_bool_or_arguments_columns" columns of table "current_aptos_names" */
|
|
204
|
+
declare enum CurrentAptosNamesSelectColumnCurrentAptosNamesAggregateBoolExpBoolOrArgumentsColumns {
|
|
205
|
+
/** column name */
|
|
206
|
+
IsActive = "is_active",
|
|
207
|
+
/** column name */
|
|
208
|
+
IsPrimary = "is_primary"
|
|
209
|
+
}
|
|
179
210
|
/** Boolean expression to filter rows from the table "current_fungible_asset_balances". All fields are combined with a logical 'AND'. */
|
|
180
211
|
type CurrentFungibleAssetBalancesBoolExp = {
|
|
181
212
|
_and?: InputMaybe<Array<CurrentFungibleAssetBalancesBoolExp>>;
|
|
@@ -224,6 +255,7 @@ type FungibleAssetActivitiesBoolExp = {
|
|
|
224
255
|
metadata?: InputMaybe<FungibleAssetMetadataBoolExp>;
|
|
225
256
|
owner_address?: InputMaybe<StringComparisonExp>;
|
|
226
257
|
owner_aptos_names?: InputMaybe<CurrentAptosNamesBoolExp>;
|
|
258
|
+
owner_aptos_names_aggregate?: InputMaybe<CurrentAptosNamesAggregateBoolExp>;
|
|
227
259
|
storage_id?: InputMaybe<StringComparisonExp>;
|
|
228
260
|
storage_refund_amount?: InputMaybe<NumericComparisonExp>;
|
|
229
261
|
token_standard?: InputMaybe<StringComparisonExp>;
|
|
@@ -394,6 +426,7 @@ type GetAccountOwnedTokensQuery = {
|
|
|
394
426
|
token_properties: any;
|
|
395
427
|
token_standard: string;
|
|
396
428
|
token_uri: string;
|
|
429
|
+
decimals: any;
|
|
397
430
|
current_collection?: {
|
|
398
431
|
collection_id: string;
|
|
399
432
|
collection_name: string;
|
|
@@ -441,6 +474,7 @@ type GetAccountOwnedTokensFromCollectionQuery = {
|
|
|
441
474
|
token_properties: any;
|
|
442
475
|
token_standard: string;
|
|
443
476
|
token_uri: string;
|
|
477
|
+
decimals: any;
|
|
444
478
|
current_collection?: {
|
|
445
479
|
collection_id: string;
|
|
446
480
|
collection_name: string;
|
|
@@ -626,6 +660,7 @@ type GetCurrentTokenOwnershipQuery = {
|
|
|
626
660
|
token_properties: any;
|
|
627
661
|
token_standard: string;
|
|
628
662
|
token_uri: string;
|
|
663
|
+
decimals: any;
|
|
629
664
|
current_collection?: {
|
|
630
665
|
collection_id: string;
|
|
631
666
|
collection_name: string;
|
|
@@ -660,6 +695,7 @@ type GetTokenDataQuery = {
|
|
|
660
695
|
token_properties: any;
|
|
661
696
|
token_standard: string;
|
|
662
697
|
token_uri: string;
|
|
698
|
+
decimals: any;
|
|
663
699
|
current_collection?: {
|
|
664
700
|
collection_id: string;
|
|
665
701
|
collection_name: string;
|
|
@@ -986,15 +1022,17 @@ declare enum TransactionResponseType {
|
|
|
986
1022
|
User = "user_transaction",
|
|
987
1023
|
Genesis = "genesis_transaction",
|
|
988
1024
|
BlockMetadata = "block_metadata_transaction",
|
|
989
|
-
StateCheckpoint = "state_checkpoint_transaction"
|
|
1025
|
+
StateCheckpoint = "state_checkpoint_transaction",
|
|
1026
|
+
Validator = "validator_transaction"
|
|
990
1027
|
}
|
|
991
1028
|
type TransactionResponse = PendingTransactionResponse | CommittedTransactionResponse;
|
|
992
|
-
type CommittedTransactionResponse = UserTransactionResponse | GenesisTransactionResponse | BlockMetadataTransactionResponse | StateCheckpointTransactionResponse;
|
|
1029
|
+
type CommittedTransactionResponse = UserTransactionResponse | GenesisTransactionResponse | BlockMetadataTransactionResponse | StateCheckpointTransactionResponse | ValidatorTransactionResponse;
|
|
993
1030
|
declare function isPendingTransactionResponse(response: TransactionResponse): response is PendingTransactionResponse;
|
|
994
1031
|
declare function isUserTransactionResponse(response: TransactionResponse): response is UserTransactionResponse;
|
|
995
1032
|
declare function isGenesisTransactionResponse(response: TransactionResponse): response is GenesisTransactionResponse;
|
|
996
1033
|
declare function isBlockMetadataTransactionResponse(response: TransactionResponse): response is BlockMetadataTransactionResponse;
|
|
997
1034
|
declare function isStateCheckpointTransactionResponse(response: TransactionResponse): response is StateCheckpointTransactionResponse;
|
|
1035
|
+
declare function isValidatorTransactionResponse(response: TransactionResponse): response is ValidatorTransactionResponse;
|
|
998
1036
|
type PendingTransactionResponse = {
|
|
999
1037
|
type: TransactionResponseType.Pending;
|
|
1000
1038
|
hash: string;
|
|
@@ -1012,7 +1050,7 @@ type UserTransactionResponse = {
|
|
|
1012
1050
|
hash: string;
|
|
1013
1051
|
state_change_hash: string;
|
|
1014
1052
|
event_root_hash: string;
|
|
1015
|
-
state_checkpoint_hash
|
|
1053
|
+
state_checkpoint_hash: string | null;
|
|
1016
1054
|
gas_used: string;
|
|
1017
1055
|
/**
|
|
1018
1056
|
* Whether the transaction was successful
|
|
@@ -1073,7 +1111,7 @@ type BlockMetadataTransactionResponse = {
|
|
|
1073
1111
|
hash: string;
|
|
1074
1112
|
state_change_hash: string;
|
|
1075
1113
|
event_root_hash: string;
|
|
1076
|
-
state_checkpoint_hash
|
|
1114
|
+
state_checkpoint_hash: string | null;
|
|
1077
1115
|
gas_used: string;
|
|
1078
1116
|
/**
|
|
1079
1117
|
* Whether the transaction was successful
|
|
@@ -1112,7 +1150,30 @@ type StateCheckpointTransactionResponse = {
|
|
|
1112
1150
|
hash: string;
|
|
1113
1151
|
state_change_hash: string;
|
|
1114
1152
|
event_root_hash: string;
|
|
1115
|
-
state_checkpoint_hash
|
|
1153
|
+
state_checkpoint_hash: string | null;
|
|
1154
|
+
gas_used: string;
|
|
1155
|
+
/**
|
|
1156
|
+
* Whether the transaction was successful
|
|
1157
|
+
*/
|
|
1158
|
+
success: boolean;
|
|
1159
|
+
/**
|
|
1160
|
+
* The VM status of the transaction, can tell useful information in a failure
|
|
1161
|
+
*/
|
|
1162
|
+
vm_status: string;
|
|
1163
|
+
accumulator_root_hash: string;
|
|
1164
|
+
/**
|
|
1165
|
+
* Final state of resources changed by the transaction
|
|
1166
|
+
*/
|
|
1167
|
+
changes: Array<WriteSetChange>;
|
|
1168
|
+
timestamp: string;
|
|
1169
|
+
};
|
|
1170
|
+
type ValidatorTransactionResponse = {
|
|
1171
|
+
type: TransactionResponseType.Validator;
|
|
1172
|
+
version: string;
|
|
1173
|
+
hash: string;
|
|
1174
|
+
state_change_hash: string;
|
|
1175
|
+
event_root_hash: string;
|
|
1176
|
+
state_checkpoint_hash: string | null;
|
|
1116
1177
|
gas_used: string;
|
|
1117
1178
|
/**
|
|
1118
1179
|
* Whether the transaction was successful
|
|
@@ -1127,6 +1188,10 @@ type StateCheckpointTransactionResponse = {
|
|
|
1127
1188
|
* Final state of resources changed by the transaction
|
|
1128
1189
|
*/
|
|
1129
1190
|
changes: Array<WriteSetChange>;
|
|
1191
|
+
/**
|
|
1192
|
+
* The events emitted by the validator transaction
|
|
1193
|
+
*/
|
|
1194
|
+
events: Array<Event$1>;
|
|
1130
1195
|
timestamp: string;
|
|
1131
1196
|
};
|
|
1132
1197
|
/**
|
|
@@ -1635,6 +1700,180 @@ type GenerateAccountWithSingleSignerSecp256k1Key = {
|
|
|
1635
1700
|
};
|
|
1636
1701
|
type GenerateAccount = GenerateAccountWithEd25519 | GenerateAccountWithSingleSignerSecp256k1Key;
|
|
1637
1702
|
|
|
1703
|
+
/**
|
|
1704
|
+
* This interface exists to define Deserializable<T> inputs for functions that
|
|
1705
|
+
* deserialize a byte buffer into a type T.
|
|
1706
|
+
* It is not intended to be implemented or extended, because Typescript has no support
|
|
1707
|
+
* for static methods in interfaces.
|
|
1708
|
+
*/
|
|
1709
|
+
interface Deserializable<T> {
|
|
1710
|
+
deserialize(deserializer: Deserializer): T;
|
|
1711
|
+
}
|
|
1712
|
+
declare class Deserializer {
|
|
1713
|
+
private buffer;
|
|
1714
|
+
private offset;
|
|
1715
|
+
constructor(data: Uint8Array);
|
|
1716
|
+
private read;
|
|
1717
|
+
/**
|
|
1718
|
+
* Deserializes a string. UTF8 string is supported. Reads the string's bytes length "l" first,
|
|
1719
|
+
* and then reads "l" bytes of content. Decodes the byte array into a string.
|
|
1720
|
+
*
|
|
1721
|
+
* BCS layout for "string": string_length | string_content
|
|
1722
|
+
* where string_length is a u32 integer encoded as a uleb128 integer, equal to the number of bytes in string_content.
|
|
1723
|
+
*
|
|
1724
|
+
* @example
|
|
1725
|
+
* ```ts
|
|
1726
|
+
* const deserializer = new Deserializer(new Uint8Array([8, 49, 50, 51, 52, 97, 98, 99, 100]));
|
|
1727
|
+
* assert(deserializer.deserializeStr() === "1234abcd");
|
|
1728
|
+
* ```
|
|
1729
|
+
*/
|
|
1730
|
+
deserializeStr(): string;
|
|
1731
|
+
/**
|
|
1732
|
+
* Deserializes an array of bytes.
|
|
1733
|
+
*
|
|
1734
|
+
* BCS layout for "bytes": bytes_length | bytes
|
|
1735
|
+
* where bytes_length is a u32 integer encoded as a uleb128 integer, equal to the length of the bytes array.
|
|
1736
|
+
*/
|
|
1737
|
+
deserializeBytes(): Uint8Array;
|
|
1738
|
+
/**
|
|
1739
|
+
* Deserializes an array of bytes. The number of bytes to read is already known.
|
|
1740
|
+
*
|
|
1741
|
+
*/
|
|
1742
|
+
deserializeFixedBytes(len: number): Uint8Array;
|
|
1743
|
+
/**
|
|
1744
|
+
* Deserializes a boolean value.
|
|
1745
|
+
*
|
|
1746
|
+
* BCS layout for "boolean": One byte. "0x01" for true and "0x00" for false.
|
|
1747
|
+
*/
|
|
1748
|
+
deserializeBool(): boolean;
|
|
1749
|
+
/**
|
|
1750
|
+
* Deserializes a uint8 number.
|
|
1751
|
+
*
|
|
1752
|
+
* BCS layout for "uint8": One byte. Binary format in little-endian representation.
|
|
1753
|
+
*/
|
|
1754
|
+
deserializeU8(): Uint8;
|
|
1755
|
+
/**
|
|
1756
|
+
* Deserializes a uint16 number.
|
|
1757
|
+
*
|
|
1758
|
+
* BCS layout for "uint16": Two bytes. Binary format in little-endian representation.
|
|
1759
|
+
* @example
|
|
1760
|
+
* ```ts
|
|
1761
|
+
* const deserializer = new Deserializer(new Uint8Array([0x34, 0x12]));
|
|
1762
|
+
* assert(deserializer.deserializeU16() === 4660);
|
|
1763
|
+
* ```
|
|
1764
|
+
*/
|
|
1765
|
+
deserializeU16(): Uint16;
|
|
1766
|
+
/**
|
|
1767
|
+
* Deserializes a uint32 number.
|
|
1768
|
+
*
|
|
1769
|
+
* BCS layout for "uint32": Four bytes. Binary format in little-endian representation.
|
|
1770
|
+
* @example
|
|
1771
|
+
* ```ts
|
|
1772
|
+
* const deserializer = new Deserializer(new Uint8Array([0x78, 0x56, 0x34, 0x12]));
|
|
1773
|
+
* assert(deserializer.deserializeU32() === 305419896);
|
|
1774
|
+
* ```
|
|
1775
|
+
*/
|
|
1776
|
+
deserializeU32(): Uint32;
|
|
1777
|
+
/**
|
|
1778
|
+
* Deserializes a uint64 number.
|
|
1779
|
+
*
|
|
1780
|
+
* BCS layout for "uint64": Eight bytes. Binary format in little-endian representation.
|
|
1781
|
+
* @example
|
|
1782
|
+
* ```ts
|
|
1783
|
+
* const deserializer = new Deserializer(new Uint8Array([0x00, 0xEF, 0xCD, 0xAB, 0x78, 0x56, 0x34, 0x12]));
|
|
1784
|
+
* assert(deserializer.deserializeU64() === 1311768467750121216);
|
|
1785
|
+
* ```
|
|
1786
|
+
*/
|
|
1787
|
+
deserializeU64(): Uint64;
|
|
1788
|
+
/**
|
|
1789
|
+
* Deserializes a uint128 number.
|
|
1790
|
+
*
|
|
1791
|
+
* BCS layout for "uint128": Sixteen bytes. Binary format in little-endian representation.
|
|
1792
|
+
*/
|
|
1793
|
+
deserializeU128(): Uint128;
|
|
1794
|
+
/**
|
|
1795
|
+
* Deserializes a uint256 number.
|
|
1796
|
+
*
|
|
1797
|
+
* BCS layout for "uint256": Thirty-two bytes. Binary format in little-endian representation.
|
|
1798
|
+
*/
|
|
1799
|
+
deserializeU256(): Uint256;
|
|
1800
|
+
/**
|
|
1801
|
+
* Deserializes a uleb128 encoded uint32 number.
|
|
1802
|
+
*
|
|
1803
|
+
* BCS use uleb128 encoding in two cases: (1) lengths of variable-length sequences and (2) tags of enum values
|
|
1804
|
+
*/
|
|
1805
|
+
deserializeUleb128AsU32(): Uint32;
|
|
1806
|
+
/**
|
|
1807
|
+
* Helper function that primarily exists to support alternative syntax for deserialization.
|
|
1808
|
+
* That is, if we have a `const deserializer: new Deserializer(...)`, instead of having to use
|
|
1809
|
+
* `MyClass.deserialize(deserializer)`, we can call `deserializer.deserialize(MyClass)`.
|
|
1810
|
+
*
|
|
1811
|
+
* @example const deserializer = new Deserializer(new Uint8Array([1, 2, 3]));
|
|
1812
|
+
* const value = deserializer.deserialize(MyClass); // where MyClass has a `deserialize` function
|
|
1813
|
+
* // value is now an instance of MyClass
|
|
1814
|
+
* // equivalent to `const value = MyClass.deserialize(deserializer)`
|
|
1815
|
+
* @param cls The BCS-deserializable class to deserialize the buffered bytes into.
|
|
1816
|
+
*
|
|
1817
|
+
* @returns the deserialized value of class type T
|
|
1818
|
+
*/
|
|
1819
|
+
deserialize<T>(cls: Deserializable<T>): T;
|
|
1820
|
+
/**
|
|
1821
|
+
* Deserializes an array of BCS Deserializable values given an existing Deserializer
|
|
1822
|
+
* instance with a loaded byte buffer.
|
|
1823
|
+
*
|
|
1824
|
+
* @param cls The BCS-deserializable class to deserialize the buffered bytes into.
|
|
1825
|
+
* @example
|
|
1826
|
+
* // serialize a vector of addresses
|
|
1827
|
+
* const addresses = new Array<AccountAddress>(
|
|
1828
|
+
* AccountAddress.from("0x1"),
|
|
1829
|
+
* AccountAddress.from("0x2"),
|
|
1830
|
+
* AccountAddress.from("0xa"),
|
|
1831
|
+
* AccountAddress.from("0xb"),
|
|
1832
|
+
* );
|
|
1833
|
+
* const serializer = new Serializer();
|
|
1834
|
+
* serializer.serializeVector(addresses);
|
|
1835
|
+
* const serializedBytes = serializer.toUint8Array();
|
|
1836
|
+
*
|
|
1837
|
+
* // deserialize the bytes into an array of addresses
|
|
1838
|
+
* const deserializer = new Deserializer(serializedBytes);
|
|
1839
|
+
* const deserializedAddresses = deserializer.deserializeVector(AccountAddress);
|
|
1840
|
+
* // deserializedAddresses is now an array of AccountAddress instances
|
|
1841
|
+
* @returns an array of deserialized values of type T
|
|
1842
|
+
*/
|
|
1843
|
+
deserializeVector<T>(cls: Deserializable<T>): Array<T>;
|
|
1844
|
+
}
|
|
1845
|
+
|
|
1846
|
+
/**
|
|
1847
|
+
* This error is used to explain why parsing failed.
|
|
1848
|
+
*/
|
|
1849
|
+
declare class ParsingError<T> extends Error {
|
|
1850
|
+
/**
|
|
1851
|
+
* This provides a programmatic way to access why parsing failed. Downstream devs
|
|
1852
|
+
* might want to use this to build their own error messages if the default error
|
|
1853
|
+
* messages are not suitable for their use case. This should be an enum.
|
|
1854
|
+
*/
|
|
1855
|
+
invalidReason: T;
|
|
1856
|
+
constructor(message: string, invalidReason: T);
|
|
1857
|
+
}
|
|
1858
|
+
/**
|
|
1859
|
+
* Whereas ParsingError is thrown when parsing fails, e.g. in a fromString function,
|
|
1860
|
+
* this type is returned from "defensive" functions like isValid.
|
|
1861
|
+
*/
|
|
1862
|
+
type ParsingResult<T> = {
|
|
1863
|
+
/**
|
|
1864
|
+
* True if valid, false otherwise.
|
|
1865
|
+
*/
|
|
1866
|
+
valid: boolean;
|
|
1867
|
+
/**
|
|
1868
|
+
* If valid is false, this will be a code explaining why parsing failed.
|
|
1869
|
+
*/
|
|
1870
|
+
invalidReason?: T;
|
|
1871
|
+
/**
|
|
1872
|
+
* If valid is false, this will be a string explaining why parsing failed.
|
|
1873
|
+
*/
|
|
1874
|
+
invalidReasonMessage?: string;
|
|
1875
|
+
};
|
|
1876
|
+
|
|
1638
1877
|
/**
|
|
1639
1878
|
* This enum is used to explain why parsing might have failed.
|
|
1640
1879
|
*/
|
|
@@ -1915,152 +2154,9 @@ declare function ensureBoolean(value: unknown): asserts value is boolean;
|
|
|
1915
2154
|
declare const outOfRangeErrorMessage: (value: AnyNumber, min: AnyNumber, max: AnyNumber) => string;
|
|
1916
2155
|
declare function validateNumberInRange<T extends AnyNumber>(value: T, minValue: T, maxValue: T): void;
|
|
1917
2156
|
|
|
1918
|
-
|
|
1919
|
-
* This interface exists to define Deserializable<T> inputs for functions that
|
|
1920
|
-
* deserialize a byte buffer into a type T.
|
|
1921
|
-
* It is not intended to be implemented or extended, because Typescript has no support
|
|
1922
|
-
* for static methods in interfaces.
|
|
1923
|
-
*/
|
|
1924
|
-
interface Deserializable<T> {
|
|
1925
|
-
deserialize(deserializer: Deserializer): T;
|
|
2157
|
+
interface TransactionArgument extends EntryFunctionArgument, ScriptFunctionArgument {
|
|
1926
2158
|
}
|
|
1927
|
-
|
|
1928
|
-
private buffer;
|
|
1929
|
-
private offset;
|
|
1930
|
-
constructor(data: Uint8Array);
|
|
1931
|
-
private read;
|
|
1932
|
-
/**
|
|
1933
|
-
* Deserializes a string. UTF8 string is supported. Reads the string's bytes length "l" first,
|
|
1934
|
-
* and then reads "l" bytes of content. Decodes the byte array into a string.
|
|
1935
|
-
*
|
|
1936
|
-
* BCS layout for "string": string_length | string_content
|
|
1937
|
-
* where string_length is a u32 integer encoded as a uleb128 integer, equal to the number of bytes in string_content.
|
|
1938
|
-
*
|
|
1939
|
-
* @example
|
|
1940
|
-
* ```ts
|
|
1941
|
-
* const deserializer = new Deserializer(new Uint8Array([8, 49, 50, 51, 52, 97, 98, 99, 100]));
|
|
1942
|
-
* assert(deserializer.deserializeStr() === "1234abcd");
|
|
1943
|
-
* ```
|
|
1944
|
-
*/
|
|
1945
|
-
deserializeStr(): string;
|
|
1946
|
-
/**
|
|
1947
|
-
* Deserializes an array of bytes.
|
|
1948
|
-
*
|
|
1949
|
-
* BCS layout for "bytes": bytes_length | bytes
|
|
1950
|
-
* where bytes_length is a u32 integer encoded as a uleb128 integer, equal to the length of the bytes array.
|
|
1951
|
-
*/
|
|
1952
|
-
deserializeBytes(): Uint8Array;
|
|
1953
|
-
/**
|
|
1954
|
-
* Deserializes an array of bytes. The number of bytes to read is already known.
|
|
1955
|
-
*
|
|
1956
|
-
*/
|
|
1957
|
-
deserializeFixedBytes(len: number): Uint8Array;
|
|
1958
|
-
/**
|
|
1959
|
-
* Deserializes a boolean value.
|
|
1960
|
-
*
|
|
1961
|
-
* BCS layout for "boolean": One byte. "0x01" for true and "0x00" for false.
|
|
1962
|
-
*/
|
|
1963
|
-
deserializeBool(): boolean;
|
|
1964
|
-
/**
|
|
1965
|
-
* Deserializes a uint8 number.
|
|
1966
|
-
*
|
|
1967
|
-
* BCS layout for "uint8": One byte. Binary format in little-endian representation.
|
|
1968
|
-
*/
|
|
1969
|
-
deserializeU8(): Uint8;
|
|
1970
|
-
/**
|
|
1971
|
-
* Deserializes a uint16 number.
|
|
1972
|
-
*
|
|
1973
|
-
* BCS layout for "uint16": Two bytes. Binary format in little-endian representation.
|
|
1974
|
-
* @example
|
|
1975
|
-
* ```ts
|
|
1976
|
-
* const deserializer = new Deserializer(new Uint8Array([0x34, 0x12]));
|
|
1977
|
-
* assert(deserializer.deserializeU16() === 4660);
|
|
1978
|
-
* ```
|
|
1979
|
-
*/
|
|
1980
|
-
deserializeU16(): Uint16;
|
|
1981
|
-
/**
|
|
1982
|
-
* Deserializes a uint32 number.
|
|
1983
|
-
*
|
|
1984
|
-
* BCS layout for "uint32": Four bytes. Binary format in little-endian representation.
|
|
1985
|
-
* @example
|
|
1986
|
-
* ```ts
|
|
1987
|
-
* const deserializer = new Deserializer(new Uint8Array([0x78, 0x56, 0x34, 0x12]));
|
|
1988
|
-
* assert(deserializer.deserializeU32() === 305419896);
|
|
1989
|
-
* ```
|
|
1990
|
-
*/
|
|
1991
|
-
deserializeU32(): Uint32;
|
|
1992
|
-
/**
|
|
1993
|
-
* Deserializes a uint64 number.
|
|
1994
|
-
*
|
|
1995
|
-
* BCS layout for "uint64": Eight bytes. Binary format in little-endian representation.
|
|
1996
|
-
* @example
|
|
1997
|
-
* ```ts
|
|
1998
|
-
* const deserializer = new Deserializer(new Uint8Array([0x00, 0xEF, 0xCD, 0xAB, 0x78, 0x56, 0x34, 0x12]));
|
|
1999
|
-
* assert(deserializer.deserializeU64() === 1311768467750121216);
|
|
2000
|
-
* ```
|
|
2001
|
-
*/
|
|
2002
|
-
deserializeU64(): Uint64;
|
|
2003
|
-
/**
|
|
2004
|
-
* Deserializes a uint128 number.
|
|
2005
|
-
*
|
|
2006
|
-
* BCS layout for "uint128": Sixteen bytes. Binary format in little-endian representation.
|
|
2007
|
-
*/
|
|
2008
|
-
deserializeU128(): Uint128;
|
|
2009
|
-
/**
|
|
2010
|
-
* Deserializes a uint256 number.
|
|
2011
|
-
*
|
|
2012
|
-
* BCS layout for "uint256": Thirty-two bytes. Binary format in little-endian representation.
|
|
2013
|
-
*/
|
|
2014
|
-
deserializeU256(): Uint256;
|
|
2015
|
-
/**
|
|
2016
|
-
* Deserializes a uleb128 encoded uint32 number.
|
|
2017
|
-
*
|
|
2018
|
-
* BCS use uleb128 encoding in two cases: (1) lengths of variable-length sequences and (2) tags of enum values
|
|
2019
|
-
*/
|
|
2020
|
-
deserializeUleb128AsU32(): Uint32;
|
|
2021
|
-
/**
|
|
2022
|
-
* Helper function that primarily exists to support alternative syntax for deserialization.
|
|
2023
|
-
* That is, if we have a `const deserializer: new Deserializer(...)`, instead of having to use
|
|
2024
|
-
* `MyClass.deserialize(deserializer)`, we can call `deserializer.deserialize(MyClass)`.
|
|
2025
|
-
*
|
|
2026
|
-
* @example const deserializer = new Deserializer(new Uint8Array([1, 2, 3]));
|
|
2027
|
-
* const value = deserializer.deserialize(MyClass); // where MyClass has a `deserialize` function
|
|
2028
|
-
* // value is now an instance of MyClass
|
|
2029
|
-
* // equivalent to `const value = MyClass.deserialize(deserializer)`
|
|
2030
|
-
* @param cls The BCS-deserializable class to deserialize the buffered bytes into.
|
|
2031
|
-
*
|
|
2032
|
-
* @returns the deserialized value of class type T
|
|
2033
|
-
*/
|
|
2034
|
-
deserialize<T>(cls: Deserializable<T>): T;
|
|
2035
|
-
/**
|
|
2036
|
-
* Deserializes an array of BCS Deserializable values given an existing Deserializer
|
|
2037
|
-
* instance with a loaded byte buffer.
|
|
2038
|
-
*
|
|
2039
|
-
* @param cls The BCS-deserializable class to deserialize the buffered bytes into.
|
|
2040
|
-
* @example
|
|
2041
|
-
* // serialize a vector of addresses
|
|
2042
|
-
* const addresses = new Array<AccountAddress>(
|
|
2043
|
-
* AccountAddress.from("0x1"),
|
|
2044
|
-
* AccountAddress.from("0x2"),
|
|
2045
|
-
* AccountAddress.from("0xa"),
|
|
2046
|
-
* AccountAddress.from("0xb"),
|
|
2047
|
-
* );
|
|
2048
|
-
* const serializer = new Serializer();
|
|
2049
|
-
* serializer.serializeVector(addresses);
|
|
2050
|
-
* const serializedBytes = serializer.toUint8Array();
|
|
2051
|
-
*
|
|
2052
|
-
* // deserialize the bytes into an array of addresses
|
|
2053
|
-
* const deserializer = new Deserializer(serializedBytes);
|
|
2054
|
-
* const deserializedAddresses = deserializer.deserializeVector(AccountAddress);
|
|
2055
|
-
* // deserializedAddresses is now an array of AccountAddress instances
|
|
2056
|
-
* @returns an array of deserialized values of type T
|
|
2057
|
-
*/
|
|
2058
|
-
deserializeVector<T>(cls: Deserializable<T>): Array<T>;
|
|
2059
|
-
}
|
|
2060
|
-
|
|
2061
|
-
interface TransactionArgument extends EntryFunctionArgument, ScriptFunctionArgument {
|
|
2062
|
-
}
|
|
2063
|
-
interface EntryFunctionArgument {
|
|
2159
|
+
interface EntryFunctionArgument {
|
|
2064
2160
|
/**
|
|
2065
2161
|
* Serialize an argument to BCS-serialized bytes.
|
|
2066
2162
|
*/
|
|
@@ -2088,238 +2184,6 @@ interface ScriptFunctionArgument {
|
|
|
2088
2184
|
bcsToHex(): Hex;
|
|
2089
2185
|
}
|
|
2090
2186
|
|
|
2091
|
-
/**
|
|
2092
|
-
* This enum is used to explain why an address was invalid.
|
|
2093
|
-
*/
|
|
2094
|
-
declare enum AddressInvalidReason {
|
|
2095
|
-
INCORRECT_NUMBER_OF_BYTES = "incorrect_number_of_bytes",
|
|
2096
|
-
INVALID_HEX_CHARS = "invalid_hex_chars",
|
|
2097
|
-
TOO_SHORT = "too_short",
|
|
2098
|
-
TOO_LONG = "too_long",
|
|
2099
|
-
LEADING_ZERO_X_REQUIRED = "leading_zero_x_required",
|
|
2100
|
-
LONG_FORM_REQUIRED_UNLESS_SPECIAL = "long_form_required_unless_special",
|
|
2101
|
-
INVALID_PADDING_ZEROES = "INVALID_PADDING_ZEROES"
|
|
2102
|
-
}
|
|
2103
|
-
type AccountAddressInput = HexInput | AccountAddress;
|
|
2104
|
-
/**
|
|
2105
|
-
* NOTE: Only use this class for account addresses. For other hex data, e.g. transaction
|
|
2106
|
-
* hashes, use the Hex class.
|
|
2107
|
-
*
|
|
2108
|
-
* AccountAddress is used for working with account addresses. Account addresses, when
|
|
2109
|
-
* represented as a string, generally look like these examples:
|
|
2110
|
-
* - 0x1
|
|
2111
|
-
* - 0xaa86fe99004361f747f91342ca13c426ca0cccb0c1217677180c9493bad6ef0c
|
|
2112
|
-
*
|
|
2113
|
-
* Proper formatting and parsing of account addresses is defined by AIP-40.
|
|
2114
|
-
* To learn more about the standard, read the AIP here:
|
|
2115
|
-
* https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.
|
|
2116
|
-
*
|
|
2117
|
-
* The comments in this class make frequent reference to the LONG and SHORT formats,
|
|
2118
|
-
* as well as "special" addresses. To learn what these refer to see AIP-40.
|
|
2119
|
-
*/
|
|
2120
|
-
declare class AccountAddress extends Serializable implements TransactionArgument {
|
|
2121
|
-
/**
|
|
2122
|
-
* This is the internal representation of an account address.
|
|
2123
|
-
*/
|
|
2124
|
-
readonly data: Uint8Array;
|
|
2125
|
-
/**
|
|
2126
|
-
* The number of bytes that make up an account address.
|
|
2127
|
-
*/
|
|
2128
|
-
static readonly LENGTH: number;
|
|
2129
|
-
/**
|
|
2130
|
-
* The length of an address string in LONG form without a leading 0x.
|
|
2131
|
-
*/
|
|
2132
|
-
static readonly LONG_STRING_LENGTH: number;
|
|
2133
|
-
static ZERO: AccountAddress;
|
|
2134
|
-
static ONE: AccountAddress;
|
|
2135
|
-
static TWO: AccountAddress;
|
|
2136
|
-
static THREE: AccountAddress;
|
|
2137
|
-
static FOUR: AccountAddress;
|
|
2138
|
-
/**
|
|
2139
|
-
* Creates an instance of AccountAddress from a Uint8Array.
|
|
2140
|
-
*
|
|
2141
|
-
* @param args.data A Uint8Array representing an account address.
|
|
2142
|
-
*/
|
|
2143
|
-
constructor(input: Uint8Array);
|
|
2144
|
-
/**
|
|
2145
|
-
* Returns whether an address is special, where special is defined as 0x0 to 0xf
|
|
2146
|
-
* inclusive. In other words, the last byte of the address must be < 0b10000 (16)
|
|
2147
|
-
* and every other byte must be zero.
|
|
2148
|
-
*
|
|
2149
|
-
* For more information on how special addresses are defined see AIP-40:
|
|
2150
|
-
* https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.
|
|
2151
|
-
*
|
|
2152
|
-
* @returns true if the address is special, false if not.
|
|
2153
|
-
*/
|
|
2154
|
-
isSpecial(): boolean;
|
|
2155
|
-
/**
|
|
2156
|
-
* Return the AccountAddress as a string as per AIP-40.
|
|
2157
|
-
* https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.
|
|
2158
|
-
*
|
|
2159
|
-
* In short, it means that special addresses are represented in SHORT form, meaning
|
|
2160
|
-
* 0x0 through to 0xf inclusive, and every other address is represented in LONG form,
|
|
2161
|
-
* meaning 0x + 64 hex characters.
|
|
2162
|
-
*
|
|
2163
|
-
* @returns AccountAddress as a string conforming to AIP-40.
|
|
2164
|
-
*/
|
|
2165
|
-
toString(): `0x${string}`;
|
|
2166
|
-
/**
|
|
2167
|
-
* NOTE: Prefer to use `toString` where possible.
|
|
2168
|
-
*
|
|
2169
|
-
* Return the AccountAddress as a string as per AIP-40 but without the leading 0x.
|
|
2170
|
-
*
|
|
2171
|
-
* Learn more by reading the docstring of `toString`.
|
|
2172
|
-
*
|
|
2173
|
-
* @returns AccountAddress as a string conforming to AIP-40 but without the leading 0x.
|
|
2174
|
-
*/
|
|
2175
|
-
toStringWithoutPrefix(): string;
|
|
2176
|
-
/**
|
|
2177
|
-
* NOTE: Prefer to use `toString` where possible.
|
|
2178
|
-
*
|
|
2179
|
-
* Whereas toString will format special addresses (as defined by isSpecial) using the
|
|
2180
|
-
* SHORT form (no leading 0s), this format the address in the LONG format
|
|
2181
|
-
* unconditionally.
|
|
2182
|
-
*
|
|
2183
|
-
* This means it will be 0x + 64 hex characters.
|
|
2184
|
-
*
|
|
2185
|
-
* @returns AccountAddress as a string in LONG form.
|
|
2186
|
-
*/
|
|
2187
|
-
toStringLong(): `0x${string}`;
|
|
2188
|
-
/**
|
|
2189
|
-
* NOTE: Prefer to use `toString` where possible.
|
|
2190
|
-
*
|
|
2191
|
-
* Whereas toString will format special addresses (as defined by isSpecial) using the
|
|
2192
|
-
* SHORT form (no leading 0s), this function will include leading zeroes. The string
|
|
2193
|
-
* will not have a leading zero.
|
|
2194
|
-
*
|
|
2195
|
-
* This means it will be 64 hex characters without a leading 0x.
|
|
2196
|
-
*
|
|
2197
|
-
* @returns AccountAddress as a string in LONG form without a leading 0x.
|
|
2198
|
-
*/
|
|
2199
|
-
toStringLongWithoutPrefix(): string;
|
|
2200
|
-
/**
|
|
2201
|
-
* Get the inner hex data. The inner data is already a Uint8Array so no conversion
|
|
2202
|
-
* is taking place here, it just returns the inner data.
|
|
2203
|
-
*
|
|
2204
|
-
* @returns Hex data as Uint8Array
|
|
2205
|
-
*/
|
|
2206
|
-
toUint8Array(): Uint8Array;
|
|
2207
|
-
/**
|
|
2208
|
-
* Serialize the AccountAddress to a Serializer instance's data buffer.
|
|
2209
|
-
* @param serializer The serializer to serialize the AccountAddress to.
|
|
2210
|
-
* @returns void
|
|
2211
|
-
* @example
|
|
2212
|
-
* const serializer = new Serializer();
|
|
2213
|
-
* const address = AccountAddress.fromString("0x1");
|
|
2214
|
-
* address.serialize(serializer);
|
|
2215
|
-
* const bytes = serializer.toUint8Array();
|
|
2216
|
-
* // `bytes` is now the BCS-serialized address.
|
|
2217
|
-
*/
|
|
2218
|
-
serialize(serializer: Serializer): void;
|
|
2219
|
-
serializeForEntryFunction(serializer: Serializer): void;
|
|
2220
|
-
serializeForScriptFunction(serializer: Serializer): void;
|
|
2221
|
-
/**
|
|
2222
|
-
* Deserialize an AccountAddress from the byte buffer in a Deserializer instance.
|
|
2223
|
-
* @param deserializer The deserializer to deserialize the AccountAddress from.
|
|
2224
|
-
* @returns An instance of AccountAddress.
|
|
2225
|
-
* @example
|
|
2226
|
-
* const bytes = hexToBytes("0x0102030405060708091011121314151617181920212223242526272829303132");
|
|
2227
|
-
* const deserializer = new Deserializer(bytes);
|
|
2228
|
-
* const address = AccountAddress.deserialize(deserializer);
|
|
2229
|
-
* // `address` is now an instance of AccountAddress.
|
|
2230
|
-
*/
|
|
2231
|
-
static deserialize(deserializer: Deserializer): AccountAddress;
|
|
2232
|
-
/**
|
|
2233
|
-
* NOTE: This function has strict parsing behavior. For relaxed behavior, please use
|
|
2234
|
-
* the `fromString` function.
|
|
2235
|
-
*
|
|
2236
|
-
* Creates an instance of AccountAddress from a hex string.
|
|
2237
|
-
*
|
|
2238
|
-
* This function allows only the strictest formats defined by AIP-40. In short this
|
|
2239
|
-
* means only the following formats are accepted:
|
|
2240
|
-
*
|
|
2241
|
-
* - LONG
|
|
2242
|
-
* - SHORT for special addresses
|
|
2243
|
-
*
|
|
2244
|
-
* Where:
|
|
2245
|
-
* - LONG is defined as 0x + 64 hex characters.
|
|
2246
|
-
* - SHORT for special addresses is 0x0 to 0xf inclusive without padding zeroes.
|
|
2247
|
-
*
|
|
2248
|
-
* This means the following are not accepted:
|
|
2249
|
-
* - SHORT for non-special addresses.
|
|
2250
|
-
* - Any address without a leading 0x.
|
|
2251
|
-
*
|
|
2252
|
-
* Learn more about the different address formats by reading AIP-40:
|
|
2253
|
-
* https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.
|
|
2254
|
-
*
|
|
2255
|
-
* @param input A hex string representing an account address.
|
|
2256
|
-
*
|
|
2257
|
-
* @returns An instance of AccountAddress.
|
|
2258
|
-
*/
|
|
2259
|
-
static fromStringStrict(input: string): AccountAddress;
|
|
2260
|
-
/**
|
|
2261
|
-
* NOTE: This function has relaxed parsing behavior. For strict behavior, please use
|
|
2262
|
-
* the `fromStringStrict` function. Where possible use `fromStringStrict` rather than this
|
|
2263
|
-
* function, `fromString` is only provided for backwards compatibility.
|
|
2264
|
-
*
|
|
2265
|
-
* Creates an instance of AccountAddress from a hex string.
|
|
2266
|
-
*
|
|
2267
|
-
* This function allows all formats defined by AIP-40. In short this means the
|
|
2268
|
-
* following formats are accepted:
|
|
2269
|
-
*
|
|
2270
|
-
* - LONG, with or without leading 0x
|
|
2271
|
-
* - SHORT, with or without leading 0x
|
|
2272
|
-
*
|
|
2273
|
-
* Where:
|
|
2274
|
-
* - LONG is 64 hex characters.
|
|
2275
|
-
* - SHORT is 1 to 63 hex characters inclusive.
|
|
2276
|
-
* - Padding zeroes are allowed, e.g. 0x0123 is valid.
|
|
2277
|
-
*
|
|
2278
|
-
* Learn more about the different address formats by reading AIP-40:
|
|
2279
|
-
* https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.
|
|
2280
|
-
*
|
|
2281
|
-
* @param input A hex string representing an account address.
|
|
2282
|
-
*
|
|
2283
|
-
* @returns An instance of AccountAddress.
|
|
2284
|
-
*/
|
|
2285
|
-
static fromString(input: string): AccountAddress;
|
|
2286
|
-
/**
|
|
2287
|
-
* Convenience method for creating an AccountAddress from all known inputs.
|
|
2288
|
-
*
|
|
2289
|
-
* This handles, Uint8array, string, and AccountAddress itself
|
|
2290
|
-
* @param input
|
|
2291
|
-
*/
|
|
2292
|
-
static from(input: AccountAddressInput): AccountAddress;
|
|
2293
|
-
/**
|
|
2294
|
-
* Convenience method for creating an AccountAddress from all known inputs.
|
|
2295
|
-
*
|
|
2296
|
-
* This handles, Uint8array, string, and AccountAddress itself
|
|
2297
|
-
* @param input
|
|
2298
|
-
*/
|
|
2299
|
-
static fromStrict(input: AccountAddressInput): AccountAddress;
|
|
2300
|
-
/**
|
|
2301
|
-
* Check if the string is a valid AccountAddress.
|
|
2302
|
-
*
|
|
2303
|
-
* @param args.input A hex string representing an account address.
|
|
2304
|
-
* @param args.strict If true, use strict parsing behavior. If false, use relaxed parsing behavior.
|
|
2305
|
-
*
|
|
2306
|
-
* @returns valid = true if the string is valid, valid = false if not. If the string
|
|
2307
|
-
* is not valid, invalidReason will be set explaining why it is invalid.
|
|
2308
|
-
*/
|
|
2309
|
-
static isValid(args: {
|
|
2310
|
-
input: AccountAddressInput;
|
|
2311
|
-
strict?: boolean;
|
|
2312
|
-
}): ParsingResult<AddressInvalidReason>;
|
|
2313
|
-
/**
|
|
2314
|
-
* Return whether AccountAddresses are equal. AccountAddresses are considered equal
|
|
2315
|
-
* if their underlying byte data is identical.
|
|
2316
|
-
*
|
|
2317
|
-
* @param other The AccountAddress to compare to.
|
|
2318
|
-
* @returns true if the AccountAddresses are equal, false if not.
|
|
2319
|
-
*/
|
|
2320
|
-
equals(other: AccountAddress): boolean;
|
|
2321
|
-
}
|
|
2322
|
-
|
|
2323
2187
|
/**
|
|
2324
2188
|
* This class exists to represent a contiguous sequence of already serialized BCS-bytes.
|
|
2325
2189
|
*
|
|
@@ -2711,72 +2575,240 @@ declare class MoveOption<T extends Serializable & EntryFunctionArgument> extends
|
|
|
2711
2575
|
* the resulting MoveOption's .isSome() method will return false.
|
|
2712
2576
|
* @returns a MoveOption<MoveString> with an inner value `value`
|
|
2713
2577
|
*/
|
|
2714
|
-
static MoveString(value?: string | null): MoveOption<MoveString>;
|
|
2715
|
-
static deserialize<U extends Serializable & EntryFunctionArgument>(deserializer: Deserializer, cls: Deserializable<U>): MoveOption<U>;
|
|
2716
|
-
}
|
|
2717
|
-
|
|
2718
|
-
/**
|
|
2719
|
-
*
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2578
|
+
static MoveString(value?: string | null): MoveOption<MoveString>;
|
|
2579
|
+
static deserialize<U extends Serializable & EntryFunctionArgument>(deserializer: Deserializer, cls: Deserializable<U>): MoveOption<U>;
|
|
2580
|
+
}
|
|
2581
|
+
|
|
2582
|
+
/**
|
|
2583
|
+
* This enum is used to explain why an address was invalid.
|
|
2584
|
+
*/
|
|
2585
|
+
declare enum AddressInvalidReason {
|
|
2586
|
+
INCORRECT_NUMBER_OF_BYTES = "incorrect_number_of_bytes",
|
|
2587
|
+
INVALID_HEX_CHARS = "invalid_hex_chars",
|
|
2588
|
+
TOO_SHORT = "too_short",
|
|
2589
|
+
TOO_LONG = "too_long",
|
|
2590
|
+
LEADING_ZERO_X_REQUIRED = "leading_zero_x_required",
|
|
2591
|
+
LONG_FORM_REQUIRED_UNLESS_SPECIAL = "long_form_required_unless_special",
|
|
2592
|
+
INVALID_PADDING_ZEROES = "INVALID_PADDING_ZEROES"
|
|
2593
|
+
}
|
|
2594
|
+
type AccountAddressInput = HexInput | AccountAddress;
|
|
2595
|
+
/**
|
|
2596
|
+
* NOTE: Only use this class for account addresses. For other hex data, e.g. transaction
|
|
2597
|
+
* hashes, use the Hex class.
|
|
2598
|
+
*
|
|
2599
|
+
* AccountAddress is used for working with account addresses. Account addresses, when
|
|
2600
|
+
* represented as a string, generally look like these examples:
|
|
2601
|
+
* - 0x1
|
|
2602
|
+
* - 0xaa86fe99004361f747f91342ca13c426ca0cccb0c1217677180c9493bad6ef0c
|
|
2603
|
+
*
|
|
2604
|
+
* Proper formatting and parsing of account addresses is defined by AIP-40.
|
|
2605
|
+
* To learn more about the standard, read the AIP here:
|
|
2606
|
+
* https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.
|
|
2607
|
+
*
|
|
2608
|
+
* The comments in this class make frequent reference to the LONG and SHORT formats,
|
|
2609
|
+
* as well as "special" addresses. To learn what these refer to see AIP-40.
|
|
2610
|
+
*/
|
|
2611
|
+
declare class AccountAddress extends Serializable implements TransactionArgument {
|
|
2612
|
+
/**
|
|
2613
|
+
* This is the internal representation of an account address.
|
|
2614
|
+
*/
|
|
2615
|
+
readonly data: Uint8Array;
|
|
2616
|
+
/**
|
|
2617
|
+
* The number of bytes that make up an account address.
|
|
2618
|
+
*/
|
|
2619
|
+
static readonly LENGTH: number;
|
|
2620
|
+
/**
|
|
2621
|
+
* The length of an address string in LONG form without a leading 0x.
|
|
2622
|
+
*/
|
|
2623
|
+
static readonly LONG_STRING_LENGTH: number;
|
|
2624
|
+
static ZERO: AccountAddress;
|
|
2625
|
+
static ONE: AccountAddress;
|
|
2626
|
+
static TWO: AccountAddress;
|
|
2627
|
+
static THREE: AccountAddress;
|
|
2628
|
+
static FOUR: AccountAddress;
|
|
2629
|
+
/**
|
|
2630
|
+
* Creates an instance of AccountAddress from a Uint8Array.
|
|
2631
|
+
*
|
|
2632
|
+
* @param args.data A Uint8Array representing an account address.
|
|
2633
|
+
*/
|
|
2634
|
+
constructor(input: Uint8Array);
|
|
2635
|
+
/**
|
|
2636
|
+
* Returns whether an address is special, where special is defined as 0x0 to 0xf
|
|
2637
|
+
* inclusive. In other words, the last byte of the address must be < 0b10000 (16)
|
|
2638
|
+
* and every other byte must be zero.
|
|
2639
|
+
*
|
|
2640
|
+
* For more information on how special addresses are defined see AIP-40:
|
|
2641
|
+
* https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.
|
|
2642
|
+
*
|
|
2643
|
+
* @returns true if the address is special, false if not.
|
|
2644
|
+
*/
|
|
2645
|
+
isSpecial(): boolean;
|
|
2646
|
+
/**
|
|
2647
|
+
* Return the AccountAddress as a string as per AIP-40.
|
|
2648
|
+
* https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.
|
|
2649
|
+
*
|
|
2650
|
+
* In short, it means that special addresses are represented in SHORT form, meaning
|
|
2651
|
+
* 0x0 through to 0xf inclusive, and every other address is represented in LONG form,
|
|
2652
|
+
* meaning 0x + 64 hex characters.
|
|
2653
|
+
*
|
|
2654
|
+
* @returns AccountAddress as a string conforming to AIP-40.
|
|
2655
|
+
*/
|
|
2656
|
+
toString(): `0x${string}`;
|
|
2657
|
+
/**
|
|
2658
|
+
* NOTE: Prefer to use `toString` where possible.
|
|
2659
|
+
*
|
|
2660
|
+
* Return the AccountAddress as a string as per AIP-40 but without the leading 0x.
|
|
2661
|
+
*
|
|
2662
|
+
* Learn more by reading the docstring of `toString`.
|
|
2663
|
+
*
|
|
2664
|
+
* @returns AccountAddress as a string conforming to AIP-40 but without the leading 0x.
|
|
2665
|
+
*/
|
|
2666
|
+
toStringWithoutPrefix(): string;
|
|
2667
|
+
/**
|
|
2668
|
+
* NOTE: Prefer to use `toString` where possible.
|
|
2669
|
+
*
|
|
2670
|
+
* Whereas toString will format special addresses (as defined by isSpecial) using the
|
|
2671
|
+
* SHORT form (no leading 0s), this format the address in the LONG format
|
|
2672
|
+
* unconditionally.
|
|
2673
|
+
*
|
|
2674
|
+
* This means it will be 0x + 64 hex characters.
|
|
2675
|
+
*
|
|
2676
|
+
* @returns AccountAddress as a string in LONG form.
|
|
2677
|
+
*/
|
|
2678
|
+
toStringLong(): `0x${string}`;
|
|
2679
|
+
/**
|
|
2680
|
+
* NOTE: Prefer to use `toString` where possible.
|
|
2681
|
+
*
|
|
2682
|
+
* Whereas toString will format special addresses (as defined by isSpecial) using the
|
|
2683
|
+
* SHORT form (no leading 0s), this function will include leading zeroes. The string
|
|
2684
|
+
* will not have a leading zero.
|
|
2685
|
+
*
|
|
2686
|
+
* This means it will be 64 hex characters without a leading 0x.
|
|
2687
|
+
*
|
|
2688
|
+
* @returns AccountAddress as a string in LONG form without a leading 0x.
|
|
2689
|
+
*/
|
|
2690
|
+
toStringLongWithoutPrefix(): string;
|
|
2723
2691
|
/**
|
|
2724
|
-
*
|
|
2725
|
-
*
|
|
2726
|
-
*
|
|
2692
|
+
* Get the inner hex data. The inner data is already a Uint8Array so no conversion
|
|
2693
|
+
* is taking place here, it just returns the inner data.
|
|
2694
|
+
*
|
|
2695
|
+
* @returns Hex data as Uint8Array
|
|
2727
2696
|
*/
|
|
2728
|
-
|
|
2729
|
-
message: HexInput;
|
|
2730
|
-
signature: Signature;
|
|
2731
|
-
}): boolean;
|
|
2697
|
+
toUint8Array(): Uint8Array;
|
|
2732
2698
|
/**
|
|
2733
|
-
*
|
|
2699
|
+
* Serialize the AccountAddress to a Serializer instance's data buffer.
|
|
2700
|
+
* @param serializer The serializer to serialize the AccountAddress to.
|
|
2701
|
+
* @returns void
|
|
2702
|
+
* @example
|
|
2703
|
+
* const serializer = new Serializer();
|
|
2704
|
+
* const address = AccountAddress.fromString("0x1");
|
|
2705
|
+
* address.serialize(serializer);
|
|
2706
|
+
* const bytes = serializer.toUint8Array();
|
|
2707
|
+
* // `bytes` is now the BCS-serialized address.
|
|
2734
2708
|
*/
|
|
2735
|
-
|
|
2709
|
+
serialize(serializer: Serializer): void;
|
|
2710
|
+
serializeForEntryFunction(serializer: Serializer): void;
|
|
2711
|
+
serializeForScriptFunction(serializer: Serializer): void;
|
|
2736
2712
|
/**
|
|
2737
|
-
*
|
|
2713
|
+
* Deserialize an AccountAddress from the byte buffer in a Deserializer instance.
|
|
2714
|
+
* @param deserializer The deserializer to deserialize the AccountAddress from.
|
|
2715
|
+
* @returns An instance of AccountAddress.
|
|
2716
|
+
* @example
|
|
2717
|
+
* const bytes = hexToBytes("0x0102030405060708091011121314151617181920212223242526272829303132");
|
|
2718
|
+
* const deserializer = new Deserializer(bytes);
|
|
2719
|
+
* const address = AccountAddress.deserialize(deserializer);
|
|
2720
|
+
* // `address` is now an instance of AccountAddress.
|
|
2738
2721
|
*/
|
|
2739
|
-
|
|
2740
|
-
abstract serialize(serializer: Serializer): void;
|
|
2741
|
-
}
|
|
2742
|
-
/**
|
|
2743
|
-
* An abstract representation of a private key. This is used to sign transactions and
|
|
2744
|
-
* derive the public key associated.
|
|
2745
|
-
*/
|
|
2746
|
-
declare abstract class PrivateKey extends Serializable {
|
|
2722
|
+
static deserialize(deserializer: Deserializer): AccountAddress;
|
|
2747
2723
|
/**
|
|
2748
|
-
*
|
|
2749
|
-
*
|
|
2724
|
+
* NOTE: This function has strict parsing behavior. For relaxed behavior, please use
|
|
2725
|
+
* the `fromString` function.
|
|
2726
|
+
*
|
|
2727
|
+
* Creates an instance of AccountAddress from a hex string.
|
|
2728
|
+
*
|
|
2729
|
+
* This function allows only the strictest formats defined by AIP-40. In short this
|
|
2730
|
+
* means only the following formats are accepted:
|
|
2731
|
+
*
|
|
2732
|
+
* - LONG
|
|
2733
|
+
* - SHORT for special addresses
|
|
2734
|
+
*
|
|
2735
|
+
* Where:
|
|
2736
|
+
* - LONG is defined as 0x + 64 hex characters.
|
|
2737
|
+
* - SHORT for special addresses is 0x0 to 0xf inclusive without padding zeroes.
|
|
2738
|
+
*
|
|
2739
|
+
* This means the following are not accepted:
|
|
2740
|
+
* - SHORT for non-special addresses.
|
|
2741
|
+
* - Any address without a leading 0x.
|
|
2742
|
+
*
|
|
2743
|
+
* Learn more about the different address formats by reading AIP-40:
|
|
2744
|
+
* https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.
|
|
2745
|
+
*
|
|
2746
|
+
* @param input A hex string representing an account address.
|
|
2747
|
+
*
|
|
2748
|
+
* @returns An instance of AccountAddress.
|
|
2750
2749
|
*/
|
|
2751
|
-
|
|
2750
|
+
static fromStringStrict(input: string): AccountAddress;
|
|
2752
2751
|
/**
|
|
2753
|
-
*
|
|
2752
|
+
* NOTE: This function has relaxed parsing behavior. For strict behavior, please use
|
|
2753
|
+
* the `fromStringStrict` function. Where possible use `fromStringStrict` rather than this
|
|
2754
|
+
* function, `fromString` is only provided for backwards compatibility.
|
|
2755
|
+
*
|
|
2756
|
+
* Creates an instance of AccountAddress from a hex string.
|
|
2757
|
+
*
|
|
2758
|
+
* This function allows all formats defined by AIP-40. In short this means the
|
|
2759
|
+
* following formats are accepted:
|
|
2760
|
+
*
|
|
2761
|
+
* - LONG, with or without leading 0x
|
|
2762
|
+
* - SHORT, with or without leading 0x
|
|
2763
|
+
*
|
|
2764
|
+
* Where:
|
|
2765
|
+
* - LONG is 64 hex characters.
|
|
2766
|
+
* - SHORT is 1 to 63 hex characters inclusive.
|
|
2767
|
+
* - Padding zeroes are allowed, e.g. 0x0123 is valid.
|
|
2768
|
+
*
|
|
2769
|
+
* Learn more about the different address formats by reading AIP-40:
|
|
2770
|
+
* https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.
|
|
2771
|
+
*
|
|
2772
|
+
* @param input A hex string representing an account address.
|
|
2773
|
+
*
|
|
2774
|
+
* @returns An instance of AccountAddress.
|
|
2754
2775
|
*/
|
|
2755
|
-
|
|
2776
|
+
static fromString(input: string): AccountAddress;
|
|
2756
2777
|
/**
|
|
2757
|
-
*
|
|
2778
|
+
* Convenience method for creating an AccountAddress from all known inputs.
|
|
2779
|
+
*
|
|
2780
|
+
* This handles, Uint8array, string, and AccountAddress itself
|
|
2781
|
+
* @param input
|
|
2758
2782
|
*/
|
|
2759
|
-
|
|
2760
|
-
abstract serialize(serializer: Serializer): void;
|
|
2783
|
+
static from(input: AccountAddressInput): AccountAddress;
|
|
2761
2784
|
/**
|
|
2762
|
-
*
|
|
2785
|
+
* Convenience method for creating an AccountAddress from all known inputs.
|
|
2786
|
+
*
|
|
2787
|
+
* This handles, Uint8array, string, and AccountAddress itself
|
|
2788
|
+
* @param input
|
|
2763
2789
|
*/
|
|
2764
|
-
|
|
2765
|
-
}
|
|
2766
|
-
/**
|
|
2767
|
-
* An abstract representation of a signature. This is the product of signing a
|
|
2768
|
-
* message and can be used with the PublicKey to verify the signature.
|
|
2769
|
-
*/
|
|
2770
|
-
declare abstract class Signature extends Serializable {
|
|
2790
|
+
static fromStrict(input: AccountAddressInput): AccountAddress;
|
|
2771
2791
|
/**
|
|
2772
|
-
*
|
|
2792
|
+
* Check if the string is a valid AccountAddress.
|
|
2793
|
+
*
|
|
2794
|
+
* @param args.input A hex string representing an account address.
|
|
2795
|
+
* @param args.strict If true, use strict parsing behavior. If false, use relaxed parsing behavior.
|
|
2796
|
+
*
|
|
2797
|
+
* @returns valid = true if the string is valid, valid = false if not. If the string
|
|
2798
|
+
* is not valid, invalidReason will be set explaining why it is invalid.
|
|
2773
2799
|
*/
|
|
2774
|
-
|
|
2800
|
+
static isValid(args: {
|
|
2801
|
+
input: AccountAddressInput;
|
|
2802
|
+
strict?: boolean;
|
|
2803
|
+
}): ParsingResult<AddressInvalidReason>;
|
|
2775
2804
|
/**
|
|
2776
|
-
*
|
|
2805
|
+
* Return whether AccountAddresses are equal. AccountAddresses are considered equal
|
|
2806
|
+
* if their underlying byte data is identical.
|
|
2807
|
+
*
|
|
2808
|
+
* @param other The AccountAddress to compare to.
|
|
2809
|
+
* @returns true if the AccountAddresses are equal, false if not.
|
|
2777
2810
|
*/
|
|
2778
|
-
|
|
2779
|
-
abstract serialize(serializer: Serializer): void;
|
|
2811
|
+
equals(other: AccountAddress): boolean;
|
|
2780
2812
|
}
|
|
2781
2813
|
|
|
2782
2814
|
/**
|
|
@@ -2809,7 +2841,12 @@ declare class AuthenticationKey extends Serializable {
|
|
|
2809
2841
|
static deserialize(deserializer: Deserializer): AuthenticationKey;
|
|
2810
2842
|
toString(): string;
|
|
2811
2843
|
toUint8Array(): Uint8Array;
|
|
2844
|
+
static fromSchemeAndBytes(args: {
|
|
2845
|
+
scheme: AuthenticationKeyScheme;
|
|
2846
|
+
input: HexInput;
|
|
2847
|
+
}): AuthenticationKey;
|
|
2812
2848
|
/**
|
|
2849
|
+
* @deprecated Use `fromPublicKey` instead
|
|
2813
2850
|
* Derives an AuthenticationKey from the public key seed bytes and an explicit derivation scheme.
|
|
2814
2851
|
*
|
|
2815
2852
|
* This facilitates targeting a specific scheme for deriving an authentication key from a public key.
|
|
@@ -2817,7 +2854,7 @@ declare class AuthenticationKey extends Serializable {
|
|
|
2817
2854
|
* @param args - the public key and scheme to use for the derivation
|
|
2818
2855
|
*/
|
|
2819
2856
|
static fromPublicKeyAndScheme(args: {
|
|
2820
|
-
publicKey:
|
|
2857
|
+
publicKey: AccountPublicKey;
|
|
2821
2858
|
scheme: AuthenticationKeyScheme;
|
|
2822
2859
|
}): AuthenticationKey;
|
|
2823
2860
|
/**
|
|
@@ -2828,7 +2865,7 @@ declare class AuthenticationKey extends Serializable {
|
|
|
2828
2865
|
* @returns AuthenticationKey
|
|
2829
2866
|
*/
|
|
2830
2867
|
static fromPublicKey(args: {
|
|
2831
|
-
publicKey:
|
|
2868
|
+
publicKey: AccountPublicKey;
|
|
2832
2869
|
}): AuthenticationKey;
|
|
2833
2870
|
/**
|
|
2834
2871
|
* Derives an account address from an AuthenticationKey. Since an AccountAddress is also 32 bytes,
|
|
@@ -2840,172 +2877,81 @@ declare class AuthenticationKey extends Serializable {
|
|
|
2840
2877
|
}
|
|
2841
2878
|
|
|
2842
2879
|
/**
|
|
2843
|
-
*
|
|
2844
|
-
*
|
|
2845
|
-
* Use this class to create accounts, sign transactions, and more.
|
|
2846
|
-
* Note: Creating an account instance does not create the account on-chain.
|
|
2847
|
-
*
|
|
2848
|
-
* Since [AIP-55](https://github.com/aptos-foundation/AIPs/pull/263) Aptos supports
|
|
2849
|
-
* `Legacy` and `Unified` authentications.
|
|
2850
|
-
*
|
|
2851
|
-
* @Legacy includes `ED25519` and `MultiED25519`
|
|
2852
|
-
* @Unified includes `SingleSender` and `MultiSender`, where currently
|
|
2853
|
-
* `SingleSender` supports `ED25519` and `Secp256k1`, and `MultiSender` supports
|
|
2854
|
-
* `MultiED25519`.
|
|
2855
|
-
*
|
|
2856
|
-
* In TypeScript SDK, we support all of these options:
|
|
2857
|
-
*
|
|
2858
|
-
* @generate default to generate Legacy Ed25519 keys, with an optional `legacy` boolean argument
|
|
2859
|
-
* that lets you generate new keys conforming to the Unified authentication.
|
|
2860
|
-
*
|
|
2861
|
-
* @fromPrivateKey derives an account by a provided private key and address, with an optional
|
|
2862
|
-
* `legacy` boolean argument that lets you generate new keys conforming to the Unified authentication.
|
|
2863
|
-
*
|
|
2864
|
-
* @fromDerivationPath derives an account with bip44 path and mnemonics,
|
|
2880
|
+
* An abstract representation of a crypto signature,
|
|
2881
|
+
* associated to a specific signature scheme e.g. Ed25519 or Secp256k1
|
|
2865
2882
|
*
|
|
2883
|
+
* This is the product of signing a message directly from a PrivateKey
|
|
2884
|
+
* and can be verified against a CryptoPublicKey.
|
|
2866
2885
|
*/
|
|
2867
|
-
declare class
|
|
2868
|
-
/**
|
|
2869
|
-
* Public key associated with the account
|
|
2870
|
-
*/
|
|
2871
|
-
readonly publicKey: PublicKey;
|
|
2872
|
-
/**
|
|
2873
|
-
* Private key associated with the account
|
|
2874
|
-
*/
|
|
2875
|
-
readonly privateKey: PrivateKey;
|
|
2876
|
-
/**
|
|
2877
|
-
* Account address associated with the account
|
|
2878
|
-
*/
|
|
2879
|
-
readonly accountAddress: AccountAddress;
|
|
2886
|
+
declare abstract class Signature extends Serializable {
|
|
2880
2887
|
/**
|
|
2881
|
-
*
|
|
2888
|
+
* Get the raw signature bytes
|
|
2882
2889
|
*/
|
|
2883
|
-
|
|
2890
|
+
abstract toUint8Array(): Uint8Array;
|
|
2884
2891
|
/**
|
|
2885
|
-
*
|
|
2886
|
-
*
|
|
2887
|
-
* Need to update this to use the new crypto library if new schemes are added.
|
|
2888
|
-
*
|
|
2889
|
-
* @param args.privateKey PrivateKey - private key of the account
|
|
2890
|
-
* @param args.address AccountAddress - address of the account
|
|
2891
|
-
* @param args.legacy optional. If set to false, the keypair authentication keys will be derived with a unified scheme.
|
|
2892
|
-
* Defaults to deriving an authentication key with the legacy scheme.
|
|
2893
|
-
*
|
|
2894
|
-
* This method is private because it should only be called by the factory static methods.
|
|
2895
|
-
* @returns Account
|
|
2892
|
+
* Get the signature as a hex string with a 0x prefix e.g. 0x123456...
|
|
2896
2893
|
*/
|
|
2897
|
-
|
|
2894
|
+
toString(): string;
|
|
2895
|
+
}
|
|
2896
|
+
|
|
2897
|
+
/**
|
|
2898
|
+
* Arguments for verifying a signature
|
|
2899
|
+
*/
|
|
2900
|
+
interface VerifySignatureArgs {
|
|
2901
|
+
message: HexInput;
|
|
2902
|
+
signature: Signature;
|
|
2903
|
+
}
|
|
2904
|
+
/**
|
|
2905
|
+
* An abstract representation of a public key.
|
|
2906
|
+
*
|
|
2907
|
+
* Provides a common interface for verifying any signature.
|
|
2908
|
+
*/
|
|
2909
|
+
declare abstract class PublicKey extends Serializable {
|
|
2898
2910
|
/**
|
|
2899
|
-
*
|
|
2900
|
-
*
|
|
2901
|
-
*
|
|
2902
|
-
*
|
|
2903
|
-
* @param args optional. Unify GenerateAccount type for Legacy and Unified keys
|
|
2904
|
-
*
|
|
2905
|
-
* Account input type to generate an account using Legacy
|
|
2906
|
-
* Ed25519 or MultiEd25519 keys or without a specified `scheme`.
|
|
2907
|
-
* ```
|
|
2908
|
-
* GenerateAccountWithLegacyKey = {
|
|
2909
|
-
* scheme?: SigningSchemeInput.Ed25519 | SigningSchemeInput.MultiEd25519;
|
|
2910
|
-
* legacy: true;
|
|
2911
|
-
* };
|
|
2912
|
-
* ```
|
|
2913
|
-
*
|
|
2914
|
-
* Account input type to generate an account using Unified
|
|
2915
|
-
* Secp256k1Ecdsa key
|
|
2916
|
-
* In this case `legacy` is always false
|
|
2917
|
-
* ```
|
|
2918
|
-
* GenerateAccountWithUnifiedKey = {
|
|
2919
|
-
* scheme: SigningSchemeInput.Secp256k1Ecdsa;
|
|
2920
|
-
* legacy?: false;
|
|
2921
|
-
* };
|
|
2922
|
-
* ```
|
|
2923
|
-
*
|
|
2924
|
-
* @returns Account with the given signing scheme
|
|
2911
|
+
* Verifies that the private key associated with this public key signed the message with the given signature.
|
|
2912
|
+
* @param args.message The message that was signed
|
|
2913
|
+
* @param args.signature The signature to verify
|
|
2925
2914
|
*/
|
|
2926
|
-
|
|
2915
|
+
abstract verifySignature(args: VerifySignatureArgs): boolean;
|
|
2927
2916
|
/**
|
|
2928
|
-
*
|
|
2929
|
-
*
|
|
2930
|
-
* This is used as a local calculation and therefore is used to instantiate an `Account`
|
|
2931
|
-
* that has not had its authentication key rotated.
|
|
2932
|
-
*
|
|
2933
|
-
* @param privateKey PrivateKey - private key of the account
|
|
2934
|
-
* @param args.legacy optional. If set to false, the keypair generated is a Unified keypair. Defaults
|
|
2935
|
-
* to generating a Legacy Ed25519 keypair
|
|
2936
|
-
*
|
|
2937
|
-
* @returns Account
|
|
2917
|
+
* Get the raw public key bytes
|
|
2938
2918
|
*/
|
|
2939
|
-
|
|
2940
|
-
privateKey: PrivateKey;
|
|
2941
|
-
legacy?: boolean;
|
|
2942
|
-
}): Account$1;
|
|
2919
|
+
abstract toUint8Array(): Uint8Array;
|
|
2943
2920
|
/**
|
|
2944
|
-
*
|
|
2945
|
-
* This is primarily used to instantiate an `Account` that has had its authentication key rotated.
|
|
2946
|
-
*
|
|
2947
|
-
* @param args.privateKey PrivateKey - the underlying private key for the account
|
|
2948
|
-
* @param args.address AccountAddress - The account address the `Account` will sign for
|
|
2949
|
-
* @param args.legacy optional. If set to false, the keypair generated is a Unified keypair. Defaults
|
|
2950
|
-
* to generating a Legacy Ed25519 keypair
|
|
2951
|
-
*
|
|
2952
|
-
* @returns Account
|
|
2921
|
+
* Get the public key as a hex string with a 0x prefix e.g. 0x123456...
|
|
2953
2922
|
*/
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2923
|
+
toString(): string;
|
|
2924
|
+
}
|
|
2925
|
+
/**
|
|
2926
|
+
* An abstract representation of an account public key.
|
|
2927
|
+
*
|
|
2928
|
+
* Provides a common interface for deriving an authentication key.
|
|
2929
|
+
*/
|
|
2930
|
+
declare abstract class AccountPublicKey extends PublicKey {
|
|
2959
2931
|
/**
|
|
2960
|
-
*
|
|
2961
|
-
*
|
|
2962
|
-
* @param args.scheme The signing scheme to derive with
|
|
2963
|
-
* @param args.path the BIP44 derive hardened path (e.g. m/44'/637'/0'/0'/0') for Ed25519,
|
|
2964
|
-
* or non-hardened path (e.g. m/44'/637'/0'/0/0) for secp256k1
|
|
2965
|
-
* Detailed description: {@link https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki}
|
|
2966
|
-
* @param args.mnemonic the mnemonic seed phrase of the account
|
|
2967
|
-
* @param args.legacy optional. If set to false, the keypair generated is a Unified keypair. Defaults
|
|
2968
|
-
* to generating a Legacy Ed25519 keypair
|
|
2969
|
-
*
|
|
2970
|
-
* @returns Account
|
|
2932
|
+
* Get the authentication key associated with this public key
|
|
2971
2933
|
*/
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2934
|
+
abstract authKey(): AuthenticationKey;
|
|
2935
|
+
}
|
|
2936
|
+
|
|
2937
|
+
/**
|
|
2938
|
+
* An abstract representation of a private key.
|
|
2939
|
+
* It is associated to a signature scheme and provides signing capabilities.
|
|
2940
|
+
*/
|
|
2941
|
+
interface PrivateKey {
|
|
2978
2942
|
/**
|
|
2979
|
-
*
|
|
2980
|
-
*
|
|
2981
|
-
* See here for more info: {@link https://aptos.dev/concepts/accounts#single-signer-authentication}
|
|
2982
|
-
*
|
|
2983
|
-
* @param args.publicKey PublicKey - public key of the account
|
|
2984
|
-
* @returns The authentication key for the associated account
|
|
2943
|
+
* Sign the given message with the private key.
|
|
2944
|
+
* @param message in HexInput format
|
|
2985
2945
|
*/
|
|
2986
|
-
|
|
2987
|
-
publicKey: PublicKey;
|
|
2988
|
-
}): AuthenticationKey;
|
|
2946
|
+
sign(message: HexInput): Signature;
|
|
2989
2947
|
/**
|
|
2990
|
-
*
|
|
2991
|
-
*
|
|
2992
|
-
* TODO: Add sign transaction or specific types
|
|
2993
|
-
*
|
|
2994
|
-
* @param data in HexInput format
|
|
2995
|
-
* @returns Signature
|
|
2948
|
+
* Derive the public key associated with the private key
|
|
2996
2949
|
*/
|
|
2997
|
-
|
|
2950
|
+
publicKey(): PublicKey;
|
|
2998
2951
|
/**
|
|
2999
|
-
*
|
|
3000
|
-
*
|
|
3001
|
-
* @param args.message raw message data in HexInput format
|
|
3002
|
-
* @param args.signature signed message Signature
|
|
3003
|
-
* @returns
|
|
2952
|
+
* Get the private key in bytes (Uint8Array).
|
|
3004
2953
|
*/
|
|
3005
|
-
|
|
3006
|
-
message: HexInput;
|
|
3007
|
-
signature: Signature;
|
|
3008
|
-
}): boolean;
|
|
2954
|
+
toUint8Array(): Uint8Array;
|
|
3009
2955
|
}
|
|
3010
2956
|
|
|
3011
2957
|
/**
|
|
@@ -3017,7 +2963,7 @@ declare class Account$1 {
|
|
|
3017
2963
|
* Ed25519 scheme is represented in the SDK as `Legacy authentication key` and also
|
|
3018
2964
|
* as `AnyPublicKey` that represents any `Unified authentication key`
|
|
3019
2965
|
*/
|
|
3020
|
-
declare class Ed25519PublicKey extends
|
|
2966
|
+
declare class Ed25519PublicKey extends AccountPublicKey {
|
|
3021
2967
|
/**
|
|
3022
2968
|
* Length of an Ed25519 public key
|
|
3023
2969
|
*/
|
|
@@ -3033,36 +2979,30 @@ declare class Ed25519PublicKey extends PublicKey {
|
|
|
3033
2979
|
* @param hexInput A HexInput (string or Uint8Array)
|
|
3034
2980
|
*/
|
|
3035
2981
|
constructor(hexInput: HexInput);
|
|
2982
|
+
/**
|
|
2983
|
+
* Verifies a signed data with a public key
|
|
2984
|
+
* @param args.message a signed message
|
|
2985
|
+
* @param args.signature the signature of the message
|
|
2986
|
+
*/
|
|
2987
|
+
verifySignature(args: VerifySignatureArgs): boolean;
|
|
2988
|
+
authKey(): AuthenticationKey;
|
|
3036
2989
|
/**
|
|
3037
2990
|
* Get the public key in bytes (Uint8Array).
|
|
3038
2991
|
*
|
|
3039
2992
|
* @returns Uint8Array representation of the public key
|
|
3040
2993
|
*/
|
|
3041
2994
|
toUint8Array(): Uint8Array;
|
|
3042
|
-
/**
|
|
3043
|
-
* Get the public key as a hex string with the 0x prefix.
|
|
3044
|
-
*
|
|
3045
|
-
* @returns string representation of the public key
|
|
3046
|
-
*/
|
|
3047
|
-
toString(): string;
|
|
3048
|
-
/**
|
|
3049
|
-
* Verifies a signed data with a public key
|
|
3050
|
-
* @param args.message a signed message
|
|
3051
|
-
* @param args.signature the signature of the message
|
|
3052
|
-
*/
|
|
3053
|
-
verifySignature(args: {
|
|
3054
|
-
message: HexInput;
|
|
3055
|
-
signature: Ed25519Signature;
|
|
3056
|
-
}): boolean;
|
|
3057
2995
|
serialize(serializer: Serializer): void;
|
|
3058
2996
|
static deserialize(deserializer: Deserializer): Ed25519PublicKey;
|
|
3059
|
-
|
|
3060
|
-
|
|
2997
|
+
/**
|
|
2998
|
+
* @deprecated use `instanceof Ed25519PublicKey` instead.
|
|
2999
|
+
*/
|
|
3000
|
+
static isPublicKey(publicKey: AccountPublicKey): publicKey is Ed25519PublicKey;
|
|
3061
3001
|
}
|
|
3062
3002
|
/**
|
|
3063
3003
|
* Represents the private key of an Ed25519 key pair.
|
|
3064
3004
|
*/
|
|
3065
|
-
declare class Ed25519PrivateKey extends PrivateKey {
|
|
3005
|
+
declare class Ed25519PrivateKey extends Serializable implements PrivateKey {
|
|
3066
3006
|
/**
|
|
3067
3007
|
* Length of an Ed25519 private key
|
|
3068
3008
|
*/
|
|
@@ -3083,39 +3023,12 @@ declare class Ed25519PrivateKey extends PrivateKey {
|
|
|
3083
3023
|
* @param hexInput HexInput (string or Uint8Array)
|
|
3084
3024
|
*/
|
|
3085
3025
|
constructor(hexInput: HexInput);
|
|
3086
|
-
/**
|
|
3087
|
-
* Get the private key in bytes (Uint8Array).
|
|
3088
|
-
*
|
|
3089
|
-
* @returns Uint8Array representation of the private key
|
|
3090
|
-
*/
|
|
3091
|
-
toUint8Array(): Uint8Array;
|
|
3092
|
-
/**
|
|
3093
|
-
* Get the private key as a hex string with the 0x prefix.
|
|
3094
|
-
*
|
|
3095
|
-
* @returns string representation of the private key
|
|
3096
|
-
*/
|
|
3097
|
-
toString(): string;
|
|
3098
|
-
/**
|
|
3099
|
-
* Sign the given message with the private key.
|
|
3100
|
-
*
|
|
3101
|
-
* @param message in HexInput format
|
|
3102
|
-
* @returns Signature
|
|
3103
|
-
*/
|
|
3104
|
-
sign(message: HexInput): Ed25519Signature;
|
|
3105
|
-
serialize(serializer: Serializer): void;
|
|
3106
|
-
static deserialize(deserializer: Deserializer): Ed25519PrivateKey;
|
|
3107
3026
|
/**
|
|
3108
3027
|
* Generate a new random private key.
|
|
3109
3028
|
*
|
|
3110
3029
|
* @returns Ed25519PrivateKey
|
|
3111
3030
|
*/
|
|
3112
3031
|
static generate(): Ed25519PrivateKey;
|
|
3113
|
-
/**
|
|
3114
|
-
* Derive the Ed25519PublicKey for this private key.
|
|
3115
|
-
*
|
|
3116
|
-
* @returns Ed25519PublicKey
|
|
3117
|
-
*/
|
|
3118
|
-
publicKey(): Ed25519PublicKey;
|
|
3119
3032
|
/**
|
|
3120
3033
|
* Derives a private key from a mnemonic seed phrase.
|
|
3121
3034
|
*
|
|
@@ -3138,6 +3051,36 @@ declare class Ed25519PrivateKey extends PrivateKey {
|
|
|
3138
3051
|
* @returns
|
|
3139
3052
|
*/
|
|
3140
3053
|
private static fromDerivationPathInner;
|
|
3054
|
+
/**
|
|
3055
|
+
* Derive the Ed25519PublicKey for this private key.
|
|
3056
|
+
*
|
|
3057
|
+
* @returns Ed25519PublicKey
|
|
3058
|
+
*/
|
|
3059
|
+
publicKey(): Ed25519PublicKey;
|
|
3060
|
+
/**
|
|
3061
|
+
* Sign the given message with the private key.
|
|
3062
|
+
*
|
|
3063
|
+
* @param message in HexInput format
|
|
3064
|
+
* @returns Signature
|
|
3065
|
+
*/
|
|
3066
|
+
sign(message: HexInput): Ed25519Signature;
|
|
3067
|
+
/**
|
|
3068
|
+
* Get the private key in bytes (Uint8Array).
|
|
3069
|
+
*
|
|
3070
|
+
* @returns Uint8Array representation of the private key
|
|
3071
|
+
*/
|
|
3072
|
+
toUint8Array(): Uint8Array;
|
|
3073
|
+
/**
|
|
3074
|
+
* Get the private key as a hex string with the 0x prefix.
|
|
3075
|
+
*
|
|
3076
|
+
* @returns string representation of the private key
|
|
3077
|
+
*/
|
|
3078
|
+
toString(): string;
|
|
3079
|
+
serialize(serializer: Serializer): void;
|
|
3080
|
+
static deserialize(deserializer: Deserializer): Ed25519PrivateKey;
|
|
3081
|
+
/**
|
|
3082
|
+
* @deprecated use `instanceof Ed25519PrivateKey` instead.
|
|
3083
|
+
*/
|
|
3141
3084
|
static isPrivateKey(privateKey: PrivateKey): privateKey is Ed25519PrivateKey;
|
|
3142
3085
|
}
|
|
3143
3086
|
/**
|
|
@@ -3154,28 +3097,79 @@ declare class Ed25519Signature extends Signature {
|
|
|
3154
3097
|
*/
|
|
3155
3098
|
private readonly data;
|
|
3156
3099
|
constructor(hexInput: HexInput);
|
|
3157
|
-
/**
|
|
3158
|
-
* Get the signature in bytes (Uint8Array).
|
|
3159
|
-
*
|
|
3160
|
-
* @returns Uint8Array representation of the signature
|
|
3161
|
-
*/
|
|
3162
3100
|
toUint8Array(): Uint8Array;
|
|
3163
|
-
/**
|
|
3164
|
-
* Get the signature as a hex string with the 0x prefix.
|
|
3165
|
-
*
|
|
3166
|
-
* @returns string representation of the signature
|
|
3167
|
-
*/
|
|
3168
|
-
toString(): string;
|
|
3169
3101
|
serialize(serializer: Serializer): void;
|
|
3170
3102
|
static deserialize(deserializer: Deserializer): Ed25519Signature;
|
|
3171
|
-
static load(deserializer: Deserializer): Ed25519Signature;
|
|
3172
|
-
static isSignature(signature: Signature): signature is Ed25519Signature;
|
|
3173
3103
|
}
|
|
3174
3104
|
|
|
3105
|
+
type DerivedKeys = {
|
|
3106
|
+
key: Uint8Array;
|
|
3107
|
+
chainCode: Uint8Array;
|
|
3108
|
+
};
|
|
3109
|
+
/**
|
|
3110
|
+
* Aptos derive path is 637
|
|
3111
|
+
*/
|
|
3112
|
+
declare const APTOS_HARDENED_REGEX: RegExp;
|
|
3113
|
+
declare const APTOS_BIP44_REGEX: RegExp;
|
|
3114
|
+
/**
|
|
3115
|
+
* A list of supported key types and associated seeds
|
|
3116
|
+
*/
|
|
3117
|
+
declare enum KeyType {
|
|
3118
|
+
ED25519 = "ed25519 seed"
|
|
3119
|
+
}
|
|
3120
|
+
declare const HARDENED_OFFSET = 2147483648;
|
|
3121
|
+
/**
|
|
3122
|
+
* Aptos derive path is 637
|
|
3123
|
+
*
|
|
3124
|
+
* Parse and validate a path that is compliant to BIP-44 in form m/44'/637'/{account_index}'/{change_index}/{address_index}
|
|
3125
|
+
* for Secp256k1
|
|
3126
|
+
*
|
|
3127
|
+
* Note that for secp256k1, last two components must be non-hardened.
|
|
3128
|
+
*
|
|
3129
|
+
* @param path path string (e.g. `m/44'/637'/0'/0/0`).
|
|
3130
|
+
*/
|
|
3131
|
+
declare function isValidBIP44Path(path: string): boolean;
|
|
3132
|
+
/**
|
|
3133
|
+
* Aptos derive path is 637
|
|
3134
|
+
*
|
|
3135
|
+
* Parse and validate a path that is compliant to SLIP-0010 and BIP-44
|
|
3136
|
+
* in form m/44'/637'/{account_index}'/{change_index}'/{address_index}'.
|
|
3137
|
+
* See SLIP-0010 {@link https://github.com/satoshilabs/slips/blob/master/slip-0044.md}
|
|
3138
|
+
* See BIP-44 {@link https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki}
|
|
3139
|
+
*
|
|
3140
|
+
* Note that for Ed25519, all components must be hardened.
|
|
3141
|
+
* This is because non-hardened [PK] derivation would not work due to Ed25519's lack of a key homomorphism.
|
|
3142
|
+
* Specifically, you cannot derive the PK associated with derivation path a/b/c given the PK of a/b.
|
|
3143
|
+
* This is because the PK in Ed25519 is, more or less, computed as 𝑔𝐻(𝑠𝑘),
|
|
3144
|
+
* with the hash function breaking the homomorphism.
|
|
3145
|
+
*
|
|
3146
|
+
* @param path path string (e.g. `m/44'/637'/0'/0'/0'`).
|
|
3147
|
+
*/
|
|
3148
|
+
declare function isValidHardenedPath(path: string): boolean;
|
|
3149
|
+
declare const deriveKey: (hashSeed: Uint8Array | string, data: Uint8Array | string) => DerivedKeys;
|
|
3150
|
+
/**
|
|
3151
|
+
* Derive a child key from the private key
|
|
3152
|
+
* @param key
|
|
3153
|
+
* @param chainCode
|
|
3154
|
+
* @param index
|
|
3155
|
+
* @constructor
|
|
3156
|
+
*/
|
|
3157
|
+
declare const CKDPriv: ({ key, chainCode }: DerivedKeys, index: number) => DerivedKeys;
|
|
3158
|
+
/**
|
|
3159
|
+
* Splits derive path into segments
|
|
3160
|
+
* @param path
|
|
3161
|
+
*/
|
|
3162
|
+
declare const splitPath: (path: string) => Array<string>;
|
|
3163
|
+
/**
|
|
3164
|
+
* Normalizes the mnemonic by removing extra whitespace and making it lowercase
|
|
3165
|
+
* @param mnemonic the mnemonic seed phrase
|
|
3166
|
+
*/
|
|
3167
|
+
declare const mnemonicToSeed: (mnemonic: string) => Uint8Array;
|
|
3168
|
+
|
|
3175
3169
|
/**
|
|
3176
3170
|
* Represents the public key of a K-of-N Ed25519 multi-sig transaction.
|
|
3177
3171
|
*/
|
|
3178
|
-
declare class MultiEd25519PublicKey extends
|
|
3172
|
+
declare class MultiEd25519PublicKey extends AccountPublicKey {
|
|
3179
3173
|
/**
|
|
3180
3174
|
* Maximum number of public keys supported
|
|
3181
3175
|
*/
|
|
@@ -3189,7 +3183,7 @@ declare class MultiEd25519PublicKey extends PublicKey {
|
|
|
3189
3183
|
*/
|
|
3190
3184
|
static readonly MIN_THRESHOLD = 1;
|
|
3191
3185
|
/**
|
|
3192
|
-
* List of Ed25519 public keys for this
|
|
3186
|
+
* List of Ed25519 public keys for this LegacyMultiEd25519PublicKey
|
|
3193
3187
|
*/
|
|
3194
3188
|
readonly publicKeys: Ed25519PublicKey[];
|
|
3195
3189
|
/**
|
|
@@ -3211,34 +3205,181 @@ declare class MultiEd25519PublicKey extends PublicKey {
|
|
|
3211
3205
|
publicKeys: Ed25519PublicKey[];
|
|
3212
3206
|
threshold: number;
|
|
3213
3207
|
});
|
|
3208
|
+
verifySignature(args: VerifySignatureArgs): boolean;
|
|
3209
|
+
authKey(): AuthenticationKey;
|
|
3210
|
+
/**
|
|
3211
|
+
* Converts a PublicKeys into Uint8Array (bytes) with: bytes = p1_bytes | ... | pn_bytes | threshold
|
|
3212
|
+
*/
|
|
3213
|
+
toUint8Array(): Uint8Array;
|
|
3214
|
+
serialize(serializer: Serializer): void;
|
|
3215
|
+
static deserialize(deserializer: Deserializer): MultiEd25519PublicKey;
|
|
3216
|
+
}
|
|
3217
|
+
/**
|
|
3218
|
+
* Represents the signature of a K-of-N Ed25519 multi-sig transaction.
|
|
3219
|
+
*/
|
|
3220
|
+
declare class MultiEd25519Signature extends Signature {
|
|
3221
|
+
/**
|
|
3222
|
+
* Maximum number of Ed25519 signatures supported
|
|
3223
|
+
*/
|
|
3224
|
+
static MAX_SIGNATURES_SUPPORTED: number;
|
|
3225
|
+
/**
|
|
3226
|
+
* Number of bytes in the bitmap representing who signed the transaction (32-bits)
|
|
3227
|
+
*/
|
|
3228
|
+
static BITMAP_LEN: number;
|
|
3229
|
+
/**
|
|
3230
|
+
* The list of underlying Ed25519 signatures
|
|
3231
|
+
*/
|
|
3232
|
+
readonly signatures: Ed25519Signature[];
|
|
3233
|
+
/**
|
|
3234
|
+
* 32-bit Bitmap representing who signed the transaction
|
|
3235
|
+
*
|
|
3236
|
+
* This is represented where each public key can be masked to determine whether the message was signed by that key.
|
|
3237
|
+
*/
|
|
3238
|
+
readonly bitmap: Uint8Array;
|
|
3239
|
+
/**
|
|
3240
|
+
* Signature for a K-of-N multi-sig transaction.
|
|
3241
|
+
*
|
|
3242
|
+
* @see {@link
|
|
3243
|
+
* https://aptos.dev/integration/creating-a-signed-transaction/#multisignature-transactions | Creating a Signed Transaction}
|
|
3244
|
+
*
|
|
3245
|
+
* @param args.signatures A list of signatures
|
|
3246
|
+
* @param args.bitmap 4 bytes, at most 32 signatures are supported. If Nth bit value is `1`, the Nth
|
|
3247
|
+
* signature should be provided in `signatures`. Bits are read from left to right.
|
|
3248
|
+
* Alternatively, you can specify an array of bitmap positions.
|
|
3249
|
+
* Valid position should range between 0 and 31.
|
|
3250
|
+
* @see MultiEd25519Signature.createBitmap
|
|
3251
|
+
*/
|
|
3252
|
+
constructor(args: {
|
|
3253
|
+
signatures: Ed25519Signature[];
|
|
3254
|
+
bitmap: Uint8Array | number[];
|
|
3255
|
+
});
|
|
3256
|
+
/**
|
|
3257
|
+
* Converts a MultiSignature into Uint8Array (bytes) with `bytes = s1_bytes | ... | sn_bytes | bitmap`
|
|
3258
|
+
*/
|
|
3259
|
+
toUint8Array(): Uint8Array;
|
|
3260
|
+
serialize(serializer: Serializer): void;
|
|
3261
|
+
static deserialize(deserializer: Deserializer): MultiEd25519Signature;
|
|
3262
|
+
/**
|
|
3263
|
+
* Helper method to create a bitmap out of the specified bit positions
|
|
3264
|
+
* @param args.bits The bitmap positions that should be set. A position starts at index 0.
|
|
3265
|
+
* Valid position should range between 0 and 31.
|
|
3266
|
+
* @example
|
|
3267
|
+
* Here's an example of valid `bits`
|
|
3268
|
+
* ```
|
|
3269
|
+
* [0, 2, 31]
|
|
3270
|
+
* ```
|
|
3271
|
+
* `[0, 2, 31]` means the 1st, 3rd and 32nd bits should be set in the bitmap.
|
|
3272
|
+
* The result bitmap should be 0b1010000000000000000000000000001
|
|
3273
|
+
*
|
|
3274
|
+
* @returns bitmap that is 32bit long
|
|
3275
|
+
*/
|
|
3276
|
+
static createBitmap(args: {
|
|
3277
|
+
bits: number[];
|
|
3278
|
+
}): Uint8Array;
|
|
3279
|
+
}
|
|
3280
|
+
|
|
3281
|
+
/**
|
|
3282
|
+
* Represents any public key supported by Aptos.
|
|
3283
|
+
*
|
|
3284
|
+
* Since [AIP-55](https://github.com/aptos-foundation/AIPs/pull/263) Aptos supports
|
|
3285
|
+
* `Legacy` and `Unified` authentication keys.
|
|
3286
|
+
*
|
|
3287
|
+
* Any unified authentication key is represented in the SDK as `AnyPublicKey`.
|
|
3288
|
+
*/
|
|
3289
|
+
declare class AnyPublicKey extends AccountPublicKey {
|
|
3290
|
+
/**
|
|
3291
|
+
* Reference to the inner public key
|
|
3292
|
+
*/
|
|
3293
|
+
readonly publicKey: PublicKey;
|
|
3294
|
+
/**
|
|
3295
|
+
* Index of the underlying enum variant
|
|
3296
|
+
*/
|
|
3297
|
+
readonly variant: AnyPublicKeyVariant;
|
|
3298
|
+
constructor(publicKey: PublicKey);
|
|
3299
|
+
verifySignature(args: VerifySignatureArgs): boolean;
|
|
3300
|
+
authKey(): AuthenticationKey;
|
|
3301
|
+
toUint8Array(): Uint8Array;
|
|
3302
|
+
serialize(serializer: Serializer): void;
|
|
3303
|
+
static deserialize(deserializer: Deserializer): AnyPublicKey;
|
|
3304
|
+
/**
|
|
3305
|
+
* @deprecated use `instanceof AnyPublicKey` instead.
|
|
3306
|
+
*/
|
|
3307
|
+
static isPublicKey(publicKey: AccountPublicKey): publicKey is AnyPublicKey;
|
|
3308
|
+
/**
|
|
3309
|
+
* @deprecated use `publicKey instanceof Ed25519PublicKey` instead.
|
|
3310
|
+
*/
|
|
3311
|
+
isEd25519(): boolean;
|
|
3312
|
+
/**
|
|
3313
|
+
* @deprecated use `publicKey instanceof Secp256k1PublicKey` instead.
|
|
3314
|
+
*/
|
|
3315
|
+
isSecp256k1PublicKey(): boolean;
|
|
3316
|
+
}
|
|
3317
|
+
/**
|
|
3318
|
+
* Instance of signature that uses the SingleKey authentication scheme.
|
|
3319
|
+
* This signature can only be generated by a `SingleKeySigner`, since it uses the
|
|
3320
|
+
* same authentication scheme.
|
|
3321
|
+
*/
|
|
3322
|
+
declare class AnySignature extends Signature {
|
|
3323
|
+
readonly signature: Signature;
|
|
3324
|
+
/**
|
|
3325
|
+
* Index of the underlying enum variant
|
|
3326
|
+
*/
|
|
3327
|
+
private readonly variant;
|
|
3328
|
+
constructor(signature: Signature);
|
|
3329
|
+
toUint8Array(): Uint8Array;
|
|
3330
|
+
serialize(serializer: Serializer): void;
|
|
3331
|
+
static deserialize(deserializer: Deserializer): AnySignature;
|
|
3332
|
+
}
|
|
3333
|
+
|
|
3334
|
+
/**
|
|
3335
|
+
* Represents the public key of a multi-agent account.
|
|
3336
|
+
*
|
|
3337
|
+
* The public keys of each individual agent can be any type of public key supported by Aptos.
|
|
3338
|
+
* Since [AIP-55](https://github.com/aptos-foundation/AIPs/pull/263) Aptos supports
|
|
3339
|
+
* `Legacy` and `Unified` authentication keys.
|
|
3340
|
+
*/
|
|
3341
|
+
declare class MultiKey extends AccountPublicKey {
|
|
3342
|
+
/**
|
|
3343
|
+
* List of any public keys
|
|
3344
|
+
*/
|
|
3345
|
+
readonly publicKeys: AnyPublicKey[];
|
|
3214
3346
|
/**
|
|
3215
|
-
*
|
|
3347
|
+
* The minimum number of valid signatures required, for the number of public keys specified
|
|
3216
3348
|
*/
|
|
3349
|
+
readonly signaturesRequired: number;
|
|
3350
|
+
constructor(args: {
|
|
3351
|
+
publicKeys: Array<PublicKey>;
|
|
3352
|
+
signaturesRequired: number;
|
|
3353
|
+
});
|
|
3354
|
+
verifySignature(args: VerifySignatureArgs): boolean;
|
|
3355
|
+
authKey(): AuthenticationKey;
|
|
3217
3356
|
toUint8Array(): Uint8Array;
|
|
3218
|
-
toString(): string;
|
|
3219
|
-
verifySignature(args: {
|
|
3220
|
-
message: HexInput;
|
|
3221
|
-
signature: MultiEd25519Signature;
|
|
3222
|
-
}): boolean;
|
|
3223
3357
|
serialize(serializer: Serializer): void;
|
|
3224
|
-
static deserialize(deserializer: Deserializer):
|
|
3225
|
-
}
|
|
3226
|
-
/**
|
|
3227
|
-
* Represents the signature of a K-of-N Ed25519 multi-sig transaction.
|
|
3228
|
-
*/
|
|
3229
|
-
declare class MultiEd25519Signature extends Signature {
|
|
3358
|
+
static deserialize(deserializer: Deserializer): MultiKey;
|
|
3230
3359
|
/**
|
|
3231
|
-
*
|
|
3360
|
+
* Create a bitmap that holds the mapping from the original public keys
|
|
3361
|
+
* to the signatures passed in
|
|
3362
|
+
*
|
|
3363
|
+
* @param args.bits array of the index mapping to the matching public keys
|
|
3364
|
+
* @returns Uint8array bit map
|
|
3232
3365
|
*/
|
|
3233
|
-
|
|
3366
|
+
createBitmap(args: {
|
|
3367
|
+
bits: number[];
|
|
3368
|
+
}): Uint8Array;
|
|
3369
|
+
}
|
|
3370
|
+
declare class MultiKeySignature extends Signature {
|
|
3234
3371
|
/**
|
|
3235
3372
|
* Number of bytes in the bitmap representing who signed the transaction (32-bits)
|
|
3236
3373
|
*/
|
|
3237
3374
|
static BITMAP_LEN: number;
|
|
3375
|
+
/**
|
|
3376
|
+
* Maximum number of Ed25519 signatures supported
|
|
3377
|
+
*/
|
|
3378
|
+
static MAX_SIGNATURES_SUPPORTED: number;
|
|
3238
3379
|
/**
|
|
3239
3380
|
* The list of underlying Ed25519 signatures
|
|
3240
3381
|
*/
|
|
3241
|
-
readonly signatures:
|
|
3382
|
+
readonly signatures: AnySignature[];
|
|
3242
3383
|
/**
|
|
3243
3384
|
* 32-bit Bitmap representing who signed the transaction
|
|
3244
3385
|
*
|
|
@@ -3256,14 +3397,9 @@ declare class MultiEd25519Signature extends Signature {
|
|
|
3256
3397
|
* signature should be provided in `signatures`. Bits are read from left to right
|
|
3257
3398
|
*/
|
|
3258
3399
|
constructor(args: {
|
|
3259
|
-
signatures:
|
|
3260
|
-
bitmap: Uint8Array;
|
|
3400
|
+
signatures: Array<Signature | AnySignature>;
|
|
3401
|
+
bitmap: Uint8Array | number[];
|
|
3261
3402
|
});
|
|
3262
|
-
/**
|
|
3263
|
-
* Converts a MultiSignature into Uint8Array (bytes) with `bytes = s1_bytes | ... | sn_bytes | bitmap`
|
|
3264
|
-
*/
|
|
3265
|
-
toUint8Array(): Uint8Array;
|
|
3266
|
-
toString(): string;
|
|
3267
3403
|
/**
|
|
3268
3404
|
* Helper method to create a bitmap out of the specified bit positions
|
|
3269
3405
|
* @param args.bits The bitmap positions that should be set. A position starts at index 0.
|
|
@@ -3281,8 +3417,9 @@ declare class MultiEd25519Signature extends Signature {
|
|
|
3281
3417
|
static createBitmap(args: {
|
|
3282
3418
|
bits: number[];
|
|
3283
3419
|
}): Uint8Array;
|
|
3420
|
+
toUint8Array(): Uint8Array;
|
|
3284
3421
|
serialize(serializer: Serializer): void;
|
|
3285
|
-
static deserialize(deserializer: Deserializer):
|
|
3422
|
+
static deserialize(deserializer: Deserializer): MultiKeySignature;
|
|
3286
3423
|
}
|
|
3287
3424
|
|
|
3288
3425
|
/**
|
|
@@ -3299,38 +3436,20 @@ declare class Secp256k1PublicKey extends PublicKey {
|
|
|
3299
3436
|
* @param hexInput A HexInput (string or Uint8Array)
|
|
3300
3437
|
*/
|
|
3301
3438
|
constructor(hexInput: HexInput);
|
|
3302
|
-
|
|
3303
|
-
* Get the public key in bytes (Uint8Array).
|
|
3304
|
-
*
|
|
3305
|
-
* @returns Uint8Array representation of the public key
|
|
3306
|
-
*/
|
|
3439
|
+
verifySignature(args: VerifySignatureArgs): boolean;
|
|
3307
3440
|
toUint8Array(): Uint8Array;
|
|
3308
|
-
/**
|
|
3309
|
-
* Get the public key as a hex string with the 0x prefix.
|
|
3310
|
-
*
|
|
3311
|
-
* @returns string representation of the public key
|
|
3312
|
-
*/
|
|
3313
|
-
toString(): string;
|
|
3314
|
-
/**
|
|
3315
|
-
* Verifies a signed data with a public key
|
|
3316
|
-
*
|
|
3317
|
-
* @param args.message message
|
|
3318
|
-
* @param args.signature The signature
|
|
3319
|
-
* @returns true if the signature is valid
|
|
3320
|
-
*/
|
|
3321
|
-
verifySignature(args: {
|
|
3322
|
-
message: HexInput;
|
|
3323
|
-
signature: Secp256k1Signature;
|
|
3324
|
-
}): boolean;
|
|
3325
3441
|
serialize(serializer: Serializer): void;
|
|
3326
3442
|
static deserialize(deserializer: Deserializer): Secp256k1PublicKey;
|
|
3327
|
-
|
|
3443
|
+
/**
|
|
3444
|
+
* @deprecated use `instanceof Secp256k1PublicKey` instead
|
|
3445
|
+
* @param publicKey
|
|
3446
|
+
*/
|
|
3328
3447
|
static isPublicKey(publicKey: PublicKey): publicKey is Secp256k1PublicKey;
|
|
3329
3448
|
}
|
|
3330
3449
|
/**
|
|
3331
3450
|
* A Secp256k1 ecdsa private key
|
|
3332
3451
|
*/
|
|
3333
|
-
declare class Secp256k1PrivateKey extends PrivateKey {
|
|
3452
|
+
declare class Secp256k1PrivateKey extends Serializable implements PrivateKey {
|
|
3334
3453
|
/**
|
|
3335
3454
|
* Length of Secp256k1 ecdsa private key
|
|
3336
3455
|
*/
|
|
@@ -3346,39 +3465,12 @@ declare class Secp256k1PrivateKey extends PrivateKey {
|
|
|
3346
3465
|
* @param hexInput A HexInput (string or Uint8Array)
|
|
3347
3466
|
*/
|
|
3348
3467
|
constructor(hexInput: HexInput);
|
|
3349
|
-
/**
|
|
3350
|
-
* Get the private key in bytes (Uint8Array).
|
|
3351
|
-
*
|
|
3352
|
-
* @returns
|
|
3353
|
-
*/
|
|
3354
|
-
toUint8Array(): Uint8Array;
|
|
3355
|
-
/**
|
|
3356
|
-
* Get the private key as a hex string with the 0x prefix.
|
|
3357
|
-
*
|
|
3358
|
-
* @returns string representation of the private key
|
|
3359
|
-
*/
|
|
3360
|
-
toString(): string;
|
|
3361
|
-
/**
|
|
3362
|
-
* Sign the given message with the private key.
|
|
3363
|
-
*
|
|
3364
|
-
* @param message in HexInput format
|
|
3365
|
-
* @returns Signature
|
|
3366
|
-
*/
|
|
3367
|
-
sign(message: HexInput): Secp256k1Signature;
|
|
3368
|
-
serialize(serializer: Serializer): void;
|
|
3369
|
-
static deserialize(deserializer: Deserializer): Secp256k1PrivateKey;
|
|
3370
3468
|
/**
|
|
3371
3469
|
* Generate a new random private key.
|
|
3372
3470
|
*
|
|
3373
3471
|
* @returns Secp256k1PrivateKey
|
|
3374
3472
|
*/
|
|
3375
3473
|
static generate(): Secp256k1PrivateKey;
|
|
3376
|
-
/**
|
|
3377
|
-
* Derive the Secp256k1PublicKey from this private key.
|
|
3378
|
-
*
|
|
3379
|
-
* @returns Secp256k1PublicKey
|
|
3380
|
-
*/
|
|
3381
|
-
publicKey(): Secp256k1PublicKey;
|
|
3382
3474
|
/**
|
|
3383
3475
|
* Derives a private key from a mnemonic seed phrase.
|
|
3384
3476
|
*
|
|
@@ -3398,209 +3490,411 @@ declare class Secp256k1PrivateKey extends PrivateKey {
|
|
|
3398
3490
|
* @returns The generated key
|
|
3399
3491
|
*/
|
|
3400
3492
|
private static fromDerivationPathInner;
|
|
3493
|
+
/**
|
|
3494
|
+
* Sign the given message with the private key.
|
|
3495
|
+
*
|
|
3496
|
+
* @param message in HexInput format
|
|
3497
|
+
* @returns Signature
|
|
3498
|
+
*/
|
|
3499
|
+
sign(message: HexInput): Secp256k1Signature;
|
|
3500
|
+
/**
|
|
3501
|
+
* Derive the Secp256k1PublicKey from this private key.
|
|
3502
|
+
*
|
|
3503
|
+
* @returns Secp256k1PublicKey
|
|
3504
|
+
*/
|
|
3505
|
+
publicKey(): Secp256k1PublicKey;
|
|
3506
|
+
/**
|
|
3507
|
+
* Get the private key in bytes (Uint8Array).
|
|
3508
|
+
*
|
|
3509
|
+
* @returns
|
|
3510
|
+
*/
|
|
3511
|
+
toUint8Array(): Uint8Array;
|
|
3512
|
+
/**
|
|
3513
|
+
* Get the private key as a hex string with the 0x prefix.
|
|
3514
|
+
*
|
|
3515
|
+
* @returns string representation of the private key
|
|
3516
|
+
*/
|
|
3517
|
+
toString(): string;
|
|
3518
|
+
serialize(serializer: Serializer): void;
|
|
3519
|
+
static deserialize(deserializer: Deserializer): Secp256k1PrivateKey;
|
|
3520
|
+
/**
|
|
3521
|
+
* @deprecated use `instanceof Secp256k1PrivateKey` instead
|
|
3522
|
+
*/
|
|
3401
3523
|
static isPrivateKey(privateKey: PrivateKey): privateKey is Secp256k1PrivateKey;
|
|
3402
3524
|
}
|
|
3403
3525
|
/**
|
|
3404
|
-
* A signature of a message signed using
|
|
3526
|
+
* A signature of a message signed using a Secp256k1 ecdsa private key
|
|
3405
3527
|
*/
|
|
3406
3528
|
declare class Secp256k1Signature extends Signature {
|
|
3407
3529
|
/**
|
|
3408
|
-
* Secp256k1 ecdsa signatures are 256-bit.
|
|
3530
|
+
* Secp256k1 ecdsa signatures are 256-bit.
|
|
3531
|
+
*/
|
|
3532
|
+
static readonly LENGTH = 64;
|
|
3533
|
+
/**
|
|
3534
|
+
* The signature bytes
|
|
3535
|
+
* @private
|
|
3536
|
+
*/
|
|
3537
|
+
private readonly data;
|
|
3538
|
+
/**
|
|
3539
|
+
* Create a new Signature instance from a Uint8Array or String.
|
|
3540
|
+
*
|
|
3541
|
+
* @param hexInput A HexInput (string or Uint8Array)
|
|
3542
|
+
*/
|
|
3543
|
+
constructor(hexInput: HexInput);
|
|
3544
|
+
toUint8Array(): Uint8Array;
|
|
3545
|
+
serialize(serializer: Serializer): void;
|
|
3546
|
+
static deserialize(deserializer: Deserializer): Secp256k1Signature;
|
|
3547
|
+
}
|
|
3548
|
+
|
|
3549
|
+
declare abstract class AccountAuthenticator extends Serializable {
|
|
3550
|
+
abstract serialize(serializer: Serializer): void;
|
|
3551
|
+
static deserialize(deserializer: Deserializer): AccountAuthenticator;
|
|
3552
|
+
isEd25519(): this is AccountAuthenticatorEd25519;
|
|
3553
|
+
isMultiEd25519(): this is AccountAuthenticatorMultiEd25519;
|
|
3554
|
+
isSingleKey(): this is AccountAuthenticatorSingleKey;
|
|
3555
|
+
isMultiKey(): this is AccountAuthenticatorMultiKey;
|
|
3556
|
+
}
|
|
3557
|
+
/**
|
|
3558
|
+
* Transaction authenticator Ed25519 for a multi signer transaction
|
|
3559
|
+
*
|
|
3560
|
+
* @param public_key Account's Ed25519 public key.
|
|
3561
|
+
* @param signature Account's Ed25519 signature
|
|
3562
|
+
*
|
|
3563
|
+
*/
|
|
3564
|
+
declare class AccountAuthenticatorEd25519 extends AccountAuthenticator {
|
|
3565
|
+
readonly public_key: Ed25519PublicKey;
|
|
3566
|
+
readonly signature: Ed25519Signature;
|
|
3567
|
+
constructor(public_key: Ed25519PublicKey, signature: Ed25519Signature);
|
|
3568
|
+
serialize(serializer: Serializer): void;
|
|
3569
|
+
static load(deserializer: Deserializer): AccountAuthenticatorEd25519;
|
|
3570
|
+
}
|
|
3571
|
+
/**
|
|
3572
|
+
* Transaction authenticator Multi Ed25519 for a multi signers transaction
|
|
3573
|
+
*
|
|
3574
|
+
* @param public_key Account's MultiEd25519 public key.
|
|
3575
|
+
* @param signature Account's MultiEd25519 signature
|
|
3576
|
+
*
|
|
3577
|
+
*/
|
|
3578
|
+
declare class AccountAuthenticatorMultiEd25519 extends AccountAuthenticator {
|
|
3579
|
+
readonly public_key: MultiEd25519PublicKey;
|
|
3580
|
+
readonly signature: MultiEd25519Signature;
|
|
3581
|
+
constructor(public_key: MultiEd25519PublicKey, signature: MultiEd25519Signature);
|
|
3582
|
+
serialize(serializer: Serializer): void;
|
|
3583
|
+
static load(deserializer: Deserializer): AccountAuthenticatorMultiEd25519;
|
|
3584
|
+
}
|
|
3585
|
+
/**
|
|
3586
|
+
* AccountAuthenticatorSingleKey for a single signer
|
|
3587
|
+
*
|
|
3588
|
+
* @param public_key AnyPublicKey
|
|
3589
|
+
* @param signature AnySignature
|
|
3590
|
+
*
|
|
3591
|
+
*/
|
|
3592
|
+
declare class AccountAuthenticatorSingleKey extends AccountAuthenticator {
|
|
3593
|
+
readonly public_key: AnyPublicKey;
|
|
3594
|
+
readonly signature: AnySignature;
|
|
3595
|
+
constructor(public_key: AnyPublicKey, signature: AnySignature);
|
|
3596
|
+
serialize(serializer: Serializer): void;
|
|
3597
|
+
static load(deserializer: Deserializer): AccountAuthenticatorSingleKey;
|
|
3598
|
+
}
|
|
3599
|
+
/**
|
|
3600
|
+
* AccountAuthenticatorMultiKey for a multi signer
|
|
3601
|
+
*
|
|
3602
|
+
* @param public_keys MultiKey
|
|
3603
|
+
* @param signatures Signature
|
|
3604
|
+
*
|
|
3605
|
+
*/
|
|
3606
|
+
declare class AccountAuthenticatorMultiKey extends AccountAuthenticator {
|
|
3607
|
+
readonly public_keys: MultiKey;
|
|
3608
|
+
readonly signatures: Array<AnySignature>;
|
|
3609
|
+
readonly signatures_bitmap: Uint8Array;
|
|
3610
|
+
constructor(public_keys: MultiKey, signatures: Array<AnySignature>, signatures_bitmap: Uint8Array);
|
|
3611
|
+
serialize(serializer: Serializer): void;
|
|
3612
|
+
static load(deserializer: Deserializer): AccountAuthenticatorMultiKey;
|
|
3613
|
+
}
|
|
3614
|
+
|
|
3615
|
+
interface SingleKeySignerConstructorArgs {
|
|
3616
|
+
privateKey: PrivateKey;
|
|
3617
|
+
address?: AccountAddressInput;
|
|
3618
|
+
}
|
|
3619
|
+
interface SingleKeySignerGenerateArgs {
|
|
3620
|
+
scheme?: SigningSchemeInput;
|
|
3621
|
+
}
|
|
3622
|
+
type SingleKeySignerFromDerivationPathArgs = SingleKeySignerGenerateArgs & {
|
|
3623
|
+
path: string;
|
|
3624
|
+
mnemonic: string;
|
|
3625
|
+
};
|
|
3626
|
+
interface VerifySingleKeySignatureArgs {
|
|
3627
|
+
message: HexInput;
|
|
3628
|
+
signature: AnySignature;
|
|
3629
|
+
}
|
|
3630
|
+
/**
|
|
3631
|
+
* Signer implementation for the SingleKey authentication scheme.
|
|
3632
|
+
* This extends a SingleKeyAccount by adding signing capabilities through a valid private key.
|
|
3633
|
+
* Currently, the only supported signature schemes are Ed25519 and Secp256k1.
|
|
3634
|
+
*
|
|
3635
|
+
* Note: Generating a signer instance does not create the account on-chain.
|
|
3636
|
+
*/
|
|
3637
|
+
declare class SingleKeyAccount implements Account$1 {
|
|
3638
|
+
/**
|
|
3639
|
+
* Private key associated with the account
|
|
3640
|
+
*/
|
|
3641
|
+
readonly privateKey: PrivateKey;
|
|
3642
|
+
readonly publicKey: AnyPublicKey;
|
|
3643
|
+
readonly accountAddress: AccountAddress;
|
|
3644
|
+
readonly signingScheme = SigningScheme.SingleKey;
|
|
3645
|
+
constructor(args: SingleKeySignerConstructorArgs);
|
|
3646
|
+
/**
|
|
3647
|
+
* Derives an account from a randomly generated private key.
|
|
3648
|
+
* Default generation is using an Ed25519 key
|
|
3649
|
+
* @returns Account with the given signature scheme
|
|
3650
|
+
*/
|
|
3651
|
+
static generate(args?: SingleKeySignerGenerateArgs): SingleKeyAccount;
|
|
3652
|
+
/**
|
|
3653
|
+
* Derives an account with bip44 path and mnemonics,
|
|
3654
|
+
* Default to using an Ed25519 signature scheme.
|
|
3655
|
+
*
|
|
3656
|
+
* @param args.scheme The signature scheme to derive the private key with
|
|
3657
|
+
* @param args.path the BIP44 derive hardened path (e.g. m/44'/637'/0'/0'/0') for Ed25519,
|
|
3658
|
+
* or non-hardened path (e.g. m/44'/637'/0'/0/0) for secp256k1
|
|
3659
|
+
* Detailed description: {@link https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki}
|
|
3660
|
+
* @param args.mnemonic the mnemonic seed phrase of the account
|
|
3661
|
+
*/
|
|
3662
|
+
static fromDerivationPath(args: SingleKeySignerFromDerivationPathArgs): SingleKeyAccount;
|
|
3663
|
+
verifySignature(args: VerifySingleKeySignatureArgs): boolean;
|
|
3664
|
+
signWithAuthenticator(message: HexInput): AccountAuthenticatorSingleKey;
|
|
3665
|
+
sign(message: HexInput): AnySignature;
|
|
3666
|
+
}
|
|
3667
|
+
|
|
3668
|
+
/**
|
|
3669
|
+
* Arguments for creating an `Ed25519Account` from an `Ed25519PrivateKey`.
|
|
3670
|
+
* This is the default input type when passing an `Ed25519PrivateKey`.
|
|
3671
|
+
* In order to use the SingleKey authentication scheme, `legacy` needs to be explicitly set to false.
|
|
3672
|
+
*/
|
|
3673
|
+
interface CreateEd25519AccountFromPrivateKeyArgs {
|
|
3674
|
+
privateKey: Ed25519PrivateKey;
|
|
3675
|
+
address?: AccountAddressInput;
|
|
3676
|
+
legacy?: true;
|
|
3677
|
+
}
|
|
3678
|
+
/**
|
|
3679
|
+
* Arguments for creating an `SingleKeyAccount` from an `Ed25519PrivateKey`.
|
|
3680
|
+
* The `legacy` argument needs to be explicitly set to false in order to
|
|
3681
|
+
* use the `SingleKey` authentication scheme.
|
|
3682
|
+
*/
|
|
3683
|
+
interface CreateEd25519SingleKeyAccountFromPrivateKeyArgs {
|
|
3684
|
+
privateKey: Ed25519PrivateKey;
|
|
3685
|
+
address?: AccountAddressInput;
|
|
3686
|
+
legacy: false;
|
|
3687
|
+
}
|
|
3688
|
+
/**
|
|
3689
|
+
* Arguments for creating an `SingleKeyAccount` from any supported private key
|
|
3690
|
+
* that is not an `Ed25519PrivateKey`.
|
|
3691
|
+
* The `legacy` argument defaults to false and cannot be explicitly set to true.
|
|
3692
|
+
*/
|
|
3693
|
+
interface CreateSingleKeyAccountFromPrivateKeyArgs {
|
|
3694
|
+
privateKey: Exclude<PrivateKey, Ed25519PrivateKey>;
|
|
3695
|
+
address?: AccountAddressInput;
|
|
3696
|
+
legacy?: false;
|
|
3697
|
+
}
|
|
3698
|
+
/**
|
|
3699
|
+
* Arguments for creating an opaque `Account` from any supported private key.
|
|
3700
|
+
* This is used when the private key type is not known at compilation time.
|
|
3701
|
+
*/
|
|
3702
|
+
interface CreateAccountFromPrivateKeyArgs {
|
|
3703
|
+
privateKey: PrivateKey;
|
|
3704
|
+
address?: AccountAddressInput;
|
|
3705
|
+
legacy?: boolean;
|
|
3706
|
+
}
|
|
3707
|
+
/**
|
|
3708
|
+
* Arguments for generating an `Ed25519Account`.
|
|
3709
|
+
* This is the input type used by default.
|
|
3710
|
+
*/
|
|
3711
|
+
interface GenerateEd25519AccountArgs {
|
|
3712
|
+
scheme?: SigningSchemeInput.Ed25519;
|
|
3713
|
+
legacy?: true;
|
|
3714
|
+
}
|
|
3715
|
+
/**
|
|
3716
|
+
* Arguments for generating an `SingleKeyAccount` with ah underlying `Ed25519PrivateKey`.
|
|
3717
|
+
* The `legacy` argument needs to be explicitly set to false,
|
|
3718
|
+
* otherwise an `Ed25519Account` will be returned instead.
|
|
3719
|
+
*/
|
|
3720
|
+
interface GenerateEd25519SingleKeyAccountArgs {
|
|
3721
|
+
scheme?: SigningSchemeInput.Ed25519;
|
|
3722
|
+
legacy: false;
|
|
3723
|
+
}
|
|
3724
|
+
/**
|
|
3725
|
+
* Arguments for generating an `SingleKeyAccount` with any supported private key
|
|
3726
|
+
* that is not an `Ed25519PrivateKey`.
|
|
3727
|
+
* The `legacy` argument defaults to false and cannot be explicitly set to true.
|
|
3728
|
+
*/
|
|
3729
|
+
interface GenerateSingleKeyAccountArgs {
|
|
3730
|
+
scheme: Exclude<SigningSchemeInput, SigningSchemeInput.Ed25519>;
|
|
3731
|
+
legacy?: false;
|
|
3732
|
+
}
|
|
3733
|
+
/**
|
|
3734
|
+
* Arguments for generating an opaque `Account`.
|
|
3735
|
+
* This is used when the input signature scheme is not known at compilation time.
|
|
3736
|
+
*/
|
|
3737
|
+
interface GenerateAccountArgs {
|
|
3738
|
+
scheme?: SigningSchemeInput;
|
|
3739
|
+
legacy?: boolean;
|
|
3740
|
+
}
|
|
3741
|
+
/**
|
|
3742
|
+
* Arguments for deriving a private key from a mnemonic phrase and a BIP44 path.
|
|
3743
|
+
*/
|
|
3744
|
+
interface PrivateKeyFromDerivationPathArgs {
|
|
3745
|
+
path: string;
|
|
3746
|
+
mnemonic: string;
|
|
3747
|
+
}
|
|
3748
|
+
/**
|
|
3749
|
+
* Interface for a generic Aptos account.
|
|
3750
|
+
*
|
|
3751
|
+
* The interface is defined as abstract class to provide a single entrypoint for account generation,
|
|
3752
|
+
* either through `Account.generate()` or `Account.fromDerivationPath`.
|
|
3753
|
+
* Despite this being an abstract class, it should be treated as an interface and enforced using
|
|
3754
|
+
* the `implements` keyword.
|
|
3755
|
+
*
|
|
3756
|
+
* Note: Generating an account instance does not create the account on-chain.
|
|
3757
|
+
*/
|
|
3758
|
+
declare abstract class Account$1 {
|
|
3759
|
+
/**
|
|
3760
|
+
* Private key associated with the account.
|
|
3761
|
+
* Note: this will be removed in the next major release,
|
|
3762
|
+
* as not all accounts have a private key.
|
|
3763
|
+
*/
|
|
3764
|
+
abstract readonly privateKey: PrivateKey;
|
|
3765
|
+
/**
|
|
3766
|
+
* Public key associated with the account
|
|
3409
3767
|
*/
|
|
3410
|
-
|
|
3768
|
+
abstract readonly publicKey: AccountPublicKey;
|
|
3411
3769
|
/**
|
|
3412
|
-
*
|
|
3413
|
-
* @private
|
|
3770
|
+
* Account address associated with the account
|
|
3414
3771
|
*/
|
|
3415
|
-
|
|
3772
|
+
abstract readonly accountAddress: AccountAddress;
|
|
3416
3773
|
/**
|
|
3417
|
-
*
|
|
3418
|
-
*
|
|
3419
|
-
* @param hexInput A HexInput (string or Uint8Array)
|
|
3774
|
+
* Signing scheme used to sign transactions
|
|
3420
3775
|
*/
|
|
3421
|
-
|
|
3776
|
+
abstract signingScheme: SigningScheme;
|
|
3422
3777
|
/**
|
|
3423
|
-
*
|
|
3424
|
-
*
|
|
3425
|
-
* @
|
|
3778
|
+
* Derives an account from a randomly generated private key.
|
|
3779
|
+
* @param args.scheme The signature scheme to use, to generate the private key
|
|
3780
|
+
* @param args.legacy Whether to use a legacy authentication scheme, when applicable
|
|
3781
|
+
* @returns An account compatible with the provided signature scheme
|
|
3426
3782
|
*/
|
|
3427
|
-
|
|
3783
|
+
static generate(args?: GenerateEd25519AccountArgs): Ed25519Account;
|
|
3784
|
+
static generate(args: GenerateEd25519SingleKeyAccountArgs): SingleKeyAccount;
|
|
3785
|
+
static generate(args: GenerateSingleKeyAccountArgs): SingleKeyAccount;
|
|
3786
|
+
static generate(args: GenerateAccountArgs): Account$1;
|
|
3428
3787
|
/**
|
|
3429
|
-
*
|
|
3788
|
+
* Creates an account from the provided private key.
|
|
3430
3789
|
*
|
|
3431
|
-
* @
|
|
3790
|
+
* @param args.privateKey a valid private key
|
|
3791
|
+
* @param args.address the account's address. If not provided, it will be derived from the public key.
|
|
3792
|
+
* @param args.legacy Whether to use a legacy authentication scheme, when applicable
|
|
3432
3793
|
*/
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
static
|
|
3436
|
-
static
|
|
3437
|
-
static isSignature(signature: Signature): signature is Secp256k1Signature;
|
|
3438
|
-
}
|
|
3439
|
-
|
|
3440
|
-
declare class AnySignature extends Signature {
|
|
3441
|
-
readonly signature: Signature;
|
|
3442
|
-
constructor(signature: Signature);
|
|
3794
|
+
static fromPrivateKey(args: CreateEd25519AccountFromPrivateKeyArgs): Ed25519Account;
|
|
3795
|
+
static fromPrivateKey(args: CreateEd25519SingleKeyAccountFromPrivateKeyArgs): SingleKeyAccount;
|
|
3796
|
+
static fromPrivateKey(args: CreateSingleKeyAccountFromPrivateKeyArgs): SingleKeyAccount;
|
|
3797
|
+
static fromPrivateKey(args: CreateAccountFromPrivateKeyArgs): Account$1;
|
|
3443
3798
|
/**
|
|
3444
|
-
*
|
|
3799
|
+
* @deprecated use `fromPrivateKey` instead.
|
|
3800
|
+
* Instantiates an account given a private key and a specified account address.
|
|
3801
|
+
* This is primarily used to instantiate an `Account` that has had its authentication key rotated.
|
|
3445
3802
|
*
|
|
3446
|
-
* @
|
|
3803
|
+
* @param args.privateKey PrivateKey - the underlying private key for the account
|
|
3804
|
+
* @param args.address AccountAddress - The account address the `Account` will sign for
|
|
3805
|
+
* @param args.legacy optional. If set to false, the keypair generated is a Unified keypair. Defaults
|
|
3806
|
+
* to generating a Legacy Ed25519 keypair
|
|
3807
|
+
*
|
|
3808
|
+
* @returns Account
|
|
3447
3809
|
*/
|
|
3448
|
-
|
|
3810
|
+
static fromPrivateKeyAndAddress(args: CreateAccountFromPrivateKeyArgs): Account$1;
|
|
3449
3811
|
/**
|
|
3450
|
-
*
|
|
3812
|
+
* Derives an account with bip44 path and mnemonics
|
|
3451
3813
|
*
|
|
3452
|
-
* @
|
|
3814
|
+
* @param args.scheme The signature scheme to derive the private key with
|
|
3815
|
+
* @param args.path the BIP44 derive hardened path (e.g. m/44'/637'/0'/0'/0') for Ed25519,
|
|
3816
|
+
* or non-hardened path (e.g. m/44'/637'/0'/0/0) for secp256k1
|
|
3817
|
+
* Detailed description: {@link https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki}
|
|
3818
|
+
* @param args.mnemonic the mnemonic seed phrase of the account
|
|
3453
3819
|
*/
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
static
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
/**
|
|
3460
|
-
* Represents any public key supported by Aptos.
|
|
3461
|
-
*
|
|
3462
|
-
* Since [AIP-55](https://github.com/aptos-foundation/AIPs/pull/263) Aptos supports
|
|
3463
|
-
* `Legacy` and `Unified` authentication keys.
|
|
3464
|
-
*
|
|
3465
|
-
* Any unified authentication key is represented in the SDK as `AnyPublicKey`.
|
|
3466
|
-
*/
|
|
3467
|
-
declare class AnyPublicKey extends PublicKey {
|
|
3820
|
+
static fromDerivationPath(args: GenerateEd25519AccountArgs & PrivateKeyFromDerivationPathArgs): Ed25519Account;
|
|
3821
|
+
static fromDerivationPath(args: GenerateEd25519SingleKeyAccountArgs & PrivateKeyFromDerivationPathArgs): SingleKeyAccount;
|
|
3822
|
+
static fromDerivationPath(args: GenerateSingleKeyAccountArgs & PrivateKeyFromDerivationPathArgs): SingleKeyAccount;
|
|
3823
|
+
static fromDerivationPath(args: GenerateAccountArgs & PrivateKeyFromDerivationPathArgs): Account$1;
|
|
3468
3824
|
/**
|
|
3469
|
-
*
|
|
3825
|
+
* @deprecated use `publicKey.authKey()` instead.
|
|
3826
|
+
* This key enables account owners to rotate their private key(s)
|
|
3827
|
+
* associated with the account without changing the address that hosts their account.
|
|
3828
|
+
* See here for more info: {@link https://aptos.dev/concepts/accounts#single-signer-authentication}
|
|
3829
|
+
*
|
|
3830
|
+
* @param args.publicKey PublicKey - public key of the account
|
|
3831
|
+
* @returns The authentication key for the associated account
|
|
3470
3832
|
*/
|
|
3471
|
-
|
|
3472
|
-
|
|
3833
|
+
static authKey(args: {
|
|
3834
|
+
publicKey: AccountPublicKey;
|
|
3835
|
+
}): AuthenticationKey;
|
|
3473
3836
|
/**
|
|
3474
|
-
*
|
|
3475
|
-
*
|
|
3476
|
-
* @
|
|
3837
|
+
* Sign a message using the available signing capabilities.
|
|
3838
|
+
* @param message the signing message, as binary input
|
|
3839
|
+
* @return the AccountAuthenticator containing the signature, together with the account's public key
|
|
3477
3840
|
*/
|
|
3478
|
-
|
|
3841
|
+
abstract signWithAuthenticator(message: HexInput): AccountAuthenticator;
|
|
3479
3842
|
/**
|
|
3480
|
-
*
|
|
3481
|
-
*
|
|
3482
|
-
* @returns
|
|
3843
|
+
* Sign the given message with the private key.
|
|
3844
|
+
* @param message in HexInput format
|
|
3845
|
+
* @returns AccountSignature
|
|
3483
3846
|
*/
|
|
3484
|
-
|
|
3847
|
+
abstract sign(message: HexInput): Signature;
|
|
3485
3848
|
/**
|
|
3486
|
-
*
|
|
3487
|
-
*
|
|
3488
|
-
* @param args.message message
|
|
3489
|
-
* @param args.signature The signature
|
|
3490
|
-
* @returns true if the signature is valid
|
|
3849
|
+
* @param args.message raw message data in HexInput format
|
|
3850
|
+
* @param args.signature signed message signature
|
|
3491
3851
|
*/
|
|
3492
|
-
verifySignature(args:
|
|
3493
|
-
message: HexInput;
|
|
3494
|
-
signature: AnySignature;
|
|
3495
|
-
}): boolean;
|
|
3496
|
-
serialize(serializer: Serializer): void;
|
|
3497
|
-
static deserialize(deserializer: Deserializer): AnyPublicKey;
|
|
3498
|
-
static isPublicKey(publicKey: PublicKey): publicKey is AnyPublicKey;
|
|
3499
|
-
isEd25519(): this is Ed25519PublicKey;
|
|
3500
|
-
isSecp256k1PublicKey(): this is Secp256k1PublicKey;
|
|
3852
|
+
verifySignature(args: VerifySignatureArgs): boolean;
|
|
3501
3853
|
}
|
|
3502
3854
|
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3855
|
+
interface Ed25519SignerConstructorArgs {
|
|
3856
|
+
privateKey: Ed25519PrivateKey;
|
|
3857
|
+
address?: AccountAddressInput;
|
|
3858
|
+
}
|
|
3859
|
+
interface Ed25519SignerFromDerivationPathArgs {
|
|
3860
|
+
path: string;
|
|
3861
|
+
mnemonic: string;
|
|
3862
|
+
}
|
|
3863
|
+
interface VerifyEd25519SignatureArgs {
|
|
3864
|
+
message: HexInput;
|
|
3865
|
+
signature: Ed25519Signature;
|
|
3866
|
+
}
|
|
3867
|
+
/**
|
|
3868
|
+
* Signer implementation for the Ed25519 authentication scheme.
|
|
3869
|
+
* This extends an {@link Ed25519Account} by adding signing capabilities through an {@link Ed25519PrivateKey}.
|
|
3870
|
+
*
|
|
3871
|
+
* Note: Generating a signer instance does not create the account on-chain.
|
|
3872
|
+
*/
|
|
3873
|
+
declare class Ed25519Account implements Account$1 {
|
|
3508
3874
|
/**
|
|
3509
|
-
*
|
|
3875
|
+
* Private key associated with the account
|
|
3510
3876
|
*/
|
|
3511
|
-
readonly
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
toUint8Array(): Uint8Array;
|
|
3877
|
+
readonly privateKey: Ed25519PrivateKey;
|
|
3878
|
+
readonly publicKey: Ed25519PublicKey;
|
|
3879
|
+
readonly accountAddress: AccountAddress;
|
|
3880
|
+
readonly signingScheme = SigningScheme.Ed25519;
|
|
3881
|
+
constructor(args: Ed25519SignerConstructorArgs);
|
|
3517
3882
|
/**
|
|
3518
|
-
*
|
|
3519
|
-
* to the signatures passed in
|
|
3520
|
-
*
|
|
3521
|
-
* @param args.bits array of the index mapping to the matching public keys
|
|
3522
|
-
* @returns Uint8array bit map
|
|
3883
|
+
* Derives a signer from a randomly generated private key
|
|
3523
3884
|
*/
|
|
3524
|
-
|
|
3525
|
-
bits: number[];
|
|
3526
|
-
}): Uint8Array;
|
|
3885
|
+
static generate(): Ed25519Account;
|
|
3527
3886
|
/**
|
|
3528
|
-
*
|
|
3887
|
+
* Derives an account with bip44 path and mnemonics
|
|
3529
3888
|
*
|
|
3530
|
-
* @
|
|
3889
|
+
* @param args.path the BIP44 derive hardened path e.g. m/44'/637'/0'/0'/0'
|
|
3890
|
+
* Detailed description: {@link https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki}
|
|
3891
|
+
* @param args.mnemonic the mnemonic seed phrase of the account
|
|
3531
3892
|
*/
|
|
3532
|
-
|
|
3533
|
-
verifySignature(args:
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
}): boolean;
|
|
3537
|
-
serialize(serializer: Serializer): void;
|
|
3538
|
-
static deserialize(deserializer: Deserializer): MultiKey;
|
|
3539
|
-
}
|
|
3540
|
-
|
|
3541
|
-
type DerivedKeys = {
|
|
3542
|
-
key: Uint8Array;
|
|
3543
|
-
chainCode: Uint8Array;
|
|
3544
|
-
};
|
|
3545
|
-
/**
|
|
3546
|
-
* Aptos derive path is 637
|
|
3547
|
-
*/
|
|
3548
|
-
declare const APTOS_HARDENED_REGEX: RegExp;
|
|
3549
|
-
declare const APTOS_BIP44_REGEX: RegExp;
|
|
3550
|
-
/**
|
|
3551
|
-
* A list of supported key types and associated seeds
|
|
3552
|
-
*/
|
|
3553
|
-
declare enum KeyType {
|
|
3554
|
-
ED25519 = "ed25519 seed"
|
|
3893
|
+
static fromDerivationPath(args: Ed25519SignerFromDerivationPathArgs): Ed25519Account;
|
|
3894
|
+
verifySignature(args: VerifyEd25519SignatureArgs): boolean;
|
|
3895
|
+
signWithAuthenticator(message: HexInput): AccountAuthenticatorEd25519;
|
|
3896
|
+
sign(message: HexInput): Ed25519Signature;
|
|
3555
3897
|
}
|
|
3556
|
-
declare const HARDENED_OFFSET = 2147483648;
|
|
3557
|
-
/**
|
|
3558
|
-
* Aptos derive path is 637
|
|
3559
|
-
*
|
|
3560
|
-
* Parse and validate a path that is compliant to BIP-44 in form m/44'/637'/{account_index}'/{change_index}/{address_index}
|
|
3561
|
-
* for Secp256k1
|
|
3562
|
-
*
|
|
3563
|
-
* Note that for secp256k1, last two components must be non-hardened.
|
|
3564
|
-
*
|
|
3565
|
-
* @param path path string (e.g. `m/44'/637'/0'/0/0`).
|
|
3566
|
-
*/
|
|
3567
|
-
declare function isValidBIP44Path(path: string): boolean;
|
|
3568
|
-
/**
|
|
3569
|
-
* Aptos derive path is 637
|
|
3570
|
-
*
|
|
3571
|
-
* Parse and validate a path that is compliant to SLIP-0010 and BIP-44
|
|
3572
|
-
* in form m/44'/637'/{account_index}'/{change_index}'/{address_index}'.
|
|
3573
|
-
* See SLIP-0010 {@link https://github.com/satoshilabs/slips/blob/master/slip-0044.md}
|
|
3574
|
-
* See BIP-44 {@link https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki}
|
|
3575
|
-
*
|
|
3576
|
-
* Note that for Ed25519, all components must be hardened.
|
|
3577
|
-
* This is because non-hardened [PK] derivation would not work due to Ed25519's lack of a key homomorphism.
|
|
3578
|
-
* Specifically, you cannot derive the PK associated with derivation path a/b/c given the PK of a/b.
|
|
3579
|
-
* This is because the PK in Ed25519 is, more or less, computed as 𝑔𝐻(𝑠𝑘),
|
|
3580
|
-
* with the hash function breaking the homomorphism.
|
|
3581
|
-
*
|
|
3582
|
-
* @param path path string (e.g. `m/44'/637'/0'/0'/0'`).
|
|
3583
|
-
*/
|
|
3584
|
-
declare function isValidHardenedPath(path: string): boolean;
|
|
3585
|
-
declare const deriveKey: (hashSeed: Uint8Array | string, data: Uint8Array | string) => DerivedKeys;
|
|
3586
|
-
/**
|
|
3587
|
-
* Derive a child key from the private key
|
|
3588
|
-
* @param key
|
|
3589
|
-
* @param chainCode
|
|
3590
|
-
* @param index
|
|
3591
|
-
* @constructor
|
|
3592
|
-
*/
|
|
3593
|
-
declare const CKDPriv: ({ key, chainCode }: DerivedKeys, index: number) => DerivedKeys;
|
|
3594
|
-
/**
|
|
3595
|
-
* Splits derive path into segments
|
|
3596
|
-
* @param path
|
|
3597
|
-
*/
|
|
3598
|
-
declare const splitPath: (path: string) => Array<string>;
|
|
3599
|
-
/**
|
|
3600
|
-
* Normalizes the mnemonic by removing extra whitespace and making it lowercase
|
|
3601
|
-
* @param mnemonic the mnemonic seed phrase
|
|
3602
|
-
*/
|
|
3603
|
-
declare const mnemonicToSeed: (mnemonic: string) => Uint8Array;
|
|
3604
3898
|
|
|
3605
3899
|
/**
|
|
3606
3900
|
* Type of API endpoint for request routing
|
|
@@ -3610,7 +3904,6 @@ declare enum AptosApiType {
|
|
|
3610
3904
|
INDEXER = 1,
|
|
3611
3905
|
FAUCET = 2
|
|
3612
3906
|
}
|
|
3613
|
-
declare const DEFAULT_NETWORK = Network.DEVNET;
|
|
3614
3907
|
/**
|
|
3615
3908
|
* The default max gas amount when none is given.
|
|
3616
3909
|
*
|
|
@@ -4467,72 +4760,6 @@ declare class RotationProofChallenge extends Serializable {
|
|
|
4467
4760
|
serialize(serializer: Serializer): void;
|
|
4468
4761
|
}
|
|
4469
4762
|
|
|
4470
|
-
declare abstract class AccountAuthenticator extends Serializable {
|
|
4471
|
-
abstract serialize(serializer: Serializer): void;
|
|
4472
|
-
static deserialize(deserializer: Deserializer): AccountAuthenticator;
|
|
4473
|
-
isEd25519(): this is AccountAuthenticatorEd25519;
|
|
4474
|
-
isMultiEd25519(): this is AccountAuthenticatorMultiEd25519;
|
|
4475
|
-
isSingleKey(): this is AccountAuthenticatorSingleKey;
|
|
4476
|
-
isMultiKey(): this is AccountAuthenticatorMultiKey;
|
|
4477
|
-
}
|
|
4478
|
-
/**
|
|
4479
|
-
* Transaction authenticator Ed25519 for a multi signer transaction
|
|
4480
|
-
*
|
|
4481
|
-
* @param public_key Account's Ed25519 public key.
|
|
4482
|
-
* @param signature Account's Ed25519 signature
|
|
4483
|
-
*
|
|
4484
|
-
*/
|
|
4485
|
-
declare class AccountAuthenticatorEd25519 extends AccountAuthenticator {
|
|
4486
|
-
readonly public_key: Ed25519PublicKey;
|
|
4487
|
-
readonly signature: Ed25519Signature;
|
|
4488
|
-
constructor(public_key: Ed25519PublicKey, signature: Ed25519Signature);
|
|
4489
|
-
serialize(serializer: Serializer): void;
|
|
4490
|
-
static load(deserializer: Deserializer): AccountAuthenticatorEd25519;
|
|
4491
|
-
}
|
|
4492
|
-
/**
|
|
4493
|
-
* Transaction authenticator Multi Ed25519 for a multi signers transaction
|
|
4494
|
-
*
|
|
4495
|
-
* @param public_key Account's MultiEd25519 public key.
|
|
4496
|
-
* @param signature Account's MultiEd25519 signature
|
|
4497
|
-
*
|
|
4498
|
-
*/
|
|
4499
|
-
declare class AccountAuthenticatorMultiEd25519 extends AccountAuthenticator {
|
|
4500
|
-
readonly public_key: MultiEd25519PublicKey;
|
|
4501
|
-
readonly signature: MultiEd25519Signature;
|
|
4502
|
-
constructor(public_key: MultiEd25519PublicKey, signature: MultiEd25519Signature);
|
|
4503
|
-
serialize(serializer: Serializer): void;
|
|
4504
|
-
static load(deserializer: Deserializer): AccountAuthenticatorMultiEd25519;
|
|
4505
|
-
}
|
|
4506
|
-
/**
|
|
4507
|
-
* AccountAuthenticatorSingleKey for a single signer
|
|
4508
|
-
*
|
|
4509
|
-
* @param public_key AnyPublicKey
|
|
4510
|
-
* @param signature AnySignature
|
|
4511
|
-
*
|
|
4512
|
-
*/
|
|
4513
|
-
declare class AccountAuthenticatorSingleKey extends AccountAuthenticator {
|
|
4514
|
-
readonly public_key: AnyPublicKey;
|
|
4515
|
-
readonly signature: AnySignature;
|
|
4516
|
-
constructor(public_key: AnyPublicKey, signature: AnySignature);
|
|
4517
|
-
serialize(serializer: Serializer): void;
|
|
4518
|
-
static load(deserializer: Deserializer): AccountAuthenticatorSingleKey;
|
|
4519
|
-
}
|
|
4520
|
-
/**
|
|
4521
|
-
* AccountAuthenticatorMultiKey for a multi signer
|
|
4522
|
-
*
|
|
4523
|
-
* @param public_keys MultiKey
|
|
4524
|
-
* @param signatures Signature
|
|
4525
|
-
*
|
|
4526
|
-
*/
|
|
4527
|
-
declare class AccountAuthenticatorMultiKey extends AccountAuthenticator {
|
|
4528
|
-
readonly public_keys: MultiKey;
|
|
4529
|
-
readonly signatures: Array<AnySignature>;
|
|
4530
|
-
readonly signatures_bitmap: Uint8Array;
|
|
4531
|
-
constructor(public_keys: MultiKey, signatures: Array<AnySignature>, signatures_bitmap: Uint8Array);
|
|
4532
|
-
serialize(serializer: Serializer): void;
|
|
4533
|
-
static load(deserializer: Deserializer): AccountAuthenticatorMultiKey;
|
|
4534
|
-
}
|
|
4535
|
-
|
|
4536
4763
|
declare abstract class TransactionAuthenticator extends Serializable {
|
|
4537
4764
|
abstract serialize(serializer: Serializer): void;
|
|
4538
4765
|
static deserialize(deserializer: Deserializer): TransactionAuthenticator;
|
|
@@ -4915,6 +5142,17 @@ declare class DigitalAsset {
|
|
|
4915
5142
|
minimumLedgerVersion?: AnyNumber;
|
|
4916
5143
|
options?: TokenStandardArg;
|
|
4917
5144
|
}): Promise<GetCollectionDataResponse>;
|
|
5145
|
+
/**
|
|
5146
|
+
* Queries data of a specific collection by the collection ID.
|
|
5147
|
+
*
|
|
5148
|
+
* @param args.collectionId the ID of the collection, it's the same thing as the address of the collection object
|
|
5149
|
+
* @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying
|
|
5150
|
+
* @returns GetCollectionDataResponse response type
|
|
5151
|
+
*/
|
|
5152
|
+
getCollectionDataByCollectionId(args: {
|
|
5153
|
+
collectionId: AccountAddressInput;
|
|
5154
|
+
minimumLedgerVersion?: AnyNumber;
|
|
5155
|
+
}): Promise<GetCollectionDataResponse>;
|
|
4918
5156
|
/**
|
|
4919
5157
|
* Queries a collection's ID.
|
|
4920
5158
|
*
|
|
@@ -5282,6 +5520,19 @@ declare class DigitalAsset {
|
|
|
5282
5520
|
declare class Event {
|
|
5283
5521
|
readonly config: AptosConfig;
|
|
5284
5522
|
constructor(config: AptosConfig);
|
|
5523
|
+
/**
|
|
5524
|
+
* Get module events by event type
|
|
5525
|
+
*
|
|
5526
|
+
* @param args.eventType - The event type
|
|
5527
|
+
* @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying
|
|
5528
|
+
*
|
|
5529
|
+
* @returns Promise<GetEventsResponse>
|
|
5530
|
+
*/
|
|
5531
|
+
getModuleEventsByEventType(args: {
|
|
5532
|
+
eventType: MoveStructId;
|
|
5533
|
+
minimumLedgerVersion?: AnyNumber;
|
|
5534
|
+
options?: PaginationArgs & OrderByArg<GetEventsResponse[0]>;
|
|
5535
|
+
}): Promise<GetEventsResponse>;
|
|
5285
5536
|
/**
|
|
5286
5537
|
* Get events by creation number and an account address
|
|
5287
5538
|
*
|
|
@@ -6885,4 +7136,4 @@ declare function postAptosFullNode<Req extends {}, Res extends {}>(options: Post
|
|
|
6885
7136
|
declare function postAptosIndexer<Req extends {}, Res extends {}>(options: PostAptosRequestOptions): Promise<AptosResponse<Req, Res>>;
|
|
6886
7137
|
declare function postAptosFaucet<Req extends {}, Res extends {}>(options: PostAptosRequestOptions): Promise<AptosResponse<Req, Res>>;
|
|
6887
7138
|
|
|
6888
|
-
export { APTOS_BIP44_REGEX, APTOS_COIN, APTOS_HARDENED_REGEX, Account$1 as Account, AccountAddress, type AccountAddressInput, AccountAuthenticator, AccountAuthenticatorEd25519, AccountAuthenticatorMultiEd25519, AccountAuthenticatorMultiKey, AccountAuthenticatorSingleKey, AccountAuthenticatorVariant, type AccountData, 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, AuthenticationKey, type AuthenticationKeyScheme, type Block, type BlockMetadataTransactionResponse, Bool, CKDPriv, ChainId, type Client, type ClientConfig, type ClientRequest, type ClientResponse, type CommittedTransactionResponse,
|
|
7139
|
+
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, 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, 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 };
|