@cowprotocol/sdk-config

中文文档
2.11.2发布于 2026/11/04MITTypeScriptESM + CJS构建来源已验证近 30 天下载 11.2万

Configuration constants and settings for CoW Protocol SDK

原始使用文档
文档目录4 节
  1. What's included
  2. Installation
  3. Usage
  4. Usage with CoW SDK

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-config

Usage

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-sdk package or specific feature packages.

版本与发布记录

@cowprotocol/sdk-config 共发布 50 个版本,首次发布于 2025/08/02;过去 12 个月发布了 38 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
2.11.2latest2026/11/046 天前
2.11.12026/11/037 天前
2.11.02026/10/2615 天前
2.10.02026/10/1328 天前
2.9.02026/10/091 个月前
2.8.02026/10/071 个月前

其他发布通道:next → 0.2.1-beta.0。

关于 @cowprotocol/sdk-config 的常见问题

@cowprotocol/sdk-config 是什么?

Configuration constants and settings for CoW Protocol SDK

如何安装 @cowprotocol/sdk-config?

在项目目录运行 npm install @cowprotocol/sdk-config,或使用 pnpm add / yarn add / bun add。

@cowprotocol/sdk-config 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@cowprotocol/sdk-config 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@cowprotocol/sdk-config 可以商用吗?

@cowprotocol/sdk-config 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@cowprotocol/sdk-config 的下载量有多少?

根据 npm 官方下载统计,@cowprotocol/sdk-config 在 2026/10/11 – 2026/11/09 这 30 天内被下载 112,199 次,日均约 3,740 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@cowprotocol/sdk-config 还在维护吗?

最新版本 2.11.2 发布于 2026/11/04(6 天前);至今共发布 50 个版本,其中过去 12 个月发布了 38 个;首次发布于 2025/08/02。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。