Skip to content

Commit

Permalink
feat: add support for optimism chain (#1816)
Browse files Browse the repository at this point in the history
* feat: add support for optimism chain

* feat: add op sepolia testnet

* chore: fix OP chain config

* chore: update use-wallet

* refactor: remove deprecated ropsten network
  • Loading branch information
0xGabi authored Nov 10, 2023
1 parent 95706d3 commit 65f70b7
Show file tree
Hide file tree
Showing 5 changed files with 804 additions and 35 deletions.
9 changes: 2 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"scrypt": "github:barrysteyn/node-scrypt#fb60a8d3c158fe115a624b5ffa7480f3a24b03fb",
"secp256k1": "^4.0.2",
"styled-components": ">=4.0.0",
"use-wallet": "^0.13.6",
"use-wallet": "^0.15.0",
"web3": "^1.5.2",
"web3-eth-abi": "^1.5.2",
"web3-utils": "^1.5.2"
Expand Down Expand Up @@ -116,14 +116,12 @@
"start:mainnet": "cross-env ARAGON_ETH_NETWORK_TYPE=main npm start",
"start:goerli": "npm start",
"start:staging": "cross-env ARAGON_ENS_REGISTRY_ADDRESS=0xfe03625ea880a8cba336f9b5ad6e15b0a3b5a939 npm start",
"start:ropsten": "cross-env ARAGON_ETH_NETWORK_TYPE=ropsten npm start",
"start:xdai": "cross-env ARAGON_ETH_NETWORK_TYPE=xdai npm start",
"build": "node scripts/build",
"build:local": "node scripts/build-local",
"build:mainnet": "cross-env ARAGON_ETH_NETWORK_TYPE=main npm run build",
"build:goerli": "npm run build",
"build:staging": "cross-env ARAGON_ENS_REGISTRY_ADDRESS=0xfe03625ea880a8cba336f9b5ad6e15b0a3b5a939 npm run build",
"build:ropsten": "cross-env ARAGON_ETH_NETWORK_TYPE=ropsten npm run build",
"build:xdai": "cross-env ARAGON_ETH_NETWORK_TYPE=xdai npm run build",
"lint": "eslint ./src",
"test": "npm run lint && npm run jest",
Expand All @@ -139,10 +137,7 @@
"publish:goerli:patch": "npm run publish:patch -- --environment goerli --build-script build:goerli",
"publish:staging:major": "npm run publish:major -- --environment staging --build-script build:staging",
"publish:staging:minor": "npm run publish:minor -- --environment staging --build-script build:staging",
"publish:staging:patch": "npm run publish:patch -- --environment staging --build-script build:staging",
"publish:ropsten:major": "npm run publish:major -- --environment ropsten --build-script build:ropsten",
"publish:ropsten:minor": "npm run publish:minor -- --environment ropsten --build-script build:ropsten",
"publish:ropsten:patch": "npm run publish:patch -- --environment ropsten --build-script build:ropsten"
"publish:staging:patch": "npm run publish:patch -- --environment staging --build-script build:staging"
},
"browserslist": {
"development": ">2%, last 1 edge versions, not ie > 0, not op_mini all",
Expand Down
15 changes: 14 additions & 1 deletion src/ethereum-providers/connectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,20 @@ export const connectors = [
{
id: 'injected',
properties: {
chainId: [1, 5, 137, 80001, 1666600000, 1666700000, 97, 56, 588, 1088], // add here to handle more injected chains
chainId: [
1,
5,
10,
11155420,
137,
80001,
1666600000,
1666700000,
97,
56,
588,
1088,
], // add here to handle more injected chains
},
},
{
Expand Down
52 changes: 36 additions & 16 deletions src/network-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,40 +29,60 @@ export const networkConfigs = {
live: true,
},
},
[chains.getChainInformation(3).type]: {
isActive: false,
[chains.getChainInformation(5).type]: {
isActive: true,
addresses: {
ensRegistry:
localEnsRegistryAddress || '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e',
dai: DAI_GOERLI_TOKEN_ADDRESS,
governExecutorProxy: '0x0451533f685fe028c439821b7502e4cf63b4c32f',
},
nodes: {
defaultEth: 'wss://goerli.eth.aragon.network/ws',
},
connectGraphEndpoint:
'https://api.thegraph.com/subgraphs/name/aragon/aragon-goerli',
settings: {
chainId: 5,
testnet: true,
...chains.getChainInformation(5), // as returned by web3.eth.net.getNetworkType()
live: true,
},
},
[chains.getChainInformation(10).type]: {
isActive: true,
addresses: {
ensRegistry:
localEnsRegistryAddress || '0x6afe2cacee211ea9179992f89dc61ff25c61e923',
localEnsRegistryAddress || '0x6f2CA655f58d5fb94A08460aC19A552EB19909FD',
dai: '0xda10009cbd5d07dd0cecc66161fc93d7c9000da1',
governExecutorProxy: null,
},
nodes: {
defaultEth: 'wss://ropsten.eth.aragon.network/ws',
defaultEth: 'wss://optimism.publicnode.com/',
},
connectGraphEndpoint: null,
settings: {
chainId: 3,
testnet: true,
...chains.getChainInformation(3),
chainId: 10,
testnet: false,
...chains.getChainInformation(10),
live: true,
},
},
[chains.getChainInformation(5).type]: {
[chains.getChainInformation(11155420).type]: {
isActive: true,
addresses: {
ensRegistry:
localEnsRegistryAddress || '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e',
dai: DAI_GOERLI_TOKEN_ADDRESS,
governExecutorProxy: '0x0451533f685fe028c439821b7502e4cf63b4c32f',
localEnsRegistryAddress || '0xcb6c0101047dbbf242747c6f2e5a0a88f292dad4',
governExecutorProxy: null,
},
nodes: {
defaultEth: 'wss://goerli.eth.aragon.network/ws',
defaultEth: 'https://sepolia.optimism.io/',
},
connectGraphEndpoint:
'https://api.thegraph.com/subgraphs/name/aragon/aragon-goerli',
connectGraphEndpoint: null,
settings: {
chainId: 5,
chainId: 11155420,
testnet: true,
...chains.getChainInformation(5), // as returned by web3.eth.net.getNetworkType()
...chains.getChainInformation(11155420),
live: true,
},
},
Expand Down
4 changes: 2 additions & 2 deletions src/templates/dandelion/config/helpers/getBlockTime.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Estimates based on block propagation rates in Feb. 2020
const NETWORK_TIMES = new Map([
['main', 13],
['kovan', 4],
['ropsten', 11],
['goerli', 15],
['private', 2],
['optimism', 2],
['op-sepolia', 2],
['matic', 2],
['mumbai', 2],
['harmonyTest', 2],
Expand Down
Loading

0 comments on commit 65f70b7

Please sign in to comment.