@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.
- package/LICENSE +21 -0
- package/package.json +85 -0
- package/src/actions/public/getAbiRecord.ts +39 -0
- package/src/actions/public/getAddressRecord.ts +38 -0
- package/src/actions/public/getAvailable.ts +39 -0
- package/src/actions/public/getContentHashRecord.ts +41 -0
- package/src/actions/public/getCredentials.ts +39 -0
- package/src/actions/public/getExpiry.ts +42 -0
- package/src/actions/public/getName.ts +39 -0
- package/src/actions/public/getOwner.ts +45 -0
- package/src/actions/public/getPrice.ts +42 -0
- package/src/actions/public/getRecords.ts +69 -0
- package/src/actions/public/getResolver.ts +39 -0
- package/src/actions/public/getSupportedInterfaces.ts +53 -0
- package/src/actions/public/getTextRecord.ts +39 -0
- package/src/actions/public/getWrapperData.ts +39 -0
- package/src/actions/public/getWrapperName.ts +39 -0
- package/src/actions/public/resolveNameData.ts +46 -0
- package/src/actions/wallet/clearRecords.ts +69 -0
- package/src/actions/wallet/commitName.ts +62 -0
- package/src/actions/wallet/createSubname.ts +67 -0
- package/src/actions/wallet/deleteSubname.ts +64 -0
- package/src/actions/wallet/index.ts +84 -0
- package/src/actions/wallet/registerName.ts +62 -0
- package/src/actions/wallet/renewNames.ts +65 -0
- package/src/actions/wallet/setAbiRecord.ts +63 -0
- package/src/actions/wallet/setAddressRecord.ts +58 -0
- package/src/actions/wallet/setContentHashRecord.ts +63 -0
- package/src/actions/wallet/setPrimaryName.ts +67 -0
- package/src/actions/wallet/setRecords.ts +62 -0
- package/src/actions/wallet/setResolver.ts +62 -0
- package/src/actions/wallet/setTextRecord.ts +58 -0
- package/src/actions/wallet/transferName.ts +73 -0
- package/src/example.ts +39 -0
- package/src/query/public/getAbiRecord.ts +61 -0
- package/src/query/public/getAddressRecord.ts +61 -0
- package/src/query/public/getAvailable.ts +61 -0
- package/src/query/public/getContentHashRecord.ts +61 -0
- package/src/query/public/getCredentials.ts +61 -0
- package/src/query/public/getExpiry.ts +64 -0
- package/src/query/public/getName.ts +61 -0
- package/src/query/public/getOwner.ts +67 -0
- package/src/query/public/getPrice.ts +65 -0
- package/src/query/public/getRecords.ts +83 -0
- package/src/query/public/getResolver.ts +61 -0
- package/src/query/public/getSupportedInterfaces.ts +80 -0
- package/src/query/public/getTextRecord.ts +62 -0
- package/src/query/public/getWrapperData.ts +61 -0
- package/src/query/public/getWrapperName.ts +61 -0
- package/src/query/public/index.ts +134 -0
- package/src/query/utils.ts +26 -0
- package/src/query/wallet/clearRecords.ts +54 -0
- package/src/query/wallet/commitName.ts +54 -0
- package/src/query/wallet/createSubname.ts +57 -0
- package/src/query/wallet/deleteSubname.ts +54 -0
- package/src/query/wallet/index.ts +85 -0
- package/src/query/wallet/registerName.ts +54 -0
- package/src/query/wallet/renewNames.ts +57 -0
- package/src/query/wallet/setAbiRecord.ts +53 -0
- package/src/query/wallet/setAddressRecord.ts +50 -0
- package/src/query/wallet/setContentHashRecord.ts +50 -0
- package/src/query/wallet/setPrimaryName.ts +57 -0
- package/src/query/wallet/setRecords.ts +54 -0
- package/src/query/wallet/setResolver.ts +54 -0
- package/src/query/wallet/setTextRecord.ts +50 -0
- package/src/query/wallet/transferName.ts +66 -0
- package/src/utils/chain.ts +50 -0
- package/src/utils/getAction.ts +56 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ASSERT_NO_TYPE_ERROR,
|
|
3
|
+
type ExcludeTE,
|
|
4
|
+
} from '@ensdomains/ensjs/internal'
|
|
5
|
+
import type { QueryOptions } from '@tanstack/query-core'
|
|
6
|
+
import type { Config } from '@wagmi/core'
|
|
7
|
+
import type {
|
|
8
|
+
Compute,
|
|
9
|
+
ExactPartial,
|
|
10
|
+
ScopeKeyParameter,
|
|
11
|
+
} from '@wagmi/core/internal'
|
|
12
|
+
import type { Chain } from 'viem'
|
|
13
|
+
import {
|
|
14
|
+
type GetTextRecordErrorType,
|
|
15
|
+
type GetTextRecordParameters,
|
|
16
|
+
type GetTextRecordReturnType,
|
|
17
|
+
getTextRecord,
|
|
18
|
+
} from '../../actions/public/getTextRecord.js'
|
|
19
|
+
import type { RequireConfigContracts } from '../../utils/chain.js'
|
|
20
|
+
import { filterQueryOptions } from '../utils.js'
|
|
21
|
+
|
|
22
|
+
export type GetTextRecordOptions<config extends Config> = Compute<
|
|
23
|
+
ExactPartial<GetTextRecordParameters<config>> & ScopeKeyParameter
|
|
24
|
+
>
|
|
25
|
+
|
|
26
|
+
export function getTextRecordQueryOptions<
|
|
27
|
+
chains extends readonly [Chain, ...Chain[]],
|
|
28
|
+
>(
|
|
29
|
+
config: RequireConfigContracts<chains, 'ensUniversalResolver'>,
|
|
30
|
+
options: GetTextRecordOptions<ExcludeTE<typeof config>> = {},
|
|
31
|
+
) {
|
|
32
|
+
ASSERT_NO_TYPE_ERROR(config)
|
|
33
|
+
|
|
34
|
+
return {
|
|
35
|
+
async queryFn({ queryKey }) {
|
|
36
|
+
const { name, key, scopeKey: _, ...parameters } = queryKey[1]
|
|
37
|
+
if (!name) throw new Error('name is required')
|
|
38
|
+
if (!key) throw new Error('key is required')
|
|
39
|
+
return getTextRecord<chains>(config, { ...parameters, name, key })
|
|
40
|
+
},
|
|
41
|
+
queryKey: getTextRecordQueryKey(options),
|
|
42
|
+
} as const satisfies QueryOptions<
|
|
43
|
+
GetTextRecordQueryFnData,
|
|
44
|
+
GetTextRecordErrorType,
|
|
45
|
+
GetTextRecordData,
|
|
46
|
+
GetTextRecordQueryKey<typeof config>
|
|
47
|
+
>
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export type GetTextRecordQueryFnData = GetTextRecordReturnType
|
|
51
|
+
|
|
52
|
+
export type GetTextRecordData = GetTextRecordQueryFnData
|
|
53
|
+
|
|
54
|
+
export function getTextRecordQueryKey<config extends Config>(
|
|
55
|
+
options: GetTextRecordOptions<config> = {},
|
|
56
|
+
) {
|
|
57
|
+
return ['ensjs_textRecord', filterQueryOptions(options)] as const
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export type GetTextRecordQueryKey<config extends Config> = ReturnType<
|
|
61
|
+
typeof getTextRecordQueryKey<config>
|
|
62
|
+
>
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ASSERT_NO_TYPE_ERROR,
|
|
3
|
+
type ExcludeTE,
|
|
4
|
+
} from '@ensdomains/ensjs/internal'
|
|
5
|
+
import type { QueryOptions } from '@tanstack/query-core'
|
|
6
|
+
import type { Config } from '@wagmi/core'
|
|
7
|
+
import type {
|
|
8
|
+
Compute,
|
|
9
|
+
ExactPartial,
|
|
10
|
+
ScopeKeyParameter,
|
|
11
|
+
} from '@wagmi/core/internal'
|
|
12
|
+
import type { Chain } from 'viem'
|
|
13
|
+
import {
|
|
14
|
+
type GetWrapperDataErrorType,
|
|
15
|
+
type GetWrapperDataParameters,
|
|
16
|
+
type GetWrapperDataReturnType,
|
|
17
|
+
getWrapperData,
|
|
18
|
+
} from '../../actions/public/getWrapperData.js'
|
|
19
|
+
import type { RequireConfigContracts } from '../../utils/chain.js'
|
|
20
|
+
import { filterQueryOptions } from '../utils.js'
|
|
21
|
+
|
|
22
|
+
export type GetWrapperDataOptions<config extends Config> = Compute<
|
|
23
|
+
ExactPartial<GetWrapperDataParameters<config>> & ScopeKeyParameter
|
|
24
|
+
>
|
|
25
|
+
|
|
26
|
+
export function getWrapperDataQueryOptions<
|
|
27
|
+
chains extends readonly [Chain, ...Chain[]],
|
|
28
|
+
>(
|
|
29
|
+
config: RequireConfigContracts<chains, 'ensNameWrapper' | 'multicall3'>,
|
|
30
|
+
options: GetWrapperDataOptions<ExcludeTE<typeof config>> = {},
|
|
31
|
+
) {
|
|
32
|
+
ASSERT_NO_TYPE_ERROR(config)
|
|
33
|
+
|
|
34
|
+
return {
|
|
35
|
+
async queryFn({ queryKey }) {
|
|
36
|
+
const { name, scopeKey: _, ...parameters } = queryKey[1]
|
|
37
|
+
if (!name) throw new Error('name is required')
|
|
38
|
+
return getWrapperData<chains>(config, { ...parameters, name })
|
|
39
|
+
},
|
|
40
|
+
queryKey: getWrapperDataQueryKey(options),
|
|
41
|
+
} as const satisfies QueryOptions<
|
|
42
|
+
GetWrapperDataQueryFnData,
|
|
43
|
+
GetWrapperDataErrorType,
|
|
44
|
+
GetWrapperDataData,
|
|
45
|
+
GetWrapperDataQueryKey<typeof config>
|
|
46
|
+
>
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export type GetWrapperDataQueryFnData = GetWrapperDataReturnType
|
|
50
|
+
|
|
51
|
+
export type GetWrapperDataData = GetWrapperDataQueryFnData
|
|
52
|
+
|
|
53
|
+
export function getWrapperDataQueryKey<config extends Config>(
|
|
54
|
+
options: GetWrapperDataOptions<config> = {},
|
|
55
|
+
) {
|
|
56
|
+
return ['ensjs_wrapperData', filterQueryOptions(options)] as const
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export type GetWrapperDataQueryKey<config extends Config> = ReturnType<
|
|
60
|
+
typeof getWrapperDataQueryKey<config>
|
|
61
|
+
>
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ASSERT_NO_TYPE_ERROR,
|
|
3
|
+
type ExcludeTE,
|
|
4
|
+
} from '@ensdomains/ensjs/internal'
|
|
5
|
+
import type { QueryOptions } from '@tanstack/query-core'
|
|
6
|
+
import type { Config } from '@wagmi/core'
|
|
7
|
+
import type {
|
|
8
|
+
Compute,
|
|
9
|
+
ExactPartial,
|
|
10
|
+
ScopeKeyParameter,
|
|
11
|
+
} from '@wagmi/core/internal'
|
|
12
|
+
import type { Chain } from 'viem'
|
|
13
|
+
import {
|
|
14
|
+
type GetWrapperNameErrorType,
|
|
15
|
+
type GetWrapperNameParameters,
|
|
16
|
+
type GetWrapperNameReturnType,
|
|
17
|
+
getWrapperName,
|
|
18
|
+
} from '../../actions/public/getWrapperName.js'
|
|
19
|
+
import type { RequireConfigContracts } from '../../utils/chain.js'
|
|
20
|
+
import { filterQueryOptions } from '../utils.js'
|
|
21
|
+
|
|
22
|
+
export type GetWrapperNameOptions<config extends Config> = Compute<
|
|
23
|
+
ExactPartial<GetWrapperNameParameters<config>> & ScopeKeyParameter
|
|
24
|
+
>
|
|
25
|
+
|
|
26
|
+
export function getWrapperNameQueryOptions<
|
|
27
|
+
chains extends readonly [Chain, ...Chain[]],
|
|
28
|
+
>(
|
|
29
|
+
config: RequireConfigContracts<chains, 'ensNameWrapper'>,
|
|
30
|
+
options: GetWrapperNameOptions<ExcludeTE<typeof config>> = {},
|
|
31
|
+
) {
|
|
32
|
+
ASSERT_NO_TYPE_ERROR(config)
|
|
33
|
+
|
|
34
|
+
return {
|
|
35
|
+
async queryFn({ queryKey }) {
|
|
36
|
+
const { name, scopeKey: _, ...parameters } = queryKey[1]
|
|
37
|
+
if (!name) throw new Error('name is required')
|
|
38
|
+
return getWrapperName<chains>(config, { ...parameters, name })
|
|
39
|
+
},
|
|
40
|
+
queryKey: getWrapperNameQueryKey(options),
|
|
41
|
+
} as const satisfies QueryOptions<
|
|
42
|
+
GetWrapperNameQueryFnData,
|
|
43
|
+
GetWrapperNameErrorType,
|
|
44
|
+
GetWrapperNameData,
|
|
45
|
+
GetWrapperNameQueryKey<typeof config>
|
|
46
|
+
>
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export type GetWrapperNameQueryFnData = GetWrapperNameReturnType
|
|
50
|
+
|
|
51
|
+
export type GetWrapperNameData = GetWrapperNameQueryFnData
|
|
52
|
+
|
|
53
|
+
export function getWrapperNameQueryKey<config extends Config>(
|
|
54
|
+
options: GetWrapperNameOptions<config> = {},
|
|
55
|
+
) {
|
|
56
|
+
return ['ensjs_wrapperName', filterQueryOptions(options)] as const
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export type GetWrapperNameQueryKey<config extends Config> = ReturnType<
|
|
60
|
+
typeof getWrapperNameQueryKey<config>
|
|
61
|
+
>
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
export {
|
|
2
|
+
type GetAbiRecordData,
|
|
3
|
+
type GetAbiRecordOptions,
|
|
4
|
+
type GetAbiRecordQueryFnData,
|
|
5
|
+
type GetAbiRecordQueryKey,
|
|
6
|
+
getAbiRecordQueryKey,
|
|
7
|
+
getAbiRecordQueryOptions,
|
|
8
|
+
} from './getAbiRecord.js'
|
|
9
|
+
|
|
10
|
+
export {
|
|
11
|
+
type GetAddressRecordData,
|
|
12
|
+
type GetAddressRecordOptions,
|
|
13
|
+
type GetAddressRecordQueryFnData,
|
|
14
|
+
type GetAddressRecordQueryKey,
|
|
15
|
+
getAddressRecordQueryKey,
|
|
16
|
+
getAddressRecordQueryOptions,
|
|
17
|
+
} from './getAddressRecord.js'
|
|
18
|
+
|
|
19
|
+
export {
|
|
20
|
+
type GetAvailableData,
|
|
21
|
+
type GetAvailableOptions,
|
|
22
|
+
type GetAvailableQueryFnData,
|
|
23
|
+
type GetAvailableQueryKey,
|
|
24
|
+
getAvailableQueryKey,
|
|
25
|
+
getAvailableQueryOptions,
|
|
26
|
+
} from './getAvailable.js'
|
|
27
|
+
|
|
28
|
+
export {
|
|
29
|
+
type GetContentHashRecordData,
|
|
30
|
+
type GetContentHashRecordOptions,
|
|
31
|
+
type GetContentHashRecordQueryFnData,
|
|
32
|
+
type GetContentHashRecordQueryKey,
|
|
33
|
+
getContentHashRecordQueryKey,
|
|
34
|
+
getContentHashRecordQueryOptions,
|
|
35
|
+
} from './getContentHashRecord.js'
|
|
36
|
+
|
|
37
|
+
export {
|
|
38
|
+
type GetCredentialsData,
|
|
39
|
+
type GetCredentialsOptions,
|
|
40
|
+
type GetCredentialsQueryFnData,
|
|
41
|
+
type GetCredentialsQueryKey,
|
|
42
|
+
getCredentialsQueryKey,
|
|
43
|
+
getCredentialsQueryOptions,
|
|
44
|
+
} from './getCredentials.js'
|
|
45
|
+
|
|
46
|
+
export {
|
|
47
|
+
type GetExpiryData,
|
|
48
|
+
type GetExpiryOptions,
|
|
49
|
+
type GetExpiryQueryFnData,
|
|
50
|
+
type GetExpiryQueryKey,
|
|
51
|
+
getExpiryQueryKey,
|
|
52
|
+
getExpiryQueryOptions,
|
|
53
|
+
} from './getExpiry.js'
|
|
54
|
+
|
|
55
|
+
export {
|
|
56
|
+
type GetNameData,
|
|
57
|
+
type GetNameOptions,
|
|
58
|
+
type GetNameQueryFnData,
|
|
59
|
+
type GetNameQueryKey,
|
|
60
|
+
getNameQueryKey,
|
|
61
|
+
getNameQueryOptions,
|
|
62
|
+
} from './getName.js'
|
|
63
|
+
|
|
64
|
+
export {
|
|
65
|
+
type GetOwnerData,
|
|
66
|
+
type GetOwnerOptions,
|
|
67
|
+
type GetOwnerQueryFnData,
|
|
68
|
+
type GetOwnerQueryKey,
|
|
69
|
+
getOwnerQueryKey,
|
|
70
|
+
getOwnerQueryOptions,
|
|
71
|
+
} from './getOwner.js'
|
|
72
|
+
|
|
73
|
+
export {
|
|
74
|
+
type GetPriceData,
|
|
75
|
+
type GetPriceOptions,
|
|
76
|
+
type GetPriceQueryFnData,
|
|
77
|
+
type GetPriceQueryKey,
|
|
78
|
+
getPriceQueryKey,
|
|
79
|
+
getPriceQueryOptions,
|
|
80
|
+
} from './getPrice.js'
|
|
81
|
+
|
|
82
|
+
export {
|
|
83
|
+
type GetRecordsData,
|
|
84
|
+
type GetRecordsOptions,
|
|
85
|
+
type GetRecordsQueryFnData,
|
|
86
|
+
type GetRecordsQueryKey,
|
|
87
|
+
getRecordsQueryKey,
|
|
88
|
+
getRecordsQueryOptions,
|
|
89
|
+
} from './getRecords.js'
|
|
90
|
+
|
|
91
|
+
export {
|
|
92
|
+
type GetResolverData,
|
|
93
|
+
type GetResolverOptions,
|
|
94
|
+
type GetResolverQueryFnData,
|
|
95
|
+
type GetResolverQueryKey,
|
|
96
|
+
getResolverQueryKey,
|
|
97
|
+
getResolverQueryOptions,
|
|
98
|
+
} from './getResolver.js'
|
|
99
|
+
|
|
100
|
+
export {
|
|
101
|
+
type GetSupportedInterfacesData,
|
|
102
|
+
type GetSupportedInterfacesOptions,
|
|
103
|
+
type GetSupportedInterfacesQueryFnData,
|
|
104
|
+
type GetSupportedInterfacesQueryKey,
|
|
105
|
+
getSupportedInterfacesQueryKey,
|
|
106
|
+
getSupportedInterfacesQueryOptions,
|
|
107
|
+
} from './getSupportedInterfaces.js'
|
|
108
|
+
|
|
109
|
+
export {
|
|
110
|
+
type GetTextRecordData,
|
|
111
|
+
type GetTextRecordOptions,
|
|
112
|
+
type GetTextRecordQueryFnData,
|
|
113
|
+
type GetTextRecordQueryKey,
|
|
114
|
+
getTextRecordQueryKey,
|
|
115
|
+
getTextRecordQueryOptions,
|
|
116
|
+
} from './getTextRecord.js'
|
|
117
|
+
|
|
118
|
+
export {
|
|
119
|
+
type GetWrapperDataData,
|
|
120
|
+
type GetWrapperDataOptions,
|
|
121
|
+
type GetWrapperDataQueryFnData,
|
|
122
|
+
type GetWrapperDataQueryKey,
|
|
123
|
+
getWrapperDataQueryKey,
|
|
124
|
+
getWrapperDataQueryOptions,
|
|
125
|
+
} from './getWrapperData.js'
|
|
126
|
+
|
|
127
|
+
export {
|
|
128
|
+
type GetWrapperNameData,
|
|
129
|
+
type GetWrapperNameOptions,
|
|
130
|
+
type GetWrapperNameQueryFnData,
|
|
131
|
+
type GetWrapperNameQueryKey,
|
|
132
|
+
getWrapperNameQueryKey,
|
|
133
|
+
getWrapperNameQueryOptions,
|
|
134
|
+
} from './getWrapperName.js'
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/* biome-ignore-all lint/correctness/noUnusedVariables: just for destructuring */
|
|
2
|
+
|
|
3
|
+
export function filterQueryOptions<type extends Record<string, unknown>>(
|
|
4
|
+
options: type,
|
|
5
|
+
): type {
|
|
6
|
+
// destructuring is super fast
|
|
7
|
+
// biome-ignore format: no formatting
|
|
8
|
+
const {
|
|
9
|
+
// import('@tanstack/query-core').QueryOptions
|
|
10
|
+
_defaulted, behavior, gcTime, initialData, initialDataUpdatedAt, maxPages, meta, networkMode, queryFn, queryHash, queryKey, queryKeyHashFn, retry, retryDelay, structuralSharing,
|
|
11
|
+
|
|
12
|
+
// import('@tanstack/query-core').InfiniteQueryObserverOptions
|
|
13
|
+
getPreviousPageParam, getNextPageParam, initialPageParam,
|
|
14
|
+
|
|
15
|
+
// import('@tanstack/react-query').UseQueryOptions
|
|
16
|
+
_optimisticResults, enabled, notifyOnChangeProps, placeholderData, refetchInterval, refetchIntervalInBackground, refetchOnMount, refetchOnReconnect, refetchOnWindowFocus, retryOnMount, select, staleTime, suspense, throwOnError,
|
|
17
|
+
|
|
18
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
19
|
+
// wagmi
|
|
20
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
21
|
+
config, connector, query,
|
|
22
|
+
...rest
|
|
23
|
+
} = options
|
|
24
|
+
|
|
25
|
+
return rest as type
|
|
26
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ASSERT_NO_TYPE_ERROR,
|
|
3
|
+
type ExcludeTE,
|
|
4
|
+
} from '@ensdomains/ensjs/internal'
|
|
5
|
+
import type { MutationOptions } from '@tanstack/query-core'
|
|
6
|
+
import type { Config } from '@wagmi/core'
|
|
7
|
+
import type {
|
|
8
|
+
Compute,
|
|
9
|
+
ExactPartial,
|
|
10
|
+
ScopeKeyParameter,
|
|
11
|
+
} from '@wagmi/core/internal'
|
|
12
|
+
import type { Chain } from 'viem'
|
|
13
|
+
import {
|
|
14
|
+
type ClearRecordsErrorType,
|
|
15
|
+
type ClearRecordsParameters,
|
|
16
|
+
type ClearRecordsReturnType,
|
|
17
|
+
clearRecords,
|
|
18
|
+
} from '../../actions/wallet/clearRecords.js'
|
|
19
|
+
import type { RequireConfigContracts } from '../../utils/chain.js'
|
|
20
|
+
import { filterQueryOptions } from '../utils.js'
|
|
21
|
+
|
|
22
|
+
export type ClearRecordsOptions<config extends Config> = Compute<
|
|
23
|
+
ExactPartial<ClearRecordsParameters<config>> & ScopeKeyParameter
|
|
24
|
+
>
|
|
25
|
+
|
|
26
|
+
export function clearRecordsMutationOptions<
|
|
27
|
+
chains extends readonly [Chain, ...Chain[]],
|
|
28
|
+
>(
|
|
29
|
+
config: RequireConfigContracts<chains, 'ensUniversalResolver'>,
|
|
30
|
+
options: ClearRecordsOptions<ExcludeTE<typeof config>>,
|
|
31
|
+
) {
|
|
32
|
+
ASSERT_NO_TYPE_ERROR(config)
|
|
33
|
+
|
|
34
|
+
return {
|
|
35
|
+
mutationFn: async (variables: ClearRecordsParameters<typeof config>) => {
|
|
36
|
+
return clearRecords(config, variables)
|
|
37
|
+
},
|
|
38
|
+
mutationKey: clearRecordsMutationKey(options),
|
|
39
|
+
} as const satisfies MutationOptions<
|
|
40
|
+
ClearRecordsReturnType,
|
|
41
|
+
ClearRecordsErrorType,
|
|
42
|
+
ClearRecordsParameters<typeof config>
|
|
43
|
+
>
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function clearRecordsMutationKey<config extends Config>(
|
|
47
|
+
options: ClearRecordsOptions<config>,
|
|
48
|
+
) {
|
|
49
|
+
return ['ensjs_clearRecords', filterQueryOptions(options)] as const
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export type ClearRecordsMutationKey<config extends Config> = ReturnType<
|
|
53
|
+
typeof clearRecordsMutationKey<config>
|
|
54
|
+
>
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ASSERT_NO_TYPE_ERROR,
|
|
3
|
+
type ExcludeTE,
|
|
4
|
+
} from '@ensdomains/ensjs/internal'
|
|
5
|
+
import type { MutationOptions } from '@tanstack/query-core'
|
|
6
|
+
import type { Config } from '@wagmi/core'
|
|
7
|
+
import type {
|
|
8
|
+
Compute,
|
|
9
|
+
ExactPartial,
|
|
10
|
+
ScopeKeyParameter,
|
|
11
|
+
} from '@wagmi/core/internal'
|
|
12
|
+
import type { Chain } from 'viem'
|
|
13
|
+
import {
|
|
14
|
+
type CommitNameErrorType,
|
|
15
|
+
type CommitNameParameters,
|
|
16
|
+
type CommitNameReturnType,
|
|
17
|
+
commitName,
|
|
18
|
+
} from '../../actions/wallet/commitName.js'
|
|
19
|
+
import type { RequireConfigContracts } from '../../utils/chain.js'
|
|
20
|
+
import { filterQueryOptions } from '../utils.js'
|
|
21
|
+
|
|
22
|
+
export type CommitNameOptions<config extends Config> = Compute<
|
|
23
|
+
ExactPartial<CommitNameParameters<config>> & ScopeKeyParameter
|
|
24
|
+
>
|
|
25
|
+
|
|
26
|
+
export function commitNameMutationOptions<
|
|
27
|
+
chains extends readonly [Chain, ...Chain[]],
|
|
28
|
+
>(
|
|
29
|
+
config: RequireConfigContracts<chains, 'ensEthRegistrarController'>,
|
|
30
|
+
options: CommitNameOptions<ExcludeTE<typeof config>>,
|
|
31
|
+
) {
|
|
32
|
+
ASSERT_NO_TYPE_ERROR(config)
|
|
33
|
+
|
|
34
|
+
return {
|
|
35
|
+
mutationFn: async (variables: CommitNameParameters<typeof config>) => {
|
|
36
|
+
return commitName(config, variables)
|
|
37
|
+
},
|
|
38
|
+
mutationKey: commitNameMutationKey(options),
|
|
39
|
+
} as const satisfies MutationOptions<
|
|
40
|
+
CommitNameReturnType,
|
|
41
|
+
CommitNameErrorType,
|
|
42
|
+
CommitNameParameters<typeof config>
|
|
43
|
+
>
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function commitNameMutationKey<config extends Config>(
|
|
47
|
+
options: CommitNameOptions<config>,
|
|
48
|
+
) {
|
|
49
|
+
return ['ensjs_commitName', filterQueryOptions(options)] as const
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export type CommitNameMutationKey<config extends Config> = ReturnType<
|
|
53
|
+
typeof commitNameMutationKey<config>
|
|
54
|
+
>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ASSERT_NO_TYPE_ERROR,
|
|
3
|
+
type ExcludeTE,
|
|
4
|
+
} from '@ensdomains/ensjs/internal'
|
|
5
|
+
import type { MutationOptions } from '@tanstack/query-core'
|
|
6
|
+
import type { Config } from '@wagmi/core'
|
|
7
|
+
import type {
|
|
8
|
+
Compute,
|
|
9
|
+
ExactPartial,
|
|
10
|
+
ScopeKeyParameter,
|
|
11
|
+
} from '@wagmi/core/internal'
|
|
12
|
+
import type { Chain } from 'viem'
|
|
13
|
+
import {
|
|
14
|
+
type CreateSubnameErrorType,
|
|
15
|
+
type CreateSubnameParameters,
|
|
16
|
+
type CreateSubnameReturnType,
|
|
17
|
+
createSubname,
|
|
18
|
+
} from '../../actions/wallet/createSubname.js'
|
|
19
|
+
import type { RequireConfigContracts } from '../../utils/chain.js'
|
|
20
|
+
import { filterQueryOptions } from '../utils.js'
|
|
21
|
+
|
|
22
|
+
export type CreateSubnameOptions<config extends Config> = Compute<
|
|
23
|
+
ExactPartial<CreateSubnameParameters<config>> & ScopeKeyParameter
|
|
24
|
+
>
|
|
25
|
+
|
|
26
|
+
export function createSubnameMutationOptions<
|
|
27
|
+
chains extends readonly [Chain, ...Chain[]],
|
|
28
|
+
>(
|
|
29
|
+
config: RequireConfigContracts<
|
|
30
|
+
chains,
|
|
31
|
+
'ensNameWrapper' | 'ensPublicResolver'
|
|
32
|
+
>,
|
|
33
|
+
options: CreateSubnameOptions<ExcludeTE<typeof config>>,
|
|
34
|
+
) {
|
|
35
|
+
ASSERT_NO_TYPE_ERROR(config)
|
|
36
|
+
|
|
37
|
+
return {
|
|
38
|
+
mutationFn: async (variables: CreateSubnameParameters<typeof config>) => {
|
|
39
|
+
return createSubname(config, variables)
|
|
40
|
+
},
|
|
41
|
+
mutationKey: createSubnameMutationKey(options),
|
|
42
|
+
} as const satisfies MutationOptions<
|
|
43
|
+
CreateSubnameReturnType,
|
|
44
|
+
CreateSubnameErrorType,
|
|
45
|
+
CreateSubnameParameters<typeof config>
|
|
46
|
+
>
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function createSubnameMutationKey<config extends Config>(
|
|
50
|
+
options: CreateSubnameOptions<config>,
|
|
51
|
+
) {
|
|
52
|
+
return ['ensjs_createSubname', filterQueryOptions(options)] as const
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export type CreateSubnameMutationKey<config extends Config> = ReturnType<
|
|
56
|
+
typeof createSubnameMutationKey<config>
|
|
57
|
+
>
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ASSERT_NO_TYPE_ERROR,
|
|
3
|
+
type ExcludeTE,
|
|
4
|
+
} from '@ensdomains/ensjs/internal'
|
|
5
|
+
import type { MutationOptions } from '@tanstack/query-core'
|
|
6
|
+
import type { Config } from '@wagmi/core'
|
|
7
|
+
import type {
|
|
8
|
+
Compute,
|
|
9
|
+
ExactPartial,
|
|
10
|
+
ScopeKeyParameter,
|
|
11
|
+
} from '@wagmi/core/internal'
|
|
12
|
+
import type { Chain } from 'viem'
|
|
13
|
+
import {
|
|
14
|
+
type DeleteSubnameErrorType,
|
|
15
|
+
type DeleteSubnameParameters,
|
|
16
|
+
type DeleteSubnameReturnType,
|
|
17
|
+
deleteSubname,
|
|
18
|
+
} from '../../actions/wallet/deleteSubname.js'
|
|
19
|
+
import type { RequireConfigContracts } from '../../utils/chain.js'
|
|
20
|
+
import { filterQueryOptions } from '../utils.js'
|
|
21
|
+
|
|
22
|
+
export type DeleteSubnameOptions<config extends Config> = Compute<
|
|
23
|
+
ExactPartial<DeleteSubnameParameters<config>> & ScopeKeyParameter
|
|
24
|
+
>
|
|
25
|
+
|
|
26
|
+
export function deleteSubnameMutationOptions<
|
|
27
|
+
chains extends readonly [Chain, ...Chain[]],
|
|
28
|
+
>(
|
|
29
|
+
config: RequireConfigContracts<chains, 'ensRegistry' | 'ensNameWrapper'>,
|
|
30
|
+
options: DeleteSubnameOptions<ExcludeTE<typeof config>>,
|
|
31
|
+
) {
|
|
32
|
+
ASSERT_NO_TYPE_ERROR(config)
|
|
33
|
+
|
|
34
|
+
return {
|
|
35
|
+
mutationFn: async (variables: DeleteSubnameParameters<typeof config>) => {
|
|
36
|
+
return deleteSubname(config, variables)
|
|
37
|
+
},
|
|
38
|
+
mutationKey: deleteSubnameMutationKey(options),
|
|
39
|
+
} as const satisfies MutationOptions<
|
|
40
|
+
DeleteSubnameReturnType,
|
|
41
|
+
DeleteSubnameErrorType,
|
|
42
|
+
DeleteSubnameParameters<typeof config>
|
|
43
|
+
>
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function deleteSubnameMutationKey<config extends Config>(
|
|
47
|
+
options: DeleteSubnameOptions<config>,
|
|
48
|
+
) {
|
|
49
|
+
return ['ensjs_deleteSubname', filterQueryOptions(options)] as const
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export type DeleteSubnameMutationKey<config extends Config> = ReturnType<
|
|
53
|
+
typeof deleteSubnameMutationKey<config>
|
|
54
|
+
>
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
export {
|
|
2
|
+
type ClearRecordsMutationKey,
|
|
3
|
+
type ClearRecordsOptions,
|
|
4
|
+
clearRecordsMutationKey,
|
|
5
|
+
clearRecordsMutationOptions,
|
|
6
|
+
} from './clearRecords.js'
|
|
7
|
+
export {
|
|
8
|
+
type CommitNameMutationKey,
|
|
9
|
+
type CommitNameOptions,
|
|
10
|
+
commitNameMutationKey,
|
|
11
|
+
commitNameMutationOptions,
|
|
12
|
+
} from './commitName.js'
|
|
13
|
+
export {
|
|
14
|
+
type CreateSubnameMutationKey,
|
|
15
|
+
type CreateSubnameOptions,
|
|
16
|
+
createSubnameMutationKey,
|
|
17
|
+
createSubnameMutationOptions,
|
|
18
|
+
} from './createSubname.js'
|
|
19
|
+
export {
|
|
20
|
+
type DeleteSubnameMutationKey,
|
|
21
|
+
type DeleteSubnameOptions,
|
|
22
|
+
deleteSubnameMutationKey,
|
|
23
|
+
deleteSubnameMutationOptions,
|
|
24
|
+
} from './deleteSubname.js'
|
|
25
|
+
export {
|
|
26
|
+
type RegisterNameMutationKey,
|
|
27
|
+
type RegisterNameOptions,
|
|
28
|
+
registerNameMutationKey,
|
|
29
|
+
registerNameMutationOptions,
|
|
30
|
+
} from './registerName.js'
|
|
31
|
+
export {
|
|
32
|
+
type RenewNamesMutationKey,
|
|
33
|
+
type RenewNamesOptions,
|
|
34
|
+
renewNamesMutationKey,
|
|
35
|
+
renewNamesMutationOptions,
|
|
36
|
+
} from './renewNames.js'
|
|
37
|
+
export {
|
|
38
|
+
type SetAbiRecordMutationKey,
|
|
39
|
+
type SetAbiRecordOptions,
|
|
40
|
+
setAbiRecordMutationKey,
|
|
41
|
+
setAbiRecordMutationOptions,
|
|
42
|
+
} from './setAbiRecord.js'
|
|
43
|
+
export {
|
|
44
|
+
type SetAddressRecordMutationKey,
|
|
45
|
+
type SetAddressRecordOptions,
|
|
46
|
+
setAddressRecordMutationKey,
|
|
47
|
+
setAddressRecordMutationOptions,
|
|
48
|
+
} from './setAddressRecord.js'
|
|
49
|
+
export {
|
|
50
|
+
type SetContentHashRecordMutationKey,
|
|
51
|
+
type SetContentHashRecordOptions,
|
|
52
|
+
setContentHashRecordMutationKey,
|
|
53
|
+
setContentHashRecordMutationOptions,
|
|
54
|
+
} from './setContentHashRecord.js'
|
|
55
|
+
export {
|
|
56
|
+
type SetPrimaryNameMutationKey,
|
|
57
|
+
type SetPrimaryNameOptions,
|
|
58
|
+
setPrimaryNameMutationKey,
|
|
59
|
+
setPrimaryNameMutationOptions,
|
|
60
|
+
} from './setPrimaryName.js'
|
|
61
|
+
export {
|
|
62
|
+
type SetRecordsMutationKey,
|
|
63
|
+
type SetRecordsOptions,
|
|
64
|
+
setRecordsMutationKey,
|
|
65
|
+
setRecordsMutationOptions,
|
|
66
|
+
} from './setRecords.js'
|
|
67
|
+
export {
|
|
68
|
+
type SetResolverMutationKey,
|
|
69
|
+
type SetResolverOptions,
|
|
70
|
+
setResolverMutationKey,
|
|
71
|
+
setResolverMutationOptions,
|
|
72
|
+
} from './setResolver.js'
|
|
73
|
+
export {
|
|
74
|
+
type SetTextRecordMutationKey,
|
|
75
|
+
type SetTextRecordOptions,
|
|
76
|
+
setTextRecordMutationKey,
|
|
77
|
+
setTextRecordMutationOptions,
|
|
78
|
+
} from './setTextRecord.js'
|
|
79
|
+
|
|
80
|
+
export {
|
|
81
|
+
type TransferNameMutationKey,
|
|
82
|
+
type TransferNameOptions,
|
|
83
|
+
transferNameMutationKey,
|
|
84
|
+
transferNameMutationOptions,
|
|
85
|
+
} from './transferName.js'
|