Lightning to USDC
Quick start guide for developers integrating Lendaswap
Welcome to the Lendaswap developer portal. This guide will help you verify your integration environment and complete your first swap.
Get the TS-SDK
npm install @lendasat/lendaswap-sdk-pure
# or
pnpm add @lendasat/lendaswap-sdk-pureYour First Swap
Follow these steps to complete a test swap from Bitcoin (Lightning) to USDC (Polygon).
First create a new client
const client = await Client.builder()
.withSignerStorage(new InMemoryWalletStorage())
.withSwapStorage(new InMemorySwapStorage())
.withApiKey(process.env.API_KEY || "")
.build();You can find all available tokens to swap like this. For this example, we look for the token details for USDC on Polygon.
const tokens = await client.getTokens();
const usdcPolygon = tokens.evm_tokens.find(
(t) => t.symbol === "USDC" && t.chain === "137",
);Afterward we can create the swap request:
const result = await client.createSwap({
sourceAsset: BTC_LIGHTNING_INFO,
targetAsset: usdcPolygon,
targetAddress: destinationAddress,
sourceAmount: amountSats,
});
const { response } = result;Pay the Lightning invoice returned in the response with any Lightning wallet (e.g., Phoenix, Wallet of Satoshi). The SDK generates the secret and shares the hash — the service creates a Boltz reverse swap it can only settle after you reveal the secret.
console.log("Pay invoice:", response.bolt11_invoice);Wait for the status to become ServerFunded, then claim your tokens.
Gasless on all chains: Claiming is gasless on Polygon, Ethereum, and Arbitrum via EIP-712 signatures. A small gas fee is deducted from the swap amount depending on network conditions. Alternatively, you can claim manually with your own wallet and pay gas yourself.
const claim = await client.claimViaGasless(response.id, destinationAddress);
console.log("Claimed! TX:", claim.txHash);
// ... "0xabc123..."The swap will complete and you will receive your tokens.
Build with AI
We have generated a llms-full.txt file that converts all our documentation into a single markdown document following the llmstxt.org standard. Feed it to any AI coding agent (Claude, Cursor, Copilot, etc.) and it will have everything it needs to integrate the LendaSwap SDK into your project.
Next Steps
- SDK & API Reference - Full SDK and REST API documentation