aboutsummaryrefslogtreecommitdiffstats
path: root/packages/web3-wrapper/src/types.ts
blob: eb5a35f07a323a16efcb50ee0e7781d51a9d1f16 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
export enum Web3WrapperErrors {
    TransactionMiningTimeout = 'TRANSACTION_MINING_TIMEOUT',
}

export interface AbstractBlockRPC {
    number: string | null;
    hash: string | null;
    parentHash: string;
    nonce: string | null;
    sha3Uncles: string;
    logsBloom: string | null;
    transactionsRoot: string;
    stateRoot: string;
    miner: string;
    difficulty: string;
    totalDifficulty: string;
    extraData: string;
    size: string;
    gasLimit: string;
    gasUsed: string;
    timestamp: string;
    uncles: string[];
}
export interface BlockWithoutTransactionDataRPC extends AbstractBlockRPC {
    transactions: string[];
}
export interface BlockWithTransactionDataRPC extends AbstractBlockRPC {
    transactions: TransactionRPC[];
}
export interface TransactionRPC {
    hash: string;
    nonce: string;
    blockHash: string | null;
    blockNumber: string | null;
    transactionIndex: string | null;
    from: string;
    to: string | null;
    value: string;
    gasPrice: string;
    gas: string;
    input: string;
}

export interface TransactionReceiptRPC {
    blockHash: string;
    blockNumber: string;
    transactionHash: string;
    transactionIndex: string;
    from: string;
    to: string;
    status: TransactionReceiptStatusRPC;
    cumulativeGasUsed: string;
    gasUsed: string;
    contractAddress: string | null;
    logs: LogEntryRPC[];
}

export interface LogEntryRPC {
    logIndex: string | null;
    transactionIndex: string | null;
    transactionHash: string;
    blockHash: string | null;
    blockNumber: string | null;
    address: string;
    data: string;
    topics: string[];
}

export type TransactionReceiptStatusRPC = null | string | 0 | 1;

export interface CallTxDataBaseRPC {
    to?: string;
    value?: string;
    gas?: string;
    gasPrice?: string;
    data?: string;
    nonce?: string;
}

export interface TxDataRPC extends CallTxDataBaseRPC {
    from: string;
}

export interface CallDataRPC extends CallTxDataBaseRPC {
    from?: string;
}

// NodeType represents the type of the backing Ethereum node.
export enum NodeType {
    Geth = 'GETH',
    Ganache = 'GANACHE',
}