lifi-stablecoin-swap
यह क्या करती है
यह गाइड दिखाती है कि ऐसा स्टेबलकॉइन स्वैप कैसे बनाएँ जहाँ उपयोगकर्ता 100 USDC भेजे और 100 USDC ही पाए, एक ही चेन पर या चेनों के पार। यह समझाती है कि LI.FI solver नेटवर्क ऑर्डर कैसे पूरा करता है और उसे on-chain कैसे जाँचें, उन टीमों के लिए जो पेमेंट या फ़िनटेक उत्पाद बना रही हैं।
कब इस्तेमाल करें
- ✓जब आप चाहते हों कि उपयोगकर्ता एक स्टेबलकॉइन को दूसरे में ठीक एक-से-एक रकम पर बदलें।
- ✓जब आप ऐसा पेमेंट या neobank ऐप बना रहे हों जिसे साफ़ और तय रकम चाहिए।
- ✓जब आप चेनों के पार स्टेबलकॉइन ट्रांसफ़र चाहते हों, जहाँ उपयोगकर्ता को एक ही संख्या दिखे।
Skill का लिंक
https://github.com/internet-court/internet-court-skill/blob/main/vendored/lifi/lifi-stablecoin-swap/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“मेरा फ़िनटेक ऐप उपयोगकर्ताओं को 100 USDC भेजने दे और दूसरी चेन पर ठीक 100 USDC पहुँचे।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
एजेंट LI.FI के साथ integrator खाता सेट करता है, फिर Intents TypeScript SDK से कोट माँगता है, on-chain ऑर्डर बनाता है और उसे ट्रैक करता है। एक-से-एक कोट केवल आपकी integrator कुंजी के तहत, समर्थित स्टेबलकॉइन जोड़ियों के लिए मिलते हैं।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे 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:
- Register an integrator ID on the LI.FI Partner Portal — https://portal.li.fi
- Complete an integration agreement with LI.FI. As part of onboarding, 1:1 stablecoin quoting is enabled for your integrator.
- 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
bigintliterals (100_000_000n).create-next-appdefaultstsconfig.jsonto"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
अक्सर पूछे जाने वाले सवाल
सामान्य ट्रांसफ़र में रकम अलग क्यों होती है?
Gas और spreads का थोड़ा हिस्सा लगता है, इसलिए सामान्य ट्रांसफ़र में आपकी भेजी रकम से थोड़ा कम पहुँच सकता है।
एक-से-एक कोट पाने से पहले क्या चाहिए?
LI.FI Partner Portal से integrator ID और LI.FI के साथ एक integration समझौता।
क्या मैं TypeScript के अलावा इसका इस्तेमाल कर सकता हूँ?
हाँ। स्किल में गैर-TypeScript बैकएंड के लिए raw REST API शामिल है।
जानकारी
लेखक का मूल विवरण
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
लोकप्रियता
- GitHub स्टार
- 7.0k
- रैंकिंग में स्थान
- #13639
- लाइसेंस
- —
- अपडेट की गई
- 26/10/2026
कमेंट
- …
इस repository की और skills
internet-court
7.0kयह आपके एजेंट को AI एजेंट या पेड सेवा से सुरक्षित तरीके से भुगतान और लेन-देन की शुरुआती दिशा देती है, और सही विशेष गाइड बताती है।
genlayer-erc7710-connector
7.0kयह आपके एजेंट को AI समीक्षा के नतीजे को अनुमति प्रणाली से जोड़ने देती है, ताकि खराब समीक्षा एजेंट की अनुमतियाँ सीमित कर सके।
genlayer-intelligent-contracts
7.0kयह आपके एजेंट को AI जज के नियम, सबूत और नतीजे तय करने में मदद करती है, जो जाँचता है कि दूसरा एजेंट अपने अधिकार के दायरे में रहा या नहीं।
x402-erc7710
7.0kयह आपके एजेंट को हर अनुरोध पर वेब सेवा का भुगतान करने और तय सीमा के भीतर लगातार खर्च करने की व्यवस्था में मदद करती है।
मिलती-जुलती skills
api-connector-builder
280kयह आपके एजेंट को मौजूदा pattern के हिसाब से नए API connections बनाने देता है। जब बिना कोई नया तरीका बनाए एक और integration जोड़ना हो, तब इसका इस्तेमाल करें।
api-design
280kयह आपके एजेंट को best practices के हिसाब से REST APIs डिज़ाइन करने में मदद करता है। यह तय करने में काम आता है कि APIs आपस में कैसे बात करें, errors कैसे दिखें, और data को कैसे व्यवस्थित करें।
backend-patterns
280kआपके एजेंट को server-side architecture patterns और database optimization में मदद करता है। server पर चलने वाला code बनाने या review करने के लिए उपयोगी है।