@aptos-labs/ts-sdk 0.0.5 → 0.0.7
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 +12 -7
- package/dist/browser/index.d.ts +874 -596
- package/dist/browser/index.global.js +75 -30
- package/dist/browser/index.global.js.map +1 -1
- package/dist/common/index.d.ts +874 -596
- package/dist/common/index.js +45 -24
- package/dist/common/index.js.map +1 -1
- package/dist/esm/api/{account.d.ts → account.d.mts} +17 -17
- package/dist/esm/api/account.mjs +1 -1
- package/dist/esm/api/ans.d.mts +273 -0
- package/dist/esm/api/ans.mjs +1 -1
- package/dist/esm/api/aptos.d.mts +80 -0
- package/dist/esm/api/aptos.mjs +1 -1
- package/dist/esm/api/{aptosConfig.d.ts → aptosConfig.d.mts} +6 -6
- package/dist/esm/api/aptosConfig.mjs +1 -1
- package/dist/esm/api/coin.d.mts +59 -0
- package/dist/esm/api/coin.mjs +1 -1
- package/dist/esm/api/{digitalAsset.d.ts → digitalAsset.d.mts} +35 -35
- package/dist/esm/api/digitalAsset.mjs +1 -1
- package/dist/esm/api/{event.d.ts → event.d.mts} +14 -14
- package/dist/esm/api/event.mjs +1 -1
- package/dist/esm/api/{faucet.d.ts → faucet.d.mts} +13 -13
- package/dist/esm/api/faucet.mjs +1 -1
- package/dist/esm/api/{fungibleAsset.d.ts → fungibleAsset.d.mts} +7 -7
- package/dist/esm/api/fungibleAsset.mjs +1 -1
- package/dist/esm/api/{general.d.ts → general.d.mts} +11 -11
- package/dist/esm/api/general.mjs +1 -1
- package/dist/esm/api/index.d.mts +50 -0
- package/dist/esm/api/index.mjs +1 -1
- package/dist/esm/api/{staking.d.ts → staking.d.mts} +13 -13
- package/dist/esm/api/staking.mjs +1 -1
- package/dist/esm/api/{transaction.d.ts → transaction.d.mts} +7 -7
- package/dist/esm/api/transaction.mjs +1 -1
- package/dist/esm/api/transactionSubmission/build.d.mts +53 -0
- package/dist/esm/api/transactionSubmission/build.mjs +2 -0
- package/dist/esm/api/transactionSubmission/sign.d.mts +50 -0
- package/dist/esm/api/transactionSubmission/sign.mjs +2 -0
- package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -0
- package/dist/esm/api/transactionSubmission/simulate.d.mts +53 -0
- package/dist/esm/api/transactionSubmission/simulate.mjs +2 -0
- package/dist/esm/api/transactionSubmission/simulate.mjs.map +1 -0
- package/dist/esm/api/transactionSubmission/submit.d.mts +51 -0
- package/dist/esm/api/transactionSubmission/submit.mjs +2 -0
- package/dist/esm/api/transactionSubmission/submit.mjs.map +1 -0
- package/dist/esm/api/transactionSubmission.d.mts +91 -0
- package/dist/esm/api/transactionSubmission.mjs +1 -1
- package/dist/esm/bcs/{consts.d.ts → consts.d.mts} +5 -5
- package/dist/esm/bcs/consts.mjs +1 -1
- package/dist/esm/bcs/{deserializer.d.ts → deserializer.d.mts} +5 -5
- package/dist/esm/bcs/deserializer.mjs +1 -1
- package/dist/esm/bcs/index.d.mts +14 -0
- package/dist/esm/bcs/index.mjs +1 -1
- package/dist/esm/bcs/serializable/{entryFunctionBytes.d.ts → entryFunctionBytes.d.mts} +11 -11
- package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +1 -1
- package/dist/esm/bcs/serializable/{fixedBytes.d.ts → fixedBytes.d.mts} +10 -10
- package/dist/esm/bcs/serializable/fixedBytes.mjs +1 -1
- package/dist/esm/bcs/serializable/{movePrimitives.d.ts → movePrimitives.d.mts} +10 -10
- package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
- package/dist/esm/bcs/serializable/{moveStructs.d.ts → moveStructs.d.mts} +11 -11
- package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
- package/dist/esm/bcs/{serializer.d.ts → serializer.d.mts} +7 -7
- package/dist/esm/bcs/serializer.mjs +1 -1
- package/dist/esm/{chunk-2B5QXKPU.mjs → chunk-2OZRBXLM.mjs} +2 -2
- package/dist/esm/chunk-2OZRBXLM.mjs.map +1 -0
- package/dist/esm/{chunk-O243HOP3.mjs → chunk-33T7WTB6.mjs} +2 -2
- package/dist/esm/chunk-33T7WTB6.mjs.map +1 -0
- package/dist/esm/chunk-3732I6BR.mjs +2 -0
- package/dist/esm/chunk-3732I6BR.mjs.map +1 -0
- package/dist/esm/chunk-3VZ3OZKC.mjs +2 -0
- package/dist/esm/chunk-3VZ3OZKC.mjs.map +1 -0
- package/dist/esm/chunk-44MGBJ73.mjs +2 -0
- package/dist/esm/{chunk-CZZJAR3B.mjs.map → chunk-44MGBJ73.mjs.map} +1 -1
- package/dist/esm/chunk-4ADA5BE7.mjs +2 -0
- package/dist/esm/{chunk-7AQXAH6Q.mjs.map → chunk-4ADA5BE7.mjs.map} +1 -1
- package/dist/esm/chunk-4KTQIWUP.mjs +2 -0
- package/dist/esm/chunk-4KTQIWUP.mjs.map +1 -0
- package/dist/esm/chunk-5LO7FR2P.mjs +2 -0
- package/dist/esm/chunk-5LO7FR2P.mjs.map +1 -0
- package/dist/esm/chunk-62SCW5NH.mjs +2 -0
- package/dist/esm/{chunk-YS2OX7AB.mjs.map → chunk-62SCW5NH.mjs.map} +1 -1
- package/dist/esm/{chunk-DNYVUM3K.mjs → chunk-67OGU66P.mjs} +2 -2
- package/dist/esm/{chunk-DNYVUM3K.mjs.map → chunk-67OGU66P.mjs.map} +1 -1
- package/dist/esm/{chunk-XFSL7O6Q.mjs → chunk-72F5YXGC.mjs} +2 -2
- package/dist/esm/chunk-72F5YXGC.mjs.map +1 -0
- package/dist/esm/{chunk-N6XWY4UT.mjs → chunk-ARVSIDVB.mjs} +1 -1
- package/dist/esm/{chunk-N6XWY4UT.mjs.map → chunk-ARVSIDVB.mjs.map} +1 -1
- package/dist/esm/{chunk-WVMDCC4V.mjs → chunk-BFQRMCY2.mjs} +2 -2
- package/dist/esm/{chunk-WVMDCC4V.mjs.map → chunk-BFQRMCY2.mjs.map} +1 -1
- package/dist/esm/{chunk-XFS5O5GJ.mjs → chunk-BM4HBROC.mjs} +2 -2
- package/dist/esm/{chunk-XFS5O5GJ.mjs.map → chunk-BM4HBROC.mjs.map} +1 -1
- package/dist/esm/chunk-BPYLPPEQ.mjs +2 -0
- package/dist/esm/{chunk-V6AAQLLJ.mjs.map → chunk-BPYLPPEQ.mjs.map} +1 -1
- package/dist/esm/{chunk-3OJN4I42.mjs → chunk-BV4OOU5Y.mjs} +2 -2
- package/dist/esm/{chunk-3OJN4I42.mjs.map → chunk-BV4OOU5Y.mjs.map} +1 -1
- package/dist/esm/chunk-CYDWEPFL.mjs +1 -0
- package/dist/esm/chunk-CYDWEPFL.mjs.map +1 -0
- package/dist/esm/chunk-DRPMIJH7.mjs +2 -0
- package/dist/esm/chunk-DRPMIJH7.mjs.map +1 -0
- package/dist/esm/chunk-EFIYW4WK.mjs +2 -0
- package/dist/esm/chunk-EWTHPMEE.mjs +2 -0
- package/dist/esm/{chunk-LAXIJRYU.mjs.map → chunk-EWTHPMEE.mjs.map} +1 -1
- package/dist/esm/chunk-GAI75GOG.mjs +2 -0
- package/dist/esm/{chunk-J3QOSJFP.mjs.map → chunk-GAI75GOG.mjs.map} +1 -1
- package/dist/esm/{chunk-BC2NOUYT.mjs → chunk-GTC7WHMV.mjs} +2 -2
- package/dist/esm/{chunk-BC2NOUYT.mjs.map → chunk-GTC7WHMV.mjs.map} +1 -1
- package/dist/esm/{chunk-MIBLZSNS.mjs → chunk-GU4OUKAF.mjs} +2 -2
- package/dist/esm/chunk-GU4OUKAF.mjs.map +1 -0
- package/dist/esm/{chunk-27P7PELS.mjs → chunk-HA6JD5R6.mjs} +2 -2
- package/dist/esm/{chunk-27P7PELS.mjs.map → chunk-HA6JD5R6.mjs.map} +1 -1
- package/dist/esm/chunk-HO7K2UAK.mjs +2 -0
- package/dist/esm/{chunk-ADR4XQPR.mjs.map → chunk-HO7K2UAK.mjs.map} +1 -1
- package/dist/esm/chunk-HVADSXTB.mjs +2 -0
- package/dist/esm/{chunk-LU6VS7PJ.mjs.map → chunk-HVADSXTB.mjs.map} +1 -1
- package/dist/esm/chunk-IBH7IOIM.mjs +2 -0
- package/dist/esm/{chunk-ZXJ5ZBTL.mjs.map → chunk-IBH7IOIM.mjs.map} +1 -1
- package/dist/esm/chunk-J5BH7V37.mjs +2 -0
- package/dist/esm/chunk-J5BH7V37.mjs.map +1 -0
- package/dist/esm/chunk-JZNLZMUC.mjs +2 -0
- package/dist/esm/{chunk-WGXAIQ7K.mjs.map → chunk-JZNLZMUC.mjs.map} +1 -1
- package/dist/esm/chunk-KQXRH5FK.mjs +2 -0
- package/dist/esm/{chunk-UQIOMAXE.mjs.map → chunk-KQXRH5FK.mjs.map} +1 -1
- package/dist/esm/chunk-L7AA75WZ.mjs +2 -0
- package/dist/esm/chunk-L7AA75WZ.mjs.map +1 -0
- package/dist/esm/chunk-LACQ537H.mjs +2 -0
- package/dist/esm/{chunk-KFP7MDSD.mjs.map → chunk-LACQ537H.mjs.map} +1 -1
- package/dist/esm/{chunk-2MQZUGO6.mjs → chunk-LDAD54H5.mjs} +1 -1
- package/dist/esm/chunk-LDAD54H5.mjs.map +1 -0
- package/dist/esm/chunk-LXW3A3MJ.mjs +2 -0
- package/dist/esm/chunk-LXW3A3MJ.mjs.map +1 -0
- package/dist/esm/{chunk-KYWYIK5P.mjs → chunk-M2V2POWK.mjs} +2 -2
- package/dist/esm/chunk-M2V2POWK.mjs.map +1 -0
- package/dist/esm/chunk-ND3ZQKTT.mjs +2 -0
- package/dist/esm/chunk-ND3ZQKTT.mjs.map +1 -0
- package/dist/esm/chunk-NZIJV4O2.mjs +2 -0
- package/dist/esm/{chunk-HH5RSP2H.mjs.map → chunk-NZIJV4O2.mjs.map} +1 -1
- package/dist/esm/chunk-O2B54NZT.mjs +2 -0
- package/dist/esm/chunk-O2B54NZT.mjs.map +1 -0
- package/dist/esm/chunk-OCW2L33Q.mjs +2 -0
- package/dist/esm/chunk-OCW2L33Q.mjs.map +1 -0
- package/dist/esm/{chunk-PJDVHU7X.mjs → chunk-OCYS4V2V.mjs} +2 -2
- package/dist/esm/{chunk-PJDVHU7X.mjs.map → chunk-OCYS4V2V.mjs.map} +1 -1
- package/dist/esm/{chunk-VAGYTPSI.mjs → chunk-OSTH5JRX.mjs} +2 -2
- package/dist/esm/chunk-OSTH5JRX.mjs.map +1 -0
- package/dist/esm/chunk-OVHY6ZUJ.mjs +2 -0
- package/dist/esm/{chunk-JTGGMXB7.mjs.map → chunk-OVHY6ZUJ.mjs.map} +1 -1
- package/dist/esm/chunk-PZCMSHY6.mjs +2 -0
- package/dist/esm/chunk-QWVR4RCV.mjs +2 -0
- package/dist/esm/{chunk-IPJKGHQY.mjs.map → chunk-QWVR4RCV.mjs.map} +1 -1
- package/dist/esm/chunk-R3KWVOFG.mjs +2 -0
- package/dist/esm/{chunk-KWJ6XKNF.mjs.map → chunk-R3KWVOFG.mjs.map} +1 -1
- package/dist/esm/{chunk-TXUMB5ZO.mjs → chunk-RHS5ROLP.mjs} +2 -2
- package/dist/esm/chunk-RHS5ROLP.mjs.map +1 -0
- package/dist/esm/{chunk-IXMH6AXJ.mjs → chunk-RKKU2SY5.mjs} +2 -2
- package/dist/esm/chunk-RYETO74W.mjs +2 -0
- package/dist/esm/{chunk-BIUGRAMO.mjs.map → chunk-RYETO74W.mjs.map} +1 -1
- package/dist/esm/chunk-S36IYY6K.mjs +2 -0
- package/dist/esm/{chunk-DXUIJ6KA.mjs.map → chunk-S36IYY6K.mjs.map} +1 -1
- package/dist/esm/chunk-TGKB6ALT.mjs +2 -0
- package/dist/esm/chunk-TGKB6ALT.mjs.map +1 -0
- package/dist/esm/chunk-TIH6ARYP.mjs +2 -0
- package/dist/esm/{chunk-IZHPCZE3.mjs.map → chunk-TIH6ARYP.mjs.map} +1 -1
- package/dist/esm/chunk-TPWSHFFI.mjs +2 -0
- package/dist/esm/chunk-TPWSHFFI.mjs.map +1 -0
- package/dist/esm/chunk-U25N2VWA.mjs +2 -0
- package/dist/esm/{chunk-FNB6CFQR.mjs.map → chunk-U25N2VWA.mjs.map} +1 -1
- package/dist/esm/chunk-U6SZNNVL.mjs +2 -0
- package/dist/esm/chunk-U6SZNNVL.mjs.map +1 -0
- package/dist/esm/{chunk-EKAOAGNQ.mjs → chunk-UAAI3NCA.mjs} +2 -2
- package/dist/esm/{chunk-BTK34A5U.mjs → chunk-UDBH4CER.mjs} +42 -21
- package/dist/esm/chunk-UDBH4CER.mjs.map +1 -0
- package/dist/esm/chunk-VWVEDCBM.mjs +2 -0
- package/dist/esm/{chunk-BREUBEPM.mjs.map → chunk-VWVEDCBM.mjs.map} +1 -1
- package/dist/esm/{chunk-ZT2A5ABR.mjs → chunk-WEJAI26R.mjs} +2 -2
- package/dist/esm/{chunk-ZT2A5ABR.mjs.map → chunk-WEJAI26R.mjs.map} +1 -1
- package/dist/esm/chunk-WL4OXZLN.mjs +2 -0
- package/dist/esm/{chunk-KNLMUSIO.mjs.map → chunk-WL4OXZLN.mjs.map} +1 -1
- package/dist/esm/chunk-X32O46IB.mjs +2 -0
- package/dist/esm/{chunk-PDLUCVJB.mjs.map → chunk-X32O46IB.mjs.map} +1 -1
- package/dist/esm/{chunk-KPESAXVI.mjs → chunk-Y2HRRUZ6.mjs} +2 -2
- package/dist/esm/{chunk-GUT3G5CG.mjs → chunk-Y7VR7X5W.mjs} +2 -2
- package/dist/esm/chunk-Y7VR7X5W.mjs.map +1 -0
- package/dist/esm/chunk-YYRDFZE6.mjs +2 -0
- package/dist/esm/{chunk-UVGCVCNG.mjs.map → chunk-YYRDFZE6.mjs.map} +1 -1
- package/dist/esm/{chunk-TYHBYRUA.mjs → chunk-ZLW65YCO.mjs} +2 -2
- package/dist/esm/chunk-ZLW65YCO.mjs.map +1 -0
- package/dist/esm/chunk-ZUHN56GM.mjs +2 -0
- package/dist/esm/chunk-ZUHN56GM.mjs.map +1 -0
- package/dist/esm/{chunk-XNFEUXDS.mjs → chunk-ZWH2ESXT.mjs} +1 -1
- package/dist/esm/chunk-ZWH2ESXT.mjs.map +1 -0
- package/dist/esm/client/{core.d.ts → core.d.mts} +9 -9
- package/dist/esm/client/core.mjs +1 -1
- package/dist/esm/client/{get.d.ts → get.d.mts} +12 -12
- package/dist/esm/client/get.mjs +1 -1
- package/dist/esm/client/index.d.mts +11 -0
- package/dist/esm/client/index.mjs +1 -1
- package/dist/esm/client/{post.d.ts → post.d.mts} +14 -14
- package/dist/esm/client/post.mjs +1 -1
- package/dist/esm/client/{types.d.ts → types.d.mts} +5 -5
- package/dist/esm/client/types.mjs +1 -1
- package/dist/esm/core/{account.d.ts → account.d.mts} +13 -13
- package/dist/esm/core/account.mjs +1 -1
- package/dist/esm/core/{accountAddress.d.ts → accountAddress.d.mts} +11 -11
- package/dist/esm/core/accountAddress.mjs +1 -1
- package/dist/esm/core/{authenticationKey.d.ts → authenticationKey.d.mts} +12 -12
- package/dist/esm/core/authenticationKey.mjs +1 -1
- package/dist/esm/core/{common.d.ts → common.d.mts} +1 -1
- package/dist/esm/core/common.mjs +1 -1
- package/dist/esm/core/crypto/{anyPublicKey.d.ts → anyPublicKey.d.mts} +11 -11
- package/dist/esm/core/crypto/anyPublicKey.mjs +1 -1
- package/dist/esm/core/crypto/{anySignature.d.ts → anySignature.d.mts} +10 -10
- package/dist/esm/core/crypto/anySignature.mjs +1 -1
- package/dist/esm/core/crypto/{asymmetricCrypto.d.ts → asymmetricCrypto.d.mts} +8 -8
- package/dist/esm/core/crypto/asymmetricCrypto.mjs +1 -1
- package/dist/esm/core/crypto/{ed25519.d.ts → ed25519.d.mts} +10 -10
- package/dist/esm/core/crypto/ed25519.mjs +1 -1
- package/dist/esm/core/crypto/{hdKey.d.ts → hdKey.d.mts} +1 -1
- package/dist/esm/core/crypto/hdKey.mjs +1 -1
- package/dist/esm/core/crypto/index.d.mts +17 -0
- package/dist/esm/core/crypto/index.mjs +1 -1
- package/dist/esm/core/crypto/{multiEd25519.d.ts → multiEd25519.d.mts} +11 -11
- package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
- package/dist/esm/core/crypto/{multiKey.d.ts → multiKey.d.mts} +12 -12
- package/dist/esm/core/crypto/multiKey.mjs +1 -1
- package/dist/esm/core/crypto/{secp256k1.d.ts → secp256k1.d.mts} +10 -10
- package/dist/esm/core/crypto/secp256k1.mjs +1 -1
- package/dist/esm/core/{hex.d.ts → hex.d.mts} +6 -6
- package/dist/esm/core/hex.mjs +1 -1
- package/dist/esm/core/index.d.mts +21 -0
- package/dist/esm/core/index.mjs +1 -1
- package/dist/esm/index.d.mts +64 -0
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/internal/{account.d.ts → account.d.mts} +17 -17
- package/dist/esm/internal/account.mjs +1 -1
- package/dist/esm/internal/ans.d.mts +150 -0
- package/dist/esm/internal/ans.mjs +1 -1
- package/dist/esm/internal/coin.d.mts +43 -0
- package/dist/esm/internal/coin.mjs +1 -1
- package/dist/esm/internal/{digitalAsset.d.ts → digitalAsset.d.mts} +34 -34
- package/dist/esm/internal/digitalAsset.mjs +1 -1
- package/dist/esm/internal/{event.d.ts → event.d.mts} +14 -14
- package/dist/esm/internal/event.mjs +1 -1
- package/dist/esm/internal/faucet.d.mts +29 -0
- package/dist/esm/internal/faucet.mjs +1 -1
- package/dist/esm/internal/{fungibleAsset.d.ts → fungibleAsset.d.mts} +7 -7
- package/dist/esm/internal/fungibleAsset.mjs +1 -1
- package/dist/esm/internal/{general.d.ts → general.d.mts} +11 -11
- package/dist/esm/internal/general.mjs +1 -1
- package/dist/esm/internal/{staking.d.ts → staking.d.mts} +13 -13
- package/dist/esm/internal/staking.mjs +1 -1
- package/dist/esm/internal/{transaction.d.ts → transaction.d.mts} +7 -7
- package/dist/esm/internal/transaction.mjs +1 -1
- package/dist/esm/internal/{transactionSubmission.d.ts → transactionSubmission.d.mts} +41 -72
- package/dist/esm/internal/transactionSubmission.mjs +1 -1
- package/dist/esm/transactions/authenticator/{account.d.ts → account.d.mts} +15 -15
- package/dist/esm/transactions/authenticator/account.mjs +1 -1
- package/dist/esm/transactions/authenticator/index.d.mts +19 -0
- package/dist/esm/transactions/authenticator/index.mjs +1 -1
- package/dist/esm/transactions/authenticator/{transaction.d.ts → transaction.d.mts} +18 -18
- package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
- package/dist/esm/transactions/index.d.mts +39 -0
- package/dist/esm/transactions/index.mjs +1 -1
- package/dist/esm/transactions/instances/chainId.d.mts +21 -0
- package/dist/esm/transactions/instances/chainId.mjs +1 -1
- package/dist/esm/transactions/instances/{identifier.d.ts → identifier.d.mts} +9 -9
- package/dist/esm/transactions/instances/identifier.mjs +1 -1
- package/dist/esm/transactions/instances/index.d.mts +29 -0
- package/dist/esm/transactions/instances/index.mjs +1 -1
- package/dist/esm/transactions/instances/{moduleId.d.ts → moduleId.d.mts} +12 -12
- package/dist/esm/transactions/instances/moduleId.mjs +1 -1
- package/dist/esm/transactions/instances/{rawTransaction.d.ts → rawTransaction.d.mts} +16 -16
- package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/{rotationProofChallenge.d.ts → rotationProofChallenge.d.mts} +14 -14
- package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
- package/dist/esm/transactions/instances/{signedTransaction.d.ts → signedTransaction.d.mts} +25 -25
- package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/{transactionArgument.d.ts → transactionArgument.d.mts} +8 -8
- package/dist/esm/transactions/instances/{transactionPayload.d.ts → transactionPayload.d.mts} +14 -14
- package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/{helpers.d.ts → helpers.d.mts} +31 -31
- package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/index.d.mts +35 -0
- package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +54 -0
- package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/{transactionBuilder.d.ts → transactionBuilder.d.mts} +35 -40
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
- package/dist/esm/transactions/typeTag/{index.d.ts → index.d.mts} +12 -12
- package/dist/esm/transactions/typeTag/index.mjs +1 -1
- package/dist/esm/transactions/typeTag/{parser.d.ts → parser.d.mts} +14 -13
- package/dist/esm/transactions/typeTag/parser.mjs +1 -1
- package/dist/esm/transactions/{types.d.ts → types.d.mts} +60 -97
- package/dist/esm/types/generated/{operations.d.ts → operations.d.mts} +105 -79
- package/dist/esm/types/generated/{queries.d.ts → queries.d.mts} +35 -32
- package/dist/esm/types/generated/queries.mjs +1 -1
- package/dist/esm/types/generated/{types.d.ts → types.d.mts} +3184 -3146
- package/dist/esm/types/generated/types.mjs +1 -1
- package/dist/esm/types/generated/types.mjs.map +1 -1
- package/dist/esm/types/{index.d.ts → index.d.mts} +94 -92
- package/dist/esm/types/index.mjs +1 -1
- package/dist/esm/types/indexer.d.mts +63 -0
- package/dist/esm/utils/apiEndpoints.mjs +1 -1
- package/dist/esm/utils/const.mjs +1 -1
- package/dist/esm/utils/helpers.mjs +1 -1
- package/dist/esm/utils/index.d.mts +2 -0
- package/dist/esm/utils/index.mjs +2 -0
- package/dist/esm/utils/index.mjs.map +1 -0
- package/dist/esm/utils/memoize.mjs +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +30 -30
- package/src/api/account.ts +2 -2
- package/src/api/ans.ts +250 -11
- package/src/api/aptos.ts +20 -0
- package/src/api/coin.ts +4 -4
- package/src/api/digitalAsset.ts +3 -3
- package/src/api/event.ts +2 -2
- package/src/api/general.ts +4 -4
- package/src/api/transactionSubmission/build.ts +42 -0
- package/src/api/transactionSubmission/sign.ts +44 -0
- package/src/api/transactionSubmission/simulate.ts +56 -0
- package/src/api/transactionSubmission/submit.ts +53 -0
- package/src/api/transactionSubmission.ts +4 -138
- package/src/client/core.ts +1 -1
- package/src/client/get.ts +6 -2
- package/src/client/post.ts +12 -4
- package/src/index.ts +1 -1
- package/src/internal/account.ts +2 -2
- package/src/internal/ans.ts +408 -22
- package/src/internal/coin.ts +5 -5
- package/src/internal/digitalAsset.ts +5 -5
- package/src/internal/event.ts +2 -2
- package/src/internal/general.ts +7 -6
- package/src/internal/queries/ansTokenFragment.graphql +9 -0
- package/src/internal/queries/getNames.graphql +11 -0
- package/src/internal/transactionSubmission.ts +52 -12
- package/src/transactions/transactionBuilder/helpers.ts +2 -2
- package/src/transactions/transactionBuilder/transactionBuilder.ts +22 -46
- package/src/transactions/typeTag/parser.ts +10 -2
- package/src/transactions/types.ts +16 -56
- package/src/types/generated/operations.ts +62 -33
- package/src/types/generated/queries.ts +56 -22
- package/src/types/generated/types.ts +2253 -2251
- package/src/types/index.ts +16 -10
- package/src/types/indexer.ts +3 -0
- package/src/utils/index.ts +2 -0
- package/dist/esm/api/ans.d.ts +0 -79
- package/dist/esm/api/aptos.d.ts +0 -72
- package/dist/esm/api/coin.d.ts +0 -59
- package/dist/esm/api/index.d.ts +0 -46
- package/dist/esm/api/transactionSubmission.d.ts +0 -142
- package/dist/esm/bcs/index.d.ts +0 -14
- package/dist/esm/chunk-2444YR3Y.mjs +0 -2
- package/dist/esm/chunk-2444YR3Y.mjs.map +0 -1
- package/dist/esm/chunk-2B5QXKPU.mjs.map +0 -1
- package/dist/esm/chunk-2MQZUGO6.mjs.map +0 -1
- package/dist/esm/chunk-3YOV42H5.mjs +0 -2
- package/dist/esm/chunk-3YOV42H5.mjs.map +0 -1
- package/dist/esm/chunk-7AIV5FEN.mjs +0 -2
- package/dist/esm/chunk-7AIV5FEN.mjs.map +0 -1
- package/dist/esm/chunk-7AQXAH6Q.mjs +0 -2
- package/dist/esm/chunk-7TL2MY2B.mjs +0 -2
- package/dist/esm/chunk-7TL2MY2B.mjs.map +0 -1
- package/dist/esm/chunk-ADR4XQPR.mjs +0 -2
- package/dist/esm/chunk-AY2HWVDO.mjs +0 -2
- package/dist/esm/chunk-AY2HWVDO.mjs.map +0 -1
- package/dist/esm/chunk-BIUGRAMO.mjs +0 -2
- package/dist/esm/chunk-BREUBEPM.mjs +0 -2
- package/dist/esm/chunk-BTK34A5U.mjs.map +0 -1
- package/dist/esm/chunk-CZZJAR3B.mjs +0 -2
- package/dist/esm/chunk-DXUIJ6KA.mjs +0 -2
- package/dist/esm/chunk-E72CFUU4.mjs +0 -2
- package/dist/esm/chunk-FHJ7F7Z6.mjs +0 -2
- package/dist/esm/chunk-FHJ7F7Z6.mjs.map +0 -1
- package/dist/esm/chunk-FNB6CFQR.mjs +0 -2
- package/dist/esm/chunk-GUT3G5CG.mjs.map +0 -1
- package/dist/esm/chunk-HH5RSP2H.mjs +0 -2
- package/dist/esm/chunk-IPJKGHQY.mjs +0 -2
- package/dist/esm/chunk-IZHPCZE3.mjs +0 -2
- package/dist/esm/chunk-J3QOSJFP.mjs +0 -2
- package/dist/esm/chunk-J5OKXARS.mjs +0 -2
- package/dist/esm/chunk-J5OKXARS.mjs.map +0 -1
- package/dist/esm/chunk-JTGGMXB7.mjs +0 -2
- package/dist/esm/chunk-KFP7MDSD.mjs +0 -2
- package/dist/esm/chunk-KJDY66XF.mjs +0 -2
- package/dist/esm/chunk-KJDY66XF.mjs.map +0 -1
- package/dist/esm/chunk-KNLMUSIO.mjs +0 -2
- package/dist/esm/chunk-KWJ6XKNF.mjs +0 -2
- package/dist/esm/chunk-KYWYIK5P.mjs.map +0 -1
- package/dist/esm/chunk-LAXIJRYU.mjs +0 -2
- package/dist/esm/chunk-LU6VS7PJ.mjs +0 -2
- package/dist/esm/chunk-MIBLZSNS.mjs.map +0 -1
- package/dist/esm/chunk-NKTKHC3Z.mjs +0 -2
- package/dist/esm/chunk-NKTKHC3Z.mjs.map +0 -1
- package/dist/esm/chunk-O243HOP3.mjs.map +0 -1
- package/dist/esm/chunk-PDLUCVJB.mjs +0 -2
- package/dist/esm/chunk-SJLO3JIH.mjs +0 -2
- package/dist/esm/chunk-TXUMB5ZO.mjs.map +0 -1
- package/dist/esm/chunk-TYHBYRUA.mjs.map +0 -1
- package/dist/esm/chunk-UQIOMAXE.mjs +0 -2
- package/dist/esm/chunk-UVGCVCNG.mjs +0 -2
- package/dist/esm/chunk-V6AAQLLJ.mjs +0 -2
- package/dist/esm/chunk-VAGYTPSI.mjs.map +0 -1
- package/dist/esm/chunk-WGXAIQ7K.mjs +0 -2
- package/dist/esm/chunk-WNEZCERQ.mjs +0 -2
- package/dist/esm/chunk-WNEZCERQ.mjs.map +0 -1
- package/dist/esm/chunk-XFSL7O6Q.mjs.map +0 -1
- package/dist/esm/chunk-YS2OX7AB.mjs +0 -2
- package/dist/esm/chunk-Z56AKXJ7.mjs +0 -2
- package/dist/esm/chunk-Z56AKXJ7.mjs.map +0 -1
- package/dist/esm/chunk-ZXJ5ZBTL.mjs +0 -2
- package/dist/esm/client/index.d.ts +0 -11
- package/dist/esm/core/crypto/index.d.ts +0 -17
- package/dist/esm/core/index.d.ts +0 -21
- package/dist/esm/index.d.ts +0 -60
- package/dist/esm/internal/ans.d.ts +0 -83
- package/dist/esm/internal/coin.d.ts +0 -43
- package/dist/esm/internal/faucet.d.ts +0 -29
- package/dist/esm/transactions/authenticator/index.d.ts +0 -19
- package/dist/esm/transactions/index.d.ts +0 -39
- package/dist/esm/transactions/instances/chainId.d.ts +0 -21
- package/dist/esm/transactions/instances/index.d.ts +0 -29
- package/dist/esm/transactions/transactionBuilder/index.d.ts +0 -35
- package/dist/esm/transactions/transactionBuilder/remoteAbi.d.ts +0 -54
- package/dist/esm/types/indexer.d.ts +0 -62
- /package/dist/esm/{chunk-XNFEUXDS.mjs.map → api/transactionSubmission/build.mjs.map} +0 -0
- /package/dist/esm/{chunk-E72CFUU4.mjs.map → chunk-EFIYW4WK.mjs.map} +0 -0
- /package/dist/esm/{chunk-SJLO3JIH.mjs.map → chunk-PZCMSHY6.mjs.map} +0 -0
- /package/dist/esm/{chunk-IXMH6AXJ.mjs.map → chunk-RKKU2SY5.mjs.map} +0 -0
- /package/dist/esm/{chunk-EKAOAGNQ.mjs.map → chunk-UAAI3NCA.mjs.map} +0 -0
- /package/dist/esm/{chunk-KPESAXVI.mjs.map → chunk-Y2HRRUZ6.mjs.map} +0 -0
- /package/dist/esm/utils/{apiEndpoints.d.ts → apiEndpoints.d.mts} +0 -0
- /package/dist/esm/utils/{const.d.ts → const.d.mts} +0 -0
- /package/dist/esm/utils/{helpers.d.ts → helpers.d.mts} +0 -0
- /package/dist/esm/utils/{memoize.d.ts → memoize.d.mts} +0 -0
- /package/dist/esm/{version.d.ts → version.d.mts} +0 -0
package/src/internal/ans.ts
CHANGED
|
@@ -9,12 +9,14 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { AptosConfig } from "../api/aptosConfig";
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
12
|
+
import { Account, AccountAddress, AccountAddressInput } from "../core";
|
|
13
|
+
import { InputGenerateTransactionOptions, SingleSignerTransaction } from "../transactions/types";
|
|
14
|
+
import { GetANSNameResponse, MoveAddressType, MoveValue, OrderBy, PaginationArgs } from "../types";
|
|
15
|
+
import { GetNamesQuery } from "../types/generated/operations";
|
|
16
|
+
import { GetNames } from "../types/generated/queries";
|
|
17
|
+
import { CurrentAptosNamesBoolExp } from "../types/generated/types";
|
|
16
18
|
import { Network } from "../utils/apiEndpoints";
|
|
17
|
-
import { view } from "./general";
|
|
19
|
+
import { queryIndexer, view } from "./general";
|
|
18
20
|
import { generateTransaction } from "./transactionSubmission";
|
|
19
21
|
|
|
20
22
|
export const VALIDATION_RULES_DESCRIPTION = [
|
|
@@ -82,8 +84,8 @@ function getRouterAddress(aptosConfig: AptosConfig): string {
|
|
|
82
84
|
return address;
|
|
83
85
|
}
|
|
84
86
|
|
|
85
|
-
const Some = <T>(value: T): MoveValue => ({ vec: [value] } as any
|
|
86
|
-
const None = (): MoveValue => ({ vec: [] } as any
|
|
87
|
+
const Some = <T>(value: T): MoveValue => ({ vec: [value] }) as any;
|
|
88
|
+
const None = (): MoveValue => ({ vec: [] }) as any;
|
|
87
89
|
// != here is intentional, we want to check for null and undefined
|
|
88
90
|
// eslint-disable-next-line eqeqeq
|
|
89
91
|
const Option = <T>(value: T | undefined | null): MoveValue => (value != undefined ? Some(value) : None());
|
|
@@ -119,17 +121,17 @@ export interface RegisterNameParameters {
|
|
|
119
121
|
sender: Account;
|
|
120
122
|
name: string;
|
|
121
123
|
expiration:
|
|
122
|
-
| { policy: "domain"; years
|
|
124
|
+
| { policy: "domain"; years?: 1 }
|
|
123
125
|
| { policy: "subdomain:follow-domain" }
|
|
124
126
|
| { policy: "subdomain:independent"; expirationDate: Date };
|
|
125
127
|
transferable?: boolean;
|
|
126
|
-
toAddress?:
|
|
127
|
-
targetAddress?:
|
|
128
|
+
toAddress?: AccountAddressInput;
|
|
129
|
+
targetAddress?: AccountAddressInput;
|
|
128
130
|
options?: InputGenerateTransactionOptions;
|
|
129
131
|
}
|
|
130
132
|
|
|
131
|
-
export async function registerName(args: RegisterNameParameters): Promise<
|
|
132
|
-
const { aptosConfig, expiration, name, sender, targetAddress, toAddress, options } = args;
|
|
133
|
+
export async function registerName(args: RegisterNameParameters): Promise<SingleSignerTransaction> {
|
|
134
|
+
const { aptosConfig, expiration, name, sender, targetAddress, toAddress, options, transferable } = args;
|
|
133
135
|
const routerAddress = getRouterAddress(aptosConfig);
|
|
134
136
|
const { domainName, subdomainName } = isValidANSName(name);
|
|
135
137
|
|
|
@@ -147,29 +149,413 @@ export async function registerName(args: RegisterNameParameters): Promise<InputS
|
|
|
147
149
|
}
|
|
148
150
|
|
|
149
151
|
if (expiration.policy === "domain") {
|
|
150
|
-
|
|
152
|
+
const years = expiration.years ?? 1;
|
|
153
|
+
if (years !== 1) {
|
|
151
154
|
throw new Error("For now, names can only be registered for 1 year at a time");
|
|
152
155
|
}
|
|
153
156
|
|
|
154
|
-
const
|
|
157
|
+
const secondsInYear = 31536000;
|
|
158
|
+
const registrationDuration = years * secondsInYear;
|
|
155
159
|
|
|
156
160
|
const transaction = await generateTransaction({
|
|
157
161
|
aptosConfig,
|
|
158
162
|
sender: sender.accountAddress.toString(),
|
|
159
163
|
data: {
|
|
160
164
|
function: `${routerAddress}::router::register_domain`,
|
|
161
|
-
functionArguments: [
|
|
162
|
-
new MoveString(domainName),
|
|
163
|
-
new U64(registrationDuration),
|
|
164
|
-
new MoveOption(targetAddress ? AccountAddress.from(targetAddress) : null),
|
|
165
|
-
new MoveOption(toAddress ? AccountAddress.from(toAddress) : null),
|
|
166
|
-
],
|
|
165
|
+
functionArguments: [domainName, registrationDuration, targetAddress, toAddress],
|
|
167
166
|
},
|
|
168
167
|
options,
|
|
169
168
|
});
|
|
170
169
|
|
|
171
|
-
return transaction as
|
|
170
|
+
return transaction as SingleSignerTransaction;
|
|
172
171
|
}
|
|
173
172
|
|
|
174
|
-
|
|
173
|
+
// We are a subdomain
|
|
174
|
+
if (!subdomainName) {
|
|
175
|
+
throw new Error(`${expiration.policy} requires a subdomain to be provided.`);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
let tldExpiration = await getExpiration({ aptosConfig, name: domainName });
|
|
179
|
+
if (!tldExpiration) {
|
|
180
|
+
throw new Error("The domain does not exist");
|
|
181
|
+
}
|
|
182
|
+
// The contract gives us seconds, but JS expects milliseconds
|
|
183
|
+
tldExpiration *= 1000;
|
|
184
|
+
|
|
185
|
+
const expirationDateInMillisecondsSinceEpoch =
|
|
186
|
+
expiration.policy === "subdomain:independent" ? expiration.expirationDate.valueOf() : tldExpiration;
|
|
187
|
+
|
|
188
|
+
if (expirationDateInMillisecondsSinceEpoch > tldExpiration) {
|
|
189
|
+
throw new Error("The subdomain expiration time cannot be greater than the domain expiration time");
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
const transaction = await generateTransaction({
|
|
193
|
+
aptosConfig,
|
|
194
|
+
sender: sender.accountAddress.toString(),
|
|
195
|
+
data: {
|
|
196
|
+
function: `${routerAddress}::router::register_subdomain`,
|
|
197
|
+
functionArguments: [
|
|
198
|
+
domainName,
|
|
199
|
+
subdomainName,
|
|
200
|
+
Math.round(expirationDateInMillisecondsSinceEpoch / 1000),
|
|
201
|
+
expiration.policy === "subdomain:follow-domain" ? 1 : 0,
|
|
202
|
+
!!transferable,
|
|
203
|
+
targetAddress,
|
|
204
|
+
toAddress,
|
|
205
|
+
],
|
|
206
|
+
},
|
|
207
|
+
options,
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
return transaction as SingleSignerTransaction;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export async function getExpiration(args: { aptosConfig: AptosConfig; name: string }): Promise<number | undefined> {
|
|
214
|
+
const { aptosConfig, name } = args;
|
|
215
|
+
const routerAddress = getRouterAddress(aptosConfig);
|
|
216
|
+
const { domainName, subdomainName } = isValidANSName(name);
|
|
217
|
+
|
|
218
|
+
try {
|
|
219
|
+
const res = await view({
|
|
220
|
+
aptosConfig,
|
|
221
|
+
payload: {
|
|
222
|
+
function: `${routerAddress}::router::get_expiration`,
|
|
223
|
+
functionArguments: [domainName, Option(subdomainName)],
|
|
224
|
+
},
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
return res[0] as number;
|
|
228
|
+
} catch (e) {
|
|
229
|
+
return undefined;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
export async function getPrimaryName(args: {
|
|
234
|
+
aptosConfig: AptosConfig;
|
|
235
|
+
address: AccountAddressInput;
|
|
236
|
+
}): Promise<string | undefined> {
|
|
237
|
+
const { aptosConfig, address } = args;
|
|
238
|
+
const routerAddress = getRouterAddress(aptosConfig);
|
|
239
|
+
|
|
240
|
+
const res = await view({
|
|
241
|
+
aptosConfig,
|
|
242
|
+
payload: {
|
|
243
|
+
function: `${routerAddress}::router::get_primary_name`,
|
|
244
|
+
functionArguments: [AccountAddress.fromRelaxed(address).toString()],
|
|
245
|
+
},
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
const domainName = unwrapOption<MoveAddressType>(res[1]);
|
|
249
|
+
const subdomainName = unwrapOption<MoveAddressType>(res[0]);
|
|
250
|
+
|
|
251
|
+
if (!domainName) return undefined;
|
|
252
|
+
|
|
253
|
+
return [subdomainName, domainName].filter(Boolean).join(".");
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
export async function setPrimaryName(args: {
|
|
257
|
+
aptosConfig: AptosConfig;
|
|
258
|
+
sender: Account;
|
|
259
|
+
name: string | null;
|
|
260
|
+
options?: InputGenerateTransactionOptions;
|
|
261
|
+
}): Promise<SingleSignerTransaction> {
|
|
262
|
+
const { aptosConfig, sender, name, options } = args;
|
|
263
|
+
const routerAddress = getRouterAddress(aptosConfig);
|
|
264
|
+
|
|
265
|
+
if (!name) {
|
|
266
|
+
const transaction = await generateTransaction({
|
|
267
|
+
aptosConfig,
|
|
268
|
+
sender: sender.accountAddress.toString(),
|
|
269
|
+
data: {
|
|
270
|
+
function: `${routerAddress}::router::clear_primary_name`,
|
|
271
|
+
functionArguments: [],
|
|
272
|
+
},
|
|
273
|
+
options,
|
|
274
|
+
});
|
|
275
|
+
|
|
276
|
+
return transaction as SingleSignerTransaction;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
const { domainName, subdomainName } = isValidANSName(name);
|
|
280
|
+
|
|
281
|
+
const transaction = await generateTransaction({
|
|
282
|
+
aptosConfig,
|
|
283
|
+
sender: sender.accountAddress.toString(),
|
|
284
|
+
data: {
|
|
285
|
+
function: `${routerAddress}::router::set_primary_name`,
|
|
286
|
+
functionArguments: [domainName, subdomainName],
|
|
287
|
+
},
|
|
288
|
+
options,
|
|
289
|
+
});
|
|
290
|
+
|
|
291
|
+
return transaction as SingleSignerTransaction;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
export async function getTargetAddress(args: {
|
|
295
|
+
aptosConfig: AptosConfig;
|
|
296
|
+
name: string;
|
|
297
|
+
}): Promise<MoveAddressType | undefined> {
|
|
298
|
+
const { aptosConfig, name } = args;
|
|
299
|
+
const routerAddress = getRouterAddress(aptosConfig);
|
|
300
|
+
const { domainName, subdomainName } = isValidANSName(name);
|
|
301
|
+
|
|
302
|
+
const res = await view({
|
|
303
|
+
aptosConfig,
|
|
304
|
+
payload: {
|
|
305
|
+
function: `${routerAddress}::router::get_target_addr`,
|
|
306
|
+
functionArguments: [domainName, Option(subdomainName)],
|
|
307
|
+
},
|
|
308
|
+
});
|
|
309
|
+
|
|
310
|
+
const target = unwrapOption<MoveAddressType>(res[0]);
|
|
311
|
+
return target ? AccountAddress.fromRelaxed(target).toString() : undefined;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
export async function setTargetAddress(args: {
|
|
315
|
+
aptosConfig: AptosConfig;
|
|
316
|
+
sender: Account;
|
|
317
|
+
name: string;
|
|
318
|
+
address: AccountAddressInput;
|
|
319
|
+
options?: InputGenerateTransactionOptions;
|
|
320
|
+
}): Promise<SingleSignerTransaction> {
|
|
321
|
+
const { aptosConfig, sender, name, address, options } = args;
|
|
322
|
+
const routerAddress = getRouterAddress(aptosConfig);
|
|
323
|
+
const { domainName, subdomainName } = isValidANSName(name);
|
|
324
|
+
|
|
325
|
+
const transaction = await generateTransaction({
|
|
326
|
+
aptosConfig,
|
|
327
|
+
sender: sender.accountAddress.toString(),
|
|
328
|
+
data: {
|
|
329
|
+
function: `${routerAddress}::router::set_target_addr`,
|
|
330
|
+
functionArguments: [domainName, subdomainName, address],
|
|
331
|
+
},
|
|
332
|
+
options,
|
|
333
|
+
});
|
|
334
|
+
|
|
335
|
+
return transaction as SingleSignerTransaction;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
export async function getName(args: {
|
|
339
|
+
aptosConfig: AptosConfig;
|
|
340
|
+
name: string;
|
|
341
|
+
}): Promise<GetANSNameResponse[0] | undefined> {
|
|
342
|
+
const { aptosConfig, name } = args;
|
|
343
|
+
const { domainName, subdomainName = "" } = isValidANSName(name);
|
|
344
|
+
|
|
345
|
+
const where: CurrentAptosNamesBoolExp = {
|
|
346
|
+
domain: { _eq: domainName },
|
|
347
|
+
subdomain: { _eq: subdomainName },
|
|
348
|
+
};
|
|
349
|
+
|
|
350
|
+
const data = await queryIndexer<GetNamesQuery>({
|
|
351
|
+
aptosConfig,
|
|
352
|
+
query: {
|
|
353
|
+
query: GetNames,
|
|
354
|
+
variables: {
|
|
355
|
+
where_condition: where,
|
|
356
|
+
limit: 1,
|
|
357
|
+
},
|
|
358
|
+
},
|
|
359
|
+
originMethod: "getName",
|
|
360
|
+
});
|
|
361
|
+
|
|
362
|
+
return data.current_aptos_names[0] as GetANSNameResponse[0] | undefined;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
interface QueryNamesOptions {
|
|
366
|
+
options?: {
|
|
367
|
+
pagination?: PaginationArgs;
|
|
368
|
+
orderBy?: OrderBy<GetANSNameResponse[0]>;
|
|
369
|
+
where?: CurrentAptosNamesBoolExp;
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
export interface GetAccountNamesArgs extends QueryNamesOptions {
|
|
374
|
+
accountAddress: AccountAddressInput;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
export async function getAccountNames(
|
|
378
|
+
args: { aptosConfig: AptosConfig } & GetAccountNamesArgs,
|
|
379
|
+
): Promise<GetANSNameResponse> {
|
|
380
|
+
const { aptosConfig, options, accountAddress } = args;
|
|
381
|
+
|
|
382
|
+
const expirationDate = await getANSExpirationDate({ aptosConfig });
|
|
383
|
+
|
|
384
|
+
const data = await queryIndexer<GetNamesQuery>({
|
|
385
|
+
aptosConfig,
|
|
386
|
+
originMethod: "getAccountNames",
|
|
387
|
+
query: {
|
|
388
|
+
query: GetNames,
|
|
389
|
+
variables: {
|
|
390
|
+
limit: options?.pagination?.limit,
|
|
391
|
+
offset: options?.pagination?.offset,
|
|
392
|
+
order_by: options?.orderBy,
|
|
393
|
+
where_condition: {
|
|
394
|
+
...(args.options?.where ?? {}),
|
|
395
|
+
owner_address: { _eq: accountAddress.toString() },
|
|
396
|
+
expiration_timestamp: { _gte: expirationDate },
|
|
397
|
+
},
|
|
398
|
+
},
|
|
399
|
+
},
|
|
400
|
+
});
|
|
401
|
+
|
|
402
|
+
return data.current_aptos_names;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
export interface GetAccountDomainsArgs extends QueryNamesOptions {
|
|
406
|
+
accountAddress: AccountAddressInput;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
export async function getAccountDomains(
|
|
410
|
+
args: { aptosConfig: AptosConfig } & GetAccountDomainsArgs,
|
|
411
|
+
): Promise<GetANSNameResponse> {
|
|
412
|
+
const { aptosConfig, options, accountAddress } = args;
|
|
413
|
+
|
|
414
|
+
const expirationDate = await getANSExpirationDate({ aptosConfig });
|
|
415
|
+
|
|
416
|
+
const data = await queryIndexer<GetNamesQuery>({
|
|
417
|
+
aptosConfig,
|
|
418
|
+
originMethod: "getAccountDomains",
|
|
419
|
+
query: {
|
|
420
|
+
query: GetNames,
|
|
421
|
+
variables: {
|
|
422
|
+
limit: options?.pagination?.limit,
|
|
423
|
+
offset: options?.pagination?.offset,
|
|
424
|
+
order_by: options?.orderBy,
|
|
425
|
+
where_condition: {
|
|
426
|
+
...(args.options?.where ?? {}),
|
|
427
|
+
owner_address: { _eq: accountAddress.toString() },
|
|
428
|
+
expiration_timestamp: { _gte: expirationDate },
|
|
429
|
+
subdomain: { _eq: "" },
|
|
430
|
+
},
|
|
431
|
+
},
|
|
432
|
+
},
|
|
433
|
+
});
|
|
434
|
+
|
|
435
|
+
return data.current_aptos_names;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
export interface GetAccountSubdomainsArgs extends QueryNamesOptions {
|
|
439
|
+
accountAddress: AccountAddressInput;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
export async function getAccountSubdomains(
|
|
443
|
+
args: { aptosConfig: AptosConfig } & GetAccountSubdomainsArgs,
|
|
444
|
+
): Promise<GetANSNameResponse> {
|
|
445
|
+
const { aptosConfig, options, accountAddress } = args;
|
|
446
|
+
|
|
447
|
+
const expirationDate = await getANSExpirationDate({ aptosConfig });
|
|
448
|
+
|
|
449
|
+
const data = await queryIndexer<GetNamesQuery>({
|
|
450
|
+
aptosConfig,
|
|
451
|
+
originMethod: "getAccountSubdomains",
|
|
452
|
+
query: {
|
|
453
|
+
query: GetNames,
|
|
454
|
+
variables: {
|
|
455
|
+
limit: options?.pagination?.limit,
|
|
456
|
+
offset: options?.pagination?.offset,
|
|
457
|
+
order_by: options?.orderBy,
|
|
458
|
+
where_condition: {
|
|
459
|
+
...(args.options?.where ?? {}),
|
|
460
|
+
owner_address: { _eq: accountAddress.toString() },
|
|
461
|
+
expiration_timestamp: { _gte: expirationDate },
|
|
462
|
+
subdomain: { _neq: "" },
|
|
463
|
+
},
|
|
464
|
+
},
|
|
465
|
+
},
|
|
466
|
+
});
|
|
467
|
+
|
|
468
|
+
return data.current_aptos_names;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
export interface GetDomainSubdomainsArgs extends QueryNamesOptions {
|
|
472
|
+
domain: string;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
export async function getDomainSubdomains(
|
|
476
|
+
args: { aptosConfig: AptosConfig } & GetDomainSubdomainsArgs,
|
|
477
|
+
): Promise<GetANSNameResponse> {
|
|
478
|
+
const { aptosConfig, options, domain } = args;
|
|
479
|
+
|
|
480
|
+
const data = await queryIndexer<GetNamesQuery>({
|
|
481
|
+
aptosConfig,
|
|
482
|
+
originMethod: "getDomainSubdomains",
|
|
483
|
+
query: {
|
|
484
|
+
query: GetNames,
|
|
485
|
+
variables: {
|
|
486
|
+
limit: options?.pagination?.limit,
|
|
487
|
+
offset: options?.pagination?.offset,
|
|
488
|
+
order_by: options?.orderBy,
|
|
489
|
+
where_condition: {
|
|
490
|
+
...(args.options?.where ?? {}),
|
|
491
|
+
domain: { _eq: domain },
|
|
492
|
+
subdomain: { _neq: "" },
|
|
493
|
+
},
|
|
494
|
+
},
|
|
495
|
+
},
|
|
496
|
+
});
|
|
497
|
+
|
|
498
|
+
return data.current_aptos_names;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
/**
|
|
502
|
+
* This function returns the expiration date in which a name is fully expired as
|
|
503
|
+
* defined by the contract. The grace period allows for names to be past
|
|
504
|
+
* expiration for a certain amount of time before they are released to the
|
|
505
|
+
* public. The names will not function as normal, but the owner can renew
|
|
506
|
+
* without others taking ownership of the name. At the time of writing, the
|
|
507
|
+
* contract specified 30 days.
|
|
508
|
+
*
|
|
509
|
+
* @param args.aptosConfig an AptosConfig object
|
|
510
|
+
* @returns
|
|
511
|
+
*/
|
|
512
|
+
async function getANSExpirationDate(args: { aptosConfig: AptosConfig }): Promise<string> {
|
|
513
|
+
const { aptosConfig } = args;
|
|
514
|
+
const routerAddress = getRouterAddress(aptosConfig);
|
|
515
|
+
|
|
516
|
+
const res = await view({
|
|
517
|
+
aptosConfig,
|
|
518
|
+
payload: {
|
|
519
|
+
function: `${routerAddress}::config::reregistration_grace_sec`,
|
|
520
|
+
functionArguments: [],
|
|
521
|
+
},
|
|
522
|
+
});
|
|
523
|
+
|
|
524
|
+
const gracePeriodInSeconds = res[0] as number;
|
|
525
|
+
const gracePeriodInDays = gracePeriodInSeconds / 60 / 60 / 24;
|
|
526
|
+
const now = () => new Date();
|
|
527
|
+
return new Date(now().setDate(now().getDate() - gracePeriodInDays)).toISOString();
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
export async function renewDomain(args: {
|
|
531
|
+
aptosConfig: AptosConfig;
|
|
532
|
+
sender: Account;
|
|
533
|
+
name: string;
|
|
534
|
+
years?: 1;
|
|
535
|
+
options?: InputGenerateTransactionOptions;
|
|
536
|
+
}): Promise<SingleSignerTransaction> {
|
|
537
|
+
const { aptosConfig, sender, name, years = 1, options } = args;
|
|
538
|
+
const routerAddress = getRouterAddress(aptosConfig);
|
|
539
|
+
const renewalDuration = years * 31536000;
|
|
540
|
+
const { domainName, subdomainName } = isValidANSName(name);
|
|
541
|
+
|
|
542
|
+
if (subdomainName) {
|
|
543
|
+
throw new Error("Subdomains cannot be renewed");
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
if (years !== 1) {
|
|
547
|
+
throw new Error("Currently, only 1 year renewals are supported");
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
const transaction = await generateTransaction({
|
|
551
|
+
aptosConfig,
|
|
552
|
+
sender: sender.accountAddress.toString(),
|
|
553
|
+
data: {
|
|
554
|
+
function: `${routerAddress}::router::renew_domain`,
|
|
555
|
+
functionArguments: [domainName, renewalDuration],
|
|
556
|
+
},
|
|
557
|
+
options,
|
|
558
|
+
});
|
|
559
|
+
|
|
560
|
+
return transaction as SingleSignerTransaction;
|
|
175
561
|
}
|
package/src/internal/coin.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { AptosConfig } from "../api/aptosConfig";
|
|
2
2
|
import { U64 } from "../bcs/serializable/movePrimitives";
|
|
3
3
|
import { Account, AccountAddress, AccountAddressInput } from "../core";
|
|
4
|
-
import { InputGenerateTransactionOptions,
|
|
5
|
-
import { AnyNumber,
|
|
4
|
+
import { InputGenerateTransactionOptions, SingleSignerTransaction } from "../transactions/types";
|
|
5
|
+
import { AnyNumber, MoveStructId } from "../types";
|
|
6
6
|
import { APTOS_COIN } from "../utils/const";
|
|
7
7
|
import { generateTransaction } from "./transactionSubmission";
|
|
8
8
|
import { parseTypeTag } from "../transactions/typeTag/parser";
|
|
@@ -12,9 +12,9 @@ export async function transferCoinTransaction(args: {
|
|
|
12
12
|
sender: Account;
|
|
13
13
|
recipient: AccountAddressInput;
|
|
14
14
|
amount: AnyNumber;
|
|
15
|
-
coinType?:
|
|
15
|
+
coinType?: MoveStructId;
|
|
16
16
|
options?: InputGenerateTransactionOptions;
|
|
17
|
-
}): Promise<
|
|
17
|
+
}): Promise<SingleSignerTransaction> {
|
|
18
18
|
const { aptosConfig, sender, recipient, amount, coinType, options } = args;
|
|
19
19
|
const coinStructType = coinType ?? APTOS_COIN;
|
|
20
20
|
const transaction = await generateTransaction({
|
|
@@ -28,5 +28,5 @@ export async function transferCoinTransaction(args: {
|
|
|
28
28
|
options,
|
|
29
29
|
});
|
|
30
30
|
|
|
31
|
-
return transaction as
|
|
31
|
+
return transaction as SingleSignerTransaction;
|
|
32
32
|
}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
import { AptosConfig } from "../api/aptosConfig";
|
|
12
12
|
import { MoveString, MoveVector, Bool, U64, U8 } from "../bcs";
|
|
13
13
|
import { Account, AccountAddress, AccountAddressInput } from "../core";
|
|
14
|
-
import { InputGenerateTransactionOptions,
|
|
14
|
+
import { InputGenerateTransactionOptions, SingleSignerTransaction } from "../transactions/types";
|
|
15
15
|
import {
|
|
16
16
|
AnyNumber,
|
|
17
17
|
GetCollectionDataResponse,
|
|
@@ -55,7 +55,7 @@ export async function mintTokenTransaction(args: {
|
|
|
55
55
|
name: string;
|
|
56
56
|
uri: string;
|
|
57
57
|
options?: InputGenerateTransactionOptions;
|
|
58
|
-
}): Promise<
|
|
58
|
+
}): Promise<SingleSignerTransaction> {
|
|
59
59
|
const { aptosConfig, options, creator } = args;
|
|
60
60
|
const transaction = await generateTransaction({
|
|
61
61
|
aptosConfig,
|
|
@@ -74,7 +74,7 @@ export async function mintTokenTransaction(args: {
|
|
|
74
74
|
},
|
|
75
75
|
options,
|
|
76
76
|
});
|
|
77
|
-
return transaction as
|
|
77
|
+
return transaction as SingleSignerTransaction;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
export async function getTokenData(args: {
|
|
@@ -219,7 +219,7 @@ export async function createCollectionTransaction(
|
|
|
219
219
|
uri: string;
|
|
220
220
|
options?: InputGenerateTransactionOptions;
|
|
221
221
|
} & CreateCollectionOptions,
|
|
222
|
-
): Promise<
|
|
222
|
+
): Promise<SingleSignerTransaction> {
|
|
223
223
|
const { aptosConfig, options, creator } = args;
|
|
224
224
|
const transaction = await generateTransaction({
|
|
225
225
|
aptosConfig,
|
|
@@ -247,7 +247,7 @@ export async function createCollectionTransaction(
|
|
|
247
247
|
},
|
|
248
248
|
options,
|
|
249
249
|
});
|
|
250
|
-
return transaction as
|
|
250
|
+
return transaction as SingleSignerTransaction;
|
|
251
251
|
}
|
|
252
252
|
|
|
253
253
|
export async function getCollectionData(args: {
|
package/src/internal/event.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
import { AptosConfig } from "../api/aptosConfig";
|
|
12
12
|
import { AccountAddress, AccountAddressInput } from "../core";
|
|
13
|
-
import { AnyNumber, GetEventsResponse, PaginationArgs,
|
|
13
|
+
import { AnyNumber, GetEventsResponse, PaginationArgs, MoveStructId, OrderBy } from "../types";
|
|
14
14
|
import { GetEventsQuery } from "../types/generated/operations";
|
|
15
15
|
import { GetEvents } from "../types/generated/queries";
|
|
16
16
|
import { EventsBoolExp } from "../types/generated/types";
|
|
@@ -35,7 +35,7 @@ export async function getAccountEventsByCreationNumber(args: {
|
|
|
35
35
|
export async function getAccountEventsByEventType(args: {
|
|
36
36
|
aptosConfig: AptosConfig;
|
|
37
37
|
accountAddress: AccountAddressInput;
|
|
38
|
-
eventType:
|
|
38
|
+
eventType: MoveStructId;
|
|
39
39
|
options?: {
|
|
40
40
|
pagination?: PaginationArgs;
|
|
41
41
|
orderBy?: OrderBy<GetEventsResponse[0]>;
|
package/src/internal/general.ts
CHANGED
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
MoveValue,
|
|
22
22
|
TableItemRequest,
|
|
23
23
|
ViewRequest,
|
|
24
|
-
|
|
24
|
+
InputViewRequestData,
|
|
25
25
|
} from "../types";
|
|
26
26
|
import { GetChainTopUserTransactionsQuery, GetProcessorStatusQuery } from "../types/generated/operations";
|
|
27
27
|
import { GetChainTopUserTransactions, GetProcessorStatus } from "../types/generated/queries";
|
|
@@ -83,11 +83,11 @@ export async function getTableItem<T>(args: {
|
|
|
83
83
|
return response.data as T;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
export async function view(args: {
|
|
86
|
+
export async function view<T extends Array<MoveValue> = Array<MoveValue>>(args: {
|
|
87
87
|
aptosConfig: AptosConfig;
|
|
88
|
-
payload:
|
|
88
|
+
payload: InputViewRequestData;
|
|
89
89
|
options?: LedgerVersion;
|
|
90
|
-
}): Promise<
|
|
90
|
+
}): Promise<T> {
|
|
91
91
|
const { aptosConfig, payload, options } = args;
|
|
92
92
|
const { data } = await postAptosFullNode<ViewRequest, MoveValue[]>({
|
|
93
93
|
aptosConfig,
|
|
@@ -100,7 +100,8 @@ export async function view(args: {
|
|
|
100
100
|
arguments: payload.functionArguments ?? [],
|
|
101
101
|
},
|
|
102
102
|
});
|
|
103
|
-
|
|
103
|
+
|
|
104
|
+
return data as T;
|
|
104
105
|
}
|
|
105
106
|
|
|
106
107
|
export async function getChainTopUserTransactions(args: {
|
|
@@ -122,7 +123,7 @@ export async function getChainTopUserTransactions(args: {
|
|
|
122
123
|
return data.user_transactions;
|
|
123
124
|
}
|
|
124
125
|
|
|
125
|
-
export async function queryIndexer<T>(args: {
|
|
126
|
+
export async function queryIndexer<T extends {}>(args: {
|
|
126
127
|
aptosConfig: AptosConfig;
|
|
127
128
|
query: GraphqlQuery;
|
|
128
129
|
originMethod?: string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#import "./AnsTokenFragment";
|
|
2
|
+
query getNames(
|
|
3
|
+
$offset: Int
|
|
4
|
+
$limit: Int
|
|
5
|
+
$where_condition: current_aptos_names_bool_exp
|
|
6
|
+
$order_by: [current_aptos_names_order_by!]
|
|
7
|
+
) {
|
|
8
|
+
current_aptos_names(limit: $limit, where: $where_condition, order_by: $order_by, offset: $offset) {
|
|
9
|
+
...AnsTokenFragment
|
|
10
|
+
}
|
|
11
|
+
}
|