1 | import BigNumber = require("bn.js");
|
2 | import { Provider } from "../providers";
|
3 | import Contract, { CustomOptions as CustomContractOptions } from "./contract";
|
4 | import PromiEvent from "../promiEvent";
|
5 | import ABI from "./abi";
|
6 | import Accounts from "./accounts";
|
7 | import {
|
8 | BatchRequest,
|
9 | Iban,
|
10 | BlockHeader,
|
11 | CompileResult,
|
12 | Block,
|
13 | Transaction,
|
14 | Tx,
|
15 | BlockType,
|
16 | Net,
|
17 | Personal
|
18 | } from "./types";
|
19 | import {
|
20 | Callback,
|
21 | TransactionReceipt,
|
22 | Logs,
|
23 | Log,
|
24 | Subscribe,
|
25 | EncodedTransaction
|
26 | } from "../types";
|
27 |
|
28 | export 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 | ): Promise<BigNumber>;
|
92 | getBalance(
|
93 | address: string,
|
94 | defaultBlock: BlockType,
|
95 | cb: Callback<BigNumber>
|
96 | ): void;
|
97 | getBlock(
|
98 | number: BlockType,
|
99 | returnTransactionObjects?: boolean,
|
100 | cb?: Callback<Block>
|
101 | ): Promise<Block>;
|
102 | getBlockNumber(callback?: Callback<number>): Promise<number>;
|
103 | getBlockTransactionCount(
|
104 | number: BlockType | string,
|
105 | cb?: Callback<number>
|
106 | ): Promise<number>;
|
107 | getBlockUncleCount(
|
108 | number: BlockType | string,
|
109 | cb?: Callback<number>
|
110 | ): Promise<number>;
|
111 | getCode(
|
112 | address: string,
|
113 | defaultBlock?: BlockType,
|
114 | cb?: Callback<string>
|
115 | ): Promise<string>;
|
116 | getCoinbase(cb?: Callback<string>): Promise<string>;
|
117 | getCompilers(cb?: Callback<string[]>): Promise<string[]>;
|
118 | getGasPrice(cb?: Callback<number>): Promise<number>;
|
119 | getHashrate(cb?: Callback<number>): Promise<number>;
|
120 | getPastLogs(
|
121 | options: {
|
122 | fromBlock?: BlockType;
|
123 | toBlock?: BlockType;
|
124 | address?: string;
|
125 | topics?: Array<string | string[]>;
|
126 | },
|
127 | cb?: Callback<Log[]>
|
128 | ): Promise<Log[]>;
|
129 | getProtocolVersion(cb?: Callback<string>): Promise<string>;
|
130 | getStorageAt(
|
131 | address: string,
|
132 | position: number | BigNumber,
|
133 | defaultBlock?: BlockType,
|
134 | cb?: Callback<string>
|
135 | ): Promise<string>;
|
136 | getTransactionReceipt(
|
137 | hash: string,
|
138 | cb?: Callback<TransactionReceipt>
|
139 | ): Promise<TransactionReceipt>;
|
140 | getTransaction(
|
141 | hash: string,
|
142 | cb?: Callback<Transaction>
|
143 | ): Promise<Transaction>;
|
144 | getTransactionCount(
|
145 | address: string,
|
146 | defaultBlock?: BlockType,
|
147 | cb?: Callback<number>
|
148 | ): Promise<number>;
|
149 | getTransactionFromBlock(
|
150 | block: BlockType,
|
151 | index: number,
|
152 | cb?: Callback<Transaction>
|
153 | ): Promise<Transaction>;
|
154 | getUncle(
|
155 | blockHashOrBlockNumber: BlockType | string,
|
156 | uncleIndex: number,
|
157 | returnTransactionObjects?: boolean,
|
158 | cb?: Callback<Block>
|
159 | ): Promise<Block>;
|
160 | getWork(cb?: Callback<string[]>): Promise<string[]>;
|
161 | givenProvider: Provider;
|
162 | isMining(cb?: Callback<boolean>): Promise<boolean>;
|
163 | isSyncing(cb?: Callback<boolean>): Promise<boolean>;
|
164 | net: Net;
|
165 | personal: Personal;
|
166 | signTransaction(
|
167 | tx: Tx,
|
168 | address?: string,
|
169 | cb?: Callback<string>
|
170 | ): Promise<EncodedTransaction>;
|
171 | sendSignedTransaction(
|
172 | data: string,
|
173 | cb?: Callback<string>
|
174 | ): PromiEvent<TransactionReceipt>;
|
175 | sendTransaction(
|
176 | tx: Tx,
|
177 | cb?: Callback<string>
|
178 | ): PromiEvent<TransactionReceipt>;
|
179 | submitWork(
|
180 | nonce: string,
|
181 | powHash: string,
|
182 | digest: string,
|
183 | cb?: Callback<boolean>
|
184 | ): Promise<boolean>;
|
185 | sign(
|
186 | address: string,
|
187 | dataToSign: string,
|
188 | cb?: Callback<string>
|
189 | ): Promise<string>;
|
190 | }
|