import { AccountId } from "@polkadot/types/interfaces/runtime"; import { ApiPromise } from "@polkadot/api"; import { AddressOrPair } from "@polkadot/api/types"; import Big from "big.js"; import { DefaultTransactionAPI, TransactionAPI } from "./transaction"; /** * @category PolkaBTC Bridge * The type Big represents DOT or PolkaBTC denominations, * while the type BN represents Planck or Satoshi denominations. */ export interface CollateralAPI extends TransactionAPI { /** * @returns Total locked collateral */ totalLocked(): Promise; /** * @param id The ID of an account * @returns The reserved balance of the given account */ balanceLocked(id: AccountId): Promise; /** * @param id The ID of an account * @returns The free balance of the given account */ balance(id: AccountId): Promise; /** * Subscribe to free balance updates, denominated in DOT * @param account AccountId string * @param callback Function to be called whenever the balance of an account is updated. * Its parameters are (accountIdString, freeBalance) */ subscribeToBalance(account: string, callback: (account: string, balance: Big) => void): Promise<() => void>; /** * Send a transaction that transfers from the caller's address to another address * @param address The recipient of the transfer * @param amount The balance to transfer */ transfer(address: string, amount: Big): Promise; } export declare class DefaultCollateralAPI extends DefaultTransactionAPI implements CollateralAPI { constructor(api: ApiPromise, account?: AddressOrPair); totalLocked(): Promise; balanceLocked(id: AccountId): Promise; balance(id: AccountId): Promise; subscribeToBalance(account: string, callback: (account: string, balance: Big) => void): Promise<() => void>; transfer(address: string, amount: Big): Promise; }