Skip to content

Commit

Permalink
feat: blast chain metadata (#1836)
Browse files Browse the repository at this point in the history
* chore: upgrade viem

* chore: replace rinkeby with sepolia in nft mint example

* chore: example chains consistency

* chore: update site chain list

* chore: update example dapp chain list

* chore: add blast icon/metadata

* Revert "chore: upgrade viem"

This reverts commit 99dc798.

* chore: cleanup bsc usage in examples

* chore: deprecate goerli in example dapp

* chore: cleanup chain consistency

* chore: changeset
  • Loading branch information
DanielSinclair committed Mar 20, 2024
1 parent 985b80b commit b25db9a
Show file tree
Hide file tree
Showing 19 changed files with 60 additions and 61 deletions.
5 changes: 5 additions & 0 deletions .changeset/loud-items-guess.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rainbow-me/rainbowkit": patch
---

Added `blast` and `blastSepolia` network support
2 changes: 0 additions & 2 deletions examples/with-create-react-app/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
optimism,
polygon,
sepolia,
zora,
} from 'wagmi/chains';

import App from './App';
Expand All @@ -28,7 +27,6 @@ const config = getDefaultConfig({
optimism,
arbitrum,
base,
zora,
...(process.env.REACT_APP_ENABLE_TESTNETS === 'true' ? [sepolia] : []),
],
});
Expand Down
2 changes: 0 additions & 2 deletions examples/with-next-app-i18n/app/[locale]/providers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import {
optimism,
polygon,
sepolia,
zora,
} from 'wagmi/chains';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';

