UNPKG

eos-utils

Version:

Powerful util library based on eosjs.

104 lines (103 loc) 2.77 kB
import { Api, JsonRpc, Serialize } from 'eosjs'; export declare const EOS_API_ENDPOINTS: string[]; export declare const EOS_API_ENDPOINTS_BLACK_LIST: string[]; export declare const EOS_QUANTITY_PRECISION = 4; export declare function getRandomRpc(apiEndpoint?: string): JsonRpc; export declare function getRandomApi(privateKey: string, apiEndpoint?: string): Api; export declare function sendTransaction( actions: Serialize.Action[], privateKey: string, apiEndpoint?: string, ): Promise<any>; /** * Create a transfer action. * * @param from The sender's EOS account * @param to The receiver's EOS account * @param symbol The currency symbol, e.g., EOS, USDT, EIDOS, DICE, KEY, etc. * @param quantity The quantity to send * @param memo memo */ export declare function createTransferAction( from: string, to: string, symbol: string, quantity: string, memo?: string, ): Serialize.Action; /** * Transfer EOS or EOS token to another account. * * @param from The sender's EOS account * @param privateKey The sender's EOS private key * @param to The receiver's EOS account * @param symbol The currency symbol, e.g., EOS, USDT, EIDOS, DICE, KEY, etc. * @param quantity The quantity to send * @param memo memo */ export declare function transfer( from: string, privateKey: string, to: string, symbol: string, quantity: string, memo?: string, ): Promise<any>; export declare function numericFromName(accountName: string): string; export declare function queryTransaction( txid: string, blockNum?: number, apiEndpoint?: string, ): Promise<any>; export declare function getCurrencyBalance( account: string, symbol: string, apiEndpoint?: string, ): Promise<number>; /** * Check the existance of an account. * * @param accountName EOS account name * @return true if exists, otherwise false */ export declare function accountExists(accountName: string, apiEndpoint?: string): Promise<boolean>; /** * Get the account names of a public key. * * @param publicKey EOS public key * @returns an array of account names, empty if not exist */ export declare function getKeyAccounts(publicKey: string, apiEndpoint?: string): Promise<string[]>; export interface TableRows { rows: Array<{ [key: string]: any; }>; more: boolean; } export declare function getTableRows( { code, scope, table, lower_bound, upper_bound, limit, }: { code: string; scope: string; table: string; lower_bound?: unknown; upper_bound?: unknown; limit?: number; }, apiEndpoint?: string, ): Promise<TableRows>; export declare function getCurrencyStats( contract: string, symbol: string, apiEndpoint?: string, ): Promise<{ supply: string; max_supply: string; issuer: string; }>;