5caaaf1b1f
* test(e2e): switching network Co-authored-by: Jordan Frankfurt <<jordan@CORN-Jordan-949.frankfurt> * fix: reconnect after failed chain switch * test(e2e): add forks to hardhat.config * test(e2e): wait on wallet_switchEthereumChain * build: upgrade cypress-hardhat * fix: do not disconnect whilst switching * fix: unit tests * fix: better chain selector check * test(e2e): better helper fn naming * test(e2e): better stub naming * fix: doc re-activation * fix: add back click * build: upgrade cypress-hardhat to include network caching * unwrap web3status --------- Co-authored-by: Jordan Frankfurt <<jordan@CORN-Jordan-949.frankfurt>
47 lines
1.3 KiB
JavaScript
47 lines
1.3 KiB
JavaScript
import { SupportedChainId } from '@uniswap/sdk-core'
|
|
|
|
/* eslint-env node */
|
|
require('dotenv').config()
|
|
|
|
// Block selection is arbitrary, as e2e tests will build up their own state.
|
|
// The only requirement is that all infrastructure under test (eg Permit2 contracts) are already deployed.
|
|
// TODO(WEB-2187): Make more dynamic to avoid manually updating
|
|
const BLOCK_NUMBER = 17388567
|
|
const POLYGON_BLOCK_NUMBER = 43600000
|
|
|
|
const forkingConfig = {
|
|
httpHeaders: {
|
|
Origin: 'localhost:3000', // infura allowlists requests by origin
|
|
},
|
|
}
|
|
|
|
const forks = {
|
|
[SupportedChainId.MAINNET]: {
|
|
url: `https://mainnet.infura.io/v3/${process.env.REACT_APP_INFURA_KEY}`,
|
|
blockNumber: BLOCK_NUMBER,
|
|
...forkingConfig,
|
|
},
|
|
[SupportedChainId.POLYGON]: {
|
|
url: `https://polygon-mainnet.infura.io/v3/${process.env.REACT_APP_INFURA_KEY}`,
|
|
blockNumber: POLYGON_BLOCK_NUMBER,
|
|
...forkingConfig,
|
|
},
|
|
}
|
|
|
|
module.exports = {
|
|
forks,
|
|
networks: {
|
|
hardhat: {
|
|
chainId: SupportedChainId.MAINNET,
|
|
forking: forks[SupportedChainId.MAINNET],
|
|
accounts: {
|
|
count: 2,
|
|
},
|
|
mining: {
|
|
auto: true, // automine to make tests easier to write.
|
|
interval: 0, // do not interval mine so that tests remain deterministic
|
|
},
|
|
},
|
|
},
|
|
}
|