Skip to content

Commit

Permalink
Merge branch 'feat/viem' into feat/ur-v2
Browse files Browse the repository at this point in the history
  • Loading branch information
TateB committed Dec 7, 2023
2 parents e68a5e9 + 9100d7e commit 691d00c
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 7 deletions.
5 changes: 5 additions & 0 deletions packages/ens-test-env/src/fetch-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -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})
}
})
}

Expand Down
2 changes: 1 addition & 1 deletion packages/ensjs/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/ensjs/src/errors/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const version = 'v3.0.0-beta.10'
export const version = 'v3.0.0-beta.11'
12 changes: 10 additions & 2 deletions packages/ensjs/src/utils/generateRecordCallArray.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,26 @@ 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(`
[
"0x623195b0eb4f647bea6caa36333c816d7b46fdcb05f9466ecacc140ea8c66faf15b3d9f1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000",
]
`)
})
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({
Expand Down
8 changes: 5 additions & 3 deletions packages/ensjs/src/utils/generateRecordCallArray.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -25,7 +26,7 @@ export type RecordOptions = Prettify<{
/** Array of coin records */
coins?: Omit<EncodeSetAddrParameters, 'namehash'>[]
/** ABI value */
abi?: Omit<EncodeSetAbiParameters, 'namehash'>
abi?: EncodedAbi | null
}>

export const generateRecordCallArray = ({
Expand All @@ -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)
}

Expand Down

0 comments on commit 691d00c

Please sign in to comment.