Monetize SDK

Learn how to configure fees and monetize your Sodax SDK integration.

When using the SODAX SDK, you can monetize your integration by collecting fees from the transactions processed through your application. The SDK supports fee configuration in two ways: globally when creating the SDK config, or per-request.

Defining Fee

import { PartnerFee } from '@sodax/sdk';

// Partner fee can be defined as a percentage or a definite token amount.
// Fee is optional, you can leave it empty/undefined.
const partnerFeePercentage = {
  address: '0x0000000000000000000000000000000000000000', // EVM (Sonic) address to receive fee
  percentage: 100, // 100 = 1%, 10000 = 100%
} satisfies PartnerFee;

const partnerFeeAmount = {
  address: '0x0000000000000000000000000000000000000000', // EVM (Sonic) address to receive fee
  amount: 1000n, // definite amount denominated in token decimal precision
} satisfies PartnerFee;

Global fee configuration

The recommended approach is to configure fees globally per feature when creating your SDK config using new Sodax({...configuration}). This ensures all requests use the same fee configuration automatically:

Per-request fee configuration

Alternatively, you can configure fees on a per-request basis. This is useful when you need different fee rates for different types of transactions or users. The fee parameter can be added to the params object when requesting quotes or executing swaps. All fee-enabled features contain similar logic (e.g. money market, etc..).

Quote request with fees

Swap request with fees

Last updated