@ensdomains/ensjs 3.0.0-alpha.47 → 3.0.0-alpha.49
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/functions/getNames.js +1 -5
- package/dist/cjs/utils/recordHelpers.js +9 -0
- package/dist/esm/functions/getNames.mjs +1 -5
- package/dist/esm/utils/recordHelpers.mjs +9 -0
- package/package.json +2 -2
- package/src/functions/getNames.ts +1 -5
- package/src/functions/setRecords.test.ts +36 -0
- package/src/utils/recordHelpers.ts +9 -0
|
@@ -87,6 +87,7 @@ const getNames = async ({ gqlInstance }, {
|
|
|
87
87
|
parent {
|
|
88
88
|
name
|
|
89
89
|
}
|
|
90
|
+
createdAt
|
|
90
91
|
`;
|
|
91
92
|
let queryVars = {};
|
|
92
93
|
let finalQuery = "";
|
|
@@ -109,7 +110,6 @@ const getNames = async ({ gqlInstance }, {
|
|
|
109
110
|
}
|
|
110
111
|
domains(first: 1000) {
|
|
111
112
|
${domainQueryData}
|
|
112
|
-
createdAt
|
|
113
113
|
registration {
|
|
114
114
|
registrationDate
|
|
115
115
|
expiryDate
|
|
@@ -144,7 +144,6 @@ const getNames = async ({ gqlInstance }, {
|
|
|
144
144
|
account(id: $id) {
|
|
145
145
|
domains(orderBy: $orderBy, orderDirection: $orderDirection) {
|
|
146
146
|
${domainQueryData}
|
|
147
|
-
createdAt
|
|
148
147
|
registration {
|
|
149
148
|
registrationDate
|
|
150
149
|
expiryDate
|
|
@@ -175,7 +174,6 @@ const getNames = async ({ gqlInstance }, {
|
|
|
175
174
|
orderDirection: $orderDirection
|
|
176
175
|
) {
|
|
177
176
|
${domainQueryData}
|
|
178
|
-
createdAt
|
|
179
177
|
}
|
|
180
178
|
}
|
|
181
179
|
}
|
|
@@ -207,7 +205,6 @@ const getNames = async ({ gqlInstance }, {
|
|
|
207
205
|
fuses
|
|
208
206
|
domain {
|
|
209
207
|
${domainQueryData}
|
|
210
|
-
createdAt
|
|
211
208
|
}
|
|
212
209
|
}
|
|
213
210
|
}
|
|
@@ -237,7 +234,6 @@ const getNames = async ({ gqlInstance }, {
|
|
|
237
234
|
fuses
|
|
238
235
|
domain {
|
|
239
236
|
${domainQueryData}
|
|
240
|
-
createdAt
|
|
241
237
|
}
|
|
242
238
|
}
|
|
243
239
|
}
|
|
@@ -139,6 +139,15 @@ const generateRecordCallArray = (namehash, records, resolver) => {
|
|
|
139
139
|
if (data)
|
|
140
140
|
calls.push(data);
|
|
141
141
|
}
|
|
142
|
+
if (records.abi) {
|
|
143
|
+
const data = generateSingleRecordCall(
|
|
144
|
+
namehash,
|
|
145
|
+
resolver,
|
|
146
|
+
"abi"
|
|
147
|
+
)(records.abi);
|
|
148
|
+
if (data)
|
|
149
|
+
calls.push(data);
|
|
150
|
+
}
|
|
142
151
|
if (records.texts && records.texts.length > 0) {
|
|
143
152
|
records.texts.map(generateSingleRecordCall(namehash, resolver, "text")).forEach((call) => calls.push(call));
|
|
144
153
|
}
|
|
@@ -65,6 +65,7 @@ var getNames = async ({ gqlInstance }, {
|
|
|
65
65
|
parent {
|
|
66
66
|
name
|
|
67
67
|
}
|
|
68
|
+
createdAt
|
|
68
69
|
`;
|
|
69
70
|
let queryVars = {};
|
|
70
71
|
let finalQuery = "";
|
|
@@ -87,7 +88,6 @@ var getNames = async ({ gqlInstance }, {
|
|
|
87
88
|
}
|
|
88
89
|
domains(first: 1000) {
|
|
89
90
|
${domainQueryData}
|
|
90
|
-
createdAt
|
|
91
91
|
registration {
|
|
92
92
|
registrationDate
|
|
93
93
|
expiryDate
|
|
@@ -122,7 +122,6 @@ var getNames = async ({ gqlInstance }, {
|
|
|
122
122
|
account(id: $id) {
|
|
123
123
|
domains(orderBy: $orderBy, orderDirection: $orderDirection) {
|
|
124
124
|
${domainQueryData}
|
|
125
|
-
createdAt
|
|
126
125
|
registration {
|
|
127
126
|
registrationDate
|
|
128
127
|
expiryDate
|
|
@@ -153,7 +152,6 @@ var getNames = async ({ gqlInstance }, {
|
|
|
153
152
|
orderDirection: $orderDirection
|
|
154
153
|
) {
|
|
155
154
|
${domainQueryData}
|
|
156
|
-
createdAt
|
|
157
155
|
}
|
|
158
156
|
}
|
|
159
157
|
}
|
|
@@ -185,7 +183,6 @@ var getNames = async ({ gqlInstance }, {
|
|
|
185
183
|
fuses
|
|
186
184
|
domain {
|
|
187
185
|
${domainQueryData}
|
|
188
|
-
createdAt
|
|
189
186
|
}
|
|
190
187
|
}
|
|
191
188
|
}
|
|
@@ -215,7 +212,6 @@ var getNames = async ({ gqlInstance }, {
|
|
|
215
212
|
fuses
|
|
216
213
|
domain {
|
|
217
214
|
${domainQueryData}
|
|
218
|
-
createdAt
|
|
219
215
|
}
|
|
220
216
|
}
|
|
221
217
|
}
|
|
@@ -108,6 +108,15 @@ var generateRecordCallArray = (namehash, records, resolver) => {
|
|
|
108
108
|
if (data)
|
|
109
109
|
calls.push(data);
|
|
110
110
|
}
|
|
111
|
+
if (records.abi) {
|
|
112
|
+
const data = generateSingleRecordCall(
|
|
113
|
+
namehash,
|
|
114
|
+
resolver,
|
|
115
|
+
"abi"
|
|
116
|
+
)(records.abi);
|
|
117
|
+
if (data)
|
|
118
|
+
calls.push(data);
|
|
119
|
+
}
|
|
111
120
|
if (records.texts && records.texts.length > 0) {
|
|
112
121
|
records.texts.map(generateSingleRecordCall(namehash, resolver, "text")).forEach((call) => calls.push(call));
|
|
113
122
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ensdomains/ensjs",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.49",
|
|
4
4
|
"description": "ENS javascript library for contract interaction",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.mjs",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"cbor": "^8.1.0",
|
|
67
67
|
"dns-packet": "^5.3.1",
|
|
68
68
|
"graphql": "^16.3.0",
|
|
69
|
-
"graphql-request": "
|
|
69
|
+
"graphql-request": "5.1.0",
|
|
70
70
|
"idna-uts46-hx": "3.4.0",
|
|
71
71
|
"pako": "^2.1.0",
|
|
72
72
|
"traverse": "^0.6.6"
|
|
@@ -144,6 +144,7 @@ const getNames = async (
|
|
|
144
144
|
parent {
|
|
145
145
|
name
|
|
146
146
|
}
|
|
147
|
+
createdAt
|
|
147
148
|
`
|
|
148
149
|
|
|
149
150
|
let queryVars: object = {}
|
|
@@ -168,7 +169,6 @@ const getNames = async (
|
|
|
168
169
|
}
|
|
169
170
|
domains(first: 1000) {
|
|
170
171
|
${domainQueryData}
|
|
171
|
-
createdAt
|
|
172
172
|
registration {
|
|
173
173
|
registrationDate
|
|
174
174
|
expiryDate
|
|
@@ -203,7 +203,6 @@ const getNames = async (
|
|
|
203
203
|
account(id: $id) {
|
|
204
204
|
domains(orderBy: $orderBy, orderDirection: $orderDirection) {
|
|
205
205
|
${domainQueryData}
|
|
206
|
-
createdAt
|
|
207
206
|
registration {
|
|
208
207
|
registrationDate
|
|
209
208
|
expiryDate
|
|
@@ -234,7 +233,6 @@ const getNames = async (
|
|
|
234
233
|
orderDirection: $orderDirection
|
|
235
234
|
) {
|
|
236
235
|
${domainQueryData}
|
|
237
|
-
createdAt
|
|
238
236
|
}
|
|
239
237
|
}
|
|
240
238
|
}
|
|
@@ -267,7 +265,6 @@ const getNames = async (
|
|
|
267
265
|
fuses
|
|
268
266
|
domain {
|
|
269
267
|
${domainQueryData}
|
|
270
|
-
createdAt
|
|
271
268
|
}
|
|
272
269
|
}
|
|
273
270
|
}
|
|
@@ -298,7 +295,6 @@ const getNames = async (
|
|
|
298
295
|
fuses
|
|
299
296
|
domain {
|
|
300
297
|
${domainQueryData}
|
|
301
|
-
createdAt
|
|
302
298
|
}
|
|
303
299
|
}
|
|
304
300
|
}
|
|
@@ -1,8 +1,29 @@
|
|
|
1
|
+
import { toUtf8String } from 'ethers/lib/utils'
|
|
1
2
|
import { ENS } from '..'
|
|
2
3
|
import setup from '../tests/setup'
|
|
3
4
|
import { hexEncodeName } from '../utils/hexEncodedName'
|
|
4
5
|
import { namehash } from '../utils/normalise'
|
|
5
6
|
|
|
7
|
+
const dummyABI = [
|
|
8
|
+
{
|
|
9
|
+
type: 'function',
|
|
10
|
+
name: 'supportsInterface',
|
|
11
|
+
constant: true,
|
|
12
|
+
stateMutability: 'view',
|
|
13
|
+
payable: false,
|
|
14
|
+
inputs: [
|
|
15
|
+
{
|
|
16
|
+
type: 'bytes4',
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
outputs: [
|
|
20
|
+
{
|
|
21
|
+
type: 'bool',
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
},
|
|
25
|
+
]
|
|
26
|
+
|
|
6
27
|
let ensInstance: ENS
|
|
7
28
|
let revert: Awaited<ReturnType<typeof setup>>['revert']
|
|
8
29
|
|
|
@@ -25,6 +46,9 @@ describe('setRecords', () => {
|
|
|
25
46
|
},
|
|
26
47
|
],
|
|
27
48
|
texts: [{ key: 'foo', value: 'bar' }],
|
|
49
|
+
abi: {
|
|
50
|
+
data: dummyABI,
|
|
51
|
+
},
|
|
28
52
|
},
|
|
29
53
|
addressOrIndex: 1,
|
|
30
54
|
})
|
|
@@ -60,5 +84,17 @@ describe('setRecords', () => {
|
|
|
60
84
|
expect(resultAddr).toBe(
|
|
61
85
|
'0x42D63ae25990889E35F215bC95884039Ba354115'.toLowerCase(),
|
|
62
86
|
)
|
|
87
|
+
|
|
88
|
+
const encodedABI = await universalResolver['resolve(bytes,bytes)'](
|
|
89
|
+
hexEncodeName('test123.eth'),
|
|
90
|
+
publicResolver.interface.encodeFunctionData('ABI', [
|
|
91
|
+
namehash('test123.eth'),
|
|
92
|
+
'0x01',
|
|
93
|
+
]),
|
|
94
|
+
)
|
|
95
|
+
const [contentType, resultABI] =
|
|
96
|
+
publicResolver.interface.decodeFunctionResult('ABI', encodedABI[0])
|
|
97
|
+
expect(contentType.toNumber()).toBe(1)
|
|
98
|
+
expect(toUtf8String(resultABI)).toBe(JSON.stringify(dummyABI))
|
|
63
99
|
})
|
|
64
100
|
})
|
|
@@ -158,6 +158,15 @@ export const generateRecordCallArray = (
|
|
|
158
158
|
if (data) calls.push(data)
|
|
159
159
|
}
|
|
160
160
|
|
|
161
|
+
if (records.abi) {
|
|
162
|
+
const data = generateSingleRecordCall(
|
|
163
|
+
namehash,
|
|
164
|
+
resolver,
|
|
165
|
+
'abi',
|
|
166
|
+
)(records.abi)
|
|
167
|
+
if (data) calls.push(data)
|
|
168
|
+
}
|
|
169
|
+
|
|
161
170
|
if (records.texts && records.texts.length > 0) {
|
|
162
171
|
records.texts
|
|
163
172
|
.map(generateSingleRecordCall(namehash, resolver, 'text'))
|