diff --git a/src/common/chains.ts b/src/common/chains.ts index 80e21698..69b7fd9f 100644 --- a/src/common/chains.ts +++ b/src/common/chains.ts @@ -6,4 +6,5 @@ export enum SupportedChainId { MAINNET = 1, GOERLI = 5, GNOSIS_CHAIN = 100, + SEPOLIA = 11155111, } diff --git a/src/common/consts.ts b/src/common/consts.ts index da014b94..cba962ab 100644 --- a/src/common/consts.ts +++ b/src/common/consts.ts @@ -1,12 +1,11 @@ import { SupportedChainId } from './chains' -import contractNetworks from '@cowprotocol/contracts/networks.json' - -const { GPv2Settlement } = JSON.parse(contractNetworks as unknown as string) as typeof contractNetworks export const BUY_ETH_ADDRESS = '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE' export const EXTENSIBLE_FALLBACK_HANDLER = '0x2f55e8b20D0B9FEFA187AA7d00B6Cbe563605bF5' export const COMPOSABLE_COW = '0xfdaFc9d1902f4e0b84f65F49f244b32b31013b74' +const SETTLEMENT_CONTRACT = '0x9008D19f58AAbD9eD0D60971565AA8510560ab41' + /** * The list of supported chains. */ @@ -14,37 +13,30 @@ export const ALL_SUPPORTED_CHAIN_IDS: SupportedChainId[] = [ SupportedChainId.MAINNET, SupportedChainId.GOERLI, SupportedChainId.GNOSIS_CHAIN, + SupportedChainId.SEPOLIA, ] +const mapAddressToNetworks: (address: string) => Record = (address: string) => { + return ALL_SUPPORTED_CHAIN_IDS.reduce>( + (acc, chainId) => ({ + ...acc, + [chainId]: address, + }), + {} + ) +} + /** * An object containing the addresses of the CoW Protocol settlement contracts for each supported chain. */ -export const COW_PROTOCOL_SETTLEMENT_CONTRACT_ADDRESS = ALL_SUPPORTED_CHAIN_IDS.reduce>( - (acc, chainId) => ({ - ...acc, - [chainId]: GPv2Settlement[chainId].address, - }), - {} -) +export const COW_PROTOCOL_SETTLEMENT_CONTRACT_ADDRESS = mapAddressToNetworks(SETTLEMENT_CONTRACT) /** * An object containing the addresses of the `ExtensibleFallbackHandler` contracts for each supported chain. */ -export const EXTENSIBLE_FALLBACK_HANDLER_CONTRACT_ADDRESS = ALL_SUPPORTED_CHAIN_IDS.reduce>( - (acc, chainId) => ({ - ...acc, - [chainId]: EXTENSIBLE_FALLBACK_HANDLER, - }), - {} -) +export const EXTENSIBLE_FALLBACK_HANDLER_CONTRACT_ADDRESS = mapAddressToNetworks(EXTENSIBLE_FALLBACK_HANDLER) /** * An object containing the addresses of the `ComposableCow` contracts for each supported chain. */ -export const COMPOSABLE_COW_CONTRACT_ADDRESS = ALL_SUPPORTED_CHAIN_IDS.reduce>( - (acc, chainId) => ({ - ...acc, - [chainId]: COMPOSABLE_COW, - }), - {} -) +export const COMPOSABLE_COW_CONTRACT_ADDRESS = mapAddressToNetworks(COMPOSABLE_COW) diff --git a/src/order-book/api.ts b/src/order-book/api.ts index 942b001a..eb420497 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.GOERLI]: 'https://api.cow.fi/goerli', + [SupportedChainId.SEPOLIA]: 'https://api.cow.fi/sepolia', } /** @@ -48,6 +49,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.GOERLI]: 'https://barn.api.cow.fi/goerli', + [SupportedChainId.SEPOLIA]: 'https://barn.api.cow.fi/sepolia', } function cleanObjectFromUndefinedValues(obj: Record): typeof obj { diff --git a/src/order-book/generated/models/OrderPostError.ts b/src/order-book/generated/models/OrderPostError.ts index c1fee9ac..6aa0d310 100644 --- a/src/order-book/generated/models/OrderPostError.ts +++ b/src/order-book/generated/models/OrderPostError.ts @@ -23,20 +23,17 @@ export namespace OrderPostError { SELL_AMOUNT_OVERFLOW = 'SellAmountOverflow', TRANSFER_SIMULATION_FAILED = 'TransferSimulationFailed', ZERO_AMOUNT = 'ZeroAmount', - INCOMPATIBLE_SIGNING_SCHEME = 'IncompatibleSigningScheme', - UNSUPPORTED_BUY_TOKEN_DESTINATION = 'UnsupportedBuyTokenDestination', + INCOMPATIBLE_SIGNING_SCHEME = 'IncompatibleSigningScheme', + TOO_MANY_LIMIT_ORDERS_UNSUPPORTED_BUY_TOKEN_DESTINATION = 'TooManyLimitOrders UnsupportedBuyTokenDestination', UNSUPPORTED_SELL_TOKEN_SOURCE = 'UnsupportedSellTokenSource', UNSUPPORTED_ORDER_TYPE = 'UnsupportedOrderType', INSUFFICIENT_VALID_TO = 'InsufficientValidTo', EXCESSIVE_VALID_TO = 'ExcessiveValidTo', TRANSFER_ETH_TO_CONTRACT = 'TransferEthToContract', - INVALID_NATIVE_SELL_TOKEN = 'InvalidNativeSellToken', - SAME_BUY_AND_SELL_TOKEN = 'SameBuyAndSellToken', + INVALID_NATIVE_SELL_TOKEN_SAME_BUY_AND_SELL_TOKEN = 'InvalidNativeSellToken SameBuyAndSellToken', UNSUPPORTED_SIGNATURE = 'UnsupportedSignature', - TOO_MANY_LIMIT_ORDERS= 'TooManyLimitOrders', - INVALID_APP_DATA = 'InvalidAppData', UNSUPPORTED_TOKEN = 'UnsupportedToken', - UNSUPPORTED_CUSTOM_INTERACTION = 'UnsupportedCustomInteraction', + UNSUPPORTED_CUSTOM_INTERACTION_INVALID_APP_DATA = 'UnsupportedCustomInteraction InvalidAppData', APP_DATA_HASH_MISMATCH = 'AppDataHashMismatch', } diff --git a/src/subgraph/api.ts b/src/subgraph/api.ts index f4a3a001..a75674ab 100644 --- a/src/subgraph/api.ts +++ b/src/subgraph/api.ts @@ -18,6 +18,7 @@ export const SUBGRAPH_PROD_CONFIG: ApiBaseUrls = { [SupportedChainId.MAINNET]: SUBGRAPH_BASE_URL + '/cow', [SupportedChainId.GNOSIS_CHAIN]: SUBGRAPH_BASE_URL + '/cow-gc', [SupportedChainId.GOERLI]: SUBGRAPH_BASE_URL + '/cow-goerli', + [SupportedChainId.SEPOLIA]: SUBGRAPH_BASE_URL + '/cow-sepolia', } /** @@ -30,6 +31,7 @@ export const SUBGRAPH_STAGING_CONFIG: ApiBaseUrls = { [SupportedChainId.MAINNET]: SUBGRAPH_BASE_URL + '/cow-staging', [SupportedChainId.GNOSIS_CHAIN]: SUBGRAPH_BASE_URL + '/cow-gc-staging', [SupportedChainId.GOERLI]: '', + [SupportedChainId.SEPOLIA]: '', } /**