@rakeshsteer/internal-sdk
v0.12.9
Published
A TypeScript SDK for interacting with Algebra Integral protocol - a next-generation AMM protocol
Readme
Algebra Integral SDK
A TypeScript SDK for interacting with Algebra Integral protocol - a next-generation AMM protocol.
Installation
npm install @rakeshsteer/internal-sdkor
yarn add @rakeshsteer/internal-sdkFeatures
- Type Safety: Full TypeScript support with comprehensive type definitions
- Multi-chain Support: Works across multiple blockchain networks
- Comprehensive Utilities: Pool calculations, price conversions, and more
- Modern Architecture: Built with modern JavaScript/TypeScript practices
Quick Start
import { ChainId, Token, CurrencyAmount } from '@rakeshsteer/internal-sdk';
// Create a token
const token = new Token(
ChainId.Mantle,
'0x...',
18,
'SYMBOL',
'Token Name'
);
// Work with currency amounts
const amount = CurrencyAmount.fromRawAmount(token, '1000000000000000000');Supported Chains
The SDK supports the following blockchain networks:
- Mainnets: ZKSync, Mantle, Telos, Mode, Arthera, Linea
- Testnets: Goerli, ZKSync Testnet, BSC Testnet, Mantle Testnet, Telos Testnet, Mode Testnet, Blast Testnet, Arthera Testnet, Linea Sepolia, Mantle Sepolia, Base Sepolia, Holesky
- Development Networks: Berachain Testnet, Form Testnet, Katla, Sei Devnet, Neon Devnet
Core Entities
ChainId
import { ChainId } from '@rakeshsteer/internal-sdk';
console.log(ChainId.Mantle); // 5000
console.log(ChainId.ZKSync); // 324Token
import { Token, ChainId } from '@rakeshsteer/internal-sdk';
const USDC = new Token(
ChainId.Mantle,
'0x09Bc4E0D864854c6aFB6eB9A9cdF58aC190D0dF9',
6,
'USDC',
'USD Coin'
);Currency Amount
import { CurrencyAmount, Token } from '@rakeshsteer/internal-sdk';
const amount = CurrencyAmount.fromRawAmount(token, '1000000');
const humanReadable = amount.toExact(); // "1.0" for 6 decimal tokenPool
import { Pool, Token } from '@rakeshsteer/internal-sdk';
const pool = new Pool(
tokenA,
tokenB,
fee,
sqrtRatioX96,
liquidity,
tickCurrent
);Utilities
The SDK provides numerous utility functions for:
- Price Calculations: Converting between different price representations
- Tick Math: Working with concentrated liquidity positions
- Pool Math: Calculating swap amounts, liquidity, etc.
- Encoding: Creating calldata for contract interactions
API Reference
Constants
ChainId: Enum of supported chain IDsPOOL_DEPLOYER_ADDRESSES: Pool deployer contract addresses per chainPOOL_INIT_CODE_HASH: Init code hashes for pool creation
Entities
Token: Represents an ERC-20 tokenCurrency: Base currency interfaceCurrencyAmount: Token amount with decimal handlingPrice: Exchange rate between two currenciesPool: Concentrated liquidity poolPosition: Liquidity position in a poolRoute: Multi-hop swap routeTrade: Swap trade with input/output amounts
Enums
ChainId: Supported blockchain networksTradeType: EXACT_INPUT or EXACT_OUTPUTRounding: Rounding modes for calculations
Development
Building
npm run buildLinting
npm run lintPublishing
Use the provided publish script:
./publish.sh --patch # Bump patch version and publish
./publish.sh --dry-run # Test publish without actually publishing
./publish.sh --help # See all optionsFor automated publishing, set your npm token in the environment:
# Using environment variable
NPM_DEPLOYMENT_KEY=your_npm_token ./publish.sh --patch
# Or create .env file (not recommended for production)
echo "NPM_DEPLOYMENT_KEY=your_npm_token" > .env
./publish.sh --patchGetting NPM Automation Token
- Go to npm access tokens
- Generate a new token with "Automation" type
- Set the token in your environment:
- For CI/CD: Set as environment variable
- For local development: Add to
.envfile (ensure it's in.gitignore)
License
MIT
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Support
For questions and support, please visit the Algebra Protocol documentation.
