TypeScript SDK Reference
Comprehensive method signatures, parameter interfaces, and architectural patterns for PumpSuiFactorySDK built on top of @mysten/sui.
Package Installation
End-to-End Implementation Sample
import { PumpSuiFactorySDK, parseSUI } from '@pumpsui/token-creator-sdk';
import { SuiClient } from '@mysten/sui/client';
// 1. Initialize SuiClient and PumpSuiFactorySDK
const client = new SuiClient({ url: 'https://fullnode.mainnet.sui.io:443' });
const sdk = new PumpSuiFactorySDK(client, 'MAINNET');
// 2. Build Create Pool PTB
const txb = await sdk.createPoolTransaction({
tokenAType: '0x2::sui::SUI',
tokenBType: '0x3568478d...::my_token::MY_TOKEN',
tokenAAmount: parseSUI(100), // 100 SUI seed liquidity
tokenBAmount: 1_000_000_000_000n, // 1,000,000 tokens
senderAddress: '0xYourWalletAddress',
});
// 3. Query on-chain pool reserves
const poolInfo = await sdk.getPoolInfo('0xPoolSharedObjectId');
console.log('Reserves:', poolInfo.reserveA, poolInfo.reserveB);
// 4. Calculate exact swap output (x*y=k formula with 0.3% fee)
const tokenOut = sdk.calculateSwapOutput(
parseSUI(10), // 10 SUI in
poolInfo.reserveA,
poolInfo.reserveB
);
console.log('Estimated Output:', tokenOut);PumpSuiFactorySDK Core Methods
createPoolTransaction(params: CreatePoolParams)Promise<Transaction>Assembles a Programmable Transaction Block (PTB) initializing a new AMM pair with seed liquidity and paying the 0.8 SUI protocol creation fee.
addLiquidityTransaction(params: AddLiquidityParams)Promise<Transaction>Generates a PTB depositing dual assets into an existing pool and minting proportional LP<A, B> certificates. Zero protocol fees.
removeLiquidityTransaction(params: RemoveLiquidityParams)Promise<Transaction>Generates a PTB burning an LP coin object and returning the underlying Token A and Token B reserves directly to the owner.
getPoolInfo(poolId: string)Promise<PoolInfo>Fetches real-time on-chain reserves, LP total supply, fee configurations, and cumulative trading volume.
calculateSwapOutput(amountIn, reserveIn, reserveOut)bigintPure mathematical helper estimating output tokens received given input amount and current pool reserves using standard constant-product AMM mechanics (0.3% fee deduction).
Mathematical & Sui PTB Utilities
sortTokenTypes(typeA, typeB)Returns canonical [tokenA, tokenB] ordered alphabetically for Sui Move constraints.
parseSUI(amount: number | string)Converts whole SUI value into exact 9-decimal MIST bigint (e.g. 1.5 -> 1500000000n).
formatSUI(mist: bigint)Converts raw MIST bigint into human-readable formatted SUI string with localized decimal points.
splitCoinsForFee(txb, amount)Helper that extracts required protocol fees from the gas coin in a single atomic instruction.