@ensdomains/ensjs 3.0.0-alpha.40 → 3.0.0-alpha.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/dist/cjs/contracts/getContractAddress.js +4 -4
  2. package/dist/cjs/functions/commitName.js +2 -3
  3. package/dist/cjs/functions/createSubname.js +2 -8
  4. package/dist/cjs/functions/getHistory.js +14 -7
  5. package/dist/cjs/functions/getNames.js +10 -6
  6. package/dist/cjs/functions/getOwner.js +25 -12
  7. package/dist/cjs/functions/getSpecificRecord.js +83 -0
  8. package/dist/cjs/functions/getWrapperData.js +3 -4
  9. package/dist/cjs/functions/renewNames.js +13 -20
  10. package/dist/cjs/functions/{burnFuses.js → setFuses.js} +24 -6
  11. package/dist/cjs/functions/wrapName.js +7 -23
  12. package/dist/cjs/generated/factories/ETHRegistrarController__factory.js +6 -55
  13. package/dist/cjs/generated/factories/NameWrapper__factory.js +90 -69
  14. package/dist/cjs/generated/factories/PublicResolver__factory.js +83 -0
  15. package/dist/cjs/generated/factories/UniversalResolver__factory.js +67 -2
  16. package/dist/cjs/index.js +15 -4
  17. package/dist/cjs/utils/consts.js +3 -1
  18. package/dist/cjs/utils/fuses.js +218 -53
  19. package/dist/cjs/utils/normalise.js +2 -2
  20. package/dist/cjs/utils/recordHelpers.js +55 -0
  21. package/dist/cjs/utils/registerHelpers.js +9 -23
  22. package/dist/cjs/utils/subgraph-types.js +16 -0
  23. package/dist/cjs/utils/wrapper.js +2 -2
  24. package/dist/esm/contracts/getContractAddress.mjs +4 -4
  25. package/dist/esm/functions/commitName.mjs +2 -3
  26. package/dist/esm/functions/createSubname.mjs +2 -2
  27. package/dist/esm/functions/getHistory.mjs +14 -7
  28. package/dist/esm/functions/getNames.mjs +10 -6
  29. package/dist/esm/functions/getOwner.mjs +25 -12
  30. package/dist/esm/functions/getSpecificRecord.mjs +78 -1
  31. package/dist/esm/functions/getWrapperData.mjs +3 -4
  32. package/dist/esm/functions/renewNames.mjs +13 -20
  33. package/dist/esm/functions/setFuses.mjs +30 -0
  34. package/dist/esm/functions/wrapName.mjs +8 -18
  35. package/dist/esm/generated/factories/ETHRegistrarController__factory.mjs +6 -55
  36. package/dist/esm/generated/factories/NameWrapper__factory.mjs +90 -69
  37. package/dist/esm/generated/factories/PublicResolver__factory.mjs +83 -0
  38. package/dist/esm/generated/factories/UniversalResolver__factory.mjs +67 -2
  39. package/dist/esm/index.mjs +15 -4
  40. package/dist/esm/utils/consts.mjs +3 -1
  41. package/dist/esm/utils/fuses.mjs +218 -53
  42. package/dist/esm/utils/normalise.mjs +1 -1
  43. package/dist/esm/utils/recordHelpers.mjs +49 -0
  44. package/dist/esm/utils/registerHelpers.mjs +9 -17
  45. package/dist/esm/utils/subgraph-types.mjs +0 -0
  46. package/dist/esm/utils/wrapper.mjs +1 -1
  47. package/dist/types/functions/commitName.d.ts +5 -6
  48. package/dist/types/functions/createSubname.d.ts +3 -3
  49. package/dist/types/functions/deleteSubname.d.ts +1 -1
  50. package/dist/types/functions/getHistory.d.ts +1 -1
  51. package/dist/types/functions/getNames.d.ts +3 -3
  52. package/dist/types/functions/getOwner.d.ts +1 -0
  53. package/dist/types/functions/getSpecificRecord.d.ts +22 -0
  54. package/dist/types/functions/getWrapperData.d.ts +44 -5
  55. package/dist/types/functions/importDNSSECName.d.ts +1 -1
  56. package/dist/types/functions/registerName.d.ts +1 -1
  57. package/dist/types/functions/renewNames.d.ts +5 -6
  58. package/dist/types/functions/setFuses.d.ts +7 -0
  59. package/dist/types/functions/setName.d.ts +1 -1
  60. package/dist/types/functions/setRecord.d.ts +5 -1
  61. package/dist/types/functions/setRecords.d.ts +1 -1
  62. package/dist/types/functions/setResolver.d.ts +1 -1
  63. package/dist/types/functions/transferController.d.ts +1 -1
  64. package/dist/types/functions/transferName.d.ts +1 -1
  65. package/dist/types/functions/transferSubname.d.ts +1 -1
  66. package/dist/types/functions/types.d.ts +9 -5
  67. package/dist/types/functions/unwrapName.d.ts +1 -1
  68. package/dist/types/functions/wrapName.d.ts +4 -4
  69. package/dist/types/generated/ETHRegistrarController.d.ts +13 -36
  70. package/dist/types/generated/NameWrapper.d.ts +97 -52
  71. package/dist/types/generated/PublicResolver.d.ts +50 -1
  72. package/dist/types/generated/UniversalResolver.d.ts +79 -32
  73. package/dist/types/generated/factories/UniversalResolver__factory.d.ts +15 -0
  74. package/dist/types/index.d.ts +75 -11
  75. package/dist/types/utils/consts.d.ts +1 -0
  76. package/dist/types/utils/fuses.d.ts +115 -45
  77. package/dist/types/utils/recordHelpers.d.ts +14 -2
  78. package/dist/types/utils/registerHelpers.d.ts +7 -25
  79. package/dist/types/utils/subgraph-types.d.ts +284 -0
  80. package/dist/types/utils/writeTx.d.ts +5 -5
  81. package/package.json +8 -5
  82. package/src/@types/pako.d.ts +188 -0
  83. package/src/contracts/bulkRenewal.ts +1 -1
  84. package/src/contracts/getContractAddress.ts +4 -4
  85. package/src/functions/commitName.test.ts +0 -3
  86. package/src/functions/commitName.ts +1 -2
  87. package/src/functions/createSubname.ts +4 -5
  88. package/src/functions/getHistory.ts +59 -25
  89. package/src/functions/getNames.test.ts +1 -1
  90. package/src/functions/getNames.ts +26 -13
  91. package/src/functions/getOwner.test.ts +62 -3
  92. package/src/functions/getOwner.ts +31 -11
  93. package/src/functions/getSpecificRecord.test.ts +162 -0
  94. package/src/functions/getSpecificRecord.ts +95 -1
  95. package/src/functions/getWrapperData.test.ts +11 -45
  96. package/src/functions/getWrapperData.ts +7 -5
  97. package/src/functions/registerName.test.ts +3 -3
  98. package/src/functions/renewNames.ts +17 -23
  99. package/src/functions/setFuses.test.ts +240 -0
  100. package/src/functions/setFuses.ts +44 -0
  101. package/src/functions/setRecord.test.ts +147 -1
  102. package/src/functions/setRecord.ts +6 -1
  103. package/src/functions/types.ts +10 -4
  104. package/src/functions/wrapName.test.ts +8 -7
  105. package/src/functions/wrapName.ts +10 -24
  106. package/src/generated/ETHRegistrarController.ts +12 -79
  107. package/src/generated/NameWrapper.ts +155 -99
  108. package/src/generated/PublicResolver.ts +123 -0
  109. package/src/generated/UniversalResolver.ts +157 -16
  110. package/src/generated/factories/ETHRegistrarController__factory.ts +6 -55
  111. package/src/generated/factories/NameWrapper__factory.ts +90 -69
  112. package/src/generated/factories/PublicResolver__factory.ts +83 -0
  113. package/src/generated/factories/UniversalResolver__factory.ts +67 -2
  114. package/src/index.ts +23 -14
  115. package/src/utils/consts.ts +1 -0
  116. package/src/utils/fuses.ts +299 -102
  117. package/src/utils/normalise.ts +1 -1
  118. package/src/utils/recordHelpers.ts +64 -1
  119. package/src/utils/registerHelpers.ts +13 -41
  120. package/src/utils/subgraph-types.ts +312 -0
  121. package/src/utils/wrapper.ts +1 -1
  122. package/dist/cjs/utils/generateFuseInput.js +0 -40
  123. package/dist/esm/functions/burnFuses.mjs +0 -12
  124. package/dist/esm/utils/generateFuseInput.mjs +0 -15
  125. package/dist/types/functions/burnFuses.d.ts +0 -3
  126. package/dist/types/utils/generateFuseInput.d.ts +0 -3
  127. package/src/functions/burnFuses.test.ts +0 -148
  128. package/src/functions/burnFuses.ts +0 -16
  129. package/src/utils/generateFuseInput.ts +0 -13
