@handcash/handcash-connect
Version:
HandCash Connect SDK
60 lines (59 loc) • 2.51 kB
TypeScript
import HandCashConnectService from '../api/handcash_connect_service';
import { ExchangeRate, SpendableBalance, UserBalance } from '../types/account';
import { CurrencyCode } from '../types/currencyCode';
import { PaymentParameters, PaymentResult } from '../types/payments';
export default class Wallet {
handCashConnectService: HandCashConnectService;
constructor(handCashConnectService: HandCashConnectService);
/**
* Checks the user's spendable balance.
* See {@link https://docs.handcash.io/docs/check-balance} for more information.
*
* @param {string} currencyCode - The currency code.
* See the list of supported currencies here: {@link https://docs.handcash.io/docs/supported-currencies}.
*
* @returns {Promise<SpendableBalance>} A promise that resolves with the spendable balance.
*/
getSpendableBalance(currencyCode?: CurrencyCode): Promise<SpendableBalance>;
/**
* Get the user's total satoshi & fiat balance.
*
* @returns {Promise<UserBalance>} A promise that resolves with the user balance.
*/
getTotalBalance(): Promise<UserBalance>;
/**
* Get the user deposit address for legacy non P2P transactions.
*
* @returns {Promise<string>} A promise that resolves with the deposit address in base58 format.
*/
getDepositAddress(): Promise<string>;
/**
*
* Make a payment for your user.
* See {@link https://docs.handcash.io/docs/make-a-payment} for more information.
*
* @param {object} paymentParameters - The payment parameters.
*
* @returns {Promise<PaymentResult>} A promise that resolves with the payment result.
*/
pay(paymentParameters: PaymentParameters): Promise<PaymentResult>;
/**
* Fetch information about one of your payments using the transaction id as reference.
*
* @param {string} transactionId - The transaction id.
*
* @returns {Promise<PaymentResult>} A promise that resolves with the payment result.
*
*/
getPayment(transactionId: string): Promise<PaymentResult>;
/**
* Fetch the exchange rate for a given currency.
*
* @param {string} currencyCode - The currency code.
* See the list of supported currencies here: {@link https://docs.handcash.io/docs/supported-currencies}.
*
* @returns {Promise<ExchangeRate>} A promise that resolves with the exchange rate.
*
*/
getExchangeRate(currencyCode: CurrencyCode): Promise<ExchangeRate>;
}