jcc-ethereum-utils
Version:
Toolkit of crossing chain from Ethereum to SWTC chain
94 lines (93 loc) • 2.08 kB
TypeScript
import { Contract } from "web3-eth-contract";
import Ethereum from "./ethereum";
import { ContractAbi } from "web3-types";
/**
* toolkit of smart contract
*
* @class SmartContract
*/
declare class SmartContract {
/**
* instance of smart contract
*
* @private
* @type {Contract}
* @memberof SmartContract
*/
private _contract;
/**
* instance of abi
*
* @private
* @type {any}
* @memberof SmartContract
*/
private _abi;
/**
* instance of ethereum
*
* @private
* @type {Ethereum}
* @memberof SmartContract
*/
private _ethereum;
/**
* contract address of smart contract
*
* @private
* @type {string}
* @memberof SmartContract
*/
private _address;
/**
* EthereumABI instance — set in init(), always present when callABI is invoked
*
* @private
* @type {Interface}
* @memberof SmartContract
*/
private interface;
/**
* Creates an instance of SmartContract
* @memberof SmartContract
*/
constructor();
/**
* return ethereum instance
*
* @readonly
* @type {Ethereum}
* SmartContract
*/
get ethereum(): Ethereum;
/**
* return contract instance
*
* @readonly
* @type {Contract}
* @memberof SmartContract
*/
get contract(): Contract<ContractAbi> | null;
get contractAddress(): string;
/**
* init instance of smart contract
*
* @param {string} tokenContractAddress contract address of smart contract
* @param {Ethereum} ethereum instance
* @param {any} abi
* @memberof SmartContract
*/
init(tokenContractAddress: string, ethereum: Ethereum, abi: any): void;
/**
* destroy instance of smart contract
*
* @memberof SmartContract
*/
destroy(): void;
/**
* call defined function in the abi
*
*/
callABI(name: string, ...args: unknown[]): Promise<string | void | []>;
}
export default SmartContract;