Skip to content

Simple Bridge usage

import { createSilentSwapClient } from '@silentswap/sdk';
import type { WalletClient } from 'viem';
 
declare const walletClient: WalletClient;
const client = createSilentSwapClient({ walletClient });
 
const quote = await client.quote({
  privacy: false,
  inputAddress: '0x70997970C51812dc3A010C7d01b50e0d17dc79C8',
  sourceChainId: 1,
  sourceAsset: 'ETH',
  amount: 10_000_000_000_000_000n,
  outputs: [
    {
      address: '0x70997970C51812dc3A010C7d01b50e0d17dc79C8',
      chainId: 8453,
      dest: {
        kind: 'evm',
        chainId: 8453,
        assetId: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
        assetSymbol: 'USDC',
        assetDecimals: 6,
      },
    },
  ],
});
 
const order = await client.placeOrder(quote);
const stop = client.trackOrderViaWebSocket(order.reference, console.log, console.error);
void stop;

Simple Bridge is exact-input and accepts exactly one output. Integrator fees are not currently available for public routes.