import { IWalletModel } from "jcc_wallet/lib/types";
import { Contract } from "web3-eth-contract";
/**
 * Toolkit of Ethereum
 *
 * @export
 * @class Ethereum
 */
export default class Ethereum {
    /**
     * instance of web3
     *
     * @protected
     * @type {*}
     * @memberof Ethereum
     */
    protected _web3: any;
    /**
     * http node
     *
     * @private
     * @type {string}
     * @memberof Ethereum
     */
    private _node;
    /**
     * gas limit
     *
     * @private
     * @type {number}
     * @memberof Ethereum
     */
    private _gasLimit;
    /**
     * min gas price
     *
     * @private
     * @type {number}
     * @memberof Ethereum
     */
    private _minGasPrice;
    /**
     * default gas price
     *
     * @private
     * @type {number}
     * @memberof Ethereum
     */
    private _defaultGasPrice;
    /**
     * Creates an instance of Ethereum
     * @param {string} node http node
     * @memberof Ethereum
     */
    constructor(node: string);
    /**
     * set & get _gasLimit
     *
     * @type {number}
     * @memberof Ethereum
     */
    get gasLimit(): number;
    set gasLimit(gas: number);
    /**
     * set & get _minGasPrice
     *
     * @type {number}
     * @memberof Ethereum
     */
    get minGasPrice(): number;
    set minGasPrice(value: number);
    /**
     * set & get _defaultGasPrice
     *
     * @memberof Ethereum
     */
    set defaultGasPrice(v: number);
    get defaultGasPrice(): number;
    /**
     * validate ethereum address
     *
     * @static
     * @param {string} address ethereum address
     * @returns {boolean} return true if the address is valid
     * @memberof Ethereum
     */
    static isValidAddress(address: string): boolean;
    /**
     * validate ethereum secret
     *
     * @static
     * @param {string} secret ethereum secret
     * @returns {boolean} return true if the secret is valid
     * @memberof Ethereum
     */
    static isValidSecret(secret: string): boolean;
    /**
     * retrieve ethereum address via secret
     *
     * @static
     * @param {string} secret ethereum secret
     * @returns {string} return address if the secret is valid, otherwise return null
     * @memberof Ethereum
     */
    static getAddress(secret: string): string;
    /**
     * create ethereum wallet
     *
     * @static
     * @returns {IWalletModel}
     * @memberof Ethereum
     */
    static createWallet(): IWalletModel;
    /**
     * prefix `0x` if the given string not start with `0x`
     *
     * @static
     * @param {string} str
     * @returns {string}
     * @memberof Ethereum
     */
    static prefix0x(str: string): string;
    /**
     * filter `0x` if the given string starts with `0x`
     *
     * @static
     * @param {string} str
     * @returns {string}
     * @memberof Ethereum
     */
    static filter0x(str: string): string;
    /**
     * init instance of web3
     *
     * @memberof Ethereum
     */
    initWeb3(): void;
    /**
     * destroy instance of web3
     *
     * @memberof Ethereum
     */
    destroyWeb3(): void;
    /**
     * get instance of web3
     *
     * @memberof Ethereum
     */
    getWeb3(): any;
    /**
     * request info of block
     *
     * @param {number|string} block number or string latest
     * @returns {Promise<any>} resolve null if request failed, return block info
     * @memberof Ethereum
     */
    getBlock(block: number | string): Promise<any>;
    /**
     * request balance of ether
     *
     * @param {string} address ethereum address
     * @returns {Promise<string>} resolve "0" if request failed
     * @memberof Ethereum
     */
    getBalance(address: string): Promise<string>;
    /**
     * request current gas price
     *
     * @returns {Promise<number>} resolve gas price if success
     * @memberof Ethereum
     */
    getGasPrice(): Promise<number>;
    /**
     * request nonce
     *
     * @param {string} address ethereum address
     * @returns {Promise<number>} resolve nonce if success
     * @memberof Ethereum
     */
    getNonce(address: string): Promise<number>;
    /**
     * check if has pending transaction
     *
     * @param {string} address
     * @returns {Promise<boolean>} resolve true if has pending transaction
     * @memberof Ethereum
     */
    hasPendingTransactions(address: string): Promise<boolean>;
    /**
     * format transaction info
     *
     * @param {string} from sender address
     * @param {string} to destination address
     * @param {number} nonce nonce
     * @param {number} gasLimit gas limit
     * @param {number} gasPrice gas price
     * @param {string} value value
     * @param {string} calldata call data
     * @returns {IEthereumTransaction}
     * @memberof Ethereum
     */
    getTx(from: string, to: string, nonce: number, gasLimit: number, gasPrice: number, value: string, calldata: string): IEthereumTransaction;
    /**
     * sign transaction with ethereum secret
     *
     * @param {IEthereumTransaction} tx transaction
     * @param {string} secret ethereum secret
     * @returns {Promise<string>} return signed info
     * @memberof Ethereum
     */
    signTransaction(tx: IEthereumTransaction, secret: string): Promise<string>;
    /**
     * send signed transaction
     *
     * @param {string} sign
     * @returns {Promise<string>} resolve hash if success
     * @memberof Ethereum
     */
    sendSignedTransaction(sign: string): Promise<string>;
    /**
     * get transaction
     *
     * @param {string} hash transaction hash
     * @returns {any} null or transaction object
     * @memberof Ethereum
     */
    getTransaction(hash: string): Promise<any>;
    /**
     * get transaction receipt
     *
     * @param {string} hash transaction hash
     * @returns {any} null or transaction receipt object
     * @memberof Ethereum
     */
    getTransactionReceipt(hash: string): Promise<any>;
    /**
     * init instance of ethereum or erc20 contract
     *
     * @param {abitItem} abi definition of ethereum abi or erc20 abi
     * @param {string} address
     * @returns {Contract} return instance of ethereum or erc20 contract
     * @memberof Ethereum
     */
    contract(abi: any, address: string): Contract;
    /**
     * check instance of contract if initialied
     *
     * @param {Contract} contract current contract instance
     * @param {string} address current contract address
     * @returns {boolean} return true if initialied
     * @memberof Ethereum
     */
    contractInitialied(contract: Contract, address: string): boolean;
}
