@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/internal/ans.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * This file contains the underlying implementations for exposed API surface in\n * the {@link api/name}. By moving the methods out into a separate file,\n * other namespaces and processes can access these methods without depending on the entire\n * name namespace and without having a dependency cycle error.\n */\n\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { MoveOption, MoveString, U64 } from \"../bcs\";\nimport { Account, AccountAddress } from \"../core\";\nimport { InputGenerateTransactionOptions, InputSingleSignerTransaction } from \"../transactions/types\";\nimport { HexInput, MoveAddressType, MoveValue } from \"../types\";\nimport { Network } from \"../utils/apiEndpoints\";\nimport { view } from \"./general\";\nimport { generateTransaction } from \"./transactionSubmission\";\n\nexport const VALIDATION_RULES_DESCRIPTION = [\n \"A name must be between 3 and 63 characters long,\",\n \"and can only contain lowercase a-z, 0-9, and hyphens.\",\n \"A name may not start or end with a hyphen.\",\n].join(\" \");\n\n/**\n *\n * @param fragment A fragment of a name, either the domain or subdomain\n * @returns boolean indicating if the fragment is a valid fragment\n */\nexport function isValidANSSegment(fragment: string): boolean {\n if (!fragment) return false;\n if (fragment.length < 3) return false;\n if (fragment.length > 63) return false;\n // only lowercase a-z and 0-9 are allowed, along with -. a domain may not start or end with a hyphen\n if (!/^[a-z\\d][a-z\\d-]{1,61}[a-z\\d]$/.test(fragment)) return false;\n return true;\n}\n\n/**\n * Checks if an ANS name is valid or not\n *\n * @param name A string of the domain name, can include or exclude the .apt suffix\n */\nexport function isValidANSName(name: string): { domainName: string; subdomainName?: string } {\n const [first, second, ...rest] = name.replace(/\\.apt$/, \"\").split(\".\");\n\n if (rest.length > 0) {\n throw new Error(`${name} is invalid. A name can only have two parts, a domain and a subdomain separated by a \".\"`);\n }\n\n if (!isValidANSSegment(first)) {\n throw new Error(`${first} is not valid. ${VALIDATION_RULES_DESCRIPTION}`);\n }\n\n if (second && !isValidANSSegment(second)) {\n throw new Error(`${second} is not valid. ${VALIDATION_RULES_DESCRIPTION}`);\n }\n\n return {\n domainName: second || first,\n subdomainName: second ? first : undefined,\n };\n}\n\nexport const LOCAL_ANS_ACCOUNT_PK =\n process.env.ANS_TEST_ACCOUNT_PRIVATE_KEY ?? \"0x37368b46ce665362562c6d1d4ec01a08c8644c488690df5a17e13ba163e20221\";\nexport const LOCAL_ANS_ACCOUNT_ADDRESS =\n process.env.ANS_TEST_ACCOUNT_ADDRESS ?? \"0x585fc9f0f0c54183b039ffc770ca282ebd87307916c215a3e692f2f8e4305e82\";\n\nconst NetworkToAnsContract: Record<Network, string | null> = {\n [Network.TESTNET]: \"0x5f8fd2347449685cf41d4db97926ec3a096eaf381332be4f1318ad4d16a8497c\",\n [Network.MAINNET]: \"0x867ed1f6bf916171b1de3ee92849b8978b7d1b9e0a8cc982a3d19d535dfd9c0c\",\n [Network.LOCAL]: LOCAL_ANS_ACCOUNT_ADDRESS,\n [Network.CUSTOM]: null,\n [Network.DEVNET]: null,\n};\n\nfunction getRouterAddress(aptosConfig: AptosConfig): string {\n const address = NetworkToAnsContract[aptosConfig.network];\n if (!address) throw new Error(`The ANS contract is not deployed to ${aptosConfig.network}`);\n return address;\n}\n\nconst Some = <T>(value: T): MoveValue => ({ vec: [value] } as any);\nconst None = (): MoveValue => ({ vec: [] } as any);\n// != here is intentional, we want to check for null and undefined\n// eslint-disable-next-line eqeqeq\nconst Option = <T>(value: T | undefined | null): MoveValue => (value != undefined ? Some(value) : None());\n\nconst unwrapOption = <T>(option: any): T | undefined => {\n if (!!option && typeof option === \"object\" && \"vec\" in option && Array.isArray(option.vec)) {\n return option.vec[0];\n }\n\n return undefined;\n};\n\nexport async function getOwnerAddress(args: { aptosConfig: AptosConfig; name: string }): Promise<string | undefined> {\n const { aptosConfig, name } = args;\n const routerAddress = getRouterAddress(aptosConfig);\n const { domainName, subdomainName } = isValidANSName(name);\n\n const res = await view({\n aptosConfig,\n payload: {\n function: `${routerAddress}::router::get_owner_addr`,\n functionArguments: [domainName, Option(subdomainName)],\n },\n });\n\n const owner = unwrapOption<MoveAddressType>(res[0]);\n\n return owner ? AccountAddress.fromRelaxed(owner).toString() : undefined;\n}\n\nexport interface RegisterNameParameters {\n aptosConfig: AptosConfig;\n sender: Account;\n name: string;\n expiration:\n | { policy: \"domain\"; years: 1 }\n | { policy: \"subdomain:follow-domain\" }\n | { policy: \"subdomain:independent\"; expirationDate: Date };\n transferable?: boolean;\n toAddress?: HexInput;\n targetAddress?: HexInput;\n options?: InputGenerateTransactionOptions;\n}\n\nexport async function registerName(args: RegisterNameParameters): Promise<InputSingleSignerTransaction> {\n const { aptosConfig, expiration, name, sender, targetAddress, toAddress, options } = args;\n const routerAddress = getRouterAddress(aptosConfig);\n const { domainName, subdomainName } = isValidANSName(name);\n\n const hasSubdomainPolicy =\n expiration.policy === \"subdomain:independent\" || expiration.policy === \"subdomain:follow-domain\";\n\n if (subdomainName && !hasSubdomainPolicy) {\n throw new Error(\n \"Subdomains must have an expiration policy of either 'subdomain:independent' or 'subdomain:follow-domain'\",\n );\n }\n\n if (hasSubdomainPolicy && !subdomainName) {\n throw new Error(`Policy is set to ${expiration.policy} but no subdomain was provided`);\n }\n\n if (expiration.policy === \"domain\") {\n if (expiration.years !== 1) {\n throw new Error(\"For now, names can only be registered for 1 year at a time\");\n }\n\n const registrationDuration = expiration.years * 31536000;\n\n const transaction = await generateTransaction({\n aptosConfig,\n sender: sender.accountAddress.toString(),\n data: {\n function: `${routerAddress}::router::register_domain`,\n functionArguments: [\n new MoveString(domainName),\n new U64(registrationDuration),\n new MoveOption(targetAddress ? AccountAddress.from(targetAddress) : null),\n new MoveOption(toAddress ? AccountAddress.from(toAddress) : null),\n ],\n },\n options,\n });\n\n return transaction as InputSingleSignerTransaction;\n }\n\n throw new Error(`Policy ${expiration.policy} is not supported yet`);\n}\n"],"mappings":"+MAmBO,IAAMA,EAA+B,CAC1C,mDACA,wDACA,4CACF,EAAE,KAAK,GAAG,EAOH,SAASC,EAAkBC,EAA2B,CAK3D,MAJI,GAACA,GACDA,EAAS,OAAS,GAClBA,EAAS,OAAS,IAElB,CAAC,iCAAiC,KAAKA,CAAQ,EAErD,CAOO,SAASC,EAAeC,EAA8D,CAC3F,GAAM,CAACC,EAAOC,KAAWC,CAAI,EAAIH,EAAK,QAAQ,SAAU,EAAE,EAAE,MAAM,GAAG,EAErE,GAAIG,EAAK,OAAS,EAChB,MAAM,IAAI,MAAM,GAAGH,2FAA8F,EAGnH,GAAI,CAACH,EAAkBI,CAAK,EAC1B,MAAM,IAAI,MAAM,GAAGA,mBAAuBL,GAA8B,EAG1E,GAAIM,GAAU,CAACL,EAAkBK,CAAM,EACrC,MAAM,IAAI,MAAM,GAAGA,mBAAwBN,GAA8B,EAG3E,MAAO,CACL,WAAYM,GAAUD,EACtB,cAAeC,EAASD,EAAQ,MAClC,CACF,CAEO,IAAMG,EACX,qEACWC,EACX,qEAEIC,EAAuD,CAC3D,YAAmB,qEACnB,YAAmB,qEACnB,UAAiBD,EACjB,WAAkB,KAClB,WAAkB,IACpB,EAEA,SAASE,EAAiBC,EAAkC,CAC1D,IAAMC,EAAUH,EAAqBE,EAAY,SACjD,GAAI,CAACC,EAAS,MAAM,IAAI,MAAM,uCAAuCD,EAAY,SAAS,EAC1F,OAAOC,CACT,CAEA,IAAMC,EAAWC,IAAyB,CAAE,IAAK,CAACA,CAAK,CAAE,GACnDC,EAAO,KAAkB,CAAE,IAAK,CAAC,CAAE,GAGnCC,EAAaF,GAA4CA,GAAS,KAAYD,EAAKC,CAAK,EAAIC,EAAK,EAEjGE,EAAmBC,GAA+B,CACtD,GAAI,CAAC,CAACA,GAAU,OAAOA,GAAW,UAAY,QAASA,GAAU,MAAM,QAAQA,EAAO,GAAG,EACvF,OAAOA,EAAO,IAAI,EAItB,EAEA,eAAsBC,EAAgBC,EAA+E,CACnH,GAAM,CAAE,YAAAT,EAAa,KAAAR,CAAK,EAAIiB,EACxBC,EAAgBX,EAAiBC,CAAW,EAC5C,CAAE,WAAAW,EAAY,cAAAC,CAAc,EAAIrB,EAAeC,CAAI,EAEnDqB,EAAM,MAAMC,EAAK,CACrB,YAAAd,EACA,QAAS,CACP,SAAU,GAAGU,4BACb,kBAAmB,CAACC,EAAYN,EAAOO,CAAa,CAAC,CACvD,CACF,CAAC,EAEKG,EAAQT,EAA8BO,EAAI,EAAE,EAElD,OAAOE,EAAQC,EAAe,YAAYD,CAAK,EAAE,SAAS,EAAI,MAChE,CAgBA,eAAsBE,EAAaR,EAAqE,CACtG,GAAM,CAAE,YAAAT,EAAa,WAAAkB,EAAY,KAAA1B,EAAM,OAAA2B,EAAQ,cAAAC,EAAe,UAAAC,EAAW,QAAAC,CAAQ,EAAIb,EAC/EC,EAAgBX,EAAiBC,CAAW,EAC5C,CAAE,WAAAW,EAAY,cAAAC,CAAc,EAAIrB,EAAeC,CAAI,EAEnD+B,EACJL,EAAW,SAAW,yBAA2BA,EAAW,SAAW,0BAEzE,GAAIN,GAAiB,CAACW,EACpB,MAAM,IAAI,MACR,0GACF,EAGF,GAAIA,GAAsB,CAACX,EACzB,MAAM,IAAI,MAAM,oBAAoBM,EAAW,sCAAsC,EAGvF,GAAIA,EAAW,SAAW,SAAU,CAClC,GAAIA,EAAW,QAAU,EACvB,MAAM,IAAI,MAAM,4DAA4D,EAG9E,IAAMM,EAAuBN,EAAW,MAAQ,QAiBhD,OAfoB,MAAMO,EAAoB,CAC5C,YAAAzB,EACA,OAAQmB,EAAO,eAAe,SAAS,EACvC,KAAM,CACJ,SAAU,GAAGT,6BACb,kBAAmB,CACjB,IAAIgB,EAAWf,CAAU,EACzB,IAAIgB,EAAIH,CAAoB,EAC5B,IAAII,EAAWR,EAAgBJ,EAAe,KAAKI,CAAa,EAAI,IAAI,EACxE,IAAIQ,EAAWP,EAAYL,EAAe,KAAKK,CAAS,EAAI,IAAI,CAClE,CACF,EACA,QAAAC,CACF,CAAC,CAGH,CAEA,MAAM,IAAI,MAAM,UAAUJ,EAAW,6BAA6B,CACpE","names":["VALIDATION_RULES_DESCRIPTION","isValidANSSegment","fragment","isValidANSName","name","first","second","rest","LOCAL_ANS_ACCOUNT_PK","LOCAL_ANS_ACCOUNT_ADDRESS","NetworkToAnsContract","getRouterAddress","aptosConfig","address","Some","value","None","Option","unwrapOption","option","getOwnerAddress","args","routerAddress","domainName","subdomainName","res","view","owner","AccountAddress","registerName","expiration","sender","targetAddress","toAddress","options","hasSubdomainPolicy","registrationDuration","generateTransaction","MoveString","U64","MoveOption"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as l,c as h}from"./chunk-BIUGRAMO.mjs";import{a as g,c as p}from"./chunk-E72CFUU4.mjs";import{b as y}from"./chunk-IZHPCZE3.mjs";var o=class extends g{constructor(e){super();let{publicKeys:t,threshold:r}=e;if(t.length>o.MAX_KEYS||t.length<o.MIN_KEYS)throw new Error(`Must have between ${o.MIN_KEYS} and ${o.MAX_KEYS} public keys, inclusive`);if(r<o.MIN_THRESHOLD||r>t.length)throw new Error(`Threshold must be between ${o.MIN_THRESHOLD} and ${t.length}, inclusive`);this.publicKeys=t,this.threshold=r}toUint8Array(){let e=new Uint8Array(this.publicKeys.length*l.LENGTH+1);return this.publicKeys.forEach((t,r)=>{e.set(t.toUint8Array(),r*l.LENGTH)}),e[this.publicKeys.length*l.LENGTH]=this.threshold,e}toString(){return y.fromHexInput(this.toUint8Array()).toString()}verifySignature(e){throw new Error("TODO - Method not implemented.")}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let t=e.deserializeBytes(),r=t[t.length-1],a=[];for(let n=0;n<t.length-1;n+=l.LENGTH){let i=n;a.push(new l(t.subarray(i,i+l.LENGTH)))}return new o({publicKeys:a,threshold:r})}},u=o;u.MAX_KEYS=32,u.MIN_KEYS=2,u.MIN_THRESHOLD=1;var s=class extends p{constructor(e){super();let{signatures:t,bitmap:r}=e;if(r.length!==s.BITMAP_LEN)throw new Error(`"bitmap" length should be ${s.BITMAP_LEN}`);if(t.length>s.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${s.MAX_SIGNATURES_SUPPORTED}`);this.signatures=t,this.bitmap=r}toUint8Array(){let e=new Uint8Array(this.signatures.length*h.LENGTH+s.BITMAP_LEN);return this.signatures.forEach((t,r)=>{e.set(t.toUint8Array(),r*h.LENGTH)}),e.set(this.bitmap,this.signatures.length*h.LENGTH),e}toString(){return y.fromHexInput(this.toUint8Array()).toString()}static createBitmap(e){let{bits:t}=e,r=128,a=new Uint8Array([0,0,0,0]),n=new Set;return t.forEach(i=>{if(i>=s.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${s.MAX_SIGNATURES_SUPPORTED-1}.`);if(n.has(i))throw new Error("Duplicate bits detected.");n.add(i);let E=Math.floor(i/8),b=a[E];b|=r>>i%8,a[E]=b}),a}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let t=e.deserializeBytes(),r=t.subarray(t.length-4),a=[];for(let n=0;n<t.length-r.length;n+=h.LENGTH){let i=n;a.push(new h(t.subarray(i,i+h.LENGTH)))}return new s({signatures:a,bitmap:r})}},c=s;c.MAX_SIGNATURES_SUPPORTED=32,c.BITMAP_LEN=4;export{u as a,c as b};
|
|
2
|
+
//# sourceMappingURL=chunk-FNB6CFQR.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/core/crypto/multiEd25519.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { PublicKey, Signature } from \"./asymmetricCrypto\";\nimport { Deserializer } from \"../../bcs/deserializer\";\nimport { Serializer } from \"../../bcs/serializer\";\nimport { Ed25519PublicKey, Ed25519Signature } from \"./ed25519\";\nimport { Hex } from \"../hex\";\nimport { HexInput } from \"../../types\";\n\n/**\n * Represents the public key of a K-of-N Ed25519 multi-sig transaction.\n */\nexport class MultiEd25519PublicKey extends PublicKey {\n /**\n * Maximum number of public keys supported\n */\n static readonly MAX_KEYS = 32;\n\n /**\n * Minimum number of public keys needed\n */\n static readonly MIN_KEYS = 2;\n\n /**\n * Minimum threshold for the number of valid signatures required\n */\n static readonly MIN_THRESHOLD = 1;\n\n /**\n * List of Ed25519 public keys for this MultiEd25519PublicKey\n */\n public readonly publicKeys: Ed25519PublicKey[];\n\n /**\n * The minimum number of valid signatures required, for the number of public keys specified\n */\n public readonly threshold: number;\n\n /**\n * Public key for a K-of-N multi-sig transaction. A K-of-N multi-sig transaction means that for such a\n * transaction to be executed, at least K out of the N authorized signers have signed the transaction\n * and passed the check conducted by the chain.\n *\n * @see {@link\n * https://aptos.dev/integration/creating-a-signed-transaction/ | Creating a Signed Transaction}\n *\n * @param args.publicKeys A list of public keys\n * @param args.threshold At least \"threshold\" signatures must be valid\n */\n constructor(args: { publicKeys: Ed25519PublicKey[]; threshold: number }) {\n super();\n\n const { publicKeys, threshold } = args;\n\n // Validate number of public keys\n if (publicKeys.length > MultiEd25519PublicKey.MAX_KEYS || publicKeys.length < MultiEd25519PublicKey.MIN_KEYS) {\n throw new Error(\n `Must have between ${MultiEd25519PublicKey.MIN_KEYS} and ${MultiEd25519PublicKey.MAX_KEYS} public keys, inclusive`,\n );\n }\n\n // Validate threshold: must be between 1 and the number of public keys, inclusive\n if (threshold < MultiEd25519PublicKey.MIN_THRESHOLD || threshold > publicKeys.length) {\n throw new Error(\n `Threshold must be between ${MultiEd25519PublicKey.MIN_THRESHOLD} and ${publicKeys.length}, inclusive`,\n );\n }\n\n this.publicKeys = publicKeys;\n this.threshold = threshold;\n }\n\n /**\n * Converts a PublicKeys into Uint8Array (bytes) with: bytes = p1_bytes | ... | pn_bytes | threshold\n */\n toUint8Array(): Uint8Array {\n const bytes = new Uint8Array(this.publicKeys.length * Ed25519PublicKey.LENGTH + 1);\n this.publicKeys.forEach((k: Ed25519PublicKey, i: number) => {\n bytes.set(k.toUint8Array(), i * Ed25519PublicKey.LENGTH);\n });\n\n bytes[this.publicKeys.length * Ed25519PublicKey.LENGTH] = this.threshold;\n\n return bytes;\n }\n\n toString(): string {\n return Hex.fromHexInput(this.toUint8Array()).toString();\n }\n\n // eslint-disable-next-line class-methods-use-this, @typescript-eslint/no-unused-vars\n verifySignature(args: { message: HexInput; signature: MultiEd25519Signature }): boolean {\n throw new Error(\"TODO - Method not implemented.\");\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeBytes(this.toUint8Array());\n }\n\n static deserialize(deserializer: Deserializer): MultiEd25519PublicKey {\n const bytes = deserializer.deserializeBytes();\n const threshold = bytes[bytes.length - 1];\n\n const keys: Ed25519PublicKey[] = [];\n\n for (let i = 0; i < bytes.length - 1; i += Ed25519PublicKey.LENGTH) {\n const begin = i;\n keys.push(new Ed25519PublicKey(bytes.subarray(begin, begin + Ed25519PublicKey.LENGTH)));\n }\n return new MultiEd25519PublicKey({ publicKeys: keys, threshold });\n }\n}\n\n/**\n * Represents the signature of a K-of-N Ed25519 multi-sig transaction.\n */\nexport class MultiEd25519Signature extends Signature {\n /**\n * Maximum number of Ed25519 signatures supported\n */\n static MAX_SIGNATURES_SUPPORTED = 32;\n\n /**\n * Number of bytes in the bitmap representing who signed the transaction (32-bits)\n */\n static BITMAP_LEN: number = 4;\n\n /**\n * The list of underlying Ed25519 signatures\n */\n public readonly signatures: Ed25519Signature[];\n\n /**\n * 32-bit Bitmap representing who signed the transaction\n *\n * This is represented where each public key can be masked to determine whether the message was signed by that key.\n */\n public readonly bitmap: Uint8Array;\n\n /**\n * Signature for a K-of-N multi-sig transaction.\n *\n * @see {@link\n * https://aptos.dev/integration/creating-a-signed-transaction/#multisignature-transactions | Creating a Signed Transaction}\n *\n * @param args.signatures A list of signatures\n * @param args.bitmap 4 bytes, at most 32 signatures are supported. If Nth bit value is `1`, the Nth\n * signature should be provided in `signatures`. Bits are read from left to right\n */\n constructor(args: { signatures: Ed25519Signature[]; bitmap: Uint8Array }) {\n super();\n\n const { signatures, bitmap } = args;\n if (bitmap.length !== MultiEd25519Signature.BITMAP_LEN) {\n throw new Error(`\"bitmap\" length should be ${MultiEd25519Signature.BITMAP_LEN}`);\n }\n\n if (signatures.length > MultiEd25519Signature.MAX_SIGNATURES_SUPPORTED) {\n throw new Error(\n `The number of signatures cannot be greater than ${MultiEd25519Signature.MAX_SIGNATURES_SUPPORTED}`,\n );\n }\n\n this.signatures = signatures;\n this.bitmap = bitmap;\n }\n\n /**\n * Converts a MultiSignature into Uint8Array (bytes) with `bytes = s1_bytes | ... | sn_bytes | bitmap`\n */\n toUint8Array(): Uint8Array {\n const bytes = new Uint8Array(this.signatures.length * Ed25519Signature.LENGTH + MultiEd25519Signature.BITMAP_LEN);\n this.signatures.forEach((k: Ed25519Signature, i: number) => {\n bytes.set(k.toUint8Array(), i * Ed25519Signature.LENGTH);\n });\n\n bytes.set(this.bitmap, this.signatures.length * Ed25519Signature.LENGTH);\n\n return bytes;\n }\n\n toString(): string {\n return Hex.fromHexInput(this.toUint8Array()).toString();\n }\n\n /**\n * Helper method to create a bitmap out of the specified bit positions\n * @param args.bits The bitmap positions that should be set. A position starts at index 0.\n * Valid position should range between 0 and 31.\n * @example\n * Here's an example of valid `bits`\n * ```\n * [0, 2, 31]\n * ```\n * `[0, 2, 31]` means the 1st, 3rd and 32nd bits should be set in the bitmap.\n * The result bitmap should be 0b1010000000000000000000000000001\n *\n * @returns bitmap that is 32bit long\n */\n static createBitmap(args: { bits: number[] }): Uint8Array {\n const { bits } = args;\n // Bits are read from left to right. e.g. 0b10000000 represents the first bit is set in one byte.\n // The decimal value of 0b10000000 is 128.\n const firstBitInByte = 128;\n const bitmap = new Uint8Array([0, 0, 0, 0]);\n\n // Check if duplicates exist in bits\n const dupCheckSet = new Set();\n\n bits.forEach((bit: number) => {\n if (bit >= MultiEd25519Signature.MAX_SIGNATURES_SUPPORTED) {\n throw new Error(`Cannot have a signature larger than ${MultiEd25519Signature.MAX_SIGNATURES_SUPPORTED - 1}.`);\n }\n\n if (dupCheckSet.has(bit)) {\n throw new Error(\"Duplicate bits detected.\");\n }\n\n dupCheckSet.add(bit);\n\n const byteOffset = Math.floor(bit / 8);\n\n let byte = bitmap[byteOffset];\n\n // eslint-disable-next-line no-bitwise\n byte |= firstBitInByte >> bit % 8;\n\n bitmap[byteOffset] = byte;\n });\n\n return bitmap;\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeBytes(this.toUint8Array());\n }\n\n static deserialize(deserializer: Deserializer): MultiEd25519Signature {\n const bytes = deserializer.deserializeBytes();\n const bitmap = bytes.subarray(bytes.length - 4);\n\n const signatures: Ed25519Signature[] = [];\n\n for (let i = 0; i < bytes.length - bitmap.length; i += Ed25519Signature.LENGTH) {\n const begin = i;\n signatures.push(new Ed25519Signature(bytes.subarray(begin, begin + Ed25519Signature.LENGTH)));\n }\n return new MultiEd25519Signature({ signatures, bitmap });\n }\n}\n"],"mappings":"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","names":["_MultiEd25519PublicKey","PublicKey","args","publicKeys","threshold","bytes","Ed25519PublicKey","k","i","Hex","serializer","deserializer","keys","begin","MultiEd25519PublicKey","_MultiEd25519Signature","Signature","signatures","bitmap","Ed25519Signature","bits","firstBitInByte","dupCheckSet","bit","byteOffset","byte","MultiEd25519Signature"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/version.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * The current version of the SDK\n *\n * hardcoded for now, we would want to have it injected dynamically\n */\nexport const VERSION = \"0.0.4\";\n"],"mappings":"AAQO,IAAMA,EAAU","names":["VERSION"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=chunk-FZY4PMEE.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var i=(o=>(o.JSON="application/json",o.BCS="application/x-bcs",o.BCS_SIGNED_TRANSACTION="application/x.aptos.signed_transaction+bcs",o))(i||{}),p=(t=>(t[t.Bool=0]="Bool",t[t.U8=1]="U8",t[t.U64=2]="U64",t[t.U128=3]="U128",t[t.Address=4]="Address",t[t.Signer=5]="Signer",t[t.Vector=6]="Vector",t[t.Struct=7]="Struct",t[t.U16=8]="U16",t[t.U32=9]="U32",t[t.U256=10]="U256",t[t.Reference=254]="Reference",t[t.Generic=255]="Generic",t))(p||{}),y=(n=>(n[n.U8=0]="U8",n[n.U64=1]="U64",n[n.U128=2]="U128",n[n.Address=3]="Address",n[n.U8Vector=4]="U8Vector",n[n.Bool=5]="Bool",n[n.U16=6]="U16",n[n.U32=7]="U32",n[n.U256=8]="U256",n))(y||{}),g=(o=>(o[o.Script=0]="Script",o[o.EntryFunction=2]="EntryFunction",o[o.Multisig=3]="Multisig",o))(g||{}),a=(r=>(r[r.MultiAgentTransaction=0]="MultiAgentTransaction",r[r.FeePayerTransaction=1]="FeePayerTransaction",r))(a||{}),u=(e=>(e[e.Ed25519=0]="Ed25519",e[e.MultiEd25519=1]="MultiEd25519",e[e.MultiAgent=2]="MultiAgent",e[e.FeePayer=3]="FeePayer",e[e.SingleSender=4]="SingleSender",e))(u||{}),d=(s=>(s[s.Ed25519=0]="Ed25519",s[s.MultiEd25519=1]="MultiEd25519",s[s.SingleKey=2]="SingleKey",s[s.MultiKey=3]="MultiKey",s))(d||{}),c=(r=>(r[r.Ed25519=0]="Ed25519",r[r.Secp256k1=1]="Secp256k1",r))(c||{}),l=(r=>(r[r.Ed25519=0]="Ed25519",r[r.Secp256k1=1]="Secp256k1",r))(l||{}),_=(e=>(e.Pending="pending_transaction",e.User="user_transaction",e.Genesis="genesis_transaction",e.BlockMetadata="block_metadata_transaction",e.StateCheckpoint="state_checkpoint_transaction",e))(_||{}),x=(o=>(o.PRIVATE="private",o.PUBLIC="public",o.FRIEND="friend",o))(x||{}),v=(s=>(s.STORE="store",s.DROP="drop",s.KEY="key",s.COPY="copy",s))(v||{}),M=(r=>(r.VALIDATOR="validator",r.FULL_NODE="full_node",r))(M||{}),h=(s=>(s[s.Ed25519=0]="Ed25519",s[s.MultiEd25519=1]="MultiEd25519",s[s.SingleKey=2]="SingleKey",s[s.MultiKey=3]="MultiKey",s))(h||{}),m=(r=>(r[r.Ed25519=0]="Ed25519",r[r.Secp256k1Ecdsa=2]="Secp256k1Ecdsa",r))(m||{}),b=(e=>(e[e.DeriveAuid=251]="DeriveAuid",e[e.DeriveObjectAddressFromObject=252]="DeriveObjectAddressFromObject",e[e.DeriveObjectAddressFromGuid=253]="DeriveObjectAddressFromGuid",e[e.DeriveObjectAddressFromSeed=254]="DeriveObjectAddressFromSeed",e[e.DeriveResourceAccountAddress=255]="DeriveResourceAccountAddress",e))(b||{});export{i as a,p as b,y as c,g as d,a as e,u as f,d as g,c as h,l as i,_ as j,x as k,v as l,M as m,h as n,m as o,b as p};
|
|
2
|
+
//# sourceMappingURL=chunk-GUT3G5CG.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/types/index.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Network } from \"../utils/apiEndpoints\";\n\nexport * from \"./indexer\";\n\nexport enum MimeType {\n /**\n * JSON representation, used for transaction submission and accept type JSON output\n */\n JSON = \"application/json\",\n /**\n * BCS representation, used for accept type BCS output\n */\n BCS = \"application/x-bcs\",\n /**\n * BCS representation, used for transaction submission in BCS input\n */\n BCS_SIGNED_TRANSACTION = \"application/x.aptos.signed_transaction+bcs\",\n}\n\n/**\n * Hex data as input to a function\n */\nexport type HexInput = string | Uint8Array;\n\n/**\n * TypeTag enum as they are represented in Rust\n * {@link https://github.com/aptos-labs/aptos-core/blob/main/third_party/move/move-core/types/src/language_storage.rs#L27}\n */\nexport enum TypeTagVariants {\n Bool = 0,\n U8 = 1,\n U64 = 2,\n U128 = 3,\n Address = 4,\n Signer = 5,\n Vector = 6,\n Struct = 7,\n U16 = 8,\n U32 = 9,\n U256 = 10,\n Reference = 254, // This is specifically a placeholder and does not represent a real type\n Generic = 255, // This is specifically a placeholder and does not represent a real type\n}\n\n/**\n * Script transaction arguments enum as they are represented in Rust\n * {@link https://github.com/aptos-labs/aptos-core/blob/main/third_party/move/move-core/types/src/transaction_argument.rs#L11}\n */\nexport enum ScriptTransactionArgumentVariants {\n U8 = 0,\n U64 = 1,\n U128 = 2,\n Address = 3,\n U8Vector = 4,\n Bool = 5,\n U16 = 6,\n U32 = 7,\n U256 = 8,\n}\n\n/**\n * Transaction payload enum as they are represented in Rust\n * {@link https://github.com/aptos-labs/aptos-core/blob/main/types/src/transaction/mod.rs#L478}\n */\nexport enum TransactionPayloadVariants {\n Script = 0,\n EntryFunction = 2,\n Multisig = 3,\n}\n\n/**\n * Transaction variants enum as they are represented in Rust\n * {@link https://github.com/aptos-labs/aptos-core/blob/main/types/src/transaction/mod.rs#L440}\n */\nexport enum TransactionVariants {\n MultiAgentTransaction = 0,\n FeePayerTransaction = 1,\n}\n\n/**\n * Transaction Authenticator enum as they are represented in Rust\n * {@link https://github.com/aptos-labs/aptos-core/blob/main/types/src/transaction/authenticator.rs#L44}\n */\nexport enum TransactionAuthenticatorVariant {\n Ed25519 = 0,\n MultiEd25519 = 1,\n MultiAgent = 2,\n FeePayer = 3,\n SingleSender = 4,\n}\n\n/**\n * Transaction Authenticator enum as they are represented in Rust\n * {@link https://github.com/aptos-labs/aptos-core/blob/main/types/src/transaction/authenticator.rs#L414}\n */\nexport enum AccountAuthenticatorVariant {\n Ed25519 = 0,\n MultiEd25519 = 1,\n SingleKey = 2,\n MultiKey = 3,\n}\n\nexport enum AnyPublicKeyVariant {\n Ed25519 = 0,\n Secp256k1 = 1,\n}\n\nexport enum AnySignatureVariant {\n Ed25519 = 0,\n Secp256k1 = 1,\n}\n\n/**\n * BCS types\n */\nexport type Uint8 = number;\nexport type Uint16 = number;\nexport type Uint32 = number;\nexport type Uint64 = bigint;\nexport type Uint128 = bigint;\nexport type Uint256 = bigint;\nexport type AnyNumber = number | bigint;\n\n/**\n * Set of configuration options that can be provided when initializing the SDK.\n * The purpose of these options is to configure various aspects of the SDK's\n * behavior and interaction with the Aptos network\n */\nexport type AptosSettings = {\n readonly network?: Network;\n\n readonly fullnode?: string;\n\n readonly faucet?: string;\n\n readonly indexer?: string;\n\n readonly clientConfig?: ClientConfig;\n\n readonly client?: Client;\n};\n\n/**\n *\n * Controls the number of results that are returned and the starting position of those results.\n * @param offset parameter specifies the starting position of the query result within the set of data. Default is 0.\n * @param limit specifies the maximum number of items or records to return in a query result. Default is 25.\n */\nexport interface PaginationArgs {\n offset?: AnyNumber;\n limit?: number;\n}\n\n/**\n * QUERY TYPES\n */\n\n/**\n * A configuration object we can pass with the request to the server.\n *\n * @param AUTH_TOKEN - an auth token to send with a faucet request\n * @param API_KEY - api key generated from developer portal {@link https://developers.aptoslabs.com/manage/api-keys}}\n * @param HEADERS - extra headers we want to send with the request\n * @param WITH_CREDENTIALS - whether to carry cookies. By default, it is set to true and cookies will be sent\n */\nexport type ClientConfig = {\n AUTH_TOKEN?: string;\n API_KEY?: string;\n HEADERS?: Record<string, string | number | boolean>;\n WITH_CREDENTIALS?: boolean;\n};\n\nexport interface ClientRequest<Req> {\n url: string;\n method: \"GET\" | \"POST\";\n body?: Req;\n contentType?: string;\n params?: any;\n overrides?: ClientConfig;\n headers?: Record<string, any>;\n}\n\nexport interface ClientResponse<Res> {\n status: number;\n statusText: string;\n data: Res;\n config?: any;\n request?: any;\n response?: any;\n headers?: any;\n}\n\nexport interface Client {\n provider<Req, Res>(requestOptions: ClientRequest<Req>): Promise<ClientResponse<Res>>;\n}\n\n/**\n * The API request type\n *\n * @param url - the url to make the request to, i.e https://fullnode.aptoslabs.devnet.com/v1\n * @param method - the request method \"GET\" | \"POST\"\n * @param endpoint (optional) - the endpoint to make the request to, i.e transactions\n * @param body (optional) - the body of the request\n * @param contentType (optional) - the content type to set the `content-type` header to,\n * by default is set to `application/json`\n * @param params (optional) - query params to add to the request\n * @param originMethod (optional) - the local method the request came from\n * @param overrides (optional) - a `ClientConfig` object type to override request data\n */\nexport type AptosRequest = {\n url: string;\n method: \"GET\" | \"POST\";\n path?: string;\n body?: any;\n contentType?: string;\n acceptType?: string;\n params?: Record<string, string | AnyNumber | boolean | undefined>;\n originMethod?: string;\n overrides?: ClientConfig;\n};\n\n/**\n * Specifies ledger version of transactions. By default latest version will be used\n */\nexport type LedgerVersion = {\n ledgerVersion?: AnyNumber;\n};\n\n/**\n * RESPONSE TYPES\n */\n\n/**\n * Type holding the outputs of the estimate gas API\n */\nexport type GasEstimation = {\n /**\n * The deprioritized estimate for the gas unit price\n */\n deprioritized_gas_estimate?: number;\n /**\n * The current estimate for the gas unit price\n */\n gas_estimate: number;\n /**\n * The prioritized estimate for the gas unit price\n */\n prioritized_gas_estimate?: number;\n};\n\nexport type MoveResource = {\n type: MoveStructType;\n data: {};\n};\n\nexport type AccountData = {\n sequence_number: string;\n authentication_key: string;\n};\n\nexport type MoveModuleBytecode = {\n bytecode: string;\n abi?: MoveModule;\n};\n\n/**\n * TRANSACTION TYPES\n */\n\nexport enum TransactionResponseType {\n Pending = \"pending_transaction\",\n User = \"user_transaction\",\n Genesis = \"genesis_transaction\",\n BlockMetadata = \"block_metadata_transaction\",\n StateCheckpoint = \"state_checkpoint_transaction\",\n}\n\nexport type TransactionResponse =\n | PendingTransactionResponse\n | UserTransactionResponse\n | GenesisTransactionResponse\n | BlockMetadataTransactionResponse\n | StateCheckpointTransactionResponse;\n\nexport type PendingTransactionResponse = {\n type: TransactionResponseType.Pending;\n hash: string;\n sender: string;\n sequence_number: string;\n max_gas_amount: string;\n gas_unit_price: string;\n expiration_timestamp_secs: string;\n payload: TransactionPayloadResponse;\n signature?: TransactionSignature;\n};\n\nexport type UserTransactionResponse = {\n type: TransactionResponseType.User;\n version: string;\n hash: string;\n state_change_hash: string;\n event_root_hash: string;\n state_checkpoint_hash?: string;\n gas_used: string;\n /**\n * Whether the transaction was successful\n */\n success: boolean;\n /**\n * The VM status of the transaction, can tell useful information in a failure\n */\n vm_status: string;\n accumulator_root_hash: string;\n /**\n * Final state of resources changed by the transaction\n */\n changes: Array<WriteSetChange>;\n sender: string;\n sequence_number: string;\n max_gas_amount: string;\n gas_unit_price: string;\n expiration_timestamp_secs: string;\n payload: TransactionPayloadResponse;\n signature?: TransactionSignature;\n /**\n * Events generated by the transaction\n */\n events: Array<Event>;\n timestamp: string;\n};\n\nexport type GenesisTransactionResponse = {\n type: TransactionResponseType.Genesis;\n version: string;\n hash: string;\n state_change_hash: string;\n event_root_hash: string;\n state_checkpoint_hash?: string;\n gas_used: string;\n /**\n * Whether the transaction was successful\n */\n success: boolean;\n /**\n * The VM status of the transaction, can tell useful information in a failure\n */\n vm_status: string;\n accumulator_root_hash: string;\n /**\n * Final state of resources changed by the transaction\n */\n changes: Array<WriteSetChange>;\n payload: GenesisPayload;\n /**\n * Events emitted during genesis\n */\n events: Array<Event>;\n};\n\nexport type BlockMetadataTransactionResponse = {\n type: TransactionResponseType.BlockMetadata;\n version: string;\n hash: string;\n state_change_hash: string;\n event_root_hash: string;\n state_checkpoint_hash?: string;\n gas_used: string;\n /**\n * Whether the transaction was successful\n */\n success: boolean;\n /**\n * The VM status of the transaction, can tell useful information in a failure\n */\n vm_status: string;\n accumulator_root_hash: string;\n /**\n * Final state of resources changed by the transaction\n */\n changes: Array<WriteSetChange>;\n id: string;\n epoch: string;\n round: string;\n /**\n * The events emitted at the block creation\n */\n events: Array<Event>;\n /**\n * Previous block votes\n */\n previous_block_votes_bitvec: Array<number>;\n proposer: string;\n /**\n * The indices of the proposers who failed to propose\n */\n failed_proposer_indices: Array<number>;\n timestamp: string;\n};\n\nexport type StateCheckpointTransactionResponse = {\n type: TransactionResponseType.StateCheckpoint;\n version: string;\n hash: string;\n state_change_hash: string;\n event_root_hash: string;\n state_checkpoint_hash?: string;\n gas_used: string;\n /**\n * Whether the transaction was successful\n */\n success: boolean;\n /**\n * The VM status of the transaction, can tell useful information in a failure\n */\n vm_status: string;\n accumulator_root_hash: string;\n /**\n * Final state of resources changed by the transaction\n */\n changes: Array<WriteSetChange>;\n timestamp: string;\n};\n\n/**\n * WRITESET CHANGE TYPES\n */\n\nexport type WriteSetChange =\n | WriteSetChangeDeleteModule\n | WriteSetChangeDeleteResource\n | WriteSetChangeDeleteTableItem\n | WriteSetChangeWriteModule\n | WriteSetChangeWriteResource\n | WriteSetChangeWriteTableItem;\n\nexport type WriteSetChangeDeleteModule = {\n type: string;\n address: string;\n /**\n * State key hash\n */\n state_key_hash: string;\n module: MoveModuleId;\n};\n\nexport type WriteSetChangeDeleteResource = {\n type: string;\n address: string;\n state_key_hash: string;\n resource: string;\n};\n\nexport type WriteSetChangeDeleteTableItem = {\n type: string;\n state_key_hash: string;\n handle: string;\n key: string;\n data?: DeletedTableData;\n};\n\nexport type WriteSetChangeWriteModule = {\n type: string;\n address: string;\n state_key_hash: string;\n data: MoveModuleBytecode;\n};\n\nexport type WriteSetChangeWriteResource = {\n type: string;\n address: string;\n state_key_hash: string;\n data: MoveResource;\n};\n\nexport type WriteSetChangeWriteTableItem = {\n type: string;\n state_key_hash: string;\n handle: string;\n key: string;\n value: string;\n data?: DecodedTableData;\n};\n\nexport type DecodedTableData = {\n /**\n * Key of table in JSON\n */\n key: any;\n /**\n * Type of key\n */\n key_type: string;\n /**\n * Value of table in JSON\n */\n value: any;\n /**\n * Type of value\n */\n value_type: string;\n};\n\n/**\n * Deleted table data\n */\nexport type DeletedTableData = {\n /**\n * Deleted key\n */\n key: any;\n /**\n * Deleted key type\n */\n key_type: string;\n};\n\nexport type TransactionPayloadResponse = EntryFunctionPayloadResponse | ScriptPayloadResponse | MultisigPayloadResponse;\n\nexport type EntryFunctionPayloadResponse = {\n type: string;\n function: MoveStructType;\n /**\n * Type arguments of the function\n */\n type_arguments: Array<string>;\n /**\n * Arguments of the function\n */\n arguments: Array<any>;\n};\n\nexport type ScriptPayloadResponse = {\n type: string;\n code: MoveScriptBytecode;\n /**\n * Type arguments of the function\n */\n type_arguments: Array<string>;\n /**\n * Arguments of the function\n */\n arguments: Array<any>;\n};\n\nexport type MultisigPayloadResponse = {\n type: string;\n multisig_address: string;\n transaction_payload?: EntryFunctionPayloadResponse;\n};\n\nexport type GenesisPayload = {\n type: string;\n write_set: WriteSet;\n};\n\n/**\n * Move script bytecode\n */\nexport type MoveScriptBytecode = {\n bytecode: string;\n abi?: MoveFunction;\n};\n\n/**\n * These are the JSON representations of transaction signatures returned from the node API.\n */\nexport type TransactionSignature =\n | TransactionEd25519Signature\n | TransactionSecp256k1Signature\n | TransactionMultiEd25519Signature\n | TransactionMultiAgentSignature\n | TransactionFeePayerSignature;\n\nexport type TransactionEd25519Signature = {\n type: string;\n public_key: string;\n signature: \"ed25519_signature\";\n};\n\nexport type TransactionSecp256k1Signature = {\n type: string;\n public_key: string;\n signature: \"secp256k1_ecdsa_signature\";\n};\n\nexport type TransactionMultiEd25519Signature = {\n type: \"multi_ed25519_signature\";\n /**\n * The public keys for the Ed25519 signature\n */\n public_keys: Array<string>;\n /**\n * Signature associated with the public keys in the same order\n */\n signatures: Array<string>;\n /**\n * The number of signatures required for a successful transaction\n */\n threshold: number;\n bitmap: string;\n};\n\nexport type TransactionMultiAgentSignature = {\n type: \"multi_agent_signature\";\n sender: AccountSignature;\n /**\n * The other involved parties' addresses\n */\n secondary_signer_addresses: Array<string>;\n /**\n * The associated signatures, in the same order as the secondary addresses\n */\n secondary_signers: Array<AccountSignature>;\n};\n\nexport type TransactionFeePayerSignature = {\n type: \"fee_payer_signature\";\n sender: AccountSignature;\n /**\n * The other involved parties' addresses\n */\n secondary_signer_addresses: Array<string>;\n /**\n * The associated signatures, in the same order as the secondary addresses\n */\n secondary_signers: Array<AccountSignature>;\n fee_payer_address: string;\n fee_payer_signer: AccountSignature;\n};\n\n/**\n * The union of all single account signatures.\n */\nexport type AccountSignature = AccountEd25519Signature | AccountSecp256k1Signature | AccountMultiEd25519Signature;\n\nexport type AccountEd25519Signature = TransactionEd25519Signature;\n\nexport type AccountSecp256k1Signature = TransactionSecp256k1Signature;\n\nexport type AccountMultiEd25519Signature = TransactionMultiEd25519Signature;\n\nexport type WriteSet = ScriptWriteSet | DirectWriteSet;\n\nexport type ScriptWriteSet = {\n type: string;\n execute_as: string;\n script: ScriptPayloadResponse;\n};\n\nexport type DirectWriteSet = {\n type: string;\n changes: Array<WriteSetChange>;\n events: Array<Event>;\n};\n\nexport type EventGuid = {\n creation_number: string;\n account_address: string;\n};\n\nexport type Event = {\n guid: EventGuid;\n sequence_number: string;\n type: string;\n /**\n * The JSON representation of the event\n */\n data: any;\n};\n\n/**\n * Map of Move types to local TypeScript types\n */\nexport type MoveUint8Type = number;\nexport type MoveUint16Type = number;\nexport type MoveUint32Type = number;\nexport type MoveUint64Type = string;\nexport type MoveUint128Type = string;\nexport type MoveUint256Type = string;\nexport type MoveAddressType = string;\nexport type MoveObjectType = string;\nexport type MoveOptionType = MoveType | null | undefined;\n/**\n * This is the format for a fully qualified struct, resource, or entry function in Move.\n */\nexport type MoveStructType = `${string}::${string}::${string}`;\n\nexport type MoveType =\n | boolean\n | string\n | MoveUint8Type\n | MoveUint16Type\n | MoveUint32Type\n | MoveUint64Type\n | MoveUint128Type\n | MoveUint256Type\n | MoveAddressType\n | MoveObjectType\n | MoveStructType\n | Array<MoveType>;\n\n/**\n * Possible Move values acceptable by move functions (entry, view)\n *\n * Map of a Move value to the corresponding TypeScript value\n *\n * `Bool -> boolean`\n *\n * `u8, u16, u32 -> number`\n *\n * `u64, u128, u256 -> string`\n *\n * `String -> string`\n *\n * `Address -> 0x${string}`\n *\n * `Struct - 0x${string}::${string}::${string}`\n *\n * `Object -> 0x${string}`\n *\n * `Vector -> Array<MoveValue>`\n *\n * `Option -> MoveValue | null | undefined`\n */\nexport type MoveValue =\n | boolean\n | string\n | MoveUint8Type\n | MoveUint16Type\n | MoveUint32Type\n | MoveUint64Type\n | MoveUint128Type\n | MoveUint256Type\n | MoveAddressType\n | MoveObjectType\n | MoveStructType\n | MoveOptionType\n | Array<MoveValue>;\n\n/**\n * Move module id is a string representation of Move module.\n * Module name is case-sensitive.\n */\nexport type MoveModuleId = `${string}::${string}`;\n\n/**\n * Move function visibility\n */\nexport enum MoveFunctionVisibility {\n PRIVATE = \"private\",\n PUBLIC = \"public\",\n FRIEND = \"friend\",\n}\n\n/**\n * Move function ability\n */\nexport enum MoveAbility {\n STORE = \"store\",\n DROP = \"drop\",\n KEY = \"key\",\n COPY = \"copy\",\n}\n\n/**\n * Move abilities tied to the generic type param and associated with the function that uses it\n */\nexport type MoveFunctionGenericTypeParam = {\n constraints: Array<MoveAbility>;\n};\n\n/**\n * Move struct field\n */\nexport type MoveStructField = {\n name: string;\n type: string;\n};\n\n/**\n * A Move module\n */\nexport type MoveModule = {\n address: string;\n name: string;\n /**\n * Friends of the module\n */\n friends: Array<MoveModuleId>;\n /**\n * Public functions of the module\n */\n exposed_functions: Array<MoveFunction>;\n /**\n * Structs of the module\n */\n structs: Array<MoveStruct>;\n};\n\n/**\n * A move struct\n */\nexport type MoveStruct = {\n name: string;\n /**\n * Whether the struct is a native struct of Move\n */\n is_native: boolean;\n /**\n * Abilities associated with the struct\n */\n abilities: Array<MoveAbility>;\n /**\n * Generic types associated with the struct\n */\n generic_type_params: Array<MoveFunctionGenericTypeParam>;\n /**\n * Fields associated with the struct\n */\n fields: Array<MoveStructField>;\n};\n\n/**\n * Move function\n */\nexport type MoveFunction = {\n name: string;\n visibility: MoveFunctionVisibility;\n /**\n * Whether the function can be called as an entry function directly in a transaction\n */\n is_entry: boolean;\n /**\n * Whether the function is a view function or not\n */\n is_view: boolean;\n /**\n * Generic type params associated with the Move function\n */\n generic_type_params: Array<MoveFunctionGenericTypeParam>;\n /**\n * Parameters associated with the move function\n */\n params: Array<string>;\n /**\n * Return type of the function\n */\n return: Array<string>;\n};\n\nexport enum RoleType {\n VALIDATOR = \"validator\",\n FULL_NODE = \"full_node\",\n}\n\nexport type LedgerInfo = {\n /**\n * Chain ID of the current chain\n */\n chain_id: number;\n epoch: string;\n ledger_version: string;\n oldest_ledger_version: string;\n ledger_timestamp: string;\n node_role: RoleType;\n oldest_block_height: string;\n block_height: string;\n /**\n * Git hash of the build of the API endpoint. Can be used to determine the exact\n * software version used by the API endpoint.\n */\n git_hash?: string;\n};\n\n/**\n * A Block type\n */\nexport type Block = {\n block_height: string;\n block_hash: string;\n block_timestamp: string;\n first_version: string;\n last_version: string;\n /**\n * The transactions in the block in sequential order\n */\n transactions?: Array<TransactionResponse>;\n};\n\n/**\n * The data needed to generate a View Request payload\n */\nexport type ViewRequestData = {\n function: MoveStructType;\n typeArguments?: Array<MoveStructType>;\n functionArguments?: Array<MoveValue>;\n};\n\n// REQUEST TYPES\n\n/**\n * View request for the Move view function API\n *\n * `type MoveStructType = ${string}::${string}::${string}`;\n */\nexport type ViewRequest = {\n function: MoveStructType;\n /**\n * Type arguments of the function\n */\n type_arguments: Array<MoveStructType>;\n /**\n * Arguments of the function\n */\n functionArguments: Array<MoveValue>;\n};\n\n/**\n * Table Item request for the GetTableItem API\n */\nexport type TableItemRequest = {\n key_type: MoveValue;\n value_type: MoveValue;\n /**\n * The value of the table item's key\n */\n key: any;\n};\n\n/**\n * A list of Authentication Key schemes that are supported by Aptos.\n *\n * They are combinations of signing schemes and derive schemes.\n */\nexport type AuthenticationKeyScheme = SigningScheme | DeriveScheme;\n\nexport enum SigningScheme {\n /**\n * For Ed25519PublicKey\n */\n Ed25519 = 0,\n /**\n * For MultiEd25519PublicKey\n */\n MultiEd25519 = 1,\n /**\n * For SingleKey ecdsa\n */\n SingleKey = 2,\n\n MultiKey = 3,\n}\n\nexport enum SigningSchemeInput {\n /**\n * For Ed25519PublicKey\n */\n Ed25519 = 0,\n /**\n * For Secp256k1Ecdsa\n */\n Secp256k1Ecdsa = 2,\n}\n\n/**\n * Scheme used for deriving account addresses from other data\n */\nexport enum DeriveScheme {\n /**\n * Derives an address using an AUID, used for objects\n */\n DeriveAuid = 251,\n /**\n * Derives an address from another object address\n */\n DeriveObjectAddressFromObject = 252,\n /**\n * Derives an address from a GUID, used for objects\n */\n DeriveObjectAddressFromGuid = 253,\n /**\n * Derives an address from seed bytes, used for named objects\n */\n DeriveObjectAddressFromSeed = 254,\n /**\n * Derives an address from seed bytes, used for resource accounts\n */\n DeriveResourceAccountAddress = 255,\n}\n\n/**\n * Option properties to pass for waitForTransaction() function\n */\nexport type WaitForTransactionOptions = {\n timeoutSecs?: number;\n checkSuccess?: boolean;\n indexerVersionCheck?: boolean;\n};\n\n/**\n * Input type to generate an account using Single Signer\n * Ed25519 or Legacy Ed25519\n */\nexport type GenerateAccountWithEd25519 = {\n scheme: SigningSchemeInput.Ed25519;\n legacy: boolean;\n};\n\n/**\n * Input type to generate an account using Single Signer\n * Secp256k1\n */\nexport type GenerateAccountWithSingleSignerSecp256k1Key = {\n scheme: SigningSchemeInput.Secp256k1Ecdsa;\n legacy?: false;\n};\n\nexport type GenerateAccount = GenerateAccountWithEd25519 | GenerateAccountWithSingleSignerSecp256k1Key;\n"],"mappings":"AAOO,IAAKA,OAIVA,EAAA,KAAO,mBAIPA,EAAA,IAAM,oBAINA,EAAA,uBAAyB,6CAZfA,OAAA,IAwBAC,OACVA,IAAA,KAAO,GAAP,OACAA,IAAA,GAAK,GAAL,KACAA,IAAA,IAAM,GAAN,MACAA,IAAA,KAAO,GAAP,OACAA,IAAA,QAAU,GAAV,UACAA,IAAA,OAAS,GAAT,SACAA,IAAA,OAAS,GAAT,SACAA,IAAA,OAAS,GAAT,SACAA,IAAA,IAAM,GAAN,MACAA,IAAA,IAAM,GAAN,MACAA,IAAA,KAAO,IAAP,OACAA,IAAA,UAAY,KAAZ,YACAA,IAAA,QAAU,KAAV,UAbUA,OAAA,IAoBAC,OACVA,IAAA,GAAK,GAAL,KACAA,IAAA,IAAM,GAAN,MACAA,IAAA,KAAO,GAAP,OACAA,IAAA,QAAU,GAAV,UACAA,IAAA,SAAW,GAAX,WACAA,IAAA,KAAO,GAAP,OACAA,IAAA,IAAM,GAAN,MACAA,IAAA,IAAM,GAAN,MACAA,IAAA,KAAO,GAAP,OATUA,OAAA,IAgBAC,OACVA,IAAA,OAAS,GAAT,SACAA,IAAA,cAAgB,GAAhB,gBACAA,IAAA,SAAW,GAAX,WAHUA,OAAA,IAUAC,OACVA,IAAA,sBAAwB,GAAxB,wBACAA,IAAA,oBAAsB,GAAtB,sBAFUA,OAAA,IASAC,OACVA,IAAA,QAAU,GAAV,UACAA,IAAA,aAAe,GAAf,eACAA,IAAA,WAAa,GAAb,aACAA,IAAA,SAAW,GAAX,WACAA,IAAA,aAAe,GAAf,eALUA,OAAA,IAYAC,OACVA,IAAA,QAAU,GAAV,UACAA,IAAA,aAAe,GAAf,eACAA,IAAA,UAAY,GAAZ,YACAA,IAAA,SAAW,GAAX,WAJUA,OAAA,IAOAC,OACVA,IAAA,QAAU,GAAV,UACAA,IAAA,UAAY,GAAZ,YAFUA,OAAA,IAKAC,OACVA,IAAA,QAAU,GAAV,UACAA,IAAA,UAAY,GAAZ,YAFUA,OAAA,IAkKAC,OACVA,EAAA,QAAU,sBACVA,EAAA,KAAO,mBACPA,EAAA,QAAU,sBACVA,EAAA,cAAgB,6BAChBA,EAAA,gBAAkB,+BALRA,OAAA,IA+dAC,OACVA,EAAA,QAAU,UACVA,EAAA,OAAS,SACTA,EAAA,OAAS,SAHCA,OAAA,IASAC,OACVA,EAAA,MAAQ,QACRA,EAAA,KAAO,OACPA,EAAA,IAAM,MACNA,EAAA,KAAO,OAJGA,OAAA,IA6FAC,OACVA,EAAA,UAAY,YACZA,EAAA,UAAY,YAFFA,OAAA,IAsFAC,OAIVA,IAAA,QAAU,GAAV,UAIAA,IAAA,aAAe,GAAf,eAIAA,IAAA,UAAY,GAAZ,YAEAA,IAAA,SAAW,GAAX,WAdUA,OAAA,IAiBAC,OAIVA,IAAA,QAAU,GAAV,UAIAA,IAAA,eAAiB,GAAjB,iBARUA,OAAA,IAcAC,OAIVA,IAAA,WAAa,KAAb,aAIAA,IAAA,8BAAgC,KAAhC,gCAIAA,IAAA,4BAA8B,KAA9B,8BAIAA,IAAA,4BAA8B,KAA9B,8BAIAA,IAAA,6BAA+B,KAA/B,+BApBUA,OAAA","names":["MimeType","TypeTagVariants","ScriptTransactionArgumentVariants","TransactionPayloadVariants","TransactionVariants","TransactionAuthenticatorVariant","AccountAuthenticatorVariant","AnyPublicKeyVariant","AnySignatureVariant","TransactionResponseType","MoveFunctionVisibility","MoveAbility","RoleType","SigningScheme","SigningSchemeInput","DeriveScheme"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as o}from"./chunk-27P7PELS.mjs";import{a as s}from"./chunk-FBPNHF54.mjs";import{bytesToHex as d,hexToBytes as h}from"@noble/hashes/utils";var g=(a=>(a.INCORRECT_NUMBER_OF_BYTES="incorrect_number_of_bytes",a.INVALID_HEX_CHARS="invalid_hex_chars",a.TOO_SHORT="too_short",a.TOO_LONG="too_long",a.LEADING_ZERO_X_REQUIRED="leading_zero_x_required",a.LONG_FORM_REQUIRED_UNLESS_SPECIAL="long_form_required_unless_special",a.INVALID_PADDING_ZEROES="INVALID_PADDING_ZEROES",a))(g||{}),t=class extends o{constructor(e){super();if(e.length!==t.LENGTH)throw new s("AccountAddress data should be exactly 32 bytes long","incorrect_number_of_bytes");this.data=e}isSpecial(){return this.data.slice(0,this.data.length-1).every(e=>e===0)&&this.data[this.data.length-1]<16}toString(){return`0x${this.toStringWithoutPrefix()}`}toStringWithoutPrefix(){let e=d(this.data);return this.isSpecial()&&(e=e[e.length-1]),e}toStringLong(){return`0x${this.toStringLongWithoutPrefix()}`}toStringLongWithoutPrefix(){return d(this.data)}toUint8Array(){return this.data}serialize(e){e.serializeFixedBytes(this.data)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(3),e.serialize(this)}static deserialize(e){let r=e.deserializeFixedBytes(t.LENGTH);return new t(r)}static fromString(e){if(!e.startsWith("0x"))throw new s("Hex string must start with a leading 0x.","leading_zero_x_required");let r=t.fromStringRelaxed(e);if(e.length!==t.LONG_STRING_LENGTH+2)if(r.isSpecial()){if(e.length!==3)throw new s(`The given hex string ${e} is a special address not in LONG form, it must be 0x0 to 0xf without padding zeroes.`,"INVALID_PADDING_ZEROES")}else throw new s(`The given hex string ${r} is not a special address, it must be represented as 0x + 64 chars.`,"long_form_required_unless_special");return r}static fromStringRelaxed(e){let r=e;if(e.startsWith("0x")&&(r=e.slice(2)),r.length===0)throw new s("Hex string is too short, must be 1 to 64 chars long, excluding the leading 0x.","too_short");if(r.length>64)throw new s("Hex string is too long, must be 1 to 64 chars long, excluding the leading 0x.","too_long");let n;try{n=h(r.padStart(64,"0"))}catch(l){let c=l;throw new s(`Hex characters are invalid: ${c.message}`,"invalid_hex_chars")}return new t(n)}static fromRelaxed(e){return e instanceof t?e:e instanceof Uint8Array?new t(e):t.fromStringRelaxed(e)}static from(e){return e instanceof t?e:e instanceof Uint8Array?new t(e):t.fromString(e)}static isValid(e){try{return e.relaxed?t.fromRelaxed(e.input):t.from(e.input),{valid:!0}}catch(r){let n=r;return{valid:!1,invalidReason:n.invalidReason,invalidReasonMessage:n.message}}}equals(e){return this.data.length!==e.data.length?!1:this.data.every((r,n)=>r===e.data[n])}},i=t;i.LENGTH=32,i.LONG_STRING_LENGTH=64,i.ZERO=t.from("0x0"),i.ONE=t.from("0x1"),i.TWO=t.from("0x2"),i.THREE=t.from("0x3"),i.FOUR=t.from("0x4");export{g as a,i as b};
|
|
2
|
+
//# sourceMappingURL=chunk-HH5RSP2H.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/core/accountAddress.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { bytesToHex, hexToBytes } from \"@noble/hashes/utils\";\nimport { Serializable, Serializer } from \"../bcs/serializer\";\nimport { Deserializer } from \"../bcs/deserializer\";\nimport { ParsingError, ParsingResult } from \"./common\";\nimport { TransactionArgument } from \"../transactions/instances/transactionArgument\";\nimport { HexInput, ScriptTransactionArgumentVariants } from \"../types\";\n\n/**\n * This enum is used to explain why an address was invalid.\n */\nexport enum AddressInvalidReason {\n INCORRECT_NUMBER_OF_BYTES = \"incorrect_number_of_bytes\",\n INVALID_HEX_CHARS = \"invalid_hex_chars\",\n TOO_SHORT = \"too_short\",\n TOO_LONG = \"too_long\",\n LEADING_ZERO_X_REQUIRED = \"leading_zero_x_required\",\n LONG_FORM_REQUIRED_UNLESS_SPECIAL = \"long_form_required_unless_special\",\n INVALID_PADDING_ZEROES = \"INVALID_PADDING_ZEROES\",\n}\n\nexport type AccountAddressInput = HexInput | AccountAddress;\n\n/**\n * NOTE: Only use this class for account addresses. For other hex data, e.g. transaction\n * hashes, use the Hex class.\n *\n * AccountAddress is used for working with account addresses. Account addresses, when\n * represented as a string, generally look like these examples:\n * - 0x1\n * - 0xaa86fe99004361f747f91342ca13c426ca0cccb0c1217677180c9493bad6ef0c\n *\n * Proper formatting and parsing of account addresses is defined by AIP-40.\n * To learn more about the standard, read the AIP here:\n * https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.\n *\n * The comments in this class make frequent reference to the LONG and SHORT formats,\n * as well as \"special\" addresses. To learn what these refer to see AIP-40.\n */\nexport class AccountAddress extends Serializable implements TransactionArgument {\n /**\n * This is the internal representation of an account address.\n */\n readonly data: Uint8Array;\n\n /**\n * The number of bytes that make up an account address.\n */\n static readonly LENGTH: number = 32;\n\n /**\n * The length of an address string in LONG form without a leading 0x.\n */\n static readonly LONG_STRING_LENGTH: number = 64;\n\n static ZERO: AccountAddress = AccountAddress.from(\"0x0\");\n\n static ONE: AccountAddress = AccountAddress.from(\"0x1\");\n\n static TWO: AccountAddress = AccountAddress.from(\"0x2\");\n\n static THREE: AccountAddress = AccountAddress.from(\"0x3\");\n\n static FOUR: AccountAddress = AccountAddress.from(\"0x4\");\n\n /**\n * Creates an instance of AccountAddress from a Uint8Array.\n *\n * @param args.data A Uint8Array representing an account address.\n */\n constructor(input: Uint8Array) {\n super();\n if (input.length !== AccountAddress.LENGTH) {\n throw new ParsingError(\n \"AccountAddress data should be exactly 32 bytes long\",\n AddressInvalidReason.INCORRECT_NUMBER_OF_BYTES,\n );\n }\n this.data = input;\n }\n\n /**\n * Returns whether an address is special, where special is defined as 0x0 to 0xf\n * inclusive. In other words, the last byte of the address must be < 0b10000 (16)\n * and every other byte must be zero.\n *\n * For more information on how special addresses are defined see AIP-40:\n * https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.\n *\n * @returns true if the address is special, false if not.\n */\n isSpecial(): boolean {\n return (\n this.data.slice(0, this.data.length - 1).every((byte) => byte === 0) && this.data[this.data.length - 1] < 0b10000\n );\n }\n\n // ===\n // Methods for representing an instance of AccountAddress as other types.\n // ===\n\n /**\n * Return the AccountAddress as a string as per AIP-40.\n * https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.\n *\n * In short, it means that special addresses are represented in SHORT form, meaning\n * 0x0 through to 0xf inclusive, and every other address is represented in LONG form,\n * meaning 0x + 64 hex characters.\n *\n * @returns AccountAddress as a string conforming to AIP-40.\n */\n toString(): `0x${string}` {\n return `0x${this.toStringWithoutPrefix()}`;\n }\n\n /**\n * NOTE: Prefer to use `toString` where possible.\n *\n * Return the AccountAddress as a string as per AIP-40 but without the leading 0x.\n *\n * Learn more by reading the docstring of `toString`.\n *\n * @returns AccountAddress as a string conforming to AIP-40 but without the leading 0x.\n */\n toStringWithoutPrefix(): string {\n let hex = bytesToHex(this.data);\n if (this.isSpecial()) {\n hex = hex[hex.length - 1];\n }\n return hex;\n }\n\n /**\n * NOTE: Prefer to use `toString` where possible.\n *\n * Whereas toString will format special addresses (as defined by isSpecial) using the\n * SHORT form (no leading 0s), this format the address in the LONG format\n * unconditionally.\n *\n * This means it will be 0x + 64 hex characters.\n *\n * @returns AccountAddress as a string in LONG form.\n */\n toStringLong(): `0x${string}` {\n return `0x${this.toStringLongWithoutPrefix()}`;\n }\n\n /**\n * NOTE: Prefer to use `toString` where possible.\n *\n * Whereas toString will format special addresses (as defined by isSpecial) using the\n * SHORT form (no leading 0s), this function will include leading zeroes. The string\n * will not have a leading zero.\n *\n * This means it will be 64 hex characters without a leading 0x.\n *\n * @returns AccountAddress as a string in LONG form without a leading 0x.\n */\n toStringLongWithoutPrefix(): string {\n return bytesToHex(this.data);\n }\n\n /**\n * Get the inner hex data. The inner data is already a Uint8Array so no conversion\n * is taking place here, it just returns the inner data.\n *\n * @returns Hex data as Uint8Array\n */\n toUint8Array(): Uint8Array {\n return this.data;\n }\n\n /**\n * Serialize the AccountAddress to a Serializer instance's data buffer.\n * @param serializer The serializer to serialize the AccountAddress to.\n * @returns void\n * @example\n * const serializer = new Serializer();\n * const address = AccountAddress.fromString(\"0x1\");\n * address.serialize(serializer);\n * const bytes = serializer.toUint8Array();\n * // `bytes` is now the BCS-serialized address.\n */\n serialize(serializer: Serializer): void {\n serializer.serializeFixedBytes(this.data);\n }\n\n serializeForEntryFunction(serializer: Serializer): void {\n const bcsBytes = this.bcsToBytes();\n serializer.serializeBytes(bcsBytes);\n }\n\n serializeForScriptFunction(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(ScriptTransactionArgumentVariants.Address);\n serializer.serialize(this);\n }\n\n /**\n * Deserialize an AccountAddress from the byte buffer in a Deserializer instance.\n * @param deserializer The deserializer to deserialize the AccountAddress from.\n * @returns An instance of AccountAddress.\n * @example\n * const bytes = hexToBytes(\"0x0102030405060708091011121314151617181920212223242526272829303132\");\n * const deserializer = new Deserializer(bytes);\n * const address = AccountAddress.deserialize(deserializer);\n * // `address` is now an instance of AccountAddress.\n */\n static deserialize(deserializer: Deserializer): AccountAddress {\n const bytes = deserializer.deserializeFixedBytes(AccountAddress.LENGTH);\n return new AccountAddress(bytes);\n }\n\n // ===\n // Methods for creating an instance of AccountAddress from other types.\n // ===\n\n /**\n * NOTE: This function has strict parsing behavior. For relaxed behavior, please use\n * the `fromStringRelaxed` function.\n *\n * Creates an instance of AccountAddress from a hex string.\n *\n * This function allows only the strictest formats defined by AIP-40. In short this\n * means only the following formats are accepted:\n *\n * - LONG\n * - SHORT for special addresses\n *\n * Where:\n * - LONG is defined as 0x + 64 hex characters.\n * - SHORT for special addresses is 0x0 to 0xf inclusive without padding zeroes.\n *\n * This means the following are not accepted:\n * - SHORT for non-special addresses.\n * - Any address without a leading 0x.\n *\n * Learn more about the different address formats by reading AIP-40:\n * https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.\n *\n * @param input A hex string representing an account address.\n *\n * @returns An instance of AccountAddress.\n */\n static fromString(input: string): AccountAddress {\n // Assert the string starts with 0x.\n if (!input.startsWith(\"0x\")) {\n throw new ParsingError(\"Hex string must start with a leading 0x.\", AddressInvalidReason.LEADING_ZERO_X_REQUIRED);\n }\n\n const address = AccountAddress.fromStringRelaxed(input);\n\n // Check if the address is in LONG form. If it is not, this is only allowed for\n // special addresses, in which case we check it is in proper SHORT form.\n if (input.length !== AccountAddress.LONG_STRING_LENGTH + 2) {\n if (!address.isSpecial()) {\n throw new ParsingError(\n `The given hex string ${address} is not a special address, it must be represented as 0x + 64 chars.`,\n AddressInvalidReason.LONG_FORM_REQUIRED_UNLESS_SPECIAL,\n );\n } else if (input.length !== 3) {\n // 0x + one hex char is the only valid SHORT form for special addresses.\n throw new ParsingError(\n // eslint-disable-next-line max-len\n `The given hex string ${input} is a special address not in LONG form, it must be 0x0 to 0xf without padding zeroes.`,\n AddressInvalidReason.INVALID_PADDING_ZEROES,\n );\n }\n }\n\n return address;\n }\n\n /**\n * NOTE: This function has relaxed parsing behavior. For strict behavior, please use\n * the `fromString` function. Where possible use `fromString` rather than this\n * function, `fromStringRelaxed` is only provided for backwards compatibility.\n *\n * Creates an instance of AccountAddress from a hex string.\n *\n * This function allows all formats defined by AIP-40. In short this means the\n * following formats are accepted:\n *\n * - LONG, with or without leading 0x\n * - SHORT, with or without leading 0x\n *\n * Where:\n * - LONG is 64 hex characters.\n * - SHORT is 1 to 63 hex characters inclusive.\n * - Padding zeroes are allowed, e.g. 0x0123 is valid.\n *\n * Learn more about the different address formats by reading AIP-40:\n * https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.\n *\n * @param input A hex string representing an account address.\n *\n * @returns An instance of AccountAddress.\n */\n static fromStringRelaxed(input: string): AccountAddress {\n let parsedInput = input;\n // Remove leading 0x for parsing.\n if (input.startsWith(\"0x\")) {\n parsedInput = input.slice(2);\n }\n\n // Ensure the address string is at least 1 character long.\n if (parsedInput.length === 0) {\n throw new ParsingError(\n \"Hex string is too short, must be 1 to 64 chars long, excluding the leading 0x.\",\n AddressInvalidReason.TOO_SHORT,\n );\n }\n\n // Ensure the address string is not longer than 64 characters.\n if (parsedInput.length > 64) {\n throw new ParsingError(\n \"Hex string is too long, must be 1 to 64 chars long, excluding the leading 0x.\",\n AddressInvalidReason.TOO_LONG,\n );\n }\n\n let addressBytes: Uint8Array;\n try {\n // Pad the address with leading zeroes, so it is 64 chars long and then convert\n // the hex string to bytes. Every two characters in a hex string constitutes a\n // single byte. So a 64 length hex string becomes a 32 byte array.\n addressBytes = hexToBytes(parsedInput.padStart(64, \"0\"));\n } catch (e) {\n const error = e as Error;\n // At this point the only way this can fail is if the hex string contains\n // invalid characters.\n throw new ParsingError(`Hex characters are invalid: ${error.message}`, AddressInvalidReason.INVALID_HEX_CHARS);\n }\n\n return new AccountAddress(addressBytes);\n }\n\n /**\n * Convenience method for creating an AccountAddress from all known inputs.\n *\n * This handles, Uint8array, string, and AccountAddress itself\n * @param input\n */\n static fromRelaxed(input: AccountAddressInput): AccountAddress {\n if (input instanceof AccountAddress) {\n return input;\n }\n if (input instanceof Uint8Array) {\n return new AccountAddress(input);\n }\n return AccountAddress.fromStringRelaxed(input);\n }\n\n /**\n * Convenience method for creating an AccountAddress from all known inputs.\n *\n * This handles, Uint8array, string, and AccountAddress itself\n * @param input\n */\n static from(input: AccountAddressInput): AccountAddress {\n if (input instanceof AccountAddress) {\n return input;\n }\n if (input instanceof Uint8Array) {\n return new AccountAddress(input);\n }\n return AccountAddress.fromString(input);\n }\n\n // ===\n // Methods for checking validity.\n // ===\n\n /**\n * Check if the string is a valid AccountAddress.\n *\n * @param args.input A hex string representing an account address.\n * @param args.relaxed If true, use relaxed parsing behavior. If false, use strict parsing behavior.\n *\n * @returns valid = true if the string is valid, valid = false if not. If the string\n * is not valid, invalidReason will be set explaining why it is invalid.\n */\n static isValid(args: { input: AccountAddressInput; relaxed?: boolean }): ParsingResult<AddressInvalidReason> {\n try {\n if (args.relaxed) {\n AccountAddress.fromRelaxed(args.input);\n } else {\n AccountAddress.from(args.input);\n }\n return { valid: true };\n } catch (e) {\n const error = e as ParsingError<AddressInvalidReason>;\n return {\n valid: false,\n invalidReason: error.invalidReason,\n invalidReasonMessage: error.message,\n };\n }\n }\n\n /**\n * Return whether AccountAddresses are equal. AccountAddresses are considered equal\n * if their underlying byte data is identical.\n *\n * @param other The AccountAddress to compare to.\n * @returns true if the AccountAddresses are equal, false if not.\n */\n equals(other: AccountAddress): boolean {\n if (this.data.length !== other.data.length) return false;\n return this.data.every((value, index) => value === other.data[index]);\n }\n}\n"],"mappings":"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","names":["bytesToHex","hexToBytes","AddressInvalidReason","_AccountAddress","Serializable","input","ParsingError","byte","hex","bytesToHex","serializer","bcsBytes","deserializer","bytes","address","parsedInput","addressBytes","hexToBytes","e","error","args","other","value","index","AccountAddress"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=chunk-HTZTTZQJ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=chunk-I5OYNCZS.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{c as i}from"./chunk-BIUGRAMO.mjs";import{c as t}from"./chunk-YS2OX7AB.mjs";import{c as s}from"./chunk-E72CFUU4.mjs";var e=class extends s{constructor(r){super();this.signature=r}toUint8Array(){return this.signature.toUint8Array()}toString(){return this.signature.toString()}serialize(r){if(this.signature instanceof i)r.serializeU32AsUleb128(0),this.signature.serialize(r);else if(this.signature instanceof t)r.serializeU32AsUleb128(1),this.signature.serialize(r);else throw new Error("Unknown signature type")}static deserialize(r){let n=r.deserializeUleb128AsU32();switch(n){case 0:return new e(i.load(r));case 1:return new e(t.load(r));default:throw new Error(`Unknown variant index for AnySignature: ${n}`)}}};export{e as a};
|
|
2
|
+
//# sourceMappingURL=chunk-IPJKGHQY.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/core/crypto/anySignature.ts"],"sourcesContent":["import { Serializer, Deserializer } from \"../../bcs\";\nimport { AnySignatureVariant } from \"../../types\";\nimport { Signature } from \"./asymmetricCrypto\";\nimport { Ed25519Signature } from \"./ed25519\";\nimport { Secp256k1Signature } from \"./secp256k1\";\n\nexport class AnySignature extends Signature {\n public readonly signature: Signature;\n\n constructor(signature: Signature) {\n super();\n this.signature = signature;\n }\n\n /**\n * Get the public key in bytes (Uint8Array).\n *\n * @returns Uint8Array representation of the public key\n */\n toUint8Array(): Uint8Array {\n return this.signature.toUint8Array();\n }\n\n /**\n * Get the public key as a hex string with the 0x prefix.\n *\n * @returns string representation of the public key\n */\n toString(): string {\n return this.signature.toString();\n }\n\n serialize(serializer: Serializer): void {\n if (this.signature instanceof Ed25519Signature) {\n serializer.serializeU32AsUleb128(AnySignatureVariant.Ed25519);\n this.signature.serialize(serializer);\n } else if (this.signature instanceof Secp256k1Signature) {\n serializer.serializeU32AsUleb128(AnySignatureVariant.Secp256k1);\n this.signature.serialize(serializer);\n } else {\n throw new Error(\"Unknown signature type\");\n }\n }\n\n static deserialize(deserializer: Deserializer): AnySignature {\n const index = deserializer.deserializeUleb128AsU32();\n switch (index) {\n case AnySignatureVariant.Ed25519:\n return new AnySignature(Ed25519Signature.load(deserializer));\n case AnySignatureVariant.Secp256k1:\n return new AnySignature(Secp256k1Signature.load(deserializer));\n default:\n throw new Error(`Unknown variant index for AnySignature: ${index}`);\n }\n }\n}\n"],"mappings":"2HAMO,IAAMA,EAAN,cAA2BC,CAAU,CAG1C,YAAYC,EAAsB,CAChC,MAAM,EACN,KAAK,UAAYA,CACnB,CAOA,cAA2B,CACzB,OAAO,KAAK,UAAU,aAAa,CACrC,CAOA,UAAmB,CACjB,OAAO,KAAK,UAAU,SAAS,CACjC,CAEA,UAAUC,EAA8B,CACtC,GAAI,KAAK,qBAAqBC,EAC5BD,EAAW,uBAAiD,EAC5D,KAAK,UAAU,UAAUA,CAAU,UAC1B,KAAK,qBAAqBE,EACnCF,EAAW,uBAAmD,EAC9D,KAAK,UAAU,UAAUA,CAAU,MAEnC,OAAM,IAAI,MAAM,wBAAwB,CAE5C,CAEA,OAAO,YAAYG,EAA0C,CAC3D,IAAMC,EAAQD,EAAa,wBAAwB,EACnD,OAAQC,EAAO,CACb,OACE,OAAO,IAAIP,EAAaI,EAAiB,KAAKE,CAAY,CAAC,EAC7D,OACE,OAAO,IAAIN,EAAaK,EAAmB,KAAKC,CAAY,CAAC,EAC/D,QACE,MAAM,IAAI,MAAM,2CAA2CC,GAAO,CACtE,CACF,CACF","names":["AnySignature","Signature","signature","serializer","Ed25519Signature","Secp256k1Signature","deserializer","index"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as t,b as o,c as s}from"./chunk-PJDVHU7X.mjs";var r=class{constructor(e){this.config=e}async getNumberOfDelegators(e){return t({aptosConfig:this.config,...e})}async getNumberOfDelegatorsForAllPools(e){return o({aptosConfig:this.config,...e})}async getDelegatedStakingActivities(e){return s({aptosConfig:this.config,...e})}};export{r as a};
|
|
2
|
+
//# sourceMappingURL=chunk-IXMH6AXJ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/api/staking.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { AptosConfig } from \"./aptosConfig\";\nimport {\n getDelegatedStakingActivities,\n getNumberOfDelegators,\n getNumberOfDelegatorsForAllPools,\n} from \"../internal/staking\";\nimport { GetDelegatedStakingActivitiesResponse, GetNumberOfDelegatorsResponse, OrderBy } from \"../types\";\nimport { AccountAddressInput } from \"../core\";\n\n/**\n * A class to query all `Staking` related queries on Aptos.\n */\nexport class Staking {\n readonly config: AptosConfig;\n\n constructor(config: AptosConfig) {\n this.config = config;\n }\n\n /**\n * Queries current number of delegators in a pool. Throws an error if the pool is not found.\n *\n * @param args.poolAddress Pool address\n * @returns The number of delegators for the given pool\n */\n async getNumberOfDelegators(args: { poolAddress: AccountAddressInput }): Promise<number> {\n return getNumberOfDelegators({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries current number of delegators in a pool. Throws an error if the pool is not found.\n *\n * @returns GetNumberOfDelegatorsForAllPoolsResponse response type\n */\n async getNumberOfDelegatorsForAllPools(args?: {\n options?: {\n orderBy?: OrderBy<GetNumberOfDelegatorsResponse[0]>;\n };\n }): Promise<GetNumberOfDelegatorsResponse> {\n return getNumberOfDelegatorsForAllPools({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries delegated staking activities\n *\n * @param args.delegatorAddress Delegator address\n * @param args.poolAddress Pool address\n * @returns GetDelegatedStakingActivitiesResponse response type\n */\n async getDelegatedStakingActivities(args: {\n delegatorAddress: AccountAddressInput;\n poolAddress: AccountAddressInput;\n }): Promise<GetDelegatedStakingActivitiesResponse> {\n return getDelegatedStakingActivities({ aptosConfig: this.config, ...args });\n }\n}\n"],"mappings":"uDAeO,IAAMA,EAAN,KAAc,CAGnB,YAAYC,EAAqB,CAC/B,KAAK,OAASA,CAChB,CAQA,MAAM,sBAAsBC,EAA6D,CACvF,OAAOC,EAAsB,CAAE,YAAa,KAAK,OAAQ,GAAGD,CAAK,CAAC,CACpE,CAOA,MAAM,iCAAiCA,EAII,CACzC,OAAOE,EAAiC,CAAE,YAAa,KAAK,OAAQ,GAAGF,CAAK,CAAC,CAC/E,CASA,MAAM,8BAA8BA,EAGe,CACjD,OAAOG,EAA8B,CAAE,YAAa,KAAK,OAAQ,GAAGH,CAAK,CAAC,CAC5E,CACF","names":["Staking","config","args","getNumberOfDelegators","getNumberOfDelegatorsForAllPools","getDelegatedStakingActivities"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a}from"./chunk-FBPNHF54.mjs";import{bytesToHex as s,hexToBytes as o}from"@noble/hashes/utils";var l=(e=>(e.TOO_SHORT="too_short",e.INVALID_LENGTH="invalid_length",e.INVALID_HEX_CHARS="invalid_hex_chars",e))(l||{}),n=class{constructor(t){this.data=t}toUint8Array(){return this.data}toStringWithoutPrefix(){return s(this.data)}toString(){return`0x${this.toStringWithoutPrefix()}`}static fromString(t){let r=t;if(r.startsWith("0x")&&(r=r.slice(2)),r.length===0)throw new a("Hex string is too short, must be at least 1 char long, excluding the optional leading 0x.","too_short");if(r.length%2!==0)throw new a("Hex string must be an even number of hex characters.","invalid_length");try{return new n(o(r))}catch(e){let i=e;throw new a(`Hex string contains invalid hex characters: ${i.message}`,"invalid_hex_chars")}}static fromHexInput(t){return t instanceof Uint8Array?new n(t):n.fromString(t)}static isValid(t){try{return n.fromString(t),{valid:!0}}catch(r){let e=r;return{valid:!1,invalidReason:e.invalidReason,invalidReasonMessage:e.message}}}equals(t){return this.data.length!==t.data.length?!1:this.data.every((r,e)=>r===t.data[e])}};export{l as a,n as b};
|
|
2
|
+
//# sourceMappingURL=chunk-IZHPCZE3.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/core/hex.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { bytesToHex, hexToBytes } from \"@noble/hashes/utils\";\nimport { ParsingError, ParsingResult } from \"./common\";\nimport { HexInput } from \"../types\";\n\n/**\n * This enum is used to explain why parsing might have failed.\n */\nexport enum HexInvalidReason {\n TOO_SHORT = \"too_short\",\n INVALID_LENGTH = \"invalid_length\",\n INVALID_HEX_CHARS = \"invalid_hex_chars\",\n}\n\n/**\n * NOTE: Do not use this class when working with account addresses, use AccountAddress.\n *\n * NOTE: When accepting hex data as input to a function, prefer to accept HexInput and\n * then use the static helper methods of this class to convert it into the desired\n * format. This enables the greatest flexibility for the developer.\n *\n * Hex is a helper class for working with hex data. Hex data, when represented as a\n * string, generally looks like this, for example: 0xaabbcc, 45cd32, etc.\n *\n * You might use this class like this:\n *\n * ```ts\n * getTransactionByHash(txnHash: HexInput): Promise<Transaction> {\n * const txnHashString = Hex.fromHexInput(txnHash).toString();\n * return await getTransactionByHashInner(txnHashString);\n * }\n * ```\n *\n * This call to `Hex.fromHexInput().toString()` converts the HexInput to a hex string\n * with a leading 0x prefix, regardless of what the input format was.\n *\n * These are some other ways to chain the functions together:\n * - `Hex.fromString({ hexInput: \"0x1f\" }).toUint8Array()`\n * - `new Hex([1, 3]).toStringWithoutPrefix()`\n */\nexport class Hex {\n private readonly data: Uint8Array;\n\n /**\n * Create a new Hex instance from a Uint8Array.\n *\n * @param data Uint8Array\n */\n constructor(data: Uint8Array) {\n this.data = data;\n }\n\n // ===\n // Methods for representing an instance of Hex as other types.\n // ===\n\n /**\n * Get the inner hex data. The inner data is already a Uint8Array so no conversion\n * is taking place here, it just returns the inner data.\n *\n * @returns Hex data as Uint8Array\n */\n toUint8Array(): Uint8Array {\n return this.data;\n }\n\n /**\n * Get the hex data as a string without the 0x prefix.\n *\n * @returns Hex string without 0x prefix\n */\n toStringWithoutPrefix(): string {\n return bytesToHex(this.data);\n }\n\n /**\n * Get the hex data as a string with the 0x prefix.\n *\n * @returns Hex string with 0x prefix\n */\n toString(): string {\n return `0x${this.toStringWithoutPrefix()}`;\n }\n\n // ===\n // Methods for creating an instance of Hex from other types.\n // ===\n\n /**\n * Static method to convert a hex string to Hex\n *\n * @param str A hex string, with or without the 0x prefix\n *\n * @returns Hex\n */\n static fromString(str: string): Hex {\n let input = str;\n\n if (input.startsWith(\"0x\")) {\n input = input.slice(2);\n }\n\n if (input.length === 0) {\n throw new ParsingError(\n \"Hex string is too short, must be at least 1 char long, excluding the optional leading 0x.\",\n HexInvalidReason.TOO_SHORT,\n );\n }\n\n if (input.length % 2 !== 0) {\n throw new ParsingError(\"Hex string must be an even number of hex characters.\", HexInvalidReason.INVALID_LENGTH);\n }\n\n try {\n return new Hex(hexToBytes(input));\n } catch (e) {\n const error = e as Error;\n throw new ParsingError(\n `Hex string contains invalid hex characters: ${error.message}`,\n HexInvalidReason.INVALID_HEX_CHARS,\n );\n }\n }\n\n /**\n * Static method to convert an instance of HexInput to Hex\n *\n * @param hexInput A HexInput (string or Uint8Array)\n *\n * @returns Hex\n */\n static fromHexInput(hexInput: HexInput): Hex {\n if (hexInput instanceof Uint8Array) return new Hex(hexInput);\n return Hex.fromString(hexInput);\n }\n\n // ===\n // Methods for checking validity.\n // ===\n\n /**\n * Check if the string is valid hex.\n *\n * @param str A hex string representing byte data.\n *\n * @returns valid = true if the string is valid, false if not. If the string is not\n * valid, invalidReason and invalidReasonMessage will be set explaining why it is\n * invalid.\n */\n static isValid(str: string): ParsingResult<HexInvalidReason> {\n try {\n Hex.fromString(str);\n return { valid: true };\n } catch (e) {\n const error = e as ParsingError<HexInvalidReason>;\n return {\n valid: false,\n invalidReason: error.invalidReason,\n invalidReasonMessage: error.message,\n };\n }\n }\n\n /**\n * Return whether Hex instances are equal. Hex instances are considered equal if\n * their underlying byte data is identical.\n *\n * @param other The Hex instance to compare to.\n * @returns true if the Hex instances are equal, false if not.\n */\n equals(other: Hex): boolean {\n if (this.data.length !== other.data.length) return false;\n return this.data.every((value, index) => value === other.data[index]);\n }\n}\n"],"mappings":"oCAGA,OAAS,cAAAA,EAAY,cAAAC,MAAkB,sBAOhC,IAAKC,OACVA,EAAA,UAAY,YACZA,EAAA,eAAiB,iBACjBA,EAAA,kBAAoB,oBAHVA,OAAA,IAgCCC,EAAN,KAAU,CAQf,YAAYC,EAAkB,CAC5B,KAAK,KAAOA,CACd,CAYA,cAA2B,CACzB,OAAO,KAAK,IACd,CAOA,uBAAgC,CAC9B,OAAOC,EAAW,KAAK,IAAI,CAC7B,CAOA,UAAmB,CACjB,MAAO,KAAK,KAAK,sBAAsB,GACzC,CAaA,OAAO,WAAWC,EAAkB,CAClC,IAAIC,EAAQD,EAMZ,GAJIC,EAAM,WAAW,IAAI,IACvBA,EAAQA,EAAM,MAAM,CAAC,GAGnBA,EAAM,SAAW,EACnB,MAAM,IAAIC,EACR,4FACA,WACF,EAGF,GAAID,EAAM,OAAS,IAAM,EACvB,MAAM,IAAIC,EAAa,uDAAwD,gBAA+B,EAGhH,GAAI,CACF,OAAO,IAAIL,EAAIM,EAAWF,CAAK,CAAC,CAClC,OAAS,EAAP,CACA,IAAMG,EAAQ,EACd,MAAM,IAAIF,EACR,+CAA+CE,EAAM,UACrD,mBACF,CACF,CACF,CASA,OAAO,aAAaC,EAAyB,CAC3C,OAAIA,aAAoB,WAAmB,IAAIR,EAAIQ,CAAQ,EACpDR,EAAI,WAAWQ,CAAQ,CAChC,CAeA,OAAO,QAAQL,EAA8C,CAC3D,GAAI,CACF,OAAAH,EAAI,WAAWG,CAAG,EACX,CAAE,MAAO,EAAK,CACvB,OAASM,EAAP,CACA,IAAMF,EAAQE,EACd,MAAO,CACL,MAAO,GACP,cAAeF,EAAM,cACrB,qBAAsBA,EAAM,OAC9B,CACF,CACF,CASA,OAAOG,EAAqB,CAC1B,OAAI,KAAK,KAAK,SAAWA,EAAM,KAAK,OAAe,GAC5C,KAAK,KAAK,MAAM,CAACC,EAAOC,IAAUD,IAAUD,EAAM,KAAKE,EAAM,CACtE,CACF","names":["bytesToHex","hexToBytes","HexInvalidReason","Hex","data","bytesToHex","str","input","ParsingError","hexToBytes","error","hexInput","e","other","value","index"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as u}from"./chunk-ZXJ5ZBTL.mjs";import{a as K}from"./chunk-FNB6CFQR.mjs";import{a as c}from"./chunk-UVGCVCNG.mjs";import{a as p,b as o}from"./chunk-BIUGRAMO.mjs";import{a as d,b as y}from"./chunk-YS2OX7AB.mjs";import{b as l}from"./chunk-IZHPCZE3.mjs";var s=class{constructor(t){let{privateKey:e,address:i,legacy:r}=t,n=r??!0;if(this.publicKey=e.publicKey(),this.publicKey instanceof p)n?this.signingScheme=0:(this.publicKey=new c(this.publicKey),this.signingScheme=2);else if(this.publicKey instanceof K)this.signingScheme=1;else if(this.publicKey instanceof d)this.publicKey=new c(this.publicKey),this.signingScheme=2;else throw new Error("Can not create new Account, unsupported public key type");this.privateKey=e,this.accountAddress=i}static generate(t){let e=t?.legacy??!0,i,r;switch(t?.scheme){case 2:i=y.generate(),r=new c(i.publicKey());break;default:i=o.generate(),e===!1?r=new c(i.publicKey()):r=i.publicKey()}let a=u.fromPublicKey({publicKey:r}).derivedAddress();return new s({privateKey:i,address:a,legacy:t?.legacy})}static fromPrivateKey(t){let{privateKey:e,legacy:i}=t,r=i??!0,n;if(e instanceof y)n=new c(e.publicKey());else if(e instanceof o)r?n=e.publicKey():n=new c(e.publicKey());else throw new Error(`Unsupported private key ${e}`);let g=u.fromPublicKey({publicKey:n}).derivedAddress();return new s({privateKey:e,address:g,legacy:r})}static fromPrivateKeyAndAddress(t){let{privateKey:e,address:i,legacy:r}=t;return new s({privateKey:e,address:i,legacy:r})}static fromDerivationPath(t){let{path:e,mnemonic:i,scheme:r,legacy:n}=t,a;switch(r){case 2:a=y.fromDerivationPath(e,i);break;case 0:a=o.fromDerivationPath(e,i);break;default:throw new Error(`Unsupported scheme ${r}`)}return s.fromPrivateKey({privateKey:a,legacy:n})}static authKey(t){let{publicKey:e}=t;return u.fromPublicKey({publicKey:e})}sign(t){return this.privateKey.sign(t)}verifySignature(t){let{message:e,signature:i}=t,r=l.fromHexInput(e).toUint8Array();return this.publicKey.verifySignature({message:r,signature:i})}};export{s as a};
|
|
2
|
+
//# sourceMappingURL=chunk-J3QOSJFP.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/core/account.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { AccountAddress } from \"./accountAddress\";\nimport { AuthenticationKey } from \"./authenticationKey\";\nimport { PrivateKey, PublicKey, Signature } from \"./crypto/asymmetricCrypto\";\nimport { Ed25519PrivateKey, Ed25519PublicKey } from \"./crypto/ed25519\";\nimport { MultiEd25519PublicKey } from \"./crypto/multiEd25519\";\nimport { Secp256k1PrivateKey, Secp256k1PublicKey } from \"./crypto/secp256k1\";\nimport { Hex } from \"./hex\";\nimport { GenerateAccount, HexInput, SigningScheme, SigningSchemeInput } from \"../types\";\nimport { AnyPublicKey } from \"./crypto/anyPublicKey\";\n\n/**\n * Class for creating and managing account on Aptos network\n *\n * Use this class to create accounts, sign transactions, and more.\n * Note: Creating an account instance does not create the account on-chain.\n *\n * Since [AIP-55](https://github.com/aptos-foundation/AIPs/pull/263) Aptos supports\n * `Legacy` and `Unified` authentications.\n *\n * @Legacy includes `ED25519` and `MultiED25519`\n * @Unified includes `SingleSender` and `MultiSender`, where currently\n * `SingleSender` supports `ED25519` and `Secp256k1`, and `MultiSender` supports\n * `MultiED25519`.\n *\n * In TypeScript SDK, we support all of these options:\n *\n * @generate default to generate Legacy Ed25519 keys, with an optional `legacy` boolean argument\n * that lets you generate new keys conforming to the Unified authentication.\n *\n * @fromPrivateKey derives an account by a provided private key and address, with an optional\n * `legacy` boolean argument that lets you generate new keys conforming to the Unified authentication.\n *\n * @fromDerivationPath derives an account with bip44 path and mnemonics,\n *\n */\nexport class Account {\n /**\n * Public key associated with the account\n */\n readonly publicKey: PublicKey;\n\n /**\n * Private key associated with the account\n */\n readonly privateKey: PrivateKey;\n\n /**\n * Account address associated with the account\n */\n readonly accountAddress: AccountAddress;\n\n /**\n * Signing scheme used to sign transactions\n */\n readonly signingScheme: SigningScheme;\n\n /**\n * constructor for Account\n *\n * Need to update this to use the new crypto library if new schemes are added.\n *\n * @param args.privateKey PrivateKey - private key of the account\n * @param args.address AccountAddress - address of the account\n * @param args.legacy optional. If set to true, the keypair authentication keys will be derived with a Legacy scheme.\n * Defaults to deriving an authentication key with a Unified scheme\n *\n * This method is private because it should only be called by the factory static methods.\n * @returns Account\n */\n private constructor(args: { privateKey: PrivateKey; address: AccountAddress; legacy?: boolean }) {\n const { privateKey, address, legacy } = args;\n const useLegacy = legacy ?? true;\n\n // Derive the public key from the private key\n this.publicKey = privateKey.publicKey();\n\n // Derive the signing scheme from the public key\n if (this.publicKey instanceof Ed25519PublicKey) {\n if (useLegacy) {\n this.signingScheme = SigningScheme.Ed25519;\n } else {\n this.publicKey = new AnyPublicKey(this.publicKey);\n this.signingScheme = SigningScheme.SingleKey;\n }\n } else if (this.publicKey instanceof MultiEd25519PublicKey) {\n this.signingScheme = SigningScheme.MultiEd25519;\n } else if (this.publicKey instanceof Secp256k1PublicKey) {\n this.publicKey = new AnyPublicKey(this.publicKey);\n this.signingScheme = SigningScheme.SingleKey;\n } else {\n throw new Error(\"Can not create new Account, unsupported public key type\");\n }\n\n this.privateKey = privateKey;\n this.accountAddress = address;\n }\n\n /**\n * Derives an account with random private key and address.\n *\n * Default generation is using the Legacy ED25519 key\n *\n * @param args optional. Unify GenerateAccount type for Legacy and Unified keys\n *\n * Account input type to generate an account using Legacy\n * Ed25519 or MultiEd25519 keys or without a specified `scheme`.\n * ```\n * GenerateAccountWithLegacyKey = {\n * scheme?: SigningSchemeInput.Ed25519 | SigningSchemeInput.MultiEd25519;\n * legacy: true;\n * };\n * ```\n *\n * Account input type to generate an account using Unified\n * Secp256k1Ecdsa key\n * In this case `legacy` is always false\n * ```\n * GenerateAccountWithUnifiedKey = {\n * scheme: SigningSchemeInput.Secp256k1Ecdsa;\n * legacy?: false;\n * };\n * ```\n *\n * @returns Account with the given signing scheme\n */\n static generate(args?: GenerateAccount): Account {\n const useLegacy = args?.legacy ?? true;\n\n let privateKey: PrivateKey;\n let publicKey: PublicKey;\n\n switch (args?.scheme) {\n case SigningSchemeInput.Secp256k1Ecdsa:\n privateKey = Secp256k1PrivateKey.generate();\n publicKey = new AnyPublicKey(privateKey.publicKey());\n break;\n default:\n privateKey = Ed25519PrivateKey.generate();\n if (useLegacy === false) {\n publicKey = new AnyPublicKey(privateKey.publicKey());\n } else {\n publicKey = privateKey.publicKey();\n }\n }\n const authKey = AuthenticationKey.fromPublicKey({ publicKey });\n\n const address = authKey.derivedAddress();\n return new Account({ privateKey, address, legacy: args?.legacy });\n }\n\n /**\n * Instantiates an account given a private key.\n *\n * This is used as a local calculation and therefore is used to instantiate an `Account`\n * that has not had its authentication key rotated.\n *\n * @param privateKey PrivateKey - private key of the account\n * @param args.legacy optional. If set to false, the keypair generated is a Unified keypair. Defaults\n * to generating a Legacy Ed25519 keypair\n *\n * @returns Account\n */\n static fromPrivateKey(args: { privateKey: PrivateKey; legacy?: boolean }): Account {\n const { privateKey, legacy } = args;\n const useLegacy = legacy ?? true;\n\n let publicKey;\n if (privateKey instanceof Secp256k1PrivateKey) {\n // Secp256k1 single sender\n publicKey = new AnyPublicKey(privateKey.publicKey());\n } else if (privateKey instanceof Ed25519PrivateKey) {\n // legacy Ed25519\n if (useLegacy) {\n publicKey = privateKey.publicKey();\n } else {\n // Ed25519 single sender\n publicKey = new AnyPublicKey(privateKey.publicKey());\n }\n } else {\n throw new Error(`Unsupported private key ${privateKey}`);\n }\n\n const authKey = AuthenticationKey.fromPublicKey({ publicKey });\n const address = authKey.derivedAddress();\n return new Account({ privateKey, address, legacy: useLegacy });\n }\n\n /**\n * Instantiates an account given a private key and a specified account address.\n * This is primarily used to instantiate an `Account` that has had its authentication key rotated.\n *\n * @param args.privateKey PrivateKey - the underlying private key for the account\n * @param args.address AccountAddress - The account address the `Account` will sign for\n * @param args.legacy optional. If set to false, the keypair generated is a Unified keypair. Defaults\n * to generating a Legacy Ed25519 keypair\n *\n * @returns Account\n */\n static fromPrivateKeyAndAddress(args: {\n privateKey: PrivateKey;\n address: AccountAddress;\n legacy?: boolean;\n }): Account {\n const { privateKey, address, legacy } = args;\n return new Account({ privateKey, address, legacy });\n }\n\n /**\n * Derives an account with bip44 path and mnemonics,\n *\n * @param args.scheme The signing scheme to derive with\n * @param args.path the BIP44 derive hardened path (e.g. m/44'/637'/0'/0'/0') for Ed25519,\n * or non-hardened path (e.g. m/44'/637'/0'/0/0) for secp256k1\n * Detailed description: {@link https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki}\n * @param args.mnemonic the mnemonic seed phrase of the account\n * @param args.legacy optional. If set to false, the keypair generated is a Unified keypair. Defaults\n * to generating a Legacy Ed25519 keypair\n *\n * @returns Account\n */\n static fromDerivationPath(args: {\n scheme: SigningSchemeInput;\n path: string;\n mnemonic: string;\n legacy?: boolean;\n }): Account {\n const { path, mnemonic, scheme, legacy } = args;\n let privateKey: PrivateKey;\n switch (scheme) {\n case SigningSchemeInput.Secp256k1Ecdsa:\n privateKey = Secp256k1PrivateKey.fromDerivationPath(path, mnemonic);\n break;\n case SigningSchemeInput.Ed25519:\n privateKey = Ed25519PrivateKey.fromDerivationPath(path, mnemonic);\n break;\n default:\n throw new Error(`Unsupported scheme ${scheme}`);\n }\n return Account.fromPrivateKey({ privateKey, legacy });\n }\n\n /**\n * This key enables account owners to rotate their private key(s)\n * associated with the account without changing the address that hosts their account.\n * See here for more info: {@link https://aptos.dev/concepts/accounts#single-signer-authentication}\n *\n * @param args.publicKey PublicKey - public key of the account\n * @returns The authentication key for the associated account\n */\n static authKey(args: { publicKey: PublicKey }): AuthenticationKey {\n const { publicKey } = args;\n return AuthenticationKey.fromPublicKey({ publicKey });\n }\n\n /**\n * Sign the given message with the private key.\n *\n * TODO: Add sign transaction or specific types\n *\n * @param data in HexInput format\n * @returns Signature\n */\n sign(data: HexInput): Signature {\n return this.privateKey.sign(data);\n }\n\n /**\n * Verify the given message and signature with the public key.\n *\n * @param args.message raw message data in HexInput format\n * @param args.signature signed message Signature\n * @returns\n */\n verifySignature(args: { message: HexInput; signature: Signature }): boolean {\n const { message, signature } = args;\n const rawMessage = Hex.fromHexInput(message).toUint8Array();\n return this.publicKey.verifySignature({ message: rawMessage, signature });\n }\n}\n"],"mappings":"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","names":["Account","args","privateKey","address","legacy","useLegacy","Ed25519PublicKey","AnyPublicKey","MultiEd25519PublicKey","Secp256k1PublicKey","publicKey","Secp256k1PrivateKey","Ed25519PrivateKey","AuthenticationKey","path","mnemonic","scheme","data","message","signature","rawMessage","Hex"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as e}from"./chunk-7TL2MY2B.mjs";import{c as r}from"./chunk-NKTKHC3Z.mjs";import{b as t}from"./chunk-HH5RSP2H.mjs";import{e as o}from"./chunk-PDLUCVJB.mjs";import{f as n}from"./chunk-KC64ESLO.mjs";async function O(i){let{aptosConfig:s,sender:c,recipient:a,amount:p,coinType:u,options:m}=i,f=u??n;return await e({aptosConfig:s,sender:c.accountAddress,data:{function:"0x1::aptos_account::transfer_coins",typeArguments:[r(f)],functionArguments:[t.from(a),new o(p)]},options:m})}export{O as a};
|
|
2
|
+
//# sourceMappingURL=chunk-J5OKXARS.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/internal/coin.ts"],"sourcesContent":["import { AptosConfig } from \"../api/aptosConfig\";\nimport { U64 } from \"../bcs/serializable/movePrimitives\";\nimport { Account, AccountAddress, AccountAddressInput } from \"../core\";\nimport { InputGenerateTransactionOptions, InputSingleSignerTransaction } from \"../transactions/types\";\nimport { AnyNumber, MoveStructType } from \"../types\";\nimport { APTOS_COIN } from \"../utils/const\";\nimport { generateTransaction } from \"./transactionSubmission\";\nimport { parseTypeTag } from \"../transactions/typeTag/parser\";\n\nexport async function transferCoinTransaction(args: {\n aptosConfig: AptosConfig;\n sender: Account;\n recipient: AccountAddressInput;\n amount: AnyNumber;\n coinType?: MoveStructType;\n options?: InputGenerateTransactionOptions;\n}): Promise<InputSingleSignerTransaction> {\n const { aptosConfig, sender, recipient, amount, coinType, options } = args;\n const coinStructType = coinType ?? APTOS_COIN;\n const transaction = await generateTransaction({\n aptosConfig,\n sender: sender.accountAddress,\n data: {\n function: \"0x1::aptos_account::transfer_coins\",\n typeArguments: [parseTypeTag(coinStructType)],\n functionArguments: [AccountAddress.from(recipient), new U64(amount)],\n },\n options,\n });\n\n return transaction as InputSingleSignerTransaction;\n}\n"],"mappings":"6MASA,eAAsBA,EAAwBC,EAOJ,CACxC,GAAM,CAAE,YAAAC,EAAa,OAAAC,EAAQ,UAAAC,EAAW,OAAAC,EAAQ,SAAAC,EAAU,QAAAC,CAAQ,EAAIN,EAChEO,EAAiBF,GAAYG,EAYnC,OAXoB,MAAMC,EAAoB,CAC5C,YAAAR,EACA,OAAQC,EAAO,eACf,KAAM,CACJ,SAAU,qCACV,cAAe,CAACQ,EAAaH,CAAc,CAAC,EAC5C,kBAAmB,CAACI,EAAe,KAAKR,CAAS,EAAG,IAAIS,EAAIR,CAAM,CAAC,CACrE,EACA,QAAAE,CACF,CAAC,CAGH","names":["transferCoinTransaction","args","aptosConfig","sender","recipient","amount","coinType","options","coinStructType","APTOS_COIN","generateTransaction","parseTypeTag","AccountAddress","U64"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as c}from"./chunk-IPJKGHQY.mjs";import{a as d,b as p}from"./chunk-FNB6CFQR.mjs";import{a as z}from"./chunk-CZZJAR3B.mjs";import{a as g}from"./chunk-UVGCVCNG.mjs";import{a as y,c as b}from"./chunk-BIUGRAMO.mjs";import{a as o}from"./chunk-27P7PELS.mjs";var s=class extends o{static deserialize(r){let e=r.deserializeUleb128AsU32();switch(e){case 0:return a.load(r);case 1:return l.load(r);case 2:return u.load(r);case 3:return n.load(r);default:throw new Error(`Unknown variant index for AccountAuthenticator: ${e}`)}}},a=class extends s{constructor(e,i){super();this.public_key=e,this.signature=i}serialize(e){e.serializeU32AsUleb128(0),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let i=y.deserialize(e),t=b.deserialize(e);return new a(i,t)}},l=class extends s{constructor(e,i){super();this.public_key=e,this.signature=i}serialize(e){e.serializeU32AsUleb128(1),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let i=d.deserialize(e),t=p.deserialize(e);return new l(i,t)}},u=class extends s{constructor(e,i){super();this.public_key=e,this.signature=i}serialize(e){e.serializeU32AsUleb128(2),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let i=g.deserialize(e),t=c.deserialize(e);return new u(i,t)}},n=class extends s{constructor(e,i,t){super();this.public_keys=e,this.signatures=i,this.signatures_bitmap=t}serialize(e){e.serializeU32AsUleb128(3),this.public_keys.serialize(e),e.serializeVector(this.signatures),e.serializeBytes(this.signatures_bitmap)}static load(e){let i=z.deserialize(e),t=e.deserializeVector(c),S=e.deserializeBytes();return new n(i,t,S)}};export{s as a,a as b,l as c,u as d,n as e};
|
|
2
|
+
//# sourceMappingURL=chunk-JTGGMXB7.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/transactions/authenticator/account.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/* eslint-disable @typescript-eslint/naming-convention */\n\nimport { Serializer, Deserializer, Serializable } from \"../../bcs\";\nimport { AnyPublicKey } from \"../../core/crypto/anyPublicKey\";\nimport { AnySignature } from \"../../core/crypto/anySignature\";\nimport { Ed25519PublicKey, Ed25519Signature } from \"../../core/crypto/ed25519\";\nimport { MultiEd25519PublicKey, MultiEd25519Signature } from \"../../core/crypto/multiEd25519\";\nimport { MultiKey } from \"../../core/crypto/multiKey\";\nimport { AccountAuthenticatorVariant } from \"../../types\";\n\nexport abstract class AccountAuthenticator extends Serializable {\n abstract serialize(serializer: Serializer): void;\n\n static deserialize(deserializer: Deserializer): AccountAuthenticator {\n const index = deserializer.deserializeUleb128AsU32();\n switch (index) {\n case AccountAuthenticatorVariant.Ed25519:\n return AccountAuthenticatorEd25519.load(deserializer);\n case AccountAuthenticatorVariant.MultiEd25519:\n return AccountAuthenticatorMultiEd25519.load(deserializer);\n case AccountAuthenticatorVariant.SingleKey:\n return AccountAuthenticatorSingleKey.load(deserializer);\n case AccountAuthenticatorVariant.MultiKey:\n return AccountAuthenticatorMultiKey.load(deserializer);\n default:\n throw new Error(`Unknown variant index for AccountAuthenticator: ${index}`);\n }\n }\n}\n\n/**\n * Transaction authenticator Ed25519 for a multi signer transaction\n *\n * @param public_key Account's Ed25519 public key.\n * @param signature Account's Ed25519 signature\n *\n */\nexport class AccountAuthenticatorEd25519 extends AccountAuthenticator {\n public readonly public_key: Ed25519PublicKey;\n\n public readonly signature: Ed25519Signature;\n\n constructor(public_key: Ed25519PublicKey, signature: Ed25519Signature) {\n super();\n this.public_key = public_key;\n this.signature = signature;\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(AccountAuthenticatorVariant.Ed25519);\n this.public_key.serialize(serializer);\n this.signature.serialize(serializer);\n }\n\n static load(deserializer: Deserializer): AccountAuthenticatorEd25519 {\n const public_key = Ed25519PublicKey.deserialize(deserializer);\n const signature = Ed25519Signature.deserialize(deserializer);\n return new AccountAuthenticatorEd25519(public_key, signature);\n }\n}\n\n/**\n * Transaction authenticator Multi Ed25519 for a multi signers transaction\n *\n * @param public_key Account's MultiEd25519 public key.\n * @param signature Account's MultiEd25519 signature\n *\n */\nexport class AccountAuthenticatorMultiEd25519 extends AccountAuthenticator {\n public readonly public_key: MultiEd25519PublicKey;\n\n public readonly signature: MultiEd25519Signature;\n\n constructor(public_key: MultiEd25519PublicKey, signature: MultiEd25519Signature) {\n super();\n this.public_key = public_key;\n this.signature = signature;\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(AccountAuthenticatorVariant.MultiEd25519);\n this.public_key.serialize(serializer);\n this.signature.serialize(serializer);\n }\n\n static load(deserializer: Deserializer): AccountAuthenticatorMultiEd25519 {\n const public_key = MultiEd25519PublicKey.deserialize(deserializer);\n const signature = MultiEd25519Signature.deserialize(deserializer);\n return new AccountAuthenticatorMultiEd25519(public_key, signature);\n }\n}\n\n/**\n * AccountAuthenticatorSingleKey for a single signer\n *\n * @param public_key AnyPublicKey\n * @param signature AnySignature\n *\n */\nexport class AccountAuthenticatorSingleKey extends AccountAuthenticator {\n public readonly public_key: AnyPublicKey;\n\n public readonly signature: AnySignature;\n\n constructor(public_key: AnyPublicKey, signature: AnySignature) {\n super();\n this.public_key = public_key;\n this.signature = signature;\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(AccountAuthenticatorVariant.SingleKey);\n this.public_key.serialize(serializer);\n this.signature.serialize(serializer);\n }\n\n static load(deserializer: Deserializer): AccountAuthenticatorSingleKey {\n const public_key = AnyPublicKey.deserialize(deserializer);\n const signature = AnySignature.deserialize(deserializer);\n return new AccountAuthenticatorSingleKey(public_key, signature);\n }\n}\n\n/**\n * AccountAuthenticatorMultiKey for a multi signer\n *\n * @param public_keys MultiKey\n * @param signatures Signature\n *\n */\nexport class AccountAuthenticatorMultiKey extends AccountAuthenticator {\n public readonly public_keys: MultiKey;\n\n public readonly signatures: Array<AnySignature>;\n\n public readonly signatures_bitmap: Uint8Array;\n\n constructor(public_keys: MultiKey, signatures: Array<AnySignature>, signatures_bitmap: Uint8Array) {\n super();\n this.public_keys = public_keys;\n this.signatures = signatures;\n this.signatures_bitmap = signatures_bitmap;\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(AccountAuthenticatorVariant.MultiKey);\n this.public_keys.serialize(serializer);\n serializer.serializeVector<AnySignature>(this.signatures);\n serializer.serializeBytes(this.signatures_bitmap);\n }\n\n static load(deserializer: Deserializer): AccountAuthenticatorMultiKey {\n const public_keys = MultiKey.deserialize(deserializer);\n const signatures = deserializer.deserializeVector(AnySignature);\n const signatures_bitmap = deserializer.deserializeBytes();\n return new AccountAuthenticatorMultiKey(public_keys, signatures, signatures_bitmap);\n }\n}\n"],"mappings":"oQAaO,IAAeA,EAAf,cAA4CC,CAAa,CAG9D,OAAO,YAAYC,EAAkD,CACnE,IAAMC,EAAQD,EAAa,wBAAwB,EACnD,OAAQC,EAAO,CACb,OACE,OAAOC,EAA4B,KAAKF,CAAY,EACtD,OACE,OAAOG,EAAiC,KAAKH,CAAY,EAC3D,OACE,OAAOI,EAA8B,KAAKJ,CAAY,EACxD,OACE,OAAOK,EAA6B,KAAKL,CAAY,EACvD,QACE,MAAM,IAAI,MAAM,mDAAmDC,GAAO,CAC9E,CACF,CACF,EASaC,EAAN,cAA0CJ,CAAqB,CAKpE,YAAYQ,EAA8BC,EAA6B,CACrE,MAAM,EACN,KAAK,WAAaD,EAClB,KAAK,UAAYC,CACnB,CAEA,UAAUC,EAA8B,CACtCA,EAAW,uBAAyD,EACpE,KAAK,WAAW,UAAUA,CAAU,EACpC,KAAK,UAAU,UAAUA,CAAU,CACrC,CAEA,OAAO,KAAKR,EAAyD,CACnE,IAAMM,EAAaG,EAAiB,YAAYT,CAAY,EACtDO,EAAYG,EAAiB,YAAYV,CAAY,EAC3D,OAAO,IAAIE,EAA4BI,EAAYC,CAAS,CAC9D,CACF,EASaJ,EAAN,cAA+CL,CAAqB,CAKzE,YAAYQ,EAAmCC,EAAkC,CAC/E,MAAM,EACN,KAAK,WAAaD,EAClB,KAAK,UAAYC,CACnB,CAEA,UAAUC,EAA8B,CACtCA,EAAW,uBAA8D,EACzE,KAAK,WAAW,UAAUA,CAAU,EACpC,KAAK,UAAU,UAAUA,CAAU,CACrC,CAEA,OAAO,KAAKR,EAA8D,CACxE,IAAMM,EAAaK,EAAsB,YAAYX,CAAY,EAC3DO,EAAYK,EAAsB,YAAYZ,CAAY,EAChE,OAAO,IAAIG,EAAiCG,EAAYC,CAAS,CACnE,CACF,EASaH,EAAN,cAA4CN,CAAqB,CAKtE,YAAYQ,EAA0BC,EAAyB,CAC7D,MAAM,EACN,KAAK,WAAaD,EAClB,KAAK,UAAYC,CACnB,CAEA,UAAUC,EAA8B,CACtCA,EAAW,uBAA2D,EACtE,KAAK,WAAW,UAAUA,CAAU,EACpC,KAAK,UAAU,UAAUA,CAAU,CACrC,CAEA,OAAO,KAAKR,EAA2D,CACrE,IAAMM,EAAaO,EAAa,YAAYb,CAAY,EAClDO,EAAYO,EAAa,YAAYd,CAAY,EACvD,OAAO,IAAII,EAA8BE,EAAYC,CAAS,CAChE,CACF,EASaF,EAAN,cAA2CP,CAAqB,CAOrE,YAAYiB,EAAuBC,EAAiCC,EAA+B,CACjG,MAAM,EACN,KAAK,YAAcF,EACnB,KAAK,WAAaC,EAClB,KAAK,kBAAoBC,CAC3B,CAEA,UAAUT,EAA8B,CACtCA,EAAW,uBAA0D,EACrE,KAAK,YAAY,UAAUA,CAAU,EACrCA,EAAW,gBAA8B,KAAK,UAAU,EACxDA,EAAW,eAAe,KAAK,iBAAiB,CAClD,CAEA,OAAO,KAAKR,EAA0D,CACpE,IAAMe,EAAcG,EAAS,YAAYlB,CAAY,EAC/CgB,EAAahB,EAAa,kBAAkBc,CAAY,EACxDG,EAAoBjB,EAAa,iBAAiB,EACxD,OAAO,IAAIK,EAA6BU,EAAaC,EAAYC,CAAiB,CACpF,CACF","names":["AccountAuthenticator","Serializable","deserializer","index","AccountAuthenticatorEd25519","AccountAuthenticatorMultiEd25519","AccountAuthenticatorSingleKey","AccountAuthenticatorMultiKey","public_key","signature","serializer","Ed25519PublicKey","Ed25519Signature","MultiEd25519PublicKey","MultiEd25519Signature","AnyPublicKey","AnySignature","public_keys","signatures","signatures_bitmap","MultiKey"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var T=(_=>(_[_.FULLNODE=0]="FULLNODE",_[_.INDEXER=1]="INDEXER",_[_.FAUCET=2]="FAUCET",_))(T||{}),E="devnet",n=2e5,N=20,r=20,O="0x1::aptos_coin::AptosCoin",c="APTOS::RawTransaction",A="APTOS::RawTransactionWithData";export{T as a,E as b,n as c,N as d,r as e,O as f,c as g,A as h};
|
|
2
|
+
//# sourceMappingURL=chunk-KC64ESLO.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/const.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Network } from \"./apiEndpoints\";\n\n/**\n * Type of API endpoint for request routing\n */\nexport enum AptosApiType {\n FULLNODE,\n INDEXER,\n FAUCET,\n}\n\nexport const DEFAULT_NETWORK = Network.DEVNET;\n\n/**\n * The default max gas amount when none is given.\n *\n * This is the maximum number of gas units that will be used by a transaction before being rejected.\n *\n * Note that max gas amount varies based on the transaction. A larger transaction will go over this\n * default gas amount, and the value will need to be changed for the specific transaction.\n */\nexport const DEFAULT_MAX_GAS_AMOUNT = 200000;\n\n/**\n * The default transaction expiration seconds from now.\n *\n * This time is how long until the blockchain nodes will reject the transaction.\n *\n * Note that the transaction expiration time varies based on network connection and network load. It may need to be\n * increased for the transaction to be processed.\n */\nexport const DEFAULT_TXN_EXP_SEC_FROM_NOW = 20;\n\n/**\n * The default number of seconds to wait for a transaction to be processed.\n *\n * This time is the amount of time that the SDK will wait for a transaction to be processed when waiting for\n * the results of the transaction. It may take longer based on network connection and network load.\n */\nexport const DEFAULT_TXN_TIMEOUT_SEC = 20;\n\n/**\n * The default gas currency for the network.\n */\nexport const APTOS_COIN = \"0x1::aptos_coin::AptosCoin\";\n\nexport const RAW_TRANSACTION_SALT = \"APTOS::RawTransaction\";\nexport const RAW_TRANSACTION_WITH_DATA_SALT = \"APTOS::RawTransactionWithData\";\n"],"mappings":"AAQO,IAAKA,OACVA,IAAA,uBACAA,IAAA,qBACAA,IAAA,mBAHUA,OAAA,IAMCC,WAUAC,EAAyB,IAUzBC,EAA+B,GAQ/BC,EAA0B,GAK1BC,EAAa,6BAEbC,EAAuB,wBACvBC,EAAiC","names":["AptosApiType","DEFAULT_NETWORK","DEFAULT_MAX_GAS_AMOUNT","DEFAULT_TXN_EXP_SEC_FROM_NOW","DEFAULT_TXN_TIMEOUT_SEC","APTOS_COIN","RAW_TRANSACTION_SALT","RAW_TRANSACTION_WITH_DATA_SALT"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{g as n}from"./chunk-MIBLZSNS.mjs";import{n as o,q as r,r as g}from"./chunk-BTK34A5U.mjs";async function p(t){let{aptosConfig:i,options:e}=t,s={query:g,variables:{where_condition:e?.where,limit:e?.pagination?.limit,offset:e?.pagination?.offset}};return(await n({aptosConfig:i,query:s,originMethod:"getFungibleAssetMetadata"})).fungible_asset_metadata}async function A(t){let{aptosConfig:i,options:e}=t,s={query:r,variables:{where_condition:e?.where,limit:e?.pagination?.limit,offset:e?.pagination?.offset}};return(await n({aptosConfig:i,query:s,originMethod:"getFungibleAssetActivities"})).fungible_asset_activities}async function c(t){let{aptosConfig:i,options:e}=t,s={query:o,variables:{where_condition:e?.where,limit:e?.pagination?.limit,offset:e?.pagination?.offset}};return(await n({aptosConfig:i,query:s,originMethod:"getCurrentFungibleAssetBalances"})).current_fungible_asset_balances}export{p as a,A as b,c};
|
|
2
|
+
//# sourceMappingURL=chunk-KFP7MDSD.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/internal/fungibleAsset.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * This file contains the underlying implementations for exposed API surface in\n * the {@link api/fungible_asset}. By moving the methods out into a separate file,\n * other namespaces and processes can access these methods without depending on the entire\n * fungible_asset namespace and without having a dependency cycle error.\n */\n\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport {\n GetCurrentFungibleAssetBalancesResponse,\n GetFungibleAssetActivitiesResponse,\n GetFungibleAssetMetadataResponse,\n PaginationArgs,\n} from \"../types\";\nimport { queryIndexer } from \"./general\";\nimport {\n GetCurrentFungibleAssetBalances,\n GetFungibleAssetActivities,\n GetFungibleAssetMetadata,\n} from \"../types/generated/queries\";\nimport {\n GetCurrentFungibleAssetBalancesQuery,\n GetFungibleAssetActivitiesQuery,\n GetFungibleAssetMetadataQuery,\n} from \"../types/generated/operations\";\nimport {\n CurrentFungibleAssetBalancesBoolExp,\n FungibleAssetActivitiesBoolExp,\n FungibleAssetMetadataBoolExp,\n} from \"../types/generated/types\";\n\nexport async function getFungibleAssetMetadata(args: {\n aptosConfig: AptosConfig;\n options?: {\n pagination?: PaginationArgs;\n where?: FungibleAssetMetadataBoolExp;\n };\n}): Promise<GetFungibleAssetMetadataResponse> {\n const { aptosConfig, options } = args;\n\n const graphqlQuery = {\n query: GetFungibleAssetMetadata,\n variables: {\n where_condition: options?.where,\n limit: options?.pagination?.limit,\n offset: options?.pagination?.offset,\n },\n };\n\n const data = await queryIndexer<GetFungibleAssetMetadataQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getFungibleAssetMetadata\",\n });\n\n return data.fungible_asset_metadata;\n}\n\nexport async function getFungibleAssetActivities(args: {\n aptosConfig: AptosConfig;\n options?: {\n pagination?: PaginationArgs;\n where?: FungibleAssetActivitiesBoolExp;\n };\n}): Promise<GetFungibleAssetActivitiesResponse> {\n const { aptosConfig, options } = args;\n\n const graphqlQuery = {\n query: GetFungibleAssetActivities,\n variables: {\n where_condition: options?.where,\n limit: options?.pagination?.limit,\n offset: options?.pagination?.offset,\n },\n };\n\n const data = await queryIndexer<GetFungibleAssetActivitiesQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getFungibleAssetActivities\",\n });\n\n return data.fungible_asset_activities;\n}\n\nexport async function getCurrentFungibleAssetBalances(args: {\n aptosConfig: AptosConfig;\n options?: {\n pagination?: PaginationArgs;\n where?: CurrentFungibleAssetBalancesBoolExp;\n };\n}): Promise<GetCurrentFungibleAssetBalancesResponse> {\n const { aptosConfig, options } = args;\n\n const graphqlQuery = {\n query: GetCurrentFungibleAssetBalances,\n variables: {\n where_condition: options?.where,\n limit: options?.pagination?.limit,\n offset: options?.pagination?.offset,\n },\n };\n\n const data = await queryIndexer<GetCurrentFungibleAssetBalancesQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getCurrentFungibleAssetBalances\",\n });\n\n return data.current_fungible_asset_balances;\n}\n"],"mappings":"gGAkCA,eAAsBA,EAAyBC,EAMD,CAC5C,GAAM,CAAE,YAAAC,EAAa,QAAAC,CAAQ,EAAIF,EAE3BG,EAAe,CACnB,MAAOC,EACP,UAAW,CACT,gBAAiBF,GAAS,MAC1B,MAAOA,GAAS,YAAY,MAC5B,OAAQA,GAAS,YAAY,MAC/B,CACF,EAQA,OANa,MAAMG,EAA4C,CAC7D,YAAAJ,EACA,MAAOE,EACP,aAAc,0BAChB,CAAC,GAEW,uBACd,CAEA,eAAsBG,EAA2BN,EAMD,CAC9C,GAAM,CAAE,YAAAC,EAAa,QAAAC,CAAQ,EAAIF,EAE3BG,EAAe,CACnB,MAAOI,EACP,UAAW,CACT,gBAAiBL,GAAS,MAC1B,MAAOA,GAAS,YAAY,MAC5B,OAAQA,GAAS,YAAY,MAC/B,CACF,EAQA,OANa,MAAMG,EAA8C,CAC/D,YAAAJ,EACA,MAAOE,EACP,aAAc,4BAChB,CAAC,GAEW,yBACd,CAEA,eAAsBK,EAAgCR,EAMD,CACnD,GAAM,CAAE,YAAAC,EAAa,QAAAC,CAAQ,EAAIF,EAE3BG,EAAe,CACnB,MAAOM,EACP,UAAW,CACT,gBAAiBP,GAAS,MAC1B,MAAOA,GAAS,YAAY,MAC5B,OAAQA,GAAS,YAAY,MAC/B,CACF,EAQA,OANa,MAAMG,EAAmD,CACpE,YAAAJ,EACA,MAAOE,EACP,aAAc,iCAChB,CAAC,GAEW,+BACd","names":["getFungibleAssetMetadata","args","aptosConfig","options","graphqlQuery","GetFungibleAssetMetadata","queryIndexer","getFungibleAssetActivities","GetFungibleAssetActivities","getCurrentFungibleAssetBalances","GetCurrentFungibleAssetBalances"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as f}from"./chunk-SJLO3JIH.mjs";import{a as g}from"./chunk-DNYVUM3K.mjs";import{a as l}from"./chunk-KYWYIK5P.mjs";import{a as m}from"./chunk-IXMH6AXJ.mjs";import{a as p}from"./chunk-KPESAXVI.mjs";import{a as h}from"./chunk-3YOV42H5.mjs";import{a as s}from"./chunk-TYHBYRUA.mjs";import{a as u}from"./chunk-Z56AKXJ7.mjs";import{a as A}from"./chunk-N6XWY4UT.mjs";import{a as r}from"./chunk-XFSL7O6Q.mjs";import{a}from"./chunk-VAGYTPSI.mjs";import{a as c}from"./chunk-WNEZCERQ.mjs";var n=class{constructor(i){this.config=new A(i),this.account=new s(this.config),this.ans=new u(this.config),this.coin=new r(this.config),this.digitalAsset=new a(this.config),this.event=new c(this.config),this.faucet=new f(this.config),this.fungibleAsset=new g(this.config),this.general=new l(this.config),this.staking=new m(this.config),this.transaction=new p(this.config),this.transactionSubmission=new h(this.config)}};function t(y,i,d){Object.getOwnPropertyNames(i.prototype).forEach(o=>{let e=Object.getOwnPropertyDescriptor(i.prototype,o);!e||(e.value=function(...b){return this[d][o](...b)},Object.defineProperty(y.prototype,o,e))})}t(n,s,"account");t(n,u,"ans");t(n,r,"coin");t(n,a,"digitalAsset");t(n,c,"event");t(n,f,"faucet");t(n,g,"fungibleAsset");t(n,l,"general");t(n,m,"staking");t(n,p,"transaction");t(n,h,"transactionSubmission");export{n as a};
|
|
2
|
+
//# sourceMappingURL=chunk-KJDY66XF.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/api/aptos.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Account } from \"./account\";\nimport { AptosConfig } from \"./aptosConfig\";\nimport { Coin } from \"./coin\";\nimport { DigitalAsset } from \"./digitalAsset\";\nimport { Event } from \"./event\";\nimport { Faucet } from \"./faucet\";\nimport { FungibleAsset } from \"./fungibleAsset\";\nimport { General } from \"./general\";\nimport { ANS } from \"./ans\";\nimport { Staking } from \"./staking\";\nimport { Transaction } from \"./transaction\";\nimport { TransactionSubmission } from \"./transactionSubmission\";\n\n/**\n * This class is the main entry point into Aptos's\n * APIs and separates functionality into different namespaces.\n *\n * To use the SDK, create a new Aptos instance to get access\n * to all the sdk functionality.\n */\nexport class Aptos {\n readonly config: AptosConfig;\n\n readonly account: Account;\n\n readonly ans: ANS;\n\n readonly coin: Coin;\n\n readonly digitalAsset: DigitalAsset;\n\n readonly event: Event;\n\n readonly faucet: Faucet;\n\n readonly fungibleAsset: FungibleAsset;\n\n readonly general: General;\n\n readonly staking: Staking;\n\n readonly transaction: Transaction;\n\n readonly transactionSubmission: TransactionSubmission;\n\n constructor(settings?: AptosConfig) {\n this.config = new AptosConfig(settings);\n this.account = new Account(this.config);\n this.ans = new ANS(this.config);\n this.coin = new Coin(this.config);\n this.digitalAsset = new DigitalAsset(this.config);\n this.event = new Event(this.config);\n this.faucet = new Faucet(this.config);\n this.fungibleAsset = new FungibleAsset(this.config);\n this.general = new General(this.config);\n this.staking = new Staking(this.config);\n this.transaction = new Transaction(this.config);\n this.transactionSubmission = new TransactionSubmission(this.config);\n }\n}\n\nexport interface Aptos\n extends Account,\n Coin,\n DigitalAsset,\n Event,\n Faucet,\n FungibleAsset,\n General,\n Staking,\n Transaction,\n ANS,\n TransactionSubmission {}\n\n/**\nIn TypeScript, we can’t inherit or extend from more than one class,\nMixins helps us to get around that by creating a partial classes\nthat we can combine to form a single class that contains all the methods and properties from the partial classes.\n{@link https://www.typescriptlang.org/docs/handbook/mixins.html#alternative-pattern}\n\nHere, we combine any subclass and the Aptos class.\n*/\nfunction applyMixin(targetClass: any, baseClass: any, baseClassProp: string) {\n // Mixin instance methods\n Object.getOwnPropertyNames(baseClass.prototype).forEach((propertyName) => {\n const propertyDescriptor = Object.getOwnPropertyDescriptor(baseClass.prototype, propertyName);\n if (!propertyDescriptor) return;\n // eslint-disable-next-line func-names\n propertyDescriptor.value = function (...args: any) {\n return (this as any)[baseClassProp][propertyName](...args);\n };\n Object.defineProperty(targetClass.prototype, propertyName, propertyDescriptor);\n });\n}\n\napplyMixin(Aptos, Account, \"account\");\napplyMixin(Aptos, ANS, \"ans\");\napplyMixin(Aptos, Coin, \"coin\");\napplyMixin(Aptos, DigitalAsset, \"digitalAsset\");\napplyMixin(Aptos, Event, \"event\");\napplyMixin(Aptos, Faucet, \"faucet\");\napplyMixin(Aptos, FungibleAsset, \"fungibleAsset\");\napplyMixin(Aptos, General, \"general\");\napplyMixin(Aptos, Staking, \"staking\");\napplyMixin(Aptos, Transaction, \"transaction\");\napplyMixin(Aptos, TransactionSubmission, \"transactionSubmission\");\n"],"mappings":"ueAuBO,IAAMA,EAAN,KAAY,CAyBjB,YAAYC,EAAwB,CAClC,KAAK,OAAS,IAAIC,EAAYD,CAAQ,EACtC,KAAK,QAAU,IAAIE,EAAQ,KAAK,MAAM,EACtC,KAAK,IAAM,IAAIC,EAAI,KAAK,MAAM,EAC9B,KAAK,KAAO,IAAIC,EAAK,KAAK,MAAM,EAChC,KAAK,aAAe,IAAIC,EAAa,KAAK,MAAM,EAChD,KAAK,MAAQ,IAAIC,EAAM,KAAK,MAAM,EAClC,KAAK,OAAS,IAAIC,EAAO,KAAK,MAAM,EACpC,KAAK,cAAgB,IAAIC,EAAc,KAAK,MAAM,EAClD,KAAK,QAAU,IAAIC,EAAQ,KAAK,MAAM,EACtC,KAAK,QAAU,IAAIC,EAAQ,KAAK,MAAM,EACtC,KAAK,YAAc,IAAIC,EAAY,KAAK,MAAM,EAC9C,KAAK,sBAAwB,IAAIC,EAAsB,KAAK,MAAM,CACpE,CACF,EAuBA,SAASC,EAAWC,EAAkBC,EAAgBC,EAAuB,CAE3E,OAAO,oBAAoBD,EAAU,SAAS,EAAE,QAASE,GAAiB,CACxE,IAAMC,EAAqB,OAAO,yBAAyBH,EAAU,UAAWE,CAAY,EACxF,CAACC,IAELA,EAAmB,MAAQ,YAAaC,EAAW,CACjD,OAAQ,KAAaH,GAAeC,GAAc,GAAGE,CAAI,CAC3D,EACA,OAAO,eAAeL,EAAY,UAAWG,EAAcC,CAAkB,EAC/E,CAAC,CACH,CAEAL,EAAWd,EAAOG,EAAS,SAAS,EACpCW,EAAWd,EAAOI,EAAK,KAAK,EAC5BU,EAAWd,EAAOK,EAAM,MAAM,EAC9BS,EAAWd,EAAOM,EAAc,cAAc,EAC9CQ,EAAWd,EAAOO,EAAO,OAAO,EAChCO,EAAWd,EAAOQ,EAAQ,QAAQ,EAClCM,EAAWd,EAAOS,EAAe,eAAe,EAChDK,EAAWd,EAAOU,EAAS,SAAS,EACpCI,EAAWd,EAAOW,EAAS,SAAS,EACpCG,EAAWd,EAAOY,EAAa,aAAa,EAC5CE,EAAWd,EAAOa,EAAuB,uBAAuB","names":["Aptos","settings","AptosConfig","Account","ANS","Coin","DigitalAsset","Event","Faucet","FungibleAsset","General","Staking","Transaction","TransactionSubmission","applyMixin","targetClass","baseClass","baseClassProp","propertyName","propertyDescriptor","args"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as e}from"./chunk-ADR4XQPR.mjs";import{a as n}from"./chunk-WGXAIQ7K.mjs";import{a as i}from"./chunk-27P7PELS.mjs";var r=class extends i{constructor(t,a){super();this.raw_txn=t,this.authenticator=a}serialize(t){this.raw_txn.serialize(t),this.authenticator.serialize(t)}static deserialize(t){let a=n.deserialize(t),o=e.deserialize(t);return new r(a,o)}};export{r as a};
|
|
2
|
+
//# sourceMappingURL=chunk-KNLMUSIO.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/transactions/instances/signedTransaction.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/* eslint-disable @typescript-eslint/naming-convention */\n\nimport { TransactionAuthenticator } from \"../authenticator/transaction\";\nimport { Deserializer } from \"../../bcs/deserializer\";\nimport { Serializable, Serializer } from \"../../bcs/serializer\";\nimport { RawTransaction } from \"./rawTransaction\";\n\nexport class SignedTransaction extends Serializable {\n public readonly raw_txn: RawTransaction;\n\n public readonly authenticator: TransactionAuthenticator;\n\n /**\n * A SignedTransaction consists of a raw transaction and an authenticator. The authenticator\n * contains a client's public key and the signature of the raw transaction.\n *\n * @see {@link https://aptos.dev/integration/creating-a-signed-transaction | Creating a Signed Transaction}\n *\n * @param raw_txn\n * @param authenticator Contains a client's public key and the signature of the raw transaction.\n * Authenticator has 3 flavors: single signature, multi-signature and multi-agent.\n * @see {@link https://github.com/aptos-labs/aptos-core/blob/main/types/src/transaction/authenticator.rs} for details.\n */\n constructor(raw_txn: RawTransaction, authenticator: TransactionAuthenticator) {\n super();\n this.raw_txn = raw_txn;\n this.authenticator = authenticator;\n }\n\n serialize(serializer: Serializer): void {\n this.raw_txn.serialize(serializer);\n this.authenticator.serialize(serializer);\n }\n\n static deserialize(deserializer: Deserializer): SignedTransaction {\n const raw_txn = RawTransaction.deserialize(deserializer);\n const authenticator = TransactionAuthenticator.deserialize(deserializer);\n return new SignedTransaction(raw_txn, authenticator);\n }\n}\n"],"mappings":"2HAUO,IAAMA,EAAN,cAAgCC,CAAa,CAgBlD,YAAYC,EAAyBC,EAAyC,CAC5E,MAAM,EACN,KAAK,QAAUD,EACf,KAAK,cAAgBC,CACvB,CAEA,UAAUC,EAA8B,CACtC,KAAK,QAAQ,UAAUA,CAAU,EACjC,KAAK,cAAc,UAAUA,CAAU,CACzC,CAEA,OAAO,YAAYC,EAA+C,CAChE,IAAMH,EAAUI,EAAe,YAAYD,CAAY,EACjDF,EAAgBI,EAAyB,YAAYF,CAAY,EACvE,OAAO,IAAIL,EAAkBE,EAASC,CAAa,CACrD,CACF","names":["SignedTransaction","Serializable","raw_txn","authenticator","serializer","deserializer","RawTransaction","TransactionAuthenticator"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as o,b as s,c as i,d as t,e as a,f as r}from"./chunk-ZT2A5ABR.mjs";var e=class{constructor(n){this.config=n}async getTransactions(n){return o({aptosConfig:this.config,...n})}async getTransactionByVersion(n){return i({aptosConfig:this.config,...n})}async getTransactionByHash(n){return t({aptosConfig:this.config,...n})}async isPendingTransaction(n){return a({aptosConfig:this.config,...n})}async waitForTransaction(n){return r({aptosConfig:this.config,...n})}async getGasPriceEstimation(){return s({aptosConfig:this.config})}};export{e as a};
|
|
2
|
+
//# sourceMappingURL=chunk-KPESAXVI.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/api/transaction.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { AptosConfig } from \"./aptosConfig\";\nimport {\n getGasPriceEstimation,\n getTransactionByHash,\n getTransactionByVersion,\n getTransactions,\n isTransactionPending,\n waitForTransaction,\n} from \"../internal/transaction\";\nimport {\n AnyNumber,\n GasEstimation,\n HexInput,\n PaginationArgs,\n TransactionResponse,\n WaitForTransactionOptions,\n} from \"../types\";\n\nexport class Transaction {\n readonly config: AptosConfig;\n\n constructor(config: AptosConfig) {\n this.config = config;\n }\n\n /**\n * Queries on-chain transactions. This function will not return pending\n * transactions. For that, use `getTransactionsByHash`.\n *\n * @param args.options.offset The number transaction to start with\n * @param args.options.limit Number of results to return\n *\n * @returns Array of on-chain transactions\n */\n async getTransactions(args?: { options?: PaginationArgs }): Promise<TransactionResponse[]> {\n return getTransactions({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries on-chain transaction by version. This function will not return pending transactions.\n *\n * @param args.ledgerVersion - Transaction version is an unsigned 64-bit number.\n * @returns On-chain transaction. Only on-chain transactions have versions, so this\n * function cannot be used to query pending transactions.\n */\n async getTransactionByVersion(args: { ledgerVersion: AnyNumber }): Promise<TransactionResponse> {\n return getTransactionByVersion({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries on-chain transaction by transaction hash. This function will return pending transactions.\n * @param args.transactionHash - Transaction hash should be hex-encoded bytes string with 0x prefix.\n * @returns Transaction from mempool (pending) or on-chain (committed) transaction\n */\n async getTransactionByHash(args: { transactionHash: HexInput }): Promise<TransactionResponse> {\n return getTransactionByHash({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Defines if specified transaction is currently in pending state\n *\n * To create a transaction hash:\n *\n * 1. Create a hash message from the bytes: \"Aptos::Transaction\" bytes + the BCS-serialized Transaction bytes.\n * 2. Apply hash algorithm SHA3-256 to the hash message bytes.\n * 3. Hex-encode the hash bytes with 0x prefix.\n *\n * @param args.transactionHash A hash of transaction\n * @returns `true` if transaction is in pending state and `false` otherwise\n */\n async isPendingTransaction(args: { transactionHash: HexInput }): Promise<boolean> {\n return isTransactionPending({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Waits for a transaction to move past the pending state.\n *\n * There are 4 cases.\n * 1. Transaction is successfully processed and committed to the chain.\n * - The function will resolve with the transaction response from the API.\n * 2. Transaction is rejected for some reason, and is therefore not committed to the blockchain.\n * - The function will throw an AptosApiError with an HTTP status code indicating some problem with the request.\n * 3. Transaction is committed but execution failed, meaning no changes were\n * written to the blockchain state.\n * - If `checkSuccess` is true, the function will throw a FailedTransactionError\n * If `checkSuccess` is false, the function will resolve with the transaction response where the `success` field is false.\n * 4. Transaction does not move past the pending state within `args.options.timeoutSecs` seconds.\n * - The function will throw a WaitForTransactionError\n *\n *\n * @param args.transactionHash The hash of a transaction previously submitted to the blockchain.\n * @param args.options.timeoutSecs Timeout in seconds. Defaults to 20 seconds.\n * @param args.options.checkSuccess A boolean which controls whether the function will error if the transaction failed.\n * Defaults to true. See case 3 above.\n * @returns The transaction on-chain. See above for more details.\n */\n async waitForTransaction(args: {\n transactionHash: HexInput;\n options?: WaitForTransactionOptions;\n }): Promise<TransactionResponse> {\n return waitForTransaction({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Gives an estimate of the gas unit price required to get a\n * transaction on chain in a reasonable amount of time.\n * For more information {@link https://fullnode.mainnet.aptoslabs.com/v1/spec#/operations/estimate_gas_price}\n *\n * @returns Object holding the outputs of the estimate gas API\n * @example\n * ```\n * {\n * gas_estimate: number;\n * deprioritized_gas_estimate?: number;\n * prioritized_gas_estimate?: number;\n * }\n * ```\n */\n async getGasPriceEstimation(): Promise<GasEstimation> {\n return getGasPriceEstimation({\n aptosConfig: this.config,\n });\n }\n}\n"],"mappings":"4EAqBO,IAAMA,EAAN,KAAkB,CAGvB,YAAYC,EAAqB,CAC/B,KAAK,OAASA,CAChB,CAWA,MAAM,gBAAgBC,EAAqE,CACzF,OAAOC,EAAgB,CACrB,YAAa,KAAK,OAClB,GAAGD,CACL,CAAC,CACH,CASA,MAAM,wBAAwBA,EAAkE,CAC9F,OAAOE,EAAwB,CAC7B,YAAa,KAAK,OAClB,GAAGF,CACL,CAAC,CACH,CAOA,MAAM,qBAAqBA,EAAmE,CAC5F,OAAOG,EAAqB,CAC1B,YAAa,KAAK,OAClB,GAAGH,CACL,CAAC,CACH,CAcA,MAAM,qBAAqBA,EAAuD,CAChF,OAAOI,EAAqB,CAC1B,YAAa,KAAK,OAClB,GAAGJ,CACL,CAAC,CACH,CAwBA,MAAM,mBAAmBA,EAGQ,CAC/B,OAAOK,EAAmB,CACxB,YAAa,KAAK,OAClB,GAAGL,CACL,CAAC,CACH,CAiBA,MAAM,uBAAgD,CACpD,OAAOM,EAAsB,CAC3B,YAAa,KAAK,MACpB,CAAC,CACH,CACF","names":["Transaction","config","args","getTransactions","getTransactionByVersion","getTransactionByHash","isTransactionPending","waitForTransaction","getGasPriceEstimation"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as t}from"./chunk-LAXIJRYU.mjs";import{b as s}from"./chunk-HH5RSP2H.mjs";import{a as o}from"./chunk-27P7PELS.mjs";var i=class extends o{constructor(e,r){super();this.address=e,this.name=r}static fromStr(e){let r=e.split("::");if(r.length!==2)throw new Error("Invalid module id.");return new i(s.fromStringRelaxed(r[0]),new t(r[1]))}serialize(e){this.address.serialize(e),this.name.serialize(e)}static deserialize(e){let r=s.deserialize(e),d=t.deserialize(e);return new i(r,d)}};export{i as a};
|
|
2
|
+
//# sourceMappingURL=chunk-KWJ6XKNF.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/transactions/instances/moduleId.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Serializable, Serializer } from \"../../bcs/serializer\";\nimport { Deserializer } from \"../../bcs/deserializer\";\nimport { AccountAddress } from \"../../core\";\nimport { Identifier } from \"./identifier\";\nimport { MoveModuleId } from \"../../types\";\n\n/**\n * Representation of a ModuleId that can serialized and deserialized\n * ModuleId means the module address (e.g \"0x1\") and the module name (e.g \"coin\")\n */\nexport class ModuleId extends Serializable {\n public readonly address: AccountAddress;\n\n public readonly name: Identifier;\n\n /**\n * Full name of a module.\n * @param address The account address. e.g \"0x1\"\n * @param name The module name under the \"address\". e.g \"coin\"\n */\n constructor(address: AccountAddress, name: Identifier) {\n super();\n this.address = address;\n this.name = name;\n }\n\n /**\n * Converts a string literal to a ModuleId\n * @param moduleId String literal in format \"account_address::module_name\", e.g. \"0x1::coin\"\n * @returns ModuleId\n */\n static fromStr(moduleId: MoveModuleId): ModuleId {\n const parts = moduleId.split(\"::\");\n if (parts.length !== 2) {\n throw new Error(\"Invalid module id.\");\n }\n return new ModuleId(AccountAddress.fromStringRelaxed(parts[0]), new Identifier(parts[1]));\n }\n\n serialize(serializer: Serializer): void {\n this.address.serialize(serializer);\n this.name.serialize(serializer);\n }\n\n static deserialize(deserializer: Deserializer): ModuleId {\n const address = AccountAddress.deserialize(deserializer);\n const name = Identifier.deserialize(deserializer);\n return new ModuleId(address, name);\n }\n}\n"],"mappings":"2HAaO,IAAMA,EAAN,cAAuBC,CAAa,CAUzC,YAAYC,EAAyBC,EAAkB,CACrD,MAAM,EACN,KAAK,QAAUD,EACf,KAAK,KAAOC,CACd,CAOA,OAAO,QAAQC,EAAkC,CAC/C,IAAMC,EAAQD,EAAS,MAAM,IAAI,EACjC,GAAIC,EAAM,SAAW,EACnB,MAAM,IAAI,MAAM,oBAAoB,EAEtC,OAAO,IAAIL,EAASM,EAAe,kBAAkBD,EAAM,EAAE,EAAG,IAAIE,EAAWF,EAAM,EAAE,CAAC,CAC1F,CAEA,UAAUG,EAA8B,CACtC,KAAK,QAAQ,UAAUA,CAAU,EACjC,KAAK,KAAK,UAAUA,CAAU,CAChC,CAEA,OAAO,YAAYC,EAAsC,CACvD,IAAMP,EAAUI,EAAe,YAAYG,CAAY,EACjDN,EAAOI,EAAW,YAAYE,CAAY,EAChD,OAAO,IAAIT,EAASE,EAASC,CAAI,CACnC,CACF","names":["ModuleId","Serializable","address","name","moduleId","parts","AccountAddress","Identifier","serializer","deserializer"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as o,b as n,c as s,d as t,e as r,f as i,g as a,i as g}from"./chunk-MIBLZSNS.mjs";var c=class{constructor(e){this.config=e}async getLedgerInfo(){return o({aptosConfig:this.config})}async getChainId(){return(await this.getLedgerInfo()).chain_id}async getBlockByVersion(e){return n({aptosConfig:this.config,...e})}async getBlockByHeight(e){return s({aptosConfig:this.config,...e})}async getTableItem(e){return t({aptosConfig:this.config,...e})}async view(e){return r({aptosConfig:this.config,...e})}async getChainTopUserTransactions(e){return i({aptosConfig:this.config,...e})}async queryIndexer(e){return a({aptosConfig:this.config,...e})}async getIndexerLastSuccessVersion(){return g({aptosConfig:this.config})}};export{c as a};
|
|
2
|
+
//# sourceMappingURL=chunk-KYWYIK5P.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/api/general.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { AptosConfig } from \"./aptosConfig\";\nimport {\n getBlockByHeight,\n getBlockByVersion,\n getChainTopUserTransactions,\n getIndexerLastSuccessVersion,\n getLedgerInfo,\n getTableItem,\n queryIndexer,\n view,\n} from \"../internal/general\";\nimport {\n AnyNumber,\n Block,\n GetChainTopUserTransactionsResponse,\n GraphqlQuery,\n LedgerInfo,\n LedgerVersion,\n MoveValue,\n TableItemRequest,\n ViewRequestData,\n} from \"../types\";\n\n/**\n * A class to query all `General` Aptos related queries\n */\nexport class General {\n readonly config: AptosConfig;\n\n constructor(config: AptosConfig) {\n this.config = config;\n }\n\n /**\n * Queries for the Aptos ledger info\n *\n * @returns Aptos Ledger Info\n *\n * @example An example of the returned data\n * ```\n * {\n * \"chain_id\": 4,\n * \"epoch\": \"8\",\n * \"ledger_version\": \"714\",\n * \"oldest_ledger_version\": \"0\",\n * \"ledger_timestamp\": \"1694695496521775\",\n * \"node_role\": \"validator\",\n * \"oldest_block_height\": \"0\",\n * \"block_height\": \"359\",\n * \"git_hash\": \"c82193f36f4e185fed9f68c4ad21f6c6dd390c6e\"\n * }\n * ```\n */\n async getLedgerInfo(): Promise<LedgerInfo> {\n return getLedgerInfo({ aptosConfig: this.config });\n }\n\n /**\n * Queries for the chain id\n *\n * @returns The chain id\n */\n async getChainId(): Promise<number> {\n const result = await this.getLedgerInfo();\n return result.chain_id;\n }\n\n /**\n * Queries for block by transaction version\n *\n * @param args.ledgerVersion Ledger version to lookup block information for\n * @param args.options.withTransactions If set to true, include all transactions in the block\n *\n * @returns Block information with optional transactions\n */\n async getBlockByVersion(args: {\n ledgerVersion: AnyNumber;\n options?: { withTransactions?: boolean };\n }): Promise<Block> {\n return getBlockByVersion({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Get block by block height\n *\n * @param args.blockHeight Block height to lookup. Starts at 0\n * @param args.options.withTransactions If set to true, include all transactions in the block\n *\n * @returns Block with optional transactions\n */\n async getBlockByHeight(args: { blockHeight: AnyNumber; options?: { withTransactions?: boolean } }): Promise<Block> {\n return getBlockByHeight({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries for a table item for a table identified by the handle and the key for the item.\n * Key and value types need to be passed in to help with key serialization and value deserialization.\n * @param args.handle A pointer to where that table is stored\n * @param args.data Object that describes table item\n * @param args.options.ledgerVersion The ledger version to query, if not provided it will get the latest version\n *\n * @example https://fullnode.devnet.aptoslabs.com/v1/accounts/0x1/resource/0x1::coin::CoinInfo%3C0x1::aptos_coin::AptosCoin%3E\n * {\n * data.key_type = \"address\" // Move type of table key\n * data.value_type = \"u128\" // Move type of table value\n * data.key = \"0x619dc29a0aac8fa146714058e8dd6d2d0f3bdf5f6331907bf91f3acd81e6935\" // Value of table key\n * }\n *\n * @returns Table item value rendered in JSON\n */\n async getTableItem<T>(args: { handle: string; data: TableItemRequest; options?: LedgerVersion }): Promise<T> {\n return getTableItem<T>({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries for a Move view function\n * @param args.payload Payload for the view function\n * @param args.options.ledgerVersion The ledger version to query, if not provided it will get the latest version\n * @example\n * `\n * const payload: ViewRequest = {\n * function: \"0x1::coin::balance\",\n * typeArguments: [\"0x1::aptos_coin::AptosCoin\"],\n * functionArguments: [accountAddress],\n * };\n * `\n *\n * @returns an array of Move values\n */\n async view(args: { payload: ViewRequestData; options?: LedgerVersion }): Promise<Array<MoveValue>> {\n return view({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries top user transactions\n *\n * @param args.limit The number of transactions to return\n * @returns GetChainTopUserTransactionsResponse\n */\n async getChainTopUserTransactions(args: { limit: number }): Promise<GetChainTopUserTransactionsResponse> {\n return getChainTopUserTransactions({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * A generic function for retrieving data from Aptos Indexer.\n * For more detailed queries specification see\n * {@link https://cloud.hasura.io/public/graphiql?endpoint=https://indexer.mainnet.aptoslabs.com/v1/graphql}\n *\n * @param args.query.query A GraphQL query\n * @param args.query.variables The variables for the query\n * @example\n * ```\n * {\n * query: `query MyQuery {\n ledger_infos {\n chain_id\n }\n }`;\n * }\n * ```\n *\n * @return The provided T type\n */\n async queryIndexer<T>(args: { query: GraphqlQuery }): Promise<T> {\n return queryIndexer<T>({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries for the last successful indexer version\n *\n * This is useful to tell what ledger version the indexer is updated to, as it can be behind the full nodes.\n */\n async getIndexerLastSuccessVersion(): Promise<number> {\n return getIndexerLastSuccessVersion({ aptosConfig: this.config });\n }\n}\n"],"mappings":"0FA6BO,IAAMA,EAAN,KAAc,CAGnB,YAAYC,EAAqB,CAC/B,KAAK,OAASA,CAChB,CAsBA,MAAM,eAAqC,CACzC,OAAOC,EAAc,CAAE,YAAa,KAAK,MAAO,CAAC,CACnD,CAOA,MAAM,YAA8B,CAElC,OADe,MAAM,KAAK,cAAc,GAC1B,QAChB,CAUA,MAAM,kBAAkBC,EAGL,CACjB,OAAOC,EAAkB,CACvB,YAAa,KAAK,OAClB,GAAGD,CACL,CAAC,CACH,CAUA,MAAM,iBAAiBA,EAA4F,CACjH,OAAOE,EAAiB,CAAE,YAAa,KAAK,OAAQ,GAAGF,CAAK,CAAC,CAC/D,CAkBA,MAAM,aAAgBA,EAAuF,CAC3G,OAAOG,EAAgB,CAAE,YAAa,KAAK,OAAQ,GAAGH,CAAK,CAAC,CAC9D,CAiBA,MAAM,KAAKA,EAAwF,CACjG,OAAOI,EAAK,CAAE,YAAa,KAAK,OAAQ,GAAGJ,CAAK,CAAC,CACnD,CAQA,MAAM,4BAA4BA,EAAuE,CACvG,OAAOK,EAA4B,CACjC,YAAa,KAAK,OAClB,GAAGL,CACL,CAAC,CACH,CAsBA,MAAM,aAAgBA,EAA2C,CAC/D,OAAOM,EAAgB,CACrB,YAAa,KAAK,OAClB,GAAGN,CACL,CAAC,CACH,CAOA,MAAM,8BAAgD,CACpD,OAAOO,EAA6B,CAAE,YAAa,KAAK,MAAO,CAAC,CAClE,CACF","names":["General","config","getLedgerInfo","args","getBlockByVersion","getBlockByHeight","getTableItem","view","getChainTopUserTransactions","queryIndexer","getIndexerLastSuccessVersion"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/transactions/instances/identifier.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Deserializer } from \"../../bcs/deserializer\";\nimport { Serializable, Serializer } from \"../../bcs/serializer\";\n\n/**\n * Representation of an Identifier that can serialized and deserialized.\n * We use Identifier to represent the module \"name\" in \"ModuleId\" and\n * the \"function name\" in \"EntryFunction\"\n */\nexport class Identifier extends Serializable {\n public identifier: string;\n\n constructor(identifier: string) {\n super();\n this.identifier = identifier;\n }\n\n public serialize(serializer: Serializer): void {\n serializer.serializeStr(this.identifier);\n }\n\n static deserialize(deserializer: Deserializer): Identifier {\n const identifier = deserializer.deserializeStr();\n return new Identifier(identifier);\n }\n}\n"],"mappings":"yCAWO,IAAMA,EAAN,cAAyBC,CAAa,CAG3C,YAAYC,EAAoB,CAC9B,MAAM,EACN,KAAK,WAAaA,CACpB,CAEO,UAAUC,EAA8B,CAC7CA,EAAW,aAAa,KAAK,UAAU,CACzC,CAEA,OAAO,YAAYC,EAAwC,CACzD,IAAMF,EAAaE,EAAa,eAAe,EAC/C,OAAO,IAAIJ,EAAWE,CAAU,CAClC,CACF","names":["Identifier","Serializable","identifier","serializer","deserializer"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{hmac as c}from"@noble/hashes/hmac";import{sha512 as p}from"@noble/hashes/sha512";import*as i from"@scure/bip39";var d=/^m\/44'\/637'\/[0-9]+'\/[0-9]+'\/[0-9]+'?$/,m=/^m\/44'\/637'\/[0-9]+'\/[0-9]+\/[0-9]+$/,y=(t=>(t.ED25519="ed25519 seed",t))(y||{}),g=2147483648;function D(e){return m.test(e)}function E(e){return d.test(e)}var A=(e,t)=>{let r=c.create(p,e).update(t).digest();return{key:r.slice(0,32),chainCode:r.slice(32)}},f=({key:e,chainCode:t},r)=>{let n=new ArrayBuffer(4);new DataView(n).setUint32(0,r);let o=new Uint8Array(n),s=new Uint8Array([0]),a=new Uint8Array([...s,...e,...o]);return A(t,a)},x=e=>e.replace("'",""),U=e=>e.split("/").slice(1).map(x),h=e=>{let t=e.trim().split(/\s+/).map(r=>r.toLowerCase()).join(" ");return i.mnemonicToSeedSync(t)};export{d as a,m as b,y as c,g as d,D as e,E as f,A as g,f as h,U as i,h as j};
|
|
2
|
+
//# sourceMappingURL=chunk-LR65XHSF.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/core/crypto/hdKey.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { hmac } from \"@noble/hashes/hmac\";\nimport { sha512 } from \"@noble/hashes/sha512\";\nimport * as bip39 from \"@scure/bip39\";\n\nexport type DerivedKeys = {\n key: Uint8Array;\n chainCode: Uint8Array;\n};\n\n/**\n * Aptos derive path is 637\n */\nexport const APTOS_HARDENED_REGEX = /^m\\/44'\\/637'\\/[0-9]+'\\/[0-9]+'\\/[0-9]+'?$/;\nexport const APTOS_BIP44_REGEX = /^m\\/44'\\/637'\\/[0-9]+'\\/[0-9]+\\/[0-9]+$/;\n\n/**\n * A list of supported key types and associated seeds\n */\nexport enum KeyType {\n ED25519 = \"ed25519 seed\",\n}\n\nexport const HARDENED_OFFSET = 0x80000000;\n\n/**\n * Aptos derive path is 637\n *\n * Parse and validate a path that is compliant to BIP-44 in form m/44'/637'/{account_index}'/{change_index}/{address_index}\n * for Secp256k1\n *\n * Note that for secp256k1, last two components must be non-hardened.\n *\n * @param path path string (e.g. `m/44'/637'/0'/0/0`).\n */\nexport function isValidBIP44Path(path: string): boolean {\n return APTOS_BIP44_REGEX.test(path);\n}\n\n/**\n * Aptos derive path is 637\n *\n * Parse and validate a path that is compliant to SLIP-0010 and BIP-44\n * in form m/44'/637'/{account_index}'/{change_index}'/{address_index}'.\n * See SLIP-0010 {@link https://github.com/satoshilabs/slips/blob/master/slip-0044.md}\n * See BIP-44 {@link https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki}\n *\n * Note that for Ed25519, all components must be hardened.\n * This is because non-hardened [PK] derivation would not work due to Ed25519's lack of a key homomorphism.\n * Specifically, you cannot derive the PK associated with derivation path a/b/c given the PK of a/b.\n * This is because the PK in Ed25519 is, more or less, computed as 𝑔𝐻(𝑠𝑘),\n * with the hash function breaking the homomorphism.\n *\n * @param path path string (e.g. `m/44'/637'/0'/0'/0'`).\n */\nexport function isValidHardenedPath(path: string): boolean {\n return APTOS_HARDENED_REGEX.test(path);\n}\n\nexport const deriveKey = (hashSeed: Uint8Array | string, data: Uint8Array | string): DerivedKeys => {\n const digest = hmac.create(sha512, hashSeed).update(data).digest();\n return {\n key: digest.slice(0, 32),\n chainCode: digest.slice(32),\n };\n};\n\n/**\n * Derive a child key from the private key\n * @param key\n * @param chainCode\n * @param index\n * @constructor\n */\nexport const CKDPriv = ({ key, chainCode }: DerivedKeys, index: number): DerivedKeys => {\n const buffer = new ArrayBuffer(4);\n new DataView(buffer).setUint32(0, index);\n const indexBytes = new Uint8Array(buffer);\n const zero = new Uint8Array([0]);\n const data = new Uint8Array([...zero, ...key, ...indexBytes]);\n return deriveKey(chainCode, data);\n};\n\nconst removeApostrophes = (val: string): string => val.replace(\"'\", \"\");\n\n/**\n * Splits derive path into segments\n * @param path\n */\nexport const splitPath = (path: string): Array<string> => path.split(\"/\").slice(1).map(removeApostrophes);\n\n/**\n * Normalizes the mnemonic by removing extra whitespace and making it lowercase\n * @param mnemonic the mnemonic seed phrase\n */\nexport const mnemonicToSeed = (mnemonic: string): Uint8Array => {\n const normalizedMnemonic = mnemonic\n .trim()\n .split(/\\s+/)\n .map((part) => part.toLowerCase())\n .join(\" \");\n return bip39.mnemonicToSeedSync(normalizedMnemonic);\n};\n"],"mappings":"AAGA,OAAS,QAAAA,MAAY,qBACrB,OAAS,UAAAC,MAAc,uBACvB,UAAYC,MAAW,eAUhB,IAAMC,EAAuB,6CACvBC,EAAoB,0CAKrBC,OACVA,EAAA,QAAU,eADAA,OAAA,IAICC,EAAkB,WAYxB,SAASC,EAAiBC,EAAuB,CACtD,OAAOJ,EAAkB,KAAKI,CAAI,CACpC,CAkBO,SAASC,EAAoBD,EAAuB,CACzD,OAAOL,EAAqB,KAAKK,CAAI,CACvC,CAEO,IAAME,EAAY,CAACC,EAA+BC,IAA2C,CAClG,IAAMC,EAASb,EAAK,OAAOC,EAAQU,CAAQ,EAAE,OAAOC,CAAI,EAAE,OAAO,EACjE,MAAO,CACL,IAAKC,EAAO,MAAM,EAAG,EAAE,EACvB,UAAWA,EAAO,MAAM,EAAE,CAC5B,CACF,EASaC,EAAU,CAAC,CAAE,IAAAC,EAAK,UAAAC,CAAU,EAAgBC,IAA+B,CACtF,IAAMC,EAAS,IAAI,YAAY,CAAC,EAChC,IAAI,SAASA,CAAM,EAAE,UAAU,EAAGD,CAAK,EACvC,IAAME,EAAa,IAAI,WAAWD,CAAM,EAClCE,EAAO,IAAI,WAAW,CAAC,CAAC,CAAC,EACzBR,EAAO,IAAI,WAAW,CAAC,GAAGQ,EAAM,GAAGL,EAAK,GAAGI,CAAU,CAAC,EAC5D,OAAOT,EAAUM,EAAWJ,CAAI,CAClC,EAEMS,EAAqBC,GAAwBA,EAAI,QAAQ,IAAK,EAAE,EAMzDC,EAAaf,GAAgCA,EAAK,MAAM,GAAG,EAAE,MAAM,CAAC,EAAE,IAAIa,CAAiB,EAM3FG,EAAkBC,GAAiC,CAC9D,IAAMC,EAAqBD,EACxB,KAAK,EACL,MAAM,KAAK,EACX,IAAKE,GAASA,EAAK,YAAY,CAAC,EAChC,KAAK,GAAG,EACX,OAAa,qBAAmBD,CAAkB,CACpD","names":["hmac","sha512","bip39","APTOS_HARDENED_REGEX","APTOS_BIP44_REGEX","KeyType","HARDENED_OFFSET","isValidBIP44Path","path","isValidHardenedPath","deriveKey","hashSeed","data","digest","CKDPriv","key","chainCode","index","buffer","indexBytes","zero","removeApostrophes","val","splitPath","mnemonicToSeed","mnemonic","normalizedMnemonic","part"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as r}from"./chunk-V6AAQLLJ.mjs";import{a as t}from"./chunk-27P7PELS.mjs";var i=class extends t{constructor(e){super();this.value=new r(e)}serialize(e){e.serialize(this.value)}serializeForEntryFunction(e){e.serializeU32AsUleb128(this.value.value.length),e.serialize(this)}static deserialize(e,l){let a=r.deserialize(e,l);return new i(a.value)}};export{i as a};
|
|
2
|
+
//# sourceMappingURL=chunk-LU6VS7PJ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/bcs/serializable/entryFunctionBytes.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Serializer, Serializable } from \"../serializer\";\nimport { Deserializer } from \"../deserializer\";\nimport { FixedBytes } from \"./fixedBytes\";\nimport { EntryFunctionArgument } from \"../../transactions/instances/transactionArgument\";\nimport { HexInput } from \"../../types\";\n\n/**\n * This class exists solely to represent a sequence of fixed bytes as a serialized entry function, because\n * serializing an entry function appends a prefix that's *only* used for entry function arguments.\n *\n * NOTE: Attempting to use this class for a serialized script function will result in erroneous\n * and unexpected behavior.\n *\n * If you wish to convert this class back to a TransactionArgument, you must know the type\n * of the argument beforehand, and use the appropriate class to deserialize the bytes within\n * an instance of this class.\n */\nexport class EntryFunctionBytes extends Serializable implements EntryFunctionArgument {\n public readonly value: FixedBytes;\n\n private constructor(value: HexInput) {\n super();\n this.value = new FixedBytes(value);\n }\n\n // Note that to see the Move, BCS-serialized representation of the underlying fixed byte vector,\n // we must not serialize the length prefix.\n //\n // In other words, this class is only used to represent a sequence of bytes that are already\n // BCS-serialized as a type. To represent those bytes accurately, the BCS-serialized form is the same exact\n // representation.\n serialize(serializer: Serializer): void {\n serializer.serialize(this.value);\n }\n\n // When we serialize these bytes as an entry function argument, we need to\n // serialize the length prefix. This essentially converts the underlying fixed byte vector to a type-agnostic\n // byte vector to an `any` type.\n // NOTE: This, and the lack of a `serializeForScriptFunction`, is the only meaningful difference between this\n // class and FixedBytes.\n serializeForEntryFunction(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(this.value.value.length);\n serializer.serialize(this);\n }\n\n /**\n * The only way to create an instance of this class is to use this static method.\n *\n * This function should only be used when deserializing a sequence of EntryFunctionPayload arguments.\n * @param deserializer the deserializer instance with the buffered bytes\n * @param length the length of the bytes to deserialize\n * @returns an instance of this class, which will now only be usable as an EntryFunctionArgument\n */\n static deserialize(deserializer: Deserializer, length: number): EntryFunctionBytes {\n const fixedBytes = FixedBytes.deserialize(deserializer, length);\n return new EntryFunctionBytes(fixedBytes.value);\n }\n}\n"],"mappings":"kFAoBO,IAAMA,EAAN,cAAiCC,CAA8C,CAG5E,YAAYC,EAAiB,CACnC,MAAM,EACN,KAAK,MAAQ,IAAIC,EAAWD,CAAK,CACnC,CAQA,UAAUE,EAA8B,CACtCA,EAAW,UAAU,KAAK,KAAK,CACjC,CAOA,0BAA0BA,EAA8B,CACtDA,EAAW,sBAAsB,KAAK,MAAM,MAAM,MAAM,EACxDA,EAAW,UAAU,IAAI,CAC3B,CAUA,OAAO,YAAYC,EAA4BC,EAAoC,CACjF,IAAMC,EAAaJ,EAAW,YAAYE,EAAcC,CAAM,EAC9D,OAAO,IAAIN,EAAmBO,EAAW,KAAK,CAChD,CACF","names":["EntryFunctionBytes","Serializable","value","FixedBytes","serializer","deserializer","length","fixedBytes"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var n={mainnet:"https://indexer.mainnet.aptoslabs.com/v1/graphql",testnet:"https://indexer-testnet.staging.gcp.aptosdev.com/v1/graphql",devnet:"https://indexer-devnet.staging.gcp.aptosdev.com/v1/graphql",local:"http://127.0.0.1:8090/v1/graphql"},o={mainnet:"https://fullnode.mainnet.aptoslabs.com/v1",testnet:"https://fullnode.testnet.aptoslabs.com/v1",devnet:"https://fullnode.devnet.aptoslabs.com/v1",local:"http://127.0.0.1:8080/v1"},s={mainnet:"https://faucet.mainnet.aptoslabs.com",testnet:"https://faucet.testnet.aptoslabs.com",devnet:"https://faucet.devnet.aptoslabs.com",local:"http://127.0.0.1:8081"},e=(t=>(t.MAINNET="mainnet",t.TESTNET="testnet",t.DEVNET="devnet",t.LOCAL="local",t.CUSTOM="custom",t))(e||{}),a={mainnet:1,testnet:2},r={mainnet:"mainnet",testnet:"testnet",devnet:"devnet",local:"local",custom:"custom"};export{n as a,o as b,s as c,e as d,a as e,r as f};
|
|
2
|
+
//# sourceMappingURL=chunk-LV33NV4J.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/apiEndpoints.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nexport const NetworkToIndexerAPI: Record<string, string> = {\n mainnet: \"https://indexer.mainnet.aptoslabs.com/v1/graphql\",\n testnet: \"https://indexer-testnet.staging.gcp.aptosdev.com/v1/graphql\",\n devnet: \"https://indexer-devnet.staging.gcp.aptosdev.com/v1/graphql\",\n local: \"http://127.0.0.1:8090/v1/graphql\",\n};\n\nexport const NetworkToNodeAPI: Record<string, string> = {\n mainnet: \"https://fullnode.mainnet.aptoslabs.com/v1\",\n testnet: \"https://fullnode.testnet.aptoslabs.com/v1\",\n devnet: \"https://fullnode.devnet.aptoslabs.com/v1\",\n local: \"http://127.0.0.1:8080/v1\",\n};\n\nexport const NetworkToFaucetAPI: Record<string, string> = {\n mainnet: \"https://faucet.mainnet.aptoslabs.com\",\n testnet: \"https://faucet.testnet.aptoslabs.com\",\n devnet: \"https://faucet.devnet.aptoslabs.com\",\n local: \"http://127.0.0.1:8081\",\n};\n\nexport enum Network {\n MAINNET = \"mainnet\",\n TESTNET = \"testnet\",\n DEVNET = \"devnet\",\n LOCAL = \"local\",\n CUSTOM = \"custom\",\n}\n\nexport const NetworkToChainId: Record<string, number> = {\n mainnet: 1,\n testnet: 2,\n};\n\nexport const NetworkToNetworkName: Record<string, Network> = {\n mainnet: Network.MAINNET,\n testnet: Network.TESTNET,\n devnet: Network.DEVNET,\n local: Network.LOCAL,\n custom: Network.CUSTOM,\n};\n"],"mappings":"AAGO,IAAMA,EAA8C,CACzD,QAAS,mDACT,QAAS,8DACT,OAAQ,6DACR,MAAO,kCACT,EAEaC,EAA2C,CACtD,QAAS,4CACT,QAAS,4CACT,OAAQ,2CACR,MAAO,0BACT,EAEaC,EAA6C,CACxD,QAAS,uCACT,QAAS,uCACT,OAAQ,sCACR,MAAO,uBACT,EAEYC,OACVA,EAAA,QAAU,UACVA,EAAA,QAAU,UACVA,EAAA,OAAS,SACTA,EAAA,MAAQ,QACRA,EAAA,OAAS,SALCA,OAAA,IAQCC,EAA2C,CACtD,QAAS,EACT,QAAS,CACX,EAEaC,EAAgD,CAC3D,QAAS,UACT,QAAS,UACT,OAAQ,SACR,MAAO,QACP,OAAQ,QACV","names":["NetworkToIndexerAPI","NetworkToNodeAPI","NetworkToFaucetAPI","Network","NetworkToChainId","NetworkToNetworkName"]}
|