UNPKG

jcc-ethereum-utils

Version:

Toolkit of crossing chain from Ethereum to SWTC chain

55 lines (54 loc) 1.44 kB
import Ethereum from "./ethereum"; import SmartContract from "./smartContract"; /** * toolkit of erc20 * * @class ERC20 */ declare class ERC20 extends SmartContract { /** * Creates an instance of ERC20 * @memberof ERC20 */ constructor(); /** * init instance of erc20 contract * * @param {string} contractAddress contract address of erc20 token * @memberof ERC20 */ init(contractAddress: string, ethereum: Ethereum): void; /** * destroy instance of erc20 contract * * @memberof ERC20 */ destroy(): void; /** * request decimals of erc20 token * * @returns {Promise<number>} * @memberof ERC20 */ decimals(): Promise<number>; /** * request balance of erc20 token * * @param {string} address ethereum address * @returns {Promise<string>} resolve "0" if request failed * @memberof ERC20 */ balanceOf(address: string): Promise<string>; /** * transfer token to erc20 contract address * * @param {string} secret ethereum secret of sender address * @param {string} to address of destination * @param {string} amount amount * @param {string} [nonce] nonce * @returns {Promise<string>} resolve hash if success * @memberof ERC20 */ transfer(secret: string, to: string, amount: string, nonce?: number): Promise<string>; } export default ERC20;