@interest-protocol/lattice-solver-api-sdk
v0.0.1
Published
SDK for Lattice Solver API
Downloads
79
Readme
@lattice/solver-api-sdk
Client SDK for the Lattice Solver API.
Installation
bun installUsage
import { SolverApiClient } from '@lattice/solver-api-sdk';
const solver = new SolverApiClient({
baseUrl: 'http://localhost:4000',
apiKey: 'optional-api-key',
});
// Get a quote
const quote = await solver.getQuote({
sourceChain: 1, // Solana
destinationChain: 3, // Sui
sourceToken: 'So11...',
destinationToken: '0x2::sui::SUI',
sourceAmount: '1000000000',
});
// Fulfill a request
const fulfillment = await solver.fulfill({
id: quote.id,
requestId: onChainRequestId,
});
// Check fulfillment status
const status = await solver.getRequest(requestId);
// Wait for settlement
await solver.waitForSettlement(requestId, {
maxPolls: 120,
intervalMs: 1000,
});API Endpoints
| Method | Endpoint | Description |
|--------|----------|-------------|
| GET | /api/v1/quote | Get swap quote |
| POST | /api/v1/fulfill | Fulfill a swap request |
| GET | /api/v1/requests/:id | Get request status |
| GET | /api/health | Health check |
Development
bun run build # Build package
bun run test # Run tests
bun run lint # Run linterDocumentation
See the solver-api README for API documentation.
