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

@integralhq/size-sdk

v0.1.3

Published

An SDK for building applications on top of Integral SIZE.

Downloads

15

Readme

integralhq/size-sdk

SDK Quick Start

The Integral SIZE SDK is created to help developers to interact with the Integral SIZE protocol. The SDK makes it convenient to instantiate an Integral Pair with on-chain data and calculate required data to perform a trade.
The SDK is for the Integral SIZE only. The SDK for Integral FIVE will be released subsequently.

Installation

The easiest way to install the Integral SIZE SDK is to run yarn add @integralhq/size-sdk or npm install @integralhq/size-sdk. To use the SDK in your project, use import or require, depending on your environment.

import { ChainId } from '@integralhq/size-sdk'
console.log(`Kovan chain id: ${ChainId.Kovan}`)

Creating a Trade

The Integral SIZE SDK provides functions that allows you in an easy way to calculate and prepare data to safely interact with Integral SIZE. The SDK will not execute trades or send transactions on your behalf.

Buy and Sell

Let's say you want to sell 1 WETH for USDC. The easies way to prepare data for such trade is to:

import { BigNumber, utils } from 'ethers'
import { ChainId, TwapDelay, CurrencyValue, getToken, getProvider } from '@integralhq/size-sdk'

const provider = getProvider(ChainId.Mainnet, {})
const receiver = '0x89205A3A3b2A69De6Dbf7f01ED13B2108B2c4365'
const usdc = await getToken(provider, ChainId.Mainnet, '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48') // USDC address on Ethereum Mainnet
const weth = await getToken(provider, ChainId.Mainnet, '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2') // WETH address on Ethereum Mainnet
const input = new CurrencyValue(weth, utils.parseEther('1.0')) // 1 WETH
const output = new CurrencyValue(usdc, utils.parseUnits('2000', usdc.decimals)) // 2000 USDC
const slippageTolerance = 20 // 2%

const sellParameters = await TwapDelay.getSellCallParameters(
  provider,
  ChainId.Mainnet,
  receiver,
  input,
  output,
  slippageTolerance
)

Let's say you want to buy 1 WETH for USDC. The easies way to prepare data for such trade is to:

import { BigNumber, utils } from 'ethers'
import { ChainId, TwapDelay, CurrencyValue, getToken, getProvider } from '@integralhq/size-sdk'

const provider = getProvider(ChainId.Mainnet, {})
const receiver = '0x89205A3A3b2A69De6Dbf7f01ED13B2108B2c4365'
const usdc = await getToken(provider, ChainId.Mainnet, '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48') // USDC address on Ethereum Mainnet
const weth = await getToken(provider, ChainId.Mainnet, '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2') // WETH address on Ethereum Mainnet
const input = new CurrencyValue(usdc, utils.parseUnits('2000', usdc.decimals)) // 2000 USDC
const output = new CurrencyValue(weth, utils.parseEther('1.0')) // 1 WETH
const slippageTolerance = 5 // 0.5%

const buyParameters = await TwapDelay.getBuyCallParameters(
  provider,
  ChainId.Mainnet,
  receiver,
  input,
  output,
  slippageTolerance
)

Pair and Pair Address

The SDK provides an easy way to get a Pair and a Pair address.

To get a Pair address, simply call getPairAddress function from TwapFactory. If the pair exists the function will return its address, otherwise undefined. The order of currencies passed in the call does not matter. There is only one pair for specific 2 currencies.

import { ChainId, TwapFactory, getToken, getProvider } from '@integralhq/size-sdk'

const provider = getProvider(ChainId.Mainnet, {})
const first = await getToken(provider, ChainId.Mainnet, '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48') // USDC address on Ethereum Mainnet
const second = await getToken(provider, ChainId.Mainnet, '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2') // WETH address on Ethereum Mainnet

const pairAddress = await TwapFactory.getPairAddress(provider, ChainId.Mainnet, first, second)

To get a Pair, call getPair function from TwapReader. This method will make all necessary on-chain calls to properly initialize the local Pair object. The order of currencies passed in the call does not matter. There is only one pair for specific 2 currencies.

import { ChainId, TwapReader, getToken, getProvider } from '@integralhq/size-sdk'

const provider = getProvider(ChainId.Mainnet, {})
const first = await getToken(provider, ChainId.Mainnet, '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48') // USDC address on Ethereum Mainnet
const second = await getToken(provider, ChainId.Mainnet, '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2') // WETH address on Ethereum Mainnet

const pair = await TwapReader.getPair(provider, ChainId.Mainnet, first, second)

Orders

To get order status, use getOrderStatus or getOrderStatuses function from TwapDelay.

import { ChainId, TwapDelay, getProvider } from '@integralhq/size-sdk'

const provider = getProvider(ChainId.Mainnet, {})
const orderStatus = await TwapDelay.getOrderStatus(provider, ChainId.Mainnet, 12)

Meaning of returned order status: |ID|Status| |---|---| |0|NonExistent| |1|EnqueuedWaiting| |2|EnqueuedReady| |3|ExecutedSucceeded| |4|ExecutedFailed| |5|Canceled|

Gas price

You can also get gas price using getGasPrice function from TwapDelay.

import { ChainId, TwapDelay, getProvider } from '@integralhq/size-sdk'

const provider = getProvider(ChainId.Mainnet, {})
const gasPrice = await TwapDelay.getGasPrice(provider, ChainId.Mainnet)