Skip to content

Commit

Permalink
feat: World Chain support
Browse files Browse the repository at this point in the history
  • Loading branch information
BrickheadJohnny committed Jul 29, 2024
1 parent 88602f7 commit 62bbfe8
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 0 deletions.
16 changes: 16 additions & 0 deletions public/networkLogos/world.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/hooks/useTokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export const TokenApiURLs: Record<Chain, string[]> = {
FILECOIN: [],
ROOTSTOCK: [],
MODE: [],
WORLD_CHAIN: [],
}

const fetchTokens = async ([_, chain]) =>
Expand Down
28 changes: 28 additions & 0 deletions src/static/customChains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -402,3 +402,31 @@ export const mint = {
},
testnet: false,
} as const satisfies Chain

export const world = {
id: 480,
name: "World Chain",
nativeCurrency: {
decimals: 18,
name: "Ether",
symbol: "ETH",
},
rpcUrls: {
default: {
http: ["https://raas-backend.alchemy.com/rpc/worldchain-mainnet/rollup"],
},
},
blockExplorers: {
default: {
name: "Blockscout",
url: "https://worldchain-mainnet-explorer.alchemy.com",
},
},
contracts: {
multicall3: {
address: "0xca11bde05977b3631167028862be2a173976ca11",
blockCreated: 306795,
},
},
testnet: false,
} as const satisfies Chain
10 changes: 10 additions & 0 deletions src/wagmiConfig/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
palm,
scrollAlpha,
taikoKatlaTestnet,
world,
x1,
} from "static/customChains"
// import type { Chain as ViemChain } from "viem"
Expand Down Expand Up @@ -698,6 +699,14 @@ const CHAIN_CONFIG: Record<Chain, GuildChain> = {
dark: "/networkLogos/mode.svg",
},
},
WORLD_CHAIN: {
...generateChainConfig(world, ETH_ICON),
iconUrl: "/networkLogos/world.svg",
blockExplorerIconUrl: {
light: "/networkLogos/world.svg",
dark: "/networkLogos/world.svg",
},
},
}

enum Chains {
Expand Down Expand Up @@ -766,6 +775,7 @@ enum Chains {
FILECOIN = filecoin.id,
ROOTSTOCK = rootstock.id,
MODE = mode.id,
WORLD_CHAIN = world.id,
}

export type Chain = keyof typeof Chains
Expand Down
3 changes: 3 additions & 0 deletions src/wagmiConfig/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
ontology,
palm,
taikoKatlaTestnet,
world,
x1,
} from "static/customChains"
import {
Expand Down Expand Up @@ -186,6 +187,7 @@ export const wagmiConfig = IS_TEST
filecoin,
rootstock,
mode,
world,
],
transports: {
[mainnet.id]: http(),
Expand Down Expand Up @@ -249,6 +251,7 @@ export const wagmiConfig = IS_TEST
[filecoin.id]: http(),
[rootstock.id]: http(),
[mode.id]: http(),
[world.id]: http(),
},
ssr: true,
connectors: [
Expand Down

0 comments on commit 62bbfe8

Please sign in to comment.