Skip to content

Commit

Permalink
Merge branch 'main' into FET-1573_pagination_issue
Browse files Browse the repository at this point in the history
  • Loading branch information
storywithoutend committed Oct 14, 2024
2 parents e66d8d8 + 3629434 commit 17783fb
Show file tree
Hide file tree
Showing 46 changed files with 12,676 additions and 5,835 deletions.
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
10 changes: 10 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": ["@changesets/changelog-github", { "repo": "ensdomains/ensjs-v3" }],
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch"
}
80 changes: 43 additions & 37 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,55 +1,61 @@
name: Publish
name: Release

on:
release:
types: [published]
push:
branches:
- main

defaults:
run:
shell: bash

env:
FORCE_COLOR: true

jobs:
publish:
name: Publish
changelog:
name: PR or Release
if: ${{ github.repository_owner == 'ensdomains' }}
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18]
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.release.target_commitish }}

- uses: pnpm/action-setup@v4
with:
version: 9.4.0
- uses: actions/checkout@v4
- name: Enable corepack
run: corepack enable pnpm

- name: Install Node.js
uses: actions/setup-node@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
node-version: 18
registry-url: 'https://registry.npmjs.org'

- run: pnpm install --frozen-lockfile

- name: Set up git
run: |
git config --local user.email '41898282+github-actions[bot]@users.noreply.github.com'
git config --local user.name 'github-actions[bot]'
- name: Install dependencies
run: pnpm install

- name: Bump version to ${{ github.event.release.tag_name }}
run: |
pnpm -F @ensdomains/ensjs ver ${{ github.event.release.tag_name }}
git add .
git commit -m "${{ github.event.release.tag_name }}"
- name: Build Packages
run: pnpm -r build

