@ensdomains/ensjs 3.0.0-beta.5 → 3.0.0-beta.6
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/cjs/clients/decorators/wallet.js +2 -0
- package/dist/cjs/clients/decorators/wallet.js.map +1 -1
- package/dist/cjs/contracts/consts.js +1 -1
- package/dist/cjs/errors/version.js +1 -1
- package/dist/cjs/functions/dns/getDnsImportData.js.map +1 -1
- package/dist/cjs/functions/dns/importDnsName.js.map +1 -1
- package/dist/cjs/functions/public/_getAddr.js +15 -13
- package/dist/cjs/functions/public/_getAddr.js.map +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 +51 -37
- 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.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/subgraph/getDecodedName.js.map +1 -1
- package/dist/cjs/functions/subgraph/getNameHistory.js.map +1 -1
- package/dist/cjs/functions/subgraph/getNamesForAddress.js +17 -10
- 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.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.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.map +1 -1
- package/dist/cjs/functions/wallet/setContentHashRecord.js.map +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.map +1 -1
- package/dist/cjs/subgraph.js +4 -1
- package/dist/cjs/subgraph.js.map +1 -1
- package/dist/cjs/utils/contentHash.js +5 -3
- package/dist/cjs/utils/contentHash.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/fuses.js +12 -9
- package/dist/cjs/utils/fuses.js.map +1 -1
- package/dist/cjs/utils/generateRecordCallArray.js +2 -7
- package/dist/cjs/utils/generateRecordCallArray.js.map +1 -1
- package/dist/cjs/utils/index.js +9 -2
- package/dist/cjs/utils/index.js.map +1 -1
- package/dist/cjs/utils/normaliseCoinId.js +15 -0
- package/dist/cjs/utils/normaliseCoinId.js.map +1 -0
- package/dist/cjs/wallet.js +3 -1
- package/dist/cjs/wallet.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/contracts/consts.js +1 -1
- package/dist/esm/errors/version.js +1 -1
- package/dist/esm/functions/dns/getDnsImportData.js +2 -1
- package/dist/esm/functions/dns/getDnsImportData.js.map +1 -1
- package/dist/esm/functions/dns/getDnsOwner.js +1 -1
- package/dist/esm/functions/dns/importDnsName.js +2 -1
- package/dist/esm/functions/dns/importDnsName.js.map +1 -1
- package/dist/esm/functions/public/_getAddr.js +15 -13
- package/dist/esm/functions/public/_getAddr.js.map +1 -1
- 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 +54 -39
- 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 +22 -0
- 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/subgraph/getDecodedName.js +2 -1
- package/dist/esm/functions/subgraph/getDecodedName.js.map +1 -1
- package/dist/esm/functions/subgraph/getNameHistory.js +2 -1
- package/dist/esm/functions/subgraph/getNameHistory.js.map +1 -1
- package/dist/esm/functions/subgraph/getNamesForAddress.js +21 -11
- 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 +2 -1
- package/dist/esm/functions/subgraph/getSubnames.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 +2 -1
- 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 +2 -1
- 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 +2 -1
- 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 +2 -1
- package/dist/esm/functions/wallet/wrapName.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 +2 -2
- package/dist/esm/utils/contentHash.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/fuses.js +11 -8
- package/dist/esm/utils/fuses.js.map +1 -1
- package/dist/esm/utils/generateRecordCallArray.js +3 -7
- package/dist/esm/utils/generateRecordCallArray.js.map +1 -1
- package/dist/esm/utils/index.js +3 -2
- package/dist/esm/utils/index.js.map +1 -1
- package/dist/esm/utils/normaliseCoinId.js +11 -0
- package/dist/esm/utils/normaliseCoinId.js.map +1 -0
- package/dist/esm/wallet.js +1 -0
- package/dist/esm/wallet.js.map +1 -1
- package/dist/types/clients/decorators/wallet.d.ts +28 -3
- package/dist/types/clients/decorators/wallet.d.ts.map +1 -1
- package/dist/types/clients/wallet.d.ts +10 -0
- package/dist/types/clients/wallet.d.ts.map +1 -1
- package/dist/types/contracts/consts.d.ts +1 -1
- package/dist/types/errors/version.d.ts +1 -1
- package/dist/types/functions/dns/getDnsImportData.d.ts +2 -1
- package/dist/types/functions/dns/getDnsImportData.d.ts.map +1 -1
- package/dist/types/functions/dns/getDnsOwner.d.ts +1 -1
- package/dist/types/functions/dns/importDnsName.d.ts +2 -1
- 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 +22 -0
- 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 +2 -1
- 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/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 +5 -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 +2 -1
- package/dist/types/functions/subgraph/getSubnames.d.ts.map +1 -1
- package/dist/types/functions/wallet/clearRecords.d.ts +552 -0
- package/dist/types/functions/wallet/clearRecords.d.ts.map +1 -0
- package/dist/types/functions/wallet/commitName.d.ts +3 -1
- package/dist/types/functions/wallet/commitName.d.ts.map +1 -1
- package/dist/types/functions/wallet/createSubname.d.ts +2 -1
- package/dist/types/functions/wallet/createSubname.d.ts.map +1 -1
- package/dist/types/functions/wallet/deleteSubname.d.ts +2 -1
- package/dist/types/functions/wallet/deleteSubname.d.ts.map +1 -1
- package/dist/types/functions/wallet/registerName.d.ts +4 -1
- package/dist/types/functions/wallet/registerName.d.ts.map +1 -1
- package/dist/types/functions/wallet/renewNames.d.ts +3 -1
- package/dist/types/functions/wallet/renewNames.d.ts.map +1 -1
- package/dist/types/functions/wallet/setAbiRecord.d.ts +3 -1
- package/dist/types/functions/wallet/setAbiRecord.d.ts.map +1 -1
- package/dist/types/functions/wallet/setAddressRecord.d.ts +2 -1
- package/dist/types/functions/wallet/setAddressRecord.d.ts.map +1 -1
- package/dist/types/functions/wallet/setChildFuses.d.ts +2 -1
- package/dist/types/functions/wallet/setChildFuses.d.ts.map +1 -1
- package/dist/types/functions/wallet/setContentHashRecord.d.ts +2 -1
- package/dist/types/functions/wallet/setContentHashRecord.d.ts.map +1 -1
- package/dist/types/functions/wallet/setFuses.d.ts +2 -1
- package/dist/types/functions/wallet/setFuses.d.ts.map +1 -1
- package/dist/types/functions/wallet/setPrimaryName.d.ts +2 -1
- package/dist/types/functions/wallet/setPrimaryName.d.ts.map +1 -1
- package/dist/types/functions/wallet/setRecords.d.ts +2 -1
- package/dist/types/functions/wallet/setRecords.d.ts.map +1 -1
- package/dist/types/functions/wallet/setResolver.d.ts +2 -1
- package/dist/types/functions/wallet/setResolver.d.ts.map +1 -1
- package/dist/types/functions/wallet/setTextRecord.d.ts +2 -1
- package/dist/types/functions/wallet/setTextRecord.d.ts.map +1 -1
- package/dist/types/functions/wallet/transferName.d.ts +2 -1
- package/dist/types/functions/wallet/transferName.d.ts.map +1 -1
- package/dist/types/functions/wallet/unwrapName.d.ts +2 -1
- package/dist/types/functions/wallet/unwrapName.d.ts.map +1 -1
- package/dist/types/functions/wallet/wrapName.d.ts +2 -1
- package/dist/types/functions/wallet/wrapName.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/utils/contentHash.d.ts +3 -0
- package/dist/types/utils/contentHash.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/fuses.d.ts +16 -16
- package/dist/types/utils/fuses.d.ts.map +1 -1
- package/dist/types/utils/generateRecordCallArray.d.ts.map +1 -1
- package/dist/types/utils/index.d.ts +3 -2
- package/dist/types/utils/index.d.ts.map +1 -1
- package/dist/types/utils/normaliseCoinId.d.ts +8 -0
- package/dist/types/utils/normaliseCoinId.d.ts.map +1 -0
- package/dist/types/wallet.d.ts +1 -0
- package/dist/types/wallet.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/clients/decorators/wallet.ts +41 -3
- package/src/contracts/consts.ts +1 -1
- package/src/errors/version.ts +1 -1
- package/src/functions/dns/getDnsImportData.ts +2 -1
- package/src/functions/dns/getDnsOwner.ts +1 -1
- package/src/functions/dns/importDnsName.ts +2 -1
- package/src/functions/public/_getAddr.ts +21 -13
- 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 +2 -1
- package/src/functions/public/getOwner.ts +54 -33
- package/src/functions/public/getPrice.ts +3 -2
- package/src/functions/public/getRecords.ts +124 -104
- package/src/functions/public/getResolver.ts +2 -1
- package/src/functions/public/getSupportedInterfaces.ts +22 -0
- package/src/functions/public/getTextRecord.ts +2 -1
- package/src/functions/public/getWrapperData.ts +2 -1
- package/src/functions/public/getWrapperName.ts +2 -1
- package/src/functions/subgraph/getDecodedName.ts +2 -1
- package/src/functions/subgraph/getNameHistory.ts +2 -1
- package/src/functions/subgraph/getNamesForAddress.ts +31 -11
- package/src/functions/subgraph/getSubgraphRecords.ts +65 -33
- package/src/functions/subgraph/getSubgraphRegistrant.ts +2 -1
- package/src/functions/subgraph/getSubnames.ts +2 -1
- package/src/functions/wallet/clearRecords.ts +97 -0
- package/src/functions/wallet/commitName.ts +3 -1
- package/src/functions/wallet/createSubname.ts +2 -1
- 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 +2 -1
- package/src/functions/wallet/setContentHashRecord.ts +2 -1
- package/src/functions/wallet/setFuses.ts +2 -1
- 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 +2 -1
- package/src/functions/wallet/unwrapName.ts +2 -1
- package/src/functions/wallet/wrapName.ts +2 -1
- package/src/subgraph.ts +5 -0
- package/src/utils/contentHash.ts +2 -2
- package/src/utils/encoders/encodeClearRecords.ts +9 -0
- package/src/utils/fuses.ts +27 -23
- package/src/utils/generateRecordCallArray.ts +3 -9
- package/src/utils/index.ts +9 -0
- package/src/utils/normaliseCoinId.ts +11 -0
- package/src/wallet.ts +7 -0
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import type { Account, Transport, WalletClient } from 'viem'
|
|
2
2
|
import type { ChainWithEns } from '../../contracts/consts.js'
|
|
3
|
+
import clearRecords, {
|
|
4
|
+
type ClearRecordsParameters,
|
|
5
|
+
type ClearRecordsReturnType,
|
|
6
|
+
} from '../../functions/wallet/clearRecords.js'
|
|
3
7
|
import commitName, {
|
|
4
8
|
type CommitNameParameters,
|
|
5
9
|
type CommitNameReturnType,
|
|
@@ -73,6 +77,35 @@ export type EnsWalletActions<
|
|
|
73
77
|
TChain extends ChainWithEns,
|
|
74
78
|
TAccount extends Account | undefined,
|
|
75
79
|
> = {
|
|
80
|
+
/**
|
|
81
|
+
* Clears the records for a name on a resolver.
|
|
82
|
+
* @param parameters - {@link ClearRecordsParameters}
|
|
83
|
+
* @returns Transaction hash. {@link ClearRecordsReturnType}
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* import { createWalletClient, custom } from 'viem'
|
|
87
|
+
* import { mainnet } from 'viem/chains'
|
|
88
|
+
* import { addEnsContracts, ensWalletActions } from '@ensdomains/ensjs'
|
|
89
|
+
*
|
|
90
|
+
* const wallet = createWalletClient({
|
|
91
|
+
* chain: addEnsContracts(mainnet),
|
|
92
|
+
* transport: custom(window.ethereum),
|
|
93
|
+
* }).extend(ensWalletActions)
|
|
94
|
+
* const hash = await wallet.clearRecords({
|
|
95
|
+
* name: 'ens.eth',
|
|
96
|
+
* resolverAddress: '0x4976fb03C32e5B8cfe2b6cCB31c09Ba78EBaBa41',
|
|
97
|
+
* })
|
|
98
|
+
* // 0x...
|
|
99
|
+
*/
|
|
100
|
+
clearRecords: ({
|
|
101
|
+
name,
|
|
102
|
+
resolverAddress,
|
|
103
|
+
...txArgs
|
|
104
|
+
}: ClearRecordsParameters<
|
|
105
|
+
TChain,
|
|
106
|
+
TAccount,
|
|
107
|
+
TChain
|
|
108
|
+
>) => Promise<ClearRecordsReturnType>
|
|
76
109
|
/**
|
|
77
110
|
* Commits a name to be registered
|
|
78
111
|
* @param parameters - {@link CommitNameParameters}
|
|
@@ -81,7 +114,8 @@ export type EnsWalletActions<
|
|
|
81
114
|
* @example
|
|
82
115
|
* import { createWalletClient, custom } from 'viem'
|
|
83
116
|
* import { mainnet } from 'viem/chains'
|
|
84
|
-
* import { addEnsContracts, ensWalletActions
|
|
117
|
+
* import { addEnsContracts, ensWalletActions } from '@ensdomains/ensjs'
|
|
118
|
+
* import { randomSecret } from '@ensdomains/ensjs/utils'
|
|
85
119
|
*
|
|
86
120
|
* const wallet = createWalletClient({
|
|
87
121
|
* chain: addEnsContracts(mainnet),
|
|
@@ -183,7 +217,8 @@ export type EnsWalletActions<
|
|
|
183
217
|
* @example
|
|
184
218
|
* import { createPublicClient, createWalletClient, http, custom } from 'viem'
|
|
185
219
|
* import { mainnet } from 'viem/chains'
|
|
186
|
-
* import { addEnsContracts, ensPublicActions, ensWalletActions
|
|
220
|
+
* import { addEnsContracts, ensPublicActions, ensWalletActions } from '@ensdomains/ensjs'
|
|
221
|
+
* import { randomSecret } from '@ensdomains/ensjs/utils'
|
|
187
222
|
*
|
|
188
223
|
* const mainnetWithEns = addEnsContracts(mainnet)
|
|
189
224
|
* const client = createPublicClient({
|
|
@@ -279,7 +314,8 @@ export type EnsWalletActions<
|
|
|
279
314
|
* import abi from './abi.json'
|
|
280
315
|
* import { createWalletClient, custom } from 'viem'
|
|
281
316
|
* import { mainnet } from 'viem/chains'
|
|
282
|
-
* import { addEnsContracts, ensWalletActions
|
|
317
|
+
* import { addEnsContracts, ensWalletActions } from '@ensdomains/ensjs'
|
|
318
|
+
* import { encodeAbi } from '@ensdomains/ensjs/utils'
|
|
283
319
|
*
|
|
284
320
|
* const wallet = createWalletClient({
|
|
285
321
|
* chain: addEnsContracts(mainnet),
|
|
@@ -492,6 +528,7 @@ export type EnsWalletActions<
|
|
|
492
528
|
setRecords: ({
|
|
493
529
|
name,
|
|
494
530
|
resolverAddress,
|
|
531
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
495
532
|
clearRecords,
|
|
496
533
|
contentHash,
|
|
497
534
|
texts,
|
|
@@ -687,6 +724,7 @@ export const ensWalletActions = <
|
|
|
687
724
|
>(
|
|
688
725
|
client: WalletClient<TTransport, TChain, TAccount>,
|
|
689
726
|
): EnsWalletActions<TChain, TAccount> => ({
|
|
727
|
+
clearRecords: (parameters) => clearRecords(client, parameters),
|
|
690
728
|
commitName: (parameters) => commitName(client, parameters),
|
|
691
729
|
createSubname: (parameters) => createSubname(client, parameters),
|
|
692
730
|
deleteSubname: (parameters) => deleteSubname(client, parameters),
|
package/src/contracts/consts.ts
CHANGED
|
@@ -79,7 +79,7 @@ export const addresses = {
|
|
|
79
79
|
address: '0x114D4603199df73e7D157787f8778E21fCd13066',
|
|
80
80
|
},
|
|
81
81
|
ensPublicResolver: {
|
|
82
|
-
address: '
|
|
82
|
+
address: '0xd7a4F6473f32aC2Af804B3686AE8F1932bC35750',
|
|
83
83
|
},
|
|
84
84
|
ensReverseRegistrar: {
|
|
85
85
|
address: '0x6d9F26FfBcF1c6f0bAe9F2C1f7fBe8eE6B1d8d4d',
|
package/src/errors/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = 'v3.0.0-beta.
|
|
1
|
+
export const version = 'v3.0.0-beta.6'
|
|
@@ -51,7 +51,8 @@ const encodeProofs = (
|
|
|
51
51
|
* @example
|
|
52
52
|
* import { createPublicClient, http } from 'viem'
|
|
53
53
|
* import { mainnet } from 'viem/chains'
|
|
54
|
-
* import { addEnsContracts
|
|
54
|
+
* import { addEnsContracts } from '@ensdomains/ensjs'
|
|
55
|
+
* import { getDnsImportData } from '@ensdomains/ensjs/dns'
|
|
55
56
|
*
|
|
56
57
|
* const client = createPublicClient({
|
|
57
58
|
* chain: addEnsContracts(mainnet),
|
|
@@ -82,7 +82,7 @@ type DnsResponse = {
|
|
|
82
82
|
* @returns Address of DNS owner. {@link GetDnsOwnerReturnType}
|
|
83
83
|
*
|
|
84
84
|
* @example
|
|
85
|
-
* import { getDnsOwner } from '@ensdomains/ensjs'
|
|
85
|
+
* import { getDnsOwner } from '@ensdomains/ensjs/dns'
|
|
86
86
|
*
|
|
87
87
|
* const owner = await getDnsOwner({ name: 'ens.domains' })
|
|
88
88
|
* // '0xb8c2C29ee19D8307cb7255e1Cd9CbDE883A267d5'
|
|
@@ -129,7 +129,8 @@ export const makeFunctionData = <
|
|
|
129
129
|
* @example
|
|
130
130
|
* import { createPublicClient, createWalletClient, http, custom } from 'viem'
|
|
131
131
|
* import { mainnet } from 'viem/chains'
|
|
132
|
-
* import { addEnsContracts
|
|
132
|
+
* import { addEnsContracts } from '@ensdomains/ensjs'
|
|
133
|
+
* import { getDnsImportData, importDnsName } from '@ensdomains/ensjs/dns'
|
|
133
134
|
*
|
|
134
135
|
* const mainnetWithEns = addEnsContracts(mainnet)
|
|
135
136
|
* const client = createPublicClient({
|
|
@@ -15,6 +15,7 @@ import type {
|
|
|
15
15
|
} from '../../types.js'
|
|
16
16
|
import { EMPTY_ADDRESS } from '../../utils/consts.js'
|
|
17
17
|
import { generateFunction } from '../../utils/generateFunction.js'
|
|
18
|
+
import { normaliseCoinId } from '../../utils/normaliseCoinId.js'
|
|
18
19
|
|
|
19
20
|
export type InternalGetAddrParameters = {
|
|
20
21
|
/** Name to get the address record for */
|
|
@@ -31,7 +32,11 @@ const encode = (
|
|
|
31
32
|
_client: ClientWithEns,
|
|
32
33
|
{ name, coin = 60, bypassFormat }: InternalGetAddrParameters,
|
|
33
34
|
): SimpleTransactionRequest => {
|
|
34
|
-
|
|
35
|
+
const normalisedCoin = normaliseCoinId(coin)
|
|
36
|
+
if (
|
|
37
|
+
(normalisedCoin.type === 'id' && normalisedCoin.value === 60) ||
|
|
38
|
+
(normalisedCoin.type === 'name' && normalisedCoin.value === 'ETH')
|
|
39
|
+
) {
|
|
35
40
|
return {
|
|
36
41
|
to: EMPTY_ADDRESS,
|
|
37
42
|
data: encodeFunctionData({
|
|
@@ -53,11 +58,12 @@ const encode = (
|
|
|
53
58
|
}
|
|
54
59
|
}
|
|
55
60
|
const formatter =
|
|
56
|
-
|
|
57
|
-
? formatsByName[
|
|
58
|
-
: formatsByCoinType[
|
|
61
|
+
normalisedCoin.type === 'name'
|
|
62
|
+
? formatsByName[normalisedCoin.value]
|
|
63
|
+
: formatsByCoinType[normalisedCoin.value]
|
|
59
64
|
|
|
60
|
-
if (!formatter)
|
|
65
|
+
if (!formatter)
|
|
66
|
+
throw new CoinFormatterNotFoundError({ coinType: normalisedCoin.value })
|
|
61
67
|
|
|
62
68
|
return {
|
|
63
69
|
to: EMPTY_ADDRESS,
|
|
@@ -72,21 +78,23 @@ const encode = (
|
|
|
72
78
|
const decode = async (
|
|
73
79
|
_client: ClientWithEns,
|
|
74
80
|
data: Hex,
|
|
75
|
-
{ coin }: InternalGetAddrParameters,
|
|
81
|
+
{ coin = 60 }: InternalGetAddrParameters,
|
|
76
82
|
): Promise<InternalGetAddrReturnType> => {
|
|
77
83
|
if (data === '0x') return null
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
84
|
+
|
|
85
|
+
const normalisedCoin = normaliseCoinId(coin)
|
|
81
86
|
|
|
82
87
|
const formatter =
|
|
83
|
-
|
|
84
|
-
? formatsByName[
|
|
85
|
-
: formatsByCoinType[
|
|
88
|
+
normalisedCoin.type === 'name'
|
|
89
|
+
? formatsByName[normalisedCoin.value]
|
|
90
|
+
: formatsByCoinType[normalisedCoin.value]
|
|
86
91
|
|
|
87
92
|
let response: Hex
|
|
88
93
|
|
|
89
|
-
if (
|
|
94
|
+
if (
|
|
95
|
+
(normalisedCoin.type === 'id' && normalisedCoin.value === 60) ||
|
|
96
|
+
(normalisedCoin.type === 'name' && normalisedCoin.value === 'ETH')
|
|
97
|
+
) {
|
|
90
98
|
response = decodeFunctionResult({
|
|
91
99
|
abi: publicResolverSingleAddrSnippet,
|
|
92
100
|
functionName: 'addr',
|
|
@@ -75,7 +75,8 @@ type BatchableFunctionObject = GeneratedFunction<typeof encode, typeof decode>
|
|
|
75
75
|
* @example
|
|
76
76
|
* import { createPublicClient, http } from 'viem'
|
|
77
77
|
* import { mainnet } from 'viem/chains'
|
|
78
|
-
* import { addEnsContracts
|
|
78
|
+
* import { addEnsContracts } from '@ensdomains/ensjs'
|
|
79
|
+
* import { batch, getTextRecord, getAddressRecord } from '@ensdomains/ensjs/public'
|
|
79
80
|
*
|
|
80
81
|
* const client = createPublicClient({
|
|
81
82
|
* chain: addEnsContracts(mainnet),
|
|
@@ -47,7 +47,8 @@ type BatchableFunctionObject = GeneratedFunction<typeof encode, typeof decode>
|
|
|
47
47
|
* @example
|
|
48
48
|
* import { createPublicClient, http } from 'viem'
|
|
49
49
|
* import { mainnet } from 'viem/chains'
|
|
50
|
-
* import { addEnsContracts
|
|
50
|
+
* import { addEnsContracts } from '@ensdomains/ensjs'
|
|
51
|
+
* import { getAbiRecord } from '@ensdomains/ensjs/public'
|
|
51
52
|
*
|
|
52
53
|
* const client = createPublicClient({
|
|
53
54
|
* chain: addEnsContracts(mainnet),
|
|
@@ -48,7 +48,8 @@ type BatchableFunctionObject = GeneratedFunction<typeof encode, typeof decode>
|
|
|
48
48
|
* @example
|
|
49
49
|
* import { createPublicClient, http } from 'viem'
|
|
50
50
|
* import { mainnet } from 'viem/chains'
|
|
51
|
-
* import { addEnsContracts
|
|
51
|
+
* import { addEnsContracts } from '@ensdomains/ensjs'
|
|
52
|
+
* import { getAddressRecord } from '@ensdomains/ensjs/public'
|
|
52
53
|
*
|
|
53
54
|
* const client = createPublicClient({
|
|
54
55
|
* chain: addEnsContracts(mainnet),
|
|
@@ -73,7 +73,8 @@ type BatchableFunctionObject = GeneratedFunction<typeof encode, typeof decode>
|
|
|
73
73
|
* @example
|
|
74
74
|
* import { createPublicClient, http } from 'viem'
|
|
75
75
|
* import { mainnet } from 'viem/chains'
|
|
76
|
-
* import { addEnsContracts
|
|
76
|
+
* import { addEnsContracts } from '@ensdomains/ensjs'
|
|
77
|
+
* import { getAvailable } from '@ensdomains/ensjs/public'
|
|
77
78
|
*
|
|
78
79
|
* const client = createPublicClient({
|
|
79
80
|
* chain: addEnsContracts(mainnet),
|
|
@@ -49,7 +49,8 @@ type BatchableFunctionObject = GeneratedFunction<typeof encode, typeof decode>
|
|
|
49
49
|
* @example
|
|
50
50
|
* import { createPublicClient, http } from 'viem'
|
|
51
51
|
* import { mainnet } from 'viem/chains'
|
|
52
|
-
* import { addEnsContracts
|
|
52
|
+
* import { addEnsContracts } from '@ensdomains/ensjs'
|
|
53
|
+
* import { getContentHashRecord } from '@ensdomains/ensjs/public'
|
|
53
54
|
*
|
|
54
55
|
* const client = createPublicClient({
|
|
55
56
|
* chain: addEnsContracts(mainnet),
|
|
@@ -181,7 +181,8 @@ type BatchableFunctionObject = GeneratedFunction<typeof encode, typeof decode>
|
|
|
181
181
|
* @example
|
|
182
182
|
* import { createPublicClient, http } from 'viem'
|
|
183
183
|
* import { mainnet } from 'viem/chains'
|
|
184
|
-
* import { addEnsContracts
|
|
184
|
+
* import { addEnsContracts } from '@ensdomains/ensjs'
|
|
185
|
+
* import { getExpiry } from '@ensdomains/ensjs/public'
|
|
185
186
|
*
|
|
186
187
|
* const client = createPublicClient({
|
|
187
188
|
* chain: addEnsContracts(mainnet),
|
|
@@ -110,7 +110,8 @@ type BatchableFunctionObject = GeneratedFunction<typeof encode, typeof decode>
|
|
|
110
110
|
* @example
|
|
111
111
|
* import { createPublicClient, http } from 'viem'
|
|
112
112
|
* import { mainnet } from 'viem/chains'
|
|
113
|
-
* import { addEnsContracts
|
|
113
|
+
* import { addEnsContracts } from '@ensdomains/ensjs'
|
|
114
|
+
* import { getName } from '@ensdomains/ensjs/public'
|
|
114
115
|
*
|
|
115
116
|
* const client = createPublicClient({
|
|
116
117
|
* chain: addEnsContracts(mainnet),
|
|
@@ -3,10 +3,7 @@ import type { ClientWithEns } from '../../contracts/consts.js'
|
|
|
3
3
|
import { getChainContractAddress } from '../../contracts/getChainContractAddress.js'
|
|
4
4
|
import type { SimpleTransactionRequest } from '../../types.js'
|
|
5
5
|
import { EMPTY_ADDRESS } from '../../utils/consts.js'
|
|
6
|
-
import {
|
|
7
|
-
generateFunction,
|
|
8
|
-
type GeneratedFunction,
|
|
9
|
-
} from '../../utils/generateFunction.js'
|
|
6
|
+
import { generateFunction } from '../../utils/generateFunction.js'
|
|
10
7
|
import { namehash as makeNamehash } from '../../utils/normalise.js'
|
|
11
8
|
import {
|
|
12
9
|
ownerFromContract,
|
|
@@ -15,11 +12,13 @@ import {
|
|
|
15
12
|
import { checkIsDotEth } from '../../utils/validation.js'
|
|
16
13
|
import multicallWrapper from './multicallWrapper.js'
|
|
17
14
|
|
|
18
|
-
export type GetOwnerParameters
|
|
15
|
+
export type GetOwnerParameters<
|
|
16
|
+
TContract extends OwnerContract | undefined = undefined,
|
|
17
|
+
> = {
|
|
19
18
|
/** Name to get owner for */
|
|
20
19
|
name: string
|
|
21
20
|
/** Optional specific contract to get ownership value from */
|
|
22
|
-
contract?:
|
|
21
|
+
contract?: TContract
|
|
23
22
|
}
|
|
24
23
|
|
|
25
24
|
type BaseGetOwnerReturnType = {
|
|
@@ -55,19 +54,22 @@ type UnwrappedOwnership = {
|
|
|
55
54
|
ownershipLevel: 'registry'
|
|
56
55
|
}
|
|
57
56
|
|
|
58
|
-
export type GetOwnerReturnType
|
|
57
|
+
export type GetOwnerReturnType<
|
|
58
|
+
TContract extends OwnerContract | undefined = undefined,
|
|
59
|
+
> =
|
|
59
60
|
| (BaseGetOwnerReturnType &
|
|
60
|
-
(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
(TContract extends 'registrar'
|
|
62
|
+
? RegistrarOnlyOwnership
|
|
63
|
+
: TContract extends 'nameWrapper'
|
|
64
|
+
? WrappedOwnership
|
|
65
|
+
: TContract extends 'registry'
|
|
66
|
+
? UnwrappedOwnership
|
|
67
|
+
: WrappedOwnership | UnwrappedEth2ldOwnership | UnwrappedOwnership))
|
|
66
68
|
| null
|
|
67
69
|
|
|
68
|
-
const encode = (
|
|
70
|
+
const encode = <TContract extends OwnerContract | undefined = undefined>(
|
|
69
71
|
client: ClientWithEns,
|
|
70
|
-
{ name, contract }: GetOwnerParameters
|
|
72
|
+
{ name, contract }: GetOwnerParameters<TContract>,
|
|
71
73
|
): SimpleTransactionRequest => {
|
|
72
74
|
const namehash = makeNamehash(name)
|
|
73
75
|
const labels = name.split('.')
|
|
@@ -102,13 +104,13 @@ const encode = (
|
|
|
102
104
|
}
|
|
103
105
|
|
|
104
106
|
const addressDecode = (data: Hex) =>
|
|
105
|
-
decodeAbiParameters([{ type: 'address' }], data)[0]
|
|
107
|
+
decodeAbiParameters([{ type: 'address' }], data)[0] as Address
|
|
106
108
|
|
|
107
|
-
const decode = async (
|
|
109
|
+
const decode = async <TContract extends OwnerContract | undefined = undefined>(
|
|
108
110
|
client: ClientWithEns,
|
|
109
111
|
data: Hex | BaseError,
|
|
110
|
-
{ name, contract }: GetOwnerParameters
|
|
111
|
-
): Promise<GetOwnerReturnType
|
|
112
|
+
{ name, contract }: GetOwnerParameters<TContract>,
|
|
113
|
+
): Promise<GetOwnerReturnType<TContract>> => {
|
|
112
114
|
if (typeof data === 'object') throw data
|
|
113
115
|
const labels = name.split('.')
|
|
114
116
|
if (contract || labels.length === 1) {
|
|
@@ -117,12 +119,12 @@ const decode = async (
|
|
|
117
119
|
return {
|
|
118
120
|
ownershipLevel: 'registrar',
|
|
119
121
|
registrant: singleOwner,
|
|
120
|
-
} as
|
|
122
|
+
} as GetOwnerReturnType<TContract>
|
|
121
123
|
}
|
|
122
124
|
return {
|
|
123
125
|
ownershipLevel: contract || 'registry',
|
|
124
126
|
owner: singleOwner,
|
|
125
|
-
} as
|
|
127
|
+
} as GetOwnerReturnType<TContract>
|
|
126
128
|
}
|
|
127
129
|
|
|
128
130
|
const result = await multicallWrapper.decode(client, data, [])
|
|
@@ -150,7 +152,7 @@ const decode = async (
|
|
|
150
152
|
return {
|
|
151
153
|
owner: nameWrapperOwner,
|
|
152
154
|
ownershipLevel: 'nameWrapper',
|
|
153
|
-
} as
|
|
155
|
+
} as GetOwnerReturnType<TContract>
|
|
154
156
|
}
|
|
155
157
|
// if there is a registrar owner, then it's not a subdomain but we have also passed the namewrapper clause
|
|
156
158
|
// this means that it's an unwrapped second-level name
|
|
@@ -161,7 +163,7 @@ const decode = async (
|
|
|
161
163
|
registrant: registrarOwner!,
|
|
162
164
|
owner: registryOwner!,
|
|
163
165
|
ownershipLevel: 'registrar',
|
|
164
|
-
} as
|
|
166
|
+
} as GetOwnerReturnType<TContract>
|
|
165
167
|
}
|
|
166
168
|
if (registryOwner !== EMPTY_ADDRESS) {
|
|
167
169
|
// if there is no registrar owner, but the label length is two, then the domain is an expired 2LD .eth
|
|
@@ -171,7 +173,7 @@ const decode = async (
|
|
|
171
173
|
registrant: null,
|
|
172
174
|
owner: registryOwner,
|
|
173
175
|
ownershipLevel: 'registrar',
|
|
174
|
-
} as
|
|
176
|
+
} as GetOwnerReturnType<TContract>
|
|
175
177
|
}
|
|
176
178
|
// this means that the subname is wrapped
|
|
177
179
|
if (
|
|
@@ -182,13 +184,13 @@ const decode = async (
|
|
|
182
184
|
return {
|
|
183
185
|
owner: nameWrapperOwner,
|
|
184
186
|
ownershipLevel: 'nameWrapper',
|
|
185
|
-
} as
|
|
187
|
+
} as GetOwnerReturnType<TContract>
|
|
186
188
|
}
|
|
187
189
|
// unwrapped subnames do not have NFTs associated, so do not have a registrant
|
|
188
190
|
return {
|
|
189
191
|
owner: registryOwner,
|
|
190
192
|
ownershipLevel: 'registry',
|
|
191
|
-
} as
|
|
193
|
+
} as GetOwnerReturnType<TContract>
|
|
192
194
|
}
|
|
193
195
|
// .eth names with no registrar owner are either unregistered or expired
|
|
194
196
|
return null
|
|
@@ -206,7 +208,7 @@ const decode = async (
|
|
|
206
208
|
return {
|
|
207
209
|
owner: nameWrapperOwner,
|
|
208
210
|
ownershipLevel: 'nameWrapper',
|
|
209
|
-
} as
|
|
211
|
+
} as GetOwnerReturnType<TContract>
|
|
210
212
|
}
|
|
211
213
|
|
|
212
214
|
// for unwrapped non .eth names, the owner is the registry owner
|
|
@@ -214,14 +216,30 @@ const decode = async (
|
|
|
214
216
|
return {
|
|
215
217
|
owner: registryOwner,
|
|
216
218
|
ownershipLevel: 'registry',
|
|
217
|
-
} as
|
|
219
|
+
} as GetOwnerReturnType<TContract>
|
|
218
220
|
}
|
|
219
221
|
|
|
220
222
|
// for anything else, return
|
|
221
223
|
return null
|
|
222
224
|
}
|
|
223
225
|
|
|
224
|
-
type
|
|
226
|
+
type EncoderFunction = typeof encode
|
|
227
|
+
type DecoderFunction = typeof decode
|
|
228
|
+
|
|
229
|
+
type BatchableFunctionObject = {
|
|
230
|
+
encode: EncoderFunction
|
|
231
|
+
decode: DecoderFunction
|
|
232
|
+
batch: <
|
|
233
|
+
TContract extends OwnerContract | undefined = undefined,
|
|
234
|
+
TParams extends GetOwnerParameters<TContract> = GetOwnerParameters<TContract>,
|
|
235
|
+
>(
|
|
236
|
+
args: TParams,
|
|
237
|
+
) => {
|
|
238
|
+
args: [TParams]
|
|
239
|
+
encode: EncoderFunction
|
|
240
|
+
decode: typeof decode<TContract>
|
|
241
|
+
}
|
|
242
|
+
}
|
|
225
243
|
|
|
226
244
|
/**
|
|
227
245
|
* Gets the owner(s) of a name.
|
|
@@ -232,7 +250,8 @@ type BatchableFunctionObject = GeneratedFunction<typeof encode, typeof decode>
|
|
|
232
250
|
* @example
|
|
233
251
|
* import { createPublicClient, http } from 'viem'
|
|
234
252
|
* import { mainnet } from 'viem/chains'
|
|
235
|
-
* import { addEnsContracts
|
|
253
|
+
* import { addEnsContracts } from '@ensdomains/ensjs'
|
|
254
|
+
* import { getOwner } from '@ensdomains/ensjs/public'
|
|
236
255
|
*
|
|
237
256
|
* const client = createPublicClient({
|
|
238
257
|
* chain: addEnsContracts(mainnet),
|
|
@@ -241,10 +260,12 @@ type BatchableFunctionObject = GeneratedFunction<typeof encode, typeof decode>
|
|
|
241
260
|
* const result = await getOwner(client, { name: 'ens.eth' })
|
|
242
261
|
* // { owner: '0xb6E040C9ECAaE172a89bD561c5F73e1C48d28cd9', registrant: '0xb6E040C9ECAaE172a89bD561c5F73e1C48d28cd9', ownershipLevel: 'registrar }
|
|
243
262
|
*/
|
|
244
|
-
const getOwner = generateFunction({ encode, decode }) as (
|
|
263
|
+
const getOwner = generateFunction({ encode, decode }) as (<
|
|
264
|
+
TContract extends OwnerContract | undefined = undefined,
|
|
265
|
+
>(
|
|
245
266
|
client: ClientWithEns,
|
|
246
|
-
{ name, contract }: GetOwnerParameters
|
|
247
|
-
) => Promise<GetOwnerReturnType
|
|
267
|
+
{ name, contract }: GetOwnerParameters<TContract>,
|
|
268
|
+
) => Promise<GetOwnerReturnType<TContract>>) &
|
|
248
269
|
BatchableFunctionObject
|
|
249
270
|
|
|
250
271
|
export default getOwner
|
|
@@ -129,13 +129,14 @@ type BatchableFunctionObject = GeneratedFunction<typeof encode, typeof decode>
|
|
|
129
129
|
* @example
|
|
130
130
|
* import { createPublicClient, http } from 'viem'
|
|
131
131
|
* import { mainnet } from 'viem/chains'
|
|
132
|
-
* import { addEnsContracts
|
|
132
|
+
* import { addEnsContracts } from '@ensdomains/ensjs'
|
|
133
|
+
* import { getPrice } from '@ensdomains/ensjs/public'
|
|
133
134
|
*
|
|
134
135
|
* const client = createPublicClient({
|
|
135
136
|
* chain: addEnsContracts(mainnet),
|
|
136
137
|
* transport: http(),
|
|
137
138
|
* })
|
|
138
|
-
* const result = await getPrice(client, { nameOrNames: 'ens.eth' })
|
|
139
|
+
* const result = await getPrice(client, { nameOrNames: 'ens.eth', duration: 31536000 })
|
|
139
140
|
* // { base: 352828971668930335n, premium: 0n }
|
|
140
141
|
*/
|
|
141
142
|
const getPrice = generateFunction({ encode, decode }) as ((
|