* Added help center article link to step 2 * Removed deprecated wallets (#1922) * Bump new onboardjs version * Fix notification re-appears (#1925) * (Fix) - #1775 Nonce of cancel transaction calculation (#1886) * Fix how the nonce of the cancel transaction is calculated * make use useState to handle nonce state * fix to prevent "0" being treated as undefined * (Fix) - #1707 Cannot use larger numbers in contract interaction (#1863) * Remove withStyles from TextAreaField and fix name * Remove any type in handleSubmit from contractInteraction review * Parses the bignumber value to string * Added link to docs for custom app modal * Fix styles to match design * Fix nonce 0 check (#1941) * Use tooltip from SRC (#1888) * Upgrade safe-react-components to latest version * fix New Transaction button * Increase the date/time tooltip size * Feature: Add Mushrooms finance app (#1893) * add mushrooms finance app * Migrate to GitHub actions (#1924) * Add Github action for each network environment * Move deploy scripts to new folder * Adapt deploy scripts to Github actions * Run coveralls only if tests succeed * Upload sentry source map * Add Production flag for tagged builds * Use coveralls Github Action * Add debug steps to all networks for first release test * Avoid to remove the current loaded safe data if the batch request fail (#1847) * Fix gas estimation (#1944) * Fix gas estimation for threshold > 4 * Update gas estimation to be more precise * Add threshold gas costs on transaction creation estimation Co-authored-by: Daniel Sanchez <daniel.sanchez@gnosis.pm> * update ipfs hash for wc app (#1954) * Update endpoint to use new name (#1955) * (Fix) Transactions infinite scroll (#1931) * install `react-intersection-observer` dependency - also, remove `react-infinite-scroll-component` * refactor `InfiniteScroll` to be used with `react-intersection-observer` * build an infinite scroll wrapper for transactions based on `InfiniteScroll` * recover `TxsInfiniteScrollContext` information to identify the last item in a list - a new component was created for History transactions: `HistoryTransactions` as a wrapper * refactor lists to use `TxsInfiniteScrollContext` and identify the last item in the list * allow to pass config to the InfiniteScroll component - also changed default bottom margin so the txs loading starts a bit earlier * fix memory consumption issue based on nft retrieval/update data * delay `lastItemId` set to next tick, to prevent multiple updates during the same render phase * Set triggerOnce to infinitescroll * Fix gas estimation (#1959) * Fix type of fetchSafeCollectibles (#1971) * Fix transaction list infinite loading (#1973) * Check transaction list before trying to assing guard element to infinite scroll in pending list (#1972) * Fix execute if collected signs is > to threshold (#1968) * Feature: Add lido finance app (#1960) * Add pooltogether safe app (#1946) * fix isExecute in useEstimateTransactionGas (#1981) * Set V3.1.0 Co-authored-by: Mati Dastugue <mdastugu@amazon.com> Co-authored-by: Mati Dastugue <matias.dastugue@altoros.com> Co-authored-by: nicolas <nicosampler@users.noreply.github.com> Co-authored-by: Agustin Pane <agustin.pane@gmail.com> Co-authored-by: Fernando <fernando.greco@gmail.com> Co-authored-by: Agustín Longoni <agustin.longoni@altoros.com> Co-authored-by: Mikhail Mikheev <mmvsha73@gmail.com> Co-authored-by: nicosampler <nf.dominguez.87@gmail.com>
8.2 KiB
Network Configuration
Network configuration structure
We have currently this structure for the network configuration:
- This is the main configuration that you need to provide in order to add a new network.
export interface NetworkConfig {
network: NetworkSettings
disabledFeatures?: SafeFeatures
disabledWallets?: Wallets
environment: SafeEnvironments
}
NetworkSettings
- It contains the Ethereum compatible network id, the network name, information about the native coin of that network and a boolean to indicate if the network is a testnet or a production network.
export type NetworkSettings = {
id: ETHEREUM_NETWORK,
backgroundColor: string,
textColor: string,
label: string,
isTestNet: boolean,
nativeCoin: Token,
}
- Currently supported Ethereum compatible networks:
export enum ETHEREUM_NETWORK {
MAINNET = 1,
MORDEN = 2,
ROPSTEN = 3,
RINKEBY = 4,
GOERLI = 5,
KOVAN = 42,
XDAI = 100,
ENERGY_WEB_CHAIN = 246,
VOLTA = 73799,
UNKNOWN = 0,
LOCAL = 4447,
}
- This is the structure to define the native coin:
type Token = {
address: string
name: string
symbol: string
decimals: number
logoUri?: string
}
SafeFeatures
It's an array that contains a list of features that should be disabled for the network. It's empty by default.
export type SafeFeatures = FEATURES[]
export enum FEATURES {
ERC721 = 'ERC721',
ERC1155 = 'ERC1155',
SAFE_APPS = 'SAFE_APPS',
CONTRACT_INTERACTION = 'CONTRACT_INTERACTION',
DOMAIN_LOOKUP = 'DOMAIN_LOOKUP'
}
Wallets
It's an array that contains a list of wallets that will be disabled for the network. It's empty by default.
export type Wallets = WALLETS[]
export enum WALLETS {
METAMASK = 'metamask',
WALLET_CONNECT = 'walletConnect',
TREZOR = 'trezor',
LEDGER = 'ledger',
TRUST = 'trust',
FORTMATIC = 'fortmatic',
PORTIS = 'portis',
AUTHEREUM = 'authereum',
TORUS = 'torus',
COINBASE = 'coinbase',
WALLET_LINK = 'walletLink',
OPERA = 'opera',
OPERA_TOUCH = 'operaTouch'
}
SafeEnviroments
If the network has different enviroments, you can add them here, otherwise you should only add production settings
type SafeEnvironments = {
dev?: EnvironmentSettings
staging?: EnvironmentSettings
production: EnvironmentSettings
}
We use a transaction service (txServiceUrl) to fetch transactions and balances of each safe and also to POST messages with the created transactions, this should be provided by Gnosis.
The networkExplorer parameters are used to provide information related to the networkExplorer used for the given network (Blockscout for xDai, Etherscan for mainnet, etc). This is used for link transaction hashes and addresses to the given network explorer.
export type EnvironmentSettings = GasPrice & {
txServiceUrl: string
relayApiUrl?: string
safeAppsUrl: string
rpcServiceUrl: string
networkExplorerName: string
networkExplorerUrl: string
networkExplorerApiUrl: string
}
The gasPrice is used to indicate a fixed amount for some networks (like xDai), otherwise you can provide an oracle we can use to fetch the current gas price.
type GasPrice = {
gasPrice: number
gasPriceOracle?: GasPriceOracle
} | {
gasPrice?: number
// for infura there's a REST API Token required stored in: `REACT_APP_INFURA_TOKEN`
gasPriceOracle: GasPriceOracle
}
export type GasPriceOracle = {
url: string
// Different gas api providers can use a different name to reflect different gas levels based on tx speed
// For example in ethGasStation for ETHEREUM_MAINNET = safeLow | average | fast
gasParameter: string
}
Enviroment variables:
- REACT_APP_NETWORK: name of the used network (ex: xDai, mainnet, rinkeby)
- REACT_APP_GOOGLE_ANALYTICS: Used for enabling google analytics
- REACT_APP_PORTIS_ID: Portis ID for enabling it on given network
- REACT_APP_FORTMATIC_KEY: Formatic yey for given network
How to add a network
- In case that it is not already supported, add the network on the ETHEREUM_NETWORK enum in
src/config/networks/network.d.ts
export enum ETHEREUM_NETWORK {
MAINNET = 1,
MORDEN = 2,
ROPSTEN = 3,
RINKEBY = 4,
GOERLI = 5,
KOVAN = 42,
XDAI = 100,
ENERGY_WEB_CHAIN = 246,
VOLTA = 73799,
UNKNOWN = 0,
LOCAL = 4447,
}
- Add env variables:
- REACT_APP_NETWORK
- REACT_APP_GOOGLE_ANALYTICS
- REACT_APP_PORTIS_ID
- REACT_APP_FORTMATIC_KEY
- Add the NetworkSettings in
src/config/networksas<network_name>.ts:
import { EnvironmentSettings, ETHEREUM_NETWORK, NetworkConfig } from 'src/config/networks/network.d'
const baseConfig: EnvironmentSettings = {
txServiceUrl: '',
safeAppsUrl: '',
gasPriceOracleUrl: '',
gasPriceOracle: {
url: '',
gasParameter: '',
},
rpcServiceUrl: '',
networkExplorerName: '',
networkExplorerUrl: '',
networkExplorerApiUrl: '',
}
const rinkeby: NetworkConfig = {
environment: {
dev: {
...baseConfig,
},
staging: {
...baseConfig,
safeAppsUrl: '',
},
production: {
...baseConfig,
txServiceUrl: '',
safeAppsUrl: '',
},
},
network: {
id: ETHEREUM_NETWORK.<NETWORK_NAME>,
backgroundColor: '',
textColor: '',
label: '',
isTestNet: true/false,
nativeCoin: {
address: '',
name: '',
symbol: '',
decimals: 0,
logoUri: '',
},
},
disabledFeatures: [],
disabledWallets: []
}
export default <NETWORK_NAME>
Configuration example (xDai) - fixed gas price
- ETHEREUM_NETWORK
export enum ETHEREUM_NETWORK {
MAINNET = 1,
MORDEN = 2,
ROPSTEN = 3,
RINKEBY = 4,
GOERLI = 5,
KOVAN = 42,
XDAI = 100, -> ADDED XDAI
ENERGY_WEB_CHAIN = 246,
VOLTA = 73799,
UNKNOWN = 0,
LOCAL = 4447,
}
- Network file xdai
import { ETHEREUM_NETWORK, NetworkConfig } from 'src/config/networks/network.d'
const xDai: NetworkConfig = {
environment: {
production: {
txServiceUrl: 'https://safe-transaction.xdai.gnosis.io/api/v1',
safeAppsUrl: 'https://safe-apps-xdai.staging.gnosisdev.com',
gasPrice: 1e9,
rpcServiceUrl: 'https://dai.poa.network/',
networkExplorerName: 'Blockscout',
networkExplorerUrl: 'https://blockscout.com/poa/xdai',
networkExplorerApiUrl: 'https://blockscout.com/poa/xdai/api',
},
},
network: {
id: ETHEREUM_NETWORK.XDAI,
backgroundColor: '#48A8A6',
textColor: '#ffffff',
label: 'xDai',
isTestNet: false,
nativeCoin: {
address: '0x000',
name: 'xDai',
symbol: 'xDai',
decimals: 18,
logoUri: xDaiLogo,
},
},
disabledWallets:[
WALLETS.TREZOR,
WALLETS.LEDGER
]
}
export default xDai
Configuration example (Mainnet) - gas price retrieven by oracle
Network file mainnet
const baseConfig: EnvironmentSettings = {
txServiceUrl: 'https://safe-transaction.mainnet.staging.gnosisdev.com/api/v1',
safeAppsUrl: 'https://safe-apps.dev.gnosisdev.com',
gasPriceOracle: {
url: 'https://ethgasstation.info/json/ethgasAPI.json',
gasParameter: 'average',
},
rpcServiceUrl: 'https://mainnet.infura.io:443/v3',
networkExplorerName: 'Etherscan',
networkExplorerUrl: 'https://etherscan.io',
networkExplorerApiUrl: 'https://api.etherscan.io/api',
}
const mainnet: NetworkConfig = {
environment: {
dev: {
...baseConfig,
},
staging: {
...baseConfig,
safeAppsUrl: 'https://safe-apps.staging.gnosisdev.com',
},
production: {
...baseConfig,
txServiceUrl: 'https://safe-transaction.mainnet.gnosis.io/api/v1',
safeAppsUrl: 'https://apps.gnosis-safe.io',
},
},
network: {
id: ETHEREUM_NETWORK.MAINNET,
backgroundColor: '#E8E7E6',
textColor: '#001428',
label: 'Mainnet',
isTestNet: false,
nativeCoin: {
address: '0x000',
name: 'Ether',
symbol: 'ETH',
decimals: 18,
logoUri: EtherLogo,
},
}
}
export default mainnet