@aptos-labs/ts-sdk 0.0.3 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/{cjs → browser}/index.d.ts +431 -237
- package/dist/browser/index.global.js +44 -42
- package/dist/browser/index.global.js.map +1 -1
- package/dist/common/index.d.ts +5831 -0
- package/dist/common/index.js +406 -0
- package/dist/common/index.js.map +1 -0
- package/dist/esm/api/account.d.ts +292 -0
- package/dist/esm/api/account.mjs +2 -0
- package/dist/esm/api/account.mjs.map +1 -0
- package/dist/esm/api/ans.d.ts +79 -0
- package/dist/esm/api/ans.mjs +2 -0
- package/dist/esm/api/ans.mjs.map +1 -0
- package/dist/esm/api/aptos.d.ts +72 -0
- package/dist/esm/api/aptos.mjs +2 -0
- package/dist/esm/api/aptos.mjs.map +1 -0
- package/dist/esm/api/aptosConfig.d.ts +51 -0
- package/dist/esm/api/aptosConfig.mjs +2 -0
- package/dist/esm/api/aptosConfig.mjs.map +1 -0
- package/dist/esm/api/coin.d.ts +59 -0
- package/dist/esm/api/coin.mjs +2 -0
- package/dist/esm/api/coin.mjs.map +1 -0
- package/dist/esm/api/digitalAsset.d.ts +174 -0
- package/dist/esm/api/digitalAsset.mjs +2 -0
- package/dist/esm/api/digitalAsset.mjs.map +1 -0
- package/dist/esm/api/event.d.ts +74 -0
- package/dist/esm/api/event.mjs +2 -0
- package/dist/esm/api/event.mjs.map +1 -0
- package/dist/esm/api/faucet.d.ts +37 -0
- package/dist/esm/api/faucet.mjs +2 -0
- package/dist/esm/api/faucet.mjs.map +1 -0
- package/dist/esm/api/fungibleAsset.d.ts +72 -0
- package/dist/esm/api/fungibleAsset.mjs +2 -0
- package/dist/esm/api/fungibleAsset.mjs.map +1 -0
- package/dist/esm/api/general.d.ts +150 -0
- package/dist/esm/api/general.mjs +2 -0
- package/dist/esm/api/general.mjs.map +1 -0
- package/dist/esm/api/index.d.ts +46 -0
- package/dist/esm/api/index.mjs +2 -0
- package/dist/esm/api/index.mjs.map +1 -0
- package/dist/esm/api/staking.d.ts +53 -0
- package/dist/esm/api/staking.mjs +2 -0
- package/dist/esm/api/staking.mjs.map +1 -0
- package/dist/esm/api/transaction.d.ts +101 -0
- package/dist/esm/api/transaction.mjs +2 -0
- package/dist/esm/api/transaction.mjs.map +1 -0
- package/dist/esm/api/transactionSubmission.d.ts +142 -0
- package/dist/esm/api/transactionSubmission.mjs +2 -0
- package/dist/esm/api/transactionSubmission.mjs.map +1 -0
- package/dist/esm/bcs/consts.d.ts +14 -0
- package/dist/esm/bcs/consts.mjs +2 -0
- package/dist/esm/bcs/consts.mjs.map +1 -0
- package/dist/esm/bcs/deserializer.d.ts +150 -0
- package/dist/esm/bcs/deserializer.mjs +2 -0
- package/dist/esm/bcs/deserializer.mjs.map +1 -0
- package/dist/esm/bcs/index.d.ts +14 -0
- package/dist/esm/bcs/index.mjs +2 -0
- package/dist/esm/bcs/index.mjs.map +1 -0
- package/dist/esm/bcs/serializable/entryFunctionBytes.d.ts +40 -0
- package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +2 -0
- package/dist/esm/bcs/serializable/entryFunctionBytes.mjs.map +1 -0
- package/dist/esm/bcs/serializable/fixedBytes.d.ts +52 -0
- package/dist/esm/bcs/serializable/fixedBytes.mjs +2 -0
- package/dist/esm/bcs/serializable/fixedBytes.mjs.map +1 -0
- package/dist/esm/bcs/serializable/movePrimitives.d.ts +69 -0
- package/dist/esm/bcs/serializable/movePrimitives.mjs +2 -0
- package/dist/esm/bcs/serializable/movePrimitives.mjs.map +1 -0
- package/dist/esm/bcs/serializable/moveStructs.d.ts +284 -0
- package/dist/esm/bcs/serializable/moveStructs.mjs +2 -0
- package/dist/esm/bcs/serializable/moveStructs.mjs.map +1 -0
- package/dist/esm/bcs/serializer.d.ts +192 -0
- package/dist/esm/bcs/serializer.mjs +2 -0
- package/dist/esm/bcs/serializer.mjs.map +1 -0
- package/dist/esm/chunk-2444YR3Y.mjs +2 -0
- package/dist/esm/chunk-2444YR3Y.mjs.map +1 -0
- package/dist/esm/chunk-27P7PELS.mjs +2 -0
- package/dist/esm/chunk-27P7PELS.mjs.map +1 -0
- package/dist/esm/chunk-2B5QXKPU.mjs +2 -0
- package/dist/esm/chunk-2B5QXKPU.mjs.map +1 -0
- package/dist/esm/chunk-2MQZUGO6.mjs +2 -0
- package/dist/esm/chunk-2MQZUGO6.mjs.map +1 -0
- package/dist/esm/chunk-3JPVQHOR.mjs +2 -0
- package/dist/esm/chunk-3JPVQHOR.mjs.map +1 -0
- package/dist/esm/chunk-3OJN4I42.mjs +2 -0
- package/dist/esm/chunk-3OJN4I42.mjs.map +1 -0
- package/dist/esm/chunk-3YOV42H5.mjs +2 -0
- package/dist/esm/chunk-3YOV42H5.mjs.map +1 -0
- package/dist/esm/chunk-4WPQQPUF.mjs +1 -0
- package/dist/esm/chunk-4WPQQPUF.mjs.map +1 -0
- package/dist/esm/chunk-6FBKUTGF.mjs +2 -0
- package/dist/esm/chunk-6FBKUTGF.mjs.map +1 -0
- package/dist/esm/chunk-7AIV5FEN.mjs +2 -0
- package/dist/esm/chunk-7AIV5FEN.mjs.map +1 -0
- package/dist/esm/chunk-7AQXAH6Q.mjs +2 -0
- package/dist/esm/chunk-7AQXAH6Q.mjs.map +1 -0
- package/dist/esm/chunk-7TL2MY2B.mjs +2 -0
- package/dist/esm/chunk-7TL2MY2B.mjs.map +1 -0
- package/dist/esm/chunk-ADR4XQPR.mjs +2 -0
- package/dist/esm/chunk-ADR4XQPR.mjs.map +1 -0
- package/dist/esm/chunk-AH44UPM4.mjs +2 -0
- package/dist/esm/chunk-AH44UPM4.mjs.map +1 -0
- package/dist/esm/chunk-AY2HWVDO.mjs +2 -0
- package/dist/esm/chunk-AY2HWVDO.mjs.map +1 -0
- package/dist/esm/chunk-BC2NOUYT.mjs +2 -0
- package/dist/esm/chunk-BC2NOUYT.mjs.map +1 -0
- package/dist/esm/chunk-BIUGRAMO.mjs +2 -0
- package/dist/esm/chunk-BIUGRAMO.mjs.map +1 -0
- package/dist/esm/chunk-BREUBEPM.mjs +2 -0
- package/dist/esm/chunk-BREUBEPM.mjs.map +1 -0
- package/dist/esm/chunk-BSCOVLWS.mjs +1 -0
- package/dist/esm/chunk-BSCOVLWS.mjs.map +1 -0
- package/dist/esm/chunk-BTK34A5U.mjs +406 -0
- package/dist/esm/chunk-BTK34A5U.mjs.map +1 -0
- package/dist/esm/chunk-CZZJAR3B.mjs +2 -0
- package/dist/esm/chunk-CZZJAR3B.mjs.map +1 -0
- package/dist/esm/chunk-DNDWTM7A.mjs +2 -0
- package/dist/esm/chunk-DNDWTM7A.mjs.map +1 -0
- package/dist/esm/chunk-DNYVUM3K.mjs +2 -0
- package/dist/esm/chunk-DNYVUM3K.mjs.map +1 -0
- package/dist/esm/chunk-DXUIJ6KA.mjs +2 -0
- package/dist/esm/chunk-DXUIJ6KA.mjs.map +1 -0
- package/dist/esm/chunk-E72CFUU4.mjs +2 -0
- package/dist/esm/chunk-E72CFUU4.mjs.map +1 -0
- package/dist/esm/chunk-E7FWVXGX.mjs +1 -0
- package/dist/esm/chunk-E7FWVXGX.mjs.map +1 -0
- package/dist/esm/chunk-EKAOAGNQ.mjs +2 -0
- package/dist/esm/chunk-EKAOAGNQ.mjs.map +1 -0
- package/dist/esm/chunk-FBPNHF54.mjs +2 -0
- package/dist/esm/chunk-FBPNHF54.mjs.map +1 -0
- package/dist/esm/chunk-FHJ7F7Z6.mjs +2 -0
- package/dist/esm/chunk-FHJ7F7Z6.mjs.map +1 -0
- package/dist/esm/chunk-FNB6CFQR.mjs +2 -0
- package/dist/esm/chunk-FNB6CFQR.mjs.map +1 -0
- package/dist/esm/chunk-FYIFBLHU.mjs +2 -0
- package/dist/esm/chunk-FYIFBLHU.mjs.map +1 -0
- package/dist/esm/chunk-FZY4PMEE.mjs +1 -0
- package/dist/esm/chunk-FZY4PMEE.mjs.map +1 -0
- package/dist/esm/chunk-GUT3G5CG.mjs +2 -0
- package/dist/esm/chunk-GUT3G5CG.mjs.map +1 -0
- package/dist/esm/chunk-HH5RSP2H.mjs +2 -0
- package/dist/esm/chunk-HH5RSP2H.mjs.map +1 -0
- package/dist/esm/chunk-HTZTTZQJ.mjs +1 -0
- package/dist/esm/chunk-HTZTTZQJ.mjs.map +1 -0
- package/dist/esm/chunk-I5OYNCZS.mjs +1 -0
- package/dist/esm/chunk-I5OYNCZS.mjs.map +1 -0
- package/dist/esm/chunk-IPJKGHQY.mjs +2 -0
- package/dist/esm/chunk-IPJKGHQY.mjs.map +1 -0
- package/dist/esm/chunk-IXMH6AXJ.mjs +2 -0
- package/dist/esm/chunk-IXMH6AXJ.mjs.map +1 -0
- package/dist/esm/chunk-IZHPCZE3.mjs +2 -0
- package/dist/esm/chunk-IZHPCZE3.mjs.map +1 -0
- package/dist/esm/chunk-J3QOSJFP.mjs +2 -0
- package/dist/esm/chunk-J3QOSJFP.mjs.map +1 -0
- package/dist/esm/chunk-J5OKXARS.mjs +2 -0
- package/dist/esm/chunk-J5OKXARS.mjs.map +1 -0
- package/dist/esm/chunk-JTGGMXB7.mjs +2 -0
- package/dist/esm/chunk-JTGGMXB7.mjs.map +1 -0
- package/dist/esm/chunk-KC64ESLO.mjs +2 -0
- package/dist/esm/chunk-KC64ESLO.mjs.map +1 -0
- package/dist/esm/chunk-KFP7MDSD.mjs +2 -0
- package/dist/esm/chunk-KFP7MDSD.mjs.map +1 -0
- package/dist/esm/chunk-KJDY66XF.mjs +2 -0
- package/dist/esm/chunk-KJDY66XF.mjs.map +1 -0
- package/dist/esm/chunk-KNLMUSIO.mjs +2 -0
- package/dist/esm/chunk-KNLMUSIO.mjs.map +1 -0
- package/dist/esm/chunk-KPESAXVI.mjs +2 -0
- package/dist/esm/chunk-KPESAXVI.mjs.map +1 -0
- package/dist/esm/chunk-KWJ6XKNF.mjs +2 -0
- package/dist/esm/chunk-KWJ6XKNF.mjs.map +1 -0
- package/dist/esm/chunk-KYWYIK5P.mjs +2 -0
- package/dist/esm/chunk-KYWYIK5P.mjs.map +1 -0
- package/dist/esm/chunk-LAXIJRYU.mjs +2 -0
- package/dist/esm/chunk-LAXIJRYU.mjs.map +1 -0
- package/dist/esm/chunk-LR65XHSF.mjs +2 -0
- package/dist/esm/chunk-LR65XHSF.mjs.map +1 -0
- package/dist/esm/chunk-LU6VS7PJ.mjs +2 -0
- package/dist/esm/chunk-LU6VS7PJ.mjs.map +1 -0
- package/dist/esm/chunk-LV33NV4J.mjs +2 -0
- package/dist/esm/chunk-LV33NV4J.mjs.map +1 -0
- package/dist/esm/chunk-MIBLZSNS.mjs +2 -0
- package/dist/esm/chunk-MIBLZSNS.mjs.map +1 -0
- package/dist/esm/chunk-N2FKVZ4D.mjs +1 -0
- package/dist/esm/chunk-N2FKVZ4D.mjs.map +1 -0
- package/dist/esm/chunk-N6XWY4UT.mjs +2 -0
- package/dist/esm/chunk-N6XWY4UT.mjs.map +1 -0
- package/dist/esm/chunk-NKTKHC3Z.mjs +2 -0
- package/dist/esm/chunk-NKTKHC3Z.mjs.map +1 -0
- package/dist/esm/chunk-O243HOP3.mjs +2 -0
- package/dist/esm/chunk-O243HOP3.mjs.map +1 -0
- package/dist/esm/chunk-PDLUCVJB.mjs +2 -0
- package/dist/esm/chunk-PDLUCVJB.mjs.map +1 -0
- package/dist/esm/chunk-PJDVHU7X.mjs +2 -0
- package/dist/esm/chunk-PJDVHU7X.mjs.map +1 -0
- package/dist/esm/chunk-R7G3CLRI.mjs +1 -0
- package/dist/esm/chunk-R7G3CLRI.mjs.map +1 -0
- package/dist/esm/chunk-RMMOF53Q.mjs +1 -0
- package/dist/esm/chunk-RMMOF53Q.mjs.map +1 -0
- package/dist/esm/chunk-SJLO3JIH.mjs +2 -0
- package/dist/esm/chunk-SJLO3JIH.mjs.map +1 -0
- package/dist/esm/chunk-TCTZCPQ6.mjs +1 -0
- package/dist/esm/chunk-TCTZCPQ6.mjs.map +1 -0
- package/dist/esm/chunk-TXUMB5ZO.mjs +2 -0
- package/dist/esm/chunk-TXUMB5ZO.mjs.map +1 -0
- package/dist/esm/chunk-TYHBYRUA.mjs +2 -0
- package/dist/esm/chunk-TYHBYRUA.mjs.map +1 -0
- package/dist/esm/chunk-UQIOMAXE.mjs +2 -0
- package/dist/esm/chunk-UQIOMAXE.mjs.map +1 -0
- package/dist/esm/chunk-UVGCVCNG.mjs +2 -0
- package/dist/esm/chunk-UVGCVCNG.mjs.map +1 -0
- package/dist/esm/chunk-UYVPNUH3.mjs +1 -0
- package/dist/esm/chunk-UYVPNUH3.mjs.map +1 -0
- package/dist/esm/chunk-V3MBJJTL.mjs +1 -0
- package/dist/esm/chunk-V3MBJJTL.mjs.map +1 -0
- package/dist/esm/chunk-V6AAQLLJ.mjs +2 -0
- package/dist/esm/chunk-V6AAQLLJ.mjs.map +1 -0
- package/dist/esm/chunk-VAGYTPSI.mjs +2 -0
- package/dist/esm/chunk-VAGYTPSI.mjs.map +1 -0
- package/dist/esm/chunk-WGXAIQ7K.mjs +2 -0
- package/dist/esm/chunk-WGXAIQ7K.mjs.map +1 -0
- package/dist/esm/chunk-WNEZCERQ.mjs +2 -0
- package/dist/esm/chunk-WNEZCERQ.mjs.map +1 -0
- package/dist/esm/chunk-WVMDCC4V.mjs +2 -0
- package/dist/esm/chunk-WVMDCC4V.mjs.map +1 -0
- package/dist/esm/chunk-XFS5O5GJ.mjs +2 -0
- package/dist/esm/chunk-XFS5O5GJ.mjs.map +1 -0
- package/dist/esm/chunk-XFSL7O6Q.mjs +2 -0
- package/dist/esm/chunk-XFSL7O6Q.mjs.map +1 -0
- package/dist/esm/chunk-XNFEUXDS.mjs +2 -0
- package/dist/esm/chunk-XNFEUXDS.mjs.map +1 -0
- package/dist/esm/chunk-YS2OX7AB.mjs +2 -0
- package/dist/esm/chunk-YS2OX7AB.mjs.map +1 -0
- package/dist/esm/chunk-Z56AKXJ7.mjs +2 -0
- package/dist/esm/chunk-Z56AKXJ7.mjs.map +1 -0
- package/dist/esm/chunk-ZT2A5ABR.mjs +2 -0
- package/dist/esm/chunk-ZT2A5ABR.mjs.map +1 -0
- package/dist/esm/chunk-ZXJ5ZBTL.mjs +2 -0
- package/dist/esm/chunk-ZXJ5ZBTL.mjs.map +1 -0
- package/dist/esm/client/core.d.ts +24 -0
- package/dist/esm/client/core.mjs +2 -0
- package/dist/esm/client/core.mjs.map +1 -0
- package/dist/esm/client/get.d.ts +55 -0
- package/dist/esm/client/get.mjs +2 -0
- package/dist/esm/client/get.mjs.map +1 -0
- package/dist/esm/client/index.d.ts +11 -0
- package/dist/esm/client/index.mjs +2 -0
- package/dist/esm/client/index.mjs.map +1 -0
- package/dist/esm/client/post.d.ts +60 -0
- package/dist/esm/client/post.mjs +2 -0
- package/dist/esm/client/post.mjs.map +1 -0
- package/dist/esm/client/types.d.ts +46 -0
- package/dist/esm/client/types.mjs +2 -0
- package/dist/esm/client/types.mjs.map +1 -0
- package/dist/esm/core/account.d.ts +184 -0
- package/dist/esm/core/account.mjs +2 -0
- package/dist/esm/core/account.mjs.map +1 -0
- package/dist/esm/core/accountAddress.d.ts +244 -0
- package/dist/esm/core/accountAddress.mjs +2 -0
- package/dist/esm/core/accountAddress.mjs.map +1 -0
- package/dist/esm/core/authenticationKey.d.ts +74 -0
- package/dist/esm/core/authenticationKey.mjs +2 -0
- package/dist/esm/core/authenticationKey.mjs.map +1 -0
- package/dist/esm/core/common.d.ts +32 -0
- package/dist/esm/core/common.mjs +2 -0
- package/dist/esm/core/common.mjs.map +1 -0
- package/dist/esm/core/crypto/anyPublicKey.d.ts +54 -0
- package/dist/esm/core/crypto/anyPublicKey.mjs +2 -0
- package/dist/esm/core/crypto/anyPublicKey.mjs.map +1 -0
- package/dist/esm/core/crypto/anySignature.d.ts +31 -0
- package/dist/esm/core/crypto/anySignature.mjs +2 -0
- package/dist/esm/core/crypto/anySignature.mjs.map +1 -0
- package/dist/esm/core/crypto/asymmetricCrypto.d.ts +74 -0
- package/dist/esm/core/crypto/asymmetricCrypto.mjs +2 -0
- package/dist/esm/core/crypto/asymmetricCrypto.mjs.map +1 -0
- package/dist/esm/core/crypto/ed25519.d.ts +173 -0
- package/dist/esm/core/crypto/ed25519.mjs +2 -0
- package/dist/esm/core/crypto/ed25519.mjs.map +1 -0
- package/dist/esm/core/crypto/hdKey.d.ts +65 -0
- package/dist/esm/core/crypto/hdKey.mjs +2 -0
- package/dist/esm/core/crypto/hdKey.mjs.map +1 -0
- package/dist/esm/core/crypto/index.d.ts +17 -0
- package/dist/esm/core/crypto/index.mjs +2 -0
- package/dist/esm/core/crypto/index.mjs.map +1 -0
- package/dist/esm/core/crypto/multiEd25519.d.ts +126 -0
- package/dist/esm/core/crypto/multiEd25519.mjs +2 -0
- package/dist/esm/core/crypto/multiEd25519.mjs.map +1 -0
- package/dist/esm/core/crypto/multiKey.d.ts +52 -0
- package/dist/esm/core/crypto/multiKey.mjs +2 -0
- package/dist/esm/core/crypto/multiKey.mjs.map +1 -0
- package/dist/esm/core/crypto/secp256k1.d.ts +161 -0
- package/dist/esm/core/crypto/secp256k1.mjs +2 -0
- package/dist/esm/core/crypto/secp256k1.mjs.map +1 -0
- package/dist/esm/core/hex.d.ts +105 -0
- package/dist/esm/core/hex.mjs +2 -0
- package/dist/esm/core/hex.mjs.map +1 -0
- package/dist/esm/core/index.d.ts +21 -0
- package/dist/esm/core/index.mjs +2 -0
- package/dist/esm/core/index.mjs.map +1 -0
- package/dist/esm/index.d.ts +60 -5637
- package/dist/esm/index.mjs +1 -5444
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/internal/account.d.ts +143 -0
- package/dist/esm/internal/account.mjs +2 -0
- package/dist/esm/internal/account.mjs.map +1 -0
- package/dist/esm/internal/ans.d.ts +83 -0
- package/dist/esm/internal/ans.mjs +2 -0
- package/dist/esm/internal/ans.mjs.map +1 -0
- package/dist/esm/internal/coin.d.ts +43 -0
- package/dist/esm/internal/coin.mjs +2 -0
- package/dist/esm/internal/coin.mjs.map +1 -0
- package/dist/esm/internal/digitalAsset.d.ts +118 -0
- package/dist/esm/internal/digitalAsset.mjs +2 -0
- package/dist/esm/internal/digitalAsset.mjs.map +1 -0
- package/dist/esm/internal/event.d.ts +45 -0
- package/dist/esm/internal/event.mjs +2 -0
- package/dist/esm/internal/event.mjs.map +1 -0
- package/dist/esm/internal/faucet.d.ts +29 -0
- package/dist/esm/internal/faucet.mjs +2 -0
- package/dist/esm/internal/faucet.mjs.map +1 -0
- package/dist/esm/internal/fungibleAsset.d.ts +38 -0
- package/dist/esm/internal/fungibleAsset.mjs +2 -0
- package/dist/esm/internal/fungibleAsset.mjs.map +1 -0
- package/dist/esm/internal/general.d.ts +60 -0
- package/dist/esm/internal/general.mjs +2 -0
- package/dist/esm/internal/general.mjs.map +1 -0
- package/dist/esm/internal/staking.d.ts +38 -0
- package/dist/esm/internal/staking.mjs +2 -0
- package/dist/esm/internal/staking.mjs.map +1 -0
- package/dist/esm/internal/transaction.d.ts +57 -0
- package/dist/esm/internal/transaction.mjs +2 -0
- package/dist/esm/internal/transaction.mjs.map +1 -0
- package/dist/esm/internal/transactionSubmission.d.ts +148 -0
- package/dist/esm/internal/transactionSubmission.mjs +2 -0
- package/dist/esm/internal/transactionSubmission.mjs.map +1 -0
- package/dist/esm/transactions/authenticator/account.d.ts +79 -0
- package/dist/esm/transactions/authenticator/account.mjs +2 -0
- package/dist/esm/transactions/authenticator/account.mjs.map +1 -0
- package/dist/esm/transactions/authenticator/index.d.ts +19 -0
- package/dist/esm/transactions/authenticator/index.mjs +2 -0
- package/dist/esm/transactions/authenticator/index.mjs.map +1 -0
- package/dist/esm/transactions/authenticator/transaction.d.ts +105 -0
- package/dist/esm/transactions/authenticator/transaction.mjs +2 -0
- package/dist/esm/transactions/authenticator/transaction.mjs.map +1 -0
- package/dist/esm/transactions/index.d.ts +39 -0
- package/dist/esm/transactions/index.mjs +2 -0
- package/dist/esm/transactions/index.mjs.map +1 -0
- package/dist/esm/transactions/instances/chainId.d.ts +21 -0
- package/dist/esm/transactions/instances/chainId.mjs +2 -0
- package/dist/esm/transactions/instances/chainId.mjs.map +1 -0
- package/dist/esm/transactions/instances/identifier.d.ts +23 -0
- package/dist/esm/transactions/instances/identifier.mjs +2 -0
- package/dist/esm/transactions/instances/identifier.mjs.map +1 -0
- package/dist/esm/transactions/instances/index.d.ts +29 -0
- package/dist/esm/transactions/instances/index.mjs +2 -0
- package/dist/esm/transactions/instances/index.mjs.map +1 -0
- package/dist/esm/transactions/instances/moduleId.d.ts +37 -0
- package/dist/esm/transactions/instances/moduleId.mjs +2 -0
- package/dist/esm/transactions/instances/moduleId.mjs.map +1 -0
- package/dist/esm/transactions/instances/rawTransaction.d.ts +98 -0
- package/dist/esm/transactions/instances/rawTransaction.mjs +2 -0
- package/dist/esm/transactions/instances/rawTransaction.mjs.map +1 -0
- package/dist/esm/transactions/instances/rotationProofChallenge.d.ts +37 -0
- package/dist/esm/transactions/instances/rotationProofChallenge.mjs +2 -0
- package/dist/esm/transactions/instances/rotationProofChallenge.mjs.map +1 -0
- package/dist/esm/transactions/instances/signedTransaction.d.ts +46 -0
- package/dist/esm/transactions/instances/signedTransaction.mjs +2 -0
- package/dist/esm/transactions/instances/signedTransaction.mjs.map +1 -0
- package/dist/esm/transactions/instances/transactionArgument.d.ts +40 -0
- package/dist/esm/transactions/instances/transactionArgument.mjs +2 -0
- package/dist/esm/transactions/instances/transactionArgument.mjs.map +1 -0
- package/dist/esm/transactions/instances/transactionPayload.d.ts +211 -0
- package/dist/esm/transactions/instances/transactionPayload.mjs +2 -0
- package/dist/esm/transactions/instances/transactionPayload.mjs.map +1 -0
- package/dist/esm/transactions/transactionBuilder/helpers.d.ts +63 -0
- package/dist/esm/transactions/transactionBuilder/helpers.mjs +2 -0
- package/dist/esm/transactions/transactionBuilder/helpers.mjs.map +1 -0
- package/dist/esm/transactions/transactionBuilder/index.d.ts +35 -0
- package/dist/esm/transactions/transactionBuilder/index.mjs +2 -0
- package/dist/esm/transactions/transactionBuilder/index.mjs.map +1 -0
- package/dist/esm/transactions/transactionBuilder/remoteAbi.d.ts +54 -0
- package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +2 -0
- package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs.map +1 -0
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.ts +128 -0
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +2 -0
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs.map +1 -0
- package/dist/esm/transactions/typeTag/index.d.ts +127 -0
- package/dist/esm/transactions/typeTag/index.mjs +2 -0
- package/dist/esm/transactions/typeTag/index.mjs.map +1 -0
- package/dist/esm/transactions/typeTag/parser.d.ts +47 -0
- package/dist/esm/transactions/typeTag/parser.mjs +2 -0
- package/dist/esm/transactions/typeTag/parser.mjs.map +1 -0
- package/dist/esm/transactions/types.d.ts +253 -0
- package/dist/esm/transactions/types.mjs +2 -0
- package/dist/esm/transactions/types.mjs.map +1 -0
- package/dist/esm/types/generated/operations.d.ts +604 -0
- package/dist/esm/types/generated/operations.mjs +1 -0
- package/dist/esm/types/generated/operations.mjs.map +1 -0
- package/dist/esm/types/generated/queries.d.ts +55 -0
- package/dist/esm/types/generated/queries.mjs +2 -0
- package/dist/esm/types/generated/queries.mjs.map +1 -0
- package/dist/esm/types/generated/types.d.ts +9458 -0
- package/dist/esm/types/generated/types.mjs +2 -0
- package/dist/esm/types/generated/types.mjs.map +1 -0
- package/dist/{types → esm/types}/index.d.ts +19 -451
- package/dist/esm/types/index.mjs +2 -0
- package/dist/esm/types/index.mjs.map +1 -0
- package/dist/esm/types/indexer.d.ts +62 -0
- package/dist/esm/types/indexer.mjs +2 -0
- package/dist/esm/types/indexer.mjs.map +1 -0
- package/dist/esm/utils/apiEndpoints.d.ts +14 -0
- package/dist/esm/utils/apiEndpoints.mjs +2 -0
- package/dist/esm/utils/apiEndpoints.mjs.map +1 -0
- package/dist/esm/utils/const.d.ts +42 -0
- package/dist/esm/utils/const.mjs +2 -0
- package/dist/esm/utils/const.mjs.map +1 -0
- package/dist/esm/utils/helpers.d.ts +7 -0
- package/dist/esm/utils/helpers.mjs +2 -0
- package/dist/esm/utils/helpers.mjs.map +1 -0
- package/dist/esm/utils/memoize.d.ts +20 -0
- package/dist/esm/utils/memoize.mjs +2 -0
- package/dist/esm/utils/memoize.mjs.map +1 -0
- package/dist/esm/version.d.ts +8 -0
- package/dist/esm/version.mjs +2 -0
- package/dist/esm/version.mjs.map +1 -0
- package/package.json +17 -13
- package/src/api/account.ts +17 -18
- package/src/api/ans.ts +58 -0
- package/src/api/aptos.ts +7 -1
- package/src/api/coin.ts +3 -3
- package/src/api/digitalAsset.ts +9 -8
- package/src/api/event.ts +4 -3
- package/src/api/faucet.ts +3 -2
- package/src/api/general.ts +2 -2
- package/src/api/staking.ts +5 -4
- package/src/api/transactionSubmission.ts +41 -20
- package/src/bcs/deserializer.ts +4 -4
- package/src/bcs/serializable/moveStructs.ts +13 -13
- package/src/bcs/serializer.ts +4 -4
- package/src/client/core.ts +18 -8
- package/src/core/account.ts +90 -33
- package/src/core/accountAddress.ts +34 -30
- package/src/core/authenticationKey.ts +11 -9
- package/src/core/crypto/ed25519.ts +48 -1
- package/src/core/crypto/hdKey.ts +105 -0
- package/src/core/crypto/index.ts +1 -0
- package/src/core/crypto/secp256k1.ts +36 -0
- package/src/index.ts +0 -1
- package/src/internal/account.ts +80 -58
- package/src/internal/ans.ts +175 -0
- package/src/internal/coin.ts +5 -5
- package/src/internal/digitalAsset.ts +16 -17
- package/src/internal/event.ts +8 -8
- package/src/internal/faucet.ts +4 -4
- package/src/internal/general.ts +3 -3
- package/src/internal/queries/getEvents.graphql +1 -0
- package/src/internal/staking.ts +8 -8
- package/src/internal/transactionSubmission.ts +78 -19
- package/src/transactions/instances/index.ts +1 -0
- package/src/transactions/instances/moduleId.ts +1 -1
- package/src/transactions/instances/rotationProofChallenge.ts +58 -0
- package/src/transactions/transactionBuilder/helpers.ts +5 -1
- package/src/transactions/transactionBuilder/remoteAbi.ts +4 -4
- package/src/transactions/transactionBuilder/transactionBuilder.ts +31 -49
- package/src/transactions/typeTag/index.ts +10 -10
- package/src/transactions/typeTag/parser.ts +1 -1
- package/src/transactions/types.ts +31 -20
- package/src/types/generated/operations.ts +19 -18
- package/src/types/generated/queries.ts +20 -19
- package/src/types/generated/types.ts +6 -0
- package/src/types/index.ts +15 -18
- package/src/utils/apiEndpoints.ts +8 -0
- package/src/version.ts +1 -1
- package/dist/cjs/index.js +0 -5631
- package/dist/cjs/index.js.map +0 -1
- package/dist/types/index.js +0 -176
- package/dist/types/index.js.map +0 -1
- package/src/utils/hdKey.ts +0 -113
|
@@ -7,6 +7,7 @@ import { Deserializer } from "../../bcs/deserializer";
|
|
|
7
7
|
import { Serializer } from "../../bcs/serializer";
|
|
8
8
|
import { Hex } from "../hex";
|
|
9
9
|
import { HexInput } from "../../types";
|
|
10
|
+
import { CKDPriv, deriveKey, HARDENED_OFFSET, isValidHardenedPath, mnemonicToSeed, splitPath } from "./hdKey";
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* Represents the public key of an Ed25519 key pair.
|
|
@@ -70,7 +71,7 @@ export class Ed25519PublicKey extends PublicKey {
|
|
|
70
71
|
verifySignature(args: { message: HexInput; signature: Ed25519Signature }): boolean {
|
|
71
72
|
const { message, signature } = args;
|
|
72
73
|
const rawMessage = Hex.fromHexInput(message).toUint8Array();
|
|
73
|
-
const rawSignature =
|
|
74
|
+
const rawSignature = signature.toUint8Array();
|
|
74
75
|
return nacl.sign.detached.verify(rawMessage, rawSignature, this.key.toUint8Array());
|
|
75
76
|
}
|
|
76
77
|
|
|
@@ -98,6 +99,12 @@ export class Ed25519PrivateKey extends PrivateKey {
|
|
|
98
99
|
*/
|
|
99
100
|
static readonly LENGTH: number = 32;
|
|
100
101
|
|
|
102
|
+
/**
|
|
103
|
+
* The Ed25519 key seed to use for BIP-32 compatibility
|
|
104
|
+
* See more {@link https://github.com/satoshilabs/slips/blob/master/slip-0010.md}
|
|
105
|
+
*/
|
|
106
|
+
static readonly SLIP_0010_SEED = "ed25519 seed";
|
|
107
|
+
|
|
101
108
|
/**
|
|
102
109
|
* The Ed25519 signing key
|
|
103
110
|
* @private
|
|
@@ -179,6 +186,46 @@ export class Ed25519PrivateKey extends PrivateKey {
|
|
|
179
186
|
const bytes = this.signingKeyPair.publicKey;
|
|
180
187
|
return new Ed25519PublicKey(bytes);
|
|
181
188
|
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Derives a private key from a mnemonic seed phrase.
|
|
192
|
+
*
|
|
193
|
+
* To derive multiple keys from the same phrase, change the path
|
|
194
|
+
*
|
|
195
|
+
* IMPORTANT: Ed25519 supports hardened derivation only (since it lacks a key homomorphism,
|
|
196
|
+
* so non-hardened derivation cannot work)
|
|
197
|
+
*
|
|
198
|
+
* @param path the BIP44 path
|
|
199
|
+
* @param mnemonics the mnemonic seed phrase
|
|
200
|
+
*/
|
|
201
|
+
static fromDerivationPath(path: string, mnemonics: string): Ed25519PrivateKey {
|
|
202
|
+
if (!isValidHardenedPath(path)) {
|
|
203
|
+
throw new Error(`Invalid derivation path ${path}`);
|
|
204
|
+
}
|
|
205
|
+
return Ed25519PrivateKey.fromDerivationPathInner(path, mnemonicToSeed(mnemonics));
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* A private inner function so we can separate from the main fromDerivationPath() method
|
|
210
|
+
* to add tests to verify we create the keys correctly.
|
|
211
|
+
*
|
|
212
|
+
* @param path the BIP44 path
|
|
213
|
+
* @param seed the seed phrase created by the mnemonics
|
|
214
|
+
* @param offset the offset used for key derivation, defaults to 0x80000000
|
|
215
|
+
* @returns
|
|
216
|
+
*/
|
|
217
|
+
private static fromDerivationPathInner(path: string, seed: Uint8Array, offset = HARDENED_OFFSET): Ed25519PrivateKey {
|
|
218
|
+
const { key, chainCode } = deriveKey(Ed25519PrivateKey.SLIP_0010_SEED, seed);
|
|
219
|
+
|
|
220
|
+
const segments = splitPath(path).map((el) => parseInt(el, 10));
|
|
221
|
+
|
|
222
|
+
// Derive the child key based on the path
|
|
223
|
+
const { key: privateKey } = segments.reduce((parentKeys, segment) => CKDPriv(parentKeys, segment + offset), {
|
|
224
|
+
key,
|
|
225
|
+
chainCode,
|
|
226
|
+
});
|
|
227
|
+
return new Ed25519PrivateKey(privateKey);
|
|
228
|
+
}
|
|
182
229
|
}
|
|
183
230
|
|
|
184
231
|
/**
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
// Copyright © Aptos Foundation
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { hmac } from "@noble/hashes/hmac";
|
|
5
|
+
import { sha512 } from "@noble/hashes/sha512";
|
|
6
|
+
import * as bip39 from "@scure/bip39";
|
|
7
|
+
|
|
8
|
+
export type DerivedKeys = {
|
|
9
|
+
key: Uint8Array;
|
|
10
|
+
chainCode: Uint8Array;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Aptos derive path is 637
|
|
15
|
+
*/
|
|
16
|
+
export const APTOS_HARDENED_REGEX = /^m\/44'\/637'\/[0-9]+'\/[0-9]+'\/[0-9]+'?$/;
|
|
17
|
+
export const APTOS_BIP44_REGEX = /^m\/44'\/637'\/[0-9]+'\/[0-9]+\/[0-9]+$/;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* A list of supported key types and associated seeds
|
|
21
|
+
*/
|
|
22
|
+
export enum KeyType {
|
|
23
|
+
ED25519 = "ed25519 seed",
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const HARDENED_OFFSET = 0x80000000;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Aptos derive path is 637
|
|
30
|
+
*
|
|
31
|
+
* Parse and validate a path that is compliant to BIP-44 in form m/44'/637'/{account_index}'/{change_index}/{address_index}
|
|
32
|
+
* for Secp256k1
|
|
33
|
+
*
|
|
34
|
+
* Note that for secp256k1, last two components must be non-hardened.
|
|
35
|
+
*
|
|
36
|
+
* @param path path string (e.g. `m/44'/637'/0'/0/0`).
|
|
37
|
+
*/
|
|
38
|
+
export function isValidBIP44Path(path: string): boolean {
|
|
39
|
+
return APTOS_BIP44_REGEX.test(path);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Aptos derive path is 637
|
|
44
|
+
*
|
|
45
|
+
* Parse and validate a path that is compliant to SLIP-0010 and BIP-44
|
|
46
|
+
* in form m/44'/637'/{account_index}'/{change_index}'/{address_index}'.
|
|
47
|
+
* See SLIP-0010 {@link https://github.com/satoshilabs/slips/blob/master/slip-0044.md}
|
|
48
|
+
* See BIP-44 {@link https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki}
|
|
49
|
+
*
|
|
50
|
+
* Note that for Ed25519, all components must be hardened.
|
|
51
|
+
* This is because non-hardened [PK] derivation would not work due to Ed25519's lack of a key homomorphism.
|
|
52
|
+
* Specifically, you cannot derive the PK associated with derivation path a/b/c given the PK of a/b.
|
|
53
|
+
* This is because the PK in Ed25519 is, more or less, computed as 𝑔𝐻(𝑠𝑘),
|
|
54
|
+
* with the hash function breaking the homomorphism.
|
|
55
|
+
*
|
|
56
|
+
* @param path path string (e.g. `m/44'/637'/0'/0'/0'`).
|
|
57
|
+
*/
|
|
58
|
+
export function isValidHardenedPath(path: string): boolean {
|
|
59
|
+
return APTOS_HARDENED_REGEX.test(path);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export const deriveKey = (hashSeed: Uint8Array | string, data: Uint8Array | string): DerivedKeys => {
|
|
63
|
+
const digest = hmac.create(sha512, hashSeed).update(data).digest();
|
|
64
|
+
return {
|
|
65
|
+
key: digest.slice(0, 32),
|
|
66
|
+
chainCode: digest.slice(32),
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Derive a child key from the private key
|
|
72
|
+
* @param key
|
|
73
|
+
* @param chainCode
|
|
74
|
+
* @param index
|
|
75
|
+
* @constructor
|
|
76
|
+
*/
|
|
77
|
+
export const CKDPriv = ({ key, chainCode }: DerivedKeys, index: number): DerivedKeys => {
|
|
78
|
+
const buffer = new ArrayBuffer(4);
|
|
79
|
+
new DataView(buffer).setUint32(0, index);
|
|
80
|
+
const indexBytes = new Uint8Array(buffer);
|
|
81
|
+
const zero = new Uint8Array([0]);
|
|
82
|
+
const data = new Uint8Array([...zero, ...key, ...indexBytes]);
|
|
83
|
+
return deriveKey(chainCode, data);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const removeApostrophes = (val: string): string => val.replace("'", "");
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Splits derive path into segments
|
|
90
|
+
* @param path
|
|
91
|
+
*/
|
|
92
|
+
export const splitPath = (path: string): Array<string> => path.split("/").slice(1).map(removeApostrophes);
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Normalizes the mnemonic by removing extra whitespace and making it lowercase
|
|
96
|
+
* @param mnemonic the mnemonic seed phrase
|
|
97
|
+
*/
|
|
98
|
+
export const mnemonicToSeed = (mnemonic: string): Uint8Array => {
|
|
99
|
+
const normalizedMnemonic = mnemonic
|
|
100
|
+
.trim()
|
|
101
|
+
.split(/\s+/)
|
|
102
|
+
.map((part) => part.toLowerCase())
|
|
103
|
+
.join(" ");
|
|
104
|
+
return bip39.mnemonicToSeedSync(normalizedMnemonic);
|
|
105
|
+
};
|
package/src/core/crypto/index.ts
CHANGED
|
@@ -3,10 +3,12 @@
|
|
|
3
3
|
|
|
4
4
|
import { sha3_256 } from "@noble/hashes/sha3";
|
|
5
5
|
import { secp256k1 } from "@noble/curves/secp256k1";
|
|
6
|
+
import { HDKey } from "@scure/bip32";
|
|
6
7
|
import { PrivateKey, PublicKey, Signature } from "./asymmetricCrypto";
|
|
7
8
|
import { Deserializer, Serializer } from "../../bcs";
|
|
8
9
|
import { Hex } from "../hex";
|
|
9
10
|
import { HexInput } from "../../types";
|
|
11
|
+
import { isValidBIP44Path, mnemonicToSeed } from "./hdKey";
|
|
10
12
|
|
|
11
13
|
/**
|
|
12
14
|
* Represents the Secp256k1 ecdsa public key
|
|
@@ -173,6 +175,40 @@ export class Secp256k1PrivateKey extends PrivateKey {
|
|
|
173
175
|
const bytes = secp256k1.getPublicKey(this.key.toUint8Array(), false);
|
|
174
176
|
return new Secp256k1PublicKey(bytes);
|
|
175
177
|
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Derives a private key from a mnemonic seed phrase.
|
|
181
|
+
*
|
|
182
|
+
* @param path the BIP44 path
|
|
183
|
+
* @param mnemonics the mnemonic seed phrase
|
|
184
|
+
*
|
|
185
|
+
* @returns The generated key
|
|
186
|
+
*/
|
|
187
|
+
static fromDerivationPath(path: string, mnemonics: string): Secp256k1PrivateKey {
|
|
188
|
+
if (!isValidBIP44Path(path)) {
|
|
189
|
+
throw new Error(`Invalid derivation path ${path}`);
|
|
190
|
+
}
|
|
191
|
+
return Secp256k1PrivateKey.fromDerivationPathInner(path, mnemonicToSeed(mnemonics));
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* A private inner function so we can separate from the main fromDerivationPath() method
|
|
196
|
+
* to add tests to verify we create the keys correctly.
|
|
197
|
+
*
|
|
198
|
+
* @param path the BIP44 path
|
|
199
|
+
* @param seed the seed phrase created by the mnemonics
|
|
200
|
+
*
|
|
201
|
+
* @returns The generated key
|
|
202
|
+
*/
|
|
203
|
+
private static fromDerivationPathInner(path: string, seed: Uint8Array): Secp256k1PrivateKey {
|
|
204
|
+
const { privateKey } = HDKey.fromMasterSeed(seed).derive(path);
|
|
205
|
+
// library returns privateKey as Uint8Array | null
|
|
206
|
+
if (privateKey === null) {
|
|
207
|
+
throw new Error("Invalid key");
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
return new Secp256k1PrivateKey(privateKey);
|
|
211
|
+
}
|
|
176
212
|
}
|
|
177
213
|
|
|
178
214
|
/**
|
package/src/index.ts
CHANGED
package/src/internal/account.ts
CHANGED
|
@@ -10,10 +10,9 @@
|
|
|
10
10
|
|
|
11
11
|
import { AptosConfig } from "../api/aptosConfig";
|
|
12
12
|
import { AptosApiError, getAptosFullNode, paginateWithCursor } from "../client";
|
|
13
|
-
import { AccountAddress } from "../core/accountAddress";
|
|
13
|
+
import { AccountAddress, AccountAddressInput } from "../core/accountAddress";
|
|
14
14
|
import { Account } from "../core/account";
|
|
15
15
|
import { PrivateKey } from "../core/crypto/asymmetricCrypto";
|
|
16
|
-
import { Hex } from "../core/hex";
|
|
17
16
|
import { getTableItem, queryIndexer } from "./general";
|
|
18
17
|
import {
|
|
19
18
|
AccountData,
|
|
@@ -22,7 +21,6 @@ import {
|
|
|
22
21
|
GetAccountOwnedObjectsResponse,
|
|
23
22
|
GetAccountOwnedTokensFromCollectionResponse,
|
|
24
23
|
GetAccountOwnedTokensQueryResponse,
|
|
25
|
-
HexInput,
|
|
26
24
|
LedgerVersion,
|
|
27
25
|
MoveModuleBytecode,
|
|
28
26
|
MoveResource,
|
|
@@ -57,26 +55,29 @@ import { memoizeAsync } from "../utils/memoize";
|
|
|
57
55
|
import { Secp256k1PrivateKey, AuthenticationKey, Ed25519PrivateKey } from "../core";
|
|
58
56
|
import { AnyPublicKey } from "../core/crypto/anyPublicKey";
|
|
59
57
|
|
|
60
|
-
export async function getInfo(args: {
|
|
58
|
+
export async function getInfo(args: {
|
|
59
|
+
aptosConfig: AptosConfig;
|
|
60
|
+
accountAddress: AccountAddressInput;
|
|
61
|
+
}): Promise<AccountData> {
|
|
61
62
|
const { aptosConfig, accountAddress } = args;
|
|
62
63
|
const { data } = await getAptosFullNode<{}, AccountData>({
|
|
63
64
|
aptosConfig,
|
|
64
65
|
originMethod: "getInfo",
|
|
65
|
-
path: `accounts/${AccountAddress.
|
|
66
|
+
path: `accounts/${AccountAddress.from(accountAddress).toString()}`,
|
|
66
67
|
});
|
|
67
68
|
return data;
|
|
68
69
|
}
|
|
69
70
|
|
|
70
71
|
export async function getModules(args: {
|
|
71
72
|
aptosConfig: AptosConfig;
|
|
72
|
-
accountAddress:
|
|
73
|
+
accountAddress: AccountAddressInput;
|
|
73
74
|
options?: PaginationArgs & LedgerVersion;
|
|
74
75
|
}): Promise<MoveModuleBytecode[]> {
|
|
75
76
|
const { aptosConfig, accountAddress, options } = args;
|
|
76
77
|
return paginateWithCursor<{}, MoveModuleBytecode[]>({
|
|
77
78
|
aptosConfig,
|
|
78
79
|
originMethod: "getModules",
|
|
79
|
-
path: `accounts/${AccountAddress.
|
|
80
|
+
path: `accounts/${AccountAddress.from(accountAddress).toString()}/modules`,
|
|
80
81
|
params: {
|
|
81
82
|
ledger_version: options?.ledgerVersion,
|
|
82
83
|
start: options?.offset,
|
|
@@ -95,7 +96,7 @@ export async function getModules(args: {
|
|
|
95
96
|
*/
|
|
96
97
|
export async function getModule(args: {
|
|
97
98
|
aptosConfig: AptosConfig;
|
|
98
|
-
accountAddress:
|
|
99
|
+
accountAddress: AccountAddressInput;
|
|
99
100
|
moduleName: string;
|
|
100
101
|
options?: LedgerVersion;
|
|
101
102
|
}): Promise<MoveModuleBytecode> {
|
|
@@ -114,7 +115,7 @@ export async function getModule(args: {
|
|
|
114
115
|
|
|
115
116
|
async function getModuleInner(args: {
|
|
116
117
|
aptosConfig: AptosConfig;
|
|
117
|
-
accountAddress:
|
|
118
|
+
accountAddress: AccountAddressInput;
|
|
118
119
|
moduleName: string;
|
|
119
120
|
options?: LedgerVersion;
|
|
120
121
|
}): Promise<MoveModuleBytecode> {
|
|
@@ -123,7 +124,7 @@ async function getModuleInner(args: {
|
|
|
123
124
|
const { data } = await getAptosFullNode<{}, MoveModuleBytecode>({
|
|
124
125
|
aptosConfig,
|
|
125
126
|
originMethod: "getModule",
|
|
126
|
-
path: `accounts/${AccountAddress.
|
|
127
|
+
path: `accounts/${AccountAddress.from(accountAddress).toString()}/module/${moduleName}`,
|
|
127
128
|
params: { ledger_version: options?.ledgerVersion },
|
|
128
129
|
});
|
|
129
130
|
return data;
|
|
@@ -131,28 +132,28 @@ async function getModuleInner(args: {
|
|
|
131
132
|
|
|
132
133
|
export async function getTransactions(args: {
|
|
133
134
|
aptosConfig: AptosConfig;
|
|
134
|
-
accountAddress:
|
|
135
|
+
accountAddress: AccountAddressInput;
|
|
135
136
|
options?: PaginationArgs;
|
|
136
137
|
}): Promise<TransactionResponse[]> {
|
|
137
138
|
const { aptosConfig, accountAddress, options } = args;
|
|
138
139
|
return paginateWithCursor<{}, TransactionResponse[]>({
|
|
139
140
|
aptosConfig,
|
|
140
141
|
originMethod: "getTransactions",
|
|
141
|
-
path: `accounts/${AccountAddress.
|
|
142
|
+
path: `accounts/${AccountAddress.from(accountAddress).toString()}/transactions`,
|
|
142
143
|
params: { start: options?.offset, limit: options?.limit },
|
|
143
144
|
});
|
|
144
145
|
}
|
|
145
146
|
|
|
146
147
|
export async function getResources(args: {
|
|
147
148
|
aptosConfig: AptosConfig;
|
|
148
|
-
accountAddress:
|
|
149
|
+
accountAddress: AccountAddressInput;
|
|
149
150
|
options?: PaginationArgs & LedgerVersion;
|
|
150
151
|
}): Promise<MoveResource[]> {
|
|
151
152
|
const { aptosConfig, accountAddress, options } = args;
|
|
152
153
|
return paginateWithCursor<{}, MoveResource[]>({
|
|
153
154
|
aptosConfig,
|
|
154
155
|
originMethod: "getResources",
|
|
155
|
-
path: `accounts/${AccountAddress.
|
|
156
|
+
path: `accounts/${AccountAddress.from(accountAddress).toString()}/resources`,
|
|
156
157
|
params: {
|
|
157
158
|
ledger_version: options?.ledgerVersion,
|
|
158
159
|
start: options?.offset,
|
|
@@ -163,7 +164,7 @@ export async function getResources(args: {
|
|
|
163
164
|
|
|
164
165
|
export async function getResource<T extends {}>(args: {
|
|
165
166
|
aptosConfig: AptosConfig;
|
|
166
|
-
accountAddress:
|
|
167
|
+
accountAddress: AccountAddressInput;
|
|
167
168
|
resourceType: MoveStructType;
|
|
168
169
|
options?: LedgerVersion;
|
|
169
170
|
}): Promise<T> {
|
|
@@ -171,7 +172,7 @@ export async function getResource<T extends {}>(args: {
|
|
|
171
172
|
const { data } = await getAptosFullNode<{}, MoveResource>({
|
|
172
173
|
aptosConfig,
|
|
173
174
|
originMethod: "getResource",
|
|
174
|
-
path: `accounts/${AccountAddress.
|
|
175
|
+
path: `accounts/${AccountAddress.from(accountAddress).toString()}/resource/${resourceType}`,
|
|
175
176
|
params: { ledger_version: options?.ledgerVersion },
|
|
176
177
|
});
|
|
177
178
|
return data.data as T;
|
|
@@ -179,7 +180,7 @@ export async function getResource<T extends {}>(args: {
|
|
|
179
180
|
|
|
180
181
|
export async function lookupOriginalAccountAddress(args: {
|
|
181
182
|
aptosConfig: AptosConfig;
|
|
182
|
-
authenticationKey:
|
|
183
|
+
authenticationKey: AccountAddressInput;
|
|
183
184
|
options?: LedgerVersion;
|
|
184
185
|
}): Promise<AccountAddress> {
|
|
185
186
|
const { aptosConfig, authenticationKey, options } = args;
|
|
@@ -197,24 +198,26 @@ export async function lookupOriginalAccountAddress(args: {
|
|
|
197
198
|
address_map: { handle },
|
|
198
199
|
} = resource;
|
|
199
200
|
|
|
201
|
+
const authKeyAddress = AccountAddress.from(authenticationKey);
|
|
202
|
+
|
|
200
203
|
// If the address is not found in the address map, which means its not rotated
|
|
201
204
|
// then return the address as is
|
|
202
205
|
try {
|
|
203
|
-
const originalAddress = await getTableItem({
|
|
206
|
+
const originalAddress = await getTableItem<string>({
|
|
204
207
|
aptosConfig,
|
|
205
208
|
handle,
|
|
206
209
|
data: {
|
|
207
|
-
key:
|
|
210
|
+
key: authKeyAddress.toString(),
|
|
208
211
|
key_type: "address",
|
|
209
212
|
value_type: "address",
|
|
210
213
|
},
|
|
211
214
|
options,
|
|
212
215
|
});
|
|
213
216
|
|
|
214
|
-
return AccountAddress.
|
|
217
|
+
return AccountAddress.from(originalAddress);
|
|
215
218
|
} catch (err) {
|
|
216
219
|
if (err instanceof AptosApiError && err.data.error_code === "table_item_not_found") {
|
|
217
|
-
return
|
|
220
|
+
return authKeyAddress;
|
|
218
221
|
}
|
|
219
222
|
|
|
220
223
|
throw err;
|
|
@@ -223,15 +226,15 @@ export async function lookupOriginalAccountAddress(args: {
|
|
|
223
226
|
|
|
224
227
|
export async function getAccountTokensCount(args: {
|
|
225
228
|
aptosConfig: AptosConfig;
|
|
226
|
-
accountAddress:
|
|
229
|
+
accountAddress: AccountAddressInput;
|
|
227
230
|
}): Promise<number> {
|
|
228
231
|
const { aptosConfig, accountAddress } = args;
|
|
229
232
|
|
|
230
|
-
const address = AccountAddress.
|
|
233
|
+
const address = AccountAddress.from(accountAddress).toStringLong();
|
|
231
234
|
|
|
232
|
-
const whereCondition:
|
|
235
|
+
const whereCondition: { owner_address: { _eq: string }; amount: { _gt: number } } = {
|
|
233
236
|
owner_address: { _eq: address },
|
|
234
|
-
amount: { _gt:
|
|
237
|
+
amount: { _gt: 0 },
|
|
235
238
|
};
|
|
236
239
|
|
|
237
240
|
const graphqlQuery = {
|
|
@@ -252,7 +255,7 @@ export async function getAccountTokensCount(args: {
|
|
|
252
255
|
|
|
253
256
|
export async function getAccountOwnedTokens(args: {
|
|
254
257
|
aptosConfig: AptosConfig;
|
|
255
|
-
accountAddress:
|
|
258
|
+
accountAddress: AccountAddressInput;
|
|
256
259
|
options?: {
|
|
257
260
|
tokenStandard?: TokenStandard;
|
|
258
261
|
pagination?: PaginationArgs;
|
|
@@ -260,12 +263,13 @@ export async function getAccountOwnedTokens(args: {
|
|
|
260
263
|
};
|
|
261
264
|
}): Promise<GetAccountOwnedTokensQueryResponse> {
|
|
262
265
|
const { aptosConfig, accountAddress, options } = args;
|
|
263
|
-
const address = AccountAddress.
|
|
266
|
+
const address = AccountAddress.from(accountAddress).toStringLong();
|
|
264
267
|
|
|
265
|
-
const whereCondition:
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
268
|
+
const whereCondition: { owner_address: { _eq: string }; amount: { _gt: number }; token_standard?: { _eq: string } } =
|
|
269
|
+
{
|
|
270
|
+
owner_address: { _eq: address },
|
|
271
|
+
amount: { _gt: 0 },
|
|
272
|
+
};
|
|
269
273
|
|
|
270
274
|
if (options?.tokenStandard) {
|
|
271
275
|
whereCondition.token_standard = { _eq: options?.tokenStandard };
|
|
@@ -292,8 +296,8 @@ export async function getAccountOwnedTokens(args: {
|
|
|
292
296
|
|
|
293
297
|
export async function getAccountOwnedTokensFromCollectionAddress(args: {
|
|
294
298
|
aptosConfig: AptosConfig;
|
|
295
|
-
accountAddress:
|
|
296
|
-
collectionAddress:
|
|
299
|
+
accountAddress: AccountAddressInput;
|
|
300
|
+
collectionAddress: AccountAddressInput;
|
|
297
301
|
options?: {
|
|
298
302
|
tokenStandard?: TokenStandard;
|
|
299
303
|
pagination?: PaginationArgs;
|
|
@@ -301,10 +305,15 @@ export async function getAccountOwnedTokensFromCollectionAddress(args: {
|
|
|
301
305
|
};
|
|
302
306
|
}): Promise<GetAccountOwnedTokensFromCollectionResponse> {
|
|
303
307
|
const { aptosConfig, accountAddress, collectionAddress, options } = args;
|
|
304
|
-
const ownerAddress = AccountAddress.
|
|
305
|
-
const collAddress =
|
|
306
|
-
|
|
307
|
-
const whereCondition:
|
|
308
|
+
const ownerAddress = AccountAddress.from(accountAddress).toStringLong();
|
|
309
|
+
const collAddress = AccountAddress.from(collectionAddress).toStringLong();
|
|
310
|
+
|
|
311
|
+
const whereCondition: {
|
|
312
|
+
owner_address: { _eq: string };
|
|
313
|
+
current_token_data: { collection_id: { _eq: string } };
|
|
314
|
+
amount: { _gt: number };
|
|
315
|
+
token_standard?: { _eq: string };
|
|
316
|
+
} = {
|
|
308
317
|
owner_address: { _eq: ownerAddress },
|
|
309
318
|
current_token_data: { collection_id: { _eq: collAddress } },
|
|
310
319
|
amount: { _gt: 0 },
|
|
@@ -335,7 +344,7 @@ export async function getAccountOwnedTokensFromCollectionAddress(args: {
|
|
|
335
344
|
|
|
336
345
|
export async function getAccountCollectionsWithOwnedTokens(args: {
|
|
337
346
|
aptosConfig: AptosConfig;
|
|
338
|
-
accountAddress:
|
|
347
|
+
accountAddress: AccountAddressInput;
|
|
339
348
|
options?: {
|
|
340
349
|
tokenStandard?: TokenStandard;
|
|
341
350
|
pagination?: PaginationArgs;
|
|
@@ -343,9 +352,13 @@ export async function getAccountCollectionsWithOwnedTokens(args: {
|
|
|
343
352
|
};
|
|
344
353
|
}): Promise<GetAccountCollectionsWithOwnedTokenResponse> {
|
|
345
354
|
const { aptosConfig, accountAddress, options } = args;
|
|
346
|
-
const address = AccountAddress.
|
|
355
|
+
const address = AccountAddress.from(accountAddress).toStringLong();
|
|
347
356
|
|
|
348
|
-
const whereCondition:
|
|
357
|
+
const whereCondition: {
|
|
358
|
+
owner_address: { _eq: string };
|
|
359
|
+
amount: { _gt: number };
|
|
360
|
+
current_collection?: { token_standard: { _eq: string } };
|
|
361
|
+
} = {
|
|
349
362
|
owner_address: { _eq: address },
|
|
350
363
|
amount: { _gt: 0 },
|
|
351
364
|
};
|
|
@@ -377,11 +390,11 @@ export async function getAccountCollectionsWithOwnedTokens(args: {
|
|
|
377
390
|
|
|
378
391
|
export async function getAccountTransactionsCount(args: {
|
|
379
392
|
aptosConfig: AptosConfig;
|
|
380
|
-
accountAddress:
|
|
393
|
+
accountAddress: AccountAddressInput;
|
|
381
394
|
}): Promise<number> {
|
|
382
395
|
const { aptosConfig, accountAddress } = args;
|
|
383
396
|
|
|
384
|
-
const address = AccountAddress.
|
|
397
|
+
const address = AccountAddress.from(accountAddress).toStringLong();
|
|
385
398
|
|
|
386
399
|
const graphqlQuery = {
|
|
387
400
|
query: GetAccountTransactionsCount,
|
|
@@ -403,16 +416,16 @@ export async function getAccountTransactionsCount(args: {
|
|
|
403
416
|
|
|
404
417
|
export async function getAccountCoinsData(args: {
|
|
405
418
|
aptosConfig: AptosConfig;
|
|
406
|
-
accountAddress:
|
|
419
|
+
accountAddress: AccountAddressInput;
|
|
407
420
|
options?: {
|
|
408
421
|
pagination?: PaginationArgs;
|
|
409
422
|
orderBy?: OrderBy<GetAccountCoinsDataResponse[0]>;
|
|
410
423
|
};
|
|
411
424
|
}): Promise<GetAccountCoinsDataResponse> {
|
|
412
425
|
const { aptosConfig, accountAddress, options } = args;
|
|
413
|
-
const address = AccountAddress.
|
|
426
|
+
const address = AccountAddress.from(accountAddress).toStringLong();
|
|
414
427
|
|
|
415
|
-
const whereCondition:
|
|
428
|
+
const whereCondition: { owner_address: { _eq: string } } = {
|
|
416
429
|
owner_address: { _eq: address },
|
|
417
430
|
};
|
|
418
431
|
|
|
@@ -437,10 +450,10 @@ export async function getAccountCoinsData(args: {
|
|
|
437
450
|
|
|
438
451
|
export async function getAccountCoinsCount(args: {
|
|
439
452
|
aptosConfig: AptosConfig;
|
|
440
|
-
accountAddress:
|
|
453
|
+
accountAddress: AccountAddressInput;
|
|
441
454
|
}): Promise<number> {
|
|
442
455
|
const { aptosConfig, accountAddress } = args;
|
|
443
|
-
const address = AccountAddress.
|
|
456
|
+
const address = AccountAddress.from(accountAddress).toStringLong();
|
|
444
457
|
|
|
445
458
|
const graphqlQuery = {
|
|
446
459
|
query: GetAccountCoinsCount,
|
|
@@ -462,16 +475,16 @@ export async function getAccountCoinsCount(args: {
|
|
|
462
475
|
|
|
463
476
|
export async function getAccountOwnedObjects(args: {
|
|
464
477
|
aptosConfig: AptosConfig;
|
|
465
|
-
accountAddress:
|
|
478
|
+
accountAddress: AccountAddressInput;
|
|
466
479
|
options?: {
|
|
467
480
|
pagination?: PaginationArgs;
|
|
468
481
|
orderBy?: OrderBy<GetAccountOwnedObjectsResponse[0]>;
|
|
469
482
|
};
|
|
470
483
|
}): Promise<GetAccountOwnedObjectsResponse> {
|
|
471
484
|
const { aptosConfig, accountAddress, options } = args;
|
|
472
|
-
const address = AccountAddress.
|
|
485
|
+
const address = AccountAddress.from(accountAddress).toStringLong();
|
|
473
486
|
|
|
474
|
-
const whereCondition:
|
|
487
|
+
const whereCondition: { owner_address: { _eq: string } } = {
|
|
475
488
|
owner_address: { _eq: address },
|
|
476
489
|
};
|
|
477
490
|
const graphqlQuery = {
|
|
@@ -492,6 +505,15 @@ export async function getAccountOwnedObjects(args: {
|
|
|
492
505
|
return data.current_objects;
|
|
493
506
|
}
|
|
494
507
|
|
|
508
|
+
/**
|
|
509
|
+
* NOTE: There is a potential issue once unified single signer scheme will be adopted
|
|
510
|
+
* by the community.
|
|
511
|
+
*
|
|
512
|
+
* Becuase on could create 2 accounts with the same private key with this new authenticator type,
|
|
513
|
+
* we’ll need to determine the order in which we lookup the accounts. First unified
|
|
514
|
+
* scheme and then legacy scheme vs first legacy scheme and then unified scheme.
|
|
515
|
+
*
|
|
516
|
+
*/
|
|
495
517
|
export async function deriveAccountFromPrivateKey(args: {
|
|
496
518
|
aptosConfig: AptosConfig;
|
|
497
519
|
privateKey: PrivateKey;
|
|
@@ -502,29 +524,29 @@ export async function deriveAccountFromPrivateKey(args: {
|
|
|
502
524
|
if (privateKey instanceof Secp256k1PrivateKey) {
|
|
503
525
|
// private key is secp256k1, therefore we know it for sure uses a single signer key
|
|
504
526
|
const authKey = AuthenticationKey.fromPublicKeyAndScheme({ publicKey, scheme: SigningScheme.SingleKey });
|
|
505
|
-
const address =
|
|
527
|
+
const address = authKey.derivedAddress();
|
|
506
528
|
return Account.fromPrivateKeyAndAddress({ privateKey, address });
|
|
507
529
|
}
|
|
508
530
|
|
|
509
531
|
if (privateKey instanceof Ed25519PrivateKey) {
|
|
510
532
|
// lookup single sender ed25519
|
|
511
|
-
const
|
|
533
|
+
const singleSenderTransactionAuthenticatorAuthKey = AuthenticationKey.fromPublicKeyAndScheme({
|
|
512
534
|
publicKey,
|
|
513
535
|
scheme: SigningScheme.SingleKey,
|
|
514
536
|
});
|
|
515
537
|
const isSingleSenderTransactionAuthenticator = await isAccountExist({
|
|
516
|
-
authKey:
|
|
538
|
+
authKey: singleSenderTransactionAuthenticatorAuthKey,
|
|
517
539
|
aptosConfig,
|
|
518
540
|
});
|
|
519
541
|
if (isSingleSenderTransactionAuthenticator) {
|
|
520
|
-
const address =
|
|
521
|
-
return Account.fromPrivateKeyAndAddress({ privateKey, address });
|
|
542
|
+
const address = singleSenderTransactionAuthenticatorAuthKey.derivedAddress();
|
|
543
|
+
return Account.fromPrivateKeyAndAddress({ privateKey, address, legacy: false });
|
|
522
544
|
}
|
|
523
545
|
// lookup legacy ed25519
|
|
524
546
|
const legacyAuthKey = AuthenticationKey.fromPublicKeyAndScheme({ publicKey, scheme: SigningScheme.Ed25519 });
|
|
525
547
|
const isLegacyEd25519 = await isAccountExist({ authKey: legacyAuthKey, aptosConfig });
|
|
526
548
|
if (isLegacyEd25519) {
|
|
527
|
-
const address =
|
|
549
|
+
const address = legacyAuthKey.derivedAddress();
|
|
528
550
|
return Account.fromPrivateKeyAndAddress({ privateKey, address, legacy: true });
|
|
529
551
|
}
|
|
530
552
|
}
|
|
@@ -537,13 +559,13 @@ export async function isAccountExist(args: { aptosConfig: AptosConfig; authKey:
|
|
|
537
559
|
const { aptosConfig, authKey } = args;
|
|
538
560
|
const accountAddress = await lookupOriginalAccountAddress({
|
|
539
561
|
aptosConfig,
|
|
540
|
-
authenticationKey: authKey.
|
|
562
|
+
authenticationKey: authKey.derivedAddress(),
|
|
541
563
|
});
|
|
542
564
|
|
|
543
565
|
try {
|
|
544
566
|
await getInfo({
|
|
545
567
|
aptosConfig,
|
|
546
|
-
accountAddress
|
|
568
|
+
accountAddress,
|
|
547
569
|
});
|
|
548
570
|
return true;
|
|
549
571
|
} catch (error: any) {
|