@uniswap/sdk-core
The Uniswap SDK Core provides the foundational classes and utilities for working with the Uniswap protocol. This package contains essential primitives like currencies, amounts, and mathematical utilities that are used across all Uniswap SDK packages.
Overview
This reference documentation covers:
- Classes - Core classes like
Token
,CurrencyAmount
,Fraction
, andPrice
- Enums - Supported chains, trade types, and other enumerations
- Types - TypeScript type definitions and interfaces
Key Components
Currency Primitives
Currency
- Base currency interfaceToken
- ERC-20 token representationEther
- Native ETH currencyCurrencyAmount
- Typed currency amounts
Mathematical Utilities
Fraction
- Precise fractional arithmeticPercent
- Percentage calculationsPrice
- Exchange rates between currencies
Chain Support
ChainId
- Supported blockchain networks- Network-specific configurations and constants
Getting Started
import { Token, CurrencyAmount, TradeType } from '@uniswap/sdk-core'
// Create a token
const USDC = new Token(1, '0xA0b86a33E6417c29C8F6e3b6E4E12A82aA4Ca8e9', 6, 'USDC', 'USD Coin')
// Create an amount
const amount = CurrencyAmount.fromRawAmount(USDC, '1000000') // 1 USDC
For practical integration examples, see the SDK v3 Guides and SDK v4 Guides.