TypeScript SDK
The official TypeScript SDK is published as @sw4p/sdk.
It exposes one Sw4pClient that covers the narrower pilot helpers, the shared
settlement intent surfaces, agent operations, filler and auction surfaces,
ERC-7683 helpers, x402 helpers, and webhook verification.
Installation
npm install @sw4p/sdk
Quick Start
import { Sw4pClient } from "@sw4p/sdk";
const client = new Sw4pClient({
apiKey: "sk_555_live_...",
baseUrl: "https://api.sw4p.io",
});
Surface Rule
transfer()andestimate()are the narrower pilot initiation helpers.status()andpairs()expose the broader settlement graph.submitIntent()andgetIntentStatus()are the canonical shared settlement surfaces for new rail work.pairs().enabledis necessary but not sufficient: require the route's strict readiness and user-actionability contract before offering execution. During API maintenance, do not offer payment execution.
That means there is no separate BTC or Tron client. Those rails extend the same client contract.
Example
const quote = await client.submitIntent({
source_chain: "ETH",
dest_chain: "BASE",
input_token: "ETH",
output_token: "USDC",
input_amount: 10_000_000_000_000_000,
mev_protection: true,
deadline: Math.floor(Date.now() / 1000) + 300,
recipient: "0xRecipientAddress...",
sender: "0xSenderAddress...",
});
const status = await client.getIntentStatus(quote.intent_id);
Additional Surfaces
- Solana helpers:
solanaBuildTx(),solanaValidateGasless(),solanaSubmit() - Agent operations:
batchTransfer(),getPortfolio(),planRebalance(),executeRebalance() - Limit orders:
createLimitOrder(),listLimitOrders(),updateLimitOrder(),cancelLimitOrder() - Filler and auction operations:
registerFiller(),submitAuctionQuote(),getAuction(),listOpenAuctions(),confirmAuctionFill() - ERC-7683 helpers:
submitErc7683Order(),resolveOrder(),getSettlementInfo() - x402 helpers:
createPaymentRequirements(),createFacilitatorConfig(),NETWORKS,USDC_ADDRESSES - Webhook verification:
verifyWebhookSignature()
Builder Note
Several newer backend surfaces are camelCase on the wire. The TypeScript SDK keeps the established SDK-facing snake_case shapes where they already exist and translates internally so builders can adopt the newer surfaces without dealing with route-family casing drift directly.
submitIntent() forwards raw backend base-unit integers for input_amount and
min_output_amount. It does not convert decimal BTC or token amounts for you.
submitIntent() also accepts mev_protection as a shared execution
preference. Today that preference is surfaced to route safety signaling and
operator metrics, while the live private executor wiring remains staged in the
backend.
Current smart-account flows are wallet-authenticated backend and app surfaces,
not Sw4pClient API-key methods. See the smart-account guide and API
reference for that contract.
Limit orders currently execute only from pre-funded Solana/WaaS USDC balances;
omit source_chain or set it to "SOL".