Skip to content

Commit

Permalink
Merge pull request #327 from oceanprotocol/feature/use_networkId
Browse files Browse the repository at this point in the history
use networkID instead of chainId
  • Loading branch information
alexcos20 authored Oct 2, 2020
2 parents 0526778 + 45f3772 commit 87bdf2b
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions src/utils/ConfigHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,25 @@ export declare type ConfigHelperNetworkName =
export declare type ConfigHelperNetworkId = 1 | 4 | number

export interface ConfigHelperConfig extends Config {
chainId: ConfigHelperNetworkId
networkId: ConfigHelperNetworkId
network: ConfigHelperNetworkName
}

const configs: ConfigHelperConfig[] = [
{
chainId: null,
networkId: null,
network: 'unknown',
nodeUri: 'http://localhost:8545',
factoryAddress: null,
metadataStoreUri: 'http://127.0.0.1:5000',
providerUri: 'http://127.0.0.1:8030',
poolFactoryAddress: null,
fixedRateExchangeAddress: null,
metadataContractAddress: null
},
{
// barge
networkId: 8996,
network: 'development',
nodeUri: 'http://localhost:8545',
factoryAddress: null,
Expand All @@ -29,7 +41,7 @@ const configs: ConfigHelperConfig[] = [
metadataContractAddress: null
},
{
chainId: 4,
networkId: 4,
network: 'rinkeby',
nodeUri: 'https://rinkeby.infura.io/v3',
factoryAddress: '0x241D0f315d2bfe32b90282e6863AC22A309EbFa0',
Expand All @@ -41,7 +53,7 @@ const configs: ConfigHelperConfig[] = [
metadataContractAddress: '0x0220D0b4FfCC4A14C7601215aA23da06d5b1c921'
},
{
chainId: 1,
networkId: 1,
network: 'mainnet',
nodeUri: 'https://mainnet.infura.io/v3',
factoryAddress: '0x1234',
Expand Down Expand Up @@ -87,7 +99,7 @@ export class ConfigHelper {
network: ConfigHelperNetworkName | ConfigHelperNetworkId,
infuraProjectId?: string
): Config {
const filterBy = typeof network === 'string' ? 'network' : 'chainId'
const filterBy = typeof network === 'string' ? 'network' : 'networkId'
let config = configs.find((c) => c[filterBy] === network)

if (!config) {
Expand Down

0 comments on commit 87bdf2b

Please sign in to comment.