⚑ 1LLET Docs

USDC

XLM

POST
/api/bridge/stellar/xlm

Bridge USDC from an EVM network (like Base) directly to XLM on a Stellar account. This utilizes a 'gasless' pull payment via EIP-3009.


⚠️ Fee Structure

Minimum Amount: 0.08 USDC. Protocol Fee: 0.05 USDC.

The fee covers the cost of gasless execution (EIP-3009) and bridge routing. Funds typically arrive within 2 minutes.

Utility: Get Quote
POST
/api/bridge/quote

Calculate the exact amount the recipient will receive (Net Amount) after Protocol Fees. This endpoint simulates the bridge transaction without executing it.

Request Payload
JSON Body
// POST /api/bridge/quote
{
  "amount": "100",
  "sourceChain": "Base", // or "Stellar"
  "targetChain": "Stellar", // or "Base"
  "token": "USDC" // Optional (defaults to USDC logic)
}
Response Example
JSON Response
{
  "success": true,
  "amountSent": 100,
  "protocolFee": 0.05,
  "netAmountBridged": 99.95, // (100 - 0.05)
  "minAmount": 0.08,
  "estimatedReceived": "99.920000" // From Bridge Provider
}
1. Get Configuration

You must fetch the Facilitator EVM Address to authorize the transfer.

GET /api/bridge/stellar
// GET /api/bridge/stellar
{
  "stellarAddress": "G...", 
  "evmAddress": "0x123..." // FACILITATOR_ADDRESS
}
2. Generate Signature (EIP-3009)
Viem (Script)
import { createWalletClient, http } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { base } from "viem/chains";

// 1. Setup Account (Backend/Script)
const account = privateKeyToAccount("0xMY_PRIVATE_KEY");

const walletClient = createWalletClient({
    account,
    chain: base,
    transport: http()
});

// 2. Constants
const USDC_BASE = "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
const FACILITATOR_ADDRESS = "0x..."; // Value from Step 1

// 3. Prepare Data
const value = BigInt(Math.floor(amount * 1_000_000));
const validAfter = BigInt(0); 
const validBefore = BigInt(Math.floor(Date.now() / 1000) + 3600);
const nonce = crypto.getRandomValues(new Uint8Array(32));
const nonceHex = "0x" + Buffer.from(nonce).toString('hex');

// 4. Sign Typed Data (EIP-3009)
const signature = await walletClient.signTypedData({
    domain: {
        name: "USD Coin",
        version: "2",
        chainId: base.id,
        verifyingContract: USDC_BASE,
    },
    types: {
        TransferWithAuthorization: [
            { name: "from", type: "address" },
            { name: "to", type: "address" },
            { name: "value", type: "uint256" },
            { name: "validAfter", type: "uint256" },
            { name: "validBefore", type: "uint256" },
            { name: "nonce", type: "bytes32" },
        ]
    },
    primaryType: "TransferWithAuthorization",
    message: {
        from: account.address,
        to: FACILITATOR_ADDRESS,
        value,
        validAfter,
        validBefore,
        nonce: nonceHex,
    },
});
3. Execute Bridge
Request Payload
const payload = {
    sourceChain: "Base",
    targetChain: "Stellar",
    amount: "10.5",
    recipientStellar: "GB...", 
    destinationToken: "XLM", // <--- Important
    paymentPayload: {
        authorization: {
            from: "0xUser...",
            to: "0xFacilitator...", // From step 1
            value: "10500000",
            validAfter: "0",
            validBefore: "...",
            nonce: "0x..."
        },
        signature: "0x..." 
    }
};

await fetch("/api/bridge/stellar/xlm", {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify(payload)
});
API Response Info
Success Response
{
  "success": true,
  "transactionHash": "0x..." // EVM Transaction Hash (Facilitator -> 1-Click)
}
Navigation

Utility: Get Quote
Utility: Gasless Pay

    USDC β†’ XLM
    USDC ↔ USDC

Introduction