Skip to content

Commit

Permalink
feat: add zkSync and zkSyncTestnet (#1560)
Browse files Browse the repository at this point in the history
* chore: add zksync network

* chore: add icon

* fix: replace zkSync icon

* fix: adopt zkSync naming, infer chain name from wagmi

* chore: changeset

* fix: zkSync colloquial name

* fix: zkSync icon background off-white color

* fix: remove icon

* fix: re-add icon

---------

Co-authored-by: Daniel Sinclair <[email protected]>
  • Loading branch information
dutterbutter and DanielSinclair authored Oct 15, 2023
1 parent 2abfffe commit 6cbd9a5
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/olive-rockets-breathe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rainbow-me/rainbowkit": patch
---

Added `zkSync` and `zkSyncTestnet` network support
2 changes: 2 additions & 0 deletions packages/example/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ import {
mainnet,
optimism,
polygon,
zkSync,
zora,
} from 'wagmi/chains';
import { alchemyProvider } from 'wagmi/providers/alchemy';
Expand All @@ -84,6 +85,7 @@ const { chains, publicClient, webSocketPublicClient } = configureChains(
base,
zora,
bsc,
zkSync,
...(process.env.NEXT_PUBLIC_ENABLE_TESTNETS === 'true'
? [goerli, holesky]
: []),
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 @@ -29,7 +29,9 @@ type ChainName =
| 'ropsten'
| 'sepolia'
| 'zora'
| 'zoraTestnet';
| 'zoraTestnet'
| 'zkSync'
| 'zkSyncTestnet';

type IconMetadata = {
iconUrl: () => Promise<string>;
Expand Down Expand Up @@ -91,6 +93,11 @@ const zoraIcon: IconMetadata = {
iconUrl: async () => (await import('./chainIcons/zora.svg')).default,
};

const zkSyncIcon: IconMetadata = {
iconBackground: '#f9f7ec',
iconUrl: async () => (await import('./chainIcons/zkSync.svg')).default,
};

const chainMetadataByName: Record<ChainName, ChainMetadata | null> = {
arbitrum: { chainId: 42_161, name: 'Arbitrum', ...arbitrumIcon },
arbitrumGoerli: { chainId: 421_613, ...arbitrumIcon },
Expand Down Expand Up @@ -118,6 +125,8 @@ const chainMetadataByName: Record<ChainName, ChainMetadata | null> = {
sepolia: { chainId: 11_155_111, ...ethereumIcon },
zora: { chainId: 7777777, name: 'Zora', ...zoraIcon },
zoraTestnet: { chainId: 999, ...zoraIcon },
zkSync: { chainId: 324, name: 'zkSync', ...zkSyncIcon },
zkSyncTestnet: { chainId: 280, ...zkSyncIcon },
};

const chainMetadataById = Object.fromEntries(
Expand Down

2 comments on commit 6cbd9a5

@vercel
Copy link

@vercel vercel bot commented on 6cbd9a5 Oct 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 6cbd9a5 Oct 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.