diff --git a/packages/ens-test-env/src/fetch-data.js b/packages/ens-test-env/src/fetch-data.js index 137f797d..87bd6d32 100644 --- a/packages/ens-test-env/src/fetch-data.js +++ b/packages/ens-test-env/src/fetch-data.js @@ -113,6 +113,11 @@ async function decompressToOutput() { extractProgressBar.stop() reject(err.message) }) + + const readMePath = `${dataPath}/ipfs/blocks/_README` + if (fs.existsSync(readMePath)) { + await fs.rm(readMePath, {force: true}) + } }) } diff --git a/packages/ensjs/package.json b/packages/ensjs/package.json index aa7b3b2f..2013c7a5 100644 --- a/packages/ensjs/package.json +++ b/packages/ensjs/package.json @@ -1,6 +1,6 @@ { "name": "@ensdomains/ensjs", - "version": "3.0.0-beta.10", + "version": "3.0.0-beta.11", "description": "ENS javascript library for contract interaction", "type": "module", "main": "./dist/cjs/index.js", diff --git a/packages/ensjs/src/errors/version.ts b/packages/ensjs/src/errors/version.ts index 745a16d1..41f41a0a 100644 --- a/packages/ensjs/src/errors/version.ts +++ b/packages/ensjs/src/errors/version.ts @@ -1 +1 @@ -export const version = 'v3.0.0-beta.10' +export const version = 'v3.0.0-beta.11' diff --git a/packages/ensjs/src/utils/generateRecordCallArray.test.ts b/packages/ensjs/src/utils/generateRecordCallArray.test.ts index c96142ff..5dd3cd54 100644 --- a/packages/ensjs/src/utils/generateRecordCallArray.test.ts +++ b/packages/ensjs/src/utils/generateRecordCallArray.test.ts @@ -44,11 +44,11 @@ it('adds contentHash call when contentHash is defined', () => { ] `) }) -it('adds abi call when abi is defined', () => { +it('adds abi call when abi is null', () => { expect( generateRecordCallArray({ namehash: namehash('test.eth'), - abi: { contentType: 0, encodedData: '0x' }, + abi: null, }), ).toMatchInlineSnapshot(` [ @@ -56,6 +56,14 @@ it('adds abi call when abi is defined', () => { ] `) }) +it('does not add abi call when abi is undefined', () => { + expect( + generateRecordCallArray({ + namehash: namehash('test.eth'), + abi: undefined, + }), + ).toMatchInlineSnapshot(`[]`) +}) it('adds text calls when texts array is defined and not empty', () => { expect( generateRecordCallArray({ diff --git a/packages/ensjs/src/utils/generateRecordCallArray.ts b/packages/ensjs/src/utils/generateRecordCallArray.ts index 7a627ddd..5d68622a 100644 --- a/packages/ensjs/src/utils/generateRecordCallArray.ts +++ b/packages/ensjs/src/utils/generateRecordCallArray.ts @@ -1,5 +1,6 @@ import { type Hex } from 'viem' import type { Prettify } from '../types.js' +import type { EncodedAbi } from './encoders/encodeAbi.js' import { encodeClearRecords } from './encoders/encodeClearRecords.js' import { encodeSetAbi, @@ -25,7 +26,7 @@ export type RecordOptions = Prettify<{ /** Array of coin records */ coins?: Omit[] /** ABI value */ - abi?: Omit + abi?: EncodedAbi | null }> export const generateRecordCallArray = ({ @@ -47,8 +48,9 @@ export const generateRecordCallArray = ({ if (data) calls.push(data) } - if (abi) { - const data = encodeSetAbi({ namehash, ...abi } as EncodeSetAbiParameters) + if (abi !== undefined) { + const abi_ = abi ?? { contentType: 0, encodedData: null } + const data = encodeSetAbi({ namehash, ...abi_ } as EncodeSetAbiParameters) if (data) calls.push(data) }