Zum Inhalt springen
Skillpedia
APIs & Server (Backend)7.0k · #13639

lifi-stablecoin-swap

Was er macht

Dieser Leitfaden zeigt, wie du einen Stablecoin-Tausch baust, bei dem ein Nutzer 100 USDC sendet und 100 USDC erhält, auf derselben Kette oder über Ketten hinweg. Er erklärt, wie das LI.FI-Solver-Netzwerk die Order ausführt und wie du sie On-Chain prüfst. Er ist für Teams gedacht, die Zahlungs- oder Finanzprodukte bauen.

Wann du ihn nutzt

  • ✓Wenn Nutzer einen Stablecoin exakt im Verhältnis 1:1 in einen anderen tauschen sollen.
  • ✓Wenn du eine Zahlungs- oder Neobank-App baust, die einen klaren, festen Betrag braucht.
  • ✓Wenn du eine Stablecoin-Überweisung über Ketten hinweg willst, bei der der Nutzer eine einzige Zahl sieht.

Link zum Skill

https://github.com/internet-court/internet-court-skill/blob/main/vendored/lifi/lifi-stablecoin-swap/SKILL.md

Kopiere ihn und füge ihn in deine KI ein (Claude, ChatGPT oder Cursor) mit der Bitte, den Anweisungen zu folgen.

So nutzt du ihn

Am einfachsten: Kopiere die Nachricht und füge sie in deine KI ein. Sie liest den Skill und folgt den Anweisungen.

Fertige Nachricht zum Einfügen

Nutze diesen Skill, um mir zu helfen: https://github.com/internet-court/internet-court-skill/blob/main/vendored/lifi/lifi-stablecoin-swap/SKILL.md Lies die SKILL.md unter diesem Link und folge ihren Anweisungen für meine Aufgabe.
Soll deine KI Skills wie diesen selbst finden?Installiere den kostenlosen Skillpedia-MCP: eine Zeile, und sie durchsucht vor jeder Aufgabe 15.000+ Skills.In 1 Minute installieren →

Beispielanfrage an deine KI

“Ich möchte, dass meine Finanz-App es Nutzern erlaubt, 100 USDC zu senden und genau 100 USDC auf einer anderen Kette ankommen zu lassen.”

5 neue Skills pro Woche. 1 Minute Lesezeit.

So funktioniert es

Der Agent richtet ein Integrator-Konto bei LI.FI ein und nutzt dann das TypeScript-SDK von Intents, um das Angebot anzufordern, die On-Chain-Order zu bauen und sie zu verfolgen. 1:1-Angebote gibt es nur unter deinem Integrator-Schlüssel und für unterstützte Stablecoin-Paare.

Technischer Inhalt (originale SKILL.md)

Originaltext des Autors, auf Englisch, direkt von GitHub.

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.)

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.

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.

import { Intent, type IntentDeps, type StandardEVM } from "@lifi/intent";
import type { WalletClient } from "viem";

const POLYMER_ORACLE = "0x0000003E06000007A224
Häufige Fragen

Warum kann der Betrag bei einer normalen Überweisung abweichen?

Gebühren und Spannen nehmen einen kleinen Anteil, daher kommt bei einer normalen Überweisung etwas weniger an, als du gesendet hast.

Was brauche ich, bevor ich 1:1-Angebote bekomme?

Eine Integrator-ID aus dem LI.FI-Partnerportal und eine Integrationsvereinbarung mit LI.FI.

Kann ich das außerhalb von TypeScript nutzen?

Ja. Die Fähigkeit enthält die reine REST-API für Backends, die nicht in TypeScript laufen.

Details

Originalbeschreibung des Autors

Build a production 1:1 stablecoin swap with LI.FI Intents — an interface or backend where the amount the user sends equals the amount they receive (no visible gas or solver fees), same-chain or cross-chain, filled by LI.FI's solver network and verifiable on-chain. USE THIS SKILL WHEN USER WANTS TO: - Build a 1:1 stablecoin swap interface ("send 100 USDC, receive 100 USDC"), same- or cross-chain - Add stablecoin transfers with a guaranteed output amount to an app, backend, or bot - Build enterprise/fintech-grade transfers with no visible gas or solver fees for the end user - Implement the LI.FI

repo: internet-court/internet-court-skill

Beliebtheit

GitHub-Sterne
7.0k
Platz im Ranking
#13639
Lizenz
—
Aktualisiert
26.10.2026

Ist dieser Skill nützlich?

0

Anmelden um abzustimmen.

Kommentare

  • …

Weitere Skills aus diesem Repository

Ähnliche Skills