@@ -1,15 +1,11 @@
1
1
  import { defaultAbiCoder } from '@ethersproject/abi/lib/abi-coder'
2
- import { BigNumberish } from '@ethersproject/bignumber/lib/bignumber'
3
2
  import { keccak256 } from '@ethersproject/keccak256'
4
3
  import type { PublicResolver } from '../generated'
5
- import { FuseOptions } from './fuses'
6
- import generateFuseInput from './generateFuseInput'
4
+ import { CombinedFuseInput, encodeFuses, hasFuses } from './fuses'
7
5
  import { labelhash } from './labels'
8
6
  import { namehash } from './normalise'
9
7
  import { generateRecordCallArray, RecordOptions } from './recordHelpers'
10
8
 
11
- export const MAX_INT_64 = 2n ** 64n - 1n
12
-
13
9
  export type BaseRegistrationParams = {
14
10
  owner: string
15
11
  duration: number
@@ -17,8 +13,7 @@ export type BaseRegistrationParams = {
17
13
  resolverAddress?: string
18
14
  records?: RecordOptions
19
15
  reverseRecord?: boolean
20
- fuses?: FuseOptions
21
- wrapperExpiry?: BigNumberish
16
+ fuses?: CombinedFuseInput['child']
22
17
  }
23
18
 
24
19
  export type RegistrationParams = Omit<
@@ -29,12 +24,8 @@ export type RegistrationParams = Omit<
29
24
  resolver: PublicResolver
30
25
  }
