Skip to content

Commit

Permalink
feat: add rootstock chain
Browse files Browse the repository at this point in the history
  • Loading branch information
ahsan-javaiid committed Oct 8, 2024
1 parent d5af77d commit 91eef5e
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 6 deletions.
4 changes: 2 additions & 2 deletions examples/nextjs-app/config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { getDefaultConfig } from 'connectkit';
import { createConfig } from 'wagmi';
import { mainnet, polygon, optimism, arbitrum } from 'wagmi/chains';
import { mainnet, polygon, optimism, arbitrum, rootstock } from 'wagmi/chains';

export const config = createConfig(
getDefaultConfig({
appName: 'ConnectKit Next.js demo',
chains: [mainnet, polygon, optimism, arbitrum],
chains: [mainnet, polygon, optimism, arbitrum, rootstock],
walletConnectProjectId: process.env.NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID!,
})
);
Expand Down
20 changes: 20 additions & 0 deletions packages/connectkit/src/assets/chains.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,25 @@ export const Polygon = ({ testnet, ...props }: Logo) => (
/>
</svg>
);
export const Rootstock = ({ testnet, ...props }: Logo) => (
<svg
{...props}
aria-hidden="true"
width="44"
height="44"
viewBox="0 0 44 48"
fill="none"
xmlns="http://www.w3.org/2000/svg"
style={{
background: testnet
? '#f7f9fa'
: '#ffffff',
}}
>
<path d="M28.715 6.605c0-3.64-3-6.593-6.703-6.593-3.7 0-6.7 2.953-6.7 6.593 0 3.641 3 6.594 6.7 6.594 3.703 0 6.703-2.953 6.703-6.594Zm0 0" fill="rgb(100%,57.647061%,11.764706%)" fillOpacity={1} stroke="none" fillRule="nonzero" />
<path d="M40.645 26.988c-3.208-1.82-7.305-.738-9.153 2.418a6.476 6.476 0 0 0-.894 3.442c.066 2.906-2.59 4.418-5.114 2.918a6.096 6.096 0 0 0-.304-.176c-2.555-1.403-2.555-4.387 0-5.79 2.093-1.116 3.515-3.296 3.515-5.8 0-.05-.004-.102-.004-.148v.003c-.066-2.91 2.598-4.421 5.125-2.91a6.786 6.786 0 0 0 6.836.075c3.203-1.82 4.301-5.856 2.45-9.008-1.852-3.153-5.95-4.23-9.157-2.41a6.583 6.583 0 0 0-3.347 5.859c.066 2.902-2.586 4.414-5.11 2.914a6.735 6.735 0 0 0-3.492-.969 6.735 6.735 0 0 0-3.492.969c-2.52 1.492-5.164-.016-5.098-2.914a6.573 6.573 0 0 0-3.36-5.863C6.84 7.78 2.743 8.868.899 12.023c-1.843 3.157-.742 7.188 2.47 9.004a6.794 6.794 0 0 0 6.82-.082c2.519-1.504 5.175.004 5.109 2.907l.004-.004c0 .05-.004.101-.004.152 0 2.508 1.418 4.688 3.512 5.8 2.558 1.403 2.554 4.395 0 5.794a3.867 3.867 0 0 0-.305.176c-2.52 1.488-5.164-.02-5.094-2.918a6.502 6.502 0 0 0-.902-3.457c-1.856-3.149-5.953-4.223-9.156-2.403C.14 28.816-.95 32.852.902 36.004c1.856 3.148 5.957 4.223 9.157 2.398l.125-.07-.004.004c2.523-1.508 5.18.004 5.11 2.906l.003-.004c0 .055-.004.11-.004.16.004 3.645 3.008 6.59 6.707 6.59 3.703-.004 6.7-2.96 6.695-6.601l-.003-.145.003.004c-.07-2.91 2.594-4.422 5.125-2.91l-.004-.008c.047.027.09.059.137.082 3.207 1.82 7.305.738 9.153-2.418 1.847-3.156.746-7.187-2.461-9.004Zm0 0" fill="rgb(100%,57.647061%,11.764706%)" fillOpacity={1} stroke="none" fillRule="nonzero"/>
</svg>
);
export const Optimism = ({ testnet, ...props }: Logo) => (
<svg
{...props}
Expand Down Expand Up @@ -852,6 +871,7 @@ export default {
Base,
Ethereum,
Polygon,
Rootstock,
Optimism,
Arbitrum,
Aurora,
Expand Down
10 changes: 10 additions & 0 deletions packages/connectkit/src/constants/chainConfigs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,16 @@ export const chainConfigs: Chain[] = [
name: 'Görli',
logo: <Logos.Ethereum testnet />,
},
{
id: 30,
name: 'Rootstock',
logo: <Logos.Rootstock />,
},
{
id: 31,
name: 'Rootstock Testnet',
logo: <Logos.Rootstock testnet />,
},
{
id: 42,
name: 'Kovan',
Expand Down
4 changes: 2 additions & 2 deletions packages/connectkit/src/defaultConfig.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { http } from 'wagmi';
import { type CreateConfigParameters } from '@wagmi/core';
import { mainnet, polygon, optimism, arbitrum } from 'wagmi/chains';
import { mainnet, polygon, optimism, arbitrum, rootstock } from 'wagmi/chains';
import { CoinbaseWalletParameters } from 'wagmi/connectors';

import defaultConnectors from './defaultConnectors';
Expand Down Expand Up @@ -30,7 +30,7 @@ const defaultConfig = ({
appUrl,
walletConnectProjectId,
coinbaseWalletPreference,
chains = [mainnet, polygon, optimism, arbitrum],
chains = [mainnet, polygon, optimism, arbitrum, rootstock],
client,
...props
}: DefaultConfigProps): CreateConfigParameters => {
Expand Down
4 changes: 2 additions & 2 deletions packages/connectkit/src/defaultTransports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import { fallback, http, webSocket } from 'wagmi';
import { type CreateConfigParameters } from '@wagmi/core';
import { type Chain, mainnet, polygon, optimism, arbitrum } from 'wagmi/chains';
import { type Chain, mainnet, polygon, optimism, arbitrum, rootstock } from 'wagmi/chains';
import { type HttpTransport, type WebSocketTransport } from 'viem';

import { chainConfigs } from './constants/chainConfigs';
Expand Down Expand Up @@ -48,7 +48,7 @@ type GetDefaultTransportsProps = {
};

export const getDefaultTransports = ({
chains = [mainnet, polygon, optimism, arbitrum],
chains = [mainnet, polygon, optimism, arbitrum, rootstock],
alchemyId,
infuraId,
}: GetDefaultTransportsProps): CreateConfigParameters['transports'] => {
Expand Down

0 comments on commit 91eef5e

Please sign in to comment.