- name: Publish
- name: Fix npmrc
run: npm config set "//registry.npmjs.org/:_authToken" "$NPM_TOKEN"
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_CONFIG_PROVENANCE: true
run: |
pnpm config set //registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN}
pnpm -F @ensdomains/ensjs publish
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Push changes
run: git push
- name: Create Release Pull Request or Publish
id: changesets
uses: changesets/action@v1
with:
# Note: pnpm install after versioning is necessary to refresh lockfile
version: pnpm chgset:version
publish: pnpm release
commit: "chore: release"
title: "[ci] release"
env:
github-token: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Needs access to publish to npm
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_CONFIG_PROVENANCE: true
4 changes: 3 additions & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
strict-peer-dependencies=false
strict-peer-dependencies=false
link-workspace-packages=deep
provenance=true
8 changes: 3 additions & 5 deletions docs/index/function.createEnsPublicClient.md
Original file line number Diff line number Diff line change
Expand Up @@ -473,11 +473,9 @@ const client = createPublicClient({
}).extend(ensPublicActions)
const result = await client.getRecords({
name: 'ens.eth',
records: {
texts: ['com.twitter', 'com.github'],
coins: ['ETH'],
contentHash: true,
},
texts: ['com.twitter', 'com.github'],
coins: ['ETH'],
contentHash: true,
})
// { texts: [{ key: 'com.twitter', value: 'ensdomains' }, { key: 'com.github', value: 'ensdomains' }], coins: [{ id: 60, name: 'ETH', value: '0xFe89cc7aBB2C4183683ab71653C4cdc9B02D44b7' }], contentHash: { protocolType: 'ipns', decoded: 'k51qzi5uqu5djdczd6zw0grmo23j2vkj9uzvujencg15s5rlkq0ss4ivll8wqw' } }
```
Expand Down
8 changes: 3 additions & 5 deletions docs/public/function.getRecords.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,9 @@ const client = createPublicClient({
})
const result = await getRecords(client, {
name: 'ens.eth',
records: {
texts: ['com.twitter', 'com.github'],
coins: ['ETH'],
contentHash: true,
},
texts: ['com.twitter', 'com.github'],
coins: ['ETH'],
contentHash: true,
})
// { texts: [{ key: 'com.twitter', value: 'ensdomains' }, { key: 'com.github', value: 'ensdomains' }], coins: [{ id: 60, name: 'ETH', value: '0xFe89cc7aBB2C4183683ab71653C4cdc9B02D44b7' }], contentHash: { protocolType: 'ipns', decoded: 'k51qzi5uqu5djdczd6zw0grmo23j2vkj9uzvujencg15s5rlkq0ss4ivll8wqw' } }
```
Expand Down
12 changes: 3 additions & 9 deletions examples/basic-tsnode-esm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,8 @@
},
"dependencies": {
"@ensdomains/ensjs": "workspace:*",
"ts-node": "^10.7.0",
"typescript": "^5.0.4",
"viem": "^1.2.9",
"node-fetch": "2.6.7"
},
"pnpm": {
"overrides": {
"node-fetch": "2.6.7"
}
"ts-node": "^10.9.2",
"typescript": "^5.6.2",
"viem": "^2.21.9"
}
}
8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,15 @@
],
"scripts": {
"publish:local:ens-test-env": "yalc publish packages/ens-test-env --push --up",
"publish:local:ensjs": "yalc publish packages/ensjs --push --up"
"publish:local:ensjs": "yalc publish packages/ensjs --push --up",
"chgset:version": "changeset version && pnpm install",
"chgset:run": "changeset",
"release": "pnpm publish -r --access public && changeset tag",
"chgset": "pnpm chgset:run && pnpm chgset:version"
},
"devDependencies": {
"@changesets/changelog-github": "^0.5.0",
"@changesets/cli": "^2.27.8",
"@typescript-eslint/eslint-plugin": "^6.7.5",
"@typescript-eslint/parser": "^6.7.5",
"eslint": "^8.51.0",
Expand Down
3 changes: 0 additions & 3 deletions packages/ens-test-env/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@ module.exports = {
mnemonic: 'test test test test test test test test test test test junk',
unlockedAccounts: ['0x0000000000000000000000000000000000000000'],
},
database: {
dbPath: './ganache',
},
},
graph: {
bypassLocal: false,
Expand Down
1 change: 0 additions & 1 deletion packages/ens-test-env/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
"concurrently": "^7.1.0",
"docker-compose": "^0.24.7",
"dotenv": "^16.0.1",
"ganache": "^7.0.4",
"js-yaml": "^4.1.0",
"lz4": "^0.6.5",
"progress-stream": "^2.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/ens-test-env/src/config.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ConcurrentlyCommandInput } from 'concurrently'
import type { ConcurrentlyCommandInput } from 'concurrently'

/**
* ens-test-env configuration object
Expand Down
4 changes: 1 addition & 3 deletions packages/ens-test-env/src/fetch-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ import lz4 from 'lz4'
import progress from 'progress-stream'
import { pipeline } from 'stream'
import tar from 'tar-fs'
import { promisify } from 'util'

const __dirname = process.env.INIT_CWD
import { promisify } from 'node:util'

const createProgressBar = (name, hasSpeed) =>
new cliProgress.SingleBar({
Expand Down
7 changes: 3 additions & 4 deletions packages/ens-test-env/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,16 @@
/* eslint-disable */

import { Command, Option } from 'commander'
import path from 'path'
import { emitKeypressEvents } from 'readline'
import { URL as URLClass } from 'url'
import path from 'node:path'
import { emitKeypressEvents } from 'node:readline'
import { main as fetchData } from './fetch-data.js'
import { main as manager } from './manager.js'
import { main as subgraph } from './subgraph.js'

let config
const program = new Command()

const __dirname = new URLClass('.', import.meta.url).pathname
const __dirname = new URL('.', import.meta.url).pathname
const cwd = process.cwd()

program
Expand Down
4 changes: 2 additions & 2 deletions packages/ens-test-env/src/manager.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* eslint-disable */
import { spawn } from 'child_process'
import { spawn } from 'node:child_process'
import concurrently from 'concurrently'
import composev1 from 'docker-compose'
import composev2 from 'docker-compose/dist/v2.js'
import { Transform } from 'stream'
import { Transform } from 'node:stream'
import waitOn from 'wait-on'
import { main as fetchData } from './fetch-data.js'

Expand Down
2 changes: 1 addition & 1 deletion packages/ens-test-env/src/subgraph.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { config } from 'dotenv'
import fs from 'node:fs'
import yaml from 'js-yaml'
import path from 'path'
import path from 'node:path'

export const main = (options) => {
const directory = path.resolve(process.cwd(), options.directory)
Expand Down
7 changes: 7 additions & 0 deletions packages/ensjs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# @ensdomains/ensjs

## 4.0.1

### Patch Changes

- [#199](https://github.com/ensdomains/ensjs/pull/199) [`1c2aa83`](https://github.com/ensdomains/ensjs/commit/1c2aa83681a1be98f920e6eac57391c138712df7) Thanks [@lucemans](https://github.com/lucemans)! - Introduce @ensdomains/ensjs-react
8 changes: 8 additions & 0 deletions packages/ensjs/deploy/00_register_legacy.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,14 @@ const names = [
],
},
},
{
label: 'with-empty-addr',
namedOwner: 'owner2',
namedAddr: 'owner2',
records: {
addr: [{ key: 61, value: '0x' }],
},
},
{
label: 'with-contenthash',
namedOwner: 'owner',
Expand Down
4 changes: 2 additions & 2 deletions packages/ensjs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ensdomains/ensjs",
"version": "4.0.0",
"version": "4.0.1",
"description": "ENS javascript library for contract interaction",
"type": "module",
"main": "./dist/cjs/index.js",
Expand Down Expand Up @@ -74,7 +74,7 @@
"!src/**/*.test.ts",
"!src/test"
],
"repository": "[email protected]:ensdomains/ensjs-v3.git",
"repository": "[email protected]:ensdomains/ensjs.git",
"author": "TateB <[email protected]>",
"license": "MIT",
"scripts": {
Expand Down
8 changes: 3 additions & 5 deletions packages/ensjs/src/clients/decorators/public.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,11 +272,9 @@ export type EnsPublicActions = {
* }).extend(ensPublicActions)
* const result = await client.getRecords({
* name: 'ens.eth',
* records: {
* texts: ['com.twitter', 'com.github'],
* coins: ['ETH'],
* contentHash: true,
* },
* texts: ['com.twitter', 'com.github'],
* coins: ['ETH'],
* contentHash: true,
* })
* // { texts: [{ key: 'com.twitter', value: 'ensdomains' }, { key: 'com.github', value: 'ensdomains' }], coins: [{ id: 60, name: 'ETH', value: '0xFe89cc7aBB2C4183683ab71653C4cdc9B02D44b7' }], contentHash: { protocolType: 'ipns', decoded: 'k51qzi5uqu5djdczd6zw0grmo23j2vkj9uzvujencg15s5rlkq0ss4ivll8wqw' } }
*/
Expand Down
8 changes: 3 additions & 5 deletions packages/ensjs/src/functions/public/getRecords.ts
Original file line number Diff line number Diff line change
Expand Up @@ -469,11 +469,9 @@ type BatchableFunctionObject = {
* })
* const result = await getRecords(client, {
* name: 'ens.eth',
* records: {
* texts: ['com.twitter', 'com.github'],
* coins: ['ETH'],
* contentHash: true,
* },
* texts: ['com.twitter', 'com.github'],
* coins: ['ETH'],
* contentHash: true,
* })
* // { texts: [{ key: 'com.twitter', value: 'ensdomains' }, { key: 'com.github', value: 'ensdomains' }], coins: [{ id: 60, name: 'ETH', value: '0xFe89cc7aBB2C4183683ab71653C4cdc9B02D44b7' }], contentHash: { protocolType: 'ipns', decoded: 'k51qzi5uqu5djdczd6zw0grmo23j2vkj9uzvujencg15s5rlkq0ss4ivll8wqw' } }
*/
Expand Down
15 changes: 15 additions & 0 deletions packages/ensjs/src/functions/subgraph/getNameHistory.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,18 @@ it('returns the history of a subname', async () => {
expect(result.registrationEvents).toBeNull()
expect(result.resolverEvents).not.toBeNull()
})

