Skip to content

Commit

Permalink
feat: arb-sepolia support (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
scolear authored Mar 29, 2024
1 parent d19e1ca commit 79788e5
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function SelectNetworkButton({
{enabledEthereumNetworks.map((network, id) => {
return (
<MenuItem key={id} value={network.id} onClick={() => handleClick(network)}>
{network.name}
{network.displayName}
</MenuItem>
);
})}
Expand Down
10 changes: 10 additions & 0 deletions src/app/hooks/use-endpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,16 @@ export function useEndpoints(): NetworkEndpoints {
bitcoinNetwork,
bitcoinNetworkName,
};
case EthereumNetworkID.ArbSepolia:
return {
attestorAPIURLs,
ethereumExplorerAPIURL: 'https://sepolia.arbiscan.io/tx/',
ethereumAttestorChainID: 'evm-arbsepolia',
bitcoinExplorerAPIURL,
bitcoinBlockchainAPIURL,
bitcoinNetwork,
bitcoinNetworkName,
};
default:
throw new Error(`Unsupported network: ${network?.name}`);
}
Expand Down
1 change: 1 addition & 0 deletions src/app/store/slices/vault/vault.slice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const initialVaultState: VaultSliceState = {
[EthereumNetworkID.Goerli]: [],
[EthereumNetworkID.Sepolia]: [],
[EthereumNetworkID.X1Testnet]: [],
[EthereumNetworkID.ArbSepolia]: [],
},
status: 'idle',
error: null,
Expand Down
28 changes: 28 additions & 0 deletions src/shared/models/ethereum-network.ts
Original file line number Diff line number Diff line change
@@ -1,50 +1,78 @@
export interface EthereumNetwork {
id: EthereumNetworkID;
name: string;
displayName: string;
}

export enum EthereumNetworkID {
Mainnet = '1',
Goerli = '5',
Sepolia = '11155111',
X1Testnet = '195',
ArbSepolia = '421614',
}

const ethereumOKXTestnet: EthereumNetwork = {
name: 'X1Test',
displayName: 'X1 Testnet',
id: EthereumNetworkID.X1Testnet,
};

const ethereumMainnet: EthereumNetwork = {
name: 'Mainnet',
displayName: 'ETH Mainnet',
id: EthereumNetworkID.Mainnet,
};

const ethereumGoerli: EthereumNetwork = {
name: 'Goerli',
displayName: 'Goerli',
id: EthereumNetworkID.Goerli,
};

const ethereumSepolia: EthereumNetwork = {
name: 'Sepolia',
displayName: 'Sepolia',
id: EthereumNetworkID.Sepolia,
};

const ethereumArbSepolia: EthereumNetwork = {
name: 'ArbSepolia',
displayName: 'Arbitrum Sepolia',
id: EthereumNetworkID.ArbSepolia,
};

export const ethereumNetworks: EthereumNetwork[] = [
ethereumMainnet,
ethereumGoerli,
ethereumSepolia,
ethereumOKXTestnet,
ethereumArbSepolia,
];

export const hexChainIDs: { [key in EthereumNetworkID]: string } = {
[EthereumNetworkID.Mainnet]: '0x1',
[EthereumNetworkID.Goerli]: '0x5',
[EthereumNetworkID.Sepolia]: '0xAA36A7',
[EthereumNetworkID.X1Testnet]: '0x3C',
[EthereumNetworkID.ArbSepolia]: '0x66eee',
};

export const addNetworkParams = {
[EthereumNetworkID.ArbSepolia]: [
{
chainId: '0x66eee',
rpcUrls: ['https://sepolia-rollup.arbitrum.io/rpc', 'https://arb-sepolia.infura.io/v3/'],
chainName: 'Arbitrum Sepolia Testnet',
nativeCurrency: {
name: 'ETH',
symbol: 'ETH',
decimals: 18,
},
blockExplorerUrls: ['https://sepolia.arbiscan.io/'],
},
],

[EthereumNetworkID.X1Testnet]: [
{
chainId: '0xC3',
Expand Down

0 comments on commit 79788e5

Please sign in to comment.