import BigNumber from 'bignumber.js'; import { ApiClient } from '../.'; /** * Single account ID (CScript or address) or reserved words, * - 'mine' to list history for all owned accounts or * - 'all' to list the whole DB */ export declare enum OwnerType { MINE = "mine", ALL = "all" } export declare enum DfTxType { MINT_TOKEN = "M", BURN_TOKEN = "F", POOL_SWAP = "s", ADD_POOL_LIQUIDITY = "l", REMOVE_POOL_LIQUIDITY = "r", UTXOS_TO_ACCOUNT = "U", ACCOUNT_TO_UTXOS = "b", ACCOUNT_TO_ACCOUNT = "B", ANY_ACCOUNTS_TO_ACCOUNTS = "a", CREATE_MASTERNODE = "C", RESIGN_MASTERNODE = "R", CREATE_TOKEN = "T", UPDATE_TOKEN = "N", UPDATE_TOKEN_ANY = "n", CREATE_POOL_PAIR = "p", UPDATE_POOL_PAIR = "u", SET_GOV_VARIABLE = "G", AUTO_AUTH_PREP = "A", NONE = "0", FUTURE_SWAP_EXECUTION = "q", FUTURE_SWAP_REFUND = "w" } /** * Configure the format of amounts * id - amount with the following 'id' -> @id * symbol - amount with the following 'symbol' -> @symbol */ export declare enum Format { ID = "id", SYMBOL = "symbol" } export declare enum SelectionModeType { PIE = "pie", CRUMBS = "crumbs", FORWARD = "forward" } export declare enum TransferDomainType { NONE = 0, /** type reserved for UTXO */ UTXO = 1, /** type for DVM Token To EVM transfer */ DVM = 2, /** type for EVM To DVM Token transfer */ EVM = 3 } export declare enum TransferDomainKey { SRC = "src", DST = "dst" } export declare enum TransferDomainOptionalKey { SINGLE_KEY_CHECK = "singlekeycheck" } /** * Account RPCs for DeFi Blockchain */ export declare class Account { private readonly client; constructor(client: ApiClient); /** * Get information about all accounts on chain * Return account with object owner info, addresses and amount with tokenId * * @param {AccountPagination} [pagination] * @param {string} [pagination.start] * @param {boolean} [pagination.including_start] * @param {number} [pagination.limit=100] * @param {boolean} [verbose=true] default = true, otherwise limited objects are listed * @param {ListAccountOptions} [options] default = true, otherwise limited objects are listed * @param {boolean} [options.indexedAmounts=false] format of amount output, default = false (true: {tokenid:amount}, false: amount@tokenid) * @param {boolean} [options.isMineOnly=false] get balances about all accounts belonging to the wallet * @return {Promise>>} */ listAccounts(pagination?: AccountPagination, verbose?: boolean, options?: ListAccountOptions): Promise>>; /** * Get information about all accounts on chain * Return account with hex-encoded owner info, addresses and amount with tokenId * * @param {AccountPagination} [pagination] * @param {string} [pagination.start] * @param {boolean} [pagination.including_start] * @param {number} [pagination.limit=100] * @param {boolean} [verbose=true] default = true, otherwise limited objects are listed * @param {ListAccountOptions} [options] default = true, otherwise limited objects are listed * @param {boolean} [options.indexedAmounts=false] format of amount output, default = false (true: {tokenid:amount}, false: amount@tokenid) * @param {boolean} [options.isMineOnly=false] get balances about all accounts belonging to the wallet * @return {Promise>>} */ listAccounts(pagination: AccountPagination, verbose: false, options: { indexedAmounts: false; isMineOnly: boolean; }): Promise>>; /** * Get information about all accounts on chain * Return account with object owner info, addresses and object with indexed amount * * @param {AccountPagination} [pagination] * @param {string} [pagination.start] * @param {boolean} [pagination.including_start] * @param {number} [pagination.limit=100] * @param {boolean} [verbose=true] default = true, otherwise limited objects are listed * @param {ListAccountOptions} [options] default = true, otherwise limited objects are listed * @param {boolean} [options.indexedAmounts=false] format of amount output, default = false (true: {tokenid:amount}, false: amount@tokenid) * @param {boolean} [options.isMineOnly=false] get balances about all accounts belonging to the wallet * @return {Promise>>} */ listAccounts(pagination: AccountPagination, verbose: true, options: { indexedAmounts: true; isMineOnly: boolean; }): Promise>>; /** * Get information about all accounts on chain * Return account with hex-encoded owner info, addresses and object with indexed amount * * @param {AccountPagination} [pagination] * @param {string} [pagination.start] * @param {boolean} [pagination.including_start] * @param {number} [pagination.limit=100] * @param {boolean} [verbose=true] default = true, otherwise limited objects are listed * @param {ListAccountOptions} [options] default = true, otherwise limited objects are listed * @param {boolean} [options.indexedAmounts=false] format of amount output, default = false (true: {tokenid:amount}, false: amount@tokenid) * @param {boolean} [options.isMineOnly=false] get balances about all accounts belonging to the wallet * @return {Promise>>} */ listAccounts(pagination: AccountPagination, verbose: false, options: { indexedAmounts: true; isMineOnly: boolean; }): Promise>>; /** * Get information about account * Return an object account with indexed amount * * @param {string} owner address in base58/bech32/hex encoding * @param {AccountPagination} [pagination] * @param {string | number} [pagination.start] * @param {boolean} [pagination.including_start] * @param {number} [pagination.limit=100] * @param {GetAccountOptions} [options] * @param {boolean} [options.indexedAmounts=false] format of amount output, default = false (true: {tokenid:amount}, false: amount@tokenid) * @return {Promise; /** * Get information about account * Return an array of amount with tokenId * * @param {string} owner address in base58/bech32/hex encoding * @param {AccountPagination} [pagination] * @param {string | number} [pagination.start] * @param {boolean} [pagination.including_start] * @param {number} [pagination.limit=100] * @param {GetAccountOptions} [options] * @param {boolean} [options.indexedAmounts=false] format of amount output, default = false (true: {tokenid:amount}, false: amount@tokenid) * @return {Promise | AccountAmount} resolves as ['60.00000000@DFI'] */ getAccount(owner: string, pagination?: AccountPagination, options?: GetAccountOptions): Promise; /** * Get the balances of all accounts that belong to the wallet * Return an array of amount with index * * @param {AccountPagination} [pagination] * @param {string} [pagination.start] * @param {boolean} [pagination.including_start] * @param {number} [pagination.limit=100] * @param {boolean} [indexedAmounts=false] format of amount output, default = false (true: {tokenid:amount}, false: amount@tokenid) * @param {GetTokenBalancesOptions} [options] * @param {boolean} [options.symbolLookup=false] use token symbols in output, default = false * @param {boolean} [options.includeEth=false] to include Eth balances in output, default = false * @return {Promise} resolves as [ '300.00000000@0', '200.00000000@1' ] */ getTokenBalances(pagination?: AccountPagination, indexedAmounts?: boolean, options?: GetTokenBalancesOptions): Promise; /** * Get the balances of all accounts that belong to the wallet * Return object amount with index * * @param {AccountPagination} [pagination] * @param {string} [pagination.start] * @param {boolean} [pagination.including_start] * @param {number} [pagination.limit=100] * @param {boolean} [indexedAmounts=false] format of amount output, default = false (true: {tokenid:amount}, false: amount@tokenid) * @param {GetTokenBalancesOptions} [options] * @param {boolean} [options.symbolLookup=false] use token symbols in output, default = false * @param {boolean} [options.includeEth=false] to include Eth balances in output, default = false * @return {Promise} resolves as { '0': 300, '1': 200 } */ getTokenBalances(pagination: AccountPagination, indexedAmounts: true, options: { symbolLookup: false; includeEth: false; }): Promise; /** * Get the balances of all accounts that belong to the wallet * Return array of amount with tokenId * * @param {AccountPagination} [pagination] * @param {string} [pagination.start] * @param {boolean} [pagination.including_start] * @param {number} [pagination.limit=100] * @param {boolean} [indexedAmounts=false] format of amount output, default = false (true: {tokenid:amount}, false: amount@tokenid) * @param {GetTokenBalancesOptions} [options] * @param {boolean} [options.symbolLookup=false] use token symbols in output, default = false * @param {boolean} [options.includeEth=false] to include Eth balances in output, default = false * @return {Promise} resolves as [ '300.00000000@DFI', '200.00000000@DBTC' ] */ getTokenBalances(pagination: AccountPagination, indexedAmounts: false, options: { symbolLookup: true; includeEth: false; }): Promise; /** * Get the balances of all accounts that belong to the wallet * Return object amount with tokenId * * @param {AccountPagination} [pagination] * @param {string} [pagination.start] * @param {boolean} [pagination.including_start] * @param {number} [pagination.limit=100] * @param {boolean} [indexedAmounts=false] format of amount output, default = false (true: {tokenid:amount}, false: amount@tokenid) * @param {GetTokenBalancesOptions} [options] * @param {boolean} [options.symbolLookup=false] use token symbols in output, default = false * @param {boolean} [options.includeEth=false] to include Eth balances in output, default = false * @return {Promise} resolves as { DFI: 300, DBTC: 200 } */ getTokenBalances(pagination: AccountPagination, indexedAmounts: true, options: { symbolLookup: true; includeEth: false; }): Promise; /** * Create a UTXOs to Account transaction submitted to a connected node. * Optionally, specific UTXOs to spend to create that transaction. * * @param {BalanceTransferPayload} payload * @param {string} payload[address] * @param {UTXO[]} [utxos = []] * @param {string} [utxos.txid] * @param {number} [utxos.vout] * @return {Promise} */ utxosToAccount(payload: BalanceTransferPayload, utxos?: UTXO[]): Promise; /** * Create an Account to Account transaction submitted to a connected node. * Optionally, specific UTXOs to spend to create that transaction. * * @param {string} from * @param {BalanceTransferPayload} payload * @param {string} payload[address] * @param {BalanceTransferAccountOptions} [options] * @param {UTXO[]} [options.utxos = []] * @param {string} [options.utxos.txid] * @param {number} [options.utxos.vout] * @return {Promise} */ accountToAccount(from: string, payload: BalanceTransferPayload, options?: BalanceTransferAccountOptions): Promise; /** * Create an transfer domain transaction submitted to a connected node. * * @param {Array | Record>} payload[] * @param {Record | Record} payload * @param {TransferDomainInfo} info * @param {string} info.address * @param {string} info.amount * @param {TransferDomainType} info.domain * @param {string} [info.data] optional data, note: currently its not used * @param {TransferDomainOptionalInfo} optionalInfo * @param {boolean} [optionalInfo.singleKeyCheck=true] * @return {Promise} */ transferDomain(payload: Array | Record>): Promise; /** * Create an Account to UTXOS transaction submitted to a connected node. * Optionally, specific UTXOs to spend to create that transaction. * * @param {string} from * @param {BalanceTransferPayload} payload * @param {string} payload[address] * @param {BalanceTransferAccountOptions} [options] * @param {UTXO[]} [options.utxos = []] * @param {string} [options.utxos.txid] * @param {number} [options.utxos.vout] * @return {Promise} */ accountToUtxos(from: string, payload: BalanceTransferPayload, options?: BalanceTransferAccountOptions): Promise; /** * Returns information about account history * * @param {OwnerType | string | string[]} [owner=OwnerType.MINE] Account ID(s) (CScript or address) or reserved words 'mine' to list history for all owned accounts or 'all' to list whole DB * @param {AccountHistoryOptions} [options] * @param {number} [options.maxBlockHeight] Optional height to iterate from (down to genesis block), (default = chaintip). * @param {number} [options.depth] Maximum depth, from the genesis block is the default * @param {boolean} [options.no_rewards] Filter out rewards * @param {string} [options.token] Filter by token * @param {DfTxType} [options.txtype] Filter by transaction type. See DfTxType. * @param {DfTxType[]} [options.txtypes] Filter multiple transaction types, supported letter from {CustomTxType}. * @param {number} [options.limit=100] Maximum number of records to return, 100 by default * @param {number} [options.start] Number of entries to skip * @param {boolean} [options.including_start=false] If true, then iterate including starting position. False by default * @param {number} [options.txn] Order in block, unlimited by default * @param {Format} [options.format] Set the return amount format, Format.SYMBOL by default * @return {Promise} */ listAccountHistory(owner?: OwnerType | string | string[], options?: AccountHistoryOptions): Promise; /** * Returns information about single account history * * @param {string} owner Single account ID (CScript or address) * @param {number} blockHeight Block height to search in * @param {number} txn Order in block * @return {Promise} */ getAccountHistory(owner: string, blockHeight: number, txn: number): Promise; /** * Returns count of account history * * @param {OwnerType | string | string[]} [owner=OwnerType.MINE] Account ID(s) (CScript or address) or reserved words 'mine' to list history count for all owned accounts or 'all' to list whole DB * @param {AccountHistoryCountOptions} [options] * @param {boolean} [options.no_rewards] Filter out rewards * @param {string} [options.token] Filter by token * @param {DfTxType} [options.txtype] Filter by transaction type. See DfTxType. * @param {DfTxType[]} [options.txtypes] Filter by multiple transaction types. See DfTxType. * @return {Promise} count of account history */ historyCount(owner?: OwnerType | string | string[], options?: AccountHistoryCountOptions): Promise; /** * Creates a transfer transaction from your accounts balances. * * @param {AddressBalances} from source address as the key, the value is amount formatted as amount@token * @param {AddressBalances} to address as the key, the value is amount formatted as amount@token * @param {SendTokensOptions} [options = { selectionMode: SelectionModeType.PIE }] * @param {SelectionModeType} [options.selectionMode] Account selection mode. If "from" param is empty, it will auto select. * @return {Promise} */ sendTokensToAddress(from: AddressBalances, to: AddressBalances, options?: SendTokensOptions): Promise; /** * Returns information about current anchor bonus, incentive funding, burnt token(s) * * @return {Promise} */ listCommunityBalances(): Promise; /** * Returns information about burn history * * @param {BurnHistoryOptions} [options] * @param {number} [options.maxBlockHeight] The block height to iterate from. * @param {number} [options.depth] Maximum depth, from the genesis block is the default * @param {string} [options.token] Filter by token * @param {DfTxType} [options.txtype] Filter by transaction type. See DfTxType. * @param {number} [options.limit=100] Maximum number of records to return, 100 by default * @return {Promise} */ listBurnHistory(options?: BurnHistoryOptions): Promise; /** * Returns burn address, burnt coin and token information. * Requires full acindex for correct amount, tokens and feeburn values. * * @return {Promise} */ getBurnInfo(): Promise; /** * Creates and submits to the network a futures contract. * * @param {FutureSwap} future * @param {string} future.address Address to fund contract and receive resulting token * @param {string} future.amount Amount to send in amount@token format * @param {string} [future.destination] Expected dToken if DUSD supplied * @param {UTXO[]} [options.utxos = []] * @param {string} options.utxos.txid * @param {number} options.utxos.vout * @return {Promise} */ futureSwap(future: FutureSwap, utxos?: UTXO[]): Promise; /** * Creates and submits to the network a withdrawal from futures contract transaction. * * @param {FutureSwap} future * @param {string} future.address Address to fund contract and receive resulting token * @param {string} future.amount Amount to send in amount@token format * @param {string} [future.destination] Expected dToken if DUSD supplied * @param {UTXO[]} [options.utxos = []] * @param {string} options.utxos.txid * @param {number} options.utxos.vout * @return {Promise} */ withdrawFutureSwap(future: FutureSwap, utxos?: UTXO[]): Promise; /** * Get specific pending futures. * * @return {Promise} */ getPendingFutureSwaps(address: string): Promise; /** * List all pending futures. * * @return {Promise} */ listPendingFutureSwaps(): Promise; /** * List pending DUSD swaps futures. * * @return {Promise} */ listPendingDusdSwaps(): Promise; /** * Get pending DUSD swaps future. * * @param {string} address to get pending future swaps * @return {Promise} */ getPendingDusdSwaps(address: string): Promise; } export interface AccountPagination { start?: number | string; including_start?: boolean; limit?: number; } export interface AccountResult { key: string; owner: T; amount: U; } export interface AccountOwner { asm: string; hex: string; reqSigs: BigNumber; type: string; addresses: string[]; } export interface AccountAmount { [id: string]: BigNumber; } export interface ListAccountOptions { indexedAmounts?: boolean; isMineOnly?: boolean; } export interface GetAccountOptions { indexedAmounts?: boolean; } export interface GetTokenBalancesOptions { symbolLookup?: boolean; includeEth?: boolean; } export interface BalanceTransferPayload { [key: string]: string; } export interface BalanceTransferAccountOptions { utxos?: UTXO[]; } export interface UTXO { txid: string; vout: number; } export interface AccountHistory { owner: string; blockHeight: number; blockHash?: string; blockTime?: number; type: string; txn: number; txid: string; amounts: string[]; } export interface AccountHistoryOptions { maxBlockHeight?: number; depth?: number; no_rewards?: boolean; token?: string; txtype?: DfTxType; txtypes?: DfTxType[]; limit?: number; start?: number; including_start?: boolean; txn?: number; format?: Format; } export interface AccountHistoryCountOptions { token?: string; txtype?: DfTxType; txtypes?: DfTxType[]; no_rewards?: boolean; } export interface AddressBalances { [key: string]: string[]; } export interface SendTokensOptions { selectionMode: SelectionModeType; } export interface CommunityBalanceData { AnchorReward: BigNumber; IncentiveFunding?: BigNumber; Burnt: BigNumber; Swap?: BigNumber; Futures?: BigNumber; Options?: BigNumber; Unallocated?: BigNumber; Unknown?: BigNumber; } export interface BurnHistoryOptions { maxBlockHeight?: number; depth?: number; token?: string; txtype?: DfTxType; limit?: number; } export interface BurnHistory { owner: string; blockHeight: number; blockHash: string; blockTime: number; type: string; txn: number; txid: string; amounts: string[]; } export interface BurnInfo { address: string; /** * Amount send to burn address */ amount: BigNumber; /** * Token amount send to burn address; formatted as AMOUNT@SYMBOL */ tokens: string[]; /** * Token amount burnt by consortium members */ consortiumtokens: string[]; /** * Amount collected via fee burn */ feeburn: BigNumber; /** * Amount collected via emission burn */ emissionburn: BigNumber; /** * Amount collected via auction burn */ auctionburn: BigNumber; /** * Burns after payback */ paybackburn: string[]; /** * Formatted as AMOUNT@SYMBOL */ dexfeetokens: string[]; /** * Amount of DFI collected from penalty resulting from paying DUSD using DFI */ dfipaybackfee: BigNumber; /** * Amount of tokens that are paid back; formatted as AMOUNT@SYMBOL */ dfipaybacktokens: string[]; /** * Amount of paybacks */ paybackfees: string[]; /** * Amount of tokens that are paid back */ paybacktokens: string[]; /** * Amount of tokens burned due to futureswap */ dfip2203: string[]; /** * Amount of tokens burned due to DFI-to-DUSD swap */ dfip2206f: string[]; } export interface FutureSwap { address: string; amount: string; destination?: string; } export interface GetFutureInfo { owner: string; values: FutureData[]; } export interface FutureData { source: string; destination: string; } export interface ListFutureInfo { owner: string; source: string; destination: string; } export interface DusdSwapsInfo { owner: string; amount: BigNumber; } export interface TransferDomainInfo { address: string; amount: string; domain: TransferDomainType; } export interface TransferDomainOptionalInfo { singleKeyCheck: boolean; } //# sourceMappingURL=account.d.ts.map