npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@synthra-swap/sdk-core

v4.2.12

Published

⚒️ An SDK for building applications on top of synthra-swap V3

Downloads

35

Readme

@synthra-swap/sdk-core

npm version License: MIT

⚒️ Core SDK for building applications on top of Synthra-swap V3

A robust and type-safe TypeScript SDK that provides the fundamental entities, utilities, and types needed to interact with the Synthra-swap protocol. This package serves as the foundation layer for all other Synthra-swap SDKs.

🚀 Features

  • Core Entities: Classes for Token, Currency, CurrencyAmount, Price, Fraction, and Percent
  • Trading Utilities: Functions for price calculations, address validation, and impact analysis
  • Type Safety: Complete TypeScript typing for enhanced development safety
  • Multi-Chain Support: Support for Ethereum and compatible networks
  • Precise Mathematics: Accurate decimal handling and financial calculations
  • Tree Shakable: Modular imports for optimized bundle sizes

📦 Installation

npm install @synthra-swap/sdk-core
yarn add @synthra-swap/sdk-core
pnpm add @synthra-swap/sdk-core

🛠️ Basic Usage

Importing Entities

import {
  Token,
  CurrencyAmount,
  Price,
  Percent,
  Fraction
} from '@synthra-swap/sdk-core'

Creating a Token

import { Token, ChainId } from '@synthra-swap/sdk-core'

const USDC = new Token(
  ChainId.MAINNET,
  '0xA0b86a33E6441c8442a4F5d4c6d8dcFc7a3e9dc5',
  6,
  'USDC',
  'USD Coin'
)

Working with Amounts

import { CurrencyAmount, Token } from '@synthra-swap/sdk-core'

// Create an amount of 100.5 USDC
const amount = CurrencyAmount.fromRawAmount(USDC, '100500000')

// Or from a decimal string
const amountFromString = CurrencyAmount.fromFractionalAmount(
  USDC,
  '100.5',
  '1'
)

console.log(amount.toFixed()) // "100.500000"

Price Calculations

import { Price, Token } from '@synthra-swap/sdk-core'

const price = new Price(
  tokenA,
  tokenB,
  '1000000000000000000', // 1 tokenA
  '2000000000000000000'  // = 2 tokenB
)

console.log(price.toFixed(4)) // "2.0000"

Working with Percentages

import { Percent } from '@synthra-swap/sdk-core'

// Create a 2.5% percentage
const slippage = new Percent('25', '1000') // 25/1000 = 2.5%

// Or from basis points
const fee = new Percent('30', '10000') // 30 basis points = 0.3%

📚 API Reference

Core Entities

Token

Represents an ERC20 token with its essential properties.

constructor(
  chainId: number,
  address: string,
  decimals: number,
  symbol?: string,
  name?: string
)

CurrencyAmount

Represents an amount of a specific currency with decimal precision.

static fromRawAmount(currency: Currency, rawAmount: JSBI): CurrencyAmount
static fromFractionalAmount(currency: Currency, numerator: JSBI, denominator: JSBI): CurrencyAmount

Price

Represents the price of one currency in terms of another.

constructor(
  baseCurrency: Currency,
  quoteCurrency: Currency,
  denominator: JSBI,
  numerator: JSBI
)

Percent

Extends the Fraction class to represent percentages.

constructor(numerator: JSBI, denominator: JSBI)

Utilities

validateAndParseAddress

Validates and normalizes an Ethereum address.

function validateAndParseAddress(address: string): string

computePriceImpact

Calculates the price impact of a swap.

function computePriceImpact(
  midPrice: Price,
  inputAmount: CurrencyAmount,
  outputAmount: CurrencyAmount
): Percent

🔗 Chain Support

The SDK supports the following chains:

  • Ethereum Mainnet (ChainId: 1)
  • Polygon (ChainId: 137)
  • Arbitrum One (ChainId: 42161)
  • Optimism (ChainId: 10)
  • Base (ChainId: 8453)

🧪 Testing

npm test

The project includes comprehensive tests for all core functionality.

🤝 Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📄 License

This project is released under the MIT License. See the LICENSE file for more details.

🔗 Related Resources


Disclaimer: This software is provided "as is" without warranty of any kind. Use at your own risk.wap/sdk-core - Now at Uniswap/sdks

All versions after 4.2.0 of this SDK can be found in the SDK monorepo! Please file all future issues, PR’s, and discussions there.

Old Issues and PR’s

If you have an issue or open PR that is still active on this SDK in this repository, please recreate it in the new repository. Some existing issues and PR’s may be automatically migrated by the Uniswap Labs team.