@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,39 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ASSERT_NO_TYPE_ERROR,
|
|
3
|
+
type ExcludeTE,
|
|
4
|
+
} from '@ensdomains/ensjs/internal'
|
|
5
|
+
import {
|
|
6
|
+
type GetTextRecordErrorType as ensjs_GetTextRecordErrorType,
|
|
7
|
+
type GetTextRecordParameters as ensjs_GetTextRecordParameters,
|
|
8
|
+
type GetTextRecordReturnType as ensjs_GetTextRecordReturnType,
|
|
9
|
+
getTextRecord as ensjs_getTextRecord,
|
|
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 GetTextRecordParameters<config extends Config = Config> = Prettify<
|
|
18
|
+
ensjs_GetTextRecordParameters & ChainIdParameter<config>
|
|
19
|
+
>
|
|
20
|
+
|
|
21
|
+
export type GetTextRecordReturnType = ensjs_GetTextRecordReturnType
|
|
22
|
+
|
|
23
|
+
export type GetTextRecordErrorType = ensjs_GetTextRecordErrorType
|
|
24
|
+
|
|
25
|
+
export function getTextRecord<chains extends readonly [Chain, ...Chain[]]>(
|
|
26
|
+
config: RequireConfigContracts<chains, 'ensUniversalResolver'>,
|
|
27
|
+
parameters: GetTextRecordParameters<ExcludeTE<typeof config>>,
|
|
28
|
+
): Promise<GetTextRecordReturnType> {
|
|
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_getTextRecord<typeof client.chain>,
|
|
36
|
+
'getTextRecord',
|
|
37
|
+
)
|
|
38
|
+
return action(rest)
|
|
39
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ASSERT_NO_TYPE_ERROR,
|
|
3
|
+
type ExcludeTE,
|
|
4
|
+
} from '@ensdomains/ensjs/internal'
|
|
5
|
+
import {
|
|
6
|
+
type GetWrapperDataErrorType as ensjs_GetWrapperDataErrorType,
|
|
7
|
+
type GetWrapperDataParameters as ensjs_GetWrapperDataParameters,
|
|
8
|
+
type GetWrapperDataReturnType as ensjs_GetWrapperDataReturnType,
|
|
9
|
+
getWrapperData as ensjs_getWrapperData,
|
|
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 GetWrapperDataParameters<config extends Config = Config> = Prettify<
|
|
18
|
+
ensjs_GetWrapperDataParameters & ChainIdParameter<config>
|
|
19
|
+
>
|
|
20
|
+
|
|
21
|
+
export type GetWrapperDataReturnType = ensjs_GetWrapperDataReturnType
|
|
22
|
+
|
|
23
|
+
export type GetWrapperDataErrorType = ensjs_GetWrapperDataErrorType
|
|
24
|
+
|
|
25
|
+
export function getWrapperData<chains extends readonly [Chain, ...Chain[]]>(
|
|
26
|
+
config: RequireConfigContracts<chains, 'ensNameWrapper' | 'multicall3'>,
|
|
27
|
+
parameters: GetWrapperDataParameters<ExcludeTE<typeof config>>,
|
|
28
|
+
): Promise<GetWrapperDataReturnType> {
|
|
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_getWrapperData<typeof client.chain>,
|
|
36
|
+
'getWrapperData',
|
|
37
|
+
)
|
|
38
|
+
return action(rest)
|
|
39
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ASSERT_NO_TYPE_ERROR,
|
|
3
|
+
type ExcludeTE,
|
|
4
|
+
} from '@ensdomains/ensjs/internal'
|
|
5
|
+
import {
|
|
6
|
+
type GetWrapperNameErrorType as ensjs_GetWrapperNameErrorType,
|
|
7
|
+
type GetWrapperNameParameters as ensjs_GetWrapperNameParameters,
|
|
8
|
+
type GetWrapperNameReturnType as ensjs_GetWrapperNameReturnType,
|
|
9
|
+
getWrapperName as ensjs_getWrapperName,
|
|
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 GetWrapperNameParameters<config extends Config = Config> = Prettify<
|
|
18
|
+
ensjs_GetWrapperNameParameters & ChainIdParameter<config>
|
|
19
|
+
>
|
|
20
|
+
|
|
21
|
+
export type GetWrapperNameReturnType = ensjs_GetWrapperNameReturnType
|
|
22
|
+
|
|
23
|
+
export type GetWrapperNameErrorType = ensjs_GetWrapperNameErrorType
|
|
24
|
+
|
|
25
|
+
export function getWrapperName<chains extends readonly [Chain, ...Chain[]]>(
|
|
26
|
+
config: RequireConfigContracts<chains, 'ensNameWrapper'>,
|
|
27
|
+
parameters: GetWrapperNameParameters<ExcludeTE<typeof config>>,
|
|
28
|
+
): Promise<GetWrapperNameReturnType> {
|
|
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_getWrapperName<typeof client.chain>,
|
|
36
|
+
'getWrapperName',
|
|
37
|
+
)
|
|
38
|
+
return action(rest)
|
|
39
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ASSERT_NO_TYPE_ERROR,
|
|
3
|
+
type ExcludeTE,
|
|
4
|
+
} from '@ensdomains/ensjs/internal'
|
|
5
|
+
import {
|
|
6
|
+
type ResolveNameDataErrorType as ensjs_ResolveNameDataErrorType,
|
|
7
|
+
type ResolveNameDataParameters as ensjs_ResolveNameDataParameters,
|
|
8
|
+
type ResolveNameDataReturnType as ensjs_ResolveNameDataReturnType,
|
|
9
|
+
resolveNameData as ensjs_resolveNameData,
|
|
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 ResolveNameDataParameters<
|
|
18
|
+
data extends Hex | Hex[],
|
|
19
|
+
config extends Config = Config,
|
|
20
|
+
> = Prettify<ensjs_ResolveNameDataParameters<data> & ChainIdParameter<config>>
|
|
21
|
+
|
|
22
|
+
export type ResolveNameDataReturnType<data extends Hex | Hex[]> =
|
|
23
|
+
ensjs_ResolveNameDataReturnType<data>
|
|
24
|
+
|
|
25
|
+
export type ResolveNameDataErrorType = ensjs_ResolveNameDataErrorType
|
|
26
|
+
|
|
27
|
+
export function resolveNameData<
|
|
28
|
+
chains extends readonly [Chain, ...Chain[]],
|
|
29
|
+
data extends Hex | Hex[],
|
|
30
|
+
>(
|
|
31
|
+
config: RequireConfigContracts<chains, 'ensUniversalResolver'>,
|
|
32
|
+
parameters: ResolveNameDataParameters<data, ExcludeTE<typeof config>>,
|
|
33
|
+
): Promise<ResolveNameDataReturnType<data>> {
|
|
34
|
+
ASSERT_NO_TYPE_ERROR(config)
|
|
35
|
+
|
|
36
|
+
const { chainId, ...rest } = parameters
|
|
37
|
+
const client = config.getClient({ chainId })
|
|
38
|
+
const action = getAction(
|
|
39
|
+
client,
|
|
40
|
+
ensjs_resolveNameData<typeof client.chain, data>,
|
|
41
|
+
// TODO: Add resolveNameData to the client decorators
|
|
42
|
+
// @ts-expect-error - Not yet added to decorator
|
|
43
|
+
'resolveNameData',
|
|
44
|
+
)
|
|
45
|
+
return action(rest)
|
|
46
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ASSERT_NO_TYPE_ERROR,
|
|
3
|
+
type ExcludeTE,
|
|
4
|
+
} from '@ensdomains/ensjs/internal'
|
|
5
|
+
import {
|
|
6
|
+
type ClearRecordsErrorType as ensjs_ClearRecordsErrorType,
|
|
7
|
+
type ClearRecordsParameters as ensjs_ClearRecordsParameters,
|
|
8
|
+
type ClearRecordsReturnType as ensjs_ClearRecordsReturnType,
|
|
9
|
+
clearRecords as ensjs_clearRecords,
|
|
10
|
+
} from '@ensdomains/ensjs/wallet'
|
|
11
|
+
import { type Config, getConnectorClient, type SelectChains } from '@wagmi/core'
|
|
12
|
+
import type {
|
|
13
|
+
ChainIdParameter,
|
|
14
|
+
Compute,
|
|
15
|
+
ConnectorParameter,
|
|
16
|
+
} from '@wagmi/core/internal'
|
|
17
|
+
import type { Account, Chain, Client } from 'viem'
|
|
18
|
+
import type { RequireConfigContracts } from '../../utils/chain.js'
|
|
19
|
+
import { getAction } from '../../utils/getAction.js'
|
|
20
|
+
|
|
21
|
+
// export type GetAbiRecordParameters<config extends Config = Config> = Prettify<
|
|
22
|
+
// ensjs_ClearRecordsParameters & ChainIdParameter<config>
|
|
23
|
+
// >
|
|
24
|
+
|
|
25
|
+
export type ClearRecordsParameters<
|
|
26
|
+
config extends Config = Config,
|
|
27
|
+
chainId extends
|
|
28
|
+
config['chains'][number]['id'] = config['chains'][number]['id'],
|
|
29
|
+
chains extends readonly Chain[] = SelectChains<config, chainId>,
|
|
30
|
+
> = {
|
|
31
|
+
[key in keyof chains]: Compute<
|
|
32
|
+
Omit<
|
|
33
|
+
ensjs_ClearRecordsParameters<chains[key], Account, chains[key]>,
|
|
34
|
+
'chain'
|
|
35
|
+
> &
|
|
36
|
+
ChainIdParameter<config, chainId> &
|
|
37
|
+
ConnectorParameter
|
|
38
|
+
>
|
|
39
|
+
}[number]
|
|
40
|
+
|
|
41
|
+
export type ClearRecordsReturnType = ensjs_ClearRecordsReturnType
|
|
42
|
+
|
|
43
|
+
export type ClearRecordsErrorType = ensjs_ClearRecordsErrorType
|
|
44
|
+
|
|
45
|
+
export async function clearRecords<chains extends readonly [Chain, ...Chain[]]>(
|
|
46
|
+
config: RequireConfigContracts<chains, 'ensUniversalResolver'>,
|
|
47
|
+
parameters: ClearRecordsParameters<ExcludeTE<typeof config>>,
|
|
48
|
+
): Promise<ClearRecordsReturnType> {
|
|
49
|
+
ASSERT_NO_TYPE_ERROR(config)
|
|
50
|
+
|
|
51
|
+
const { account, chainId, connector, ...rest } = parameters
|
|
52
|
+
|
|
53
|
+
let client: Client<any, Chain>
|
|
54
|
+
if (typeof account === 'object' && account?.type === 'local')
|
|
55
|
+
client = config.getClient({ chainId })
|
|
56
|
+
else
|
|
57
|
+
client = await getConnectorClient(config, {
|
|
58
|
+
account: account ?? undefined,
|
|
59
|
+
chainId,
|
|
60
|
+
connector,
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
const action = getAction(client, ensjs_clearRecords, 'clearRecords')
|
|
64
|
+
return await action({
|
|
65
|
+
...(rest as any),
|
|
66
|
+
...(account ? { account } : {}),
|
|
67
|
+
chain: chainId ? { id: chainId } : null,
|
|
68
|
+
})
|
|
69
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ASSERT_NO_TYPE_ERROR,
|
|
3
|
+
type ExcludeTE,
|
|
4
|
+
} from '@ensdomains/ensjs/internal'
|
|
5
|
+
import {
|
|
6
|
+
type CommitNameErrorType as ensjs_CommitNameErrorType,
|
|
7
|
+
type CommitNameParameters as ensjs_CommitNameParameters,
|
|
8
|
+
type CommitNameReturnType as ensjs_CommitNameReturnType,
|
|
9
|
+
commitName as ensjs_commitName,
|
|
10
|
+
} from '@ensdomains/ensjs/wallet'
|
|
11
|
+
import { type Config, getConnectorClient, type SelectChains } from '@wagmi/core'
|
|
12
|
+
import type {
|
|
13
|
+
ChainIdParameter,
|
|
14
|
+
Compute,
|
|
15
|
+
ConnectorParameter,
|
|
16
|
+
} from '@wagmi/core/internal'
|
|
17
|
+
import type { Account, Chain, Client } from 'viem'
|
|
18
|
+
import type { RequireConfigContracts } from '../../utils/chain.js'
|
|
19
|
+
import { getAction } from '../../utils/getAction.js'
|
|
20
|
+
|
|
21
|
+
export type CommitNameParameters<
|
|
22
|
+
config extends Config = Config,
|
|
23
|
+
chainId extends
|
|
24
|
+
config['chains'][number]['id'] = config['chains'][number]['id'],
|
|
25
|
+
chains extends readonly Chain[] = SelectChains<config, chainId>,
|
|
26
|
+
> = {
|
|
27
|
+
[key in keyof chains]: Compute<
|
|
28
|
+
Omit<ensjs_CommitNameParameters<chains[key], Account, any>, 'chain'> &
|
|
29
|
+
ChainIdParameter<config, chainId> &
|
|
30
|
+
ConnectorParameter
|
|
31
|
+
>
|
|
32
|
+
}[number]
|
|
33
|
+
|
|
34
|
+
export type CommitNameReturnType = ensjs_CommitNameReturnType
|
|
35
|
+
|
|
36
|
+
export type CommitNameErrorType = ensjs_CommitNameErrorType
|
|
37
|
+
|
|
38
|
+
export async function commitName<chains extends readonly [Chain, ...Chain[]]>(
|
|
39
|
+
config: RequireConfigContracts<chains, 'ensEthRegistrarController'>,
|
|
40
|
+
parameters: CommitNameParameters<ExcludeTE<typeof config>>,
|
|
41
|
+
): Promise<CommitNameReturnType> {
|
|
42
|
+
ASSERT_NO_TYPE_ERROR(config)
|
|
43
|
+
|
|
44
|
+
const { account, chainId, connector, ...rest } = parameters
|
|
45
|
+
|
|
46
|
+
let client: Client<any, Chain>
|
|
47
|
+
if (typeof account === 'object' && account?.type === 'local')
|
|
48
|
+
client = config.getClient({ chainId })
|
|
49
|
+
else
|
|
50
|
+
client = await getConnectorClient(config, {
|
|
51
|
+
account: account ?? undefined,
|
|
52
|
+
chainId,
|
|
53
|
+
connector,
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
const action = getAction(client, ensjs_commitName, 'commitName')
|
|
57
|
+
return await action({
|
|
58
|
+
...(rest as any),
|
|
59
|
+
...(account ? { account } : {}),
|
|
60
|
+
chain: chainId ? { id: chainId } : null,
|
|
61
|
+
})
|
|
62
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ASSERT_NO_TYPE_ERROR,
|
|
3
|
+
type ExcludeTE,
|
|
4
|
+
} from '@ensdomains/ensjs/internal'
|
|
5
|
+
import {
|
|
6
|
+
type CreateSubnameErrorType as ensjs_CreateSubnameErrorType,
|
|
7
|
+
type CreateSubnameParameters as ensjs_CreateSubnameParameters,
|
|
8
|
+
type CreateSubnameReturnType as ensjs_CreateSubnameReturnType,
|
|
9
|
+
createSubname as ensjs_createSubname,
|
|
10
|
+
} from '@ensdomains/ensjs/wallet'
|
|
11
|
+
import { type Config, getConnectorClient, type SelectChains } from '@wagmi/core'
|
|
12
|
+
import type {
|
|
13
|
+
ChainIdParameter,
|
|
14
|
+
Compute,
|
|
15
|
+
ConnectorParameter,
|
|
16
|
+
} from '@wagmi/core/internal'
|
|
17
|
+
import type { Account, Chain, Client } from 'viem'
|
|
18
|
+
import type { RequireConfigContracts } from '../../utils/chain.js'
|
|
19
|
+
import { getAction } from '../../utils/getAction.js'
|
|
20
|
+
|
|
21
|
+
export type CreateSubnameParameters<
|
|
22
|
+
config extends Config = Config,
|
|
23
|
+
chainId extends
|
|
24
|
+
config['chains'][number]['id'] = config['chains'][number]['id'],
|
|
25
|
+
chains extends readonly Chain[] = SelectChains<config, chainId>,
|
|
26
|
+
> = {
|
|
27
|
+
[key in keyof chains]: Compute<
|
|
28
|
+
Omit<ensjs_CreateSubnameParameters<chains[key], Account, any>, 'chain'> &
|
|
29
|
+
ChainIdParameter<config, chainId> &
|
|
30
|
+
ConnectorParameter
|
|
31
|
+
>
|
|
32
|
+
}[number]
|
|
33
|
+
|
|
34
|
+
export type CreateSubnameReturnType = ensjs_CreateSubnameReturnType
|
|
35
|
+
|
|
36
|
+
export type CreateSubnameErrorType = ensjs_CreateSubnameErrorType
|
|
37
|
+
|
|
38
|
+
export async function createSubname<
|
|
39
|
+
chains extends readonly [Chain, ...Chain[]],
|
|
40
|
+
>(
|
|
41
|
+
config: RequireConfigContracts<
|
|
42
|
+
chains,
|
|
43
|
+
'ensNameWrapper' | 'ensPublicResolver'
|
|
44
|
+
>,
|
|
45
|
+
parameters: CreateSubnameParameters<ExcludeTE<typeof config>>,
|
|
46
|
+
): Promise<CreateSubnameReturnType> {
|
|
47
|
+
ASSERT_NO_TYPE_ERROR(config)
|
|
48
|
+
|
|
49
|
+
const { account, chainId, connector, ...rest } = parameters
|
|
50
|
+
|
|
51
|
+
let client: Client<any, Chain>
|
|
52
|
+
if (typeof account === 'object' && account?.type === 'local')
|
|
53
|
+
client = config.getClient({ chainId })
|
|
54
|
+
else
|
|
55
|
+
client = await getConnectorClient(config, {
|
|
56
|
+
account: account ?? undefined,
|
|
57
|
+
chainId,
|
|
58
|
+
connector,
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
const action = getAction(client, ensjs_createSubname, 'createSubname')
|
|
62
|
+
return await action({
|
|
63
|
+
...(rest as any),
|
|
64
|
+
...(account ? { account } : {}),
|
|
65
|
+
chain: chainId ? { id: chainId } : null,
|
|
66
|
+
})
|
|
67
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ASSERT_NO_TYPE_ERROR,
|
|
3
|
+
type ExcludeTE,
|
|
4
|
+
} from '@ensdomains/ensjs/internal'
|
|
5
|
+
import {
|
|
6
|
+
type DeleteSubnameErrorType as ensjs_DeleteSubnameErrorType,
|
|
7
|
+
type DeleteSubnameParameters as ensjs_DeleteSubnameParameters,
|
|
8
|
+
type DeleteSubnameReturnType as ensjs_DeleteSubnameReturnType,
|
|
9
|
+
deleteSubname as ensjs_deleteSubname,
|
|
10
|
+
} from '@ensdomains/ensjs/wallet'
|
|
11
|
+
import { type Config, getConnectorClient, type SelectChains } from '@wagmi/core'
|
|
12
|
+
import type {
|
|
13
|
+
ChainIdParameter,
|
|
14
|
+
Compute,
|
|
15
|
+
ConnectorParameter,
|
|
16
|
+
} from '@wagmi/core/internal'
|
|
17
|
+
import type { Account, Chain, Client } from 'viem'
|
|
18
|
+
import type { RequireConfigContracts } from '../../utils/chain.js'
|
|
19
|
+
import { getAction } from '../../utils/getAction.js'
|
|
20
|
+
|
|
21
|
+
export type DeleteSubnameParameters<
|
|
22
|
+
config extends Config = Config,
|
|
23
|
+
chainId extends
|
|
24
|
+
config['chains'][number]['id'] = config['chains'][number]['id'],
|
|
25
|
+
chains extends readonly Chain[] = SelectChains<config, chainId>,
|
|
26
|
+
> = {
|
|
27
|
+
[key in keyof chains]: Compute<
|
|
28
|
+
Omit<ensjs_DeleteSubnameParameters<chains[key], Account, any>, 'chain'> &
|
|
29
|
+
ChainIdParameter<config, chainId> &
|
|
30
|
+
ConnectorParameter
|
|
31
|
+
>
|
|
32
|
+
}[number]
|
|
33
|
+
|
|
34
|
+
export type DeleteSubnameReturnType = ensjs_DeleteSubnameReturnType
|
|
35
|
+
|
|
36
|
+
export type DeleteSubnameErrorType = ensjs_DeleteSubnameErrorType
|
|
37
|
+
|
|
38
|
+
export async function deleteSubname<
|
|
39
|
+
chains extends readonly [Chain, ...Chain[]],
|
|
40
|
+
>(
|
|
41
|
+
config: RequireConfigContracts<chains, 'ensRegistry' | 'ensNameWrapper'>,
|
|
42
|
+
parameters: DeleteSubnameParameters<ExcludeTE<typeof config>>,
|
|
43
|
+
): Promise<DeleteSubnameReturnType> {
|
|
44
|
+
ASSERT_NO_TYPE_ERROR(config)
|
|
45
|
+
|
|
46
|
+
const { account, chainId, connector, ...rest } = parameters
|
|
47
|
+
|
|
48
|
+
let client: Client<any, Chain>
|
|
49
|
+
if (typeof account === 'object' && account?.type === 'local')
|
|
50
|
+
client = config.getClient({ chainId })
|
|
51
|
+
else
|
|
52
|
+
client = await getConnectorClient(config, {
|
|
53
|
+
account: account ?? undefined,
|
|
54
|
+
chainId,
|
|
55
|
+
connector,
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
const action = getAction(client, ensjs_deleteSubname, 'deleteSubname')
|
|
59
|
+
return await action({
|
|
60
|
+
...(rest as any),
|
|
61
|
+
...(account ? { account } : {}),
|
|
62
|
+
chain: chainId ? { id: chainId } : null,
|
|
63
|
+
})
|
|
64
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
export {
|
|
2
|
+
type ClearRecordsErrorType,
|
|
3
|
+
type ClearRecordsParameters,
|
|
4
|
+
type ClearRecordsReturnType,
|
|
5
|
+
clearRecords,
|
|
6
|
+
} from './clearRecords.js'
|
|
7
|
+
export {
|
|
8
|
+
type CommitNameErrorType,
|
|
9
|
+
type CommitNameParameters,
|
|
10
|
+
type CommitNameReturnType,
|
|
11
|
+
commitName,
|
|
12
|
+
} from './commitName.js'
|
|
13
|
+
export {
|
|
14
|
+
type CreateSubnameErrorType,
|
|
15
|
+
type CreateSubnameParameters,
|
|
16
|
+
type CreateSubnameReturnType,
|
|
17
|
+
createSubname,
|
|
18
|
+
} from './createSubname.js'
|
|
19
|
+
export {
|
|
20
|
+
type DeleteSubnameErrorType,
|
|
21
|
+
type DeleteSubnameParameters,
|
|
22
|
+
type DeleteSubnameReturnType,
|
|
23
|
+
deleteSubname,
|
|
24
|
+
} from './deleteSubname.js'
|
|
25
|
+
export {
|
|
26
|
+
type RegisterNameErrorType,
|
|
27
|
+
type RegisterNameParameters,
|
|
28
|
+
type RegisterNameReturnType,
|
|
29
|
+
registerName,
|
|
30
|
+
} from './registerName.js'
|
|
31
|
+
export {
|
|
32
|
+
type RenewNamesErrorType,
|
|
33
|
+
type RenewNamesParameters,
|
|
34
|
+
type RenewNamesReturnType,
|
|
35
|
+
renewNames,
|
|
36
|
+
} from './renewNames.js'
|
|
37
|
+
export {
|
|
38
|
+
type SetAbiRecordErrorType,
|
|
39
|
+
type SetAbiRecordParameters,
|
|
40
|
+
type SetAbiRecordReturnType,
|
|
41
|
+
setAbiRecord,
|
|
42
|
+
} from './setAbiRecord.js'
|
|
43
|
+
export {
|
|
44
|
+
type SetAddressRecordErrorType,
|
|
45
|
+
type SetAddressRecordParameters,
|
|
46
|
+
type SetAddressRecordReturnType,
|
|
47
|
+
setAddressRecord,
|
|
48
|
+
} from './setAddressRecord.js'
|
|
49
|
+
export {
|
|
50
|
+
type SetContentHashRecordErrorType,
|
|
51
|
+
type SetContentHashRecordParameters,
|
|
52
|
+
type SetContentHashRecordReturnType,
|
|
53
|
+
setContentHashRecord,
|
|
54
|
+
} from './setContentHashRecord.js'
|
|
55
|
+
export {
|
|
56
|
+
type SetPrimaryNameErrorType,
|
|
57
|
+
type SetPrimaryNameParameters,
|
|
58
|
+
type SetPrimaryNameReturnType,
|
|
59
|
+
setPrimaryName,
|
|
60
|
+
} from './setPrimaryName.js'
|
|
61
|
+
export {
|
|
62
|
+
type SetRecordsErrorType,
|
|
63
|
+
type SetRecordsParameters,
|
|
64
|
+
type SetRecordsReturnType,
|
|
65
|
+
setRecords,
|
|
66
|
+
} from './setRecords.js'
|
|
67
|
+
export {
|
|
68
|
+
type SetResolverErrorType,
|
|
69
|
+
type SetResolverParameters,
|
|
70
|
+
type SetResolverReturnType,
|
|
71
|
+
setResolver,
|
|
72
|
+
} from './setResolver.js'
|
|
73
|
+
export {
|
|
74
|
+
type SetTextRecordErrorType,
|
|
75
|
+
type SetTextRecordParameters,
|
|
76
|
+
type SetTextRecordReturnType,
|
|
77
|
+
setTextRecord,
|
|
78
|
+
} from './setTextRecord.js'
|
|
79
|
+
export {
|
|
80
|
+
type TransferNameErrorType,
|
|
81
|
+
type TransferNameParameters,
|
|
82
|
+
type TransferNameReturnType,
|
|
83
|
+
transferName,
|
|
84
|
+
} from './transferName.js'
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ASSERT_NO_TYPE_ERROR,
|
|
3
|
+
type ExcludeTE,
|
|
4
|
+
} from '@ensdomains/ensjs/internal'
|
|
5
|
+
import {
|
|
6
|
+
type RegisterNameErrorType as ensjs_RegisterNameErrorType,
|
|
7
|
+
type RegisterNameParameters as ensjs_RegisterNameParameters,
|
|
8
|
+
type RegisterNameReturnType as ensjs_RegisterNameReturnType,
|
|
9
|
+
registerName as ensjs_registerName,
|
|
10
|
+
} from '@ensdomains/ensjs/wallet'
|
|
11
|
+
import { type Config, getConnectorClient, type SelectChains } from '@wagmi/core'
|
|
12
|
+
import type {
|
|
13
|
+
ChainIdParameter,
|
|
14
|
+
Compute,
|
|
15
|
+
ConnectorParameter,
|
|
16
|
+
} from '@wagmi/core/internal'
|
|
17
|
+
import type { Account, Chain, Client } from 'viem'
|
|
18
|
+
import type { RequireConfigContracts } from '../../utils/chain.js'
|
|
19
|
+
import { getAction } from '../../utils/getAction.js'
|
|
20
|
+
|
|
21
|
+
export type RegisterNameParameters<
|
|
22
|
+
config extends Config = Config,
|
|
23
|
+
chainId extends
|
|
24
|
+
config['chains'][number]['id'] = config['chains'][number]['id'],
|
|
25
|
+
chains extends readonly Chain[] = SelectChains<config, chainId>,
|
|
26
|
+
> = {
|
|
27
|
+
[key in keyof chains]: Compute<
|
|
28
|
+
Omit<ensjs_RegisterNameParameters<chains[key], Account, any>, 'chain'> &
|
|
29
|
+
ChainIdParameter<config, chainId> &
|
|
30
|
+
ConnectorParameter
|
|
31
|
+
>
|
|
32
|
+
}[number]
|
|
33
|
+
|
|
34
|
+
export type RegisterNameReturnType = ensjs_RegisterNameReturnType
|
|
35
|
+
|
|
36
|
+
export type RegisterNameErrorType = ensjs_RegisterNameErrorType
|
|
37
|
+
|
|
38
|
+
export async function registerName<chains extends readonly [Chain, ...Chain[]]>(
|
|
39
|
+
config: RequireConfigContracts<chains, 'ensEthRegistrarController'>,
|
|
40
|
+
parameters: RegisterNameParameters<ExcludeTE<typeof config>>,
|
|
41
|
+
): Promise<RegisterNameReturnType> {
|
|
42
|
+
ASSERT_NO_TYPE_ERROR(config)
|
|
43
|
+
|
|
44
|
+
const { account, chainId, connector, ...rest } = parameters
|
|
45
|
+
|
|
46
|
+
let client: Client<any, Chain>
|
|
47
|
+
if (typeof account === 'object' && account?.type === 'local')
|
|
48
|
+
client = config.getClient({ chainId })
|
|
49
|
+
else
|
|
50
|
+
client = await getConnectorClient(config, {
|
|
51
|
+
account: account ?? undefined,
|
|
52
|
+
chainId,
|
|
53
|
+
connector,
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
const action = getAction(client, ensjs_registerName, 'registerName')
|
|
57
|
+
return await action({
|
|
58
|
+
...(rest as any),
|
|
59
|
+
...(account ? { account } : {}),
|
|
60
|
+
chain: chainId ? { id: chainId } : null,
|
|
61
|
+
})
|
|
62
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ASSERT_NO_TYPE_ERROR,
|
|
3
|
+
type ExcludeTE,
|
|
4
|
+
} from '@ensdomains/ensjs/internal'
|
|
5
|
+
import {
|
|
6
|
+
type RenewNamesErrorType as ensjs_RenewNamesErrorType,
|
|
7
|
+
type RenewNamesParameters as ensjs_RenewNamesParameters,
|
|
8
|
+
type RenewNamesReturnType as ensjs_RenewNamesReturnType,
|
|
9
|
+
renewNames as ensjs_renewNames,
|
|
10
|
+
} from '@ensdomains/ensjs/wallet'
|
|
11
|
+
import { type Config, getConnectorClient, type SelectChains } from '@wagmi/core'
|
|
12
|
+
import type {
|
|
13
|
+
ChainIdParameter,
|
|
14
|
+
Compute,
|
|
15
|
+
ConnectorParameter,
|
|
16
|
+
} from '@wagmi/core/internal'
|
|
17
|
+
import type { Account, Chain, Client } from 'viem'
|
|
18
|
+
import type { RequireConfigContracts } from '../../utils/chain.js'
|
|
19
|
+
import { getAction } from '../../utils/getAction.js'
|
|
20
|
+
|
|
21
|
+
export type RenewNamesParameters<
|
|
22
|
+
config extends Config = Config,
|
|
23
|
+
chainId extends
|
|
24
|
+
config['chains'][number]['id'] = config['chains'][number]['id'],
|
|
25
|
+
chains extends readonly Chain[] = SelectChains<config, chainId>,
|
|
26
|
+
> = {
|
|
27
|
+
[key in keyof chains]: Compute<
|
|
28
|
+
Omit<ensjs_RenewNamesParameters<chains[key], Account, any>, 'chain'> &
|
|
29
|
+
ChainIdParameter<config, chainId> &
|
|
30
|
+
ConnectorParameter
|
|
31
|
+
>
|
|
32
|
+
}[number]
|
|
33
|
+
|
|
34
|
+
export type RenewNamesReturnType = ensjs_RenewNamesReturnType
|
|
35
|
+
|
|
36
|
+
export type RenewNamesErrorType = ensjs_RenewNamesErrorType
|
|
37
|
+
|
|
38
|
+
export async function renewNames<chains extends readonly [Chain, ...Chain[]]>(
|
|
39
|
+
config: RequireConfigContracts<
|
|
40
|
+
chains,
|
|
41
|
+
'ensEthRegistrarController' | 'ensBulkRenewal'
|
|
42
|
+
>,
|
|
43
|
+
parameters: RenewNamesParameters<ExcludeTE<typeof config>>,
|
|
44
|
+
): Promise<RenewNamesReturnType> {
|
|
45
|
+
ASSERT_NO_TYPE_ERROR(config)
|
|
46
|
+
|
|
47
|
+
const { account, chainId, connector, ...rest } = parameters
|
|
48
|
+
|
|
49
|
+
let client: Client<any, Chain>
|
|
50
|
+
if (typeof account === 'object' && account?.type === 'local')
|
|
51
|
+
client = config.getClient({ chainId })
|
|
52
|
+
else
|
|
53
|
+
client = await getConnectorClient(config, {
|
|
54
|
+
account: account ?? undefined,
|
|
55
|
+
chainId,
|
|
56
|
+
connector,
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
const action = getAction(client, ensjs_renewNames, 'renewNames')
|
|
60
|
+
return await action({
|
|
61
|
+
...(rest as any),
|
|
62
|
+
...(account ? { account } : {}),
|
|
63
|
+
chain: chainId ? { id: chainId } : null,
|
|
64
|
+
})
|
|
65
|
+
}
|