Velar SDK
The Velar SDK is a powerful toolkit that enables seamless integration with the Velar Protocol, allowing developers to implement token swaps, manage liquidity, and interact with the Velar DEX ecosystem. This SDK provides a robust set of tools for building decentralized applications on the Stacks blockchain.
Installation
Available Versions
The latest version introduces significant improvements and changes:
Added support for all VELAR DEX listed tokens
Direct token contract address support in SwapConfig
Enhanced AmountOutResponse with detailed path information
Simplified API with removal of SwapType requirement
Removed support for
swapTokensForExactTokens
Stable release with core functionality:
Support for token swapping operations
Implementation of
swapTokensForExactTokens
Includes bug fix for
assetName
in swap operationsUses SwapType enum for different swap operations
Key Features
Token Swapping: Execute token swaps with optimal routing
Price Computation: Calculate swap amounts with slippage protection
Pair Management: Query available trading pairs
Multi-hop Routing: Support for complex swap paths
Contract Integration: Seamless integration with Stacks blockchain
Core Components
The SDK is built around several key interfaces and classes:
VelarSDK Class
The main entry point for interacting with the protocol:
SwapService
Handles all swap-related operations:
Getting Started
Initialize the SDK:
Create a swap instance:
Execute operations:
Token Support
The SDK supports a wide range of tokens on the Velar DEX, including:
Core tokens: STX, VELAR, aeUSDC, aBTC
Ecosystem tokens: SOME, ROCK, MICK, WELSH, LEO
Staked variants: stSTX, sODIN, sROO, sWELSH
And many more
For the latest list of supported tokens and their trading pairs, you can use the getPairs
method or check the official token list at: https://sdk-beta.velar.network/tokens/symbols
Migration Guide
When upgrading from 0.6.9 to 0.7.0-beta:
Remove all
SwapType
referencesUpdate
getComputedAmount
implementation to handle new response typeRemove any
swapTokensForExactTokens
implementationsUpdate token inputs to optionally use contract addresses
Best Practices
Always implement proper error handling
Use slippage protection for better trade execution
Test with small amounts before large transactions
Keep the SDK updated to the latest stable version
Monitor transaction status using provided callbacks
Support
For technical support, bug reports, or feature requests, please join our community on Telegram or Discord. Our documentation is regularly updated to help you make the most of the Velar SDK.
Last updated
Was this helpful?