diff --git a/packages/ensjs/src/functions/getSpecificRecord.test.ts b/packages/ensjs/src/functions/getSpecificRecord.test.ts index 7d7a5efa..e0ba0fe9 100644 --- a/packages/ensjs/src/functions/getSpecificRecord.test.ts +++ b/packages/ensjs/src/functions/getSpecificRecord.test.ts @@ -238,4 +238,21 @@ describe('getSpecificRecord', () => { expect(result).toBeUndefined() }) }) + + describe('_getABI', () => { + it('should return if resolver address is included', async () => { + const profile = await ensInstance.getProfile('with-type-1-abi.eth') + expect(profile?.resolverAddress).toBeTruthy() + const result = await ensInstance._getABI( + 'with-type-1-abi.eth', + profile?.resolverAddress, + ) + expect(result).toBeTruthy() + if (result) { + expect(result.contentType).toBe(1) + expect(result.decoded).toBe(true) + expect(result.abi).toMatchObject(dummyABI) + } + }) + }) }) diff --git a/packages/ensjs/src/functions/getSpecificRecord.ts b/packages/ensjs/src/functions/getSpecificRecord.ts index c4a5db4e..ac13e0fb 100644 --- a/packages/ensjs/src/functions/getSpecificRecord.ts +++ b/packages/ensjs/src/functions/getSpecificRecord.ts @@ -245,10 +245,14 @@ export const getAddr = { const supportedContentTypes = '0xf' export const _getABI = { - raw: async ({ contracts }: ENSArgs<'contracts'>, name: string) => { + raw: async ( + { contracts }: ENSArgs<'contracts'>, + name: string, + resolverAddress?: string, + ) => { const publicResolver = await contracts?.getPublicResolver()! return { - to: '0x0000000000000000000000000000000000000000', + to: resolverAddress || '0x0000000000000000000000000000000000000000', data: publicResolver.interface.encodeFunctionData('ABI', [ namehash(name), supportedContentTypes,