Skip to content

Payroll and batch payouts

A wallet-funded private quote can turn one deposit into 1–20 USDC payouts. Each fixed outputs[].amount is in SilentSwap USDC units—build it with parseUsdc('40') regardless of payout chain.

Fixed USDC targets

This request pays 40 USDC on Base and 60 USDC on BNB Chain.

import { parseUsdc, type QuoteRequest, type SilentSwapClient } from '@silentswap/sdk';
 
declare const client: SilentSwapClient;
 
const payroll: QuoteRequest = {
  privacy: true,
  inputAddress: '0x70997970C51812dc3A010C7d01b50e0d17dc79C8',
  sourceAsset: 'USDC',
  sourceChainId: 1,
  outputs: [
    {
      address: '0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC',
      chainId: 8453,
      amount: parseUsdc('40'),
    },
    {
      address: '0x90F79bf6EB2c4f870365E785982E1f101E93b906',
      chainId: 56,
      amount: parseUsdc('60'),
    },
  ],
};
 
const quote = await client.quote(payroll);
 
// Render every output, asset, fee, and expiry in trusted UI before this line.
const order = await client.placeOrder(quote);
 
const stop = client.trackOrderViaWebSocket(
  order.reference,
  (state) => {
    for (const recipient of state.privacy ? state.recipients ?? [] : []) {
      console.log(recipient.splitIndex, recipient.status, recipient.recipientTxHash);
    }
  },
  console.error,
);
 
stop;

Track every row in state.recipients[]; a top-level status can hide a partially delivered batch. See order statuses and tracking.

Split an exact input by weight

Set top-level amount to spend exactly that many source-token base units. The output amounts then become ratio weights instead of fixed USDC targets. This request spends exactly 100 USDC and assigns its credited payout 70/30.

import type { QuoteRequest, SilentSwapClient } from '@silentswap/sdk';
 
declare const client: SilentSwapClient;
 
const weightedPayroll: QuoteRequest = {
  privacy: true,
  inputAddress: '0x70997970C51812dc3A010C7d01b50e0d17dc79C8',
  sourceAsset: 'USDC',
  sourceChainId: 8453,
  amount: 100_000_000n,
  outputs: [
    {
      address: '0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC',
      chainId: 8453,
      amount: 70n,
    },
    {
      address: '0x90F79bf6EB2c4f870365E785982E1f101E93b906',
      chainId: 56,
      amount: 30n,
    },
  ],
};
 
const quote = await client.quote(weightedPayroll);
 
// Render every output, asset, fee, and expiry in trusted UI before this line.
const order = await client.placeOrder(quote);
 
void order;

Until the deposit lands, weighted payouts are estimates. Render every payout with “≈” while state.payoutsAreEstimates is true.

Limits

  • A wallet-funded private quote accepts at most 20 recipients.
  • Every recipient must receive at least 10 USDC.
  • Direct USDC destinations are Base (8453) and BNB Chain (56).
  • A split cannot carry dest. Use separate orders for arbitrary output assets.

In both modes, render all outputs, assets, fees, and expiry in trusted UI before calling placeOrder.