takefy-cryptomus
Version:
TypeScript SDK for the Cryptomus payment system API
28 lines (27 loc) • 1.06 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.OtherService = void 0;
const base_1 = require("./base");
/**
* Service class for handling miscellaneous Cryptomus API operations.
* Currently supports retrieving exchange rates.
*/
class OtherService extends base_1.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);
}
}
exports.OtherService = OtherService;