UNPKG

5.39 kBTypeScriptView Raw
1import BigNumber = require("bn.js");
2import { Provider } from "../providers";
3import Contract, { CustomOptions as CustomContractOptions } from "./contract";
4import PromiEvent from "../promiEvent";
5import ABI from "./abi";
6import Accounts from "./accounts";
7import {
8 BatchRequest,
9 Iban,
10 BlockHeader,
11 CompileResult,
12 Block,
13 Transaction,
14 Tx,
15 BlockType,
16 Net,
17 Personal
18} from "./types";
19import {
20 Callback,
21 TransactionReceipt,
22 Logs,
23 Log,
24 Subscribe,
25 EncodedTransaction
26} from "../types";
27
28export default interface Eth {
29 defaultAccount: string;
30 defaultBlock: BlockType;
31 BatchRequest: new () => BatchRequest;
32 Iban: Iban;
33 Contract: new (
34 jsonInterface: any[],
35 address?: string,
36 options?: CustomContractOptions
37 ) => Contract;
38 abi: ABI;
39 setProvider: (provider: Provider) => void;
40 accounts: Accounts;
41 call(
42 callObject: Tx,
43 defaultBloc?: BlockType,
44 callBack?: Callback<string>
45 ): Promise<string>;
46 clearSubscriptions(): boolean;
47 subscribe(
48 type: "logs",
49 options?: Logs,
50 callback?: Callback<Subscribe<Log>>
51 ): Promise<Subscribe<Log>>;
52 subscribe(
53 type: "syncing",
54 callback?: Callback<Subscribe<any>>
55 ): Promise<Subscribe<any>>;
56 subscribe(
57 type: "newBlockHeaders",
58 callback?: Callback<Subscribe<BlockHeader>>
59 ): Promise<Subscribe<BlockHeader>>;
60 subscribe(
61 type: "pendingTransactions",
62 callback?: Callback<Subscribe<Transaction>>
63 ): Promise<Subscribe<Transaction>>;
64 subscribe(
65 type: "pendingTransactions" | "newBlockHeaders" | "syncing" | "logs",
66 options?: Logs,
67 callback?: Callback<Subscribe<any>>
68 ): Promise<Subscribe<any>>;
69
70 unsubscribe(callBack: Callback<boolean>): void | boolean;
71 compile: {
72 solidity(
73 source: string,
74 callback?: Callback<CompileResult>
75 ): Promise<CompileResult>;
76 lll(
77 source: string,
78 callback?: Callback<CompileResult>
79 ): Promise<CompileResult>;
80 serpent(
81 source: string,
82 callback?: Callback<CompileResult>
83 ): Promise<CompileResult>;
84 };
85 currentProvider: Provider;
86 estimateGas(tx: Tx, callback?: Callback<number>): Promise<number>;
87 getAccounts(cb?: Callback<string[]>): Promise<string[]>;
88 getBalance(
89 address: string,
90 defaultBlock?: BlockType,
91 cb?: Callback<number>
92 ): Promise<number>;
93 getBlock(
94 number: BlockType,
95 returnTransactionObjects?: boolean,
96 cb?: Callback<Block>
97 ): Promise<Block>;
98 getBlockNumber(callback?: Callback<number>): Promise<number>;
99 getBlockTransactionCount(
100 number: BlockType | string,
101 cb?: Callback<number>
102 ): Promise<number>;
103 getBlockUncleCount(
104 number: BlockType | string,
105 cb?: Callback<number>
106 ): Promise<number>;
107 getCode(
108 address: string,
109 defaultBlock?: BlockType,
110 cb?: Callback<string>
111 ): Promise<string>;
112 getCoinbase(cb?: Callback<string>): Promise<string>;
113 getCompilers(cb?: Callback<string[]>): Promise<string[]>;
114 getGasPrice(cb?: Callback<number>): Promise<number>;
115 getHashrate(cb?: Callback<number>): Promise<number>;
116 getPastLogs(
117 options: {
118 fromBlock?: BlockType;
119 toBlock?: BlockType;
120 address?: string;
121 topics?: Array<string | string[]>;
122 },
123 cb?: Callback<Log[]>
124 ): Promise<Log[]>;
125 getProtocolVersion(cb?: Callback<string>): Promise<string>;
126 getStorageAt(
127 address: string,
128 position: number | BigNumber,
129 defaultBlock?: BlockType,
130 cb?: Callback<string>
131 ): Promise<string>;
132 getTransactionReceipt(
133 hash: string,
134 cb?: Callback<TransactionReceipt>
135 ): Promise<TransactionReceipt>;
136 getTransaction(
137 hash: string,
138 cb?: Callback<Transaction>
139 ): Promise<Transaction>;
140 getTransactionCount(
141 address: string,
142 defaultBlock?: BlockType,
143 cb?: Callback<number>
144 ): Promise<number>;
145 getTransactionFromBlock(
146 block: BlockType,
147 index: number,
148 cb?: Callback<Transaction>
149 ): Promise<Transaction>;
150 getUncle(
151 blockHashOrBlockNumber: BlockType | string,
152 uncleIndex: number,
153 returnTransactionObjects?: boolean,
154 cb?: Callback<Block>
155 ): Promise<Block>;
156 getWork(cb?: Callback<string[]>): Promise<string[]>;
157 givenProvider: Provider;
158 isMining(cb?: Callback<boolean>): Promise<boolean>;
159 isSyncing(cb?: Callback<boolean>): Promise<boolean>;
160 net: Net;
161 personal: Personal;
162 signTransaction(
163 tx: Tx,
164 address?: string,
165 cb?: Callback<string>
166 ): Promise<EncodedTransaction>;
167 sendSignedTransaction(
168 data: string,
169 cb?: Callback<string>
170 ): PromiEvent<TransactionReceipt>;
171 sendTransaction(
172 tx: Tx,
173 cb?: Callback<string>
174 ): PromiEvent<TransactionReceipt>;
175 submitWork(
176 nonce: string,
177 powHash: string,
178 digest: string,
179 cb?: Callback<boolean>
180 ): Promise<boolean>;
181 sign(
182 address: string,
183 dataToSign: string,
184 cb?: Callback<string>
185 ): Promise<string>;
186}