diff --git a/.env.sample b/.env.sample index cb1ac5354..2f99e2ca6 100644 --- a/.env.sample +++ b/.env.sample @@ -14,7 +14,7 @@ MIGRATION_WEBHOOK_URL= GASLESS_WEBHOOK_URL= GASLESS_DISABLED=false DASHBOARD_PASSWORD= -TENDERLY_RPC_KEY= +NEXT_PUBLIC_TENDERLY_RPC_KEY= # this is used to determine which database to fetch data from NEXT_PUBLIC_VERCEL_ENV=development \ No newline at end of file diff --git a/lib/config.ts b/lib/config.ts index 8880ad716..3708cf143 100644 --- a/lib/config.ts +++ b/lib/config.ts @@ -61,5 +61,5 @@ export const config: SystemConfig = { DASHBOARD_PASSWORD: process.env.DASHBOARD_PASSWORD || '', GASLESS_BACKDOOR_SECRET: process.env.GASLESS_BACKDOOR_SECRET || '', GASLESS_DISABLED: process.env.GASLESS_DISABLED || '', - TENDERLY_RPC_KEY: process.env.TENDERLY_RPC_KEY || '' + TENDERLY_RPC_KEY: process.env.NEXT_PUBLIC_TENDERLY_RPC_KEY || '' }; diff --git a/modules/web3/helpers/getDefaultProvider.ts b/modules/web3/helpers/getDefaultProvider.ts index 048b28c6c..0876d297c 100644 --- a/modules/web3/helpers/getDefaultProvider.ts +++ b/modules/web3/helpers/getDefaultProvider.ts @@ -15,17 +15,21 @@ ethers.utils.Logger.setLogLevel(ethers.utils.Logger.levels.ERROR); export const getDefaultProvider = ( network: SupportedNetworks | string | undefined ): providers.FallbackProvider => { - const infuraProvider = new ethers.providers.InfuraProvider(network, config.INFURA_KEY); - const alchemyProvider = new ethers.providers.AlchemyProvider(network, config.ALCHEMY_KEY); - const pocketProvider = new ethers.providers.PocketProvider(network, config.POCKET_KEY); - const etherscanProvider = new ethers.providers.EtherscanProvider(network, config.ETHERSCAN_KEY); - - const provider = new ethers.providers.FallbackProvider([ - { provider: infuraProvider, priority: 2 }, - { provider: alchemyProvider, priority: 1 }, - { provider: pocketProvider, priority: 3 }, - { provider: etherscanProvider, priority: 3 } - ], 1); //Quorum of 1 - - return provider; + if (network === SupportedNetworks.TENDERLY) { + return new ethers.providers.FallbackProvider([new ethers.providers.JsonRpcProvider(`https://virtual.mainnet.rpc.tenderly.co/${config.TENDERLY_RPC_KEY}`)], 1); + } else { + const infuraProvider = new ethers.providers.InfuraProvider(network, config.INFURA_KEY); + const alchemyProvider = new ethers.providers.AlchemyProvider(network, config.ALCHEMY_KEY); + const pocketProvider = new ethers.providers.PocketProvider(network, config.POCKET_KEY); + const etherscanProvider = new ethers.providers.EtherscanProvider(network, config.ETHERSCAN_KEY); + + const provider = new ethers.providers.FallbackProvider([ + { provider: infuraProvider, priority: 2 }, + { provider: alchemyProvider, priority: 1 }, + { provider: pocketProvider, priority: 3 }, + { provider: etherscanProvider, priority: 3 } + ], 1); //Quorum of 1 + + return provider; + } };