UNPKG

jcc-ethereum-utils

Version:

Toolkit of crossing chain from Ethereum to SWTC chain

104 lines (103 loc) 3.23 kB
import BigNumber from "bignumber.js"; import ERC20 from "./erc20"; import Ethereum from "./ethereum"; import SmartContract from "./smartContract"; /** * Toolkit of Erc20Fingate * * @export * @class Erc20Fingate * @extends {EthereumFingate} */ declare class Fingate extends SmartContract { /** * ether gas limit * * @private * @type {number} * @memberof Fingate */ private _etherGasLimit; private _erc20; /** * Creates an instance of ERC20 * @memberof Fingate */ constructor(); /** * set & get _etherGasLimit * * @memberof EtherFingate */ set etherGasLimit(v: number); get etherGasLimit(): number; /** * init erc20 contract * * @param {string} etherContractAddress ether fingate address * @param {string} tokenContractAddress contract address of erc20 token * @memberof Erc20Fingate */ init(fingateAddress: string, ethereum: Ethereum): void; initErc20(erc20: ERC20): void; /** * destroy instance of contract * * @memberof Fingate */ destroy(): void; /** * check state if pending * * @param {((BigNumber | string)[])} state * @returns {boolean} return true if state is pending * @memberof Fingate */ isPending(state: (BigNumber | string)[]): boolean; /** * request deposit state * * @param {string} address ethereum address * @param {string} [contractAddress="0x0000000000000000000000000000000000000000"] contract address * @returns {(Promise<(BigNumber | string)[]>)} * @memberof Fingate */ depositState(address: string, contractAddress?: string): Promise<(BigNumber | string)[]>; /** * deposit ether * * @param {string} secret ethereum secret * @param {string} jingtumAddress jingtum address * @param {string} amount deposit value * @param {string} [nonce] nonce * @returns {Promise<string>} resolve hash if success * @memberof Fingate */ deposit(secret: string, jingtumAddress: string, amount: string, nonce?: number): Promise<string>; /** * deposit erc20 token * * @param {string} jtAddress swtc address * @param {string} tokenAddress erc20 contract address * @param {number} decimals token decimals * @param {string} amount amount of deposit * @param {string} hash generated by `transfer` api of ERC20 * @param {string} secret ethereum secret * @param {string} [nonce] nonce * @returns {Promise<string>} reslove hash of transaction if success * @memberof Fingate */ depositToken(jtAddress: string, tokenAddress: string, decimals: number, amount: string, hash: string, secret: string, nonce?: number): Promise<string>; /** * deposit erc20 * * @param {string} secret ethereum secret * @param {string} jtAddress jingtum address * @param {string} amount deposit value * @param {string} [nonce] nonce * @returns {Promise<string[]>} resolve hashs if success * @memberof Fingate */ depositErc20(secret: string, jtAddress: string, amount: string, nonce?: number): Promise<string[]>; } export default Fingate;