Skip to main content
Version: 2.1.34

SwapParams

The SwapParams type represents the parameters required for initiating a swap.

type SwapParams = {
fromAsset: Asset;
toAsset: Asset;
sendAmount: string;
receiveAmount: string;
timelock?: number;
minDestinationConfirmations?: number;
nonce?: number;
additionalData: {
strategyId: string;
btcAddress?: string;
};
affiliateFee?: AffiliateFeeOptionalChainAsset[];
};
PropertyTypeDescription
fromAssetAssetAsset to be sent.
toAssetAssetAsset to be received.
sendAmountstringAmount in lowest denomination of the sendAsset.
recieveAmountstringAmount in lowest denomination of the toAsset.
timelocknumberTime lock for the swap
minDestinationConfirmationsnumberThis will wait for the specified number of confirmations before redeeming the funds.
noncenumberUnique nonce for generating secret and secret hashes. If not provided, it will be generated as the total order count until now + 1.
additionalDataAdditionalDataAdditional data for the order.
affiliateFeeAffiliateFeeOptionalChainAsset[]Integrator fee for the order

AdditionalData

PropertyTypeDescription
strategyIdstringGet strategy id from the quote
btcAddressstringProvide btcAddress if the destination or source chain is bitcoin. This address is used as refund address if source chain is bitcoin, and as redeem address if destination chain is bitcoin.

AffiliateFeeOptionalChainAsset

type AffiliateFee = {
fee: number;
address: string;
chain: string;
asset: string;
};

type AffiliateFeeOptionalChainAsset = Omit<AffiliateFee, 'chain' | 'asset'> & Partial<Pick<AffiliateFee, 'chain' | 'asset'>>;
PropertyTypeDescription
feenumberThe affiliate fee amount in basis points (bps).
addressstringRecipient address where the affiliate fee will be sent.
chainstringThe blockchain network on which the fee payout should occur (e.g., ethereum, base).
assetstringThe asset (HTLC contract address) in which the fee should be paid to affiliate.