@ensdomains/ensjs 3.0.0-beta.1 → 3.0.0-beta.11
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/contracts/OldestResolver.json +170 -0
- package/contracts/UniversalResolverv2.json +628 -0
- package/dist/cjs/clients/decorators/subgraph.js.map +1 -1
- package/dist/cjs/clients/decorators/wallet.js +2 -0
- package/dist/cjs/clients/decorators/wallet.js.map +1 -1
- package/dist/cjs/clients/public.js.map +1 -1
- package/dist/cjs/clients/subgraph.js.map +1 -1
- package/dist/cjs/contracts/consts.js +53 -2
- package/dist/cjs/contracts/consts.js.map +1 -1
- package/dist/cjs/contracts/universalResolver.js +46 -1
- package/dist/cjs/contracts/universalResolver.js.map +1 -1
- package/dist/cjs/dns.js +3 -3
- package/dist/cjs/dns.js.map +1 -1
- package/dist/cjs/errors/subgraph.js.map +1 -1
- package/dist/cjs/errors/utils.js +27 -18
- package/dist/cjs/errors/utils.js.map +1 -1
- package/dist/cjs/errors/version.js +1 -1
- package/dist/cjs/errors/version.js.map +1 -1
- package/dist/cjs/functions/dns/{prepareDnsImport.js → getDnsImportData.js} +3 -3
- package/dist/cjs/functions/dns/{prepareDnsImport.js.map → getDnsImportData.js.map} +1 -1
- package/dist/cjs/functions/dns/importDnsName.js +7 -7
- package/dist/cjs/functions/dns/importDnsName.js.map +1 -1
- package/dist/cjs/functions/public/_getAbi.js +2 -2
- package/dist/cjs/functions/public/_getAbi.js.map +1 -1
- package/dist/cjs/functions/public/_getAddr.js +9 -19
- package/dist/cjs/functions/public/_getAddr.js.map +1 -1
- package/dist/cjs/functions/public/_getContentHash.js +1 -1
- package/dist/cjs/functions/public/batch.js.map +1 -1
- package/dist/cjs/functions/public/getAbiRecord.js.map +1 -1
- package/dist/cjs/functions/public/getAddressRecord.js.map +1 -1
- package/dist/cjs/functions/public/getAvailable.js.map +1 -1
- package/dist/cjs/functions/public/getContentHashRecord.js.map +1 -1
- package/dist/cjs/functions/public/getExpiry.js.map +1 -1
- package/dist/cjs/functions/public/getName.js.map +1 -1
- package/dist/cjs/functions/public/getOwner.js.map +1 -1
- package/dist/cjs/functions/public/getPrice.js.map +1 -1
- package/dist/cjs/functions/public/getRecords.js +56 -42
- package/dist/cjs/functions/public/getRecords.js.map +1 -1
- package/dist/cjs/functions/public/getResolver.js.map +1 -1
- package/dist/cjs/functions/public/getSupportedInterfaces.js +1 -1
- package/dist/cjs/functions/public/getSupportedInterfaces.js.map +1 -1
- package/dist/cjs/functions/public/getTextRecord.js.map +1 -1
- package/dist/cjs/functions/public/getWrapperData.js.map +1 -1
- package/dist/cjs/functions/public/getWrapperName.js.map +1 -1
- package/dist/cjs/functions/public/multicallWrapper.js.map +1 -1
- package/dist/cjs/functions/public/universalWrapper.js.map +1 -1
- package/dist/cjs/functions/subgraph/client.js.map +1 -1
- package/dist/cjs/functions/subgraph/filters.js +3 -0
- package/dist/cjs/functions/subgraph/filters.js.map +1 -0
- package/dist/cjs/functions/subgraph/getDecodedName.js.map +1 -1
- package/dist/cjs/functions/subgraph/getNameHistory.js +4 -3
- package/dist/cjs/functions/subgraph/getNameHistory.js.map +1 -1
- package/dist/cjs/functions/subgraph/getNamesForAddress.js +155 -190
- package/dist/cjs/functions/subgraph/getNamesForAddress.js.map +1 -1
- package/dist/cjs/functions/subgraph/getSubgraphRecords.js +34 -26
- package/dist/cjs/functions/subgraph/getSubgraphRecords.js.map +1 -1
- package/dist/cjs/functions/subgraph/getSubgraphRegistrant.js.map +1 -1
- package/dist/cjs/functions/subgraph/getSubnames.js +95 -108
- package/dist/cjs/functions/subgraph/getSubnames.js.map +1 -1
- package/dist/cjs/functions/subgraph/types.js +3 -0
- package/dist/cjs/functions/subgraph/types.js.map +1 -0
- package/dist/cjs/functions/subgraph/utils.js.map +1 -1
- package/dist/cjs/functions/wallet/clearRecords.js +26 -0
- package/dist/cjs/functions/wallet/clearRecords.js.map +1 -0
- package/dist/cjs/functions/wallet/commitName.js.map +1 -1
- package/dist/cjs/functions/wallet/createSubname.js +1 -1
- package/dist/cjs/functions/wallet/createSubname.js.map +1 -1
- package/dist/cjs/functions/wallet/deleteSubname.js.map +1 -1
- package/dist/cjs/functions/wallet/registerName.js.map +1 -1
- package/dist/cjs/functions/wallet/renewNames.js.map +1 -1
- package/dist/cjs/functions/wallet/setAbiRecord.js.map +1 -1
- package/dist/cjs/functions/wallet/setAddressRecord.js.map +1 -1
- package/dist/cjs/functions/wallet/setChildFuses.js +1 -1
- package/dist/cjs/functions/wallet/setChildFuses.js.map +1 -1
- package/dist/cjs/functions/wallet/setContentHashRecord.js.map +1 -1
- package/dist/cjs/functions/wallet/setFuses.js +1 -1
- package/dist/cjs/functions/wallet/setFuses.js.map +1 -1
- package/dist/cjs/functions/wallet/setPrimaryName.js.map +1 -1
- package/dist/cjs/functions/wallet/setRecords.js.map +1 -1
- package/dist/cjs/functions/wallet/setResolver.js.map +1 -1
- package/dist/cjs/functions/wallet/setTextRecord.js.map +1 -1
- package/dist/cjs/functions/wallet/transferName.js.map +1 -1
- package/dist/cjs/functions/wallet/unwrapName.js.map +1 -1
- package/dist/cjs/functions/wallet/wrapName.js +3 -1
- package/dist/cjs/functions/wallet/wrapName.js.map +1 -1
- package/dist/cjs/index.js +1 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/subgraph.js +4 -1
- package/dist/cjs/subgraph.js.map +1 -1
- package/dist/cjs/utils/contentHash.js +60 -131
- package/dist/cjs/utils/contentHash.js.map +1 -1
- package/dist/cjs/utils/encoders/encodeAbi.js +33 -3
- package/dist/cjs/utils/encoders/encodeAbi.js.map +1 -1
- package/dist/cjs/utils/encoders/encodeClearRecords.js +12 -0
- package/dist/cjs/utils/encoders/encodeClearRecords.js.map +1 -0
- package/dist/cjs/utils/encoders/encodeSetAddr.js +5 -16
- package/dist/cjs/utils/encoders/encodeSetAddr.js.map +1 -1
- package/dist/cjs/utils/encoders/encodeSetContentHash.js +1 -4
- package/dist/cjs/utils/encoders/encodeSetContentHash.js.map +1 -1
- package/dist/cjs/utils/format.js +1 -5
- package/dist/cjs/utils/format.js.map +1 -1
- package/dist/cjs/utils/fuses.js +184 -200
- package/dist/cjs/utils/fuses.js.map +1 -1
- package/dist/cjs/utils/generateRecordCallArray.js +6 -10
- package/dist/cjs/utils/generateRecordCallArray.js.map +1 -1
- package/dist/cjs/utils/getRevertErrorData.js +4 -1
- package/dist/cjs/utils/getRevertErrorData.js.map +1 -1
- package/dist/cjs/utils/index.js +31 -7
- package/dist/cjs/utils/index.js.map +1 -1
- package/dist/cjs/utils/normaliseCoinId.js +35 -0
- package/dist/cjs/utils/normaliseCoinId.js.map +1 -0
- package/dist/cjs/utils/registerHelpers.js +3 -1
- package/dist/cjs/utils/registerHelpers.js.map +1 -1
- package/dist/cjs/wallet.js +3 -1
- package/dist/cjs/wallet.js.map +1 -1
- package/dist/esm/clients/decorators/subgraph.js.map +1 -1
- package/dist/esm/clients/decorators/wallet.js +2 -0
- package/dist/esm/clients/decorators/wallet.js.map +1 -1
- package/dist/esm/clients/public.js.map +1 -1
- package/dist/esm/clients/subgraph.js.map +1 -1
- package/dist/esm/contracts/consts.js +53 -2
- package/dist/esm/contracts/consts.js.map +1 -1
- package/dist/esm/contracts/universalResolver.js +46 -1
- package/dist/esm/contracts/universalResolver.js.map +1 -1
- package/dist/esm/dns.js +1 -1
- package/dist/esm/dns.js.map +1 -1
- package/dist/esm/errors/subgraph.js.map +1 -1
- package/dist/esm/errors/utils.js +24 -16
- package/dist/esm/errors/utils.js.map +1 -1
- package/dist/esm/errors/version.js +1 -1
- package/dist/esm/errors/version.js.map +1 -1
- package/dist/esm/functions/dns/{prepareDnsImport.js → getDnsImportData.js} +10 -10
- package/dist/esm/functions/dns/{prepareDnsImport.js.map → getDnsImportData.js.map} +1 -1
- package/dist/esm/functions/dns/getDnsOwner.js +1 -1
- package/dist/esm/functions/dns/importDnsName.js +13 -12
- package/dist/esm/functions/dns/importDnsName.js.map +1 -1
- package/dist/esm/functions/public/_getAbi.js +2 -2
- package/dist/esm/functions/public/_getAbi.js.map +1 -1
- package/dist/esm/functions/public/_getAddr.js +10 -20
- package/dist/esm/functions/public/_getAddr.js.map +1 -1
- package/dist/esm/functions/public/_getContentHash.js +2 -2
- package/dist/esm/functions/public/batch.js +2 -1
- package/dist/esm/functions/public/batch.js.map +1 -1
- package/dist/esm/functions/public/getAbiRecord.js +2 -1
- package/dist/esm/functions/public/getAbiRecord.js.map +1 -1
- package/dist/esm/functions/public/getAddressRecord.js +2 -1
- package/dist/esm/functions/public/getAddressRecord.js.map +1 -1
- package/dist/esm/functions/public/getAvailable.js +2 -1
- package/dist/esm/functions/public/getAvailable.js.map +1 -1
- package/dist/esm/functions/public/getContentHashRecord.js +2 -1
- package/dist/esm/functions/public/getContentHashRecord.js.map +1 -1
- package/dist/esm/functions/public/getExpiry.js +2 -1
- package/dist/esm/functions/public/getExpiry.js.map +1 -1
- package/dist/esm/functions/public/getName.js +2 -1
- package/dist/esm/functions/public/getName.js.map +1 -1
- package/dist/esm/functions/public/getOwner.js +3 -2
- package/dist/esm/functions/public/getOwner.js.map +1 -1
- package/dist/esm/functions/public/getPrice.js +3 -2
- package/dist/esm/functions/public/getPrice.js.map +1 -1
- package/dist/esm/functions/public/getRecords.js +59 -48
- package/dist/esm/functions/public/getRecords.js.map +1 -1
- package/dist/esm/functions/public/getResolver.js +2 -1
- package/dist/esm/functions/public/getResolver.js.map +1 -1
- package/dist/esm/functions/public/getSupportedInterfaces.js +24 -2
- package/dist/esm/functions/public/getSupportedInterfaces.js.map +1 -1
- package/dist/esm/functions/public/getTextRecord.js +2 -1
- package/dist/esm/functions/public/getTextRecord.js.map +1 -1
- package/dist/esm/functions/public/getWrapperData.js +2 -1
- package/dist/esm/functions/public/getWrapperData.js.map +1 -1
- package/dist/esm/functions/public/getWrapperName.js +2 -1
- package/dist/esm/functions/public/getWrapperName.js.map +1 -1
- package/dist/esm/functions/public/multicallWrapper.js.map +1 -1
- package/dist/esm/functions/public/universalWrapper.js.map +1 -1
- package/dist/esm/functions/subgraph/client.js.map +1 -1
- package/dist/esm/functions/subgraph/filters.js +2 -0
- package/dist/esm/functions/subgraph/filters.js.map +1 -0
- package/dist/esm/functions/subgraph/getDecodedName.js +2 -1
- package/dist/esm/functions/subgraph/getDecodedName.js.map +1 -1
- package/dist/esm/functions/subgraph/getNameHistory.js +8 -6
- package/dist/esm/functions/subgraph/getNameHistory.js.map +1 -1
- package/dist/esm/functions/subgraph/getNamesForAddress.js +163 -192
- package/dist/esm/functions/subgraph/getNamesForAddress.js.map +1 -1
- package/dist/esm/functions/subgraph/getSubgraphRecords.js +36 -27
- package/dist/esm/functions/subgraph/getSubgraphRecords.js.map +1 -1
- package/dist/esm/functions/subgraph/getSubgraphRegistrant.js +2 -1
- package/dist/esm/functions/subgraph/getSubgraphRegistrant.js.map +1 -1
- package/dist/esm/functions/subgraph/getSubnames.js +103 -112
- package/dist/esm/functions/subgraph/getSubnames.js.map +1 -1
- package/dist/esm/functions/subgraph/types.js +2 -0
- package/dist/esm/functions/subgraph/types.js.map +1 -0
- package/dist/esm/functions/subgraph/utils.js.map +1 -1
- package/dist/esm/functions/wallet/clearRecords.js +44 -0
- package/dist/esm/functions/wallet/clearRecords.js.map +1 -0
- package/dist/esm/functions/wallet/commitName.js +3 -1
- package/dist/esm/functions/wallet/commitName.js.map +1 -1
- package/dist/esm/functions/wallet/createSubname.js +3 -2
- package/dist/esm/functions/wallet/createSubname.js.map +1 -1
- package/dist/esm/functions/wallet/deleteSubname.js +2 -1
- package/dist/esm/functions/wallet/deleteSubname.js.map +1 -1
- package/dist/esm/functions/wallet/registerName.js +4 -1
- package/dist/esm/functions/wallet/registerName.js.map +1 -1
- package/dist/esm/functions/wallet/renewNames.js +3 -1
- package/dist/esm/functions/wallet/renewNames.js.map +1 -1
- package/dist/esm/functions/wallet/setAbiRecord.js +3 -1
- package/dist/esm/functions/wallet/setAbiRecord.js.map +1 -1
- package/dist/esm/functions/wallet/setAddressRecord.js +2 -1
- package/dist/esm/functions/wallet/setAddressRecord.js.map +1 -1
- package/dist/esm/functions/wallet/setChildFuses.js +3 -2
- package/dist/esm/functions/wallet/setChildFuses.js.map +1 -1
- package/dist/esm/functions/wallet/setContentHashRecord.js +2 -1
- package/dist/esm/functions/wallet/setContentHashRecord.js.map +1 -1
- package/dist/esm/functions/wallet/setFuses.js +4 -3
- package/dist/esm/functions/wallet/setFuses.js.map +1 -1
- package/dist/esm/functions/wallet/setPrimaryName.js +2 -1
- package/dist/esm/functions/wallet/setPrimaryName.js.map +1 -1
- package/dist/esm/functions/wallet/setRecords.js +2 -1
- package/dist/esm/functions/wallet/setRecords.js.map +1 -1
- package/dist/esm/functions/wallet/setResolver.js +2 -1
- package/dist/esm/functions/wallet/setResolver.js.map +1 -1
- package/dist/esm/functions/wallet/setTextRecord.js +2 -1
- package/dist/esm/functions/wallet/setTextRecord.js.map +1 -1
- package/dist/esm/functions/wallet/transferName.js +2 -1
- package/dist/esm/functions/wallet/transferName.js.map +1 -1
- package/dist/esm/functions/wallet/unwrapName.js +2 -1
- package/dist/esm/functions/wallet/unwrapName.js.map +1 -1
- package/dist/esm/functions/wallet/wrapName.js +6 -3
- package/dist/esm/functions/wallet/wrapName.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/subgraph.js +1 -0
- package/dist/esm/subgraph.js.map +1 -1
- package/dist/esm/utils/contentHash.js +56 -128
- package/dist/esm/utils/contentHash.js.map +1 -1
- package/dist/esm/utils/encoders/encodeAbi.js +30 -2
- package/dist/esm/utils/encoders/encodeAbi.js.map +1 -1
- package/dist/esm/utils/encoders/encodeClearRecords.js +8 -0
- package/dist/esm/utils/encoders/encodeClearRecords.js.map +1 -0
- package/dist/esm/utils/encoders/encodeSetAddr.js +5 -16
- package/dist/esm/utils/encoders/encodeSetAddr.js.map +1 -1
- package/dist/esm/utils/encoders/encodeSetContentHash.js +2 -5
- package/dist/esm/utils/encoders/encodeSetContentHash.js.map +1 -1
- package/dist/esm/utils/format.js +0 -2
- package/dist/esm/utils/format.js.map +1 -1
- package/dist/esm/utils/fuses.js +183 -201
- package/dist/esm/utils/fuses.js.map +1 -1
- package/dist/esm/utils/generateRecordCallArray.js +7 -10
- package/dist/esm/utils/generateRecordCallArray.js.map +1 -1
- package/dist/esm/utils/getRevertErrorData.js +4 -1
- package/dist/esm/utils/getRevertErrorData.js.map +1 -1
- package/dist/esm/utils/index.js +5 -3
- package/dist/esm/utils/index.js.map +1 -1
- package/dist/esm/utils/normaliseCoinId.js +30 -0
- package/dist/esm/utils/normaliseCoinId.js.map +1 -0
- package/dist/esm/utils/registerHelpers.js +4 -2
- package/dist/esm/utils/registerHelpers.js.map +1 -1
- package/dist/esm/wallet.js +1 -0
- package/dist/esm/wallet.js.map +1 -1
- package/dist/types/clients/decorators/public.d.ts +1 -519
- package/dist/types/clients/decorators/public.d.ts.map +1 -1
- package/dist/types/clients/decorators/subgraph.d.ts +2 -520
- package/dist/types/clients/decorators/subgraph.d.ts.map +1 -1
- package/dist/types/clients/decorators/wallet.d.ts +66 -47
- package/dist/types/clients/decorators/wallet.d.ts.map +1 -1
- package/dist/types/clients/public.d.ts +24 -265
- package/dist/types/clients/public.d.ts.map +1 -1
- package/dist/types/clients/subgraph.d.ts +19 -260
- package/dist/types/clients/subgraph.d.ts.map +1 -1
- package/dist/types/clients/wallet.d.ts +60 -92
- package/dist/types/clients/wallet.d.ts.map +1 -1
- package/dist/types/contracts/consts.d.ts +52 -3
- package/dist/types/contracts/consts.d.ts.map +1 -1
- package/dist/types/contracts/universalResolver.d.ts +133 -1
- package/dist/types/contracts/universalResolver.d.ts.map +1 -1
- package/dist/types/dns.d.ts +2 -2
- package/dist/types/dns.d.ts.map +1 -1
- package/dist/types/errors/subgraph.d.ts +4 -4
- package/dist/types/errors/subgraph.d.ts.map +1 -1
- package/dist/types/errors/utils.d.ts +16 -13
- package/dist/types/errors/utils.d.ts.map +1 -1
- package/dist/types/errors/version.d.ts +1 -1
- package/dist/types/errors/version.d.ts.map +1 -1
- package/dist/types/functions/dns/getDnsImportData.d.ts +39 -0
- package/dist/types/functions/dns/{prepareDnsImport.d.ts.map → getDnsImportData.d.ts.map} +1 -1
- package/dist/types/functions/dns/getDnsOwner.d.ts +1 -1
- package/dist/types/functions/dns/importDnsName.d.ts +88 -102
- package/dist/types/functions/dns/importDnsName.d.ts.map +1 -1
- package/dist/types/functions/public/_getAddr.d.ts.map +1 -1
- package/dist/types/functions/public/batch.d.ts +2 -1
- package/dist/types/functions/public/batch.d.ts.map +1 -1
- package/dist/types/functions/public/getAbiRecord.d.ts +2 -1
- package/dist/types/functions/public/getAbiRecord.d.ts.map +1 -1
- package/dist/types/functions/public/getAddressRecord.d.ts +2 -1
- package/dist/types/functions/public/getAddressRecord.d.ts.map +1 -1
- package/dist/types/functions/public/getAvailable.d.ts +2 -1
- package/dist/types/functions/public/getAvailable.d.ts.map +1 -1
- package/dist/types/functions/public/getContentHashRecord.d.ts +2 -1
- package/dist/types/functions/public/getContentHashRecord.d.ts.map +1 -1
- package/dist/types/functions/public/getExpiry.d.ts +2 -1
- package/dist/types/functions/public/getExpiry.d.ts.map +1 -1
- package/dist/types/functions/public/getName.d.ts +2 -1
- package/dist/types/functions/public/getName.d.ts.map +1 -1
- package/dist/types/functions/public/getOwner.d.ts +19 -9
- package/dist/types/functions/public/getOwner.d.ts.map +1 -1
- package/dist/types/functions/public/getPrice.d.ts +3 -2
- package/dist/types/functions/public/getPrice.d.ts.map +1 -1
- package/dist/types/functions/public/getRecords.d.ts +3 -2
- package/dist/types/functions/public/getRecords.d.ts.map +1 -1
- package/dist/types/functions/public/getResolver.d.ts +2 -1
- package/dist/types/functions/public/getResolver.d.ts.map +1 -1
- package/dist/types/functions/public/getSupportedInterfaces.d.ts +41 -4
- package/dist/types/functions/public/getSupportedInterfaces.d.ts.map +1 -1
- package/dist/types/functions/public/getTextRecord.d.ts +2 -1
- package/dist/types/functions/public/getTextRecord.d.ts.map +1 -1
- package/dist/types/functions/public/getWrapperData.d.ts +4 -3
- package/dist/types/functions/public/getWrapperData.d.ts.map +1 -1
- package/dist/types/functions/public/getWrapperName.d.ts +2 -1
- package/dist/types/functions/public/getWrapperName.d.ts.map +1 -1
- package/dist/types/functions/subgraph/client.d.ts +2 -2
- package/dist/types/functions/subgraph/client.d.ts.map +1 -1
- package/dist/types/functions/subgraph/filters.d.ts +693 -0
- package/dist/types/functions/subgraph/filters.d.ts.map +1 -0
- package/dist/types/functions/subgraph/getDecodedName.d.ts +2 -1
- package/dist/types/functions/subgraph/getDecodedName.d.ts.map +1 -1
- package/dist/types/functions/subgraph/getNameHistory.d.ts +2 -1
- package/dist/types/functions/subgraph/getNameHistory.d.ts.map +1 -1
- package/dist/types/functions/subgraph/getNamesForAddress.d.ts +7 -2
- package/dist/types/functions/subgraph/getNamesForAddress.d.ts.map +1 -1
- package/dist/types/functions/subgraph/getSubgraphRecords.d.ts +2 -1
- package/dist/types/functions/subgraph/getSubgraphRecords.d.ts.map +1 -1
- package/dist/types/functions/subgraph/getSubgraphRegistrant.d.ts +2 -1
- package/dist/types/functions/subgraph/getSubgraphRegistrant.d.ts.map +1 -1
- package/dist/types/functions/subgraph/getSubnames.d.ts +5 -2
- package/dist/types/functions/subgraph/getSubnames.d.ts.map +1 -1
- package/dist/types/functions/subgraph/types.d.ts +13 -0
- package/dist/types/functions/subgraph/types.d.ts.map +1 -0
- package/dist/types/functions/subgraph/utils.d.ts +2 -2
- package/dist/types/functions/subgraph/utils.d.ts.map +1 -1
- package/dist/types/functions/wallet/clearRecords.d.ts +555 -0
- package/dist/types/functions/wallet/clearRecords.d.ts.map +1 -0
- package/dist/types/functions/wallet/commitName.d.ts +80 -93
- package/dist/types/functions/wallet/commitName.d.ts.map +1 -1
- package/dist/types/functions/wallet/createSubname.d.ts +82 -96
- package/dist/types/functions/wallet/createSubname.d.ts.map +1 -1
- package/dist/types/functions/wallet/deleteSubname.d.ts +79 -93
- package/dist/types/functions/wallet/deleteSubname.d.ts.map +1 -1
- package/dist/types/functions/wallet/registerName.d.ts +80 -89
- package/dist/types/functions/wallet/registerName.d.ts.map +1 -1
- package/dist/types/functions/wallet/renewNames.d.ts +79 -89
- package/dist/types/functions/wallet/renewNames.d.ts.map +1 -1
- package/dist/types/functions/wallet/setAbiRecord.d.ts +80 -93
- package/dist/types/functions/wallet/setAbiRecord.d.ts.map +1 -1
- package/dist/types/functions/wallet/setAddressRecord.d.ts +79 -93
- package/dist/types/functions/wallet/setAddressRecord.d.ts.map +1 -1
- package/dist/types/functions/wallet/setChildFuses.d.ts +81 -95
- package/dist/types/functions/wallet/setChildFuses.d.ts.map +1 -1
- package/dist/types/functions/wallet/setContentHashRecord.d.ts +79 -93
- package/dist/types/functions/wallet/setContentHashRecord.d.ts.map +1 -1
- package/dist/types/functions/wallet/setFuses.d.ts +81 -95
- package/dist/types/functions/wallet/setFuses.d.ts.map +1 -1
- package/dist/types/functions/wallet/setPrimaryName.d.ts +79 -93
- package/dist/types/functions/wallet/setPrimaryName.d.ts.map +1 -1
- package/dist/types/functions/wallet/setRecords.d.ts +79 -93
- package/dist/types/functions/wallet/setRecords.d.ts.map +1 -1
- package/dist/types/functions/wallet/setResolver.d.ts +79 -93
- package/dist/types/functions/wallet/setResolver.d.ts.map +1 -1
- package/dist/types/functions/wallet/setTextRecord.d.ts +79 -93
- package/dist/types/functions/wallet/setTextRecord.d.ts.map +1 -1
- package/dist/types/functions/wallet/transferName.d.ts +80 -94
- package/dist/types/functions/wallet/transferName.d.ts.map +1 -1
- package/dist/types/functions/wallet/unwrapName.d.ts +79 -93
- package/dist/types/functions/wallet/unwrapName.d.ts.map +1 -1
- package/dist/types/functions/wallet/wrapName.d.ts +81 -95
- package/dist/types/functions/wallet/wrapName.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/subgraph.d.ts +1 -0
- package/dist/types/subgraph.d.ts.map +1 -1
- package/dist/types/types.d.ts +3 -1
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/utils/contentHash.d.ts +10 -11
- package/dist/types/utils/contentHash.d.ts.map +1 -1
- package/dist/types/utils/encoders/encodeAbi.d.ts +8 -5
- package/dist/types/utils/encoders/encodeAbi.d.ts.map +1 -1
- package/dist/types/utils/encoders/encodeClearRecords.d.ts +3 -0
- package/dist/types/utils/encoders/encodeClearRecords.d.ts.map +1 -0
- package/dist/types/utils/encoders/encodeSetAddr.d.ts.map +1 -1
- package/dist/types/utils/encoders/encodeSetContentHash.d.ts.map +1 -1
- package/dist/types/utils/format.d.ts +0 -2
- package/dist/types/utils/format.d.ts.map +1 -1
- package/dist/types/utils/fuses.d.ts +164 -125
- package/dist/types/utils/fuses.d.ts.map +1 -1
- package/dist/types/utils/generateRecordCallArray.d.ts +5 -5
- package/dist/types/utils/generateRecordCallArray.d.ts.map +1 -1
- package/dist/types/utils/getRevertErrorData.d.ts.map +1 -1
- package/dist/types/utils/index.d.ts +5 -3
- package/dist/types/utils/index.d.ts.map +1 -1
- package/dist/types/utils/normaliseCoinId.d.ts +10 -0
- package/dist/types/utils/normaliseCoinId.d.ts.map +1 -0
- package/dist/types/utils/registerHelpers.d.ts +2 -2
- package/dist/types/utils/registerHelpers.d.ts.map +1 -1
- package/dist/types/wallet.d.ts +18 -17
- package/dist/types/wallet.d.ts.map +1 -1
- package/package.json +9 -9
- package/src/clients/decorators/subgraph.ts +1 -0
- package/src/clients/decorators/wallet.ts +41 -3
- package/src/clients/public.ts +3 -2
- package/src/clients/subgraph.ts +3 -2
- package/src/clients/wallet.ts +1 -1
- package/src/contracts/consts.ts +58 -13
- package/src/contracts/universalResolver.ts +46 -1
- package/src/dns.ts +7 -5
- package/src/errors/subgraph.ts +4 -4
- package/src/errors/utils.ts +29 -18
- package/src/errors/version.ts +1 -1
- package/src/functions/dns/{prepareDnsImport.ts → getDnsImportData.ts} +13 -13
- package/src/functions/dns/getDnsOwner.ts +1 -1
- package/src/functions/dns/importDnsName.ts +21 -15
- package/src/functions/public/_getAbi.ts +2 -2
- package/src/functions/public/_getAddr.ts +16 -23
- package/src/functions/public/_getContentHash.ts +2 -2
- package/src/functions/public/batch.ts +2 -1
- package/src/functions/public/getAbiRecord.ts +2 -1
- package/src/functions/public/getAddressRecord.ts +2 -1
- package/src/functions/public/getAvailable.ts +2 -1
- package/src/functions/public/getContentHashRecord.ts +2 -1
- package/src/functions/public/getExpiry.ts +2 -1
- package/src/functions/public/getName.ts +3 -2
- package/src/functions/public/getOwner.ts +54 -33
- package/src/functions/public/getPrice.ts +3 -2
- package/src/functions/public/getRecords.ts +130 -114
- package/src/functions/public/getResolver.ts +3 -2
- package/src/functions/public/getSupportedInterfaces.ts +70 -10
- package/src/functions/public/getTextRecord.ts +2 -1
- package/src/functions/public/getWrapperData.ts +5 -4
- package/src/functions/public/getWrapperName.ts +3 -2
- package/src/functions/public/multicallWrapper.ts +1 -1
- package/src/functions/public/universalWrapper.ts +1 -1
- package/src/functions/subgraph/client.ts +2 -2
- package/src/functions/subgraph/filters.ts +702 -0
- package/src/functions/subgraph/getDecodedName.ts +2 -1
- package/src/functions/subgraph/getNameHistory.ts +8 -6
- package/src/functions/subgraph/getNamesForAddress.ts +199 -195
- package/src/functions/subgraph/getSubgraphRecords.ts +65 -33
- package/src/functions/subgraph/getSubgraphRegistrant.ts +2 -1
- package/src/functions/subgraph/getSubnames.ts +123 -114
- package/src/functions/subgraph/types.ts +13 -0
- package/src/functions/subgraph/utils.ts +2 -2
- package/src/functions/wallet/clearRecords.ts +97 -0
- package/src/functions/wallet/commitName.ts +3 -1
- package/src/functions/wallet/createSubname.ts +6 -5
- package/src/functions/wallet/deleteSubname.ts +2 -1
- package/src/functions/wallet/registerName.ts +4 -1
- package/src/functions/wallet/renewNames.ts +3 -1
- package/src/functions/wallet/setAbiRecord.ts +3 -1
- package/src/functions/wallet/setAddressRecord.ts +2 -1
- package/src/functions/wallet/setChildFuses.ts +5 -4
- package/src/functions/wallet/setContentHashRecord.ts +2 -1
- package/src/functions/wallet/setFuses.ts +8 -4
- package/src/functions/wallet/setPrimaryName.ts +2 -1
- package/src/functions/wallet/setRecords.ts +2 -1
- package/src/functions/wallet/setResolver.ts +2 -1
- package/src/functions/wallet/setTextRecord.ts +2 -1
- package/src/functions/wallet/transferName.ts +3 -2
- package/src/functions/wallet/unwrapName.ts +2 -1
- package/src/functions/wallet/wrapName.ts +10 -4
- package/src/index.ts +0 -1
- package/src/subgraph.ts +5 -0
- package/src/types.ts +6 -3
- package/src/utils/contentHash.ts +65 -113
- package/src/utils/encoders/encodeAbi.ts +37 -8
- package/src/utils/encoders/encodeClearRecords.ts +9 -0
- package/src/utils/encoders/encodeSetAddr.ts +5 -16
- package/src/utils/encoders/encodeSetContentHash.ts +2 -4
- package/src/utils/format.ts +0 -6
- package/src/utils/fuses.ts +312 -308
- package/src/utils/generateRecordCallArray.ts +10 -14
- package/src/utils/getRevertErrorData.ts +3 -1
- package/src/utils/index.ts +37 -5
- package/src/utils/normaliseCoinId.ts +36 -0
- package/src/utils/registerHelpers.ts +5 -3
- package/src/wallet.ts +41 -0
- package/dist/types/functions/dns/prepareDnsImport.d.ts +0 -39
- package/src/@types/@ensdomains/content-hash.d.ts +0 -1
- package/src/functions/dns/getDnsOwner.test.ts +0 -195
- package/src/functions/dns/importDnsName.test.ts +0 -117
- package/src/functions/dns/prepareDnsImport.test.ts +0 -115
- package/src/functions/public/batch.test.ts +0 -67
- package/src/functions/public/ccip.test.ts +0 -78
- package/src/functions/public/getAbiRecord.test.ts +0 -174
- package/src/functions/public/getAddressRecord.test.ts +0 -83
- package/src/functions/public/getAvailable.test.ts +0 -17
- package/src/functions/public/getContentHashRecord.test.ts +0 -28
- package/src/functions/public/getExpiry.test.ts +0 -48
- package/src/functions/public/getName.test.ts +0 -66
- package/src/functions/public/getOwner.test.ts +0 -87
- package/src/functions/public/getPrice.test.ts +0 -45
- package/src/functions/public/getRecords.test.ts +0 -49
- package/src/functions/public/getResolver.test.ts +0 -12
- package/src/functions/public/getTextRecord.test.ts +0 -20
- package/src/functions/public/getWrapperData.test.ts +0 -79
- package/src/functions/public/getWrapperName.test.ts +0 -19
- package/src/functions/subgraph/client.test.ts +0 -170
- package/src/functions/subgraph/getDecodedName.test.ts +0 -31
- package/src/functions/subgraph/getNameHistory.test.ts +0 -39
- package/src/functions/subgraph/getNamesForAddress.test.ts +0 -244
- package/src/functions/subgraph/getSubgraphRecords.test.ts +0 -74
- package/src/functions/subgraph/getSubgraphRegistrant.test.ts +0 -34
- package/src/functions/subgraph/getSubnames.test.ts +0 -202
- package/src/functions/wallet/commitName.test.ts +0 -58
- package/src/functions/wallet/createSubname.test.ts +0 -73
- package/src/functions/wallet/deleteSubname.test.ts +0 -150
- package/src/functions/wallet/registerName.test.ts +0 -81
- package/src/functions/wallet/renewNames.test.ts +0 -92
- package/src/functions/wallet/setAbiRecord.test.ts +0 -156
- package/src/functions/wallet/setAddressRecord.test.ts +0 -121
- package/src/functions/wallet/setChildFuses.test.ts +0 -97
- package/src/functions/wallet/setContentHashRecord.test.ts +0 -69
- package/src/functions/wallet/setFuses.test.ts +0 -287
- package/src/functions/wallet/setPrimaryName.test.ts +0 -71
- package/src/functions/wallet/setRecords.test.ts +0 -127
- package/src/functions/wallet/setResolver.test.ts +0 -114
- package/src/functions/wallet/setTextRecord.test.ts +0 -67
- package/src/functions/wallet/transferName.test.ts +0 -201
- package/src/functions/wallet/unwrapName.test.ts +0 -93
- package/src/functions/wallet/wrapName.test.ts +0 -195
- package/src/utils/generateRecordCallArray.test.ts +0 -84
- package/src/utils/labels.test.ts +0 -163
- package/src/utils/makeLabelNodeAndParent.test.ts +0 -11
- package/src/utils/makeSafeSecondsDate.test.ts +0 -14
- package/src/utils/normalise.test.ts +0 -35
- package/src/utils/ownerFromContract.test.ts +0 -52
- package/src/utils/registerHelpers.test.ts +0 -159
- package/src/utils/validation.test.ts +0 -170
- package/src/utils/wrapper.test.ts +0 -46
|
@@ -32,7 +32,8 @@ type SubgraphResult = {
|
|
|
32
32
|
* @example
|
|
33
33
|
* import { createPublicClient, http } from 'viem'
|
|
34
34
|
* import { mainnet } from 'viem/chains'
|
|
35
|
-
* import { addEnsContracts
|
|
35
|
+
* import { addEnsContracts } from '@ensdomains/ensjs'
|
|
36
|
+
* import { getDecodedName } from '@ensdomains/ensjs/subgraph'
|
|
36
37
|
*
|
|
37
38
|
* const client = createPublicClient({
|
|
38
39
|
* chain: addEnsContracts(mainnet),
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getCoderByCoinType } from '@ensdomains/address-encoder'
|
|
2
2
|
import { gql } from 'graphql-request'
|
|
3
|
+
import { hexToBytes } from 'viem'
|
|
3
4
|
import type { ClientWithEns } from '../../contracts/consts.js'
|
|
4
|
-
import {
|
|
5
|
+
import { decodeContentHash } from '../../utils/contentHash.js'
|
|
5
6
|
import { namehash } from '../../utils/normalise.js'
|
|
6
7
|
import { createSubgraphClient } from './client.js'
|
|
7
8
|
import type {
|
|
@@ -71,7 +72,8 @@ export type GetNameHistoryReturnType = {
|
|
|
71
72
|
* @example
|
|
72
73
|
* import { createPublicClient, http } from 'viem'
|
|
73
74
|
* import { mainnet } from 'viem/chains'
|
|
74
|
-
* import { addEnsContracts
|
|
75
|
+
* import { addEnsContracts } from '@ensdomains/ensjs'
|
|
76
|
+
* import { getNameHistory } from '@ensdomains/ensjs/subgraph'
|
|
75
77
|
*
|
|
76
78
|
* const client = createPublicClient({
|
|
77
79
|
* chain: addEnsContracts(mainnet),
|
|
@@ -275,7 +277,7 @@ const getNameHistory = async (
|
|
|
275
277
|
}
|
|
276
278
|
case 'MulticoinAddrChanged': {
|
|
277
279
|
const { multiaddr, ...event_ } = event
|
|
278
|
-
const format =
|
|
280
|
+
const format = getCoderByCoinType(parseInt(event.coinType))
|
|
279
281
|
if (!format) {
|
|
280
282
|
return {
|
|
281
283
|
...event_,
|
|
@@ -296,11 +298,11 @@ const getNameHistory = async (
|
|
|
296
298
|
...event_,
|
|
297
299
|
coinName: format.name,
|
|
298
300
|
decoded: true,
|
|
299
|
-
addr: format.
|
|
301
|
+
addr: format.encode(hexToBytes(multiaddr)),
|
|
300
302
|
}
|
|
301
303
|
}
|
|
302
304
|
case 'ContenthashChanged': {
|
|
303
|
-
const { decoded: contentHash, protocolType } =
|
|
305
|
+
const { decoded: contentHash, protocolType } = decodeContentHash(
|
|
304
306
|
event.hash,
|
|
305
307
|
) || { protocolType: null, decoded: null }
|
|
306
308
|
return {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
1
2
|
import { gql } from 'graphql-request'
|
|
2
3
|
import type { Address } from 'viem'
|
|
3
4
|
import type { ClientWithEns } from '../../contracts/consts.js'
|
|
@@ -6,8 +7,9 @@ import {
|
|
|
6
7
|
InvalidFilterKeyError,
|
|
7
8
|
InvalidOrderByError,
|
|
8
9
|
} from '../../errors/subgraph.js'
|
|
9
|
-
import { GRACE_PERIOD_SECONDS } from '../../utils/consts.js'
|
|
10
|
+
import { EMPTY_ADDRESS, GRACE_PERIOD_SECONDS } from '../../utils/consts.js'
|
|
10
11
|
import { createSubgraphClient } from './client.js'
|
|
12
|
+
import type { DomainFilter } from './filters.js'
|
|
11
13
|
import {
|
|
12
14
|
domainDetailsFragment,
|
|
13
15
|
registrationDetailsFragment,
|
|
@@ -16,6 +18,13 @@ import {
|
|
|
16
18
|
} from './fragments.js'
|
|
17
19
|
import { makeNameObject, type Name } from './utils.js'
|
|
18
20
|
|
|
21
|
+
const supportedOwnerFilters = [
|
|
22
|
+
'owner',
|
|
23
|
+
'registrant',
|
|
24
|
+
'wrappedOwner',
|
|
25
|
+
'resolvedAddress',
|
|
26
|
+
] as const
|
|
27
|
+
|
|
19
28
|
type GetNamesForAddressOrderBy =
|
|
20
29
|
| 'expiryDate'
|
|
21
30
|
| 'name'
|
|
@@ -34,10 +43,14 @@ type GetNamesForAddressRelation = {
|
|
|
34
43
|
}
|
|
35
44
|
|
|
36
45
|
type GetNamesForAddressFilter = GetNamesForAddressRelation & {
|
|
46
|
+
/** Search string filter for subname label */
|
|
47
|
+
searchString?: string
|
|
37
48
|
/** Allows expired names to be included (default: false) */
|
|
38
49
|
allowExpired?: boolean
|
|
39
50
|
/** Allows reverse record nodes to be included (default: false) */
|
|
40
51
|
allowReverseRecord?: boolean
|
|
52
|
+
/** Allows deleted names to be included (default: false) */
|
|
53
|
+
allowDeleted?: boolean
|
|
41
54
|
}
|
|
42
55
|
|
|
43
56
|
export type GetNamesForAddressParameters = {
|
|
@@ -65,6 +78,70 @@ type SubgraphResult = {
|
|
|
65
78
|
domains: SubgraphDomain[]
|
|
66
79
|
}
|
|
67
80
|
|
|
81
|
+
const getOrderByFilter = ({
|
|
82
|
+
orderBy,
|
|
83
|
+
orderDirection,
|
|
84
|
+
previousPage,
|
|
85
|
+
}: Required<
|
|
86
|
+
Pick<
|
|
87
|
+
GetNamesForAddressParameters,
|
|
88
|
+
'orderBy' | 'orderDirection' | 'previousPage'
|
|
89
|
+
>
|
|
90
|
+
>): DomainFilter => {
|
|
91
|
+
const lastDomain = previousPage[previousPage.length - 1]
|
|
92
|
+
const operator = orderDirection === 'asc' ? 'gt' : 'lt'
|
|
93
|
+
|
|
94
|
+
switch (orderBy) {
|
|
95
|
+
case 'expiryDate': {
|
|
96
|
+
let lastExpiryDate = lastDomain.expiryDate?.value
|
|
97
|
+
? lastDomain.expiryDate.value / 1000
|
|
98
|
+
: 0
|
|
99
|
+
if (lastDomain.parentName === 'eth') {
|
|
100
|
+
lastExpiryDate += GRACE_PERIOD_SECONDS
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (orderDirection === 'asc' && lastExpiryDate === 0) {
|
|
104
|
+
return {
|
|
105
|
+
and: [{ expiryDate: null }, { [`id_${operator}`]: lastDomain.id }],
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
if (orderDirection === 'desc' && lastExpiryDate !== 0) {
|
|
109
|
+
return {
|
|
110
|
+
[`expiryDate_${operator}`]: `${lastExpiryDate}`,
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return {
|
|
114
|
+
or: [
|
|
115
|
+
{
|
|
116
|
+
[`expiryDate_${operator}`]: `${lastExpiryDate}`,
|
|
117
|
+
},
|
|
118
|
+
{ expiryDate: null },
|
|
119
|
+
],
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
case 'name': {
|
|
123
|
+
return {
|
|
124
|
+
[`name_${operator}`]: lastDomain.name ?? '',
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
case 'labelName': {
|
|
128
|
+
return {
|
|
129
|
+
[`labelName_${operator}`]: lastDomain.labelName ?? '',
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
case 'createdAt': {
|
|
133
|
+
return {
|
|
134
|
+
[`createdAt_${operator}`]: `${lastDomain.createdAt.value / 1000}`,
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
default:
|
|
138
|
+
throw new InvalidOrderByError({
|
|
139
|
+
orderBy: orderBy || '<no orderBy provided>',
|
|
140
|
+
supportedOrderBys: ['expiryDate', 'name', 'labelName', 'createdAt'],
|
|
141
|
+
})
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
68
145
|
/**
|
|
69
146
|
* Gets the names for an address from the subgraph.
|
|
70
147
|
* @param client - {@link ClientWithEns}
|
|
@@ -74,7 +151,8 @@ type SubgraphResult = {
|
|
|
74
151
|
* @example
|
|
75
152
|
* import { createPublicClient, http } from 'viem'
|
|
76
153
|
* import { mainnet } from 'viem/chains'
|
|
77
|
-
* import { addEnsContracts
|
|
154
|
+
* import { addEnsContracts } from '@ensdomains/ensjs'
|
|
155
|
+
* import { getNamesForAddress } from '@ensdomains/ensjs/subgraph'
|
|
78
156
|
*
|
|
79
157
|
* const client = createPublicClient({
|
|
80
158
|
* chain: addEnsContracts(mainnet),
|
|
@@ -86,247 +164,173 @@ const getNamesForAddress = async (
|
|
|
86
164
|
client: ClientWithEns,
|
|
87
165
|
{
|
|
88
166
|
address,
|
|
89
|
-
filter
|
|
90
|
-
owner: true,
|
|
91
|
-
registrant: true,
|
|
92
|
-
resolvedAddress: true,
|
|
93
|
-
wrappedOwner: true,
|
|
94
|
-
allowExpired: false,
|
|
95
|
-
allowReverseRecord: false,
|
|
96
|
-
},
|
|
167
|
+
filter: _filter,
|
|
97
168
|
orderBy = 'name',
|
|
98
169
|
orderDirection = 'asc',
|
|
99
170
|
pageSize = 100,
|
|
100
171
|
previousPage,
|
|
101
172
|
}: GetNamesForAddressParameters,
|
|
102
173
|
): Promise<GetNamesForAddressReturnType> => {
|
|
174
|
+
const filter = {
|
|
175
|
+
owner: true,
|
|
176
|
+
registrant: true,
|
|
177
|
+
resolvedAddress: true,
|
|
178
|
+
wrappedOwner: true,
|
|
179
|
+
allowExpired: false,
|
|
180
|
+
allowDeleted: false,
|
|
181
|
+
allowReverseRecord: false,
|
|
182
|
+
..._filter,
|
|
183
|
+
}
|
|
184
|
+
|
|
103
185
|
const subgraphClient = createSubgraphClient({ client })
|
|
104
186
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
{ owner: $address }
|
|
117
|
-
`
|
|
118
|
-
break
|
|
119
|
-
}
|
|
120
|
-
case 'registrant': {
|
|
121
|
-
ownerWhereFilter += `
|
|
122
|
-
{ registrant: $address }
|
|
123
|
-
`
|
|
124
|
-
break
|
|
125
|
-
}
|
|
126
|
-
case 'wrappedOwner': {
|
|
127
|
-
ownerWhereFilter += `
|
|
128
|
-
{ wrappedOwner: $address }
|
|
129
|
-
`
|
|
130
|
-
break
|
|
131
|
-
}
|
|
132
|
-
case 'resolvedAddress': {
|
|
133
|
-
ownerWhereFilter += `
|
|
134
|
-
{ resolvedAddress: $address }
|
|
135
|
-
`
|
|
136
|
-
break
|
|
137
|
-
}
|
|
138
|
-
default:
|
|
187
|
+
const {
|
|
188
|
+
allowExpired,
|
|
189
|
+
allowDeleted,
|
|
190
|
+
allowReverseRecord,
|
|
191
|
+
searchString,
|
|
192
|
+
...filters
|
|
193
|
+
} = filter
|
|
194
|
+
const ownerWhereFilters: DomainFilter[] = Object.entries(filters).reduce(
|
|
195
|
+
(prev, [key, value]) => {
|
|
196
|
+
if (value) {
|
|
197
|
+
if (!supportedOwnerFilters.includes(key as any))
|
|
139
198
|
throw new InvalidFilterKeyError({
|
|
140
199
|
filterKey: key,
|
|
141
|
-
supportedFilterKeys:
|
|
142
|
-
'owner',
|
|
143
|
-
'registrant',
|
|
144
|
-
'wrappedOwner',
|
|
145
|
-
'resolvedAddress',
|
|
146
|
-
],
|
|
200
|
+
supportedFilterKeys: supportedOwnerFilters,
|
|
147
201
|
})
|
|
202
|
+
return [
|
|
203
|
+
...prev,
|
|
204
|
+
{
|
|
205
|
+
[key]: address.toLowerCase(),
|
|
206
|
+
},
|
|
207
|
+
]
|
|
148
208
|
}
|
|
149
|
-
|
|
150
|
-
|
|
209
|
+
return prev
|
|
210
|
+
},
|
|
211
|
+
[] as DomainFilter[],
|
|
212
|
+
)
|
|
213
|
+
|
|
214
|
+
const hasFilterApplied = ownerWhereFilters.length > 0
|
|
151
215
|
|
|
152
216
|
if (!hasFilterApplied)
|
|
153
217
|
throw new FilterKeyRequiredError({
|
|
154
|
-
supportedFilterKeys:
|
|
155
|
-
'owner',
|
|
156
|
-
'registrant',
|
|
157
|
-
'wrappedOwner',
|
|
158
|
-
'resolvedAddress',
|
|
159
|
-
],
|
|
218
|
+
supportedFilterKeys: supportedOwnerFilters,
|
|
160
219
|
details: 'At least one ownership filter must be enabled',
|
|
161
220
|
})
|
|
162
221
|
|
|
163
|
-
ownerWhereFilter
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
const whereFilters = [ownerWhereFilter]
|
|
168
|
-
|
|
169
|
-
let orderByFilter = ''
|
|
170
|
-
let orderByStringVar = ''
|
|
222
|
+
const ownerWhereFilter: DomainFilter =
|
|
223
|
+
ownerWhereFilters.length > 1
|
|
224
|
+
? { or: ownerWhereFilters }
|
|
225
|
+
: ownerWhereFilters[0]
|
|
226
|
+
const whereFilters: DomainFilter[] = [ownerWhereFilter]
|
|
171
227
|
|
|
172
|
-
if (previousPage
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
if (lastDomain.parentName === 'eth') {
|
|
181
|
-
lastExpiryDate += GRACE_PERIOD_SECONDS
|
|
182
|
-
}
|
|
183
|
-
if (orderDirection === 'asc' && lastExpiryDate === 0) {
|
|
184
|
-
orderByFilter = `
|
|
185
|
-
{
|
|
186
|
-
and: [
|
|
187
|
-
{ expiryDate: null }
|
|
188
|
-
{ id_${operator}: "${lastDomain.id}" }
|
|
189
|
-
]
|
|
190
|
-
}
|
|
191
|
-
`
|
|
192
|
-
} else if (orderDirection === 'desc' && lastExpiryDate !== 0) {
|
|
193
|
-
orderByFilter = `
|
|
194
|
-
{
|
|
195
|
-
expiryDate_${operator}: ${lastExpiryDate}
|
|
196
|
-
}
|
|
197
|
-
`
|
|
198
|
-
} else {
|
|
199
|
-
orderByFilter = `
|
|
200
|
-
{
|
|
201
|
-
or: [
|
|
202
|
-
{
|
|
203
|
-
expiryDate_${operator}: ${lastExpiryDate}
|
|
204
|
-
}
|
|
205
|
-
{ expiryDate: null }
|
|
206
|
-
]
|
|
207
|
-
}
|
|
208
|
-
`
|
|
209
|
-
}
|
|
210
|
-
break
|
|
211
|
-
}
|
|
212
|
-
case 'name': {
|
|
213
|
-
orderByFilter = `
|
|
214
|
-
{
|
|
215
|
-
name_${operator}: $orderByStringVar
|
|
216
|
-
}
|
|
217
|
-
`
|
|
218
|
-
orderByStringVar = lastDomain.name ?? ''
|
|
219
|
-
break
|
|
220
|
-
}
|
|
221
|
-
case 'labelName': {
|
|
222
|
-
orderByFilter = `
|
|
223
|
-
{
|
|
224
|
-
labelName_${operator}: $orderByStringVar
|
|
225
|
-
}
|
|
226
|
-
`
|
|
227
|
-
orderByStringVar = lastDomain.labelName ?? ''
|
|
228
|
-
break
|
|
229
|
-
}
|
|
230
|
-
case 'createdAt': {
|
|
231
|
-
orderByFilter = `
|
|
232
|
-
{
|
|
233
|
-
createdAt_${operator}: ${lastDomain.createdAt.value / 1000}
|
|
234
|
-
}
|
|
235
|
-
`
|
|
236
|
-
break
|
|
237
|
-
}
|
|
238
|
-
default:
|
|
239
|
-
throw new InvalidOrderByError({
|
|
240
|
-
orderBy,
|
|
241
|
-
supportedOrderBys: ['expiryDate', 'name', 'labelName', 'createdAt'],
|
|
242
|
-
})
|
|
243
|
-
}
|
|
244
|
-
whereFilters.push(orderByFilter)
|
|
228
|
+
if (previousPage?.length) {
|
|
229
|
+
whereFilters.push(
|
|
230
|
+
getOrderByFilter({
|
|
231
|
+
orderBy,
|
|
232
|
+
orderDirection,
|
|
233
|
+
previousPage,
|
|
234
|
+
}),
|
|
235
|
+
)
|
|
245
236
|
}
|
|
246
237
|
|
|
247
238
|
if (!allowReverseRecord) {
|
|
248
239
|
// Exclude domains with parent addr.reverse
|
|
249
240
|
// namehash of addr.reverse = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2
|
|
250
|
-
whereFilters.push(
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
`)
|
|
241
|
+
whereFilters.push({
|
|
242
|
+
parent_not:
|
|
243
|
+
'0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2',
|
|
244
|
+
})
|
|
255
245
|
}
|
|
256
246
|
|
|
257
247
|
if (!allowExpired) {
|
|
258
248
|
// Exclude domains that are expired
|
|
259
249
|
// if expiryDate is null, there is no expiry on the domain (registration or wrapped)
|
|
260
|
-
whereFilters.push(
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
}
|
|
267
|
-
`)
|
|
250
|
+
whereFilters.push({
|
|
251
|
+
or: [
|
|
252
|
+
{ expiryDate_gt: `${Math.floor(Date.now() / 1000)}` },
|
|
253
|
+
{ expiryDate: null },
|
|
254
|
+
],
|
|
255
|
+
})
|
|
268
256
|
}
|
|
269
257
|
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
258
|
+
if (!allowDeleted) {
|
|
259
|
+
// exclude "deleted" domains
|
|
260
|
+
// when owner/resolver/registrant = null
|
|
261
|
+
whereFilters.push({
|
|
262
|
+
or: [
|
|
263
|
+
{
|
|
264
|
+
owner_not: EMPTY_ADDRESS,
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
resolver_not: null,
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
and: [
|
|
271
|
+
{
|
|
272
|
+
registrant_not: EMPTY_ADDRESS,
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
registrant_not: null,
|
|
276
|
+
},
|
|
277
|
+
],
|
|
278
|
+
},
|
|
279
|
+
],
|
|
280
|
+
})
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
if (searchString) {
|
|
284
|
+
// using labelName_contains instead of name_contains because name_contains
|
|
285
|
+
// includes the parent name
|
|
286
|
+
whereFilters.push({
|
|
287
|
+
labelName_contains: searchString,
|
|
288
|
+
})
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
const whereFilter: DomainFilter =
|
|
292
|
+
whereFilters.length > 1 ? { and: whereFilters } : whereFilters[0]
|
|
281
293
|
|
|
282
294
|
const query = gql`
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
295
|
+
query getNamesForAddress(
|
|
296
|
+
$orderBy: Domain_orderBy
|
|
297
|
+
$orderDirection: OrderDirection
|
|
298
|
+
$first: Int
|
|
299
|
+
$whereFilter: Domain_filter
|
|
300
|
+
) {
|
|
301
|
+
domains(
|
|
302
|
+
orderBy: $orderBy
|
|
303
|
+
orderDirection: $orderDirection
|
|
304
|
+
first: $first
|
|
305
|
+
where: $whereFilter
|
|
290
306
|
) {
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
}
|
|
298
|
-
) {
|
|
299
|
-
...DomainDetails
|
|
300
|
-
registration {
|
|
301
|
-
...RegistrationDetails
|
|
302
|
-
}
|
|
303
|
-
wrappedDomain {
|
|
304
|
-
...WrappedDomainDetails
|
|
305
|
-
}
|
|
307
|
+
...DomainDetails
|
|
308
|
+
registration {
|
|
309
|
+
...RegistrationDetails
|
|
310
|
+
}
|
|
311
|
+
wrappedDomain {
|
|
312
|
+
...WrappedDomainDetails
|
|
306
313
|
}
|
|
307
314
|
}
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
315
|
+
}
|
|
316
|
+
${domainDetailsFragment}
|
|
317
|
+
${registrationDetailsFragment}
|
|
318
|
+
${wrappedDomainDetailsFragment}
|
|
319
|
+
`
|
|
312
320
|
|
|
313
321
|
const result = await subgraphClient.request<
|
|
314
322
|
SubgraphResult,
|
|
315
323
|
{
|
|
316
|
-
address: string
|
|
317
324
|
orderBy: string
|
|
318
325
|
orderDirection: string
|
|
319
326
|
first: number
|
|
320
|
-
|
|
321
|
-
orderByStringVar: string
|
|
327
|
+
whereFilter: DomainFilter
|
|
322
328
|
}
|
|
323
329
|
>(query, {
|
|
324
|
-
address: address.toLowerCase(),
|
|
325
330
|
orderBy,
|
|
326
331
|
orderDirection,
|
|
327
332
|
first: pageSize,
|
|
328
|
-
|
|
329
|
-
orderByStringVar,
|
|
333
|
+
whereFilter,
|
|
330
334
|
})
|
|
331
335
|
|
|
332
336
|
if (!result) return []
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type { GraphQLClient } from 'graphql-request'
|
|
1
2
|
import { gql } from 'graphql-request'
|
|
2
|
-
import type { Address } from 'viem'
|
|
3
|
+
import type { Address, Hex } from 'viem'
|
|
3
4
|
import type { ClientWithEns } from '../../contracts/consts.js'
|
|
4
5
|
import type { DateWithValue } from '../../types.js'
|
|
5
6
|
import { namehash } from '../../utils/normalise.js'
|
|
@@ -73,6 +74,59 @@ type CustomResolverSubgraphResult = {
|
|
|
73
74
|
resolver?: ResolverResult
|
|
74
75
|
}
|
|
75
76
|
|
|
77
|
+
type GetResolverResultReturnType = {
|
|
78
|
+
domain: DomainResult
|
|
79
|
+
resolver: ResolverResult | undefined
|
|
80
|
+
} | null
|
|
81
|
+
|
|
82
|
+
const getCustomResolverResult = async (
|
|
83
|
+
subgraphClient: GraphQLClient,
|
|
84
|
+
{
|
|
85
|
+
id,
|
|
86
|
+
resolverAddress,
|
|
87
|
+
}: {
|
|
88
|
+
id: Hex
|
|
89
|
+
resolverAddress: Address
|
|
90
|
+
},
|
|
91
|
+
): Promise<GetResolverResultReturnType> => {
|
|
92
|
+
const resolverId = `${resolverAddress.toLowerCase()}-${id}`
|
|
93
|
+
const response = await subgraphClient.request<CustomResolverSubgraphResult>(
|
|
94
|
+
customResolverQuery,
|
|
95
|
+
{
|
|
96
|
+
id,
|
|
97
|
+
resolverId,
|
|
98
|
+
},
|
|
99
|
+
)
|
|
100
|
+
if (!response || !response.domain) return null
|
|
101
|
+
return {
|
|
102
|
+
domain: response.domain,
|
|
103
|
+
resolver: response.resolver,
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const getInheritedResolverResult = async (
|
|
108
|
+
subgraphClient: GraphQLClient,
|
|
109
|
+
{
|
|
110
|
+
id,
|
|
111
|
+
}: {
|
|
112
|
+
id: Hex
|
|
113
|
+
},
|
|
114
|
+
): Promise<GetResolverResultReturnType> => {
|
|
115
|
+
const response =
|
|
116
|
+
await subgraphClient.request<InheritedResolverSubgraphResult>(
|
|
117
|
+
inheritedResolverQuery,
|
|
118
|
+
{
|
|
119
|
+
id,
|
|
120
|
+
},
|
|
121
|
+
)
|
|
122
|
+
if (!response || !response.domain) return null
|
|
123
|
+
const { resolver, ...domain } = response.domain
|
|
124
|
+
return {
|
|
125
|
+
domain,
|
|
126
|
+
resolver,
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
76
130
|
/**
|
|
77
131
|
* Gets the records for a name from the subgraph
|
|
78
132
|
* @param client - {@link ClientWithEns}
|
|
@@ -82,7 +136,8 @@ type CustomResolverSubgraphResult = {
|
|
|
82
136
|
* @example
|
|
83
137
|
* import { createPublicClient, http } from 'viem'
|
|
84
138
|
* import { mainnet } from 'viem/chains'
|
|
85
|
-
* import { addEnsContracts
|
|
139
|
+
* import { addEnsContracts } from '@ensdomains/ensjs'
|
|
140
|
+
* import { getSubgraphRecords } from '@ensdomains/ensjs/subgraph'
|
|
86
141
|
*
|
|
87
142
|
* const client = createPublicClient({
|
|
88
143
|
* chain: addEnsContracts(mainnet),
|
|
@@ -103,39 +158,16 @@ const getSubgraphRecords = async (
|
|
|
103
158
|
const subgraphClient = createSubgraphClient({ client })
|
|
104
159
|
const id = namehash(name)
|
|
105
160
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
if (
|
|
110
|
-
|
|
111
|
-
const response = await subgraphClient.request<CustomResolverSubgraphResult>(
|
|
112
|
-
customResolverQuery,
|
|
113
|
-
{
|
|
114
|
-
id,
|
|
115
|
-
resolverId,
|
|
116
|
-
},
|
|
117
|
-
)
|
|
118
|
-
if (!response || !response.domain) return null
|
|
119
|
-
domainResult = response.domain
|
|
120
|
-
resolverResult = response.resolver
|
|
121
|
-
} else {
|
|
122
|
-
const response =
|
|
123
|
-
await subgraphClient.request<InheritedResolverSubgraphResult>(
|
|
124
|
-
inheritedResolverQuery,
|
|
125
|
-
{
|
|
126
|
-
id,
|
|
127
|
-
},
|
|
128
|
-
)
|
|
129
|
-
if (!response || !response.domain) return null
|
|
130
|
-
const { resolver, ...domain_ } = response.domain
|
|
131
|
-
resolverResult = resolver
|
|
132
|
-
domainResult = domain_
|
|
133
|
-
}
|
|
161
|
+
const result = resolverAddress
|
|
162
|
+
? await getCustomResolverResult(subgraphClient, { id, resolverAddress })
|
|
163
|
+
: await getInheritedResolverResult(subgraphClient, { id })
|
|
164
|
+
if (!result) return null
|
|
165
|
+
const { domain, resolver } = result
|
|
134
166
|
|
|
135
|
-
const { isMigrated, createdAt: stringCreatedAt } =
|
|
167
|
+
const { isMigrated, createdAt: stringCreatedAt } = domain
|
|
136
168
|
const intCreatedAt = parseInt(stringCreatedAt) * 1000
|
|
137
|
-
const texts =
|
|
138
|
-
const coins =
|
|
169
|
+
const texts = resolver?.texts || []
|
|
170
|
+
const coins = resolver?.coinTypes || []
|
|
139
171
|
|
|
140
172
|
return {
|
|
141
173
|
isMigrated,
|
|
@@ -39,7 +39,8 @@ type SubgraphResult = {
|
|
|
39
39
|
* @example
|
|
40
40
|
* import { createPublicClient, http } from 'viem'
|
|
41
41
|
* import { mainnet } from 'viem/chains'
|
|
42
|
-
* import { addEnsContracts
|
|
42
|
+
* import { addEnsContracts } from '@ensdomains/ensjs'
|
|
43
|
+
* import { getSubgraphRegistrant } from '@ensdomains/ensjs/subgraph'
|
|
43
44
|
*
|
|
44
45
|
* const client = createPublicClient({
|
|
45
46
|
* chain: addEnsContracts(mainnet),
|