@ensdomains/ensjs 4.1.1 → 5.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/dns/getDnsImportData.d.ts +38 -0
- package/dist/actions/dns/getDnsImportData.d.ts.map +1 -0
- package/dist/actions/dns/getDnsImportData.js +60 -0
- package/dist/actions/dns/getDnsImportData.js.map +1 -0
- package/dist/actions/dns/getDnsOffchainData.d.ts +40 -0
- package/dist/actions/dns/getDnsOffchainData.d.ts.map +1 -0
- package/dist/actions/dns/getDnsOffchainData.js +104 -0
- package/dist/actions/dns/getDnsOffchainData.js.map +1 -0
- package/dist/actions/dns/getDnsOwner.d.ts +27 -0
- package/dist/actions/dns/getDnsOwner.d.ts.map +1 -0
- package/dist/actions/dns/getDnsOwner.js +53 -0
- package/dist/actions/dns/getDnsOwner.js.map +1 -0
- package/dist/actions/dns/importDnsName.d.ts +64 -0
- package/dist/actions/dns/importDnsName.d.ts.map +1 -0
- package/dist/actions/dns/importDnsName.js +85 -0
- package/dist/actions/dns/importDnsName.js.map +1 -0
- package/dist/actions/dns/types.d.ts +2 -0
- package/dist/actions/dns/types.d.ts.map +1 -0
- package/dist/actions/dns/types.js.map +1 -0
- package/dist/actions/public/findResolver.d.ts +7 -0
- package/dist/actions/public/findResolver.d.ts.map +1 -0
- package/dist/actions/public/findResolver.js +5 -0
- package/dist/actions/public/findResolver.js.map +1 -0
- package/dist/actions/public/getAbiRecord.d.ts +32 -0
- package/dist/actions/public/getAbiRecord.d.ts.map +1 -0
- package/dist/actions/public/getAbiRecord.js +35 -0
- package/dist/actions/public/getAbiRecord.js.map +1 -0
- package/dist/actions/public/getAddressRecord.d.ts +32 -0
- package/dist/actions/public/getAddressRecord.d.ts.map +1 -0
- package/dist/actions/public/getAddressRecord.js +35 -0
- package/dist/actions/public/getAddressRecord.js.map +1 -0
- package/dist/actions/public/getAvailable.d.ts +31 -0
- package/dist/actions/public/getAvailable.d.ts.map +1 -0
- package/dist/actions/public/getAvailable.js +49 -0
- package/dist/actions/public/getAvailable.js.map +1 -0
- package/dist/actions/public/getContentHashRecord.d.ts +32 -0
- package/dist/actions/public/getContentHashRecord.d.ts.map +1 -0
- package/dist/actions/public/getContentHashRecord.js +35 -0
- package/dist/actions/public/getContentHashRecord.js.map +1 -0
- package/dist/actions/public/getCredentials.d.ts +32 -0
- package/dist/actions/public/getCredentials.d.ts.map +1 -0
- package/dist/actions/public/getCredentials.js +41 -0
- package/dist/actions/public/getCredentials.js.map +1 -0
- package/dist/actions/public/getExpiry.d.ts +45 -0
- package/dist/actions/public/getExpiry.d.ts.map +1 -0
- package/dist/actions/public/getExpiry.js +156 -0
- package/dist/actions/public/getExpiry.js.map +1 -0
- package/dist/actions/public/getName.d.ts +62 -0
- package/dist/actions/public/getName.d.ts.map +1 -0
- package/dist/actions/public/getName.js +90 -0
- package/dist/actions/public/getName.js.map +1 -0
- package/dist/actions/public/getOwner.d.ts +61 -0
- package/dist/actions/public/getOwner.d.ts.map +1 -0
- package/dist/actions/public/getOwner.js +163 -0
- package/dist/actions/public/getOwner.js.map +1 -0
- package/dist/actions/public/getPrice.d.ts +37 -0
- package/dist/actions/public/getPrice.d.ts.map +1 -0
- package/dist/actions/public/getPrice.js +61 -0
- package/dist/actions/public/getPrice.js.map +1 -0
- package/dist/actions/public/getRecords.d.ts +79 -0
- package/dist/actions/public/getRecords.d.ts.map +1 -0
- package/dist/actions/public/getRecords.js +160 -0
- package/dist/actions/public/getRecords.js.map +1 -0
- package/dist/actions/public/getResolver.d.ts +30 -0
- package/dist/actions/public/getResolver.d.ts.map +1 -0
- package/dist/actions/public/getResolver.js +43 -0
- package/dist/actions/public/getResolver.js.map +1 -0
- package/dist/actions/public/getResolverName.d.ts +30 -0
- package/dist/actions/public/getResolverName.d.ts.map +1 -0
- package/dist/actions/public/getResolverName.js +35 -0
- package/dist/actions/public/getResolverName.js.map +1 -0
- package/dist/actions/public/getSupportedInterfaces.d.ts +34 -0
- package/dist/actions/public/getSupportedInterfaces.d.ts.map +1 -0
- package/dist/actions/public/getSupportedInterfaces.js +40 -0
- package/dist/actions/public/getSupportedInterfaces.js.map +1 -0
- package/dist/actions/public/getTextRecord.d.ts +32 -0
- package/dist/actions/public/getTextRecord.d.ts.map +1 -0
- package/dist/actions/public/getTextRecord.js +37 -0
- package/dist/actions/public/getTextRecord.js.map +1 -0
- package/dist/actions/public/getWrapperData.d.ts +39 -0
- package/dist/actions/public/getWrapperData.d.ts.map +1 -0
- package/dist/actions/public/getWrapperData.js +50 -0
- package/dist/actions/public/getWrapperData.js.map +1 -0
- package/dist/actions/public/getWrapperName.d.ts +30 -0
- package/dist/actions/public/getWrapperName.d.ts.map +1 -0
- package/dist/actions/public/getWrapperName.js +43 -0
- package/dist/actions/public/getWrapperName.js.map +1 -0
- package/dist/actions/public/resolveNameData.d.ts +30 -0
- package/dist/actions/public/resolveNameData.d.ts.map +1 -0
- package/dist/actions/public/resolveNameData.js +91 -0
- package/dist/actions/public/resolveNameData.js.map +1 -0
- package/dist/actions/public/v2/getResolverName.d.ts +29 -0
- package/dist/actions/public/v2/getResolverName.d.ts.map +1 -0
- package/dist/actions/public/v2/getResolverName.js +35 -0
- package/dist/actions/public/v2/getResolverName.js.map +1 -0
- package/dist/actions/public/v2/getUnderlyingResolver.d.ts +30 -0
- package/dist/actions/public/v2/getUnderlyingResolver.d.ts.map +1 -0
- package/dist/actions/public/v2/getUnderlyingResolver.js +35 -0
- package/dist/actions/public/v2/getUnderlyingResolver.js.map +1 -0
- package/dist/actions/subgraph/client.d.ts +9 -0
- package/dist/actions/subgraph/client.d.ts.map +1 -0
- package/dist/actions/subgraph/client.js +88 -0
- package/dist/actions/subgraph/client.js.map +1 -0
- package/dist/actions/subgraph/events.d.ts +140 -0
- package/dist/actions/subgraph/events.d.ts.map +1 -0
- package/dist/actions/subgraph/events.js.map +1 -0
- package/dist/actions/subgraph/filters.d.ts +702 -0
- package/dist/actions/subgraph/filters.d.ts.map +1 -0
- package/dist/actions/subgraph/filters.js +108 -0
- package/dist/actions/subgraph/filters.js.map +1 -0
- package/dist/actions/subgraph/fragments.d.ts +41 -0
- package/dist/actions/subgraph/fragments.d.ts.map +1 -0
- package/dist/actions/subgraph/fragments.js.map +1 -0
- package/dist/actions/subgraph/getDecodedName.d.ts +33 -0
- package/dist/actions/subgraph/getDecodedName.d.ts.map +1 -0
- package/dist/actions/subgraph/getDecodedName.js +84 -0
- package/dist/actions/subgraph/getDecodedName.js.map +1 -0
- package/dist/actions/subgraph/getNameHistory.d.ts +61 -0
- package/dist/actions/subgraph/getNameHistory.d.ts.map +1 -0
- package/dist/actions/subgraph/getNameHistory.js +202 -0
- package/dist/actions/subgraph/getNameHistory.js.map +1 -0
- package/dist/actions/subgraph/getNamesForAddress.d.ts +69 -0
- package/dist/actions/subgraph/getNamesForAddress.d.ts.map +1 -0
- package/dist/actions/subgraph/getNamesForAddress.js +214 -0
- package/dist/actions/subgraph/getNamesForAddress.js.map +1 -0
- package/dist/actions/subgraph/getRecordHistory.d.ts +13 -0
- package/dist/actions/subgraph/getRecordHistory.d.ts.map +1 -0
- package/dist/actions/subgraph/getRecordHistory.js +76 -0
- package/dist/actions/subgraph/getRecordHistory.js.map +1 -0
- package/dist/actions/subgraph/getResolvedNamesForAddress.d.ts +26 -0
- package/dist/actions/subgraph/getResolvedNamesForAddress.d.ts.map +1 -0
- package/dist/actions/subgraph/getResolvedNamesForAddress.js +29 -0
- package/dist/actions/subgraph/getResolvedNamesForAddress.js.map +1 -0
- package/dist/actions/subgraph/getSubgraphRecords.d.ts +49 -0
- package/dist/actions/subgraph/getSubgraphRecords.d.ts.map +1 -0
- package/dist/actions/subgraph/getSubgraphRecords.js +103 -0
- package/dist/actions/subgraph/getSubgraphRecords.js.map +1 -0
- package/dist/actions/subgraph/getSubgraphRegistrant.d.ts +33 -0
- package/dist/actions/subgraph/getSubgraphRegistrant.d.ts.map +1 -0
- package/dist/actions/subgraph/getSubgraphRegistrant.js +52 -0
- package/dist/actions/subgraph/getSubgraphRegistrant.js.map +1 -0
- package/dist/actions/subgraph/getSubnames.d.ts +47 -0
- package/dist/actions/subgraph/getSubnames.d.ts.map +1 -0
- package/dist/actions/subgraph/getSubnames.js +159 -0
- package/dist/actions/subgraph/getSubnames.js.map +1 -0
- package/dist/actions/subgraph/types.d.ts +13 -0
- package/dist/actions/subgraph/types.d.ts.map +1 -0
- package/dist/actions/subgraph/types.js.map +1 -0
- package/dist/actions/subgraph/utils.d.ts +42 -0
- package/dist/actions/subgraph/utils.d.ts.map +1 -0
- package/dist/actions/subgraph/utils.js +119 -0
- package/dist/actions/subgraph/utils.js.map +1 -0
- package/dist/actions/wallet/clearRecords.d.ts +70 -0
- package/dist/actions/wallet/clearRecords.d.ts.map +1 -0
- package/dist/actions/wallet/clearRecords.js +55 -0
- package/dist/actions/wallet/clearRecords.js.map +1 -0
- package/dist/actions/wallet/commitName.d.ts +171 -0
- package/dist/actions/wallet/commitName.d.ts.map +1 -0
- package/dist/actions/wallet/commitName.js +76 -0
- package/dist/actions/wallet/commitName.js.map +1 -0
- package/dist/actions/wallet/createSubname.d.ts +83 -0
- package/dist/actions/wallet/createSubname.d.ts.map +1 -0
- package/dist/actions/wallet/createSubname.js +173 -0
- package/dist/actions/wallet/createSubname.js.map +1 -0
- package/dist/actions/wallet/deleteSubname.d.ts +481 -0
- package/dist/actions/wallet/deleteSubname.d.ts.map +1 -0
- package/dist/actions/wallet/deleteSubname.js +120 -0
- package/dist/actions/wallet/deleteSubname.js.map +1 -0
- package/dist/actions/wallet/registerName.d.ts +207 -0
- package/dist/actions/wallet/registerName.d.ts.map +1 -0
- package/dist/actions/wallet/registerName.js +94 -0
- package/dist/actions/wallet/registerName.js.map +1 -0
- package/dist/actions/wallet/renewNames.d.ts +131 -0
- package/dist/actions/wallet/renewNames.d.ts.map +1 -0
- package/dist/actions/wallet/renewNames.js +79 -0
- package/dist/actions/wallet/renewNames.js.map +1 -0
- package/dist/actions/wallet/setAbiRecord.d.ts +78 -0
- package/dist/actions/wallet/setAbiRecord.d.ts.map +1 -0
- package/dist/actions/wallet/setAbiRecord.js +58 -0
- package/dist/actions/wallet/setAbiRecord.js.map +1 -0
- package/dist/actions/wallet/setAddressRecord.d.ts +90 -0
- package/dist/actions/wallet/setAddressRecord.d.ts.map +1 -0
- package/dist/actions/wallet/setAddressRecord.js +57 -0
- package/dist/actions/wallet/setAddressRecord.js.map +1 -0
- package/dist/actions/wallet/setChildFuses.d.ts +183 -0
- package/dist/actions/wallet/setChildFuses.d.ts.map +1 -0
- package/dist/actions/wallet/setChildFuses.js +63 -0
- package/dist/actions/wallet/setChildFuses.js.map +1 -0
- package/dist/actions/wallet/setContentHashRecord.d.ts +78 -0
- package/dist/actions/wallet/setContentHashRecord.d.ts.map +1 -0
- package/dist/actions/wallet/setContentHashRecord.js +50 -0
- package/dist/actions/wallet/setContentHashRecord.js.map +1 -0
- package/dist/actions/wallet/setFuses.d.ts +175 -0
- package/dist/actions/wallet/setFuses.d.ts.map +1 -0
- package/dist/actions/wallet/setFuses.js +59 -0
- package/dist/actions/wallet/setFuses.js.map +1 -0
- package/dist/actions/wallet/setPrimaryName.d.ts +197 -0
- package/dist/actions/wallet/setPrimaryName.d.ts.map +1 -0
- package/dist/actions/wallet/setPrimaryName.js +69 -0
- package/dist/actions/wallet/setPrimaryName.js.map +1 -0
- package/dist/actions/wallet/setRecords.d.ts +225 -0
- package/dist/actions/wallet/setRecords.d.ts.map +1 -0
- package/dist/actions/wallet/setRecords.js +81 -0
- package/dist/actions/wallet/setRecords.js.map +1 -0
- package/dist/actions/wallet/setResolver.d.ts +244 -0
- package/dist/actions/wallet/setResolver.d.ts.map +1 -0
- package/dist/actions/wallet/setResolver.js +75 -0
- package/dist/actions/wallet/setResolver.js.map +1 -0
- package/dist/actions/wallet/setTextRecord.d.ts +88 -0
- package/dist/actions/wallet/setTextRecord.d.ts.map +1 -0
- package/dist/actions/wallet/setTextRecord.js +53 -0
- package/dist/actions/wallet/setTextRecord.js.map +1 -0
- package/dist/actions/wallet/transferName.d.ts +622 -0
- package/dist/actions/wallet/transferName.d.ts.map +1 -0
- package/dist/actions/wallet/transferName.js +161 -0
- package/dist/actions/wallet/transferName.js.map +1 -0
- package/dist/actions/wallet/unwrapName.d.ts +313 -0
- package/dist/actions/wallet/unwrapName.d.ts.map +1 -0
- package/dist/actions/wallet/unwrapName.js +84 -0
- package/dist/actions/wallet/unwrapName.js.map +1 -0
- package/dist/actions/wallet/wrapName.d.ts +257 -0
- package/dist/actions/wallet/wrapName.d.ts.map +1 -0
- package/dist/actions/wallet/wrapName.js +101 -0
- package/dist/actions/wallet/wrapName.js.map +1 -0
- package/dist/clients/chain.d.ts +287 -0
- package/dist/clients/chain.d.ts.map +1 -0
- package/dist/clients/chain.js +232 -0
- package/dist/clients/chain.js.map +1 -0
- package/dist/clients/decorators/public.d.ts +38 -40
- package/dist/clients/decorators/public.d.ts.map +1 -0
- package/dist/clients/decorators/public.js +33 -30
- package/dist/clients/decorators/public.js.map +1 -1
- package/dist/clients/decorators/subgraph.d.ts +8 -7
- package/dist/clients/decorators/subgraph.d.ts.map +1 -0
- package/dist/clients/decorators/subgraph.js +6 -6
- package/dist/clients/decorators/subgraph.js.map +1 -1
- package/dist/clients/decorators/wallet.d.ts +45 -41
- package/dist/clients/decorators/wallet.d.ts.map +1 -0
- package/dist/clients/decorators/wallet.js +41 -38
- package/dist/clients/decorators/wallet.js.map +1 -1
- package/dist/contracts/addEnsContracts.d.ts +3 -3
- package/dist/contracts/addEnsContracts.d.ts.map +1 -0
- package/dist/contracts/addEnsContracts.js +5 -5
- package/dist/contracts/addEnsContracts.js.map +1 -1
- package/dist/contracts/baseRegistrar.d.ts +1 -0
- package/dist/contracts/baseRegistrar.d.ts.map +1 -0
- package/dist/contracts/bulkRenewal.d.ts +1 -0
- package/dist/contracts/bulkRenewal.d.ts.map +1 -0
- package/dist/contracts/compositeResolver.d.ts +17 -0
- package/dist/contracts/compositeResolver.d.ts.map +1 -0
- package/dist/contracts/compositeResolver.js +24 -0
- package/dist/contracts/compositeResolver.js.map +1 -0
- package/dist/contracts/consts.d.ts +16 -39
- package/dist/contracts/consts.d.ts.map +1 -0
- package/dist/contracts/consts.js +19 -41
- package/dist/contracts/consts.js.map +1 -1
- package/dist/contracts/dedicatedResolver.d.ts +55 -0
- package/dist/contracts/dedicatedResolver.d.ts.map +1 -0
- package/dist/contracts/dedicatedResolver.js +75 -0
- package/dist/contracts/dedicatedResolver.js.map +1 -0
- package/dist/contracts/dnsRegistrar.d.ts +1 -0
- package/dist/contracts/dnsRegistrar.d.ts.map +1 -0
- package/dist/contracts/dnssecImpl.d.ts +1 -0
- package/dist/contracts/dnssecImpl.d.ts.map +1 -0
- package/dist/contracts/erc1155.d.ts +1 -0
- package/dist/contracts/erc1155.d.ts.map +1 -0
- package/dist/contracts/erc165.d.ts +1 -0
- package/dist/contracts/erc165.d.ts.map +1 -0
- package/dist/contracts/erc721.d.ts +1 -0
- package/dist/contracts/erc721.d.ts.map +1 -0
- package/dist/contracts/ethRegistrarController.d.ts +1 -31
- package/dist/contracts/ethRegistrarController.d.ts.map +1 -0
- package/dist/contracts/ethRegistrarController.js +0 -40
- package/dist/contracts/ethRegistrarController.js.map +1 -1
- package/dist/contracts/getChainContractAddress.d.ts +16 -15
- package/dist/contracts/getChainContractAddress.d.ts.map +1 -0
- package/dist/contracts/getChainContractAddress.js +3 -2
- package/dist/contracts/getChainContractAddress.js.map +1 -1
- package/dist/contracts/index.d.ts +3 -4
- package/dist/contracts/index.d.ts.map +1 -0
- package/dist/contracts/index.js +2 -4
- package/dist/contracts/index.js.map +1 -1
- package/dist/contracts/l2EthRegistrar.d.ts +599 -0
- package/dist/contracts/l2EthRegistrar.d.ts.map +1 -0
- package/dist/contracts/l2EthRegistrar.js +296 -0
- package/dist/contracts/l2EthRegistrar.js.map +1 -0
- package/dist/contracts/multicall.d.ts +11 -10
- package/dist/contracts/multicall.d.ts.map +1 -0
- package/dist/contracts/multicall.js +14 -14
- package/dist/contracts/multicall.js.map +1 -1
- package/dist/contracts/nameWrapper.d.ts +1 -0
- package/dist/contracts/nameWrapper.d.ts.map +1 -0
- package/dist/contracts/publicResolver.d.ts +8 -3
- package/dist/contracts/publicResolver.d.ts.map +1 -0
- package/dist/contracts/publicResolver.js +9 -3
- package/dist/contracts/publicResolver.js.map +1 -1
- package/dist/contracts/registry.d.ts +1 -0
- package/dist/contracts/registry.d.ts.map +1 -0
- package/dist/contracts/reverseRegistrar.d.ts +1 -0
- package/dist/contracts/reverseRegistrar.d.ts.map +1 -0
- package/dist/contracts/universalResolver.d.ts +1 -0
- package/dist/contracts/universalResolver.d.ts.map +1 -0
- package/dist/dns.d.ts +6 -5
- package/dist/dns.d.ts.map +1 -0
- package/dist/dns.js +4 -4
- package/dist/dns.js.map +1 -1
- package/dist/errors/base.d.ts +1 -0
- package/dist/errors/base.d.ts.map +1 -0
- package/dist/errors/base.js +36 -6
- package/dist/errors/base.js.map +1 -1
- package/dist/errors/contracts.d.ts +1 -0
- package/dist/errors/contracts.d.ts.map +1 -0
- package/dist/errors/contracts.js +24 -4
- package/dist/errors/contracts.js.map +1 -1
- package/dist/errors/dns.d.ts +1 -0
- package/dist/errors/dns.d.ts.map +1 -0
- package/dist/errors/dns.js +90 -15
- package/dist/errors/dns.js.map +1 -1
- package/dist/errors/error-utils.d.ts +1 -0
- package/dist/errors/error-utils.d.ts.map +1 -0
- package/dist/errors/general.d.ts +2 -1
- package/dist/errors/general.d.ts.map +1 -0
- package/dist/errors/general.js +66 -11
- package/dist/errors/general.js.map +1 -1
- package/dist/errors/public.d.ts +1 -0
- package/dist/errors/public.d.ts.map +1 -0
- package/dist/errors/public.js +30 -5
- package/dist/errors/public.js.map +1 -1
- package/dist/errors/subgraph.d.ts +1 -0
- package/dist/errors/subgraph.d.ts.map +1 -0
- package/dist/errors/subgraph.js +48 -8
- package/dist/errors/subgraph.js.map +1 -1
- package/dist/errors/utils.d.ts +4 -0
- package/dist/errors/utils.d.ts.map +1 -0
- package/dist/errors/utils.js +96 -16
- package/dist/errors/utils.js.map +1 -1
- package/dist/errors/version.d.ts +2 -1
- package/dist/errors/version.d.ts.map +1 -0
- package/dist/errors/version.js +1 -1
- package/dist/errors/version.js.map +1 -1
- package/dist/errors/wallet.d.ts +1 -0
- package/dist/errors/wallet.d.ts.map +1 -0
- package/dist/exports/chain.d.ts +2 -0
- package/dist/exports/chain.d.ts.map +1 -0
- package/dist/exports/chain.js +2 -0
- package/dist/exports/chain.js.map +1 -0
- package/dist/exports/internal.d.ts +2 -0
- package/dist/exports/internal.d.ts.map +1 -0
- package/dist/exports/internal.js +2 -0
- package/dist/exports/internal.js.map +1 -0
- package/dist/exports/public/v2.d.ts +3 -0
- package/dist/exports/public/v2.d.ts.map +1 -0
- package/dist/exports/public/v2.js +3 -0
- package/dist/exports/public/v2.js.map +1 -0
- package/dist/exports/public.d.ts +17 -0
- package/dist/exports/public.d.ts.map +1 -0
- package/dist/exports/public.js +17 -0
- package/dist/exports/public.js.map +1 -0
- package/dist/exports/wallet.d.ts +19 -0
- package/dist/exports/wallet.d.ts.map +1 -0
- package/dist/exports/wallet.js +19 -0
- package/dist/exports/wallet.js.map +1 -0
- package/dist/index.d.ts +1 -6
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +0 -6
- package/dist/index.js.map +1 -1
- package/dist/subgraph.d.ts +12 -9
- package/dist/subgraph.d.ts.map +1 -0
- package/dist/subgraph.js +10 -8
- package/dist/subgraph.js.map +1 -1
- package/dist/test/addTestContracts.d.ts +87 -0
- package/dist/test/addTestContracts.d.ts.map +1 -0
- package/dist/test/addTestContracts.js +89 -0
- package/dist/test/addTestContracts.js.map +1 -0
- package/dist/test/createHttpServer.d.ts +6 -0
- package/dist/test/createHttpServer.d.ts.map +1 -0
- package/dist/test/createHttpServer.js +25 -0
- package/dist/test/createHttpServer.js.map +1 -0
- package/dist/test/dns.d.ts +6 -0
- package/dist/test/dns.d.ts.map +1 -0
- package/dist/test/dns.js +8 -0
- package/dist/test/dns.js.map +1 -0
- package/dist/test/setup.d.ts +2 -0
- package/dist/test/setup.d.ts.map +1 -0
- package/dist/test/setup.js +7 -0
- package/dist/test/setup.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/dist/types/index.d.ts +60 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/internal.d.ts +25 -0
- package/dist/types/internal.d.ts.map +1 -0
- package/dist/types/internal.js +18 -0
- package/dist/types/internal.js.map +1 -0
- package/dist/utils/ccipBatchRequest.d.ts +3 -0
- package/dist/utils/ccipBatchRequest.d.ts.map +1 -0
- package/dist/utils/ccipBatchRequest.js +4 -1
- package/dist/utils/ccipBatchRequest.js.map +1 -1
- package/dist/utils/ccipRequest.d.ts +4 -1
- package/dist/utils/ccipRequest.d.ts.map +1 -0
- package/dist/utils/ccipRequest.js +4 -3
- package/dist/utils/ccipRequest.js.map +1 -1
- package/dist/utils/clientWithOverrides.d.ts +8 -0
- package/dist/utils/clientWithOverrides.d.ts.map +1 -0
- package/dist/utils/clientWithOverrides.js +9 -0
- package/dist/utils/clientWithOverrides.js.map +1 -0
- package/dist/utils/coders/clearRecords.d.ts +29 -0
- package/dist/utils/coders/clearRecords.d.ts.map +1 -0
- package/dist/utils/coders/clearRecords.js +12 -0
- package/dist/utils/coders/clearRecords.js.map +1 -0
- package/dist/utils/coders/encodeAbi.d.ts +39 -0
- package/dist/utils/coders/encodeAbi.d.ts.map +1 -0
- package/dist/utils/coders/encodeAbi.js +75 -0
- package/dist/utils/coders/encodeAbi.js.map +1 -0
- package/dist/utils/coders/getAbi.d.ts +65 -0
- package/dist/utils/coders/getAbi.d.ts.map +1 -0
- package/dist/utils/coders/getAbi.js +102 -0
- package/dist/utils/coders/getAbi.js.map +1 -0
- package/dist/utils/coders/getAddress.d.ts +116 -0
- package/dist/utils/coders/getAddress.d.ts.map +1 -0
- package/dist/utils/coders/getAddress.js +85 -0
- package/dist/utils/coders/getAddress.js.map +1 -0
- package/dist/utils/coders/getContentHash.d.ts +35 -0
- package/dist/utils/coders/getContentHash.d.ts.map +1 -0
- package/dist/utils/coders/getContentHash.js +31 -0
- package/dist/utils/coders/getContentHash.js.map +1 -0
- package/dist/utils/coders/getText.d.ts +60 -0
- package/dist/utils/coders/getText.d.ts.map +1 -0
- package/dist/utils/coders/getText.js +32 -0
- package/dist/utils/coders/getText.js.map +1 -0
- package/dist/utils/coders/resolverMulticallParameters.d.ts +27 -0
- package/dist/utils/coders/resolverMulticallParameters.d.ts.map +1 -0
- package/dist/utils/coders/resolverMulticallParameters.js +34 -0
- package/dist/utils/coders/resolverMulticallParameters.js.map +1 -0
- package/dist/utils/coders/setAbi.d.ts +31 -0
- package/dist/utils/coders/setAbi.d.ts.map +1 -0
- package/dist/utils/coders/setAbi.js +14 -0
- package/dist/utils/coders/setAbi.js.map +1 -0
- package/dist/utils/coders/setAddr.d.ts +49 -0
- package/dist/utils/coders/setAddr.d.ts.map +1 -0
- package/dist/utils/coders/setAddr.js +27 -0
- package/dist/utils/coders/setAddr.js.map +1 -0
- package/dist/utils/coders/setContentHash.d.ts +40 -0
- package/dist/utils/coders/setContentHash.d.ts.map +1 -0
- package/dist/utils/coders/setContentHash.js +19 -0
- package/dist/utils/coders/setContentHash.js.map +1 -0
- package/dist/utils/coders/setText.d.ts +45 -0
- package/dist/utils/coders/setText.d.ts.map +1 -0
- package/dist/utils/coders/setText.js +17 -0
- package/dist/utils/coders/setText.js.map +1 -0
- package/dist/utils/consts.d.ts +1 -0
- package/dist/utils/consts.d.ts.map +1 -0
- package/dist/utils/contentHash.d.ts +8 -0
- package/dist/utils/contentHash.d.ts.map +1 -0
- package/dist/utils/contentHash.js +1 -0
- package/dist/utils/contentHash.js.map +1 -1
- package/dist/utils/dns/getDnsTxtRecords.d.ts +4 -1
- package/dist/utils/dns/getDnsTxtRecords.d.ts.map +1 -0
- package/dist/utils/dns/getDnsTxtRecords.js.map +1 -1
- package/dist/utils/dns/misc.d.ts +1 -0
- package/dist/utils/dns/misc.d.ts.map +1 -0
- package/dist/utils/errors/isNullRegistrarOwnerOfError.d.ts +6 -0
- package/dist/utils/errors/isNullRegistrarOwnerOfError.d.ts.map +1 -0
- package/dist/utils/errors/isNullRegistrarOwnerOfError.js +14 -0
- package/dist/utils/errors/isNullRegistrarOwnerOfError.js.map +1 -0
- package/dist/utils/errors/isNullUniversalResolverError.d.ts +6 -0
- package/dist/utils/errors/isNullUniversalResolverError.d.ts.map +1 -0
- package/dist/utils/errors/isNullUniversalResolverError.js +24 -0
- package/dist/utils/errors/isNullUniversalResolverError.js.map +1 -0
- package/dist/utils/errors/isReverseAddressMismatch.d.ts +6 -0
- package/dist/utils/errors/isReverseAddressMismatch.d.ts.map +1 -0
- package/dist/utils/errors/isReverseAddressMismatch.js +16 -0
- package/dist/utils/errors/isReverseAddressMismatch.js.map +1 -0
- package/dist/utils/errors/parseReverseAddressMismatchError.d.ts +5 -0
- package/dist/utils/errors/parseReverseAddressMismatchError.d.ts.map +1 -0
- package/dist/utils/errors/parseReverseAddressMismatchError.js +15 -0
- package/dist/utils/errors/parseReverseAddressMismatchError.js.map +1 -0
- package/dist/utils/format.d.ts +1 -0
- package/dist/utils/format.d.ts.map +1 -0
- package/dist/utils/fuses.d.ts +6 -1
- package/dist/utils/fuses.d.ts.map +1 -0
- package/dist/utils/fuses.js.map +1 -1
- package/dist/utils/generateSupportedContentTypes.d.ts +2 -1
- package/dist/utils/generateSupportedContentTypes.d.ts.map +1 -0
- package/dist/utils/index.d.ts +37 -23
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +36 -23
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/l2RegisterHelpers.d.ts +37 -0
- package/dist/utils/l2RegisterHelpers.d.ts.map +1 -0
- package/dist/utils/l2RegisterHelpers.js +48 -0
- package/dist/utils/l2RegisterHelpers.js.map +1 -0
- package/dist/utils/name/getNameType.d.ts +3 -0
- package/dist/utils/name/getNameType.d.ts.map +1 -0
- package/dist/utils/name/getNameType.js.map +1 -0
- package/dist/utils/name/getNameWithSizedLabels.d.ts +8 -0
- package/dist/utils/name/getNameWithSizedLabels.d.ts.map +1 -0
- package/dist/utils/name/getNameWithSizedLabels.js +18 -0
- package/dist/utils/name/getNameWithSizedLabels.js.map +1 -0
- package/dist/utils/name/hexEncodedName.d.ts +7 -0
- package/dist/utils/name/hexEncodedName.d.ts.map +1 -0
- package/dist/utils/name/hexEncodedName.js +20 -0
- package/dist/utils/name/hexEncodedName.js.map +1 -0
- package/dist/utils/name/labels.d.ts +55 -0
- package/dist/utils/name/labels.d.ts.map +1 -0
- package/dist/utils/name/labels.js +123 -0
- package/dist/utils/name/labels.js.map +1 -0
- package/dist/utils/name/makeLabelNodeAndParent.d.ts +14 -0
- package/dist/utils/name/makeLabelNodeAndParent.d.ts.map +1 -0
- package/dist/utils/name/makeLabelNodeAndParent.js +18 -0
- package/dist/utils/name/makeLabelNodeAndParent.js.map +1 -0
- package/dist/utils/name/normalize.d.ts +25 -0
- package/dist/utils/name/normalize.d.ts.map +1 -0
- package/dist/utils/name/normalize.js +27 -0
- package/dist/utils/name/normalize.js.map +1 -0
- package/dist/utils/name/validation.d.ts +20 -0
- package/dist/utils/name/validation.d.ts.map +1 -0
- package/dist/utils/name/validation.js +70 -0
- package/dist/utils/name/validation.js.map +1 -0
- package/dist/utils/normalizeCoinId.d.ts +15 -0
- package/dist/utils/normalizeCoinId.d.ts.map +1 -0
- package/dist/utils/normalizeCoinId.js +32 -0
- package/dist/utils/normalizeCoinId.js.map +1 -0
- package/dist/utils/nullableAddress.d.ts +3 -0
- package/dist/utils/nullableAddress.d.ts.map +1 -0
- package/dist/utils/nullableAddress.js +3 -0
- package/dist/utils/nullableAddress.js.map +1 -0
- package/dist/utils/ownerFromContract.d.ts +187 -8
- package/dist/utils/ownerFromContract.d.ts.map +1 -0
- package/dist/utils/ownerFromContract.js +20 -22
- package/dist/utils/ownerFromContract.js.map +1 -1
- package/dist/utils/registerHelpers.d.ts +14 -6
- package/dist/utils/registerHelpers.d.ts.map +1 -0
- package/dist/utils/registerHelpers.js +13 -12
- package/dist/utils/registerHelpers.js.map +1 -1
- package/dist/utils/wrapper.d.ts +7 -1
- package/dist/utils/wrapper.d.ts.map +1 -0
- package/dist/utils/wrapper.js +4 -1
- package/dist/utils/wrapper.js.map +1 -1
- package/package.json +29 -14
- package/src/actions/dns/getDnsImportData.ts +109 -0
- package/src/actions/dns/getDnsOffchainData.ts +169 -0
- package/src/actions/dns/getDnsOwner.ts +96 -0
- package/src/actions/dns/importDnsName.ts +175 -0
- package/src/actions/public/getAbiRecord.ts +72 -0
- package/src/actions/public/getAddressRecord.ts +87 -0
- package/src/actions/public/getAvailable.ts +76 -0
- package/src/actions/public/getContentHashRecord.ts +70 -0
- package/src/actions/public/getCredentials.ts +65 -0
- package/src/actions/public/getExpiry.ts +220 -0
- package/src/actions/public/getName.ts +164 -0
- package/src/actions/public/getOwner.ts +278 -0
- package/src/actions/public/getPrice.ts +100 -0
- package/src/actions/public/getRecords.ts +398 -0
- package/src/actions/public/getResolver.ts +71 -0
- package/src/actions/public/getSupportedInterfaces.ts +68 -0
- package/src/actions/public/getTextRecord.ts +74 -0
- package/src/actions/public/getWrapperData.ts +88 -0
- package/src/actions/public/getWrapperName.ts +76 -0
- package/src/actions/public/resolveNameData.ts +143 -0
- package/src/actions/public/v2/getResolverName.ts +50 -0
- package/src/actions/public/v2/getUnderlyingResolver.ts +53 -0
- package/src/actions/subgraph/client.ts +105 -0
- package/src/actions/subgraph/filters.ts +848 -0
- package/src/actions/subgraph/getDecodedName.ts +123 -0
- package/src/actions/subgraph/getNameHistory.ts +286 -0
- package/src/actions/subgraph/getNamesForAddress.ts +353 -0
- package/src/actions/subgraph/getRecordHistory.ts +126 -0
- package/src/actions/subgraph/getResolvedNamesForAddress.ts +60 -0
- package/src/actions/subgraph/getSubgraphRecords.ts +185 -0
- package/src/actions/subgraph/getSubgraphRegistrant.ts +78 -0
- package/src/actions/subgraph/getSubnames.ts +238 -0
- package/src/actions/subgraph/utils.ts +164 -0
- package/src/actions/wallet/clearRecords.ts +135 -0
- package/src/actions/wallet/commitName.ts +191 -0
- package/src/actions/wallet/createSubname.ts +354 -0
- package/src/actions/wallet/deleteSubname.ts +241 -0
- package/src/actions/wallet/registerName.ts +190 -0
- package/src/actions/wallet/renewNames.ts +167 -0
- package/src/actions/wallet/setAbiRecord.ts +176 -0
- package/src/actions/wallet/setAddressRecord.ts +174 -0
- package/src/actions/wallet/setChildFuses.ts +152 -0
- package/src/actions/wallet/setContentHashRecord.ts +134 -0
- package/src/actions/wallet/setFuses.ts +127 -0
- package/src/actions/wallet/setPrimaryName.ts +189 -0
- package/src/actions/wallet/setRecords.ts +174 -0
- package/src/actions/wallet/setResolver.ts +173 -0
- package/src/actions/wallet/setTextRecord.ts +137 -0
- package/src/actions/wallet/transferName.ts +314 -0
- package/src/actions/wallet/unwrapName.ts +194 -0
- package/src/actions/wallet/wrapName.ts +235 -0
- package/src/clients/chain.ts +426 -0
- package/src/contracts/addEnsContracts.ts +14 -12
- package/src/contracts/compositeResolver.ts +23 -0
- package/src/contracts/dedicatedResolver.ts +77 -0
- package/src/contracts/ethRegistrarController.ts +0 -41
- package/src/contracts/getChainContractAddress.ts +25 -18
- package/src/contracts/index.ts +4 -28
- package/src/contracts/l2EthRegistrar.ts +303 -0
- package/src/contracts/multicall.ts +15 -15
- package/src/contracts/publicResolver.ts +10 -3
- package/src/dns.ts +13 -9
- package/src/errors/base.ts +1 -1
- package/src/errors/general.ts +1 -1
- package/src/errors/utils.ts +2 -0
- package/src/errors/version.ts +1 -1
- package/src/exports/chain.ts +1 -0
- package/src/exports/internal.ts +1 -0
- package/src/exports/public/v2.ts +2 -0
- package/src/exports/public.ts +16 -0
- package/src/exports/wallet.ts +18 -0
- package/src/index.ts +0 -28
- package/src/subgraph.ts +28 -9
- package/src/types/index.ts +137 -0
- package/src/types/internal.ts +62 -0
- package/src/utils/ccipBatchRequest.ts +14 -2
- package/src/utils/ccipRequest.ts +24 -3
- package/src/utils/clientWithOverrides.ts +27 -0
- package/src/utils/coders/clearRecords.ts +33 -0
- package/src/utils/coders/encodeAbi.ts +144 -0
- package/src/utils/coders/getAbi.ts +211 -0
- package/src/utils/coders/getAddress.ts +239 -0
- package/src/utils/coders/getContentHash.ts +81 -0
- package/src/utils/coders/getText.ts +104 -0
- package/src/utils/coders/resolverMulticallParameters.ts +109 -0
- package/src/utils/coders/setAbi.ts +44 -0
- package/src/utils/coders/setAddr.ts +64 -0
- package/src/utils/coders/setContentHash.ts +45 -0
- package/src/utils/coders/setText.ts +40 -0
- package/src/utils/contentHash.ts +39 -2
- package/src/utils/dns/getDnsTxtRecords.ts +4 -1
- package/src/utils/errors/isNullRegistrarOwnerOfError.ts +12 -0
- package/src/utils/errors/isNullUniversalResolverError.ts +19 -0
- package/src/utils/errors/parseReverseAddressMismatchError.ts +14 -0
- package/src/utils/fuses.ts +30 -1
- package/src/utils/generateSupportedContentTypes.ts +1 -1
- package/src/utils/index.ts +36 -164
- package/src/utils/l2RegisterHelpers.ts +147 -0
- package/src/utils/name/getNameType.ts +18 -0
- package/src/utils/name/getNameWithSizedLabels.ts +28 -0
- package/src/utils/name/hexEncodedName.ts +33 -0
- package/src/utils/name/labels.ts +178 -0
- package/src/utils/name/makeLabelNodeAndParent.ts +27 -0
- package/src/utils/name/normalize.ts +70 -0
- package/src/utils/name/validation.ts +119 -0
- package/src/utils/normalizeCoinId.ts +65 -0
- package/src/utils/nullableAddress.ts +4 -0
- package/src/utils/ownerFromContract.ts +49 -34
- package/src/utils/registerHelpers.ts +76 -17
- package/src/utils/wrapper.ts +27 -4
- package/dist/clients/public.d.ts +0 -26
- package/dist/clients/public.js +0 -34
- package/dist/clients/public.js.map +0 -1
- package/dist/clients/subgraph.d.ts +0 -25
- package/dist/clients/subgraph.js +0 -31
- package/dist/clients/subgraph.js.map +0 -1
- package/dist/clients/wallet.d.ts +0 -25
- package/dist/clients/wallet.js +0 -30
- package/dist/clients/wallet.js.map +0 -1
- package/dist/contracts/legacyEthRegistrarController.d.ts +0 -262
- package/dist/contracts/legacyEthRegistrarController.js +0 -184
- package/dist/contracts/legacyEthRegistrarController.js.map +0 -1
- package/dist/errors/register.d.ts +0 -9
- package/dist/errors/register.js +0 -14
- package/dist/errors/register.js.map +0 -1
- package/dist/functions/dns/getDnsImportData.d.ts +0 -36
- package/dist/functions/dns/getDnsImportData.js +0 -60
- package/dist/functions/dns/getDnsImportData.js.map +0 -1
- package/dist/functions/dns/getDnsOffchainData.d.ts +0 -27
- package/dist/functions/dns/getDnsOffchainData.js +0 -95
- package/dist/functions/dns/getDnsOffchainData.js.map +0 -1
- package/dist/functions/dns/getDnsOwner.d.ts +0 -24
- package/dist/functions/dns/getDnsOwner.js +0 -54
- package/dist/functions/dns/getDnsOwner.js.map +0 -1
- package/dist/functions/dns/importDnsName.d.ts +0 -61
- package/dist/functions/dns/importDnsName.js +0 -84
- package/dist/functions/dns/importDnsName.js.map +0 -1
- package/dist/functions/dns/types.d.ts +0 -1
- package/dist/functions/dns/types.js.map +0 -1
- package/dist/functions/public/_getAbi.d.ts +0 -19
- package/dist/functions/public/_getAbi.js +0 -82
- package/dist/functions/public/_getAbi.js.map +0 -1
- package/dist/functions/public/_getAddr.d.ts +0 -16
- package/dist/functions/public/_getAddr.js +0 -78
- package/dist/functions/public/_getAddr.js.map +0 -1
- package/dist/functions/public/_getContentHash.d.ts +0 -13
- package/dist/functions/public/_getContentHash.js +0 -36
- package/dist/functions/public/_getContentHash.js.map +0 -1
- package/dist/functions/public/_getText.d.ts +0 -14
- package/dist/functions/public/_getText.js +0 -37
- package/dist/functions/public/_getText.js.map +0 -1
- package/dist/functions/public/batch.d.ts +0 -39
- package/dist/functions/public/batch.js +0 -54
- package/dist/functions/public/batch.js.map +0 -1
- package/dist/functions/public/getAbiRecord.d.ts +0 -34
- package/dist/functions/public/getAbiRecord.js +0 -42
- package/dist/functions/public/getAbiRecord.js.map +0 -1
- package/dist/functions/public/getAddressRecord.d.ts +0 -34
- package/dist/functions/public/getAddressRecord.js +0 -42
- package/dist/functions/public/getAddressRecord.js.map +0 -1
- package/dist/functions/public/getAvailable.d.ts +0 -33
- package/dist/functions/public/getAvailable.js +0 -59
- package/dist/functions/public/getAvailable.js.map +0 -1
- package/dist/functions/public/getContentHashRecord.d.ts +0 -34
- package/dist/functions/public/getContentHashRecord.js +0 -42
- package/dist/functions/public/getContentHashRecord.js.map +0 -1
- package/dist/functions/public/getExpiry.d.ts +0 -44
- package/dist/functions/public/getExpiry.js +0 -137
- package/dist/functions/public/getExpiry.js.map +0 -1
- package/dist/functions/public/getName.d.ts +0 -60
- package/dist/functions/public/getName.js +0 -122
- package/dist/functions/public/getName.js.map +0 -1
- package/dist/functions/public/getOwner.d.ts +0 -73
- package/dist/functions/public/getOwner.js +0 -156
- package/dist/functions/public/getOwner.js.map +0 -1
- package/dist/functions/public/getPrice.d.ts +0 -40
- package/dist/functions/public/getPrice.js +0 -105
- package/dist/functions/public/getPrice.js.map +0 -1
- package/dist/functions/public/getRecords.d.ts +0 -107
- package/dist/functions/public/getRecords.js +0 -252
- package/dist/functions/public/getRecords.js.map +0 -1
- package/dist/functions/public/getResolver.d.ts +0 -33
- package/dist/functions/public/getResolver.js +0 -61
- package/dist/functions/public/getResolver.js.map +0 -1
- package/dist/functions/public/getSupportedInterfaces.d.ts +0 -47
- package/dist/functions/public/getSupportedInterfaces.js +0 -53
- package/dist/functions/public/getSupportedInterfaces.js.map +0 -1
- package/dist/functions/public/getTextRecord.d.ts +0 -34
- package/dist/functions/public/getTextRecord.js +0 -42
- package/dist/functions/public/getTextRecord.js.map +0 -1
- package/dist/functions/public/getWrapperData.d.ts +0 -42
- package/dist/functions/public/getWrapperData.js +0 -77
- package/dist/functions/public/getWrapperData.js.map +0 -1
- package/dist/functions/public/getWrapperName.d.ts +0 -33
- package/dist/functions/public/getWrapperName.js +0 -61
- package/dist/functions/public/getWrapperName.js.map +0 -1
- package/dist/functions/public/multicallWrapper.d.ts +0 -13
- package/dist/functions/public/multicallWrapper.js +0 -55
- package/dist/functions/public/multicallWrapper.js.map +0 -1
- package/dist/functions/public/universalWrapper.d.ts +0 -15
- package/dist/functions/public/universalWrapper.js +0 -79
- package/dist/functions/public/universalWrapper.js.map +0 -1
- package/dist/functions/subgraph/client.d.ts +0 -8
- package/dist/functions/subgraph/client.js +0 -88
- package/dist/functions/subgraph/client.js.map +0 -1
- package/dist/functions/subgraph/events.d.ts +0 -139
- package/dist/functions/subgraph/events.js.map +0 -1
- package/dist/functions/subgraph/filters.d.ts +0 -701
- package/dist/functions/subgraph/filters.js +0 -108
- package/dist/functions/subgraph/filters.js.map +0 -1
- package/dist/functions/subgraph/fragments.d.ts +0 -40
- package/dist/functions/subgraph/fragments.js.map +0 -1
- package/dist/functions/subgraph/getDecodedName.d.ts +0 -29
- package/dist/functions/subgraph/getDecodedName.js +0 -84
- package/dist/functions/subgraph/getDecodedName.js.map +0 -1
- package/dist/functions/subgraph/getNameHistory.d.ts +0 -53
- package/dist/functions/subgraph/getNameHistory.js +0 -248
- package/dist/functions/subgraph/getNameHistory.js.map +0 -1
- package/dist/functions/subgraph/getNamesForAddress.d.ts +0 -64
- package/dist/functions/subgraph/getNamesForAddress.js +0 -214
- package/dist/functions/subgraph/getNamesForAddress.js.map +0 -1
- package/dist/functions/subgraph/getSubgraphRecords.d.ts +0 -45
- package/dist/functions/subgraph/getSubgraphRecords.js +0 -103
- package/dist/functions/subgraph/getSubgraphRecords.js.map +0 -1
- package/dist/functions/subgraph/getSubgraphRegistrant.d.ts +0 -28
- package/dist/functions/subgraph/getSubgraphRegistrant.js +0 -52
- package/dist/functions/subgraph/getSubgraphRegistrant.js.map +0 -1
- package/dist/functions/subgraph/getSubnames.d.ts +0 -42
- package/dist/functions/subgraph/getSubnames.js +0 -159
- package/dist/functions/subgraph/getSubnames.js.map +0 -1
- package/dist/functions/subgraph/types.d.ts +0 -12
- package/dist/functions/subgraph/types.js.map +0 -1
- package/dist/functions/subgraph/utils.d.ts +0 -38
- package/dist/functions/subgraph/utils.js +0 -53
- package/dist/functions/subgraph/utils.js.map +0 -1
- package/dist/functions/wallet/clearRecords.d.ts +0 -40
- package/dist/functions/wallet/clearRecords.js +0 -45
- package/dist/functions/wallet/clearRecords.js.map +0 -1
- package/dist/functions/wallet/commitName.d.ts +0 -40
- package/dist/functions/wallet/commitName.js +0 -76
- package/dist/functions/wallet/commitName.js.map +0 -1
- package/dist/functions/wallet/createSubname.d.ts +0 -61
- package/dist/functions/wallet/createSubname.js +0 -148
- package/dist/functions/wallet/createSubname.js.map +0 -1
- package/dist/functions/wallet/deleteSubname.d.ts +0 -42
- package/dist/functions/wallet/deleteSubname.js +0 -125
- package/dist/functions/wallet/deleteSubname.js.map +0 -1
- package/dist/functions/wallet/legacyCommitName.d.ts +0 -40
- package/dist/functions/wallet/legacyCommitName.js +0 -72
- package/dist/functions/wallet/legacyCommitName.js.map +0 -1
- package/dist/functions/wallet/legacyRegisterName.d.ts +0 -59
- package/dist/functions/wallet/legacyRegisterName.js +0 -93
- package/dist/functions/wallet/legacyRegisterName.js.map +0 -1
- package/dist/functions/wallet/registerName.d.ts +0 -59
- package/dist/functions/wallet/registerName.js +0 -92
- package/dist/functions/wallet/registerName.js.map +0 -1
- package/dist/functions/wallet/renewNames.d.ts +0 -58
- package/dist/functions/wallet/renewNames.js +0 -94
- package/dist/functions/wallet/renewNames.js.map +0 -1
- package/dist/functions/wallet/setAbiRecord.d.ts +0 -48
- package/dist/functions/wallet/setAbiRecord.js +0 -54
- package/dist/functions/wallet/setAbiRecord.js.map +0 -1
- package/dist/functions/wallet/setAddressRecord.d.ts +0 -46
- package/dist/functions/wallet/setAddressRecord.js +0 -49
- package/dist/functions/wallet/setAddressRecord.js.map +0 -1
- package/dist/functions/wallet/setChildFuses.d.ts +0 -47
- package/dist/functions/wallet/setChildFuses.js +0 -57
- package/dist/functions/wallet/setChildFuses.js.map +0 -1
- package/dist/functions/wallet/setContentHashRecord.d.ts +0 -43
- package/dist/functions/wallet/setContentHashRecord.js +0 -47
- package/dist/functions/wallet/setContentHashRecord.js.map +0 -1
- package/dist/functions/wallet/setFuses.d.ts +0 -43
- package/dist/functions/wallet/setFuses.js +0 -52
- package/dist/functions/wallet/setFuses.js.map +0 -1
- package/dist/functions/wallet/setPrimaryName.d.ts +0 -50
- package/dist/functions/wallet/setPrimaryName.js +0 -76
- package/dist/functions/wallet/setPrimaryName.js.map +0 -1
- package/dist/functions/wallet/setRecords.d.ts +0 -48
- package/dist/functions/wallet/setRecords.js +0 -75
- package/dist/functions/wallet/setRecords.js.map +0 -1
- package/dist/functions/wallet/setResolver.d.ts +0 -43
- package/dist/functions/wallet/setResolver.js +0 -67
- package/dist/functions/wallet/setResolver.js.map +0 -1
- package/dist/functions/wallet/setTextRecord.d.ts +0 -46
- package/dist/functions/wallet/setTextRecord.js +0 -49
- package/dist/functions/wallet/setTextRecord.js.map +0 -1
- package/dist/functions/wallet/transferName.d.ts +0 -57
- package/dist/functions/wallet/transferName.js +0 -159
- package/dist/functions/wallet/transferName.js.map +0 -1
- package/dist/functions/wallet/unwrapName.d.ts +0 -52
- package/dist/functions/wallet/unwrapName.js +0 -82
- package/dist/functions/wallet/unwrapName.js.map +0 -1
- package/dist/functions/wallet/wrapName.d.ts +0 -45
- package/dist/functions/wallet/wrapName.js +0 -97
- package/dist/functions/wallet/wrapName.js.map +0 -1
- package/dist/public.d.ts +0 -20
- package/dist/public.js +0 -21
- package/dist/public.js.map +0 -1
- package/dist/types.d.ts +0 -66
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
- package/dist/utils/checkSafeUniversalResolverData.d.ts +0 -13
- package/dist/utils/checkSafeUniversalResolverData.js +0 -39
- package/dist/utils/checkSafeUniversalResolverData.js.map +0 -1
- package/dist/utils/encoders/encodeAbi.d.ts +0 -28
- package/dist/utils/encoders/encodeAbi.js +0 -64
- package/dist/utils/encoders/encodeAbi.js.map +0 -1
- package/dist/utils/encoders/encodeClearRecords.d.ts +0 -2
- package/dist/utils/encoders/encodeClearRecords.js +0 -8
- package/dist/utils/encoders/encodeClearRecords.js.map +0 -1
- package/dist/utils/encoders/encodeSetAbi.d.ts +0 -7
- package/dist/utils/encoders/encodeSetAbi.js +0 -10
- package/dist/utils/encoders/encodeSetAbi.js.map +0 -1
- package/dist/utils/encoders/encodeSetAddr.d.ts +0 -8
- package/dist/utils/encoders/encodeSetAddr.js +0 -19
- package/dist/utils/encoders/encodeSetAddr.js.map +0 -1
- package/dist/utils/encoders/encodeSetContentHash.d.ts +0 -7
- package/dist/utils/encoders/encodeSetContentHash.js +0 -15
- package/dist/utils/encoders/encodeSetContentHash.js.map +0 -1
- package/dist/utils/encoders/encodeSetText.d.ts +0 -8
- package/dist/utils/encoders/encodeSetText.js +0 -10
- package/dist/utils/encoders/encodeSetText.js.map +0 -1
- package/dist/utils/generateFunction.d.ts +0 -22
- package/dist/utils/generateFunction.js +0 -26
- package/dist/utils/generateFunction.js.map +0 -1
- package/dist/utils/generateRecordCallArray.d.ts +0 -20
- package/dist/utils/generateRecordCallArray.js +0 -36
- package/dist/utils/generateRecordCallArray.js.map +0 -1
- package/dist/utils/getNameType.d.ts +0 -2
- package/dist/utils/getNameType.js.map +0 -1
- package/dist/utils/getRevertErrorData.d.ts +0 -1
- package/dist/utils/getRevertErrorData.js +0 -11
- package/dist/utils/getRevertErrorData.js.map +0 -1
- package/dist/utils/hexEncodedName.d.ts +0 -3
- package/dist/utils/hexEncodedName.js +0 -43
- package/dist/utils/hexEncodedName.js.map +0 -1
- package/dist/utils/labels.d.ts +0 -9
- package/dist/utils/labels.js +0 -76
- package/dist/utils/labels.js.map +0 -1
- package/dist/utils/legacyRegisterHelpers.d.ts +0 -48
- package/dist/utils/legacyRegisterHelpers.js +0 -45
- package/dist/utils/legacyRegisterHelpers.js.map +0 -1
- package/dist/utils/makeLabelNodeAndParent.d.ts +0 -5
- package/dist/utils/makeLabelNodeAndParent.js +0 -13
- package/dist/utils/makeLabelNodeAndParent.js.map +0 -1
- package/dist/utils/makeSafeSecondsDate.d.ts +0 -1
- package/dist/utils/makeSafeSecondsDate.js +0 -8
- package/dist/utils/makeSafeSecondsDate.js.map +0 -1
- package/dist/utils/normalise.d.ts +0 -11
- package/dist/utils/normalise.js +0 -33
- package/dist/utils/normalise.js.map +0 -1
- package/dist/utils/normaliseCoinId.d.ts +0 -9
- package/dist/utils/normaliseCoinId.js +0 -30
- package/dist/utils/normaliseCoinId.js.map +0 -1
- package/dist/utils/validation.d.ts +0 -13
- package/dist/utils/validation.js +0 -60
- package/dist/utils/validation.js.map +0 -1
- package/dist/wallet.d.ts +0 -20
- package/dist/wallet.js +0 -21
- package/dist/wallet.js.map +0 -1
- package/src/clients/decorators/public.ts +0 -420
- package/src/clients/decorators/subgraph.ts +0 -195
- package/src/clients/decorators/wallet.ts +0 -746
- package/src/clients/public.ts +0 -84
- package/src/clients/subgraph.ts +0 -75
- package/src/clients/wallet.ts +0 -96
- package/src/contracts/consts.ts +0 -236
- package/src/contracts/legacyEthRegistrarController.ts +0 -194
- package/src/errors/register.ts +0 -22
- package/src/functions/dns/getDnsImportData.ts +0 -102
- package/src/functions/dns/getDnsOffchainData.ts +0 -152
- package/src/functions/dns/getDnsOwner.ts +0 -89
- package/src/functions/dns/importDnsName.ts +0 -171
- package/src/functions/public/_getAbi.ts +0 -126
- package/src/functions/public/_getAddr.ts +0 -121
- package/src/functions/public/_getContentHash.ts +0 -60
- package/src/functions/public/_getText.ts +0 -59
- package/src/functions/public/batch.ts +0 -101
- package/src/functions/public/getAbiRecord.ts +0 -87
- package/src/functions/public/getAddressRecord.ts +0 -88
- package/src/functions/public/getAvailable.ts +0 -92
- package/src/functions/public/getContentHashRecord.ts +0 -84
- package/src/functions/public/getExpiry.ts +0 -200
- package/src/functions/public/getName.ts +0 -197
- package/src/functions/public/getOwner.ts +0 -277
- package/src/functions/public/getPrice.ts +0 -148
- package/src/functions/public/getRecords.ts +0 -505
- package/src/functions/public/getResolver.ts +0 -101
- package/src/functions/public/getSupportedInterfaces.ts +0 -114
- package/src/functions/public/getTextRecord.ts +0 -83
- package/src/functions/public/getWrapperData.ts +0 -129
- package/src/functions/public/getWrapperName.ts +0 -98
- package/src/functions/public/multicallWrapper.ts +0 -88
- package/src/functions/public/universalWrapper.ts +0 -122
- package/src/functions/subgraph/client.ts +0 -103
- package/src/functions/subgraph/filters.ts +0 -848
- package/src/functions/subgraph/getDecodedName.ts +0 -121
- package/src/functions/subgraph/getNameHistory.ts +0 -328
- package/src/functions/subgraph/getNamesForAddress.ts +0 -347
- package/src/functions/subgraph/getSubgraphRecords.ts +0 -183
- package/src/functions/subgraph/getSubgraphRegistrant.ts +0 -76
- package/src/functions/subgraph/getSubnames.ts +0 -236
- package/src/functions/subgraph/utils.ts +0 -92
- package/src/functions/wallet/clearRecords.ts +0 -98
- package/src/functions/wallet/commitName.ts +0 -132
- package/src/functions/wallet/createSubname.ts +0 -276
- package/src/functions/wallet/deleteSubname.ts +0 -192
- package/src/functions/wallet/legacyCommitName.ts +0 -127
- package/src/functions/wallet/legacyRegisterName.ts +0 -159
- package/src/functions/wallet/registerName.ts +0 -156
- package/src/functions/wallet/renewNames.ts +0 -153
- package/src/functions/wallet/setAbiRecord.ts +0 -114
- package/src/functions/wallet/setAddressRecord.ts +0 -108
- package/src/functions/wallet/setChildFuses.ts +0 -113
- package/src/functions/wallet/setContentHashRecord.ts +0 -103
- package/src/functions/wallet/setFuses.ts +0 -107
- package/src/functions/wallet/setPrimaryName.ts +0 -156
- package/src/functions/wallet/setRecords.ts +0 -135
- package/src/functions/wallet/setResolver.ts +0 -127
- package/src/functions/wallet/setTextRecord.ts +0 -108
- package/src/functions/wallet/transferName.ts +0 -264
- package/src/functions/wallet/unwrapName.ts +0 -173
- package/src/functions/wallet/wrapName.ts +0 -189
- package/src/public.ts +0 -100
- package/src/types.ts +0 -131
- package/src/utils/checkSafeUniversalResolverData.ts +0 -62
- package/src/utils/encoders/encodeAbi.ts +0 -104
- package/src/utils/encoders/encodeClearRecords.ts +0 -9
- package/src/utils/encoders/encodeSetAbi.ts +0 -21
- package/src/utils/encoders/encodeSetAddr.ts +0 -32
- package/src/utils/encoders/encodeSetContentHash.ts +0 -25
- package/src/utils/encoders/encodeSetText.ts +0 -22
- package/src/utils/generateFunction.ts +0 -83
- package/src/utils/generateRecordCallArray.ts +0 -74
- package/src/utils/getNameType.ts +0 -18
- package/src/utils/getRevertErrorData.ts +0 -9
- package/src/utils/hexEncodedName.ts +0 -49
- package/src/utils/labels.ts +0 -96
- package/src/utils/legacyRegisterHelpers.ts +0 -147
- package/src/utils/makeLabelNodeAndParent.ts +0 -13
- package/src/utils/makeSafeSecondsDate.ts +0 -7
- package/src/utils/normalise.ts +0 -75
- package/src/utils/normaliseCoinId.ts +0 -36
- package/src/utils/validation.ts +0 -79
- package/src/wallet.ts +0 -140
- /package/dist/{functions → actions}/dns/types.js +0 -0
- /package/dist/{functions → actions}/subgraph/events.js +0 -0
- /package/dist/{functions → actions}/subgraph/fragments.js +0 -0
- /package/dist/{functions → actions}/subgraph/types.js +0 -0
- /package/dist/utils/{getNameType.js → name/getNameType.js} +0 -0
- /package/src/{functions → actions}/dns/types.ts +0 -0
- /package/src/{functions → actions}/subgraph/events.ts +0 -0
- /package/src/{functions → actions}/subgraph/fragments.ts +0 -0
- /package/src/{functions → actions}/subgraph/types.ts +0 -0
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type Abi,
|
|
3
|
+
type Address,
|
|
4
|
+
type Chain,
|
|
5
|
+
type EncodeFunctionDataErrorType,
|
|
6
|
+
encodeFunctionData,
|
|
7
|
+
type Hex,
|
|
8
|
+
type MulticallErrorType,
|
|
9
|
+
zeroAddress,
|
|
10
|
+
} from 'viem'
|
|
11
|
+
import { multicall } from 'viem/actions'
|
|
12
|
+
import { getAction } from 'viem/utils'
|
|
13
|
+
import type { RequireClientContracts } from '../../clients/chain.js'
|
|
14
|
+
import type { ErrorType } from '../../errors/utils.js'
|
|
15
|
+
import type { DecodedAddr, DecodedText, Prettify } from '../../types/index.js'
|
|
16
|
+
import { ASSERT_NO_TYPE_ERROR } from '../../types/internal.js'
|
|
17
|
+
import {
|
|
18
|
+
type DecodeAbiResultErrorType,
|
|
19
|
+
type DecodeAbiResultFromPrimitiveTypesErrorType,
|
|
20
|
+
type DecodeAbiResultReturnType,
|
|
21
|
+
decodeAbiResult,
|
|
22
|
+
decodeAbiResultFromPrimitiveTypes,
|
|
23
|
+
type GetAbiParametersErrorType,
|
|
24
|
+
getAbiParameters,
|
|
25
|
+
} from '../../utils/coders/getAbi.js'
|
|
26
|
+
import {
|
|
27
|
+
type DecodeAddressResultErrorType,
|
|
28
|
+
type DecodeAddressResultFromPrimitiveTypesErrorType,
|
|
29
|
+
decodeAddressResult,
|
|
30
|
+
decodeAddressResultFromPrimitiveTypes,
|
|
31
|
+
type GetAddressParametersErrorType,
|
|
32
|
+
getAddressParameters,
|
|
33
|
+
} from '../../utils/coders/getAddress.js'
|
|
34
|
+
import {
|
|
35
|
+
type DecodeContentHashResultErrorType,
|
|
36
|
+
type DecodeContentHashResultFromPrimitiveTypesErrorType,
|
|
37
|
+
decodeContentHashResult,
|
|
38
|
+
decodeContentHashResultFromPrimitiveTypes,
|
|
39
|
+
type GetContentHashErrorType,
|
|
40
|
+
type GetContentHashReturnType,
|
|
41
|
+
getContentHashParameters,
|
|
42
|
+
} from '../../utils/coders/getContentHash.js'
|
|
43
|
+
import {
|
|
44
|
+
type DecodeTextResultErrorType,
|
|
45
|
+
type DecodeTextResultFromPrimitiveTypesErrorType,
|
|
46
|
+
decodeTextResult,
|
|
47
|
+
decodeTextResultFromPrimitiveTypes,
|
|
48
|
+
type GetTextParametersErrorType,
|
|
49
|
+
getTextParameters,
|
|
50
|
+
} from '../../utils/coders/getText.js'
|
|
51
|
+
import {
|
|
52
|
+
type ResolveNameDataErrorType,
|
|
53
|
+
resolveNameData,
|
|
54
|
+
} from './resolveNameData.js'
|
|
55
|
+
|
|
56
|
+
export type GetRecordsParameters<
|
|
57
|
+
texts extends readonly string[] | undefined = readonly string[],
|
|
58
|
+
coins extends readonly (string | number)[] | undefined = readonly (
|
|
59
|
+
| string
|
|
60
|
+
| number
|
|
61
|
+
)[],
|
|
62
|
+
contentHash extends boolean | undefined = true,
|
|
63
|
+
abi extends boolean | undefined = true,
|
|
64
|
+
> = {
|
|
65
|
+
/** Name to get records for */
|
|
66
|
+
name: string
|
|
67
|
+
/** Text record key array */
|
|
68
|
+
texts?: texts
|
|
69
|
+
/** Coin record id/symbol array */
|
|
70
|
+
coins?: coins
|
|
71
|
+
/** If true, will fetch content hash */
|
|
72
|
+
contentHash?: contentHash
|
|
73
|
+
/** If true, will fetch ABI */
|
|
74
|
+
abi?: abi
|
|
75
|
+
/** Optional specific resolver address, for fallback or for all results */
|
|
76
|
+
resolver?: {
|
|
77
|
+
/** Resolver address */
|
|
78
|
+
address: Address
|
|
79
|
+
/** If true, will only use resolver if main fetch fails */
|
|
80
|
+
fallbackOnly?: boolean
|
|
81
|
+
}
|
|
82
|
+
/** Batch gateway URLs to use for resolving CCIP-read requests. */
|
|
83
|
+
gatewayUrls?: string[]
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
type WithContentHashResult = {
|
|
87
|
+
/** Retrieved content hash record for name */
|
|
88
|
+
contentHash: GetContentHashReturnType
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
type WithAbiResult = {
|
|
92
|
+
/** Retrieved ABI record for name */
|
|
93
|
+
abi: DecodeAbiResultReturnType
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
type WithTextsResult = {
|
|
97
|
+
/** Retrieved text records for name */
|
|
98
|
+
texts: DecodedText[]
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
type WithCoinsResult = {
|
|
102
|
+
/** Retrieved coins for name */
|
|
103
|
+
coins: DecodedAddr[]
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
type CreateCallsErrorType =
|
|
107
|
+
| GetTextParametersErrorType
|
|
108
|
+
| DecodeTextResultFromPrimitiveTypesErrorType
|
|
109
|
+
| DecodeTextResultErrorType
|
|
110
|
+
| GetAddressParametersErrorType
|
|
111
|
+
| DecodeAddressResultFromPrimitiveTypesErrorType
|
|
112
|
+
| DecodeAddressResultErrorType
|
|
113
|
+
| GetContentHashErrorType
|
|
114
|
+
| DecodeContentHashResultFromPrimitiveTypesErrorType
|
|
115
|
+
| DecodeContentHashResultErrorType
|
|
116
|
+
| GetAbiParametersErrorType
|
|
117
|
+
| DecodeAbiResultFromPrimitiveTypesErrorType
|
|
118
|
+
| DecodeAbiResultErrorType
|
|
119
|
+
|
|
120
|
+
const createCalls = <
|
|
121
|
+
const texts extends readonly string[] | undefined = undefined,
|
|
122
|
+
const coins extends readonly (string | number)[] | undefined = undefined,
|
|
123
|
+
const contentHash extends boolean | undefined = undefined,
|
|
124
|
+
const abi extends boolean | undefined = undefined,
|
|
125
|
+
>({
|
|
126
|
+
name,
|
|
127
|
+
texts,
|
|
128
|
+
coins,
|
|
129
|
+
abi,
|
|
130
|
+
contentHash,
|
|
131
|
+
}: Pick<
|
|
132
|
+
GetRecordsParameters<texts, coins, contentHash, abi>,
|
|
133
|
+
'name' | 'texts' | 'coins' | 'abi' | 'contentHash'
|
|
134
|
+
>) => [
|
|
135
|
+
...(texts ?? []).map(
|
|
136
|
+
(text) =>
|
|
137
|
+
({
|
|
138
|
+
parameters: getTextParameters({ name, key: text }),
|
|
139
|
+
addToResult: <shouldDecodeFromPrimitiveTypes extends boolean>({
|
|
140
|
+
currentResult,
|
|
141
|
+
data,
|
|
142
|
+
shouldDecodeFromPrimitiveTypes,
|
|
143
|
+
}: {
|
|
144
|
+
currentResult: GetRecordsReturnType
|
|
145
|
+
shouldDecodeFromPrimitiveTypes: shouldDecodeFromPrimitiveTypes
|
|
146
|
+
data: shouldDecodeFromPrimitiveTypes extends true ? string : Hex
|
|
147
|
+
}) => {
|
|
148
|
+
const result = shouldDecodeFromPrimitiveTypes
|
|
149
|
+
? decodeTextResultFromPrimitiveTypes({ decodedData: data })
|
|
150
|
+
: decodeTextResult(data as Hex, { strict: false })
|
|
151
|
+
if (!result) return
|
|
152
|
+
|
|
153
|
+
currentResult.texts.push({ key: text, value: result })
|
|
154
|
+
},
|
|
155
|
+
}) as const,
|
|
156
|
+
),
|
|
157
|
+
...(coins ?? []).map(
|
|
158
|
+
(coin) =>
|
|
159
|
+
({
|
|
160
|
+
parameters: getAddressParameters({ name, coin }),
|
|
161
|
+
addToResult: <shouldDecodeFromPrimitiveTypes extends boolean>({
|
|
162
|
+
currentResult,
|
|
163
|
+
data,
|
|
164
|
+
shouldDecodeFromPrimitiveTypes,
|
|
165
|
+
}: {
|
|
166
|
+
currentResult: GetRecordsReturnType
|
|
167
|
+
shouldDecodeFromPrimitiveTypes: shouldDecodeFromPrimitiveTypes
|
|
168
|
+
data: Hex
|
|
169
|
+
}) => {
|
|
170
|
+
try {
|
|
171
|
+
const result = shouldDecodeFromPrimitiveTypes
|
|
172
|
+
? decodeAddressResultFromPrimitiveTypes({
|
|
173
|
+
decodedData: data,
|
|
174
|
+
coin,
|
|
175
|
+
})
|
|
176
|
+
: decodeAddressResult(data, { coin, strict: false })
|
|
177
|
+
|
|
178
|
+
if (!result) return
|
|
179
|
+
|
|
180
|
+
currentResult.coins.push(result)
|
|
181
|
+
} catch (e) {
|
|
182
|
+
console.error(e)
|
|
183
|
+
// Don't panic if coming across an unknown coinType
|
|
184
|
+
return
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
}) as const,
|
|
188
|
+
),
|
|
189
|
+
...(contentHash
|
|
190
|
+
? ([
|
|
191
|
+
{
|
|
192
|
+
parameters: getContentHashParameters({ name }),
|
|
193
|
+
addToResult: <shouldDecodeFromPrimitiveTypes extends boolean>({
|
|
194
|
+
currentResult,
|
|
195
|
+
data,
|
|
196
|
+
shouldDecodeFromPrimitiveTypes,
|
|
197
|
+
}: {
|
|
198
|
+
currentResult: GetRecordsReturnType
|
|
199
|
+
shouldDecodeFromPrimitiveTypes: shouldDecodeFromPrimitiveTypes
|
|
200
|
+
data: Hex
|
|
201
|
+
}) => {
|
|
202
|
+
const result = shouldDecodeFromPrimitiveTypes
|
|
203
|
+
? decodeContentHashResultFromPrimitiveTypes({ decodedData: data })
|
|
204
|
+
: decodeContentHashResult(data, { strict: false })
|
|
205
|
+
if (!result) return
|
|
206
|
+
|
|
207
|
+
currentResult.contentHash = result
|
|
208
|
+
},
|
|
209
|
+
},
|
|
210
|
+
] as const)
|
|
211
|
+
: []),
|
|
212
|
+
...(abi
|
|
213
|
+
? ([
|
|
214
|
+
{
|
|
215
|
+
parameters: getAbiParameters({ name }),
|
|
216
|
+
addToResult: async <shouldDecodeFromPrimitiveTypes extends boolean>({
|
|
217
|
+
currentResult,
|
|
218
|
+
data,
|
|
219
|
+
shouldDecodeFromPrimitiveTypes,
|
|
220
|
+
}: {
|
|
221
|
+
currentResult: GetRecordsReturnType
|
|
222
|
+
shouldDecodeFromPrimitiveTypes: shouldDecodeFromPrimitiveTypes
|
|
223
|
+
data: shouldDecodeFromPrimitiveTypes extends true
|
|
224
|
+
? readonly [bigint, Hex]
|
|
225
|
+
: Hex
|
|
226
|
+
}) => {
|
|
227
|
+
const result = shouldDecodeFromPrimitiveTypes
|
|
228
|
+
? await decodeAbiResultFromPrimitiveTypes({
|
|
229
|
+
decodedData: data as readonly [bigint, Hex],
|
|
230
|
+
})
|
|
231
|
+
: await decodeAbiResult(data as Hex, { strict: false })
|
|
232
|
+
if (!result) return
|
|
233
|
+
|
|
234
|
+
currentResult.abi = result
|
|
235
|
+
},
|
|
236
|
+
},
|
|
237
|
+
] as const)
|
|
238
|
+
: []),
|
|
239
|
+
]
|
|
240
|
+
|
|
241
|
+
const createEmptyResult = <
|
|
242
|
+
texts extends readonly string[] | undefined,
|
|
243
|
+
coins extends readonly (string | number)[] | undefined,
|
|
244
|
+
contentHash extends boolean | undefined,
|
|
245
|
+
abi extends boolean | undefined,
|
|
246
|
+
>({
|
|
247
|
+
texts,
|
|
248
|
+
coins,
|
|
249
|
+
abi,
|
|
250
|
+
contentHash,
|
|
251
|
+
}: Pick<
|
|
252
|
+
GetRecordsParameters<texts, coins, contentHash, abi>,
|
|
253
|
+
'texts' | 'coins' | 'abi' | 'contentHash'
|
|
254
|
+
>) =>
|
|
255
|
+
({
|
|
256
|
+
...(texts ? { texts: [] as DecodedText[] } : {}),
|
|
257
|
+
...(coins ? { coins: [] as DecodedAddr[] } : {}),
|
|
258
|
+
...(contentHash ? { contentHash: null } : {}),
|
|
259
|
+
...(abi ? { abi: null } : {}),
|
|
260
|
+
resolverAddress: zeroAddress as Address,
|
|
261
|
+
}) as GetRecordsReturnType
|
|
262
|
+
|
|
263
|
+
export type GetRecordsReturnType<
|
|
264
|
+
texts extends readonly string[] | undefined = readonly string[],
|
|
265
|
+
coins extends readonly (string | number)[] | undefined = readonly (
|
|
266
|
+
| string
|
|
267
|
+
| number
|
|
268
|
+
)[],
|
|
269
|
+
contentHash extends boolean | undefined = true,
|
|
270
|
+
abi extends boolean | undefined = true,
|
|
271
|
+
> = Prettify<
|
|
272
|
+
(contentHash extends true ? WithContentHashResult : {}) &
|
|
273
|
+
(abi extends true ? WithAbiResult : {}) &
|
|
274
|
+
(texts extends readonly string[] ? WithTextsResult : {}) &
|
|
275
|
+
(coins extends readonly (string | number)[] ? WithCoinsResult : {}) & {
|
|
276
|
+
/** Resolver address used for fetch */
|
|
277
|
+
resolverAddress: Address
|
|
278
|
+
}
|
|
279
|
+
>
|
|
280
|
+
|
|
281
|
+
export type GetRecordsErrorType =
|
|
282
|
+
| CreateCallsErrorType
|
|
283
|
+
| MulticallErrorType
|
|
284
|
+
| ResolveNameDataErrorType
|
|
285
|
+
| EncodeFunctionDataErrorType
|
|
286
|
+
| ErrorType
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* Gets arbitrary records for a name
|
|
290
|
+
* @param client - {@link Client}
|
|
291
|
+
* @param parameters - {@link GetRecordsParameters}
|
|
292
|
+
* @returns Records data object. {@link GetRecordsReturnType}
|
|
293
|
+
*
|
|
294
|
+
* @example
|
|
295
|
+
* import { createPublicClient, http } from 'viem'
|
|
296
|
+
* import { mainnet } from 'viem/chains'
|
|
297
|
+
* import { addEnsContracts } from '@ensdomains/ensjs'
|
|
298
|
+
* import { getRecords } from '@ensdomains/ensjs/public'
|
|
299
|
+
*
|
|
300
|
+
* const client = createPublicClient({
|
|
301
|
+
* chain: addEnsContracts(mainnet),
|
|
302
|
+
* transport: http(),
|
|
303
|
+
* })
|
|
304
|
+
* const result = await getRecords(client, {
|
|
305
|
+
* name: 'ens.eth',
|
|
306
|
+
* texts: ['com.twitter', 'com.github'],
|
|
307
|
+
* coins: ['ETH'],
|
|
308
|
+
* contentHash: true,
|
|
309
|
+
* })
|
|
310
|
+
* // { texts: [{ key: 'com.twitter', value: 'ensdomains' }, { key: 'com.github', value: 'ensdomains' }], coins: [{ id: 60, name: 'ETH', value: '0xFe89cc7aBB2C4183683ab71653C4cdc9B02D44b7' }], contentHash: { protocolType: 'ipns', decoded: 'k51qzi5uqu5djdczd6zw0grmo23j2vkj9uzvujencg15s5rlkq0ss4ivll8wqw' } }
|
|
311
|
+
*/
|
|
312
|
+
export async function getRecords<
|
|
313
|
+
chain extends Chain,
|
|
314
|
+
const texts extends readonly string[] | undefined = undefined,
|
|
315
|
+
const coins extends readonly (string | number)[] | undefined = undefined,
|
|
316
|
+
const contentHash extends boolean | undefined = undefined,
|
|
317
|
+
const abi extends boolean | undefined = undefined,
|
|
318
|
+
>(
|
|
319
|
+
client: RequireClientContracts<chain, 'ensUniversalResolver' | 'multicall3'>,
|
|
320
|
+
{
|
|
321
|
+
name,
|
|
322
|
+
resolver,
|
|
323
|
+
texts,
|
|
324
|
+
coins,
|
|
325
|
+
contentHash,
|
|
326
|
+
abi,
|
|
327
|
+
gatewayUrls,
|
|
328
|
+
}: GetRecordsParameters<texts, coins, contentHash, abi>,
|
|
329
|
+
): Promise<GetRecordsReturnType<texts, coins, contentHash, abi>> {
|
|
330
|
+
ASSERT_NO_TYPE_ERROR(client)
|
|
331
|
+
|
|
332
|
+
const calls = createCalls({
|
|
333
|
+
name,
|
|
334
|
+
texts,
|
|
335
|
+
coins,
|
|
336
|
+
contentHash,
|
|
337
|
+
abi,
|
|
338
|
+
})
|
|
339
|
+
const currentResult = createEmptyResult({ texts, coins, contentHash, abi })
|
|
340
|
+
|
|
341
|
+
if (resolver?.address && !resolver.fallbackOnly) {
|
|
342
|
+
const multicallAction = getAction(client, multicall, 'multicall')
|
|
343
|
+
const result = await multicallAction({
|
|
344
|
+
contracts: calls.map((c) => ({
|
|
345
|
+
address: resolver.address,
|
|
346
|
+
...c.parameters,
|
|
347
|
+
})),
|
|
348
|
+
})
|
|
349
|
+
currentResult.resolverAddress = resolver.address
|
|
350
|
+
await Promise.all(
|
|
351
|
+
result.map(async (item, i) => {
|
|
352
|
+
if (item.status !== 'success') return
|
|
353
|
+
|
|
354
|
+
const callItem = calls[i]
|
|
355
|
+
await callItem.addToResult({
|
|
356
|
+
currentResult,
|
|
357
|
+
data: item.result as never,
|
|
358
|
+
shouldDecodeFromPrimitiveTypes: true,
|
|
359
|
+
})
|
|
360
|
+
}),
|
|
361
|
+
)
|
|
362
|
+
} else {
|
|
363
|
+
const resolveNameDataAction = getAction(
|
|
364
|
+
client,
|
|
365
|
+
resolveNameData,
|
|
366
|
+
'resolveNameData',
|
|
367
|
+
)
|
|
368
|
+
const result = await resolveNameDataAction({
|
|
369
|
+
name,
|
|
370
|
+
data: calls.map((c) => encodeFunctionData<Abi>(c?.parameters)),
|
|
371
|
+
gatewayUrls,
|
|
372
|
+
})
|
|
373
|
+
if (!result)
|
|
374
|
+
return currentResult as GetRecordsReturnType<
|
|
375
|
+
texts,
|
|
376
|
+
coins,
|
|
377
|
+
contentHash,
|
|
378
|
+
abi
|
|
379
|
+
>
|
|
380
|
+
|
|
381
|
+
currentResult.resolverAddress = result.resolverAddress
|
|
382
|
+
|
|
383
|
+
await Promise.all(
|
|
384
|
+
result.resolvedData.map(async (item, i) => {
|
|
385
|
+
if (!item.success) return
|
|
386
|
+
|
|
387
|
+
const callItem = calls[i]
|
|
388
|
+
await callItem.addToResult({
|
|
389
|
+
currentResult,
|
|
390
|
+
data: item.returnData,
|
|
391
|
+
shouldDecodeFromPrimitiveTypes: false,
|
|
392
|
+
})
|
|
393
|
+
}),
|
|
394
|
+
)
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
return currentResult as GetRecordsReturnType<texts, coins, contentHash, abi>
|
|
398
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type Address,
|
|
3
|
+
type Chain,
|
|
4
|
+
type GetChainContractAddressErrorType,
|
|
5
|
+
type ReadContractErrorType,
|
|
6
|
+
type ToHexErrorType,
|
|
7
|
+
toHex,
|
|
8
|
+
zeroAddress,
|
|
9
|
+
} from 'viem'
|
|
10
|
+
import { readContract } from 'viem/actions'
|
|
11
|
+
import { type PacketToBytesErrorType, packetToBytes } from 'viem/ens'
|
|
12
|
+
import { getAction } from 'viem/utils'
|
|
13
|
+
import {
|
|
14
|
+
getChainContractAddress,
|
|
15
|
+
type RequireClientContracts,
|
|
16
|
+
} from '../../clients/chain.js'
|
|
17
|
+
import { universalResolverFindResolverSnippet } from '../../contracts/universalResolver.js'
|
|
18
|
+
import { ASSERT_NO_TYPE_ERROR } from '../../types/internal.js'
|
|
19
|
+
|
|
20
|
+
export type GetResolverParameters = {
|
|
21
|
+
/** Name to get resolver for */
|
|
22
|
+
name: string
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export type GetResolverReturnType = Address | null
|
|
26
|
+
|
|
27
|
+
export type GetResolverErrorType =
|
|
28
|
+
| ReadContractErrorType
|
|
29
|
+
| GetChainContractAddressErrorType
|
|
30
|
+
| ToHexErrorType
|
|
31
|
+
| PacketToBytesErrorType
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Gets the resolver address for a name.
|
|
35
|
+
* @param client - {@link Client}
|
|
36
|
+
* @param parameters - {@link GetResolverParameters}
|
|
37
|
+
* @returns Resolver address, or null if none is found. {@link GetResolverReturnType}
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* import { createPublicClient, http } from 'viem'
|
|
41
|
+
* import { mainnet } from 'viem/chains'
|
|
42
|
+
* import { addEnsContracts } from '@ensdomains/ensjs'
|
|
43
|
+
* import { getResolver } from '@ensdomains/ensjs/public'
|
|
44
|
+
*
|
|
45
|
+
* const client = createPublicClient({
|
|
46
|
+
* chain: addEnsContracts(mainnet),
|
|
47
|
+
* transport: http(),
|
|
48
|
+
* })
|
|
49
|
+
* const result = await getResolver(client, { name: 'ens.eth' })
|
|
50
|
+
* // 0x4976fb03C32e5B8cfe2b6cCB31c09Ba78EBaBa41
|
|
51
|
+
*/
|
|
52
|
+
export async function getResolver<chain extends Chain>(
|
|
53
|
+
client: RequireClientContracts<chain, 'ensUniversalResolver'>,
|
|
54
|
+
{ name }: GetResolverParameters,
|
|
55
|
+
): Promise<GetResolverReturnType> {
|
|
56
|
+
ASSERT_NO_TYPE_ERROR(client)
|
|
57
|
+
|
|
58
|
+
const readContractAction = getAction(client, readContract, 'readContract')
|
|
59
|
+
const result = await readContractAction({
|
|
60
|
+
address: getChainContractAddress({
|
|
61
|
+
chain: client.chain,
|
|
62
|
+
contract: 'ensUniversalResolver',
|
|
63
|
+
}),
|
|
64
|
+
abi: universalResolverFindResolverSnippet,
|
|
65
|
+
functionName: 'findResolver',
|
|
66
|
+
args: [toHex(packetToBytes(name))],
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
if (result[0] === zeroAddress) return null
|
|
70
|
+
return result[0]
|
|
71
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { Address, Chain, Hex, MulticallErrorType } from 'viem'
|
|
2
|
+
import { multicall } from 'viem/actions'
|
|
3
|
+
import { getAction } from 'viem/utils'
|
|
4
|
+
import type { RequireClientContracts } from '../../clients/chain.js'
|
|
5
|
+
import { erc165SupportsInterfaceSnippet } from '../../contracts/erc165.js'
|
|
6
|
+
import { ASSERT_NO_TYPE_ERROR } from '../../types/internal.js'
|
|
7
|
+
|
|
8
|
+
export type GetSupportedInterfacesParameters<
|
|
9
|
+
interfaces extends readonly Hex[],
|
|
10
|
+
> = {
|
|
11
|
+
address: Address
|
|
12
|
+
interfaces: interfaces
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type GetSupportedInterfacesReturnType<
|
|
16
|
+
interfaces extends readonly Hex[],
|
|
17
|
+
> = {
|
|
18
|
+
-readonly [K in keyof interfaces]: boolean
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type GetSupportedInterfacesErrorType = MulticallErrorType
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Gets the supported interfaces for any contract address.
|
|
25
|
+
* @param client - {@link Client}
|
|
26
|
+
* @param parameters - {@link GetSupportedInterfacesParameters}
|
|
27
|
+
* @returns Array of booleans matching the input array {@link GetSupportedInterfacesReturnType}
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* import { createPublicClient, http } from 'viem'
|
|
31
|
+
* import { mainnet } from 'viem/chains'
|
|
32
|
+
* import { addEnsContracts } from '@ensdomains/ensjs'
|
|
33
|
+
* import { getSupportedInterfaces } from '@ensdomains/ensjs/public'
|
|
34
|
+
*
|
|
35
|
+
* const client = createPublicClient({
|
|
36
|
+
* chain: addEnsContracts(mainnet),
|
|
37
|
+
* transport: http(),
|
|
38
|
+
* })
|
|
39
|
+
* const result = await getSupportedInterfaces(client, {
|
|
40
|
+
* address: '0x58774Bb8acD458A640aF0B88238369A167546ef2',
|
|
41
|
+
* interfaces: ['0x2f435428', '0x23b872dd'],
|
|
42
|
+
* })
|
|
43
|
+
* // [true, false]
|
|
44
|
+
*/
|
|
45
|
+
export async function getSupportedInterfaces<
|
|
46
|
+
chain extends Chain,
|
|
47
|
+
const interfaces extends readonly Hex[],
|
|
48
|
+
>(
|
|
49
|
+
client: RequireClientContracts<chain, 'multicall3'>,
|
|
50
|
+
{ address, interfaces }: GetSupportedInterfacesParameters<interfaces>,
|
|
51
|
+
): Promise<GetSupportedInterfacesReturnType<interfaces>> {
|
|
52
|
+
ASSERT_NO_TYPE_ERROR(client)
|
|
53
|
+
|
|
54
|
+
const multicallAction = getAction(client, multicall, 'multicall')
|
|
55
|
+
|
|
56
|
+
const result = await multicallAction({
|
|
57
|
+
contracts: interfaces.map((interfaceId) => ({
|
|
58
|
+
address,
|
|
59
|
+
abi: erc165SupportsInterfaceSnippet,
|
|
60
|
+
functionName: 'supportsInterface',
|
|
61
|
+
args: [interfaceId],
|
|
62
|
+
})),
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
return result.map(
|
|
66
|
+
(r) => r.status === 'success' && r.result === true,
|
|
67
|
+
) as GetSupportedInterfacesReturnType<interfaces>
|
|
68
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { Chain, EncodeFunctionDataErrorType } from 'viem'
|
|
2
|
+
import { encodeFunctionData, getAction } from 'viem/utils'
|
|
3
|
+
import type { RequireClientContracts } from '../../clients/chain.js'
|
|
4
|
+
import type { Prettify } from '../../types/index.js'
|
|
5
|
+
import { ASSERT_NO_TYPE_ERROR } from '../../types/internal.js'
|
|
6
|
+
import {
|
|
7
|
+
type DecodeTextResultErrorType,
|
|
8
|
+
type DecodeTextResultParameters,
|
|
9
|
+
type DecodeTextResultReturnType,
|
|
10
|
+
decodeTextResult,
|
|
11
|
+
type GetTextParametersErrorType,
|
|
12
|
+
type GetTextParametersParameters,
|
|
13
|
+
getTextParameters,
|
|
14
|
+
} from '../../utils/coders/getText.js'
|
|
15
|
+
import {
|
|
16
|
+
type ResolveNameDataErrorType,
|
|
17
|
+
resolveNameData,
|
|
18
|
+
} from './resolveNameData.js'
|
|
19
|
+
|
|
20
|
+
export type GetTextRecordParameters = Prettify<
|
|
21
|
+
GetTextParametersParameters &
|
|
22
|
+
DecodeTextResultParameters & {
|
|
23
|
+
/** Batch gateway URLs to use for resolving CCIP-read requests. */
|
|
24
|
+
gatewayUrls?: string[]
|
|
25
|
+
}
|
|
26
|
+
>
|
|
27
|
+
|
|
28
|
+
export type GetTextRecordReturnType = DecodeTextResultReturnType
|
|
29
|
+
|
|
30
|
+
export type GetTextRecordErrorType =
|
|
31
|
+
| ResolveNameDataErrorType
|
|
32
|
+
| EncodeFunctionDataErrorType
|
|
33
|
+
| GetTextParametersErrorType
|
|
34
|
+
| DecodeTextResultErrorType
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Gets a text record for a name.
|
|
38
|
+
* @param client - {@link Client}
|
|
39
|
+
* @param parameters - {@link GetTextRecordParameters}
|
|
40
|
+
* @returns Text record string, or null if none is found. {@link GetTextRecordReturnType}
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* import { createPublicClient, http } from 'viem'
|
|
44
|
+
* import { mainnet } from 'viem/chains'
|
|
45
|
+
* import { addEnsContracts } from '@ensdomains/ensjs'
|
|
46
|
+
* import { getTextRecord } from '@ensdomains/ensjs/public'
|
|
47
|
+
*
|
|
48
|
+
* const client = createPublicClient({
|
|
49
|
+
* chain: addEnsContracts(mainnet),
|
|
50
|
+
* transport: http(),
|
|
51
|
+
* })
|
|
52
|
+
* const result = await getTextRecord(client, { name: 'ens.eth', key: 'com.twitter' })
|
|
53
|
+
* // ensdomains
|
|
54
|
+
*/
|
|
55
|
+
export async function getTextRecord<chain extends Chain>(
|
|
56
|
+
client: RequireClientContracts<chain, 'ensUniversalResolver'>,
|
|
57
|
+
{ gatewayUrls, strict, ...parameters }: GetTextRecordParameters,
|
|
58
|
+
): Promise<GetTextRecordReturnType> {
|
|
59
|
+
ASSERT_NO_TYPE_ERROR(client)
|
|
60
|
+
|
|
61
|
+
const resolveNameDataAction = getAction(
|
|
62
|
+
client,
|
|
63
|
+
resolveNameData,
|
|
64
|
+
'resolveNameData',
|
|
65
|
+
)
|
|
66
|
+
const result = await resolveNameDataAction({
|
|
67
|
+
name: parameters.name,
|
|
68
|
+
data: encodeFunctionData(getTextParameters(parameters)),
|
|
69
|
+
gatewayUrls,
|
|
70
|
+
strict,
|
|
71
|
+
})
|
|
72
|
+
if (!result) return null
|
|
73
|
+
return decodeTextResult(result.resolvedData, { strict })
|
|
74
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type Address,
|
|
3
|
+
type Chain,
|
|
4
|
+
type GetChainContractAddressErrorType,
|
|
5
|
+
type NamehashErrorType,
|
|
6
|
+
namehash,
|
|
7
|
+
type ReadContractErrorType,
|
|
8
|
+
zeroAddress,
|
|
9
|
+
} from 'viem'
|
|
10
|
+
import { readContract } from 'viem/actions'
|
|
11
|
+
import { getAction } from 'viem/utils'
|
|
12
|
+
import {
|
|
13
|
+
getChainContractAddress,
|
|
14
|
+
type RequireClientContracts,
|
|
15
|
+
} from '../../clients/chain.js'
|
|
16
|
+
import { nameWrapperGetDataSnippet } from '../../contracts/nameWrapper.js'
|
|
17
|
+
import type { Prettify } from '../../types/index.js'
|
|
18
|
+
import { ASSERT_NO_TYPE_ERROR } from '../../types/internal.js'
|
|
19
|
+
import { type DecodedFuses, decodeFuses } from '../../utils/fuses.js'
|
|
20
|
+
|
|
21
|
+
export type GetWrapperDataParameters = {
|
|
22
|
+
/** Name to get wrapper data for */
|
|
23
|
+
name: string
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export type GetWrapperDataReturnType = Prettify<{
|
|
27
|
+
/** Fuse object */
|
|
28
|
+
fuses: DecodedFuses & {
|
|
29
|
+
value: number
|
|
30
|
+
}
|
|
31
|
+
/** Expiry of the name */
|
|
32
|
+
expiry: bigint | null
|
|
33
|
+
/** Owner of the name */
|
|
34
|
+
owner: Address
|
|
35
|
+
} | null>
|
|
36
|
+
|
|
37
|
+
export type GetWrapperDataErrorType =
|
|
38
|
+
| ReadContractErrorType
|
|
39
|
+
| GetChainContractAddressErrorType
|
|
40
|
+
| NamehashErrorType
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Gets the wrapper data for a name.
|
|
44
|
+
* @param client - {@link Client}
|
|
45
|
+
* @param parameters - {@link GetWrapperDataParameters}
|
|
46
|
+
* @returns Wrapper data object, or null if name is not wrapped. {@link GetWrapperDataReturnType}
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* import { createPublicClient, http } from 'viem'
|
|
50
|
+
* import { mainnet } from 'viem/chains'
|
|
51
|
+
* import { addEnsContracts } from '@ensdomains/ensjs'
|
|
52
|
+
* import { getWrapperData } from '@ensdomains/ensjs/public'
|
|
53
|
+
*
|
|
54
|
+
* const client = createPublicClient({
|
|
55
|
+
* chain: addEnsContracts(mainnet),
|
|
56
|
+
* transport: http(),
|
|
57
|
+
* })
|
|
58
|
+
* const result = await getWrapperData(client, { name: 'ilikelasagna.eth' })
|
|
59
|
+
*/
|
|
60
|
+
export async function getWrapperData<chain extends Chain>(
|
|
61
|
+
client: RequireClientContracts<chain, 'ensNameWrapper'>,
|
|
62
|
+
{ name }: GetWrapperDataParameters,
|
|
63
|
+
): Promise<GetWrapperDataReturnType> {
|
|
64
|
+
ASSERT_NO_TYPE_ERROR(client)
|
|
65
|
+
|
|
66
|
+
const readContractAction = getAction(client, readContract, 'readContract')
|
|
67
|
+
const [owner, fuses, expiry] = await readContractAction({
|
|
68
|
+
address: getChainContractAddress({
|
|
69
|
+
chain: client.chain,
|
|
70
|
+
contract: 'ensNameWrapper',
|
|
71
|
+
}),
|
|
72
|
+
abi: nameWrapperGetDataSnippet,
|
|
73
|
+
functionName: 'getData',
|
|
74
|
+
args: [BigInt(namehash(name))],
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
if (owner === zeroAddress) return null
|
|
78
|
+
|
|
79
|
+
const fuseObj = decodeFuses(fuses)
|
|
80
|
+
return {
|
|
81
|
+
fuses: {
|
|
82
|
+
...fuseObj,
|
|
83
|
+
value: fuses,
|
|
84
|
+
},
|
|
85
|
+
expiry: expiry > 0 ? expiry * 1000n : null,
|
|
86
|
+
owner,
|
|
87
|
+
}
|
|
88
|
+
}
|