UNPKG

web3x

Version:

Typescript port of web3.js

67 lines (66 loc) 2.46 kB
/// <reference types="node" /> import { Address } from '../address'; import { BlockType, Eth } from '../eth'; import { SendTx } from '../eth/send-tx'; import { TransactionReceipt } from '../formatters'; import { ContractAbi, ContractFunctionEntry } from './abi'; export declare type TxFactory = (...args: any[]) => Tx; export interface CallOptions { from?: Address; gasPrice?: string | number; gas?: number; } export interface SendOptions { from?: Address; gasPrice?: string | number; gas?: number; value?: number | string; nonce?: number | string; } export interface EstimateOptions { from?: Address; gas?: string | number; gasPrice?: string | number; value?: number | string; } export declare type DefaultOptions = { from?: Address; gasPrice?: string | number; gas?: number; }; export interface TxCall<Return = any> { call(options?: CallOptions, block?: BlockType): Promise<Return>; getCallRequestPayload(options?: CallOptions, block?: number): any; estimateGas(options?: EstimateOptions): Promise<number>; encodeABI(): Buffer; } export interface TxSend<TxReceipt = TransactionReceipt> { send(options?: SendOptions): SendTx<TxReceipt>; getSendRequestPayload(options?: SendOptions): any; estimateGas(options?: EstimateOptions): Promise<number>; encodeABI(): Buffer; } export declare class Tx implements TxCall, TxSend { protected eth: Eth; protected contractEntry: ContractFunctionEntry; protected contractAbi: ContractAbi; protected contractAddress?: Address | undefined; protected args: any[]; protected defaultOptions: DefaultOptions; constructor(eth: Eth, contractEntry: ContractFunctionEntry, contractAbi: ContractAbi, contractAddress?: Address | undefined, args?: any[], defaultOptions?: DefaultOptions); estimateGas(options?: EstimateOptions): Promise<number>; call(options?: CallOptions, block?: BlockType): Promise<any>; getCallRequestPayload(options: CallOptions, block?: number): { format: (result: string) => any; method: string; params: (string | import("../formatters").RawCallRequest | undefined)[]; }; send(options: SendOptions): SendTx; getSendRequestPayload(options: SendOptions): { method: string; params: import("../formatters").RawTransactionRequest[]; format: (result: string) => string; }; encodeABI(): Buffer; private getTx; }