@ensdomains/ensjs 3.0.0-alpha.66 → 3.0.0-alpha.67
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/getSpecificRecord.js +2 -2
- package/dist/esm/functions/getSpecificRecord.mjs +2 -2
- package/dist/types/functions/getSpecificRecord.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/package.json +1 -1
- package/src/functions/getSpecificRecord.test.ts +17 -0
- package/src/functions/getSpecificRecord.ts +6 -2
|
@@ -204,10 +204,10 @@ const getAddr = {
|
|
|
204
204
|
};
|
|
205
205
|
const supportedContentTypes = "0xf";
|
|
206
206
|
const _getABI = {
|
|
207
|
-
raw: async ({ contracts }, name) => {
|
|
207
|
+
raw: async ({ contracts }, name, resolverAddress) => {
|
|
208
208
|
const publicResolver = await (contracts == null ? void 0 : contracts.getPublicResolver());
|
|
209
209
|
return {
|
|
210
|
-
to: "0x0000000000000000000000000000000000000000",
|
|
210
|
+
to: resolverAddress || "0x0000000000000000000000000000000000000000",
|
|
211
211
|
data: publicResolver.interface.encodeFunctionData("ABI", [
|
|
212
212
|
(0, import_normalise.namehash)(name),
|
|
213
213
|
supportedContentTypes
|
|
@@ -169,10 +169,10 @@ var getAddr = {
|
|
|
169
169
|
};
|
|
170
170
|
var supportedContentTypes = "0xf";
|
|
171
171
|
var _getABI = {
|
|
172
|
-
raw: async ({ contracts }, name) => {
|
|
172
|
+
raw: async ({ contracts }, name, resolverAddress) => {
|
|
173
173
|
const publicResolver = await contracts?.getPublicResolver();
|
|
174
174
|
return {
|
|
175
|
-
to: "0x0000000000000000000000000000000000000000",
|
|
175
|
+
to: resolverAddress || "0x0000000000000000000000000000000000000000",
|
|
176
176
|
data: publicResolver.interface.encodeFunctionData("ABI", [
|
|
177
177
|
namehash(name),
|
|
178
178
|
supportedContentTypes
|
|
@@ -72,7 +72,7 @@ export declare const getAddr: {
|
|
|
72
72
|
} | undefined>;
|
|
73
73
|
};
|
|
74
74
|
export declare const _getABI: {
|
|
75
|
-
raw: ({ contracts }: ENSArgs<'contracts'>, name: string) => Promise<{
|
|
75
|
+
raw: ({ contracts }: ENSArgs<'contracts'>, name: string, resolverAddress?: string) => Promise<{
|
|
76
76
|
to: string;
|
|
77
77
|
data: string;
|
|
78
78
|
}>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -382,7 +382,7 @@ export declare class ENS {
|
|
|
382
382
|
} | undefined>;
|
|
383
383
|
}>;
|
|
384
384
|
_getABI: GeneratedRawFunction<{
|
|
385
|
-
raw: ({ contracts }: ENSArgs<"contracts">, name: string) => Promise<{
|
|
385
|
+
raw: ({ contracts }: ENSArgs<"contracts">, name: string, resolverAddress?: string | undefined) => Promise<{
|
|
386
386
|
to: string;
|
|
387
387
|
data: string;
|
|
388
388
|
}>;
|
package/package.json
CHANGED
|
@@ -238,4 +238,21 @@ describe('getSpecificRecord', () => {
|
|
|
238
238
|
expect(result).toBeUndefined()
|
|
239
239
|
})
|
|
240
240
|
})
|
|
241
|
+
|
|
242
|
+
describe('_getABI', () => {
|
|
243
|
+
it('should return if resolver address is included', async () => {
|
|
244
|
+
const profile = await ensInstance.getProfile('with-type-1-abi.eth')
|
|
245
|
+
expect(profile?.resolverAddress).toBeTruthy()
|
|
246
|
+
const result = await ensInstance._getABI(
|
|
247
|
+
'with-type-1-abi.eth',
|
|
248
|
+
profile?.resolverAddress,
|
|
249
|
+
)
|
|
250
|
+
expect(result).toBeTruthy()
|
|
251
|
+
if (result) {
|
|
252
|
+
expect(result.contentType).toBe(1)
|
|
253
|
+
expect(result.decoded).toBe(true)
|
|
254
|
+
expect(result.abi).toMatchObject(dummyABI)
|
|
255
|
+
}
|
|
256
|
+
})
|
|
257
|
+
})
|
|
241
258
|
})
|
|
@@ -245,10 +245,14 @@ export const getAddr = {
|
|
|
245
245
|
const supportedContentTypes = '0xf'
|
|
246
246
|
|
|
247
247
|
export const _getABI = {
|
|
248
|
-
raw: async (
|
|
248
|
+
raw: async (
|
|
249
|
+
{ contracts }: ENSArgs<'contracts'>,
|
|
250
|
+
name: string,
|
|
251
|
+
resolverAddress?: string,
|
|
252
|
+
) => {
|
|
249
253
|
const publicResolver = await contracts?.getPublicResolver()!
|
|
250
254
|
return {
|
|
251
|
-
to: '0x0000000000000000000000000000000000000000',
|
|
255
|
+
to: resolverAddress || '0x0000000000000000000000000000000000000000',
|
|
252
256
|
data: publicResolver.interface.encodeFunctionData('ABI', [
|
|
253
257
|
namehash(name),
|
|
254
258
|
supportedContentTypes,
|