diff --git a/.env.example b/.env.example index 3480c20..6c9b499 100644 --- a/.env.example +++ b/.env.example @@ -10,6 +10,13 @@ PORT=8080 # RPC_URL_42161=wss://arbitrum-mainnet.io/ws/v3/your-infura-key # RPC_URL_11155111=https://sepolia.infura.io/v3/your-infura-key +# CoW API +COW_API_BASE_URL=https://api.cow.fi +# COW_API_URL_1=https://api.cow.fi/mainnet +# COW_API_URL_100=https://api.cow.fi/xdai +# COW_API_URL_42161=https://api.cow.fi/arbitrum_one +# COW_API_URL_11155111=https://api.cow.fi/sepolia + # Caching REDIS_HOST=redis # REDIS_PORT=6379 diff --git a/libs/repositories/src/datasources/cowApi.ts b/libs/repositories/src/datasources/cowApi.ts index df187ba..af07914 100644 --- a/libs/repositories/src/datasources/cowApi.ts +++ b/libs/repositories/src/datasources/cowApi.ts @@ -17,8 +17,12 @@ const COW_API_NETWORK_NAMES: Record = { export const cowApiClients = ALL_CHAIN_IDS.reduce< Record >((acc, chainId) => { + const cowApiUrl = + process.env[`COW_API_URL_${chainId}`] || + COW_API_BASE_URL + '/' + COW_API_NETWORK_NAMES[chainId]; + acc[chainId] = createClient({ - baseUrl: COW_API_BASE_URL + '/' + COW_API_NETWORK_NAMES[chainId], + baseUrl: cowApiUrl, }); return acc;