@ensdomains/ensjs 3.0.0-alpha.48 → 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.
|
@@ -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
|
}
|
|
@@ -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,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'))
|