mirror of
https://github.com/lens-protocol/core.git
synced 2026-01-08 05:43:57 -05:00
feat: Environment variables modified to be generic
This commit is contained in:
10
.env.example
10
.env.example
@@ -1,9 +1,11 @@
|
|||||||
MNEMONIC=
|
MNEMONIC=
|
||||||
ETHERSCAN_KEY=
|
POLYGON_RPC_URL=
|
||||||
INFURA_KEY=
|
MUMBAI_RPC_URL=
|
||||||
ETHERSCAN_NETWORK=
|
KOVAN_RPC_URL=
|
||||||
|
ROPSTEN_RPC_URL=
|
||||||
|
MAINNET_RPC_URL=
|
||||||
|
BLOCK_EXPLORER_KEY=
|
||||||
TENDERLY_PROJECT=
|
TENDERLY_PROJECT=
|
||||||
TENDERLY_USERNAME=
|
TENDERLY_USERNAME=
|
||||||
ALCHEMY_KEY=
|
|
||||||
TENDERLY_FORK_ID=
|
TENDERLY_FORK_ID=
|
||||||
TENDERLY_HEAD_ID=
|
TENDERLY_HEAD_ID=
|
||||||
|
|||||||
@@ -45,13 +45,12 @@ The Lens Protocol is a decentralized, non-custodial social graph. Lens implement
|
|||||||
>
|
>
|
||||||
> (feel free to experiment and submit PR's)
|
> (feel free to experiment and submit PR's)
|
||||||
|
|
||||||
The environment is built using Docker Compose, note that your `.env` file must have an `ALCHEMY_KEY` or an `INFURA_KEY` variable, and an optional `MNEMONIC` and `ETHERSCAN_KEY`, defined like so:
|
The environment is built using Docker Compose, note that your `.env` file must have the RPC URL of the network you want to use, and an optional `MNEMONIC` and `BLOCK_EXPLORER_KEY`, defined like so, assuming you choose to use Mumbai network:
|
||||||
|
|
||||||
```
|
```
|
||||||
MNEMONIC="MNEMONIC YOU WANT TO DERIVE WALLETS FROM HERE"
|
MNEMONIC="MNEMONIC YOU WANT TO DERIVE WALLETS FROM HERE"
|
||||||
ALCHEMY_KEY="YOUR ALCHEMY KEY HERE"
|
MUMBAI_RPC_URL="YOUR RPC URL HERE"
|
||||||
INFURA_KEY="OR YOUR INFURA KEY HERE"
|
BLOCK_EXPLORER_KEY="YOUR BLOCK EXPLORER API KEY HERE"
|
||||||
ETHERSCAN_KEY="YOUR ETHERSCAN API KEY HERE"
|
|
||||||
```
|
```
|
||||||
|
|
||||||
With the environment file set up, you can move on to using Docker:
|
With the environment file set up, you can move on to using Docker:
|
||||||
|
|||||||
@@ -14,11 +14,9 @@ services:
|
|||||||
- $HOME/.tenderly/config.yaml:/root/.tenderly/config.yaml:ro
|
- $HOME/.tenderly/config.yaml:/root/.tenderly/config.yaml:ro
|
||||||
#environment:
|
#environment:
|
||||||
#- MNEMONIC=
|
#- MNEMONIC=
|
||||||
#- ETHERSCAN_KEY=
|
#- RPC_URL=
|
||||||
#- INFURA_KEY=
|
#- BLOCK_EXPLORER_KEY=
|
||||||
#- ETHERSCAN_NETWORK=
|
|
||||||
#- TENDERLY_PROJECT=
|
#- TENDERLY_PROJECT=
|
||||||
#- TENDERLY_USERNAME=
|
#- TENDERLY_USERNAME=
|
||||||
#- ALCHEMY_KEY=
|
|
||||||
#- TENDERLY_FORK_ID=
|
#- TENDERLY_FORK_ID=
|
||||||
#- TENDERLY_HEAD_ID=
|
#- TENDERLY_HEAD_ID=
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ const MNEMONIC_PATH = "m/44'/60'/0'/0";
|
|||||||
const MNEMONIC = process.env.MNEMONIC || '';
|
const MNEMONIC = process.env.MNEMONIC || '';
|
||||||
const MAINNET_FORK = process.env.MAINNET_FORK === 'true';
|
const MAINNET_FORK = process.env.MAINNET_FORK === 'true';
|
||||||
const TRACK_GAS = process.env.TRACK_GAS === 'true';
|
const TRACK_GAS = process.env.TRACK_GAS === 'true';
|
||||||
const ETHERSCAN_KEY = process.env.ETHERSCAN_KEY || '';
|
const BLOCK_EXPLORER_KEY = process.env.BLOCK_EXPLORER_KEY || '';
|
||||||
|
|
||||||
const getCommonNetworkConfig = (networkName: eNetwork, networkId: number) => ({
|
const getCommonNetworkConfig = (networkName: eNetwork, networkId: number) => ({
|
||||||
url: NETWORKS_RPC_URL[networkName],
|
url: NETWORKS_RPC_URL[networkName],
|
||||||
@@ -95,7 +95,7 @@ const config: HardhatUserConfig = {
|
|||||||
runOnCompile: false,
|
runOnCompile: false,
|
||||||
},
|
},
|
||||||
etherscan: {
|
etherscan: {
|
||||||
apiKey: ETHERSCAN_KEY,
|
apiKey: BLOCK_EXPLORER_KEY,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -8,30 +8,18 @@ import {
|
|||||||
import dotenv from 'dotenv';
|
import dotenv from 'dotenv';
|
||||||
dotenv.config({});
|
dotenv.config({});
|
||||||
|
|
||||||
const INFURA_KEY = process.env.INFURA_KEY || '';
|
|
||||||
const ALCHEMY_KEY = process.env.ALCHEMY_KEY || '';
|
|
||||||
const TENDERLY_FORK_ID = process.env.TENDERLY_FORK_ID || '';
|
const TENDERLY_FORK_ID = process.env.TENDERLY_FORK_ID || '';
|
||||||
|
|
||||||
const GWEI = 1000 * 1000 * 1000;
|
const GWEI = 1000 * 1000 * 1000;
|
||||||
|
|
||||||
export const NETWORKS_RPC_URL: iParamsPerNetwork<string> = {
|
export const NETWORKS_RPC_URL: iParamsPerNetwork<string> = {
|
||||||
[eEthereumNetwork.kovan]: ALCHEMY_KEY
|
[eEthereumNetwork.kovan]: process.env.KOVAN_RPC_URL,
|
||||||
? `https://eth-kovan.alchemyapi.io/v2/${ALCHEMY_KEY}`
|
[eEthereumNetwork.ropsten]: process.env.ROPSTEN_RPC_URL,
|
||||||
: `https://kovan.infura.io/v3/${INFURA_KEY}`,
|
[eEthereumNetwork.main]: process.env.MAINNET_RPC_URL,
|
||||||
[eEthereumNetwork.ropsten]: ALCHEMY_KEY
|
|
||||||
? `https://eth-ropsten.alchemyapi.io/v2/${ALCHEMY_KEY}`
|
|
||||||
: `https://ropsten.infura.io/v3/${INFURA_KEY}`,
|
|
||||||
[eEthereumNetwork.main]: ALCHEMY_KEY
|
|
||||||
? `https://eth-mainnet.alchemyapi.io/v2/${ALCHEMY_KEY}`
|
|
||||||
: `https://mainnet.infura.io/v3/${INFURA_KEY}`,
|
|
||||||
[eEthereumNetwork.hardhat]: 'http://localhost:8545',
|
[eEthereumNetwork.hardhat]: 'http://localhost:8545',
|
||||||
[eEthereumNetwork.harhatevm]: 'http://localhost:8545',
|
[eEthereumNetwork.harhatevm]: 'http://localhost:8545',
|
||||||
[eEthereumNetwork.tenderlyMain]: `https://rpc.tenderly.co/fork/${TENDERLY_FORK_ID}`,
|
[eEthereumNetwork.tenderlyMain]: `https://rpc.tenderly.co/fork/${TENDERLY_FORK_ID}`,
|
||||||
[ePolygonNetwork.mumbai]: ALCHEMY_KEY
|
[ePolygonNetwork.mumbai]: process.env.MUMBAI_RPC_URL,
|
||||||
? `https://polygon-mumbai.g.alchemy.com/v2/${ALCHEMY_KEY}`
|
[ePolygonNetwork.matic]: process.env.POLYGON_RPC_URL,
|
||||||
: `https://polygon-mumbai.infura.io/v3/${INFURA_KEY}`,
|
|
||||||
[ePolygonNetwork.matic]: ALCHEMY_KEY
|
|
||||||
? `https://polygon-mainnet.g.alchemy.com/v2/${ALCHEMY_KEY}`
|
|
||||||
: `https://polygon-mainnet.infura.io/v3/${INFURA_KEY}`,
|
|
||||||
[eXDaiNetwork.xdai]: 'https://rpc.xdaichain.com/',
|
[eXDaiNetwork.xdai]: 'https://rpc.xdaichain.com/',
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ export async function resetFork(): Promise<void> {
|
|||||||
params: [
|
params: [
|
||||||
{
|
{
|
||||||
forking: {
|
forking: {
|
||||||
jsonRpcUrl: `https://eth-mainnet.alchemyapi.io/v2/${process.env.ALCHEMY_KEY}`,
|
jsonRpcUrl: process.env.MAINNET_RPC_URL,
|
||||||
blockNumber: 12012081,
|
blockNumber: 12012081,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user