Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add Sepolia testnet #116

Merged
merged 5 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions packages/sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# 3.2.0

## SDK

### Added

- `Sepolia` testnet

## Playground

- Support for `Sepolia` testnet

# 3.1.0

## SDK
Expand Down
8 changes: 7 additions & 1 deletion packages/sdk/src/common/constants.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { type Address, type Chain } from 'viem';
import { goerli, mainnet, holesky } from 'viem/chains';
import { goerli, mainnet, holesky, sepolia } from 'viem/chains';

export enum CHAINS {
Goerli = 5,
Mainnet = 1,
Holesky = 17000,
Sepolia = 11155111,
}

export const APPROX_BLOCKS_BY_DAY = 7600n;
Expand All @@ -13,6 +14,7 @@ export const SUPPORTED_CHAINS: CHAINS[] = [
CHAINS.Goerli,
CHAINS.Mainnet,
CHAINS.Holesky,
CHAINS.Sepolia,
];

export const SUBMIT_EXTRA_GAS_TRANSACTION_RATIO = 1.05;
Expand All @@ -25,6 +27,7 @@ export const LIDO_LOCATOR_BY_CHAIN: {
[CHAINS.Mainnet]: '0xC1d0b3DE6792Bf6b4b37EccdcC24e45978Cfd2Eb',
[CHAINS.Goerli]: '0x1eDf09b5023DC86737b59dE68a8130De878984f5',
[CHAINS.Holesky]: '0x28FAB2059C713A7F9D8c86Db49f9bb0e96Af1ef8',
[CHAINS.Sepolia]: '0x8f6254332f69557A72b0DA2D5F0Bc07d4CA991E7',
};

export const SUBRGRAPH_ID_BY_CHAIN: {
Expand All @@ -33,6 +36,7 @@ export const SUBRGRAPH_ID_BY_CHAIN: {
[CHAINS.Mainnet]: 'Sxx812XgeKyzQPaBpR5YZWmGV5fZuBaPdh7DFhzSwiQ',
[CHAINS.Goerli]: 'QmeDfGTuNbSoZ71zi3Ch4WNRbzALfiFPnJMYUFPinLiFNa',
[CHAINS.Holesky]: null,
[CHAINS.Sepolia]: null,
};

export const EARLIEST_TOKEN_REBASED_EVENT: {
Expand All @@ -41,6 +45,7 @@ export const EARLIEST_TOKEN_REBASED_EVENT: {
[CHAINS.Mainnet]: 17272708n,
[CHAINS.Goerli]: 8712039n,
[CHAINS.Holesky]: 52174n,
[CHAINS.Sepolia]: 5434668n,
} as const;

export const LIDO_TOKENS = {
Expand Down Expand Up @@ -104,4 +109,5 @@ export const VIEM_CHAINS: { [key in CHAINS]: Chain } = {
[CHAINS.Mainnet]: mainnet,
[CHAINS.Goerli]: goerli,
[CHAINS.Holesky]: holesky,
[CHAINS.Sepolia]: sepolia,
};
9 changes: 7 additions & 2 deletions playground/components/layout/header/headerWallet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,17 @@ import { HeaderWalletChainStyle } from './headerWalletStyles';

const HeaderWallet: FC = () => {
const { active, chainId } = useWeb3();
const chainName = chainId && CHAINS[chainId];
// TODO: update @lido-sdk/constants
const chainName = chainId && { ...CHAINS, 11155111: 'Sepolia' }[chainId];
const isSepolia = chainId === 11155111;

return (
<>
{chainId && (
<HeaderWalletChainStyle $color={getChainColor(chainId)}>
<HeaderWalletChainStyle
// TODO: update @lido-sdk/constants -> getChainColor
$color={isSepolia ? '#FFD700' : getChainColor(chainId)}
>
{chainName}
</HeaderWalletChainStyle>
)}
Expand Down
3 changes: 2 additions & 1 deletion playground/env-dynamics.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ export const rpcProviderUrls = {
1: process.env[`RPC_PROVIDER_URL_1`],
5: process.env[`RPC_PROVIDER_URL_5`],
17000: process.env[`RPC_PROVIDER_URL_17000`],
11155111: process.env[`RPC_PROVIDER_URL_11155111`],
};
/** @type number */
export const defaultChain = parseInt(process.env.DEFAULT_CHAIN, 10) || 17000;
/** @type number[] */
export const supportedChains = process.env?.SUPPORTED_CHAINS?.split(',').map(
(chainId) => parseInt(chainId, 10),
) ?? [1, 5, 17000];
) ?? [1, 5, 17000, 11155111];
export const walletconnectProjectId = process.env.WALLETCONNECT_PROJECT_ID;
2 changes: 2 additions & 0 deletions playground/providers/web3.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ const Web3Provider: FC<PropsWithChildren> = ({ children }) => {
[CHAINS.Mainnet]: getRpc(CHAINS.Mainnet),
[CHAINS.Goerli]: getRpc(CHAINS.Goerli),
[CHAINS.Holesky]: getRpc(CHAINS.Holesky),
// TODO: update @lido-sdk/constants
11155111: getRpc(11155111),
};
}, [customRpc]);

Expand Down
Loading