Overview
TheSwapClient provides access to exchange rate discovery and swapping functionality for the Bloque platform. It serves as the main entry point for:
- Finding available exchange rates between asset pairs
- Accessing PSE payment utilities
- Managing generic bank transfer cash-outs to Colombian banks
Constructor
TheSwapClient is automatically initialized when you create a Bloque SDK instance. Access it via bloque.swap.
Properties
pse
PSE (Pagos Seguros en Línea) utilities client for listing banks and creating PSE swap orders.See PseClient for details.
bankTransfer
Generic bank transfer client for cash-out swaps supporting all Colombian banks.See BankTransferClient for details.
Methods
findRates()
Retrieves available exchange rates for a given asset pair with optional filters.Parameters
Rate search parameters
Returns
Example
Fee Structure
Exchange rates include detailed fee information with multiple components:Fee Component Types
Percentage-based fee (e.g., 2.5% of transaction)
percentage: The percentage value (e.g., 2.5)- Used for: Platform fees, take rates
Exchange rate-based fee
pair: Currency pair (e.g., “USD/COP”)- Used for: Exchange rate spreads
Fixed amount fee
amount: Fixed fee amount- Used for: PSE transaction fees, bank transfer fees
Fee Calculation Example
Rate Calculation
Rates are calculated based on:- Base exchange rate: The market rate between the two assets
- Medium fees: Fees charged by payment providers (e.g., PSE, bank transfers)
- Platform fees: Bloque’s service fee
- Amount: The source or destination amount you specify
Understanding the Rate Tuple
Therate field is a tuple [sourceAmount, destinationAmount] representing the conversion:
Amount Limits
Each rate includes minimum and maximum amounts:Related Types
FindRatesParams- Parameters for rate searchFindRatesResult- Result containing available ratesSwapRate- Individual exchange rate detailsFee- Fee structure and breakdownFeeComponent- Individual fee component