Skip to main content

SDK Quickstart

The easiest way to integrate Sweepr is the TypeScript SDK. For the first release, Sweepr issues partner API keys directly. There is no self-service dashboard yet.

Initialize

Use version: 'v2' for EVM Partner V2 sweeps with on-chain fee splitting. Use version: 'v1' for Solana or the off-chain partner accounting path.

Check Supported Chains

Before showing a chain in your UI, read V2 status and use only chains that are ready for V5 builds:
The status response includes enabled chains, V5 contract addresses, output tokens, and router allowlists.

Build a Sweep

Builds should be created from your backend when using a secret key, or from your frontend only when Sweepr issued a public pk_live key with allowed origins.
Use an idempotency key when retrying a build request from your backend:

Verify Fee Authorization

Always verify the V2 fee authorization before asking the user to sign Permit2.
The SDK checks the EIP-712 signature, chain, V5 contract address, deadline, and fee bounds. If you know the expected partner payout wallet, pass it as an additional check:

Approve Permit2

For ERC-20 input tokens, the user may need a one-time approval from each token to Permit2 before the Permit2 signature can be spent by the V5 contract.
You can check allowance first:

Sign Permit2

Ask the user’s wallet to sign the Permit2 typed data returned by build.permit2.

Send Sweep Transaction

Use the SDK helper for the normal path. It verifies the fee authorization again before sending unless skipVerification is explicitly set.
If your wallet integration requires manual transaction construction, use the lower-level helper:

Confirm With Sweepr

After the transaction is submitted, send the hash back to Sweepr. Sweepr reads the receipt and confirms the actual split from the SweepExecutedV5 event.
Confirm is idempotent for the same submitted transaction hash. Sweepr rejects a different transaction hash after a sweep is already confirmed.

Check Status

Important status values:
  • pending: transaction is not indexed yet or still waiting.
  • completed: Sweepr matched the V5 event to the original fee authorization.
  • expired: the fee authorization expired before a transaction was submitted.
  • failed: the submitted transaction reverted or could not be accepted.

V1 Solana

V2 on-chain partner fee split is EVM-only. Use version: 'v1' for Solana until the Sweepr Solana settlement program is live.
Last modified on July 5, 2026