import Asset from '../model/asset'; import { TranscalPayload } from '../model/transcalPayload'; import { IIdentity } from '../types/eos'; import ChainHelper from './chain'; import ResHelper from './khRes'; /** * kh helper, supported kh contract operations * @author kinghand@foxmail.com */ export default class KhHelper { readonly _chain: ChainHelper; /** * initiate with the chain helper * @param {ChainHelper} _chain */ constructor(_chain: ChainHelper); /** * call kh contract with transfer (match eoskit) * @param {IIdentity} account - {name, authority} * @param {string} target - eos account, can be user or contract * @param {string} quantity - eos asset format, e.p. "1.0000 EOS" * @param {string} func - function name * @param {string} tokenAccount - name of token account * @param {Array} args - arguments of the transcal * @param {Function} cbError - memo * @return {Promise<*>} transactionData */ transcal(account: IIdentity, target: string, quantity: string, func: string, args: any[], cbError: (err: any) => any, tokenAccount?: string): Promise; /** * transcal with "0.0001 EOS" token * @param {IIdentity} account - {name, authority} * @param {string} target - eos account, can be user or contract * @param {string} symbolStr * @param {string} func * @param {Array} args - arguments of the transcal * @param {Function} cbError - memo * @return {Promise<*>} */ transend(account: IIdentity, target: string, symbolStr: string, func: string, args: any[], cbError: (err: any) => any): Promise; /** * get res helper of (code, sym) * @example kh.res('thecontract', 'WOD') * @param code - the contract's account * @param symStr - symbol of resource */ res(code: string, symStr: string): ResHelper; /** * check res of an user * @deprecated - using res(code, symStr).checkBalance(userAccount) instead * @param code - contract name * @param account_name - account of the user * @param symbolStr - symbol string like "EOS" * @return {Promise} - returns null if it's not exist. */ checkResOf(code: string, account_name: string, symbolStr: string): Promise; /** * check res of an user * @deprecated - using res(code, symStr).checkInfo() instead * @param code - contract name * @param symbolStr - symbol string like "EOS" * @return {Promise} - returns null if it's not exist. */ checkResInfo(code: string, symbolStr: string): Promise; /** * parse transcal payload to data structure * @param memo * @return {TranscalPayload} */ parseTranscalPayload(memo: string): TranscalPayload; /** * assemble transcal data structure to payload * @param func * @param args * @return {string} */ assembleTranscalPayload(func: string, ...args: string[]): string; }