Go SDK
Developers can use the Go SDK to build backend services and microservices that interact with the WheelX AI-powered aggregation platform.
Install
go get github.com/wheelx-fi/wheelx-sdk/go/wheelxRequires go-ethereum for transaction execution:
go get github.com/ethereum/go-ethereumQuick Start
package main
import (
"context"
"fmt"
"log"
"github.com/wheelx-fi/wheelx-sdk/go/wheelx"
)
func main() {
// Initialize SDK
sdk := wheelx.NewWheelXSDK("")
// Create quote request
req := wheelx.QuoteRequest{
FromChain: 1,
ToChain: 1,
FromToken: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
ToToken: "0xdAC17F958D2ee523a2206206994597C13D831ec7", // USDT
FromAddress: "0x742d35Cc6634C0532925a3b8Dc9F6A7c5D3a7C6a",
ToAddress: "0x742d35Cc6634C0532925a3b8Dc9F6A7c5D3a7C6a",
Amount: 1000000, // 1 USDC (6 decimals)
Slippage: &[]int{50}[0],
}
// Get quote
ctx := context.Background()
quote, err := sdk.GetQuote(ctx, req)
if err != nil {
log.Fatalf("Failed to get quote: %v", err)
}
fmt.Printf("Quote received: %s tokens\n", quote.AmountOut)
fmt.Printf("Request ID: %s\n", quote.RequestId)
}Transaction Execution
API Reference
WheelXSDK
NewWheelXSDK(baseURL string)
Create new SDK instance
GetQuote(ctx, req) (*QuoteResponse, error)
Get a quote for token swap/bridge
GetOrderStatus(ctx, requestID) (*OrderResponse, error)
Get order status by request ID
TransactionExecutor
NewTransactionExecutor(rpcURL string)
Create executor with RPC endpoint
BuildTransaction(ctx, txData, fromAddress)
Build legacy transaction
BuildEIP1559Transaction(ctx, txData, fromAddress)
Build EIP-1559 transaction
SignAndSendTransaction(ctx, tx, privateKey)
Sign and send transaction
WaitForTransaction(ctx, txHash)
Wait for confirmation
Last updated
Was this helpful?