@ensdomains/ensjs 4.0.3-alpha.0 → 4.0.3-alpha.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/contracts/ethRegistrarController.js +41 -1
- package/dist/cjs/contracts/ethRegistrarController.js.map +1 -1
- package/dist/cjs/contracts/index.js +16 -2
- package/dist/cjs/contracts/index.js.map +1 -1
- package/dist/cjs/contracts/legacyEthRegistrarController.js +35 -1
- package/dist/cjs/contracts/legacyEthRegistrarController.js.map +1 -1
- package/dist/cjs/errors/version.js +1 -1
- package/dist/cjs/errors/version.js.map +1 -1
- package/dist/cjs/functions/wallet/legacyRegisterName.js +11 -12
- package/dist/cjs/functions/wallet/legacyRegisterName.js.map +1 -1
- package/dist/cjs/utils/index.js +4 -1
- package/dist/cjs/utils/index.js.map +1 -1
- package/dist/cjs/utils/legacyRegisterHelpers.js +23 -13
- package/dist/cjs/utils/legacyRegisterHelpers.js.map +1 -1
- package/dist/esm/contracts/ethRegistrarController.js +40 -0
- package/dist/esm/contracts/ethRegistrarController.js.map +1 -1
- package/dist/esm/contracts/index.js +2 -1
- package/dist/esm/contracts/index.js.map +1 -1
- package/dist/esm/contracts/legacyEthRegistrarController.js +34 -0
- package/dist/esm/contracts/legacyEthRegistrarController.js.map +1 -1
- package/dist/esm/errors/version.js +1 -1
- package/dist/esm/errors/version.js.map +1 -1
- package/dist/esm/functions/wallet/legacyRegisterName.js +12 -13
- package/dist/esm/functions/wallet/legacyRegisterName.js.map +1 -1
- package/dist/esm/utils/index.js +1 -1
- package/dist/esm/utils/index.js.map +1 -1
- package/dist/esm/utils/legacyRegisterHelpers.js +19 -11
- package/dist/esm/utils/legacyRegisterHelpers.js.map +1 -1
- package/dist/types/contracts/ethRegistrarController.d.ts +31 -0
- package/dist/types/contracts/ethRegistrarController.d.ts.map +1 -1
- package/dist/types/contracts/index.d.ts +2 -1
- package/dist/types/contracts/index.d.ts.map +1 -1
- package/dist/types/contracts/legacyEthRegistrarController.d.ts +262 -167
- package/dist/types/contracts/legacyEthRegistrarController.d.ts.map +1 -1
- package/dist/types/errors/version.d.ts +1 -1
- package/dist/types/errors/version.d.ts.map +1 -1
- package/dist/types/functions/wallet/legacyRegisterName.d.ts.map +1 -1
- package/dist/types/utils/index.d.ts +1 -1
- package/dist/types/utils/index.d.ts.map +1 -1
- package/dist/types/utils/legacyRegisterHelpers.d.ts +17 -9
- package/dist/types/utils/legacyRegisterHelpers.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/contracts/ethRegistrarController.ts +41 -0
- package/src/contracts/index.ts +15 -0
- package/src/contracts/legacyEthRegistrarController.ts +46 -11
- package/src/errors/version.ts +1 -1
- package/src/functions/wallet/legacyRegisterName.ts +13 -14
- package/src/utils/index.ts +6 -0
- package/src/utils/legacyRegisterHelpers.ts +65 -52
|
@@ -15,7 +15,7 @@ export { generateRecordCallArray, type RecordOptions, } from './generateRecordCa
|
|
|
15
15
|
export { generateSupportedContentTypes } from './generateSupportedContentTypes.js';
|
|
16
16
|
export { bytesToPacket, packetToBytes } from './hexEncodedName.js';
|
|
17
17
|
export { checkIsDecrypted, checkLabel, decodeLabelhash, decryptName, encodeLabelhash, isEncodedLabelhash, saveLabel, saveName, } from './labels.js';
|
|
18
|
-
export { makeLegacyCommitment, makeLegacyCommitmentFromTuple, makeLegacyCommitmentTuple, makeLegacyRegistrationTuple, type LegacyCommitmentTuple, type LegacyRegistrationParameters, type LegacyRegistrationTuple, } from './legacyRegisterHelpers.js';
|
|
18
|
+
export { makeLegacyCommitment, makeLegacyCommitmentFromTuple, makeLegacyCommitmentTuple, makeLegacyCommitmentWithConfigTuple, makeLegacyRegistrationTuple, makeLegacyRegistrationWithConfigTuple, isLegacyRegistrationWithConfigParameters, type LegacyCommitmentTuple, type LegacyCommitmentWithConfigTuple, type LegacyRegistrationParameters, type LegacyRegistrationWithConfigParameters, type LegacyRegistrationTuple, type LegacyRegistrationWithConfigTuple, } from './legacyRegisterHelpers.js';
|
|
19
19
|
export { makeSafeSecondsDate } from './makeSafeSecondsDate.js';
|
|
20
20
|
export { beautify, emoji, isCombiningMark, namehash, normalise, normaliseFragment, shouldEscape, split, tokenise, type DisallowedToken, type EmojiToken, type IgnoredToken, type Label, type MappedToken, type NFCToken, type StopToken, type TextToken, type Token, type ValidToken, } from './normalise.js';
|
|
21
21
|
export { makeCommitment, makeCommitmentFromTuple, makeCommitmentTuple, makeRegistrationTuple, randomSecret, type CommitmentTuple, type RegistrationParameters, type RegistrationTuple, } from './registerHelpers.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EACL,gBAAgB,EAChB,KAAK,0BAA0B,EAC/B,KAAK,0BAA0B,GAChC,MAAM,2BAA2B,CAAA;AAClC,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,eAAe,GACrB,MAAM,eAAe,CAAA;AACtB,OAAO,EACL,qBAAqB,EACrB,SAAS,EACT,qBAAqB,EACrB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,UAAU,GAChB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAA;AACrE,OAAO,EACL,YAAY,EACZ,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,GAC5B,MAAM,4BAA4B,CAAA;AACnC,OAAO,EACL,aAAa,EACb,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,GAC7B,MAAM,6BAA6B,CAAA;AACpC,OAAO,EACL,oBAAoB,EACpB,KAAK,8BAA8B,EACnC,KAAK,8BAA8B,GACpC,MAAM,oCAAoC,CAAA;AAC3C,OAAO,EACL,aAAa,EACb,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,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SAAS,EACd,KAAK,SAAS,EACd,KAAK,KAAK,EACV,KAAK,UAAU,GAChB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EACL,cAAc,EACd,uBAAuB,EACvB,mBAAmB,EACnB,qBAAqB,EACrB,YAAY,EACZ,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,GACvB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EACL,aAAa,EACb,UAAU,EACV,YAAY,EACZ,KAAK,iBAAiB,GACvB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,UAAU,EACV,cAAc,EACd,uBAAuB,GACxB,MAAM,cAAc,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Address, type Hex } from 'viem';
|
|
2
|
-
export type
|
|
2
|
+
export type LegacyRegistrationParameters = {
|
|
3
3
|
/** Name to register */
|
|
4
4
|
name: string;
|
|
5
5
|
/** Address to set owner to */
|
|
@@ -13,20 +13,26 @@ export type LegacyRegistrationBaseParameters = {
|
|
|
13
13
|
/** Address to set upon registration, defaults to empty address */
|
|
14
14
|
address?: Address;
|
|
15
15
|
};
|
|
16
|
-
export type LegacyRegistrationWithConfigParameters =
|
|
16
|
+
export type LegacyRegistrationWithConfigParameters = LegacyRegistrationParameters & {
|
|
17
17
|
resolverAddress: Address;
|
|
18
18
|
address?: Address;
|
|
19
19
|
};
|
|
20
|
-
export
|
|
21
|
-
export
|
|
22
|
-
export type
|
|
20
|
+
export declare const isLegacyRegistrationWithConfigParameters: (params: LegacyRegistrationParameters) => params is LegacyRegistrationWithConfigParameters;
|
|
21
|
+
export type LegacyCommitmentTuple = [label: string, owner: Address, secret: Hex];
|
|
22
|
+
export type LegacyCommitmentWithConfigTuple = [
|
|
23
23
|
label: string,
|
|
24
24
|
owner: Address,
|
|
25
25
|
resolverAddress: Address,
|
|
26
26
|
address: Address,
|
|
27
27
|
secret: Hex
|
|
28
28
|
];
|
|
29
|
-
export type LegacyRegistrationTuple = [
|
|
29
|
+
export type LegacyRegistrationTuple = [
|
|
30
|
+
label: string,
|
|
31
|
+
owner: Address,
|
|
32
|
+
duration: bigint,
|
|
33
|
+
secret: Hex
|
|
34
|
+
];
|
|
35
|
+
export type LegacyRegistrationWithConfigTuple = [
|
|
30
36
|
label: string,
|
|
31
37
|
owner: Address,
|
|
32
38
|
duration: bigint,
|
|
@@ -35,7 +41,9 @@ export type LegacyRegistrationTuple = [label: string, owner: Address, duration:
|
|
|
35
41
|
address: Address
|
|
36
42
|
];
|
|
37
43
|
export declare const makeLegacyCommitmentTuple: (params: LegacyRegistrationParameters) => LegacyCommitmentTuple;
|
|
38
|
-
export declare const
|
|
39
|
-
export declare const
|
|
40
|
-
export declare const
|
|
44
|
+
export declare const makeLegacyCommitmentWithConfigTuple: (params: LegacyRegistrationWithConfigParameters) => LegacyCommitmentWithConfigTuple;
|
|
45
|
+
export declare const makeLegacyRegistrationTuple: ({ name, owner, secret, duration, }: LegacyRegistrationParameters) => LegacyRegistrationTuple;
|
|
46
|
+
export declare const makeLegacyRegistrationWithConfigTuple: ({ name, owner, secret, duration, resolverAddress, address, }: LegacyRegistrationWithConfigParameters) => LegacyRegistrationWithConfigTuple;
|
|
47
|
+
export declare const makeLegacyCommitmentFromTuple: ([label, ...others]: LegacyCommitmentTuple | LegacyCommitmentWithConfigTuple) => Hex;
|
|
48
|
+
export declare const makeLegacyCommitment: (params: LegacyRegistrationParameters | LegacyRegistrationWithConfigParameters) => Hex;
|
|
41
49
|
//# sourceMappingURL=legacyRegisterHelpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"legacyRegisterHelpers.d.ts","sourceRoot":"","sources":["../../../src/utils/legacyRegisterHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,OAAO,EACZ,KAAK,GAAG,EAET,MAAM,MAAM,CAAA;AAIb,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"legacyRegisterHelpers.d.ts","sourceRoot":"","sources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,eAAO,MAAM,yBAAyB,WAC5B,4BAA4B,0BAKrC,CAAA;AAED,eAAO,MAAM,mCAAmC,WACtC,sCAAsC,oCAW/C,CAAA;AAED,eAAO,MAAM,2BAA2B,uCAKrC,4BAA4B,4BAG9B,CAAA;AAED,eAAO,MAAM,qCAAqC,iEAO/C,sCAAsC,sCAGxC,CAAA;AAED,eAAO,MAAM,6BAA6B,uBACtC,qBAAqB,GACrB,+BAA+B,KAAG,GAoBrC,CAAA;AAED,eAAO,MAAM,oBAAoB,WACvB,4BAA4B,GAAG,sCAAsC,KAC5E,GAKF,CAAA"}
|
package/package.json
CHANGED
|
@@ -206,3 +206,44 @@ export const ethRegistrarControllerRenewSnippet = [
|
|
|
206
206
|
type: 'function',
|
|
207
207
|
},
|
|
208
208
|
] as const
|
|
209
|
+
|
|
210
|
+
export const ethRegistrarControllerNameRegisteredEventSnippet = [
|
|
211
|
+
{
|
|
212
|
+
anonymous: false,
|
|
213
|
+
inputs: [
|
|
214
|
+
{
|
|
215
|
+
indexed: false,
|
|
216
|
+
name: 'name',
|
|
217
|
+
type: 'string',
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
indexed: true,
|
|
221
|
+
name: 'label',
|
|
222
|
+
type: 'bytes32',
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
indexed: true,
|
|
226
|
+
internalType: 'address',
|
|
227
|
+
name: 'owner',
|
|
228
|
+
type: 'address',
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
indexed: false,
|
|
232
|
+
name: 'baseCost',
|
|
233
|
+
type: 'uint256',
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
indexed: false,
|
|
237
|
+
name: 'premium',
|
|
238
|
+
type: 'uint256',
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
indexed: false,
|
|
242
|
+
name: 'expires',
|
|
243
|
+
type: 'uint256',
|
|
244
|
+
},
|
|
245
|
+
],
|
|
246
|
+
name: 'NameRegistered',
|
|
247
|
+
type: 'event',
|
|
248
|
+
},
|
|
249
|
+
] as const
|
package/src/contracts/index.ts
CHANGED
|
@@ -40,8 +40,23 @@ export {
|
|
|
40
40
|
ethRegistrarControllerRegisterSnippet,
|
|
41
41
|
ethRegistrarControllerRenewSnippet,
|
|
42
42
|
ethRegistrarControllerRentPriceSnippet,
|
|
43
|
+
ethRegistrarControllerNameRegisteredEventSnippet,
|
|
43
44
|
} from './ethRegistrarController.js'
|
|
44
45
|
export { getChainContractAddress } from './getChainContractAddress.js'
|
|
46
|
+
export {
|
|
47
|
+
legacyEthRegistrarControllerAvailableSnippet,
|
|
48
|
+
legacyEthRegistrarControllerCommitSnippet,
|
|
49
|
+
legacyEthRegistrarControllerCommitmentsSnippet,
|
|
50
|
+
legacyEthRegistrarControllerMakeCommitmentSnippet,
|
|
51
|
+
legacyEthRegistrarControllerMakeCommitmentWithConfigSnippet,
|
|
52
|
+
legacyEthRegistrarControllerRegisterSnippet,
|
|
53
|
+
legacyEthRegistrarControllerRegisterWithConfigSnippet,
|
|
54
|
+
legacyEthRegistrarControllerRenewSnippet,
|
|
55
|
+
legacyEthRegistrarControllerRentPriceSnippet,
|
|
56
|
+
legacyEthRegistrarControllerSupportsInterfaceSnippet,
|
|
57
|
+
legacyEthRegistrarControllerTransferOwnershipSnippet,
|
|
58
|
+
legacyEthRegistrarControllerNameRegisteredEventSnippet,
|
|
59
|
+
} from './legacyEthRegistrarController.js'
|
|
45
60
|
export {
|
|
46
61
|
multicallGetCurrentBlockTimestampSnippet,
|
|
47
62
|
multicallTryAggregateSnippet,
|
|
@@ -8,7 +8,7 @@ export const legacyEthRegistrarControllerAvailableSnippet = [
|
|
|
8
8
|
stateMutability: 'view',
|
|
9
9
|
type: 'function',
|
|
10
10
|
},
|
|
11
|
-
]
|
|
11
|
+
] as const
|
|
12
12
|
|
|
13
13
|
export const legacyEthRegistrarControllerCommitSnippet = [
|
|
14
14
|
{
|
|
@@ -20,7 +20,7 @@ export const legacyEthRegistrarControllerCommitSnippet = [
|
|
|
20
20
|
stateMutability: 'nonpayable',
|
|
21
21
|
type: 'function',
|
|
22
22
|
},
|
|
23
|
-
]
|
|
23
|
+
] as const
|
|
24
24
|
|
|
25
25
|
export const legacyEthRegistrarControllerCommitmentsSnippet = [
|
|
26
26
|
{
|
|
@@ -32,7 +32,7 @@ export const legacyEthRegistrarControllerCommitmentsSnippet = [
|
|
|
32
32
|
stateMutability: 'view',
|
|
33
33
|
type: 'function',
|
|
34
34
|
},
|
|
35
|
-
]
|
|
35
|
+
] as const
|
|
36
36
|
|
|
37
37
|
export const legacyEthRegistrarControllerMakeCommitmentSnippet = [
|
|
38
38
|
{
|
|
@@ -48,7 +48,7 @@ export const legacyEthRegistrarControllerMakeCommitmentSnippet = [
|
|
|
48
48
|
stateMutability: 'pure',
|
|
49
49
|
type: 'function',
|
|
50
50
|
},
|
|
51
|
-
]
|
|
51
|
+
] as const
|
|
52
52
|
|
|
53
53
|
export const legacyEthRegistrarControllerMakeCommitmentWithConfigSnippet = [
|
|
54
54
|
{
|
|
@@ -66,7 +66,7 @@ export const legacyEthRegistrarControllerMakeCommitmentWithConfigSnippet = [
|
|
|
66
66
|
stateMutability: 'pure',
|
|
67
67
|
type: 'function',
|
|
68
68
|
},
|
|
69
|
-
]
|
|
69
|
+
] as const
|
|
70
70
|
|
|
71
71
|
export const legacyEthRegistrarControllerRegisterSnippet = [
|
|
72
72
|
{
|
|
@@ -83,7 +83,7 @@ export const legacyEthRegistrarControllerRegisterSnippet = [
|
|
|
83
83
|
stateMutability: 'payable',
|
|
84
84
|
type: 'function',
|
|
85
85
|
},
|
|
86
|
-
]
|
|
86
|
+
] as const
|
|
87
87
|
|
|
88
88
|
export const legacyEthRegistrarControllerRegisterWithConfigSnippet = [
|
|
89
89
|
{
|
|
@@ -102,7 +102,7 @@ export const legacyEthRegistrarControllerRegisterWithConfigSnippet = [
|
|
|
102
102
|
stateMutability: 'payable',
|
|
103
103
|
type: 'function',
|
|
104
104
|
},
|
|
105
|
-
]
|
|
105
|
+
] as const
|
|
106
106
|
|
|
107
107
|
export const legacyEthRegistrarControllerRenewSnippet = [
|
|
108
108
|
{
|
|
@@ -117,7 +117,7 @@ export const legacyEthRegistrarControllerRenewSnippet = [
|
|
|
117
117
|
stateMutability: 'payable',
|
|
118
118
|
type: 'function',
|
|
119
119
|
},
|
|
120
|
-
]
|
|
120
|
+
] as const
|
|
121
121
|
|
|
122
122
|
export const legacyEthRegistrarControllerRentPriceSnippet = [
|
|
123
123
|
{
|
|
@@ -132,7 +132,7 @@ export const legacyEthRegistrarControllerRentPriceSnippet = [
|
|
|
132
132
|
stateMutability: 'view',
|
|
133
133
|
type: 'function',
|
|
134
134
|
},
|
|
135
|
-
]
|
|
135
|
+
] as const
|
|
136
136
|
|
|
137
137
|
export const legacyEthRegistrarControllerSupportsInterfaceSnippet = [
|
|
138
138
|
{
|
|
@@ -144,7 +144,7 @@ export const legacyEthRegistrarControllerSupportsInterfaceSnippet = [
|
|
|
144
144
|
stateMutability: 'pure',
|
|
145
145
|
type: 'function',
|
|
146
146
|
},
|
|
147
|
-
]
|
|
147
|
+
] as const
|
|
148
148
|
|
|
149
149
|
export const legacyEthRegistrarControllerTransferOwnershipSnippet = [
|
|
150
150
|
{
|
|
@@ -156,4 +156,39 @@ export const legacyEthRegistrarControllerTransferOwnershipSnippet = [
|
|
|
156
156
|
stateMutability: 'nonpayable',
|
|
157
157
|
type: 'function',
|
|
158
158
|
},
|
|
159
|
-
]
|
|
159
|
+
] as const
|
|
160
|
+
|
|
161
|
+
export const legacyEthRegistrarControllerNameRegisteredEventSnippet = [
|
|
162
|
+
{
|
|
163
|
+
anonymous: false,
|
|
164
|
+
inputs: [
|
|
165
|
+
{ indexed: false, internalType: 'string', name: 'name', type: 'string' },
|
|
166
|
+
{
|
|
167
|
+
indexed: true,
|
|
168
|
+
internalType: 'bytes32',
|
|
169
|
+
name: 'label',
|
|
170
|
+
type: 'bytes32',
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
indexed: true,
|
|
174
|
+
internalType: 'address',
|
|
175
|
+
name: 'owner',
|
|
176
|
+
type: 'address',
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
indexed: false,
|
|
180
|
+
internalType: 'uint256',
|
|
181
|
+
name: 'cost',
|
|
182
|
+
type: 'uint256',
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
indexed: false,
|
|
186
|
+
internalType: 'uint256',
|
|
187
|
+
name: 'expires',
|
|
188
|
+
type: 'uint256',
|
|
189
|
+
},
|
|
190
|
+
],
|
|
191
|
+
name: 'NameRegistered',
|
|
192
|
+
type: 'event',
|
|
193
|
+
},
|
|
194
|
+
] as const
|
package/src/errors/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = 'v4.0.3-alpha.
|
|
1
|
+
export const version = 'v4.0.3-alpha.12'
|
|
@@ -18,7 +18,8 @@ import { getNameType } from '../../utils/getNameType.js'
|
|
|
18
18
|
import {
|
|
19
19
|
makeLegacyRegistrationTuple,
|
|
20
20
|
type LegacyRegistrationParameters,
|
|
21
|
-
|
|
21
|
+
isLegacyRegistrationWithConfigParameters,
|
|
22
|
+
makeLegacyRegistrationWithConfigTuple,
|
|
22
23
|
} from '../../utils/legacyRegisterHelpers.js'
|
|
23
24
|
import {
|
|
24
25
|
legacyEthRegistrarControllerRegisterSnippet,
|
|
@@ -60,24 +61,22 @@ export const makeFunctionData = <
|
|
|
60
61
|
details: 'Only 2ld-eth name registration is supported',
|
|
61
62
|
})
|
|
62
63
|
|
|
63
|
-
const data = isLegacyRegistrationWithConfig(args)
|
|
64
|
-
? encodeFunctionData({
|
|
65
|
-
abi: legacyEthRegistrarControllerRegisterWithConfigSnippet,
|
|
66
|
-
functionName: 'registerWithConfig',
|
|
67
|
-
args: makeLegacyRegistrationTuple(args),
|
|
68
|
-
})
|
|
69
|
-
: encodeFunctionData({
|
|
70
|
-
abi: legacyEthRegistrarControllerRegisterSnippet,
|
|
71
|
-
functionName: 'register',
|
|
72
|
-
args: makeLegacyRegistrationTuple(args),
|
|
73
|
-
})
|
|
74
|
-
|
|
75
64
|
return {
|
|
76
65
|
to: getChainContractAddress({
|
|
77
66
|
client: wallet,
|
|
78
67
|
contract: 'legacyEthRegistrarController',
|
|
79
68
|
}),
|
|
80
|
-
data
|
|
69
|
+
data: isLegacyRegistrationWithConfigParameters(args)
|
|
70
|
+
? encodeFunctionData({
|
|
71
|
+
abi: legacyEthRegistrarControllerRegisterWithConfigSnippet,
|
|
72
|
+
functionName: 'registerWithConfig',
|
|
73
|
+
args: makeLegacyRegistrationWithConfigTuple(args),
|
|
74
|
+
})
|
|
75
|
+
: encodeFunctionData({
|
|
76
|
+
abi: legacyEthRegistrarControllerRegisterSnippet,
|
|
77
|
+
functionName: 'register',
|
|
78
|
+
args: makeLegacyRegistrationTuple(args),
|
|
79
|
+
}),
|
|
81
80
|
value,
|
|
82
81
|
}
|
|
83
82
|
}
|
package/src/utils/index.ts
CHANGED
|
@@ -108,10 +108,16 @@ export {
|
|
|
108
108
|
makeLegacyCommitment,
|
|
109
109
|
makeLegacyCommitmentFromTuple,
|
|
110
110
|
makeLegacyCommitmentTuple,
|
|
111
|
+
makeLegacyCommitmentWithConfigTuple,
|
|
111
112
|
makeLegacyRegistrationTuple,
|
|
113
|
+
makeLegacyRegistrationWithConfigTuple,
|
|
114
|
+
isLegacyRegistrationWithConfigParameters,
|
|
112
115
|
type LegacyCommitmentTuple,
|
|
116
|
+
type LegacyCommitmentWithConfigTuple,
|
|
113
117
|
type LegacyRegistrationParameters,
|
|
118
|
+
type LegacyRegistrationWithConfigParameters,
|
|
114
119
|
type LegacyRegistrationTuple,
|
|
120
|
+
type LegacyRegistrationWithConfigTuple,
|
|
115
121
|
} from './legacyRegisterHelpers.js'
|
|
116
122
|
export { makeSafeSecondsDate } from './makeSafeSecondsDate.js'
|
|
117
123
|
export {
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
import { EMPTY_ADDRESS } from './consts.js'
|
|
9
9
|
import { LegacyRegistrationInvalidConfigError } from '../errors/register.js'
|
|
10
10
|
|
|
11
|
-
export type
|
|
11
|
+
export type LegacyRegistrationParameters = {
|
|
12
12
|
/** Name to register */
|
|
13
13
|
name: string
|
|
14
14
|
/** Address to set owner to */
|
|
@@ -24,16 +24,12 @@ export type LegacyRegistrationBaseParameters = {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
export type LegacyRegistrationWithConfigParameters =
|
|
27
|
-
|
|
27
|
+
LegacyRegistrationParameters & {
|
|
28
28
|
resolverAddress: Address
|
|
29
29
|
address?: Address
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
export
|
|
33
|
-
| LegacyRegistrationBaseParameters
|
|
34
|
-
| LegacyRegistrationWithConfigParameters
|
|
35
|
-
|
|
36
|
-
export const isLegacyRegistrationWithConfig = (
|
|
32
|
+
export const isLegacyRegistrationWithConfigParameters = (
|
|
37
33
|
params: LegacyRegistrationParameters,
|
|
38
34
|
): params is LegacyRegistrationWithConfigParameters => {
|
|
39
35
|
const { resolverAddress = EMPTY_ADDRESS, address = EMPTY_ADDRESS } =
|
|
@@ -47,67 +43,79 @@ export const isLegacyRegistrationWithConfig = (
|
|
|
47
43
|
return resolverAddress !== EMPTY_ADDRESS || address !== EMPTY_ADDRESS
|
|
48
44
|
}
|
|
49
45
|
|
|
50
|
-
export type LegacyCommitmentTuple =
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
export type LegacyRegistrationTuple =
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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
|
+
]
|
|
70
71
|
|
|
71
72
|
export const makeLegacyCommitmentTuple = (
|
|
72
73
|
params: LegacyRegistrationParameters,
|
|
73
74
|
): LegacyCommitmentTuple => {
|
|
74
|
-
const {
|
|
75
|
-
name,
|
|
76
|
-
owner,
|
|
77
|
-
secret,
|
|
78
|
-
resolverAddress = EMPTY_ADDRESS,
|
|
79
|
-
address = EMPTY_ADDRESS,
|
|
80
|
-
} = params as LegacyRegistrationWithConfigParameters
|
|
81
|
-
|
|
75
|
+
const { name, owner, secret } = params
|
|
82
76
|
const label = name.split('.')[0]
|
|
83
|
-
|
|
84
|
-
if (isLegacyRegistrationWithConfig(params)) {
|
|
85
|
-
return [label, owner, secret, resolverAddress, address]
|
|
86
|
-
}
|
|
87
77
|
return [label, owner, secret]
|
|
88
78
|
}
|
|
89
79
|
|
|
90
|
-
export const
|
|
91
|
-
params:
|
|
92
|
-
):
|
|
80
|
+
export const makeLegacyCommitmentWithConfigTuple = (
|
|
81
|
+
params: LegacyRegistrationWithConfigParameters,
|
|
82
|
+
): LegacyCommitmentWithConfigTuple => {
|
|
93
83
|
const {
|
|
94
84
|
name,
|
|
95
85
|
owner,
|
|
96
86
|
secret,
|
|
97
|
-
duration,
|
|
98
87
|
resolverAddress = EMPTY_ADDRESS,
|
|
99
88
|
address = EMPTY_ADDRESS,
|
|
100
89
|
} = params as LegacyRegistrationWithConfigParameters
|
|
101
90
|
const label = name.split('.')[0]
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
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]
|
|
105
102
|
}
|
|
106
103
|
|
|
107
|
-
export const
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
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 => {
|
|
111
119
|
const labelHash = labelhash(label)
|
|
112
120
|
const params = [labelHash, ...others] as const
|
|
113
121
|
|
|
@@ -130,5 +138,10 @@ export const makeLegacyCommitmentFromTuple = ([
|
|
|
130
138
|
}
|
|
131
139
|
|
|
132
140
|
export const makeLegacyCommitment = (
|
|
133
|
-
params: LegacyRegistrationParameters,
|
|
134
|
-
): Hex =>
|
|
141
|
+
params: LegacyRegistrationParameters | LegacyRegistrationWithConfigParameters,
|
|
142
|
+
): Hex => {
|
|
143
|
+
const touple = isLegacyRegistrationWithConfigParameters(params)
|
|
144
|
+
? makeLegacyCommitmentWithConfigTuple(params)
|
|
145
|
+
: makeLegacyCommitmentTuple(params)
|
|
146
|
+
return makeLegacyCommitmentFromTuple(touple)
|
|
147
|
+
}
|