@ensdomains/ensjs-query-core 0.0.1

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.
Files changed (68) hide show
  1. package/LICENSE +21 -0
  2. package/package.json +85 -0
  3. package/src/actions/public/getAbiRecord.ts +39 -0
  4. package/src/actions/public/getAddressRecord.ts +38 -0
  5. package/src/actions/public/getAvailable.ts +39 -0
  6. package/src/actions/public/getContentHashRecord.ts +41 -0
  7. package/src/actions/public/getCredentials.ts +39 -0
  8. package/src/actions/public/getExpiry.ts +42 -0
  9. package/src/actions/public/getName.ts +39 -0
  10. package/src/actions/public/getOwner.ts +45 -0
  11. package/src/actions/public/getPrice.ts +42 -0
  12. package/src/actions/public/getRecords.ts +69 -0
  13. package/src/actions/public/getResolver.ts +39 -0
  14. package/src/actions/public/getSupportedInterfaces.ts +53 -0
  15. package/src/actions/public/getTextRecord.ts +39 -0
  16. package/src/actions/public/getWrapperData.ts +39 -0
  17. package/src/actions/public/getWrapperName.ts +39 -0
  18. package/src/actions/public/resolveNameData.ts +46 -0
  19. package/src/actions/wallet/clearRecords.ts +69 -0
  20. package/src/actions/wallet/commitName.ts +62 -0
  21. package/src/actions/wallet/createSubname.ts +67 -0
  22. package/src/actions/wallet/deleteSubname.ts +64 -0
  23. package/src/actions/wallet/index.ts +84 -0
  24. package/src/actions/wallet/registerName.ts +62 -0
  25. package/src/actions/wallet/renewNames.ts +65 -0
  26. package/src/actions/wallet/setAbiRecord.ts +63 -0
  27. package/src/actions/wallet/setAddressRecord.ts +58 -0
  28. package/src/actions/wallet/setContentHashRecord.ts +63 -0
  29. package/src/actions/wallet/setPrimaryName.ts +67 -0
  30. package/src/actions/wallet/setRecords.ts +62 -0
  31. package/src/actions/wallet/setResolver.ts +62 -0
  32. package/src/actions/wallet/setTextRecord.ts +58 -0
  33. package/src/actions/wallet/transferName.ts +73 -0
  34. package/src/example.ts +39 -0
  35. package/src/query/public/getAbiRecord.ts +61 -0
  36. package/src/query/public/getAddressRecord.ts +61 -0
  37. package/src/query/public/getAvailable.ts +61 -0
  38. package/src/query/public/getContentHashRecord.ts +61 -0
  39. package/src/query/public/getCredentials.ts +61 -0
  40. package/src/query/public/getExpiry.ts +64 -0
  41. package/src/query/public/getName.ts +61 -0
  42. package/src/query/public/getOwner.ts +67 -0
  43. package/src/query/public/getPrice.ts +65 -0
  44. package/src/query/public/getRecords.ts +83 -0
  45. package/src/query/public/getResolver.ts +61 -0
  46. package/src/query/public/getSupportedInterfaces.ts +80 -0
  47. package/src/query/public/getTextRecord.ts +62 -0
  48. package/src/query/public/getWrapperData.ts +61 -0
  49. package/src/query/public/getWrapperName.ts +61 -0
  50. package/src/query/public/index.ts +134 -0
  51. package/src/query/utils.ts +26 -0
  52. package/src/query/wallet/clearRecords.ts +54 -0
  53. package/src/query/wallet/commitName.ts +54 -0
  54. package/src/query/wallet/createSubname.ts +57 -0
  55. package/src/query/wallet/deleteSubname.ts +54 -0
  56. package/src/query/wallet/index.ts +85 -0
  57. package/src/query/wallet/registerName.ts +54 -0
  58. package/src/query/wallet/renewNames.ts +57 -0
  59. package/src/query/wallet/setAbiRecord.ts +53 -0
  60. package/src/query/wallet/setAddressRecord.ts +50 -0
  61. package/src/query/wallet/setContentHashRecord.ts +50 -0
  62. package/src/query/wallet/setPrimaryName.ts +57 -0
  63. package/src/query/wallet/setRecords.ts +54 -0
  64. package/src/query/wallet/setResolver.ts +54 -0
  65. package/src/query/wallet/setTextRecord.ts +50 -0
  66. package/src/query/wallet/transferName.ts +66 -0
  67. package/src/utils/chain.ts +50 -0
  68. package/src/utils/getAction.ts +56 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 ENS Labs Limited
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/package.json ADDED
@@ -0,0 +1,85 @@
1
+ {
2
+ "name": "@ensdomains/ensjs-query-core",
3
+ "version": "0.0.1",
4
+ "description": "ENS javascript extension library for @wagmi/core",
5
+ "type": "module",
6
+ "module": "./dist/esm/exports/index.js",
7
+ "types": "./dist/types/exports/index.d.ts",
8
+ "typings": "./dist/types/exports/index.d.ts",
9
+ "sideEffects": false,
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/types/exports/index.d.ts",
13
+ "default": "./dist/esm/exports/index.js"
14
+ },
15
+ "./actions/public": {
16
+ "types": "./dist/types/actions/public/index.d.ts",
17
+ "default": "./dist/esm/actions/public/index.js"
18
+ },
19
+ "./actions/wallet": {
20
+ "types": "./dist/types/actions/wallet/index.d.ts",
21
+ "default": "./dist/esm/actions/wallet/index.js"
22
+ },
23
+ "./query/public": {
24
+ "types": "./dist/types/query/public/index.d.ts",
25
+ "default": "./dist/esm/query/public/index.js"
26
+ },
27
+ "./query/wallet": {
28
+ "types": "./dist/types/query/wallet/index.d.ts",
29
+ "default": "./dist/esm/query/wallet/index.js"
30
+ },
31
+ "./package.json": "./package.json"
32
+ },
33
+ "typesVersions": {
34
+ "*": {
35
+ "actions/public": [
36
+ "./dist/types/actions/public/index.d.ts"
37
+ ],
38
+ "actions/wallet": [
39
+ "./dist/types/actions/wallet/index.d.ts"
40
+ ],
41
+ "query/public": [
42
+ "./dist/types/query/public/index.d.ts"
43
+ ],
44
+ "query/wallet": [
45
+ "./dist/types/query/wallet/index.d.ts"
46
+ ]
47
+ }
48
+ },
49
+ "files": [
50
+ "dist/",
51
+ "src/",
52
+ "!src/**/*.test.ts",
53
+ "!src/test"
54
+ ],
55
+ "repository": {
56
+ "type": "git",
57
+ "url": "git+https://github.com/ensdomains/ensjs.git",
58
+ "directory": "packages/query-core"
59
+ },
60
+ "author": "Jakob <jakob@ens.domains>",
61
+ "license": "MIT",
62
+ "dependencies": {},
63
+ "devDependencies": {
64
+ "typescript": "5.6.2",
65
+ "@wagmi/core": "^2.17.2",
66
+ "viem": "^2.9.2",
67
+ "@ensdomains/ensjs": "5.0.0-sepolia-fix.1"
68
+ },
69
+ "peerDependencies": {
70
+ "@tanstack/query-core": ">=5.0.0",
71
+ "@ensdomains/ensjs": "^5.0.0",
72
+ "viem": "^2.9.2",
73
+ "@wagmi/core": "^2.17.2"
74
+ },
75
+ "engines": {
76
+ "node": ">=18"
77
+ },
78
+ "scripts": {
79
+ "build": "pnpm run clean && pnpm run build:esm+types",
80
+ "clean": "rm -rf dist",
81
+ "build:esm+types": "tsc --project tsconfig.build.json --outDir ./dist/esm --declaration --declarationMap --declarationDir ./dist/types",
82
+ "check:types": "tsc --noEmit",
83
+ "lint": "biome check"
84
+ }
85
+ }
@@ -0,0 +1,39 @@
1
+ import {
2
+ ASSERT_NO_TYPE_ERROR,
3
+ type ExcludeTE,
4
+ } from '@ensdomains/ensjs/internal'
5
+ import {
6
+ type GetAbiRecordErrorType as ensjs_GetAbiRecordErrorType,
7
+ type GetAbiRecordParameters as ensjs_GetAbiRecordParameters,
8
+ type GetAbiRecordReturnType as ensjs_GetAbiRecordReturnType,
9
+ getAbiRecord as ensjs_getAbiRecord,
10
+ } from '@ensdomains/ensjs/public'
11
+ import type { Config } from '@wagmi/core'
12
+ import type { ChainIdParameter } from '@wagmi/core/internal'
13
+ import type { Chain, Prettify } from 'viem'
14
+ import type { RequireConfigContracts } from '../../utils/chain.js'
15
+ import { getAction } from '../../utils/getAction.js'
16
+
17
+ export type GetAbiRecordParameters<config extends Config = Config> = Prettify<
18
+ ensjs_GetAbiRecordParameters & ChainIdParameter<config>
19
+ >
20
+
21
+ export type GetAbiRecordReturnType = ensjs_GetAbiRecordReturnType
22
+
23
+ export type GetAbiRecordErrorType = ensjs_GetAbiRecordErrorType
24
+
25
+ export function getAbiRecord<chains extends readonly [Chain, ...Chain[]]>(
26
+ config: RequireConfigContracts<chains, 'ensUniversalResolver'>,
27
+ parameters: GetAbiRecordParameters<ExcludeTE<typeof config>>,
28
+ ): Promise<GetAbiRecordReturnType> {
29
+ ASSERT_NO_TYPE_ERROR(config)
30
+
31
+ const { chainId, ...rest } = parameters
32
+ const client = config.getClient({ chainId })
33
+ const action = getAction(
34
+ client,
35
+ ensjs_getAbiRecord<typeof client.chain>,
36
+ 'getAbiRecord',
37
+ )
38
+ return action(rest)
39
+ }
@@ -0,0 +1,38 @@
1
+ import {
2
+ ASSERT_NO_TYPE_ERROR,
3
+ type ExcludeTE,
4
+ } from '@ensdomains/ensjs/internal'
5
+ import {
6
+ type GetAddressRecordErrorType as ensjs_GetAddressRecordErrorType,
7
+ type GetAddressRecordParameters as ensjs_GetAddressRecordParameters,
8
+ type GetAddressRecordReturnType as ensjs_GetAddressRecordReturnType,
9
+ getAddressRecord as ensjs_getAddressRecord,
10
+ } from '@ensdomains/ensjs/public'
11
+ import type { Config } from '@wagmi/core'
12
+ import type { ChainIdParameter } from '@wagmi/core/internal'
13
+ import type { Chain, Prettify } from 'viem'
14
+ import type { RequireConfigContracts } from '../../utils/chain.js'
15
+ import { getAction } from '../../utils/getAction.js'
16
+
17
+ export type GetAddressRecordParameters<config extends Config = Config> =
18
+ Prettify<ensjs_GetAddressRecordParameters & ChainIdParameter<config>>
19
+
20
+ export type GetAddressRecordReturnType = ensjs_GetAddressRecordReturnType
21
+
22
+ export type GetAddressRecordErrorType = ensjs_GetAddressRecordErrorType
23
+
24
+ export function getAddressRecord<chains extends readonly [Chain, ...Chain[]]>(
25
+ config: RequireConfigContracts<chains, 'ensUniversalResolver'>,
26
+ parameters: GetAddressRecordParameters<ExcludeTE<typeof config>>,
27
+ ): Promise<GetAddressRecordReturnType> {
28
+ ASSERT_NO_TYPE_ERROR(config)
29
+
30
+ const { chainId, ...rest } = parameters
31
+ const client = config.getClient({ chainId })
32
+ const action = getAction(
33
+ client,
34
+ ensjs_getAddressRecord<typeof client.chain>,
35
+ 'getAddressRecord',
36
+ )
37
+ return action(rest)
38
+ }
@@ -0,0 +1,39 @@
1
+ import {
2
+ ASSERT_NO_TYPE_ERROR,
3
+ type ExcludeTE,
4
+ } from '@ensdomains/ensjs/internal'
5
+ import {
6
+ type GetAvailableErrorType as ensjs_GetAvailableErrorType,
7
+ type GetAvailableParameters as ensjs_GetAvailableParameters,
8
+ type GetAvailableReturnType as ensjs_GetAvailableReturnType,
9
+ getAvailable as ensjs_getAvailable,
10
+ } from '@ensdomains/ensjs/public'
11
+ import type { Config } from '@wagmi/core'
12
+ import type { ChainIdParameter } from '@wagmi/core/internal'
13
+ import type { Chain, Prettify } from 'viem'
14
+ import type { RequireConfigContracts } from '../../utils/chain.js'
15
+ import { getAction } from '../../utils/getAction.js'
16
+
17
+ export type GetAvailableParameters<config extends Config = Config> = Prettify<
18
+ ensjs_GetAvailableParameters & ChainIdParameter<config>
19
+ >
20
+
21
+ export type GetAvailableReturnType = ensjs_GetAvailableReturnType
22
+
23
+ export type GetAvailableErrorType = ensjs_GetAvailableErrorType
24
+
25
+ export function getAvailable<chains extends readonly [Chain, ...Chain[]]>(
26
+ config: RequireConfigContracts<chains, 'ensBaseRegistrarImplementation'>,
27
+ parameters: GetAvailableParameters<ExcludeTE<typeof config>>,
28
+ ): Promise<GetAvailableReturnType> {
29
+ ASSERT_NO_TYPE_ERROR(config)
30
+
31
+ const { chainId, ...rest } = parameters
32
+ const client = config.getClient({ chainId })
33
+ const action = getAction(
34
+ client,
35
+ ensjs_getAvailable<typeof client.chain>,
36
+ 'getAvailable',
37
+ )
38
+ return action(rest)
39
+ }
@@ -0,0 +1,41 @@
1
+ import {
2
+ ASSERT_NO_TYPE_ERROR,
3
+ type ExcludeTE,
4
+ } from '@ensdomains/ensjs/internal'
5
+ import {
6
+ type GetContentHashRecordErrorType as ensjs_GetContentHashRecordErrorType,
7
+ type GetContentHashRecordParameters as ensjs_GetContentHashRecordParameters,
8
+ type GetContentHashRecordReturnType as ensjs_GetContentHashRecordReturnType,
9
+ getContentHashRecord as ensjs_getContentHashRecord,
10
+ } from '@ensdomains/ensjs/public'
11
+ import type { Config } from '@wagmi/core'
12
+ import type { ChainIdParameter } from '@wagmi/core/internal'
13
+ import type { Chain, Prettify } from 'viem'
14
+ import type { RequireConfigContracts } from '../../utils/chain.js'
15
+ import { getAction } from '../../utils/getAction.js'
16
+
17
+ export type GetContentHashRecordParameters<config extends Config = Config> =
18
+ Prettify<ensjs_GetContentHashRecordParameters & ChainIdParameter<config>>
19
+
20
+ export type GetContentHashRecordReturnType =
21
+ ensjs_GetContentHashRecordReturnType
22
+
23
+ export type GetContentHashRecordErrorType = ensjs_GetContentHashRecordErrorType
24
+
25
+ export function getContentHashRecord<
26
+ chains extends readonly [Chain, ...Chain[]],
27
+ >(
28
+ config: RequireConfigContracts<chains, 'ensUniversalResolver'>,
29
+ parameters: GetContentHashRecordParameters<ExcludeTE<typeof config>>,
30
+ ): Promise<GetContentHashRecordReturnType> {
31
+ ASSERT_NO_TYPE_ERROR(config)
32
+
33
+ const { chainId, ...rest } = parameters
34
+ const client = config.getClient({ chainId })
35
+ const action = getAction(
36
+ client,
37
+ ensjs_getContentHashRecord<typeof client.chain>,
38
+ 'getContentHashRecord',
39
+ )
40
+ return action(rest)
41
+ }
@@ -0,0 +1,39 @@
1
+ import {
2
+ ASSERT_NO_TYPE_ERROR,
3
+ type ExcludeTE,
4
+ } from '@ensdomains/ensjs/internal'
5
+ import {
6
+ type GetCredentialsErrorType as ensjs_GetCredentialsErrorType,
7
+ type GetCredentialsParameters as ensjs_GetCredentialsParameters,
8
+ type GetCredentialsReturnType as ensjs_GetCredentialsReturnType,
9
+ getCredentials as ensjs_getCredentials,
10
+ } from '@ensdomains/ensjs/public'
11
+ import type { Config } from '@wagmi/core'
12
+ import type { ChainIdParameter } from '@wagmi/core/internal'
13
+ import type { Chain, Prettify } from 'viem'
14
+ import type { RequireConfigContracts } from '../../utils/chain.js'
15
+ import { getAction } from '../../utils/getAction.js'
16
+
17
+ export type GetCredentialsParameters<config extends Config = Config> = Prettify<
18
+ ensjs_GetCredentialsParameters & ChainIdParameter<config>
19
+ >
20
+
21
+ export type GetCredentialsReturnType = ensjs_GetCredentialsReturnType
22
+
23
+ export type GetCredentialsErrorType = ensjs_GetCredentialsErrorType
24
+
25
+ export function getCredentials<chains extends readonly [Chain, ...Chain[]]>(
26
+ config: RequireConfigContracts<chains, 'ensUniversalResolver'>,
27
+ parameters: GetCredentialsParameters<ExcludeTE<typeof config>>,
28
+ ): Promise<GetCredentialsReturnType> {
29
+ ASSERT_NO_TYPE_ERROR(config)
30
+
31
+ const { chainId, ...rest } = parameters
32
+ const client = config.getClient({ chainId })
33
+ const action = getAction(
34
+ client,
35
+ ensjs_getCredentials<typeof client.chain>,
36
+ 'getCredentials',
37
+ )
38
+ return action(rest)
39
+ }
@@ -0,0 +1,42 @@
1
+ import {
2
+ ASSERT_NO_TYPE_ERROR,
3
+ type ExcludeTE,
4
+ } from '@ensdomains/ensjs/internal'
5
+ import {
6
+ type GetExpiryErrorType as ensjs_GetExpiryErrorType,
7
+ type GetExpiryParameters as ensjs_GetExpiryParameters,
8
+ type GetExpiryReturnType as ensjs_GetExpiryReturnType,
9
+ getExpiry as ensjs_getExpiry,
10
+ } from '@ensdomains/ensjs/public'
11
+ import type { Config } from '@wagmi/core'
12
+ import type { ChainIdParameter } from '@wagmi/core/internal'
13
+ import type { Chain, Prettify } from 'viem'
14
+ import type { RequireConfigContracts } from '../../utils/chain.js'
15
+ import { getAction } from '../../utils/getAction.js'
16
+
17
+ export type GetExpiryParameters<config extends Config = Config> = Prettify<
18
+ ensjs_GetExpiryParameters & ChainIdParameter<config>
19
+ >
20
+
21
+ export type GetExpiryReturnType = ensjs_GetExpiryReturnType
22
+
23
+ export type GetExpiryErrorType = ensjs_GetExpiryErrorType
24
+
25
+ export function getExpiry<chains extends readonly [Chain, ...Chain[]]>(
26
+ config: RequireConfigContracts<
27
+ chains,
28
+ 'ensNameWrapper' | 'ensBaseRegistrarImplementation' | 'multicall3'
29
+ >,
30
+ parameters: GetExpiryParameters<ExcludeTE<typeof config>>,
31
+ ): Promise<GetExpiryReturnType> {
32
+ ASSERT_NO_TYPE_ERROR(config)
33
+
34
+ const { chainId, ...rest } = parameters
35
+ const client = config.getClient({ chainId })
36
+ const action = getAction(
37
+ client,
38
+ ensjs_getExpiry<typeof client.chain>,
39
+ 'getExpiry',
40
+ )
41
+ return action(rest)
42
+ }
@@ -0,0 +1,39 @@
1
+ import {
2
+ ASSERT_NO_TYPE_ERROR,
3
+ type ExcludeTE,
4
+ } from '@ensdomains/ensjs/internal'
5
+ import {
6
+ type GetNameErrorType as ensjs_GetNameErrorType,
7
+ type GetNameParameters as ensjs_GetNameParameters,
8
+ type GetNameReturnType as ensjs_GetNameReturnType,
9
+ getName as ensjs_getName,
10
+ } from '@ensdomains/ensjs/public'
11
+ import type { Config } from '@wagmi/core'
12
+ import type { ChainIdParameter } from '@wagmi/core/internal'
13
+ import type { Chain, Prettify } from 'viem'
14
+ import type { RequireConfigContracts } from '../../utils/chain.js'
15
+ import { getAction } from '../../utils/getAction.js'
16
+
17
+ export type GetNameParameters<config extends Config = Config> = Prettify<
18
+ ensjs_GetNameParameters & ChainIdParameter<config>
19
+ >
20
+
21
+ export type GetNameReturnType = ensjs_GetNameReturnType
22
+
23
+ export type GetNameErrorType = ensjs_GetNameErrorType
24
+
25
+ export function getName<chains extends readonly [Chain, ...Chain[]]>(
26
+ config: RequireConfigContracts<chains, 'ensUniversalResolver'>,
27
+ parameters: GetNameParameters<ExcludeTE<typeof config>>,
28
+ ): Promise<GetNameReturnType> {
29
+ ASSERT_NO_TYPE_ERROR(config)
30
+
31
+ const { chainId, ...rest } = parameters
32
+ const client = config.getClient({ chainId })
33
+ const action = getAction(
34
+ client,
35
+ ensjs_getName<typeof client.chain>,
36
+ 'getName',
37
+ )
38
+ return action(rest)
39
+ }
@@ -0,0 +1,45 @@
1
+ import {
2
+ ASSERT_NO_TYPE_ERROR,
3
+ type ExcludeTE,
4
+ } from '@ensdomains/ensjs/internal'
5
+ import {
6
+ type GetOwnerErrorType as ensjs_GetOwnerErrorType,
7
+ type GetOwnerParameters as ensjs_GetOwnerParameters,
8
+ type GetOwnerReturnType as ensjs_GetOwnerReturnType,
9
+ getOwner as ensjs_getOwner,
10
+ } from '@ensdomains/ensjs/public'
11
+ import type { Config } from '@wagmi/core'
12
+ import type { ChainIdParameter } from '@wagmi/core/internal'
13
+ import type { Chain, Prettify } from 'viem'
14
+ import type { RequireConfigContracts } from '../../utils/chain.js'
15
+ import { getAction } from '../../utils/getAction.js'
16
+
17
+ export type GetOwnerParameters<config extends Config = Config> = Prettify<
18
+ ensjs_GetOwnerParameters & ChainIdParameter<config>
19
+ >
20
+
21
+ export type GetOwnerReturnType = ensjs_GetOwnerReturnType
22
+
23
+ export type GetOwnerErrorType = ensjs_GetOwnerErrorType
24
+
25
+ export function getOwner<chains extends readonly [Chain, ...Chain[]]>(
26
+ config: RequireConfigContracts<
27
+ chains,
28
+ | 'ensNameWrapper'
29
+ | 'ensRegistry'
30
+ | 'ensBaseRegistrarImplementation'
31
+ | 'multicall3'
32
+ >,
33
+ parameters: GetOwnerParameters<ExcludeTE<typeof config>>,
34
+ ): Promise<GetOwnerReturnType> {
35
+ ASSERT_NO_TYPE_ERROR(config)
36
+
37
+ const { chainId, ...rest } = parameters
38
+ const client = config.getClient({ chainId })
39
+ const action = getAction(
40
+ client,
41
+ ensjs_getOwner<typeof client.chain>,
42
+ 'getOwner',
43
+ )
44
+ return action(rest)
45
+ }
@@ -0,0 +1,42 @@
1
+ import {
2
+ ASSERT_NO_TYPE_ERROR,
3
+ type ExcludeTE,
4
+ } from '@ensdomains/ensjs/internal'
5
+ import {
6
+ type GetPriceErrorType as ensjs_GetPriceErrorType,
7
+ type GetPriceParameters as ensjs_GetPriceParameters,
8
+ type GetPriceReturnType as ensjs_GetPriceReturnType,
9
+ getPrice as ensjs_getPrice,
10
+ } from '@ensdomains/ensjs/public/v1'
11
+ import type { Config } from '@wagmi/core'
12
+ import type { ChainIdParameter } from '@wagmi/core/internal'
13
+ import type { Chain, Prettify } from 'viem'
14
+ import type { RequireConfigContracts } from '../../utils/chain.js'
15
+ import { getAction } from '../../utils/getAction.js'
16
+
17
+ export type GetPriceParameters<config extends Config = Config> = Prettify<
18
+ ensjs_GetPriceParameters & ChainIdParameter<config>
19
+ >
20
+
21
+ export type GetPriceReturnType = ensjs_GetPriceReturnType
22
+
23
+ export type GetPriceErrorType = ensjs_GetPriceErrorType
24
+
25
+ export function getPrice<chains extends readonly [Chain, ...Chain[]]>(
26
+ config: RequireConfigContracts<
27
+ chains,
28
+ 'ensEthRegistrarController' | 'multicall3'
29
+ >,
30
+ parameters: GetPriceParameters<ExcludeTE<typeof config>>,
31
+ ): Promise<GetPriceReturnType> {
32
+ ASSERT_NO_TYPE_ERROR(config)
33
+
34
+ const { chainId, ...rest } = parameters
35
+ const client = config.getClient({ chainId })
36
+ const action = getAction(
37
+ client,
38
+ ensjs_getPrice<typeof client.chain>,
39
+ 'getPrice',
40
+ )
41
+ return action(rest)
42
+ }
@@ -0,0 +1,69 @@
1
+ import {
2
+ ASSERT_NO_TYPE_ERROR,
3
+ type ExcludeTE,
4
+ } from '@ensdomains/ensjs/internal'
5
+ import {
6
+ type GetRecordsErrorType as ensjs_GetRecordsErrorType,
7
+ type GetRecordsParameters as ensjs_GetRecordsParameters,
8
+ type GetRecordsReturnType as ensjs_GetRecordsReturnType,
9
+ getRecords as ensjs_getRecords,
10
+ } from '@ensdomains/ensjs/public'
11
+ import type { Config } from '@wagmi/core'
12
+ import type { ChainIdParameter } from '@wagmi/core/internal'
13
+ import type { Chain, Prettify } from 'viem'
14
+ import type { RequireConfigContracts } from '../../utils/chain.js'
15
+ import { getAction } from '../../utils/getAction.js'
16
+
17
+ export type GetRecordsParameters<
18
+ config extends Config = Config,
19
+ texts extends readonly string[] | undefined = readonly string[],
20
+ coins extends readonly (string | number)[] | undefined = readonly (
21
+ | string
22
+ | number
23
+ )[],
24
+ contentHash extends boolean | undefined = true,
25
+ abi extends boolean | undefined = true,
26
+ > = Prettify<
27
+ ensjs_GetRecordsParameters<texts, coins, contentHash, abi> &
28
+ ChainIdParameter<config>
29
+ >
30
+
31
+ export type GetRecordsReturnType<
32
+ texts extends readonly string[] | undefined = readonly string[],
33
+ coins extends readonly (string | number)[] | undefined = readonly (
34
+ | string
35
+ | number
36
+ )[],
37
+ contentHash extends boolean | undefined = true,
38
+ abi extends boolean | undefined = true,
39
+ > = ensjs_GetRecordsReturnType<texts, coins, contentHash, abi>
40
+
41
+ export type GetRecordsErrorType = ensjs_GetRecordsErrorType
42
+
43
+ export function getRecords<
44
+ chains extends readonly [Chain, ...Chain[]],
45
+ const texts extends readonly string[] | undefined = undefined,
46
+ const coins extends readonly (string | number)[] | undefined = undefined,
47
+ const contentHash extends boolean | undefined = undefined,
48
+ const abi extends boolean | undefined = undefined,
49
+ >(
50
+ config: RequireConfigContracts<chains, 'ensUniversalResolver' | 'multicall3'>,
51
+ parameters: GetRecordsParameters<
52
+ ExcludeTE<typeof config>,
53
+ texts,
54
+ coins,
55
+ contentHash,
56
+ abi
57
+ >,
58
+ ): Promise<GetRecordsReturnType<texts, coins, contentHash, abi>> {
59
+ ASSERT_NO_TYPE_ERROR(config)
60
+
61
+ const { chainId, ...rest } = parameters
62
+ const client = config.getClient({ chainId })
63
+ const action = getAction(
64
+ client,
65
+ ensjs_getRecords<typeof client.chain, texts, coins, contentHash, abi>,
66
+ 'getRecords',
67
+ )
68
+ return action(rest)
69
+ }
@@ -0,0 +1,39 @@
1
+ import {
2
+ ASSERT_NO_TYPE_ERROR,
3
+ type ExcludeTE,
4
+ } from '@ensdomains/ensjs/internal'
5
+ import {
6
+ type GetResolverErrorType as ensjs_GetResolverErrorType,
7
+ type GetResolverParameters as ensjs_GetResolverParameters,
8
+ type GetResolverReturnType as ensjs_GetResolverReturnType,
9
+ getResolver as ensjs_getResolver,
10
+ } from '@ensdomains/ensjs/public'
11
+ import type { Config } from '@wagmi/core'
12
+ import type { ChainIdParameter } from '@wagmi/core/internal'
13
+ import type { Chain, Prettify } from 'viem'
14
+ import type { RequireConfigContracts } from '../../utils/chain.js'
15
+ import { getAction } from '../../utils/getAction.js'
16
+
17
+ export type GetResolverParameters<config extends Config = Config> = Prettify<
18
+ ensjs_GetResolverParameters & ChainIdParameter<config>
19
+ >
20
+
21
+ export type GetResolverReturnType = ensjs_GetResolverReturnType
22
+
23
+ export type GetResolverErrorType = ensjs_GetResolverErrorType
24
+
25
+ export function getResolver<chains extends readonly [Chain, ...Chain[]]>(
26
+ config: RequireConfigContracts<chains, 'ensRegistry'>,
27
+ parameters: GetResolverParameters<ExcludeTE<typeof config>>,
28
+ ): Promise<GetResolverReturnType> {
29
+ ASSERT_NO_TYPE_ERROR(config)
30
+
31
+ const { chainId, ...rest } = parameters
32
+ const client = config.getClient({ chainId })
33
+ const action = getAction(
34
+ client,
35
+ ensjs_getResolver<typeof client.chain>,
36
+ 'getResolver',
37
+ )
38
+ return action(rest)
39
+ }
@@ -0,0 +1,53 @@
1
+ import {
2
+ ASSERT_NO_TYPE_ERROR,
3
+ type ExcludeTE,
4
+ } from '@ensdomains/ensjs/internal'
5
+ import {
6
+ type GetSupportedInterfacesErrorType as ensjs_GetSupportedInterfacesErrorType,
7
+ type GetSupportedInterfacesParameters as ensjs_GetSupportedInterfacesParameters,
8
+ type GetSupportedInterfacesReturnType as ensjs_GetSupportedInterfacesReturnType,
9
+ getSupportedInterfaces as ensjs_getSupportedInterfaces,
10
+ } from '@ensdomains/ensjs/public'
11
+ import type { Config } from '@wagmi/core'
12
+ import type { ChainIdParameter } from '@wagmi/core/internal'
13
+ import type { Chain, Hex, Prettify } from 'viem'
14
+ import type { RequireConfigContracts } from '../../utils/chain.js'
15
+ import { getAction } from '../../utils/getAction.js'
16
+
17
+ export type GetSupportedInterfacesParameters<
18
+ config extends Config = Config,
19
+ interfaces extends readonly Hex[] = readonly Hex[],
20
+ > = Prettify<
21
+ ensjs_GetSupportedInterfacesParameters<interfaces> & ChainIdParameter<config>
22
+ >
23
+
24
+ export type GetSupportedInterfacesReturnType<
25
+ interfaces extends readonly Hex[] = readonly Hex[],
26
+ > = ensjs_GetSupportedInterfacesReturnType<interfaces>
27
+
28
+ export type GetSupportedInterfacesErrorType =
29
+ ensjs_GetSupportedInterfacesErrorType
30
+
31
+ export function getSupportedInterfaces<
32
+ chains extends readonly [Chain, ...Chain[]],
33
+ const interfaces extends readonly Hex[],
34
+ >(
35
+ config: RequireConfigContracts<chains, 'multicall3'>,
36
+ parameters: GetSupportedInterfacesParameters<
37
+ ExcludeTE<typeof config>,
38
+ interfaces
39
+ >,
40
+ ): Promise<GetSupportedInterfacesReturnType<interfaces>> {
41
+ ASSERT_NO_TYPE_ERROR(config)
42
+
43
+ const { chainId, ...rest } = parameters
44
+ const client = config.getClient({ chainId })
45
+ const action = getAction(
46
+ client,
47
+ ensjs_getSupportedInterfaces<typeof client.chain, interfaces>,
48
+ // TODO: Add getSupportedInterfaces to the client decorators
49
+ // @ts-expect-error - Not yet added to decorator
50
+ 'getSupportedInterfaces',
51
+ )
52
+ return action(rest)
53
+ }