Skip to content

Commit

Permalink
Merge pull request #4 from turbo-eth/feat/add-gnosis-avalanche
Browse files Browse the repository at this point in the history
Feat: Add avalanche and gnosis chains
  • Loading branch information
marthendalnunes authored Jun 30, 2023
2 parents 42b9782 + a26f9d7 commit b83c3a6
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-turbo-eth",
"version": "0.1.0",
"version": "0.1.1",
"description": "Create web3 apps in turbo mode.",
"author": "Vitor @marthendalnunes",
"license": "MIT",
Expand Down
42 changes: 42 additions & 0 deletions src/config/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,28 @@ export const prodNetworkOptions: ProdNetworks = {
],
testnets: ['celoAlfajores'],
},
gnosis: {
name: 'Gnosis',
pageDependencies: [
{
dependencyPath: configNetworksPath,
type: 'snippet',
regexList: [/\n\s*gnosis as gnosisNoIcon,/, /\n\s*const gnosis = {[\s\S]*?},?/],
},
],
testnets: ['gnosisChiado'],
},
avalanche: {
name: 'Avalanche',
pageDependencies: [
{
dependencyPath: configNetworksPath,
type: 'snippet',
regexList: [/\n\s*avalanche as avalancheNoIcon,/, /\n\s*const avalanche = {[\s\S]*?},?/],
},
],
testnets: ['avalancheFuji'],
},
}

export const testNetworkOptions: TestNetworks = {
Expand Down Expand Up @@ -135,6 +157,26 @@ export const testNetworkOptions: TestNetworks = {
},
],
},
gnosisChiado: {
name: 'Gnosis Chiado',
pageDependencies: [
{
dependencyPath: configNetworksPath,
type: 'snippet',
regexList: [/\n\s*gnosisChiado as gnosisChiadoNoIcon,/, /\n\s*const gnosisChiado = {[\s\S]*?},?/],
},
],
},
avalancheFuji: {
name: 'Avalanche Fuji',
pageDependencies: [
{
dependencyPath: configNetworksPath,
type: 'snippet',
regexList: [/\n\s*avalancheFuji as avalancheFujiNoIcon,/, /\n\s*const avalancheFuji = {[\s\S]*?},?/],
},
],
},
hardhat: {
name: 'Hardhat',
pageDependencies: [
Expand Down
4 changes: 3 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export type Provider = {
env: string
}

export type AvailableProdNetworks = 'mainnet' | 'optimism' | 'arbitrum' | 'polygon' | 'celo'
export type AvailableProdNetworks = 'mainnet' | 'optimism' | 'arbitrum' | 'polygon' | 'celo' | 'gnosis' | 'avalanche'
export type AvailableTestNetworks =
| 'goerli'
| 'sepolia'
Expand All @@ -37,6 +37,8 @@ export type AvailableTestNetworks =
| 'celoAlfajores'
| 'baseGoerli'
| 'hardhat'
| 'gnosisChiado'
| 'avalancheFuji'

export type ProdNetworks = Record<AvailableProdNetworks, ProdNetwork>
export type TestNetworks = Record<AvailableTestNetworks, Network>
Expand Down
24 changes: 22 additions & 2 deletions template/base/config/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@ import { Chain, configureChains } from 'wagmi'
import {
arbitrum,
arbitrumGoerli as arbitrumGoerliNoIcon,
avalancheFuji as avalancheFujiNoIcon,
avalanche as avalancheNoIcon,
baseGoerli as baseGoerliNoIcon,
celoAlfajores as celoAlfajoresNoIcon,
celo as celoNoIcon,
gnosisChiado as gnosisChiadoNoIcon,
gnosis as gnosisNoIcon,
goerli as goerliNoIcon,
hardhat,
mainnet,
Expand Down Expand Up @@ -47,9 +51,25 @@ const celoAlfajores = {
...celoAlfajoresNoIcon,
iconUrl: '/icons/NetworkCeloTest.svg',
}
const avalanche = {
...avalancheNoIcon,
iconUrl: '/icons/NetworkAvalanche.svg',
}
const avalancheFuji = {
...avalancheFujiNoIcon,
iconUrl: '/icons/NetworkAvalanche.svg',
}
const gnosis = {
...gnosisNoIcon,
iconUrl: '/icons/NetworkGnosis.svg',
}
const gnosisChiado = {
...gnosisChiadoNoIcon,
iconUrl: '/icons/NetworkGnosis.svg',
}

export const ETH_CHAINS_TEST = [mainnet, goerli, sepolia, polygonMumbai, celoAlfajores, hardhat,baseGoerli, optimismGoerli, arbitrumGoerli]
export const ETH_CHAINS_PROD = [mainnet, optimism, arbitrum, polygon, celo, goerli, baseGoerli]
export const ETH_CHAINS_TEST = [mainnet, goerli, sepolia, polygonMumbai, celoAlfajores, hardhat,baseGoerli, optimismGoerli, arbitrumGoerli, gnosisChiado, avalancheFuji]
export const ETH_CHAINS_PROD = [mainnet, optimism, arbitrum, polygon, celo, gnosis, avalanche, goerli, baseGoerli]
export const ETH_CHAINS_DEV = env.NEXT_PUBLIC_PROD_NETWORKS_DEV === 'true' ? [...ETH_CHAINS_PROD, ...ETH_CHAINS_TEST] : ETH_CHAINS_TEST

export const CHAINS: Chain[] = process.env.NODE_ENV === 'production' ? ETH_CHAINS_PROD : ETH_CHAINS_DEV
Expand Down
4 changes: 4 additions & 0 deletions template/base/public/icons/NetworkAvalanche.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions template/base/public/icons/NetworkGnosis.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b83c3a6

Please sign in to comment.