import { Client } from '@open-rpc/client-js'; import KardiaContract from '../smc'; interface KRC20Props { client?: Client; provider?: string; address?: string; name?: string; symbol?: string; decimals?: number; abi?: Record[]; chainId?: number; } declare class KRC20 { private _rpcClient; address: string; name: string; decimals: number; symbol: string; abi: Record[]; private _smcInstance; constructor({ client, address, name, decimals, symbol, provider, abi, chainId }: KRC20Props); /** * Set custom ABI to use KRC20 token * @param abi Custom ABI */ setCustomABI(abi: Record[]): void; private validateAddress; /** * Get contract instance to use custom function */ getContractInstance(): KardiaContract; /** * Get token name * @param fetch Flag to indicate if get from network or from local cache */ getName(fetch?: boolean): Promise; /** * Get token decimals * @param fetch Flag to indicate if get from network or from local cache */ getDecimals(fetch?: boolean): Promise; /** * Get token symbol * @param fetch Flag to indicate if get from network or from local cache */ getSymbol(fetch?: boolean): Promise; /** * Get token total supply * @param format Format to return, can be "string", "BigNumber" or "number" */ getTotalSupply(format?: 'string' | 'BigNumber' | 'number'): Promise; /** * Get data from network to save to local cache * @param address Contract address */ getFromAddress(address: string): Promise; /** * Get balance of address * @param address Address to get balance */ balanceOf(address: string): Promise; /** * Transfer raw amount of token * @param privateKey Private key of wallet to send * @param to Receiver's address * @param amount Raw amount of token to transfer * @param transferPayload Custom tx payload * @param waitUntilMined Wait for tx to be mined or not */ transferRaw(privateKey: string, to: string, amount: string, transferPayload?: Record, waitUntilMined?: boolean): Promise; /** * Transfer token * @param privateKey Private key of wallet to send * @param to Receiver's address * @param amount Amount of token to transfer * @param transferPayload Custom tx payload * @param waitUntilMined Wait for tx to be mined or not */ transfer(privateKey: string, to: string, amount: number | string, transferPayload?: Record, waitUntilMined?: boolean): Promise; /** * Estimate gas for tx * @param to Receiver's address * @param amount Amount of token to transfer */ estimateGas(to: string, amount: number): Promise; } export default KRC20;