SDK Reference
A TypeScript SDK for interacting with PulseSwap.io, providing seamless integration with multiple DEX platforms on the PulseChain network.
Features
Multi-DEX Support: Integration with PulseX V1/V2/Stable, 9inch V2/V3, 9mm V2/V3, Phux.io, 0xTide, Piteas, and PulseSwap Aggregator
Quote Generation: Get optimal swap quotes across different platforms with
FASTorOPTIMALmodesTransaction Building: Generate ready-to-execute transaction data
TypeScript Support: Full type definitions for better developer experience
Fee Management: Built-in fee calculation and optimization
Aggregator Support: Access to Piteas and PulseSwap aggregators for best route finding
Installation
npm install pulseswap-sdk
# or
yarn add pulseswap-sdk
# or
pnpm add pulseswap-sdkQuick Start
Supported Platforms
Platform.PULSEX_V1
Uniswap V2
PulseX V1 DEX
Platform.PULSEX_V2
Uniswap V2
PulseX V2 DEX
Platform.PULSEX_STABLE
Stable
PulseX Stable DEX
Platform.NINEINCH_V2
Uniswap V2
9inch V2 DEX
Platform.NINEINCH_V3
Uniswap V3
9inch V3 DEX
Platform.NINEMM_V2
Uniswap V2
9mm V2 DEX
Platform.NINEMM_V3
Uniswap V3
9mm V3 DEX
Platform.PHUX_V2
Balancer V2
Phux.io DEX
Platform.TIDE_V3
Balancer V3
0xTide DEX
Platform.PITEAS
Piteas
Piteas Aggregator
Platform.PULSESWAP
PulseSwap
PulseSwap Aggregator
API Reference
PulseSwapSDK
PulseSwapSDKConstructor
Parameters:
config.quoteUrl– URL for the standard quote API (default:https://quotes.pulseswap.io/api/v2)config.piteasUrl– URL for the Piteas quote API (default:https://api.piteas.io)
getQuote
Gets a swap quote for the specified platform.
Parameters:
request– Quote request objectplatform– Target DEX platform (Platformenum)
Returns:
Promise<QuoteResult | null> – Resolves to quote result, or null if the quote failed.
Types
PulseSwapSDKConfig
PulseSwapSDKConfigQuoteRequest
QuoteRequestQuoteResult
QuoteResultTransaction
TransactionRoute
RouteQuoteExtra
QuoteExtraFields:
tokenInTax– Tax rate for the input token (basis points, e.g.100= 1%)tokenOutTax– Tax rate for the output token (basis points, e.g.200= 2%)tokenInPrice– USD price of the input token (for better optimization)tokenOutPrice– USD price of the output token (for better optimization)gasPrice– Gas price in wei (as string)gasTokenPrice– USD price of the gas token (for gas cost calculations)
QuoteMode
QuoteModeExamples
Basic Swap
Using Piteas Aggregator
Using PulseSwap Aggregator
Error Handling
The SDK returns null when a quote cannot be generated (network errors, invalid params, etc.). Always check for null:
Last updated
Was this helpful?