Skip to content

Commit 0aa3ee1

Browse files
authoredApr 12, 2024
feat: add ens contract to token list (#13)
1 parent c466546 commit 0aa3ee1

File tree

2 files changed

+28
-7
lines changed

2 files changed

+28
-7
lines changed
 

‎packages/token-list/src/default-token-list.json

+14
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,20 @@
7878
}
7979
}
8080
},
81+
{
82+
"chainId": 1,
83+
"address": "0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85",
84+
"name": "Ethereum Name Service",
85+
"symbol": "ENS",
86+
"logoURI": "https://assets.coingecko.com/nft_contracts/images/373/small_2x/ens-ethereum-name-service.png",
87+
"extensions": {
88+
"bridgeInfo": {
89+
"8453": {
90+
"tokenAddress": "0x3828727c3FD3D1A9F8692a457C8a80a3DBA16546"
91+
}
92+
}
93+
}
94+
},
8195
{
8296
"chainId": 1,
8397
"address": "0x60E4d786628Fea6478F785A6d7e704777c86a7c6",

‎packages/token-list/src/tests/valid-erc721s.test.ts

+14-7
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,40 @@
1-
import { expect, test } from "vitest";
2-
import { type Address, erc721Abi } from "viem";
31
import { multicall } from "@wagmi/core";
2+
import { erc721Abi, type Address } from "viem";
3+
import { expect, test } from "vitest";
44
import { optimismMintableErc721FactoryAbi } from "../config/abis/optimism-mintable-erc721-factory-abi.js";
55
import {
6-
l2ChainIds,
7-
l2ChainIdsTestnet,
86
config,
97
l1ChainIdsTestnet,
8+
l2ChainIds,
9+
l2ChainIdsTestnet,
1010
} from "../config/wagmi.js";
11-
import { testnetTokenList, defaultTokenList } from "../index.js";
11+
import { defaultTokenList, testnetTokenList } from "../index.js";
1212

1313
const OptimismMintableERC721FactoryAddress =
1414
"0x4200000000000000000000000000000000000017";
1515

1616
// Production token list
1717

1818
test("Tokens are valid ERC721s", async () => {
19+
20+
// Removes ENS addresses from the default token list,
21+
// since they don't have a name or symbol
22+
const ENSMainnetAddress = "0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85";
23+
const filteredTokens = defaultTokenList.tokens.filter(
24+
({ address }) => address !== ENSMainnetAddress,
25+
);
1926
const [names, symbols] = await Promise.all([
2027
// Fetch the name of all tokens in the default token list
2128
multicall(config, {
22-
contracts: defaultTokenList.tokens.map(({ address }) => ({
29+
contracts: filteredTokens.map(({ address }) => ({
2330
address: address as Address,
2431
abi: erc721Abi,
2532
functionName: "name",
2633
})),
2734
}),
2835
// Fetch the symbol of all tokens in the default token list
2936
multicall(config, {
30-
contracts: defaultTokenList.tokens.map(({ address }) => ({
37+
contracts: filteredTokens.map(({ address }) => ({
3138
address: address as Address,
3239
abi: erc721Abi,
3340
functionName: "symbol",

0 commit comments

Comments
 (0)