git clone --depth 1 https://github.com/internet-court/internet-court-skill /tmp/lifi-stablecoin-swap && cp -r /tmp/lifi-stablecoin-swap/vendored/lifi/lifi-stablecoin-swap ~/.claude/skills/lifi-stablecoin-swapSKILL.md
# Build a 1:1 Stablecoin Swap with LI.FI Intents
A normal crypto transfer leaks value to gas and spreads — send 100 USDC, ~99.8 arrives. For a
neobank, payment processor, or regulated fintech, that's a non-starter: their users expect that
sending 100 means 100 arrives.
LI.FI Intents lets you offer exactly that — **send 100 USDC, receive 100 USDC** (or USDT, or
another supported stablecoin), same-chain or cross-chain. A solver from LI.FI's network fronts
the destination gas and sources the liquidity, then settles against the user's deposit, so the
end user sees one number from start to finish, provable on a public block explorer.
The primary integration is the **`@lifi/intent` TypeScript SDK** — it requests the quote, builds
the on-chain order, and tracks it. The raw REST API is in §7 for non-TypeScript backends.
---
## 1. Enable 1:1 quoting on your integrator account
1:1 stablecoin quoting is a capability provisioned on your **LI.FI integrator account**:
1. Register an integrator ID on the **LI.FI Partner Portal** — https://portal.li.fi
2. Complete an integration agreement with LI.FI. As part of onboarding, 1:1 stablecoin quoting is
enabled for your integrator.
3. Quote requests made **under your integrator key** then return 1:1 amounts for supported
stablecoin pairs.
The integration code below is identical regardless — what makes the quote come back 1:1 is your
onboarded integrator. See https://docs.li.fi/lifi-intents/introduction or contact LI.FI to enable it.
---
## 2. The flow
`order.li.fi` is the Intents API. The escrow flow is the recommended default and takes four steps:
```
1. Quote getQuotes(...) -> guaranteed output amount (1:1)
2. Approve ERC-20 approve(InputSettlerEscrow, amount) -> let the settler pull the input token
3. Open escrow.open(StandardOrder) on-chain -> locks funds, emits Open(orderId)
4. Track GET /orders/status?onChainOrderId=... -> Signed -> Delivered -> Settled
```
Opening the order emits `Open(bytes32 indexed orderId, ...)`; solvers watch for that event and fill
on the destination chain, so the escrow flow needs **no order-submission call**. You poll status
until the funds land, then show the user the destination transaction. The `orderId` is the
receipt — anyone can independently verify the deposit and the delivery matched.
(There is also a **Compact / gasless** flow — deposit once into The Compact, then sign and submit
each order off-chain. Use escrow unless you specifically want gasless after a one-time deposit.)
```bash
npm install @lifi/intent viem
```
(The runnable interface in the quickstart also uses `wagmi` + `@tanstack/react-query` for the
wallet — its install line includes them.)
> Setup note: the SDK uses `bigint` literals (`100_000_000n`). `create-next-app` defaults
> `tsconfig.json` to `"target": "ES2017"`, which rejects them — set `"target": "ES2020"` (or higher).
---
## 3. Quote (1:1)
`getQuotes` with your integrator key. `IntentApi(true)` targets mainnet / the production solver
network. Amounts are `bigint` in the token's smallest units (100 USDC = `100_000_000n`, 6 decimals).
Under a 1:1-enabled integrator on a supported stablecoin pair, the output equals the input.
```ts
import { IntentApi } from "@lifi/intent";
const api = new IntentApi(true);
const res = await api.getQuotes({
user, // the user's 0x address
userChainId: 8453, // source chain (Base)
integratorKey: process.env.LIFI_INTEGRATOR_KEY, // your onboarded integrator key
inputs: [{ sender: user, asset: usdcOnBase, chainId: 8453, amount: 100_000_000n }],
outputs: [{ receiver: user, asset: usdcOnArb, chainId: 42161, amount: 0n }],
});
const quote = res.quotes[0];
if (!quote) throw new Error("No quote available for this pair");
const received = BigInt(quote.preview.outputs[0].amount); // == 100_000_000n for a 1:1 pair
const quoteId = quote.quoteId;
```
---
## 4. Build & open the order
The SDK builds the `StandardOrder` for you — pass plain token addresses + chain ids; it computes
the nonce, deadlines, oracle, and EIP-7930 encoding. `getOracle` supplies the verifier oracle
(Polymer addresses below). Then call `open(order)` on the escrow settler the SDK gives you.
```ts
import { Intent, type IntentDeps, type StandardEVM } from "@lifi/intent";
import type { WalletClient } from "viem";
const POLYMER_ORACLE = "0x0000003E06000007A224AeE90052fA6bb46d43C9" as const; // mainnet
const deps: IntentDeps = {
getOracle: (verifier) => (verifier === "polymer" ? POLYMER_ORACLE : undefined),
};
type Tok = { address: `0x${string}`; chainId: number; decimals: number; name: string };
const ctx = (t: Tok, amount: bigint) => ({
token: { address: t.address, name: t.name, chainId: BigInt(t.chainId),
decimals: t.decimals, chainNamespace: "eip155" as const },
amount,
});
const intent = new Intent({
inputTokens: [ctx(fromToken, 100_000_000n)],
outputTokens: [ctx(toToken, received)], // `received` from the quote
verifier: "polymer",
account: user,
outputRecipient: user,
lock: { type: "escrow" },
}, deps).order();
// asOrder() is a union (multichain | EVM | Solana); narrow to the single-chain EVM order
// so it matches the OPEN_ABI StandardOrder tuple.
const order = intent.asOrder() as StandardEVM; // the StandardOrder struct
const orderId = intent.orderId(); // your tracking handle
const settler = intent.inputSettler; // InputSettlerEscrow (0x000025c3...)
// 1) ERC-20 approve(settler, amountIn) for the source token if allowance is insufficient
// (allowance check + ERC20 ABI shown in references/quickstart.md).
// 2) Open the order (full `open` ABI is in references/quickstart.md). viem's writeContract
// needs `account` and `chain` when the wallet client has none bound:
const txHash = await wallet.writeContract({
address: settler, abi: OPEN_ABI, functionNEntry point for Internet Court — the trust layer for agent-to-agent commerce. Use whenever an agent needs to transact with another agent or a paid service, or a user mentions agent payments, paid APIs (HTTP 402/x402), wallet custody or trust concerns, spending mandates, delegated permissions (ERC-7710/7715), escrow, agent identity or reputation (ERC-8004), negotiation between agents (A2A), agent jobs (ERC-8183), machine payments (MPP, AP2), supervision of agent behavior, revocation, verification, or dispute resolution (GenLayer) — even if they never say "Internet Court". Routes to the vendored protocol skills and connector skills in this package.
Connect GenLayer Intelligent Contract decisions to ERC-7710-style delegated authority. Use when an agent needs to design the interface, message schema, relayer/bridge path, EVM revocation controller, constraint updates, proof/finality assumptions, and failure handling that turn a GenLayer agent-performance review into ERC-7710 revocation or policy changes.
Internet Court adapter for GenLayer Intelligent Contract supervision. Use to specify agent-performance rubrics, evidence schemas, decision outputs, and ERC-7710 connector expectations, while delegating actual GenLayer contract writing, linting, testing, deployment, and CLI interaction to the official GenLayer skills at https://skills.genlayer.com/.
Design and implement demos combining x402 HTTP payments with ERC-7710 smart contract delegations and ERC-7715 wallet permission requests for subscriptions, bounded agent budgets, recurring spend, pay-per-use APIs, and agentic commerce.
0G Compute Network guide for decentralized AI inference, fine-tuning, and GPU services. Covers chatbots, image generation, speech-to-text, SDK integration (0g-serving-broker), processResponse API, broker.inference methods, CLI commands (0g-compute-cli), and account management. Use this skill for any 0G compute, 0G AI, or decentralized GPU question.
Use this skill when the user asks to list, create, inspect, update, disable, re-enable, or revoke AltLLM Portal API keys for external agents or applications. Do NOT use for wallet login, billing history, or payment links.
Use this skill when the user asks to log in or out with a wallet session, fetch a wallet sign-in challenge, verify an externally signed challenge, or troubleshoot AltLLM Portal wallet login for the local altllm CLI. Do NOT use for API key management, billing history, or payment links.
Use this skill when the user asks to inspect AltLLM Portal balance, redeem a promo code, review billing transactions, or view usage analytics by period, model, or API key using the local altllm CLI. Do NOT use for API key lifecycle management or payment-link execution.