@anywalletkit/protocol-swap2-usdt0

中文文档
0.4.2发布于 2026/11/07Apache-2.0TypeScriptESM + CJS构建来源已验证近 30 天下载 2311

USDT0 (Tether's LayerZero OFT for USDT) for the swap2 engine: USDT / USDT0 between 16 EVM chains in one source transaction — quoteOFT + quoteSend on the OFT itself, send with the LayerZero fee as msg.value, status from LayerZero Scan, lzReceive retry of a

原始使用文档
文档目录6 节
  1. Install
  2. What the provider does
  3. Tests
  4. Status
  5. Behind remoteProvider
  6. Activity

@anywalletkit/protocol-swap2-usdt0

npm

USDT0 — Tether's USDT as a LayerZero OFT — as a swap2 provider: USDT / USDT0 between 16 EVM chains in one source transaction. send(SendParam, MessagingFee, refund) on the chain's OFT with the LayerZero messaging fee as msg.value; LayerZero's DVNs verify the packet and the executor delivers on the destination (USDT0 minted, or USDT released from the Ethereum adapter). No spread, no protocol fee today — the only cost is the LayerZero fee in the source chain's native coin (≈ 0.0000024 ETH for Arbitrum → HyperEVM on 2026-10-20). It is the only direct USDT path into HyperEVM.

Install

npm install @anywalletkit/protocol-swap2-usdt0 @anywalletkit/core
# or: pnpm add @anywalletkit/protocol-swap2-usdt0 @anywalletkit/core  ·  yarn add @anywalletkit/protocol-swap2-usdt0 @anywalletkit/core

On npm: @anywalletkit/protocol-swap2-usdt0, published from the release workflow with provenance.

import {usdt0Provider} from "@anywalletkit/protocol-swap2-usdt0/provider";
import {RouterSwap2Protocol} from "@anywalletkit/protocol-swap2-router/swap2/router";

const swap2 = new RouterSwap2Protocol(arbitrumAccount, {fromChain: "eip155:42161", providers: [usdt0Provider({rpcUrls})]});
const res = await swap2.swap2({fromToken: "USDT0", toToken: "USDT0", toChain: 999, fromTokenAmount: 10_000_000n, minAmountOut: 10_000_000n});
// … poll …
const status = await swap2.getSwap2Status(res.id);   // "pending" → "completed" with the HyperEVM delivery hash

rpcUrls (CAIP-2 → URL or URLs) is required for every chain the provider quotes from: the fee and the received amount come from the OFT itself, not from an API.

What the provider does

  • Quote = two eth_calls on the source OFT. quoteOFT(SendParam) gives the limits, any OFT fee rows and amountReceivedLD — what really arrives after dust removal (shared decimals = 6 on every deployment, so nothing is removed today). That amount becomes minAmountLD, and quoteSend prices the message with it. The contract reverts rather than deliver less.
  • Calldata is sealed in the quote: send(SendParam{dstEid, to, amountLD, minAmountLD, extraOptions: 0x, composeMsg: 0x, oftCmd: 0x}, {nativeFee, 0}, refundAddress), value = nativeFee = the quoted LayerZero fee + 25 % headroom — the fee is paid at send time and moves with gas (live: +1.7 % in a minute on Ethereum); OAppSender needs msg.value == nativeFee and the endpoint refunds the unused part to refundAddress in the same transaction (declared as txRequest.nativeFee so the engine caps it per chain and the router prices it). extraOptions stays empty: every deployment's enforcedOptions already carry the executor gas (type-3, lzReceive gas 80 000, read on-chain 2026-10-20).
  • Approvals: Ethereum locks USDT in an OFT adapter (approvalRequired() = true) → approvalAddress is the adapter, exact amount. Every other chain's OFT burns the caller's USDT0 through the token's mint/burn role (approvalRequired() = false) → no approval at all.
  • Bound on-chain: before the first quote on a chain the OFT's token() and approvalRequired() must match config.ts; per pair, peers(dstEid) must be the destination OFT. A mismatch refuses the route with its reason.
  • Preflight (right before signing): target is the source OFT, peer still wired, and the current quoteSend fee still fits the sealed value — the endpoint reverts an underpaid send, so a fee past the headroom means re-quote.
  • Tracking: LayerZero Scan GET /v1/messages/tx/{sourceTxHash}, matched to the route's eids and the source OFT. INFLIGHT / CONFIRMING / BLOCKED → pending; DELIVERED → completed with the destination hash; PAYLOAD_STORED → action-required; FAILED and the burned / skipped / malformed statuses → failed; a hash whose message belongs to another pathway → failed.
  • Claim (buildClaim, through the engine's claimSwap2): a delivery that reverted on the destination is stored by the endpoint and can be retried by anyone — EndpointV2.lzReceive(origin, receiver, guid, message, 0x) with the exact packet Scan recorded, on the destination chain. Null otherwise.
  • Deployments (docs.usdt0.to, every address re-read on-chain 2026-10-20): Ethereum (eid 30101, adapter), Arbitrum 30110, OP Mainnet 30111, Polygon 30109, HyperEVM 30367, Ink 30339, Berachain 30362, Unichain 30320, Sei 30280, Plasma 30383, Monad 30390, MegaETH 30398, X Layer 30274, Mantle 30181, Morph 30322, Flare 30295. USDT0 is also live on Conflux eSpace, Hedera, Rootstock, Stable, Tempo, HyperCore, IOTA and Stellar — not wallet chains here yet. OP's catalog USDT is the legacy bridged token (not the OFT); USDT0 is.

Tests

pnpm test — provider tests over a fake JSON-RPC + fake LayerZero Scan (route gating, quote maths incl. dust and OFT fee rows, calldata binding, every named refusal, on-chain binding failures, preflight, the whole pending → completed / action-required / failed lifecycle, the lzReceive claim, the router snapshot) and the conformance suite incl. the behaviour fixture (the engine executes exactly the reviewed plan, no approval). USDT0_LIVE=1 pnpm test adds a live read-only quote on Arbitrum. pnpm verify:live re-reads all 13 deployments on-chain and quotes 10 USDT0 Arbitrum → HyperEVM with the preflight.

Status

2026-10-20: built, tests green, all 13 deployments verified on-chain, live quote + preflight verified. No funded transfer yet (plan: 10 USDT Arbitrum → HyperEVM from the phone, then the status through LayerZero Scan).

Behind remoteProvider

When the provider runs on your server, spread its pins into the app's stub: remoteProvider({name: "usdt0", baseUrl, ...usdt0Pins}). The engine then lets the EVM route call and approve only the USDT0 OFT (and, on Ethereum, the adapter as spender), never an address the backend names, and usdt0VerifyQuote decodes the server's send on the device: the destination eid, the recipient, the input, a minAmountLD that keeps the quoted minimum, no options or compose message, the trader as refund and the declared native fee as value. Without the pins the stub gets no EVM calldata route (fail closed).

Activity

describeActivity: send on the OFT → "Bridged USDT0" ("Bridged USDT" on Ethereum); the executor's delivery (USDT0 minted to the owner, or USDT released by the adapter, in a transaction the owner did not send) → "Received USDT0 via LayerZero"; the owner's own lzReceive retry → the same. Fixtures are recorded mainnet transactions (fixtures/activity).

版本与发布记录

@anywalletkit/protocol-swap2-usdt0 共发布 15 个版本,首次发布于 2026/10/25;过去 12 个月发布了 15 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.4.2latest2026/11/07今天
0.4.12026/11/052 天前
0.4.02026/11/035 天前
0.3.02026/10/308 天前
0.2.12026/10/309 天前
0.2.02026/10/2910 天前

关于 @anywalletkit/protocol-swap2-usdt0 的常见问题

@anywalletkit/protocol-swap2-usdt0 是什么?

USDT0 (Tether's LayerZero OFT for USDT) for the swap2 engine: USDT / USDT0 between 16 EVM chains in one source transaction — quoteOFT + quoteSend on the OFT itself, send with the LayerZero fee as msg.value, status from LayerZero Scan, lzReceive retry of a

如何安装 @anywalletkit/protocol-swap2-usdt0?

在项目目录运行 npm install @anywalletkit/protocol-swap2-usdt0,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@anywalletkit/core(0.8.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@anywalletkit/protocol-swap2-usdt0 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@anywalletkit/protocol-swap2-usdt0 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@anywalletkit/protocol-swap2-usdt0 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@anywalletkit/protocol-swap2-usdt0 可以商用吗?

@anywalletkit/protocol-swap2-usdt0 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@anywalletkit/protocol-swap2-usdt0 的下载量有多少?

根据 npm 官方下载统计,@anywalletkit/protocol-swap2-usdt0 在 2026/10/06 – 2026/11/04 这 30 天内被下载 2,311 次,日均约 77 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@anywalletkit/protocol-swap2-usdt0 还在维护吗?

最新版本 0.4.2 发布于 2026/11/07(今天);至今共发布 15 个版本,其中过去 12 个月发布了 15 个;首次发布于 2026/10/25。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。