Complete Swap
Claim with WalletConnect
Claim funds using your own wallet. Required for Ethereum destinations, optional for Polygon.
Required for Ethereum: If you're swapping BTC to tokens on Ethereum (usdc_eth, usdt_eth, xaut_eth), you must use this method. Gelato Relay is only available for Polygon.
Manual claiming requires:
- Connecting your wallet (MetaMask, WalletConnect, etc.)
- Signing a transaction to claim from the HTLC contract
- Paying gas fees in ETH (you need ETH in your wallet)
Manual Claiming with wagmi/viem
For React applications using wagmi:
import { useWriteContract, useAccount } from "wagmi";
// The SDK's claim() returns calldata for Ethereum chains
const claimResult = await client.claim(swapId);
if (claimResult.ethereumClaimData) {
const { writeContract } = useWriteContract();
await writeContract({
address: claimResult.ethereumClaimData.contractAddress as `0x${string}`,
data: claimResult.ethereumClaimData.callData as `0x${string}`,
});
}Manual Claiming with ethers.js
For vanilla JavaScript/TypeScript applications:
import { BrowserProvider } from "ethers";
const provider = new BrowserProvider(window.ethereum);
const signer = await provider.getSigner();
const claimResult = await client.claim(swapId);
if (claimResult.ethereumClaimData) {
const tx = await signer.sendTransaction({
to: claimResult.ethereumClaimData.contractAddress,
data: claimResult.ethereumClaimData.callData,
});
await tx.wait();
console.log("Claimed! TX:", tx.hash);
}Comparison: Gelato vs Manual
| Feature | Gelato (claim) | Manual (WalletConnect) |
|---|---|---|
| Gas fees | Free (LendaSwap pays) | User pays |
| Wallet required | No | Yes |
| Complexity | Simple (one SDK call) | More complex |
| Transaction speed | ~30 seconds | Depends on gas price |
| Polygon | Supported | Optional (use Gelato instead) |
| Ethereum | Not available | Required |
When to Use Manual Claiming
- Ethereum destinations - Required for
usdc_eth,usdt_eth,xaut_eth(Gelato not available) - Custom gas settings - Need to set specific gas price/limit
- Hardware wallets - Some hardware wallets work better with direct signing
- Specific requirements - Enterprise or compliance needs
- Debugging - Testing or troubleshooting swap issues
Important Notes
Preimage Security: The preimage is the secret that unlocks the HTLC. Never share it or expose it publicly before claiming.
- Use Gelato when possible - It's free and simpler
- Ensure sufficient gas - Have enough ETH for the transaction
- Check swap status - Only claim when status is
ServerFunded - One-time claim - Claiming twice will fail