From bcf20d9a32265ad838fda1efd5bf30afb3d66fee Mon Sep 17 00:00:00 2001 From: Alfetopito Date: Thu, 24 Oct 2024 08:46:43 +0100 Subject: [PATCH 1/2] feat: add base network --- README.md | 3 ++- src/common/chains.ts | 1 + src/common/configs.ts | 6 +++++- src/order-book/api.ts | 2 ++ src/subgraph/api.ts | 2 ++ 5 files changed, 12 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 235d7408..055102d3 100644 --- a/README.md +++ b/README.md @@ -105,7 +105,7 @@ Since the API supports different networks and environments, there are some optio #### Environment configuration -`chainId` - can be one of `SupportedChainId.MAINNET`, `SupportedChainId.GNOSIS_CHAIN`, `SupportedChainId.ARBITRUM_ONE` or `SupportedChainId.SEPOLIA` +`chainId` - can be one of `SupportedChainId.MAINNET`, `SupportedChainId.GNOSIS_CHAIN`, `SupportedChainId.ARBITRUM_ONE`, `SupportedChainId.BASE` or `SupportedChainId.SEPOLIA` `env` - this parameter affects which environment will be used: @@ -135,6 +135,7 @@ const orderBookApi = new OrderBookApi({ [SupportedChainId.MAINNET]: 'https://YOUR_ENDPOINT/mainnet', [SupportedChainId.GNOSIS_CHAIN]: 'https://YOUR_ENDPOINT/gnosis_chain', [SupportedChainId.ARBITRUM]: 'https://YOUR_ENDPOINT/arbitrum_one', + [SupportedChainId.BASE]: 'https://YOUR_ENDPOINT/base', [SupportedChainId.SEPOLIA]: 'https://YOUR_ENDPOINT/sepolia', }, }) diff --git a/src/common/chains.ts b/src/common/chains.ts index 28e847b4..8e916da4 100644 --- a/src/common/chains.ts +++ b/src/common/chains.ts @@ -6,5 +6,6 @@ export enum SupportedChainId { MAINNET = 1, GNOSIS_CHAIN = 100, ARBITRUM_ONE = 42161, + BASE = 8453, SEPOLIA = 11155111, } diff --git a/src/common/configs.ts b/src/common/configs.ts index 488f7839..ad3cd48e 100644 --- a/src/common/configs.ts +++ b/src/common/configs.ts @@ -1,6 +1,6 @@ -import { SupportedChainId } from './chains' import { BackoffOptions } from 'exponential-backoff' import { RateLimiterOpts } from 'limiter/dist/esm' +import { SupportedChainId } from './chains' /** * IPFS configuration. @@ -42,6 +42,8 @@ export type PartialApiContext = Partial /** * @property {string} [1] The base URL for the mainnet API. * @property {string} [100] The base URL for the Gnosis Chain API. + * @property {string} [42161] The base URL for the Arbitrum One API. + * @property {string} [8453] The base URL for the Base API. * @property {string} [11155111] The base URL for the Sepolia testnet API. */ export type ApiBaseUrls = Record @@ -53,6 +55,8 @@ export type ApiBaseUrls = Record * {@link SupportedChainId Supported chains} are: * - Mainnet * - Gnosis Chain + * - Arbitrum One + * - Base * - Sepolia * * Each chain has it's own API, and each API has it's own base URL. diff --git a/src/order-book/api.ts b/src/order-book/api.ts index bf2e457e..0af88598 100644 --- a/src/order-book/api.ts +++ b/src/order-book/api.ts @@ -39,6 +39,7 @@ export const ORDER_BOOK_PROD_CONFIG: ApiBaseUrls = { [SupportedChainId.MAINNET]: 'https://api.cow.fi/mainnet', [SupportedChainId.GNOSIS_CHAIN]: 'https://api.cow.fi/xdai', [SupportedChainId.ARBITRUM_ONE]: 'https://api.cow.fi/arbitrum_one', + [SupportedChainId.BASE]: 'https://api.cow.fi/base', [SupportedChainId.SEPOLIA]: 'https://api.cow.fi/sepolia', } @@ -49,6 +50,7 @@ export const ORDER_BOOK_STAGING_CONFIG: ApiBaseUrls = { [SupportedChainId.MAINNET]: 'https://barn.api.cow.fi/mainnet', [SupportedChainId.GNOSIS_CHAIN]: 'https://barn.api.cow.fi/xdai', [SupportedChainId.ARBITRUM_ONE]: 'https://barn.api.cow.fi/arbitrum_one', + [SupportedChainId.BASE]: 'https://barn.api.cow.fi/base', [SupportedChainId.SEPOLIA]: 'https://barn.api.cow.fi/sepolia', } diff --git a/src/subgraph/api.ts b/src/subgraph/api.ts index 4b4dcde3..13337e0b 100644 --- a/src/subgraph/api.ts +++ b/src/subgraph/api.ts @@ -25,6 +25,7 @@ export const SUBGRAPH_PROD_CONFIG: SubgraphApiBaseUrls = { [SupportedChainId.MAINNET]: SUBGRAPH_BASE_URL + '/cow', [SupportedChainId.GNOSIS_CHAIN]: SUBGRAPH_BASE_URL + '/cow-gc', [SupportedChainId.ARBITRUM_ONE]: null, + [SupportedChainId.BASE]: null, [SupportedChainId.SEPOLIA]: null, } @@ -38,6 +39,7 @@ export const SUBGRAPH_STAGING_CONFIG: SubgraphApiBaseUrls = { [SupportedChainId.MAINNET]: SUBGRAPH_BASE_URL + '/cow-staging', [SupportedChainId.GNOSIS_CHAIN]: SUBGRAPH_BASE_URL + '/cow-gc-staging', [SupportedChainId.ARBITRUM_ONE]: null, + [SupportedChainId.BASE]: null, [SupportedChainId.SEPOLIA]: null, } From a27eb375c4f885ac975120e93db9634f8008b5ba Mon Sep 17 00:00:00 2001 From: Alfetopito Date: Thu, 24 Oct 2024 08:49:21 +0100 Subject: [PATCH 2/2] chore: bump version to 5.7.0-RC.0 --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index ec7f7b3a..1f780415 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@cowprotocol/cow-sdk", - "version": "5.6.0", + "version": "5.7.0-RC.0", "license": "(MIT OR Apache-2.0)", "files": [ "/dist" @@ -100,4 +100,4 @@ "typescript", "subgraph" ] -} +} \ No newline at end of file