UNPKG

nodejs-cryptomus

Version:

A comprehensive Node.js client for the Cryptomus API

47 lines (40 loc) 962 B
import { CryptomusClient } from '../client'; import { BalanceInfo } from '../types'; /** * Balance service for managing account balances */ export class BalanceService { private readonly client: CryptomusClient; /** * Create a new balance service * * @param client - Cryptomus API client */ constructor(client: CryptomusClient) { this.client = client; } /** * Get merchant balance * * @returns Balance information */ async getMerchantBalance(): Promise<BalanceInfo[]> { const response = await this.client.requestPayment<BalanceInfo[]>( 'GET', '/balance' ); return response.result; } /** * Get business balance (requires payout key) * * @returns Balance information */ async getBusinessBalance(): Promise<BalanceInfo[]> { const response = await this.client.requestPayout<BalanceInfo[]>( 'GET', '/balance' ); return response.result; } }