@ensdomains/ensjs 4.2.0 → 4.2.3
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/clients/decorators/wallet.d.ts +2 -2
- package/dist/contracts/addEnsContracts.js +0 -2
- package/dist/contracts/addEnsContracts.js.map +1 -1
- package/dist/contracts/bulkRenewal.d.ts +6 -0
- package/dist/contracts/bulkRenewal.js +7 -0
- package/dist/contracts/bulkRenewal.js.map +1 -1
- package/dist/contracts/consts.d.ts +35 -59
- package/dist/contracts/consts.js +35 -60
- package/dist/contracts/consts.js.map +1 -1
- package/dist/contracts/ethRegistrarController.d.ts +394 -27
- package/dist/contracts/ethRegistrarController.js +180 -34
- package/dist/contracts/ethRegistrarController.js.map +1 -1
- package/dist/contracts/universalResolver.d.ts +234 -8
- package/dist/contracts/universalResolver.js +53 -4
- package/dist/contracts/universalResolver.js.map +1 -1
- package/dist/errors/utils.js +1 -0
- package/dist/errors/utils.js.map +1 -1
- package/dist/errors/version.d.ts +1 -1
- package/dist/errors/version.js +1 -1
- package/dist/errors/version.js.map +1 -1
- package/dist/functions/public/batch.js.map +1 -1
- package/dist/functions/public/getName.js.map +1 -1
- package/dist/functions/public/getRecords.js +2 -2
- package/dist/functions/public/getRecords.js.map +1 -1
- package/dist/functions/subgraph/client.js +1 -0
- package/dist/functions/subgraph/client.js.map +1 -1
- package/dist/functions/subgraph/getNamesForAddress.js +1 -0
- package/dist/functions/subgraph/getNamesForAddress.js.map +1 -1
- package/dist/functions/wallet/commitName.d.ts +1 -1
- package/dist/functions/wallet/commitName.js +2 -2
- package/dist/functions/wallet/commitName.js.map +1 -1
- package/dist/functions/wallet/registerName.d.ts +1 -1
- package/dist/functions/wallet/registerName.js +4 -7
- package/dist/functions/wallet/registerName.js.map +1 -1
- package/dist/functions/wallet/renewNames.d.ts +5 -3
- package/dist/functions/wallet/renewNames.js +4 -3
- package/dist/functions/wallet/renewNames.js.map +1 -1
- package/dist/utils/checkSafeUniversalResolverData.js.map +1 -1
- package/dist/utils/consts.d.ts +1 -0
- package/dist/utils/consts.js +1 -0
- package/dist/utils/consts.js.map +1 -1
- package/dist/utils/encoders/encodeAbi.js.map +1 -1
- package/dist/utils/generateFunction.js.map +1 -1
- package/dist/utils/index.d.ts +2 -3
- package/dist/utils/index.js +2 -3
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/labels.js +4 -2
- package/dist/utils/labels.js.map +1 -1
- package/dist/utils/registerHelpers.d.ts +20 -27
- package/dist/utils/registerHelpers.js +19 -33
- package/dist/utils/registerHelpers.js.map +1 -1
- package/dist/wallet.d.ts +0 -2
- package/dist/wallet.js +0 -2
- package/dist/wallet.js.map +1 -1
- package/package.json +8 -9
- package/src/@types/dns-packet/index.d.ts +1 -0
- package/src/@types/pako.d.ts +4 -1
- package/src/clients/decorators/wallet.ts +2 -2
- package/src/contracts/addEnsContracts.ts +0 -2
- package/src/contracts/bulkRenewal.ts +7 -0
- package/src/contracts/consts.ts +39 -60
- package/src/contracts/ethRegistrarController.ts +181 -34
- package/src/contracts/universalResolver.ts +53 -4
- package/src/errors/utils.ts +1 -0
- package/src/errors/version.ts +1 -1
- package/src/functions/public/batch.ts +1 -0
- package/src/functions/public/getName.ts +1 -0
- package/src/functions/public/getRecords.ts +8 -2
- package/src/functions/subgraph/client.ts +1 -0
- package/src/functions/subgraph/getNamesForAddress.ts +1 -0
- package/src/functions/wallet/commitName.ts +2 -2
- package/src/functions/wallet/registerName.ts +4 -8
- package/src/functions/wallet/renewNames.ts +12 -3
- package/src/types.ts +2 -0
- package/src/utils/checkSafeUniversalResolverData.ts +1 -0
- package/src/utils/consts.ts +2 -0
- package/src/utils/encoders/encodeAbi.ts +1 -0
- package/src/utils/generateFunction.ts +6 -0
- package/src/utils/index.ts +5 -20
- package/src/utils/labels.ts +8 -4
- package/src/utils/registerHelpers.ts +40 -64
- package/src/wallet.ts +0 -14
- package/dist/functions/wallet/legacyCommitName.d.ts +0 -40
- package/dist/functions/wallet/legacyCommitName.js +0 -72
- package/dist/functions/wallet/legacyCommitName.js.map +0 -1
- package/dist/functions/wallet/legacyRegisterName.d.ts +0 -59
- package/dist/functions/wallet/legacyRegisterName.js +0 -93
- package/dist/functions/wallet/legacyRegisterName.js.map +0 -1
- package/dist/utils/legacyRegisterHelpers.d.ts +0 -48
- package/dist/utils/legacyRegisterHelpers.js +0 -45
- package/dist/utils/legacyRegisterHelpers.js.map +0 -1
- package/src/functions/wallet/legacyCommitName.ts +0 -127
- package/src/functions/wallet/legacyRegisterName.ts +0 -159
- package/src/utils/legacyRegisterHelpers.ts +0 -147
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type Address,
|
|
3
|
-
type Hex,
|
|
4
|
-
encodePacked,
|
|
5
|
-
keccak256,
|
|
6
|
-
labelhash,
|
|
7
|
-
} from 'viem'
|
|
8
|
-
import { LegacyRegistrationInvalidConfigError } from '../errors/register.js'
|
|
9
|
-
import { EMPTY_ADDRESS } from './consts.js'
|
|
10
|
-
|
|
11
|
-
export type LegacyRegistrationParameters = {
|
|
12
|
-
/** Name to register */
|
|
13
|
-
name: string
|
|
14
|
-
/** Address to set owner to */
|
|
15
|
-
owner: Address
|
|
16
|
-
/** Duration of registration */
|
|
17
|
-
duration: number
|
|
18
|
-
/** Random 32 bytes to use for registration */
|
|
19
|
-
secret: Hex
|
|
20
|
-
/** Custom resolver address, defaults to empty address */
|
|
21
|
-
resolverAddress?: Address
|
|
22
|
-
/** Address to set upon registration, defaults to empty address */
|
|
23
|
-
address?: Address
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export type LegacyRegistrationWithConfigParameters =
|
|
27
|
-
LegacyRegistrationParameters & {
|
|
28
|
-
resolverAddress: Address
|
|
29
|
-
address?: Address
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export const isLegacyRegistrationWithConfigParameters = (
|
|
33
|
-
params: LegacyRegistrationParameters,
|
|
34
|
-
): params is LegacyRegistrationWithConfigParameters => {
|
|
35
|
-
const { resolverAddress = EMPTY_ADDRESS, address = EMPTY_ADDRESS } =
|
|
36
|
-
params as LegacyRegistrationWithConfigParameters
|
|
37
|
-
|
|
38
|
-
if (resolverAddress === EMPTY_ADDRESS && address !== EMPTY_ADDRESS)
|
|
39
|
-
throw new LegacyRegistrationInvalidConfigError({
|
|
40
|
-
resolverAddress,
|
|
41
|
-
address,
|
|
42
|
-
})
|
|
43
|
-
return resolverAddress !== EMPTY_ADDRESS || address !== EMPTY_ADDRESS
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export type LegacyCommitmentTuple = [label: string, owner: Address, secret: Hex]
|
|
47
|
-
|
|
48
|
-
export type LegacyCommitmentWithConfigTuple = [
|
|
49
|
-
label: string,
|
|
50
|
-
owner: Address,
|
|
51
|
-
resolverAddress: Address,
|
|
52
|
-
address: Address,
|
|
53
|
-
secret: Hex,
|
|
54
|
-
]
|
|
55
|
-
|
|
56
|
-
export type LegacyRegistrationTuple = [
|
|
57
|
-
label: string,
|
|
58
|
-
owner: Address,
|
|
59
|
-
duration: bigint,
|
|
60
|
-
secret: Hex,
|
|
61
|
-
]
|
|
62
|
-
|
|
63
|
-
export type LegacyRegistrationWithConfigTuple = [
|
|
64
|
-
label: string,
|
|
65
|
-
owner: Address,
|
|
66
|
-
duration: bigint,
|
|
67
|
-
secret: Hex,
|
|
68
|
-
resolverAddress: Address,
|
|
69
|
-
address: Address,
|
|
70
|
-
]
|
|
71
|
-
|
|
72
|
-
export const makeLegacyCommitmentTuple = (
|
|
73
|
-
params: LegacyRegistrationParameters,
|
|
74
|
-
): LegacyCommitmentTuple => {
|
|
75
|
-
const { name, owner, secret } = params
|
|
76
|
-
const label = name.split('.')[0]
|
|
77
|
-
return [label, owner, secret]
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export const makeLegacyCommitmentWithConfigTuple = (
|
|
81
|
-
params: LegacyRegistrationWithConfigParameters,
|
|
82
|
-
): LegacyCommitmentWithConfigTuple => {
|
|
83
|
-
const {
|
|
84
|
-
name,
|
|
85
|
-
owner,
|
|
86
|
-
secret,
|
|
87
|
-
resolverAddress = EMPTY_ADDRESS,
|
|
88
|
-
address = EMPTY_ADDRESS,
|
|
89
|
-
} = params as LegacyRegistrationWithConfigParameters
|
|
90
|
-
const label = name.split('.')[0]
|
|
91
|
-
return [label, owner, secret, resolverAddress, address]
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
export const makeLegacyRegistrationTuple = ({
|
|
95
|
-
name,
|
|
96
|
-
owner,
|
|
97
|
-
secret,
|
|
98
|
-
duration,
|
|
99
|
-
}: LegacyRegistrationParameters): LegacyRegistrationTuple => {
|
|
100
|
-
const label = name.split('.')[0]
|
|
101
|
-
return [label, owner, BigInt(duration), secret]
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export const makeLegacyRegistrationWithConfigTuple = ({
|
|
105
|
-
name,
|
|
106
|
-
owner,
|
|
107
|
-
secret,
|
|
108
|
-
duration,
|
|
109
|
-
resolverAddress,
|
|
110
|
-
address = EMPTY_ADDRESS,
|
|
111
|
-
}: LegacyRegistrationWithConfigParameters): LegacyRegistrationWithConfigTuple => {
|
|
112
|
-
const label = name.split('.')[0]
|
|
113
|
-
return [label, owner, BigInt(duration), secret, resolverAddress, address]
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
export const makeLegacyCommitmentFromTuple = ([label, ...others]:
|
|
117
|
-
| LegacyCommitmentTuple
|
|
118
|
-
| LegacyCommitmentWithConfigTuple): Hex => {
|
|
119
|
-
const labelHash = labelhash(label)
|
|
120
|
-
const params = [labelHash, ...others] as const
|
|
121
|
-
|
|
122
|
-
if (params.length === 3)
|
|
123
|
-
return keccak256(encodePacked(['bytes32', 'address', 'bytes32'], params))
|
|
124
|
-
|
|
125
|
-
const [
|
|
126
|
-
owner,
|
|
127
|
-
secret,
|
|
128
|
-
resolverAddress = EMPTY_ADDRESS,
|
|
129
|
-
address = EMPTY_ADDRESS,
|
|
130
|
-
] = others
|
|
131
|
-
|
|
132
|
-
return keccak256(
|
|
133
|
-
encodePacked(
|
|
134
|
-
['bytes32', 'address', 'address', 'address', 'bytes32'],
|
|
135
|
-
[labelHash, owner, resolverAddress, address, secret],
|
|
136
|
-
),
|
|
137
|
-
)
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
export const makeLegacyCommitment = (
|
|
141
|
-
params: LegacyRegistrationParameters | LegacyRegistrationWithConfigParameters,
|
|
142
|
-
): Hex => {
|
|
143
|
-
const touple = isLegacyRegistrationWithConfigParameters(params)
|
|
144
|
-
? makeLegacyCommitmentWithConfigTuple(params)
|
|
145
|
-
: makeLegacyCommitmentTuple(params)
|
|
146
|
-
return makeLegacyCommitmentFromTuple(touple)
|
|
147
|
-
}
|