it('returns the history of a name with a null addr record', async () => {
const result = await getNameHistory(publicClient, {
name: 'with-empty-addr.eth',
})
if (!result) throw new Error('No result')
expect(result.domainEvents.length).toBeGreaterThan(0)
expect(result.registrationEvents!.length).toBeGreaterThan(0)
expect(result.resolverEvents).not.toBeNull()
expect(
result.resolverEvents!.some(
(event) => event.type === 'MulticoinAddrChanged' && event.addr === null,
),
).toBe(true)
})
4 changes: 2 additions & 2 deletions packages/ensjs/src/functions/subgraph/getNameHistory.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getCoderByCoinType } from '@ensdomains/address-encoder'
import { gql } from 'graphql-request'
import { hexToBytes } from 'viem'
import { hexToBytes, trim } from 'viem'
import type { ClientWithEns } from '../../contracts/consts.js'
import { decodeContentHash } from '../../utils/contentHash.js'
import { namehash } from '../../utils/normalise.js'
Expand Down Expand Up @@ -286,7 +286,7 @@ const getNameHistory = async (
addr: multiaddr,
}
}
if (BigInt(multiaddr) === 0n) {
if (multiaddr === '0x' || trim(multiaddr) === '0x00') {
return {
...event_,
coinName: format.name,
Expand Down
Loading

0 comments on commit 17783fb

Please sign in to comment.