takefy-cryptomus
Version:
TypeScript SDK for the Cryptomus payment system API
24 lines (23 loc) • 922 B
JavaScript
import { BaseService } from "./base";
/**
* Service class for handling miscellaneous Cryptomus API operations.
* Currently supports retrieving exchange rates.
*/
export class OtherService extends BaseService {
/**
* Retrieves current exchange rates for a specific currency.
*
* @param {string} currency - The currency code to get exchange rates for (e.g., "USDT", "BTC").
* @returns {Promise<GetExchangeRatesForCurrencyResponse>} A promise that resolves with the exchange rates.
* @throws {Error} If the request fails or returns an error response.
*
* @example
* ```typescript
* const rates = await client.other.getExchangeRatesForCurrency("USDT");
* console.log(rates[0].course); // Current exchange rate
* ```
*/
async getExchangeRatesForCurrency(currency) {
return this.request(`/exchange-rate/${currency}/list`, "GET", undefined);
}
}