Lendasat LogoLendasat Docs
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:

  1. Connecting your wallet (MetaMask, WalletConnect, etc.)
  2. Signing a transaction to claim from the HTLC contract
  3. 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

FeatureGelato (claim)Manual (WalletConnect)
Gas feesFree (LendaSwap pays)User pays
Wallet requiredNoYes
ComplexitySimple (one SDK call)More complex
Transaction speed~30 secondsDepends on gas price
PolygonSupportedOptional (use Gelato instead)
EthereumNot availableRequired

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.

  1. Use Gelato when possible - It's free and simpler
  2. Ensure sufficient gas - Have enough ETH for the transaction
  3. Check swap status - Only claim when status is ServerFunded
  4. One-time claim - Claiming twice will fail