Skip to content

Commit

Permalink
feat: add base network (#223)
Browse files Browse the repository at this point in the history
* feat: add base network

* chore: bump version to 5.7.0-RC.0
  • Loading branch information
alfetopito authored Nov 6, 2024
1 parent d30a891 commit 53f24f4
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 4 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down Expand Up @@ -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',
},
})
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -100,4 +100,4 @@
"typescript",
"subgraph"
]
}
}
1 change: 1 addition & 0 deletions src/common/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ export enum SupportedChainId {
MAINNET = 1,
GNOSIS_CHAIN = 100,
ARBITRUM_ONE = 42161,
BASE = 8453,
SEPOLIA = 11155111,
}
6 changes: 5 additions & 1 deletion src/common/configs.ts
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -42,6 +42,8 @@ export type PartialApiContext = Partial<ApiContext>
/**
* @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<SupportedChainId, string>
Expand All @@ -53,6 +55,8 @@ export type ApiBaseUrls = Record<SupportedChainId, string>
* {@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.
Expand Down
2 changes: 2 additions & 0 deletions src/order-book/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
}

Expand All @@ -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',
}

Expand Down
2 changes: 2 additions & 0 deletions src/subgraph/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}

Expand All @@ -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,
}

Expand Down

0 comments on commit 53f24f4

Please sign in to comment.