import BigNumber from 'bignumber.js'; import PublicKey from "../crypto/public-key"; import AccountAddress from '../interfaces/AccountAddress'; import AccountEthAddress from '../interfaces/AccountEthAddress'; import BlockHeader from '../interfaces/BlockHeader'; import TransactionObject from '../interfaces/TransactionObject'; import Block from '../interfaces/Block'; import Committee from '../interfaces/Committee'; import ContractLogs from '../interfaces/ContractLogs'; import AccountHistory from '../interfaces/AccountHistory'; import FullAccount from '../interfaces/FullAccount'; import ChainProperties from '../interfaces/ChainProperties'; import GlobalProperties from '../interfaces/GlobalProperties'; import Config from '../interfaces/Config'; import DynamicGlobalProperties from '../interfaces/DynamicGlobalProperties'; import ContractHistory from '../interfaces/ContractHistory'; import ContractResult from '../interfaces/ContractResult'; import FrozenBalance from '../interfaces/FrozenBalance'; import BtcAddress from '../interfaces/BtcAddress'; import { OperationHistoryObject } from '../interfaces/chain'; import { PotentialPeerRecord } from '../interfaces/net/peer-database'; import { IObject, IAssetObject, IAccountObject, ERC20DepositTokenObject, ERC20WithdrawTokenObject, } from '../interfaces/objects'; import RegistrationTask from '../interfaces/RegistrationTask'; import PeerDetails from '../interfaces/PeerDetails'; import { Log } from '../interfaces/vm/types'; import { asset } from '../serializers/chain'; import { signedTransaction } from '../serializers'; import { StringSerializer } from '../serializers/basic'; import { uint32, uint64, int32 } from '../serializers/basic/integers'; import { committeeMemberId, contractId } from '../serializers/chain/id/protocol'; import { VectorSerializer, SetSerializer } from '../serializers/collections'; import { Contract } from '../interfaces/Contract'; type SidechainType = "" | "eth" | "btc"; interface ContractLogsFilterOptions { /** IDs of the contract */ contracts?: SetSerializer["__TInput__"], /** Filters by certain events if any provided */ topics?: VectorSerializer>["__TInput__"], /** Number of block to start retrieve from */ fromBlock?: typeof int32["__TInput__"], /** Number of block to end to retrieve */ toBlock?: typeof int32["__TInput__"], } export default class Api { broadcastTransaction(tr: object): Promise; broadcastTransactionWithCallback(signedTransactionObject: object, wasBroadcastedCallback?: () => any): Promise; checkERC20Token(contractId: string): Promise; get24Volume(baseAssetName: string, quoteAssetName: string): Promise; getAccounts(accountIds: Array, force?: boolean): Promise; getAccountBalances( accountId: string, assetIds: Array, force?: boolean, ): Promise['__TOutput__']>; getAccountByName(accountName: string, force?: boolean): Promise; getAccountByAddress(address: string): Promise; getAccountCount(): Promise; getAccountDeposits(account: string, type: SidechainType): Promise; getAccountHistory(accountId: string, stop: string, limit: number, start: string): Promise>; getAccountHistoryOperations( accountId: string, operationId: string, start: number, stop: number, limit: number, ): Promise; getAccountReferences(accountId: string, force?: boolean): Promise; getAccountWithdrawals(account: string, type: SidechainType): Promise; getAllAssetHolders(): Promise>; getAssetHolders(assetId: string, start: number, limit: number): Promise>; getAssetHoldersCount(assetId: string): Promise; getAssets(assetIds: Array, force?: boolean): Promise>; getBalanceObjects(keys: Object): any; getBitAssetData(bitAssetId: string, force?: boolean): Promise; getBlock(blockNum: number): Promise; getBlockHeader(blockNum: number): Promise; getBlockVirtualOperations(blockNum: number): any; /** * Returns all deposits, for the given account id * @param account the id of the account to provide information about * @returns the all public erc20 deposits data stored in the blockchain */ getErc20AccountDeposits(account: string): Promise; /** * Returns all withdrawals, for the given account id * @param account the id of the account to provide information about * @returns the all public erc20 deposits data stored in the blockchain */ getERC20AccountWithdrawals(account: string): Promise; getBtcAddress(accountId: string): Promise>; getAccountAddresses(accountId: string, from: number, limit: number): Promise>; getEthAddress(accountId: string): Promise; getBtcDepositScript(btcDepositId: string): Promise; getChainId(force?: boolean): Promise getChainProperties(force?: boolean): Promise; getCommitteeFrozenBalance(committeeMemberId: string): Promise; getCommitteeMembers(committeeMemberIds: Array, force?: boolean): Promise>; getCommitteeMemberByAccount(accountId: string, force?: boolean): Promise; getConfig(force?: boolean): Promise; getContract(contractId: string): Promise; getContractBalances(contractId: string, force?: boolean): Promise; getContractPoolWhitelist(contractId: string): Promise; getDidObject(id: string): Promise; getKey(idString: string): Promise; getKeys(idString: string): Promise; getContractHistory( operationId: string, stop: number, limit: number, start: number, ): Promise; /** * Get operations relevant to the specified contract referenced by an event numbering specific to the contract. * The current number of operations for the contract can be found in the contract statistics (or use 0 for start). * @param contract the contract whose history should be queried * @param options.stop * Sequence number of earliest operation. 0 is default and will query `limit` number of operations. * @param options.limit Maximum number of operations to retrive (must not exceed 100) * @param options.start Sequence number of the most recent operation to retrive. * 0 is default, which will start querying from the most recent operation. * @returns A list of operations performed by contract, ordered from most recent to oldest */ getRelativeContractHistory(contract: typeof contractId["__TInput__"], options?: { stop?: typeof uint64["__TInput__"], limit?: typeof uint64["__TInput__"], start?: typeof uint64["__TInput__"], }): Promise; getContracts(contractIds: Array, force?: boolean): Promise>; /** * Get logs of specified contract logs filter options * @param opts Contract logs filter options (see {@link ContractLogsFilterOptions}) * @returns The contracts logs from specified blocks interval */ getContractLogs(opts?: ContractLogsFilterOptions): Promise; getContractPoolBalance(resultContractId: string, force?: boolean): Promise<{asset_id: string, amount: number}>; getContractResult(resultContractId: string, force?: boolean): Promise; getDynamicAssetData(dynamicAssetDataId: string, force?: boolean): Promise; getDynamicGlobalProperties(force?: boolean): Promise; /** Retrieve the current info about git revision of the project */ getGitRevision(): Promise<{ [key: string]: unknown }>; /** Retrieve the incentives info */ getIncentivesInfo(blockStart: number, blockEnd: number): Promise<{ [key: string]: unknown }>; getCurrentIncentivesInfo(): Promise<{ [key: string]: unknown }>; getAccountAddressByLabel(accountNameOrId: string, label: string): Promise<{ [key: string]: unknown }>; getAccountAddressHistory(address: string, options?: { stop?: string, limit?: typeof uint64["__TInput__"], start?: string, }): Promise<{ [key: string]: unknown }>; getFeePool(assetId: string): Promise; getFrozenBalances(accountId: string): Promise>; getFullAccounts( accountNamesOrIds: string[], subscribe?: boolean, force?: boolean, ): Promise; getFullContract(contractId: string, force?: boolean): Promise; getGlobalProperties(force?: boolean): Promise; getKeyReferences(keys: Array, force?: boolean): Promise; getMarginPositions(accountId: string): Promise; getNamedAccountBalances(accountName: string, assetIds: Array, force?: boolean): Promise; getObject(objectId: string, force?: boolean): Promise; getObjects(objectIds: string, force?: boolean): Promise>; getPotentialSignatures(tr: Object): Promise; getProposedTransactions(accountNameOrId: string): Promise; getTransactionById(transactionId: string): Promise; getBtcStakeAddress(accountNameOrId: string): Promise<{ id: string, account: string, stake_script: string, p2sh_address: string, }>; getRelativeAccountHistory(accountId: string, stop: number, limit: number, start: number): Promise; getRequiredFees(operations: Array, assetId: string): Promise>; getRequiredSignatures(tr: Object, availableKey: Array): Promise; getTicker(baseAssetName: string, quoteAssetName: string): Promise; getTradeHistory( baseAssetName: string, quoteAssetName: number, start: number, stop: number, limit: number, ): Promise; getTransaction(blockNum: number, transactionIndex: number): Promise; getTransactionHex(tr: object): Promise; getVestedBalances(balanceIds: Array): Promise; getVestingBalances(balanceIds: Array): Promise; callContractNoChangingState( contractId: string, caller: string, asset: { asset_id: string, amount: number | string }, code: string, ): Promise; listAssets(lowerBoundSymbol: string, limit: number): Promise; lookupAccounts(lowerBoundName: string, limit: number): Promise>; lookupAccountNames(accountNames: Array, force?: boolean): Promise; lookupAssetSymbols(symbolsOrIds: Array, force?: boolean): Promise; lookupCommitteeMemberAccounts(lowerBoundName: string, limit: number): Promise; registerAccount( name: string, activeKey: string, echoRandKey: string, evmAddress: string, wasBroadcastedCallback?: () => any, ): Promise<[{ block_num: number, tx_id: string }]>; requestRegistrationTask(): Promise /** * @param cb * @param options Contract logs filter options (see `ContractLogsFilterOptions` method) * @returns Callback id which should be referenced in `unsubscribeContractLogs` */ subscribeContractLogs(cb: (result: Log[]) => any, options?: ContractLogsFilterOptions): Promise; /** * Unsubscribe from contract log subscription * @param subscribeId Subscribe id (returns by `subscribeContractLogs`) */ unsubscribeContractLogs(subscribeId: typeof uint64["__TInput__"]): Promise; validateTransaction(tr: Object): Promise; verifyAuthority(tr: Object): Promise; verifyAccountAuthority(accountNameOrId: Object, signers: Array): Promise; getConnectedPeers(): Promise>; getPotentialPeers(): Promise; }