Skip to content

Commit 206292b

Browse files
feat(config): add CHAIN_CONFIG for multichain support
1 parent 3385b75 commit 206292b

File tree

1 file changed

+39
-17
lines changed

1 file changed

+39
-17
lines changed

src/config/config.ts

Lines changed: 39 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,43 @@
1-
export const WEB3TELEGRAM_DAPP_ADDRESS = 'web3telegram.apps.iexec.eth';
2-
3-
export const WHITELIST_SMART_CONTRACT_ADDRESS =
4-
'0x192C6f5AccE52c81Fcc2670f10611a3665AAA98F';
5-
6-
export const PROD_WORKERPOOL_ADDRESS = 'prod-v8-bellecour.main.pools.iexec.eth';
7-
8-
export const DATAPROTECTOR_SUBGRAPH_ENDPOINT =
9-
'https://thegraph.iex.ec/subgraphs/name/bellecour/dataprotector-v2';
10-
111
export const MAX_DESIRED_DATA_ORDER_PRICE = 0;
12-
132
export const MAX_DESIRED_APP_ORDER_PRICE = 0;
14-
153
export const MAX_DESIRED_WORKERPOOL_ORDER_PRICE = 0;
16-
17-
export const IPFS_UPLOAD_URL = '/dns4/ipfs-upload.v8-bellecour.iex.ec/https';
18-
19-
export const DEFAULT_IPFS_GATEWAY = 'https://ipfs-gateway.v8-bellecour.iex.ec';
20-
214
export const ANY_DATASET_ADDRESS = 'any';
5+
6+
export const CHAIN_IDS = {
7+
BELLECOUR: 134,
8+
AVALANCHE_FUJI: 43113,
9+
ARBITRUM_SEPOLIA: 421614,
10+
} as const;
11+
12+
export const DEFAULT_CHAIN_ID = CHAIN_IDS.BELLECOUR;
13+
14+
interface ChainConfig {
15+
name: string;
16+
dappAddress: string;
17+
prodWorkerpoolAddress: string;
18+
dataProtectorSubgraph: string;
19+
ipfsUploadUrl: string;
20+
ipfsGateway: string;
21+
whitelistSmartContract: string;
22+
}
23+
24+
export const CHAIN_CONFIG: Record<number, ChainConfig> = {
25+
[CHAIN_IDS.BELLECOUR]: {
26+
name: 'bellecour',
27+
dappAddress: 'web3telegram.apps.iexec.eth',
28+
prodWorkerpoolAddress: 'prod-v8-bellecour.main.pools.iexec.eth',
29+
dataProtectorSubgraph:
30+
'https://thegraph.iex.ec/subgraphs/name/bellecour/dataprotector-v2',
31+
ipfsUploadUrl: '/dns4/ipfs-upload.v8-bellecour.iex.ec/https',
32+
ipfsGateway: 'https://ipfs-gateway.v8-bellecour.iex.ec',
33+
whitelistSmartContract: '0x192C6f5AccE52c81Fcc2670f10611a3665AAA98F',
34+
},
35+
};
36+
37+
export function getChainConfig(chainId: number): ChainConfig {
38+
const config = CHAIN_CONFIG[chainId];
39+
if (!config) {
40+
throw new Error(`Unsupported chain ID: ${chainId}`);
41+
}
42+
return config;
43+
}

0 commit comments

Comments
 (0)