diff --git a/.github/workflows/dev-cd.yaml b/.github/workflows/dev-cd.yaml index 64e0f5cd..3dd9a287 100644 --- a/.github/workflows/dev-cd.yaml +++ b/.github/workflows/dev-cd.yaml @@ -5,8 +5,14 @@ on: branches: master env: - REACT_APP_ETHERSCAN_KEY: ${{ secrets.REACT_APP_ETHERSCAN_KEY }} REACT_APP_INFURA_ID: ${{ secrets.REACT_APP_INFURA_ID }} + REACT_APP_ETHERSCAN_KEY: ${{ secrets.REACT_APP_ETHERSCAN_KEY }} + REACT_APP_GNOSISSCAN_KEY: ${{ secrets.REACT_APP_GNOSISSCAN_KEY }} + REACT_APP_POLYGONSCAN_KEY: ${{ secrets.REACT_APP_POLYGONSCAN_KEY }} + REACT_APP_BSCSCAN_KEY: ${{ secrets.REACT_APP_BSCSCAN_KEY }} + REACT_APP_OPTIMISTIC_ETHERSCAN_KEY: ${{ secrets.REACT_APP_OPTIMISTIC_ETHERSCAN_KEY }} + REACT_APP_ARBISCAN_KEY: ${{ secrets.REACT_APP_ARBISCAN_KEY }} + REACT_APP_SNOWTRACE_KEY: ${{ secrets.REACT_APP_SNOWTRACE_KEY }} REACT_APP_MULTI_SEND_CONTRACT: "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761" REACT_APP_BACKEND_API_URL: "https://api.dev.zodiac.gnosisguild.org/api" diff --git a/.github/workflows/prod-release-deploy.yaml b/.github/workflows/prod-release-deploy.yaml index ec4d70fd..5f27032e 100644 --- a/.github/workflows/prod-release-deploy.yaml +++ b/.github/workflows/prod-release-deploy.yaml @@ -5,10 +5,16 @@ on: types: created env: - REACT_APP_ETHERSCAN_KEY: ${{ secrets.REACT_APP_ETHERSCAN_KEY }} REACT_APP_INFURA_ID: ${{ secrets.REACT_APP_INFURA_ID }} REACT_APP_MULTI_SEND_CONTRACT: "0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761" REACT_APP_BACKEND_API_URL: "https://api.zodiac.gnosisguild.org/api" + REACT_APP_ETHERSCAN_KEY: ${{ secrets.REACT_APP_ETHERSCAN_KEY }} + REACT_APP_GNOSISSCAN_KEY: ${{ secrets.REACT_APP_GNOSISSCAN_KEY }} + REACT_APP_POLYGONSCAN_KEY: ${{ secrets.REACT_APP_POLYGONSCAN_KEY }} + REACT_APP_BSCSCAN_KEY: ${{ secrets.REACT_APP_BSCSCAN_KEY }} + REACT_APP_OPTIMISTIC_ETHERSCAN_KEY: ${{ secrets.REACT_APP_OPTIMISTIC_ETHERSCAN_KEY }} + REACT_APP_ARBISCAN_KEY: ${{ secrets.REACT_APP_ARBISCAN_KEY }} + REACT_APP_SNOWTRACE_KEY: ${{ secrets.REACT_APP_SNOWTRACE_KEY }} jobs: deploy: diff --git a/packages/app/.env.sample b/packages/app/.env.sample index e59c0731..ccc48edd 100644 --- a/packages/app/.env.sample +++ b/packages/app/.env.sample @@ -1,6 +1,14 @@ PORT=3000 HTTPS=true REACT_APP_INFURA_ID= -REACT_APP_ETHERSCAN_KEY= REACT_APP_MULTI_SEND_CONTRACT=0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761 -REACT_APP_BACKEND_API_URL=http://localhost:3001/api \ No newline at end of file +REACT_APP_BACKEND_API_URL=http://localhost:3001/api + +# Blockchain explorers +REACT_APP_ETHERSCAN_KEY= +REACT_APP_GNOSISSCAN_KEY= +REACT_APP_POLYGONSCAN_KEY= +REACT_APP_BSCSCAN_KEY= +REACT_APP_OPTIMISTIC_ETHERSCAN_KEY= +REACT_APP_ARBISCAN_KEY= +REACT_APP_SNOWTRACE_KEY= \ No newline at end of file diff --git a/packages/app/src/utils/explorers.ts b/packages/app/src/utils/explorers.ts index c9edbc90..a6b493ee 100644 --- a/packages/app/src/utils/explorers.ts +++ b/packages/app/src/utils/explorers.ts @@ -1,6 +1,40 @@ import { NETWORK } from "./networks" +const isDev = process.env.NODE_ENV === "development" const REACT_APP_ETHERSCAN_KEY = process.env.REACT_APP_ETHERSCAN_KEY +if (!REACT_APP_ETHERSCAN_KEY) { + throw new Error("REACT_APP_ETHERSCAN_KEY is not set") +} + +const REACT_APP_GNOSISSCAN_KEY = process.env.REACT_APP_GNOSISSCAN_KEY +if (!isDev && !REACT_APP_GNOSISSCAN_KEY) { + throw new Error("REACT_APP_GNOSISSCAN_KEY is not set") +} + +const REACT_APP_POLYGONSCAN_KEY = process.env.REACT_APP_POLYGONSCAN_KEY +if (!isDev && !REACT_APP_POLYGONSCAN_KEY) { + throw new Error("REACT_APP_POLYGONSCAN_KEY is not set") +} + +const REACT_APP_BSCSCAN_KEY = process.env.REACT_APP_BSCSCAN_KEY +if (!isDev && !REACT_APP_BSCSCAN_KEY) { + throw new Error("REACT_APP_BSCSCAN_KEY is not set") +} + +const REACT_APP_OPTIMISTIC_ETHERSCAN_KEY = process.env.REACT_APP_OPTIMISTIC_ETHERSCAN_KEY +if (!isDev && !REACT_APP_OPTIMISTIC_ETHERSCAN_KEY) { + throw new Error("REACT_APP_OPTIMISTIC_ETHERSCAN_KEY is not set") +} + +const REACT_APP_ARBISCAN_KEY = process.env.REACT_APP_ARBISCAN_KEY +if (!isDev && !REACT_APP_ARBISCAN_KEY) { + throw new Error("REACT_APP_ARBISCAN_KEY is not set") +} + +const REACT_APP_SNOWTRACE_KEY = process.env.REACT_APP_SNOWTRACE_KEY +if (!isDev && !REACT_APP_SNOWTRACE_KEY) { + throw new Error("REACT_APP_SNOWTRACE_KEY is not set") +} interface ExplorerData { networkExplorerName: string @@ -32,13 +66,13 @@ export const EXPLORERS_CONFIG: Record = { explorerApiKey: REACT_APP_ETHERSCAN_KEY, }, [NETWORK.GNOSIS_CHAIN]: { - networkExplorerName: "Blockscout", - networkExplorerUrl: "https://blockscout.com/xdai/mainnet", - networkExplorerApiUrl: "https://blockscout.com/xdai/mainnet/api", + networkExplorerName: "GnosisScan", + networkExplorerUrl: "https://gnosisscan.io", + networkExplorerApiUrl: "https://api.gnosisscan.io/api", safeUrl: "https://app.safe.global/gno:", safeTransactionApi: "https://safe-transaction-gnosis-chain.safe.global/", - verifyContractUrl: - "https://docs.blockscout.com/for-users/smart-contract-interaction/verifying-a-smart-contract", + verifyContractUrl: "https://gnosisscan.io/verifyContract", + explorerApiKey: REACT_APP_GNOSISSCAN_KEY, }, [NETWORK.POLYGON]: { networkExplorerName: "Polygonscan", @@ -47,16 +81,16 @@ export const EXPLORERS_CONFIG: Record = { safeUrl: "https://app.safe.global/matic:", safeTransactionApi: "https://safe-transaction-polygon.safe.global/", verifyContractUrl: "https://polygonscan.com/verifyContract", - explorerApiKey: REACT_APP_ETHERSCAN_KEY, + explorerApiKey: REACT_APP_POLYGONSCAN_KEY, }, [NETWORK.BSC]: { networkExplorerName: "Bscscan", networkExplorerUrl: "https://bscscan.com/", - networkExplorerApiUrl: "https://bscscan.com/api", + networkExplorerApiUrl: "https://api.bscscan.com/api", safeUrl: "https://app.safe.global/bsc:", safeTransactionApi: "https://safe-transaction-bsc.safe.global/", verifyContractUrl: "https://bscscan.com/verifyContract", - explorerApiKey: REACT_APP_ETHERSCAN_KEY, + explorerApiKey: REACT_APP_BSCSCAN_KEY, }, [NETWORK.OPTIMISM]: { networkExplorerName: "Optimism", @@ -65,7 +99,7 @@ export const EXPLORERS_CONFIG: Record = { safeTransactionApi: "https://safe-transaction-optimism.safe.global/", safeUrl: "https://app.safe.global/oeth:", verifyContractUrl: "https://optimistic.etherscan.io/verifyContract", - explorerApiKey: REACT_APP_ETHERSCAN_KEY, + explorerApiKey: REACT_APP_OPTIMISTIC_ETHERSCAN_KEY, }, [NETWORK.ARBITRUM]: { networkExplorerName: "Arbiscan", @@ -74,7 +108,7 @@ export const EXPLORERS_CONFIG: Record = { safeTransactionApi: "https://safe-transaction-arbitrum.safe.global/", safeUrl: "https://app.safe.global/arb1:", verifyContractUrl: "https://arbiscan.io/verifyContract", - explorerApiKey: REACT_APP_ETHERSCAN_KEY, + explorerApiKey: REACT_APP_ARBISCAN_KEY, }, [NETWORK.AVALANCHE]: { networkExplorerName: "Snowtrace", @@ -83,7 +117,7 @@ export const EXPLORERS_CONFIG: Record = { safeTransactionApi: "https://safe-transaction-avalanche.safe.global/", safeUrl: "https://app.safe.global/avax:", verifyContractUrl: "https://snowtrace.io/verifyContract", - explorerApiKey: REACT_APP_ETHERSCAN_KEY, + explorerApiKey: REACT_APP_SNOWTRACE_KEY, }, }