Skip to content

Commit

Permalink
Add support for Sepolia-based L2 testnets (for Base, Arbitrum, Optimism)
Browse files Browse the repository at this point in the history
We're adding config for new testnets in order to be able to do a token
attestation on those testnets.
  • Loading branch information
michalinacienciala committed Feb 1, 2024
1 parent b7de149 commit c918c7a
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ on:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: write
jobs:
build-and-deploy:
runs-on: ubuntu-latest
Expand Down
15 changes: 15 additions & 0 deletions src/components/ShowTx.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@ import {
CHAIN_ID_XPLA,
CHAIN_ID_APTOS,
CHAIN_ID_ARBITRUM,
CHAIN_ID_ARBITRUM_SEPOLIA,
CHAIN_ID_INJECTIVE,
CHAIN_ID_BASE,
CHAIN_ID_BASE_SEPOLIA,
CHAIN_ID_OPTIMISM,
CHAIN_ID_OPTIMISM_SEPOLIA,
CHAIN_ID_SEPOLIA,
CHAIN_ID_SUI,
} from "@certusone/wormhole-sdk";
Expand Down Expand Up @@ -133,10 +136,18 @@ export default function ShowTx({
? `https://${CLUSTER === "testnet" ? "goerli." : ""}basescan.org/tx/${
tx?.id
}`
: chainId === CHAIN_ID_BASE_SEPOLIA
? `https://${CLUSTER === "testnet" ? "sepolia." : ""}basescan.org/tx/${
tx?.id
}`
: chainId === CHAIN_ID_OPTIMISM
? `https://${
CLUSTER === "testnet" ? "goerli-" : ""
}optimism.etherscan.io/tx/${tx?.id}`
: chainId === CHAIN_ID_OPTIMISM_SEPOLIA
? `https://${
CLUSTER === "testnet" ? "sepolia-" : ""
}optimism.etherscan.io/tx/${tx?.id}`
: chainId === CHAIN_ID_XPLA
? `https://explorer.xpla.io/${
CLUSTER === "testnet" ? "testnet/" : ""
Expand All @@ -145,6 +156,10 @@ export default function ShowTx({
? `https://${CLUSTER === "testnet" ? "goerli." : ""}arbiscan.io/tx/${
tx?.id
}`
: chainId === CHAIN_ID_ARBITRUM_SEPOLIA
? `https://${CLUSTER === "testnet" ? "sepolia." : ""}arbiscan.io/tx/${
tx?.id
}`
: chainId === CHAIN_ID_APTOS
? `https://explorer.aptoslabs.com/txn/${tx?.id}${
CLUSTER === "testnet"
Expand Down
15 changes: 15 additions & 0 deletions src/components/SmartAddress.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,14 @@ import {
CHAIN_ID_APTOS,
isValidAptosType,
CHAIN_ID_ARBITRUM,
CHAIN_ID_ARBITRUM_SEPOLIA,
CHAIN_ID_INJECTIVE,
terra,
CHAIN_ID_NEAR,
CHAIN_ID_BASE,
CHAIN_ID_BASE_SEPOLIA,
CHAIN_ID_OPTIMISM,
CHAIN_ID_OPTIMISM_SEPOLIA,
CHAIN_ID_SEPOLIA,
CHAIN_ID_SUI,
} from "@certusone/wormhole-sdk";
Expand Down Expand Up @@ -167,10 +170,18 @@ export default function SmartAddress({
? `https://${CLUSTER === "testnet" ? "goerli." : ""}basescan.org/${
isAsset ? "token" : "address"
}/${useableAddress}`
: chainId === CHAIN_ID_BASE_SEPOLIA
? `https://${CLUSTER === "testnet" ? "sepolia." : ""}basescan.org/${
isAsset ? "token" : "address"
}/${useableAddress}`
: chainId === CHAIN_ID_OPTIMISM
? `https://${CLUSTER === "testnet" ? "goerli-" : ""}optimism.etherscan.io/${
isAsset ? "token" : "address"
}/${useableAddress}`
: chainId === CHAIN_ID_OPTIMISM_SEPOLIA
? `https://${CLUSTER === "testnet" ? "sepolia-" : ""}optimism.etherscan.io/${
isAsset ? "token" : "address"
}/${useableAddress}`
: chainId === CHAIN_ID_KARURA
? `https://${
CLUSTER === "testnet"
Expand Down Expand Up @@ -211,6 +222,10 @@ export default function SmartAddress({
? `https://${CLUSTER === "testnet" ? "goerli." : ""}arbiscan.io/${
isAsset ? "token" : "address"
}/${useableAddress}`
: chainId === CHAIN_ID_ARBITRUM_SEPOLIA
? `https://${CLUSTER === "testnet" ? "sepolia." : ""}arbiscan.io/${
isAsset ? "token" : "address"
}/${useableAddress}`
: chainId === CHAIN_ID_APTOS
? `https://explorer.aptoslabs.com/account/${
isValidAptosType(useableAddress)
Expand Down
50 changes: 43 additions & 7 deletions src/utils/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ import {
CHAIN_ID_ALGORAND,
CHAIN_ID_APTOS,
CHAIN_ID_ARBITRUM,
CHAIN_ID_ARBITRUM_SEPOLIA,
CHAIN_ID_AURORA,
CHAIN_ID_AVAX,
CHAIN_ID_BASE,
CHAIN_ID_BASE_SEPOLIA,
CHAIN_ID_BSC,
CHAIN_ID_CELO,
CHAIN_ID_ETH,
Expand All @@ -19,7 +21,9 @@ import {
CHAIN_ID_NEON,
CHAIN_ID_OASIS,
CHAIN_ID_OPTIMISM,
CHAIN_ID_OPTIMISM_SEPOLIA,
CHAIN_ID_POLYGON,
CHAIN_ID_POLYGON_AMOY,
CHAIN_ID_SEPOLIA,
CHAIN_ID_SOLANA,
CHAIN_ID_SUI,
Expand Down Expand Up @@ -99,7 +103,12 @@ export const CHAINS: ChainInfo[] =
},
{
id: CHAIN_ID_ARBITRUM,
name: "Arbitrum",
name: "Arbitrum Goerli",
logo: arbitrumIcon,
},
{
id: CHAIN_ID_ARBITRUM_SEPOLIA,
name: "Arbitrum Sepolia",
logo: arbitrumIcon,
},
{
Expand All @@ -117,6 +126,11 @@ export const CHAINS: ChainInfo[] =
name: "Base Goerli",
logo: baseIcon,
},
{
id: CHAIN_ID_BASE_SEPOLIA,
name: "Base Sepolia",
logo: baseIcon,
},
{
id: CHAIN_ID_BSC,
name: "Binance Smart Chain",
Expand Down Expand Up @@ -179,12 +193,22 @@ export const CHAINS: ChainInfo[] =
},
{
id: CHAIN_ID_OPTIMISM,
name: "Optimism (Goerli)",
name: "Optimism Goerli",
logo: optimismIcon,
},
{
id: CHAIN_ID_OPTIMISM_SEPOLIA,
name: "Optimism Sepolia",
logo: optimismIcon,
},
{
id: CHAIN_ID_POLYGON,
name: "Polygon",
name: "Polygon Mumbai",
logo: polygonIcon,
},
{
id: CHAIN_ID_POLYGON_AMOY,
name: "Polygon Amoy",
logo: polygonIcon,
},
{
Expand Down Expand Up @@ -282,9 +306,12 @@ export const CHAINS_WITH_NFT_SUPPORT = CHAINS.filter(
id === CHAIN_ID_CELO ||
id === CHAIN_ID_NEON ||
id === CHAIN_ID_ARBITRUM ||
id === CHAIN_ID_ARBITRUM_SEPOLIA ||
id === CHAIN_ID_MOONBEAM ||
id === CHAIN_ID_BASE ||
id === CHAIN_ID_OPTIMISM
id === CHAIN_ID_BASE_SEPOLIA ||
id === CHAIN_ID_OPTIMISM ||
id === CHAIN_ID_OPTIMISM_SEPOLIA
);
export type ChainsById = { [key in ChainId]: ChainInfo };
export const CHAINS_BY_ID: ChainsById = CHAINS.reduce((obj, chain) => {
Expand Down Expand Up @@ -330,13 +357,13 @@ export const getDefaultNativeCurrencySymbol = (chainId: ChainId) =>
? "XPLA"
: chainId === CHAIN_ID_APTOS
? "APTOS"
: chainId === CHAIN_ID_ARBITRUM
: chainId === CHAIN_ID_ARBITRUM || chainId === CHAIN_ID_ARBITRUM_SEPOLIA
? "ETH"
: chainId === CHAIN_ID_MOONBEAM
? "GLMR"
: chainId === CHAIN_ID_BASE
: chainId === CHAIN_ID_BASE || chainId === CHAIN_ID_BASE_SEPOLIA
? "ETH"
: chainId === CHAIN_ID_OPTIMISM
: chainId === CHAIN_ID_OPTIMISM || chainId === CHAIN_ID_OPTIMISM_SEPOLIA
? "ETH"
: chainId === CHAIN_ID_SUI
? "SUI"
Expand Down Expand Up @@ -425,9 +452,12 @@ export const KLAYTN_NETWORK_CHAIN_ID = CLUSTER === "testnet" ? 1001 : 1381;
export const CELO_NETWORK_CHAIN_ID = CLUSTER === "testnet" ? 44787 : 1381;
export const NEON_NETWORK_CHAIN_ID = CLUSTER === "testnet" ? 245022926 : 1381;
export const ARBITRUM_NETWORK_CHAIN_ID = CLUSTER === "testnet" ? 421613 : 1381;
export const ARBITRUM_SEPOLIA_NETWORK_CHAIN_ID = CLUSTER === "testnet" ? 421614 : 1381;
export const MOONBEAM_NETWORK_CHAIN_ID = CLUSTER === "testnet" ? 1287 : 1381;
export const BASE_NETWORK_CHAIN_ID = CLUSTER === "testnet" ? 84531 : 1381;
export const BASE_SEPOLIA_NETWORK_CHAIN_ID = CLUSTER === "testnet" ? 84532 : 1381;
export const OPTIMISM_NETWORK_CHAIN_ID = CLUSTER === "testnet" ? 420 : 1381;
export const OPTIMISM_SEPOLIA_NETWORK_CHAIN_ID = CLUSTER === "testnet" ? 11155420 : 1381;
export const getEvmChainId = (chainId: ChainId) =>
chainId === CHAIN_ID_ETH
? ETH_NETWORK_CHAIN_ID
Expand Down Expand Up @@ -457,12 +487,18 @@ export const getEvmChainId = (chainId: ChainId) =>
? NEON_NETWORK_CHAIN_ID
: chainId === CHAIN_ID_ARBITRUM
? ARBITRUM_NETWORK_CHAIN_ID
: chainId === CHAIN_ID_ARBITRUM_SEPOLIA
? ARBITRUM_SEPOLIA_NETWORK_CHAIN_ID
: chainId === CHAIN_ID_MOONBEAM
? MOONBEAM_NETWORK_CHAIN_ID
: chainId === CHAIN_ID_BASE
? BASE_NETWORK_CHAIN_ID
: chainId === CHAIN_ID_BASE_SEPOLIA
? BASE_SEPOLIA_NETWORK_CHAIN_ID
: chainId === CHAIN_ID_OPTIMISM
? OPTIMISM_NETWORK_CHAIN_ID
: chainId === CHAIN_ID_OPTIMISM_SEPOLIA
? OPTIMISM_SEPOLIA_NETWORK_CHAIN_ID
: undefined;
export const SOLANA_HOST = process.env.REACT_APP_SOLANA_API_URL
? process.env.REACT_APP_SOLANA_API_URL
Expand Down

0 comments on commit c918c7a

Please sign in to comment.