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 TreasuryAPI extends TransactionAPI { /** * @returns The total amount issued in the system */ total(): Promise; /** * @param id The AccountId of a user * @returns The user's balance */ balance(id: AccountId): Promise; /** * @param destination The address of a user * @param amount The amount to transfer */ transfer(destination: string, amount: Big): Promise; /** * Subscribe to balance updates, denominated in PolkaBTC * @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>; } export declare class DefaultTreasuryAPI extends DefaultTransactionAPI implements TreasuryAPI { constructor(api: ApiPromise, account?: AddressOrPair); total(): Promise; balance(id: AccountId): Promise; subscribeToBalance(account: string, callback: (account: string, balance: Big) => void): Promise<() => void>; transfer(destination: string, amount: Big): Promise; }