Prerequisites
- OKX API credentials
- Sui wallet with a private key
- SUI tokens for gas fees
- Access to a Sui RPC endpoint
Setup
Common Token Addresses
Sui uses type identifiers for tokens:| Token | Address |
|---|---|
| SUI | 0x2::sui::SUI |
| USDC | 0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC |
Getting a Quote
Fetch a quote to preview swap details:Executing a Swap
Execute a complete swap workflow:Complete Working Example
Here’s a full example you can run:Sui-Specific Configuration
When configuring the client for Sui, you can customize the connection:Understanding Sui Token Addresses
Sui uses a different address format than other chains:- Module-based: Tokens are identified by their module path
- Format:
{package}::{module}::{type} - Example:
0x2::sui::SUIbreaks down to:- Package:
0x2(system package) - Module:
sui - Type:
SUI
- Package:
Best Practices
Verify Addresses
Double-check token type identifiers before swapping
Test with Small Amounts
Start with small swaps to verify configuration
Monitor Gas
Keep sufficient SUI for transaction fees
Use Official RPCs
Connect to reliable RPC endpoints for best performance
Error Handling
Swap Parameters
All parameters for Sui swaps:Next Steps
TON Swaps
Learn how to get quotes on TON
API Reference
View complete swap API documentation