Migrate from SilentSwap V2
@silentswap/sdk@2.0.0 keeps the package name and familiar lifecycle names, but
removes the V2 authentication and authorization ceremony. Existing V2 orders are not
convertible: let them finish under your pinned 0.x integration before cutting over.
Migrate with an agent
Install the SilentSwap integration skill and let an agent perform the mechanical audit and rewrite. The skill preserves application-specific wallet decisions as explicit TODOs instead of guessing a wallet brand.
mkdir -p .agents/skills/silentswap-integration/references
curl -fsSL https://docs.silentswap.com/skill/SKILL.md \
-o .agents/skills/silentswap-integration/SKILL.md
curl -fsSL https://docs.silentswap.com/skill/references/complete-example.ts \
-o .agents/skills/silentswap-integration/references/complete-example.tsUse this prompt:
Use $silentswap-integration to migrate this application from @silentswap/sdk 0.x to 2.x.
Audit every old import and call site; remove nonce, SIWE, facilitator, and authorization
persistence; migrate quote, placeOrder, trackOrderViaWebSocket, executeRefund, errors, and
client configuration; flag pending V2 orders that must finish on pinned 0.x; run the
consumer typecheck; and leave TODOs only where this app must choose its wallet adapters.For Claude Code, install the same folder under
.claude/skills/silentswap-integration.
API mapping
| V2 | V3 |
|---|---|
createSilentSwapClient | unchanged |
| nonce/SIWE authentication | removed |
| facilitator group | removed |
quote({ outputs, pro }) | quote({ privacy, inputAddress, outputs, integratorFee }) |
| sign authorizations | removed; review the quote, then deposit |
order() | placeOrder(quote) |
trackOrderViaWebSocket | same name; transport is adaptive |
executeRefund | same name; accepts a private order reference |
| Simple Bridge | same product name; use privacy: false |
pro / integratorId | integratorFee / integratorAddress |
| React/Vue/widget packages | discontinued; React 2.x is planned |
Do not mechanically translate the old pro integrator ID into an integrator fee. Only add
integratorFee and integratorAddress after the application owner has
approved the USDC-denominated fee and payout address.
Rewrite each output
V2 and V3 both call the array outputs, but each row is simpler in V3:
| V2 output field | V3 output field |
|---|---|
recipient | address |
USDC decimal-string value | bigint amount in USDC base units |
non-USDC value | recompute the V3 USDC payout budget; do not copy destination-native units |
CAIP-19 asset | derive destination chainId and dest only |
method | removed |
facilitatorPublicKeys | removed |
extra.swap | optional dest, when it names an arbitrary destination asset |
Derive top-level sourceAsset or sourceToken independently from the old
application's source selection/deposit flow. Review ambiguous CAIP-19 or
extra.swap values with the application owner; an agent should leave a focused TODO
instead of guessing chain or token metadata.
Revised order flow
import { createSilentSwapClient } from '@silentswap/sdk';
import { parseUnits } from 'viem';
import type { WalletClient } from 'viem';
declare const account: `0x${string}`;
declare const recipient: `0x${string}`;
declare const walletClient: WalletClient;
const client = createSilentSwapClient({ walletClient });
const quote = await client.quote({
privacy: true,
inputAddress: account,
sourceChainId: 1,
sourceAsset: 'USDC',
outputs: [
{
address: recipient,
chainId: 8453,
amount: parseUnits('10', 6),
},
],
});
// Render quote.outputs/recipients, amounts, assets, fees, and expiresAt here.
const order = await client.placeOrder(quote);
const stop = client.trackOrderViaWebSocket(order.reference, console.log, console.error);
void stop;There is no replacement authorization ceremony. The user reviews the RFQ in your trusted UI,
then placeOrder handles an ERC-20 approval when necessary and submits the deposit.
Unlike V2, tracking no longer returns a promise that resolves to the final status: it emits
states through callbacks and immediately returns the teardown function. Refunds now return
{ refundTxHash } from
client.executeRefund(privateReference).
Behavioral changes
- V3 throws typed errors instead of returning
[error, value]tuples. - Production
baseUrlis optional and defaults tohttps://api.silentswap.com. - Public request terminology remains
outputs[]; the SDK maps it to the private backend's unchangedrecipients[]wire field. privacy: truealways requiresinputAddress.privacy: falseuses Simple Bridge with the same quote/place/track lifecycle.- Integrator fees use USDC base units and require
integratorAddresswhen positive. - Browser integrations must register their exact HTTPS production origin with SilentSwap support. Node and server integrations do not need CORS registration.
Remove persisted V2 nonces, SIWE tokens, facilitator wallets, authorization signatures, and WebSocket recovery data. Do not reinterpret them as V3 credentials.