@cowprotocol/sdk-config
v0.6.2
Published
Configuration constants and settings for CoW Protocol SDK
Downloads
9,393
Keywords
Readme
SDK Config
This package contains configuration constants, chain definitions, and settings for the CoW Protocol SDK. It provides essential configuration utilities and types that are used across all SDK packages.
What's included
- Supported Chains - Definitions for all blockchains supported by CoW Protocol
- Environment Configuration - Production and staging environment settings
- Contract Addresses - Smart contract addresses for each supported chain
- API Configuration - Base URLs and configuration options for CoW Protocol APIs
- Chain Information - Detailed chain metadata, native currencies, and RPC endpoints
Installation
pnpm add @cowprotocol/sdk-configUsage
import {
SupportedChainId,
ALL_SUPPORTED_CHAINS_MAP,
CowEnv,
ApiContext,
ChainInfo,
COW_PROTOCOL_SETTLEMENT_CONTRACT_ADDRESS,
} from '@cowprotocol/sdk-config'
// Use supported chain IDs
const chainId = SupportedChainId.MAINNET // 1
const gnosisChain = SupportedChainId.GNOSIS_CHAIN // 100
// Get chain information
const mainnetInfo: ChainInfo = ALL_SUPPORTED_CHAINS_MAP[SupportedChainId.MAINNET]
console.log(mainnetInfo.label) // "Ethereum"
console.log(mainnetInfo.nativeCurrency.symbol) // "ETH"
// Get contract addresses
const settlementAddress = COW_PROTOCOL_SETTLEMENT_CONTRACT_ADDRESS[SupportedChainId.MAINNET]
// Configure API context
const apiContext: ApiContext = {
chainId: SupportedChainId.SEPOLIA,
env: 'staging' as CowEnv,
}Usage with CoW SDK
import { CowSdk, SupportedChainId, ALL_SUPPORTED_CHAINS_MAP, CowEnv, ApiContext, ChainInfo } from '@cowprotocol/cow-sdk'
const sdk = new CowSdk({
chainId: SupportedChainId.MAINNET, // From config package
adapter,
env: 'prod', // From config package
})Note: This package is primarily designed to provide configuration constants and is rarely used standalone. Most developers should use
@cowprotocol/cow-sdkpackage or specific feature packages.