Expand All @@ -35,7 +34,6 @@ const config = getDefaultConfig({
optimism,
arbitrum,
base,
zora,
...(process.env.NEXT_PUBLIC_ENABLE_TESTNETS === 'true' ? [sepolia] : []),
],
wallets: [
Expand Down
2 changes: 0 additions & 2 deletions examples/with-next-app/app/providers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import {
optimism,
polygon,
sepolia,
zora,
} from 'wagmi/chains';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { WagmiProvider } from 'wagmi';
Expand All @@ -41,7 +40,6 @@ const config = getDefaultConfig({
optimism,
arbitrum,
base,
zora,
...(process.env.NEXT_PUBLIC_ENABLE_TESTNETS === 'true' ? [sepolia] : []),
],
ssr: true,
Expand Down
2 changes: 0 additions & 2 deletions examples/with-next-custom-button/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import {
optimism,
polygon,
sepolia,
zora,
} from 'wagmi/chains';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';

Expand All @@ -42,7 +41,6 @@ const config = getDefaultConfig({
optimism,
arbitrum,
base,
zora,
...(process.env.NEXT_PUBLIC_ENABLE_TESTNETS === 'true' ? [sepolia] : []),
],
ssr: true,
Expand Down
32 changes: 3 additions & 29 deletions examples/with-next-mint-nft/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,13 @@ import type { AppProps } from 'next/app';
import {
RainbowKitProvider,
getDefaultWallets,
getDefaultConfig,
Chain,
getDefaultConfig
} from '@rainbow-me/rainbowkit';
import { argentWallet, trustWallet } from '@rainbow-me/rainbowkit/wallets';
import { WagmiProvider } from 'wagmi';
import { sepolia } from 'wagmi/chains';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';

const rinkeby: Chain = {
id: 4,
name: 'Rinkeby',
nativeCurrency: { name: 'Rinkeby Ether', symbol: 'ETH', decimals: 18 },
rpcUrls: {
alchemy: { http: ['https://eth-rinkeby.alchemyapi.io/v2'] },
default: { http: ['https://rpc.ankr.com/eth_rinkeby'] },
infura: { http: ['https://rinkeby.infura.io/v3'] },
public: { http: ['https://rpc.ankr.com/eth_rinkeby'] },
},
blockExplorers: {
etherscan: { name: 'Etherscan', url: 'https://rinkeby.etherscan.io' },
default: { name: 'Etherscan', url: 'https://rinkeby.etherscan.io' },
},
contracts: {
ensRegistry: {
address: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e',
},
multicall3: {
address: '0xca11bde05977b3631167028862be2a173976ca11',
blockCreated: 10299530,
},
},
testnet: true,
};

const { wallets } = getDefaultWallets();

const config = getDefaultConfig({
Expand All @@ -50,7 +24,7 @@ const config = getDefaultConfig({
wallets: [argentWallet, trustWallet],
},
],
chains: [rinkeby],
chains: [sepolia],
ssr: true,
});

Expand Down
2 changes: 0 additions & 2 deletions examples/with-next-siwe-iron-session/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import {
optimism,
polygon,
sepolia,
zora,
} from 'wagmi/chains';
import { SiweMessage } from 'siwe';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
Expand All @@ -49,7 +48,6 @@ const config = getDefaultConfig({
optimism,
arbitrum,
base,
zora,
...(process.env.NEXT_PUBLIC_ENABLE_TESTNETS === 'true' ? [sepolia] : []),
],
ssr: true,
Expand Down
2 changes: 0 additions & 2 deletions examples/with-next-siwe-next-auth/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import {
optimism,
polygon,
sepolia,
zora,
} from 'wagmi/chains';

import { SessionProvider } from 'next-auth/react';
Expand Down Expand Up @@ -49,7 +48,6 @@ const config = getDefaultConfig({
optimism,
arbitrum,
base,
zora,
...(process.env.NEXT_PUBLIC_ENABLE_TESTNETS === 'true' ? [sepolia] : []),
],
ssr: true,
Expand Down
2 changes: 0 additions & 2 deletions examples/with-next/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import {
optimism,
polygon,
sepolia,
zora,
} from 'wagmi/chains';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';

Expand All @@ -44,7 +43,6 @@ const config = getDefaultConfig({
optimism,
arbitrum,
base,
zora,
...(process.env.NEXT_PUBLIC_ENABLE_TESTNETS === 'true' ? [sepolia] : []),
],
ssr: true,
Expand Down
2 changes: 0 additions & 2 deletions examples/with-remix/app/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import {
optimism,
polygon,
sepolia,
zora,
} from 'wagmi/chains';

import globalStylesUrl from './styles/global.css';
Expand Down Expand Up @@ -83,7 +82,6 @@ export default function App() {
optimism,
arbitrum,
base,
zora,
...testChains,
];

Expand Down
4 changes: 2 additions & 2 deletions examples/with-vite/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import App from './App';

import { getDefaultConfig, RainbowKitProvider } from '@rainbow-me/rainbowkit';
import { WagmiProvider } from 'wagmi';
import { arbitrum, base, mainnet, optimism, polygon, zora } from 'wagmi/chains';
import { arbitrum, base, mainnet, optimism, polygon } from 'wagmi/chains';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';

const config = getDefaultConfig({
appName: 'RainbowKit demo',
projectId: 'YOUR_PROJECT_ID',
chains: [mainnet, polygon, optimism, arbitrum, base, zora],
chains: [mainnet, polygon, optimism, arbitrum, base],
});

const queryClient = new QueryClient();
Expand Down
2 changes: 0 additions & 2 deletions packages/create-rainbowkit/generated-test-app/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
optimism,
polygon,
sepolia,
zora,
} from 'wagmi/chains';
import { getDefaultConfig, RainbowKitProvider } from '@rainbow-me/rainbowkit';

Expand All @@ -24,7 +23,6 @@ const config = getDefaultConfig({
optimism,
arbitrum,
base,
zora,
...(process.env.NEXT_PUBLIC_ENABLE_TESTNETS === 'true' ? [sepolia] : []),
],
ssr: true,
Expand Down
2 changes: 0 additions & 2 deletions packages/create-rainbowkit/templates/next-app/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
optimism,
polygon,
sepolia,
zora,
} from 'wagmi/chains';
import { getDefaultConfig, RainbowKitProvider } from '@rainbow-me/rainbowkit';

Expand All @@ -24,7 +23,6 @@ const config = getDefaultConfig({
optimism,
arbitrum,
base,
zora,
...(process.env.NEXT_PUBLIC_ENABLE_TESTNETS === 'true' ? [sepolia] : []),
],
ssr: true,
Expand Down
12 changes: 8 additions & 4 deletions packages/example/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,12 @@ import { WagmiProvider, useDisconnect } from 'wagmi';
import {
arbitrum,
arbitrumSepolia,
avalancheFuji,
base,
baseSepolia,
blast,
blastSepolia,
bsc,
goerli,
holesky,
mainnet,
optimism,
Expand Down Expand Up @@ -124,21 +126,23 @@ const config = getDefaultConfig({
optimism,
arbitrum,
base,
zora,
bsc,
zkSync,
avalanche,
zora,
blast,
zkSync,
ronin,
...(process.env.NEXT_PUBLIC_ENABLE_TESTNETS === 'true'
? [
goerli,
sepolia,
holesky,
polygonMumbai,
optimismSepolia,
arbitrumSepolia,
baseSepolia,
zoraSepolia,
blastSepolia,
avalancheFuji,
]
: []),
],
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ type ChainName =
| 'base'
| 'baseGoerli'
| 'baseSepolia'
| 'blast'
| 'blastSepolia'
| 'bsc'
| 'bscTestnet'
| 'goerli'
Expand Down Expand Up @@ -65,6 +67,11 @@ const baseIcon: IconMetadata = {
iconUrl: async () => (await import('./chainIcons/base.svg')).default,
};

const blastIcon: IconMetadata = {
iconBackground: '#000000',
iconUrl: async () => (await import('./chainIcons/blast.svg')).default,
};

const bscIcon: IconMetadata = {
iconBackground: '#ebac0e',
iconUrl: async () => (await import('./chainIcons/bsc.svg')).default,
Expand Down Expand Up @@ -124,6 +131,8 @@ const chainMetadataByName: Record<ChainName, ChainMetadata | null> = {
base: { chainId: 8453, name: 'Base', ...baseIcon },
baseGoerli: { chainId: 84531, ...baseIcon },
baseSepolia: { chainId: 84532, ...baseIcon },
blast: { chainId: 81457, name: 'Blast', ...blastIcon },
blastSepolia: { chainId: 168_587_773, ...blastIcon },
bsc: { chainId: 56, name: 'BSC', ...bscIcon },
bscTestnet: { chainId: 97, ...bscIcon },
cronos: { chainId: 25, ...cronosIcon },
Expand Down
17 changes: 15 additions & 2 deletions packages/rainbowkit/test/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,19 @@ import { render } from '@testing-library/react';
import React, { ReactElement } from 'react';
import { http, type Chain } from 'viem';
import { WagmiProvider, createConfig } from 'wagmi';
import { arbitrum, base, mainnet, optimism, polygon, zora } from 'wagmi/chains';
import {
arbitrum,
avalanche,
base,
bsc,
mainnet,
optimism,
polygon,
zora,
} from 'wagmi/chains';
import { MockParameters, mock } from 'wagmi/connectors';
import { RainbowKitProvider } from '../src/components/RainbowKitProvider/RainbowKitProvider';
import type { RainbowKitProviderProps } from '../src/components/RainbowKitProvider/RainbowKitProvider';
import { RainbowKitProvider } from '../src/components/RainbowKitProvider/RainbowKitProvider';
import { connectorsForWallets } from '../src/wallets/connectorsForWallets';
import { getDefaultWallets } from '../src/wallets/getDefaultWallets';

Expand All @@ -16,6 +25,8 @@ const defaultChains: readonly [Chain, ...Chain[]] = [
optimism,
arbitrum,
base,
bsc,
avalanche,
zora,
];

Expand Down Expand Up @@ -59,6 +70,8 @@ export function renderWithProviders(
[optimism.id]: http(),
[arbitrum.id]: http(),
[base.id]: http(),
[bsc.id]: http(),
[avalanche.id]: http(),
[zora.id]: http(),
},
});
Expand Down
18 changes: 16 additions & 2 deletions site/components/Provider/Provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ import React from 'react';
import { http, WagmiProvider } from 'wagmi';
import {
arbitrum,
avalanche,
base,
blast,
bsc,
mainnet,
optimism,
Expand All @@ -28,16 +30,28 @@ const transports = {
[optimism.id]: http(),
[arbitrum.id]: http(),
[base.id]: http(),
[zora.id]: http(),
[bsc.id]: http(),
[avalanche.id]: http(),
[zora.id]: http(),
[blast.id]: http(),
};

const { wallets } = getDefaultWallets();

const config = getDefaultConfig({
appName: 'rainbowkit.com',
projectId,
chains: [mainnet, polygon, optimism, arbitrum, base, zora, bsc],
chains: [
mainnet,
polygon,
optimism,
arbitrum,
base,
bsc,
avalanche,
zora,
blast,
],
transports,
wallets: [
...wallets,
Expand Down
Loading

0 comments on commit b25db9a

Please sign in to comment.