Skip to content

Commit

Permalink
Merge branch 'release/1.4.0-alpha.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
nekofar committed Nov 28, 2024
2 parents f3fa118 + 92c6ee4 commit 073e157
Show file tree
Hide file tree
Showing 7 changed files with 156 additions and 107 deletions.
83 changes: 44 additions & 39 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,87 +1,87 @@
version: 2
updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: 'github-actions'
- package-ecosystem: "github-actions"
# Files stored in repository root
directory: '/'
directory: "/"
# Check for updates every weekday
schedule:
interval: 'daily'
interval: "daily"
# Add assignees
assignees:
- 'nekofar'
- "nekofar"
# Include a list of updated dependencies
commit-message:
prefix: 'ci'
include: 'scope'
prefix: "ci"
include: "scope"
# Specify labels for pull requests
labels:
- 'dependencies'
- "dependencies"
# Allow up to 20 open pull requests for dependencies
open-pull-requests-limit: 20
# Add reviewers
reviewers:
- 'nekofar'
- "nekofar"
# Raise pull requests against the `develop` branch
target-branch: 'develop'
target-branch: "develop"

# Maintain dependencies for PNPM
- package-ecosystem: 'npm'
- package-ecosystem: "npm"
# Files stored in repository root
directory: '/'
directory: "/"
# Check for updates every weekday
schedule:
interval: 'daily'
interval: "daily"
# Add assignees
assignees:
- 'nekofar'
# Include a list of updated dependencies
commit-message:
prefix: 'chore'
include: 'scope'
- "nekofar"
# Add reviewers
reviewers:
- "nekofar"
# Specify labels for pull requests
labels:
- 'dependencies'
- "dependencies"
# Include a list of updated dependencies
commit-message:
prefix: "chore"
include: "scope"
# Allow up to 10 open pull requests for dependencies
open-pull-requests-limit: 20
# Add reviewers
reviewers:
- 'nekofar'
# Raise pull requests against the `develop` branch
target-branch: 'develop'
target-branch: "develop"
# Create a group of dependencies to be updated together in one pull request
groups:
babel:
patterns:
- '@babel/*'
- 'babel-core'
- 'babel-loader'
- "@babel/*"
- "babel-core"
- "babel-loader"
eslint:
patterns:
- 'eslint'
- '@typescript-eslint/eslint-plugin'
- '@typescript-eslint/parser'
- "eslint"
- "@typescript-eslint/eslint-plugin"
- "@typescript-eslint/parser"
lingui:
patterns:
- '@lingui/*'
- "@lingui/*"
next:
patterns:
- 'next'
- 'eslint-config-next'
- '@next/*'
- "next"
- "eslint-config-next"
- "@next/*"
serwist:
patterns:
- '@serwist/*'
- "@serwist/*"
next-on-page:
patterns:
- '@cloudflare/next-on-pages'
- 'eslint-plugin-next-on-pages'
- "@cloudflare/next-on-pages"
- "eslint-plugin-next-on-pages"
react:
patterns:
- 'react'
- 'react-dom'
- '@types/react'
- '@types/react-dom'
- "react"
- "react-dom"
- "@types/react"
- "@types/react-dom"
# List of packages to ignore for specific update types
ignore:
- dependency-name: "eslint"
Expand All @@ -90,6 +90,11 @@ updates:
- dependency-name: "next"
update-types:
- "version-update:semver-major"
- dependency-name: "vercel"
update-types:
- "version-update:semver-patch"
- "version-update:semver-minor"
- "version-update:semver-major"
- dependency-name: "@next/*"
update-types:
- "version-update:semver-major"
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

All notable changes to this project will be documented in this file.

## [1.4.0-alpha.5] - 2024-11-28

### 🚀 Features

- *(ethereum-react)* Add `useNNSName` hook
- *(hooks)* Add NNS name lookup in `useAccountDisplayName`

### ◀️ Revert

- *(deps-dev)* Bump vercel from 39.1.1 to 39.1.2 (#845)

## [1.4.0-alpha.4] - 2024-11-27

### ◀️ Revert
Expand Down
4 changes: 2 additions & 2 deletions apps/nouns-camp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"eslint-config-prettier": "9.1.0",
"eslint-plugin-next-on-pages": "1.13.5",
"vercel": "39.1.1",
"wrangler": "3.90.0"
"wrangler": "3.91.0"
},
"dependencies": {
"@cloudflare/pages-plugin-vercel-og": "0.1.2",
Expand All @@ -40,7 +40,7 @@
"@serwist/sw": "9.0.10",
"@shades/common": "workspace:0.0.0",
"@shades/ui-web": "workspace:0.0.0",
"@tanstack/react-query": "5.61.3",
"@tanstack/react-query": "5.61.5",
"@vercel/analytics": "1.4.1",
"@vercel/edge-config": "1.4.0",
"@vercel/kv": "3.0.0",
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.4.0-alpha.4",
"version": "1.4.0-alpha.5",
"name": "@lilnouns/lilnouns-camp",
"scripts": {
"preinstall": "npx -y only-allow pnpm",
Expand Down Expand Up @@ -32,7 +32,7 @@
},
"devDependencies": {
"prettier": "3.4.1",
"turbo": "2.3.2",
"turbo": "2.3.3",
"typescript": "5.7.2"
},
"engines": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { isAddress as isEthereumAccountAddress } from "viem";
import { useEnsName } from "wagmi";
import { truncateAddress } from "../../utils/ethereum.js";
import { useNNSName } from "./nns-name";

const useAccountDisplayName = (
accountAddress,
Expand All @@ -9,6 +10,8 @@ const useAccountDisplayName = (
const isAddress =
accountAddress != null && isEthereumAccountAddress(accountAddress);

const { data: nnsName } = useNNSName(accountAddress);

const { data: ensName } = useEnsName({
address: accountAddress,
chainId,
Expand All @@ -22,7 +25,7 @@ const useAccountDisplayName = (
if (accountAddress != null && !isAddress)
console.warn(`Invalid address "${accountAddress}"`);

return ensName ?? truncatedAddress;
return nnsName ?? ensName ?? truncatedAddress;
};

export default useAccountDisplayName;
30 changes: 30 additions & 0 deletions packages/common/src/ethereum-react/hooks/nns-name.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { useQuery } from "@tanstack/react-query";

async function fetchNNSName(address) {
const res = await fetch(`https://api.nns.xyz/resolve`, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({ address }),
});

if (!res.ok) {
const errorText = await res.text();
throw new Error(`Failed to resolve NNS name: ${res.status} - ${errorText}`);
}

const body = await res.json();
return body.name || null;
}

export function useNNSName(address) {
return useQuery({
queryKey: ["nns-name", address],
queryFn: () => fetchNNSName(address),
enabled: Boolean(address),
onError: (error) => {
console.error("Failed to fetch NNS name:", error);
},
});
}
Loading

0 comments on commit 073e157

Please sign in to comment.