nodejs-cryptomus
Version:
A comprehensive Node.js client for the Cryptomus API
63 lines (54 loc) • 1.52 kB
text/typescript
import { CryptomusClient } from '../client';
import { CurrencyNetworkInfo, PaymentLimitInfo } from '../types';
/**
* Currency service for managing currencies and limits
*/
export class CurrencyService {
private readonly client: CryptomusClient;
/**
* Create a new currency service
*
* @param client - Cryptomus API client
*/
constructor(client: CryptomusClient) {
this.client = client;
}
/**
* Get available currencies with networks for payment
*
* @returns List of available currencies with networks
*/
async getPaymentCurrencies(): Promise<CurrencyNetworkInfo[]> {
const response = await this.client.requestPayment<CurrencyNetworkInfo[]>(
'GET',
'/payment/currencies'
);
return response.result;
}
/**
* Get available currencies with networks for payout
*
* @returns List of available currencies with networks
*/
async getPayoutCurrencies(): Promise<CurrencyNetworkInfo[]> {
const response = await this.client.requestPayout<CurrencyNetworkInfo[]>(
'GET',
'/payout/currencies'
);
return response.result;
}
/**
* Get payment limits for a specific currency
*
* @param currency - Currency code
* @returns Payment limit information
*/
async getPaymentLimits(currency: string): Promise<PaymentLimitInfo> {
const response = await this.client.requestPayment<PaymentLimitInfo>(
'GET',
'/payment/limits',
{ currency }
);
return response.result;
}
}