1 | import { Callback } from "../types";
|
2 | import PromiEvent from "../promiEvent";
|
3 | import { ABIDefinition } from "./abi";
|
4 | export interface Tx {
|
5 | nonce?: string | number;
|
6 | chainId?: string | number;
|
7 | from?: string;
|
8 | to?: string;
|
9 | data?: string;
|
10 | value?: string | number;
|
11 | gas?: string | number;
|
12 | gasPrice?: string | number;
|
13 | }
|
14 |
|
15 | export class BatchRequest {
|
16 | constructor();
|
17 | add(request: object): void; //
|
18 | execute(): void;
|
19 | }
|
20 | export class Iban {
|
21 | constructor(address: string);
|
22 | static toAddress(iban: Iban): string;
|
23 | isValid(): boolean;
|
24 | }
|
25 | export type BlockType = "latest" | "pending" | "genesis" | number;
|
26 |
|
27 | export interface BlockHeader {
|
28 | number: number;
|
29 | hash: string;
|
30 | parentHash: string;
|
31 | nonce: string;
|
32 | sha3Uncles: string;
|
33 | logsBloom: string;
|
34 | transactionRoot: string;
|
35 | stateRoot: string;
|
36 | receiptRoot: string;
|
37 | miner: string;
|
38 | extraData: string;
|
39 | gasLimit: number;
|
40 | gasUsed: number;
|
41 | timestamp: number;
|
42 | }
|
43 | export interface Block extends BlockHeader {
|
44 | transactions: Transaction[];
|
45 | size: number;
|
46 | difficulty: number;
|
47 | totalDifficulty: number;
|
48 | uncles: string[];
|
49 | }
|
50 |
|
51 | export class Net {
|
52 | getId(cb?: Callback<number>): Promise<number>;
|
53 | isListening(cb?: Callback<boolean>): Promise<boolean>;
|
54 | getPeerCount(cb?: Callback<number>): Promise<number>;
|
55 | }
|
56 | export class Personal {
|
57 | newAccount(password: string, cb?: Callback<boolean>): Promise<string>;
|
58 | importRawKey(): Promise<string>;
|
59 | lockAccount(): Promise<boolean>;
|
60 | unlockAccount(address: string, password: string, unlockDuration: number): void;
|
61 | sign(): Promise<string>;
|
62 | ecRecover(message: string, sig: string): void;
|
63 | sendTransaction(tx: Tx, passphrase: string): Promise<string>;
|
64 | }
|
65 |
|
66 | export interface Transaction {
|
67 | hash: string;
|
68 | nonce: number;
|
69 | blockHash: string;
|
70 | blockNumber: number;
|
71 | transactionIndex: number;
|
72 | from: string;
|
73 | to: string;
|
74 | value: string;
|
75 | gasPrice: string;
|
76 | gas: number;
|
77 | input: string;
|
78 | v?: string;
|
79 | r?: string;
|
80 | s?: string;
|
81 | }
|
82 | export interface TransactionObject<T> {
|
83 | arguments: any[];
|
84 | call(tx?: Tx): Promise<T>;
|
85 | send(tx?: Tx): PromiEvent<T>;
|
86 | estimateGas(tx?: Tx): Promise<number>;
|
87 | encodeABI(): string;
|
88 | }
|
89 | export interface CompileResult {
|
90 | code: string;
|
91 | info: {
|
92 | source: string;
|
93 | language: string;
|
94 | languageVersion: string;
|
95 | compilerVersion: string;
|
96 | abiDefinition: ABIDefinition[];
|
97 | };
|
98 | userDoc: { methods: object };
|
99 | developerDoc: { methods: object };
|
100 | }
|