31
26
 
32
- export type CommitmentParams = Omit<
33
- RegistrationParams,
34
- 'secret' | 'wrapperExpiry'
35
- > & {
27
+ export type CommitmentParams = Omit<RegistrationParams, 'secret'> & {
36
28
  secret?: string
37
- wrapperExpiry?: BigNumberish
38
29
  }
39
30
 
40
31
  export type RegistrationTuple = [
@@ -45,20 +36,7 @@ export type RegistrationTuple = [
45
36
  resolver: string,
46
37
  data: string[],
47
38
  reverseRecord: boolean,
48
- fuses: string,
49
- wrapperExpiry: BigNumberish,
50
- ]
51
-
52
- export type CommitmentTuple = [
53
- labelhash: string,
54
- owner: string,
55
- duration: number,
56
- resolver: string,
57
- data: string[],
58
- secret: string,
59
- reverseRecord: boolean,
60
- fuses: string,
61
- wrapperExpiry: BigNumberish,
39
+ ownerControlledFuses: number,
62
40
  ]
63
41
 
64
42
  export const randomSecret = () => {
@@ -74,15 +52,14 @@ export const makeCommitmentData = ({
74
52
  records,
75
53
  reverseRecord,
76
54
  fuses,
77
- wrapperExpiry,
78
55
  secret,
79
56
  }: CommitmentParams & {
80
57
  secret: string
81
- }): CommitmentTuple => {
82
- const label = labelhash(name.split('.')[0])
58
+ }): RegistrationTuple => {
59
+ const labelHash = labelhash(name.split('.')[0])
83
60
  const hash = namehash(name)
84
61
  const resolverAddress = resolver.address
85
- const fuseData = fuses ? generateFuseInput(fuses) : '0'
62
+ const fuseData = hasFuses(fuses) ? encodeFuses(fuses!, 'child') : 0
86
63
 
87
64
  if (reverseRecord) {
88
65
  if (!records) {
@@ -96,15 +73,14 @@ export const makeCommitmentData = ({
96
73
  const data = records ? generateRecordCallArray(hash, records, resolver) : []
97
74
 
98
75
  return [
99
- label,
76
+ labelHash,
100
77
  owner,
101
78
  duration,
79
+ secret,
102
80
  resolverAddress,
103
81
  data,
104
- secret,
105
82
  !!reverseRecord,
106
83
  fuseData,
107
- wrapperExpiry || MAX_INT_64,
108
84
  ]
109
85
  }
110
86
 
@@ -114,24 +90,21 @@ export const makeRegistrationData = (
114
90
  const commitmentData = makeCommitmentData(params)
115
91
  const label = params.name.split('.')[0]
116
92
  commitmentData[0] = label
117
- const secret = commitmentData.splice(5, 1)[0]
118
- commitmentData.splice(3, 0, secret)
119
- return commitmentData as unknown as RegistrationTuple
93
+ return commitmentData
120
94
  }
121
95
 
122
- export const _makeCommitment = (params: CommitmentTuple) => {
96
+ export const _makeCommitment = (params: RegistrationTuple) => {
123
97
  return keccak256(
124
98
  defaultAbiCoder.encode(
125
99
  [
126
100
  'bytes32',
127
101
  'address',
128
102
  'uint256',
103
+ 'bytes32',
129
104
  'address',
130
105
  'bytes[]',
131
- 'bytes32',
132
106
  'bool',
133
- 'uint32',
134
- 'uint64',
107
+ 'uint16',
135
108
  ],
136
109
  params,
137
110
  ),
@@ -152,6 +125,5 @@ export const makeCommitment = ({
152
125
  return {
153
126
  secret,
154
127
  commitment,
155
- wrapperExpiry: generatedParams[8],
156
128
  }
157
129
  }
@@ -0,0 +1,312 @@
1
+ export type Maybe<T> = T | null
2
+ export type Exact<T extends { [key: string]: unknown }> = {
3
+ [K in keyof T]: T[K]
4
+ }
5
+ export type MakeOptional<T, K extends keyof T> = Omit<T, K> & {
6
+ [SubKey in K]?: Maybe<T[SubKey]>
7
+ }
8
+ export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & {
9
+ [SubKey in K]: Maybe<T[SubKey]>
10
+ }
11
+ /** All built-in and custom scalars, mapped to their actual values */
12
+ export type Scalars = {
13
+ ID: string
14
+ String: string
15
+ Boolean: boolean
16
+ Int: number
17
+ Float: number
18
+ Bytes: string
19
+ BigInt: string
20
+ }
21
+
22
+ export type Domain = {
23
+ __typename?: 'Domain'
24
+ id: Scalars['ID']
25
+ name?: Maybe<Scalars['String']>
26
+ labelName?: Maybe<Scalars['String']>
27
+ labelhash?: Maybe<Scalars['Bytes']>
28
+ parent?: Maybe<Domain>
29
+ subdomains: Array<Domain>
30
+ subdomainCount: Scalars['Int']
31
+ resolvedAddress?: Maybe<Account>
32
+ owner: Account
33
+ resolver?: Maybe<Resolver>
34
+ ttl?: Maybe<Scalars['BigInt']>
35
+ isMigrated: Scalars['Boolean']
36
+ createdAt: Scalars['BigInt']
37
+ events: Array<DomainEvent>
38
+ registration?: Maybe<Registration>
39
+ wrappedDomain?: Maybe<WrappedDomain>
40
+ }
41
+
42
+ export type DomainEvent = {
43
+ id: Scalars['ID']
44
+ domain: Domain
45
+ blockNumber: Scalars['Int']
46
+ transactionID: Scalars['Bytes']
47
+ }
48
+
49
+ export type Transfer = DomainEvent & {
50
+ __typename?: 'Transfer'
51
+ id: Scalars['ID']
52
+ domain: Domain
53
+ blockNumber: Scalars['Int']
54
+ transactionID: Scalars['Bytes']
55
+ owner: Account
56
+ }
57
+
58
+ export type NewOwner = DomainEvent & {
59
+ __typename?: 'NewOwner'
60
+ id: Scalars['ID']
61
+ parentDomain: Domain
62
+ domain: Domain
63
+ blockNumber: Scalars['Int']
64
+ transactionID: Scalars['Bytes']
65
+ owner: Account
66
+ }
67
+
68
+ export type NewResolver = DomainEvent & {
69
+ __typename?: 'NewResolver'
70
+ id: Scalars['ID']
71
+ domain: Domain
72
+ blockNumber: Scalars['Int']
73
+ transactionID: Scalars['Bytes']
74
+ resolver: Resolver
75
+ }
76
+
77
+ export type NewTtl = DomainEvent & {
78
+ __typename?: 'NewTTL'
79
+ id: Scalars['ID']
80
+ domain: Domain
81
+ blockNumber: Scalars['Int']
82
+ transactionID: Scalars['Bytes']
83
+ ttl: Scalars['BigInt']
84
+ }
85
+
86
+ export type WrappedTransfer = DomainEvent & {
87
+ __typename?: 'WrappedTransfer'
88
+ id: Scalars['ID']
89
+ domain: Domain
90
+ blockNumber: Scalars['Int']
91
+ transactionID: Scalars['Bytes']
92
+ owner: Account
93
+ }
94
+
95
+ export type NameWrapped = DomainEvent & {
96
+ __typename?: 'NameWrapped'
97
+ id: Scalars['ID']
98
+ domain: Domain
99
+ blockNumber: Scalars['Int']
100
+ transactionID: Scalars['Bytes']
101
+ name: Scalars['String']
102
+ fuses: Scalars['Int']
103
+ owner: Account
104
+ expiryDate: Scalars['BigInt']
105
+ }
106
+
107
+ export type NameUnwrapped = DomainEvent & {
108
+ __typename?: 'NameUnwrapped'
109
+ id: Scalars['ID']
110
+ domain: Domain
111
+ blockNumber: Scalars['Int']
112
+ transactionID: Scalars['Bytes']
113
+ owner: Account
114
+ }
115
+
116
+ export type FusesSet = DomainEvent & {
117
+ __typename?: 'FusesSet'
118
+ id: Scalars['ID']
119
+ domain: Domain
120
+ blockNumber: Scalars['Int']
121
+ transactionID: Scalars['Bytes']
122
+ fuses: Scalars['Int']
123
+ }
124
+
125
+ export type ExpiryExtended = DomainEvent & {
126
+ __typename?: 'ExpiryExtended'
127
+ id: Scalars['ID']
128
+ domain: Domain
129
+ blockNumber: Scalars['Int']
130
+ transactionID: Scalars['Bytes']
131
+ expiryDate: Scalars['BigInt']
132
+ }
133
+
134
+ export type Registration = {
135
+ __typename?: 'Registration'
136
+ id: Scalars['ID']
137
+ domain: Domain
138
+ registrationDate: Scalars['BigInt']
139
+ expiryDate: Scalars['BigInt']
140
+ cost?: Maybe<Scalars['BigInt']>
141
+ registrant: Account
142
+ labelName?: Maybe<Scalars['String']>
143
+ events: Array<RegistrationEvent>
144
+ }
145
+
146
+ export type RegistrationEvent = {
147
+ id: Scalars['ID']
148
+ registration: Registration
149
+ blockNumber: Scalars['Int']
150
+ transactionID: Scalars['Bytes']
151
+ }
152
+
153
+ export type NameRegistered = RegistrationEvent & {
154
+ __typename?: 'NameRegistered'
155
+ id: Scalars['ID']
156
+ registration: Registration
157
+ blockNumber: Scalars['Int']
158
+ transactionID: Scalars['Bytes']
159
+ registrant: Account
160
+ expiryDate: Scalars['BigInt']
161
+ }
162
+
163
+ export type NameRenewed = RegistrationEvent & {
164
+ __typename?: 'NameRenewed'
165
+ id: Scalars['ID']
166
+ registration: Registration
167
+ blockNumber: Scalars['Int']
168
+ transactionID: Scalars['Bytes']
169
+ expiryDate: Scalars['BigInt']
170
+ }
171
+
172
+ export type NameTransferred = RegistrationEvent & {
173
+ __typename?: 'NameTransferred'
174
+ id: Scalars['ID']
175
+ registration: Registration
176
+ blockNumber: Scalars['Int']
177
+ transactionID: Scalars['Bytes']
178
+ newOwner: Account
179
+ }
180
+
181
+ export type WrappedDomain = {
182
+ __typename?: 'WrappedDomain'
183
+ id: Scalars['ID']
184
+ domain: Domain
185
+ expiryDate: Scalars['BigInt']
186
+ fuses: Scalars['Int']
187
+ owner: Account
188
+ name?: Maybe<Scalars['String']>
189
+ }
190
+
191
+ export type Account = {
192
+ __typename?: 'Account'
193
+ id: Scalars['ID']
194
+ domains: Array<Domain>
195
+ wrappedDomains?: Maybe<Array<WrappedDomain>>
196
+ registrations?: Maybe<Array<Registration>>
197
+ }
198
+
199
+ export type Resolver = {
200
+ __typename?: 'Resolver'
201
+ id: Scalars['ID']
202
+ domain?: Maybe<Domain>
203
+ address: Scalars['Bytes']
204
+ addr?: Maybe<Account>
205
+ contentHash?: Maybe<Scalars['Bytes']>
206
+ texts?: Maybe<Array<Scalars['String']>>
207
+ coinTypes?: Maybe<Array<Scalars['BigInt']>>
208
+ events: Array<ResolverEvent>
209
+ }
210
+
211
+ export type ResolverEvent = {
212
+ id: Scalars['ID']
213
+ resolver: Resolver
214
+ blockNumber: Scalars['Int']
215
+ transactionID: Scalars['Bytes']
216
+ }
217
+
218
+ export type AddrChanged = ResolverEvent & {
219
+ __typename?: 'AddrChanged'
220
+ id: Scalars['ID']
221
+ resolver: Resolver
222
+ blockNumber: Scalars['Int']
223
+ transactionID: Scalars['Bytes']
224
+ addr: Account
225
+ }
226
+
227
+ export type MulticoinAddrChanged = ResolverEvent & {
228
+ __typename?: 'MulticoinAddrChanged'
229
+ id: Scalars['ID']
230
+ resolver: Resolver
231
+ blockNumber: Scalars['Int']
232
+ transactionID: Scalars['Bytes']
233
+ coinType: Scalars['BigInt']
234
+ addr: Scalars['Bytes']
235
+ }
236
+
237
+ export type NameChanged = ResolverEvent & {
238
+ __typename?: 'NameChanged'
239
+ id: Scalars['ID']
240
+ resolver: Resolver
241
+ blockNumber: Scalars['Int']
242
+ transactionID: Scalars['Bytes']
243
+ name: Scalars['String']
244
+ }
245
+
246
+ export type AbiChanged = ResolverEvent & {
247
+ __typename?: 'AbiChanged'
248
+ id: Scalars['ID']
249
+ resolver: Resolver
250
+ blockNumber: Scalars['Int']
251
+ transactionID: Scalars['Bytes']
252
+ contentType: Scalars['BigInt']
253
+ }
254
+
255
+ export type PubkeyChanged = ResolverEvent & {
256
+ __typename?: 'PubkeyChanged'
257
+ id: Scalars['ID']
258
+ resolver: Resolver
259
+ blockNumber: Scalars['Int']
260
+ transactionID: Scalars['Bytes']
261
+ x: Scalars['Bytes']
262
+ y: Scalars['Bytes']
263
+ }
264
+
265
+ export type TextChanged = ResolverEvent & {
266
+ __typename?: 'TextChanged'
267
+ id: Scalars['ID']
268
+ resolver: Resolver
269
+ blockNumber: Scalars['Int']
270
+ transactionID: Scalars['Bytes']
271
+ key: Scalars['String']
272
+ value?: Maybe<Scalars['String']>
273
+ }
274
+
275
+ export type ContenthashChanged = ResolverEvent & {
276
+ __typename?: 'ContenthashChanged'
277
+ id: Scalars['ID']
278
+ resolver: Resolver
279
+ blockNumber: Scalars['Int']
280
+ transactionID: Scalars['Bytes']
281
+ hash: Scalars['Bytes']
282
+ }
283
+
284
+ export type InterfaceChanged = ResolverEvent & {
285
+ __typename?: 'InterfaceChanged'
286
+ id: Scalars['ID']
287
+ resolver: Resolver
288
+ blockNumber: Scalars['Int']
289
+ transactionID: Scalars['Bytes']
290
+ interfaceID: Scalars['Bytes']
291
+ implementer: Scalars['Bytes']
292
+ }
293
+
294
+ export type AuthorisationChanged = ResolverEvent & {
295
+ __typename?: 'AuthorisationChanged'
296
+ id: Scalars['ID']
297
+ resolver: Resolver
298
+ blockNumber: Scalars['Int']
299
+ transactionID: Scalars['Bytes']
300
+ owner: Scalars['Bytes']
301
+ target: Scalars['Bytes']
302
+ isAuthorized: Scalars['Boolean']
303
+ }
304
+
305
+ export type VersionChanged = ResolverEvent & {
306
+ __typename?: 'VersionChanged'
307
+ id: Scalars['ID']
308
+ resolver: Resolver
309
+ blockNumber: Scalars['Int']
310
+ transactionID: Scalars['Bytes']
311
+ version: Scalars['BigInt']
312
+ }
@@ -1,5 +1,5 @@
1
1
  import { BigNumber } from '@ethersproject/bignumber/lib/bignumber'
2
- import { toUtf8Bytes } from '@ethersproject/strings/lib/utf8'
2
+ import { toUtf8Bytes } from '@ethersproject/strings'
3
3
  import { ENSArgs } from '../index'
4
4
 
5
5
  export type Expiry = string | number | Date | BigNumber
@@ -1,40 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
- mod
23
- ));
24
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
- var generateFuseInput_exports = {};
26
- __export(generateFuseInput_exports, {
27
- default: () => generateFuseInput_default
28
- });
29
- module.exports = __toCommonJS(generateFuseInput_exports);
30
- var import_bignumber = require("@ethersproject/bignumber/lib/bignumber");
31
- var import_fuses = __toESM(require("./fuses"));
32
- var generateFuseInput_default = (fuseOptions) => {
33
- const fuseKeys = Object.keys(fuseOptions).filter(
34
- (opt) => fuseOptions[opt] === true
35
- );
36
- const bigNumberFuses = fuseKeys.reduce((prev, curr) => {
37
- return prev.or(import_fuses.default[curr]);
38
- }, import_bignumber.BigNumber.from(0));
39
- return bigNumberFuses.toHexString();
40
- };
@@ -1,12 +0,0 @@
1
- // src/functions/burnFuses.ts
2
- import { validateFuses } from "../utils/fuses.mjs";
3
- import { namehash } from "../utils/normalise.mjs";
4
- async function burnFuses_default({ contracts, signer }, name, props) {
5
- const encodedFuses = validateFuses(props);
6
- const nameWrapper = (await contracts.getNameWrapper()).connect(signer);
7
- const hash = namehash(name);
8
- return nameWrapper.populateTransaction.setFuses(hash, encodedFuses);
9
- }
10
- export {
11
- burnFuses_default as default
12
- };
@@ -1,15 +0,0 @@
1
- // src/utils/generateFuseInput.ts
2
- import { BigNumber } from "@ethersproject/bignumber/lib.esm/bignumber.js";
3
- import fuses from "./fuses.mjs";
4
- var generateFuseInput_default = (fuseOptions) => {
5
- const fuseKeys = Object.keys(fuseOptions).filter(
6
- (opt) => fuseOptions[opt] === true
7
- );
8
- const bigNumberFuses = fuseKeys.reduce((prev, curr) => {
9
- return prev.or(fuses[curr]);
10
- }, BigNumber.from(0));
11
- return bigNumberFuses.toHexString();
12
- };
13
- export {
14
- generateFuseInput_default as default
15
- };
@@ -1,3 +0,0 @@
1
- import { ENSArgs } from '..';
2
- import { FuseProps } from '../utils/fuses';
3
- export default function ({ contracts, signer }: ENSArgs<'contracts' | 'signer'>, name: string, props: FuseProps): Promise<import("@ethersproject/contracts").PopulatedTransaction>;
@@ -1,3 +0,0 @@
1
- import { FuseOptions } from './fuses';
2
- declare const _default: (fuseOptions: FuseOptions) => string;
3
- export default _default;
@@ -1,148 +0,0 @@
1
- import { ethers } from 'ethers'
2
- import { ENS } from '..'
3
- import setup from '../tests/setup'
4
- import { namehash } from '../utils/normalise'
5
-
6
- let ensInstance: ENS
7
- let revert: Awaited<ReturnType<typeof setup>>['revert']
8
- let provider: ethers.providers.JsonRpcProvider
9
- let accounts: string[]
10
-
11
- beforeAll(async () => {
12
- ;({ ensInstance, revert, provider } = await setup())
13
- accounts = await provider.listAccounts()
14
- })
15
-
16
- afterAll(async () => {
17
- await revert()
18
- })
19
-
20
- describe('burnFuses', () => {
21
- beforeEach(async () => {
22
- await revert()
23
- })
24
- describe('Array', () => {
25
- it('should return a burnFuses transaction from a named fuse array and succeed', async () => {
26
- const tx = await ensInstance.burnFuses('wrapped.eth', {
27
- namedFusesToBurn: [
28
- 'CANNOT_UNWRAP',
29
- 'CANNOT_CREATE_SUBDOMAIN',
30
- 'CANNOT_SET_TTL',
31
- ],
32
- addressOrIndex: accounts[1],
33
- })
34
- expect(tx).toBeTruthy()
35
- await tx.wait()
36
-
37
- const nameWrapper = await ensInstance.contracts!.getNameWrapper()!
38
- const [, fuses] = await nameWrapper.getData(namehash('wrapped.eth'))
39
- expect(fuses).toBe(113)
40
- })
41
- it('should return a burnFuses transaction from an unnamed fuse array and succeed', async () => {
42
- const tx0 = await ensInstance.burnFuses('wrapped.eth', {
43
- namedFusesToBurn: ['CANNOT_UNWRAP'],
44
- addressOrIndex: accounts[1],
45
- })
46
- expect(tx0).toBeTruthy()
47
- await tx0.wait()
48
-
49
- const tx = await ensInstance.burnFuses('wrapped.eth', {
50
- unnamedFusesToBurn: [128, 256, 512],
51
- addressOrIndex: accounts[1],
52
- })
53
- expect(tx).toBeTruthy()
54
- await tx.wait()
55
-
56
- const nameWrapper = await ensInstance.contracts!.getNameWrapper()!
57
- const [, fuses] = await nameWrapper.getData(namehash('wrapped.eth'))
58
- expect(fuses).toBe(961)
59
- })
60
- it('should return a burnFuses transaction from both an unnamed and named fuse array and succeed', async () => {
61
- const tx = await ensInstance.burnFuses('wrapped.eth', {
62
- namedFusesToBurn: [
63
- 'CANNOT_UNWRAP',
64
- 'CANNOT_CREATE_SUBDOMAIN',
65
- 'CANNOT_SET_TTL',
66
- ],
67
- unnamedFusesToBurn: [128, 256, 512],
68
- addressOrIndex: accounts[1],
69
- })
70
- expect(tx).toBeTruthy()
71
- await tx.wait()
72
-
73
- const nameWrapper = await ensInstance.contracts!.getNameWrapper()!
74
- const [, fuses] = await nameWrapper.getData(namehash('wrapped.eth'))
75
- expect(fuses).toBe(1009)
76
- })
77
- it('should throw an error when trying to burn a named fuse in an unnamed fuse array', async () => {
78
- try {
79
- await ensInstance.burnFuses('wrapped.eth', {
80
- unnamedFusesToBurn: [64] as any,
81
- })
82
- expect(false).toBeTruthy()
83
- } catch (e: any) {
84
- expect(e.message).toBe(
85
- '64 is not a valid unnamed fuse. If you are trying to burn a named fuse, use the namedFusesToBurn property.',
86
- )
87
- }
88
- })
89
- it('should throw an error when trying to burn an unnamed fuse in a named fuse array', async () => {
90
- try {
91
- await ensInstance.burnFuses('wrapped.eth', {
92
- namedFusesToBurn: ['COOL_SWAG_FUSE'] as any,
93
- })
94
- expect(false).toBeTruthy()
95
- } catch (e: any) {
96
- expect(e.message).toBe('COOL_SWAG_FUSE is not a valid named fuse.')
97
- }
98
- })
99
- })
100
- describe('Number', () => {
101
- it('should return a burnFuses transaction from a number and succeed', async () => {
102
- const tx = await ensInstance.burnFuses('wrapped.eth', {
103
- fuseNumberToBurn: 49,
104
- addressOrIndex: accounts[1],
105
- })
106
- expect(tx).toBeTruthy()
107
- await tx.wait()
108
-
109
- const nameWrapper = await ensInstance.contracts!.getNameWrapper()!
110
- const [, fuses] = await nameWrapper.getData(namehash('wrapped.eth'))
111
- expect(fuses).toBe(113)
112
- })
113
- it('should throw an error if the number is too high', async () => {
114
- try {
115
- await ensInstance.burnFuses('wrapped.eth', {
116
- fuseNumberToBurn: 4294967297,
117
- })
118
- expect(false).toBeTruthy()
119
- } catch (e: any) {
120
- expect(e.message).toBe(
121
- 'Fuse number must be limited to uint32, 4294967297 was too high.',
122
- )
123
- }
124
- })
125
- it('should throw an error if the number is too low', async () => {
126
- try {
127
- await ensInstance.burnFuses('wrapped.eth', {
128
- fuseNumberToBurn: -1,
129
- })
130
- expect(false).toBeTruthy()
131
- } catch (e: any) {
132
- expect(e.message).toBe(
133
- 'Fuse number must be limited to uint32, -1 was too low.',
134
- )
135
- }
136
- })
137
- it('should throw an error if the number is not an integer', async () => {
138
- try {
139
- await ensInstance.burnFuses('wrapped.eth', {
140
- fuseNumberToBurn: 7.5,
141
- })
142
- expect(false).toBeTruthy()
143
- } catch (e: any) {
144
- expect(e.message).toBe('Fuse number must be an integer, 7.5 was not.')
145
- }
146
- })
147
- })
148
- })
@@ -1,16 +0,0 @@
1
- import { ENSArgs } from '..'
2
- import { FuseProps, validateFuses } from '../utils/fuses'
3
- import { namehash } from '../utils/normalise'
4
-
5
- export default async function (
6
- { contracts, signer }: ENSArgs<'contracts' | 'signer'>,
7
- name: string,
8
- props: FuseProps,
9
- ) {
10
- const encodedFuses = validateFuses(props)
11
-
12
- const nameWrapper = (await contracts!.getNameWrapper()!).connect(signer)
13
- const hash = namehash(name)
14
-
15
- return nameWrapper.populateTransaction.setFuses(hash, encodedFuses)
16
- }