@@ -5,63 +5,159 @@ use jsonrpc_core::*;
5
5
/// Eth rpc interface.
6
6
pub trait Eth : Sized + Send + Sync + ' static {
7
7
/// Returns protocol version.
8
- fn protocol_version ( & self , _: Params ) -> Result < Value , Error > { rpcerr ! ( ) }
8
+ fn protocol_version ( & self , _: Params ) -> Result < Value , Error > { rpc_unimplemented ! ( ) }
9
+
10
+ /// Returns the number of hashes per second that the node is mining with.
11
+ fn hashrate ( & self , _: Params ) -> Result < Value , Error > { rpc_unimplemented ! ( ) }
9
12
10
13
/// Returns block author.
11
- fn author ( & self , _: Params ) -> Result < Value , Error > { rpcerr ! ( ) }
14
+ fn author ( & self , _: Params ) -> Result < Value , Error > { rpc_unimplemented ! ( ) }
15
+
16
+ /// Returns true if client is actively mining new blocks.
17
+ fn is_mining ( & self , _: Params ) -> Result < Value , Error > { rpc_unimplemented ! ( ) }
12
18
13
19
/// Returns current gas_price.
14
- fn gas_price ( & self , _: Params ) -> Result < Value , Error > { rpcerr ! ( ) }
20
+ fn gas_price ( & self , _: Params ) -> Result < Value , Error > { rpc_unimplemented ! ( ) }
21
+
22
+ /// Returns accounts list.
23
+ fn accounts ( & self , _: Params ) -> Result < Value , Error > { rpc_unimplemented ! ( ) }
15
24
16
25
/// Returns highest block number.
17
- fn block_number ( & self , _: Params ) -> Result < Value , Error > { rpcerr ! ( ) }
26
+ fn block_number ( & self , _: Params ) -> Result < Value , Error > { rpc_unimplemented ! ( ) }
27
+
28
+ /// Returns balance of the given account.
29
+ fn balance ( & self , _: Params ) -> Result < Value , Error > { rpc_unimplemented ! ( ) }
30
+
31
+ /// Returns content of the storage at given address.
32
+ fn storage_at ( & self , _: Params ) -> Result < Value , Error > { rpc_unimplemented ! ( ) }
18
33
19
34
/// Returns block with given index / hash.
20
- fn block ( & self , _: Params ) -> Result < Value , Error > { rpcerr ! ( ) }
35
+ fn block ( & self , _: Params ) -> Result < Value , Error > { rpc_unimplemented ! ( ) }
21
36
22
- /// Returns true if client is actively mining new blocks.
23
- fn is_mining ( & self , _: Params ) -> Result < Value , Error > { rpcerr ! ( ) }
24
-
25
- /// Returns the number of hashes per second that the node is mining with.
26
- fn hashrate ( & self , _: Params ) -> Result < Value , Error > { rpcerr ! ( ) }
37
+ /// Returns the number of transactions sent from given address at given time (block number).
38
+ fn transaction_count ( & self , _: Params ) -> Result < Value , Error > { rpc_unimplemented ! ( ) }
27
39
28
40
/// Returns the number of transactions in a block.
29
- fn block_transaction_count ( & self , _: Params ) -> Result < Value , Error > { rpcerr ! ( ) }
41
+ fn block_transaction_count ( & self , _: Params ) -> Result < Value , Error > { rpc_unimplemented ! ( ) }
42
+
43
+ /// Returns the number of uncles in a given block.
44
+ fn block_uncles_count ( & self , _: Params ) -> Result < Value , Error > { rpc_unimplemented ! ( ) }
45
+
46
+ /// Returns the code at given address at given time (block number).
47
+ fn code_at ( & self , _: Params ) -> Result < Value , Error > { rpc_unimplemented ! ( ) }
48
+
49
+ /// Sends transaction.
50
+ fn send_transaction ( & self , _: Params ) -> Result < Value , Error > { rpc_unimplemented ! ( ) }
51
+
52
+ /// Call contract.
53
+ fn call ( & self , _: Params ) -> Result < Value , Error > { rpc_unimplemented ! ( ) }
54
+
55
+ /// Estimate gas needed for execution of given contract.
56
+ fn estimate_gas ( & self , _: Params ) -> Result < Value , Error > { rpc_unimplemented ! ( ) }
57
+
58
+ /// Returns transaction at given block and index.
59
+ fn transaction_at ( & self , _: Params ) -> Result < Value , Error > { rpc_unimplemented ! ( ) }
60
+
61
+ /// Returns transaction receipt.
62
+ fn transaction_receipt ( & self , _: Params ) -> Result < Value , Error > { rpc_unimplemented ! ( ) }
63
+
64
+ /// Returns an uncles at given block and index.
65
+ fn uncle_at ( & self , _: Params ) -> Result < Value , Error > { rpc_unimplemented ! ( ) }
66
+
67
+ /// Returns available compilers.
68
+ fn compilers ( & self , _: Params ) -> Result < Value , Error > { rpc_unimplemented ! ( ) }
69
+
70
+ /// Compiles lll code.
71
+ fn compile_lll ( & self , _: Params ) -> Result < Value , Error > { rpc_unimplemented ! ( ) }
72
+
73
+ /// Compiles solidity.
74
+ fn compile_solidity ( & self , _: Params ) -> Result < Value , Error > { rpc_unimplemented ! ( ) }
75
+
76
+ /// Compiles serpent.
77
+ fn compile_serpent ( & self , _: Params ) -> Result < Value , Error > { rpc_unimplemented ! ( ) }
78
+
79
+ /// Returns logs matching given filter object.
80
+ fn logs ( & self , _: Params ) -> Result < Value , Error > { rpc_unimplemented ! ( ) }
81
+
82
+ /// Returns the hash of the current block, the seedHash, and the boundary condition to be met.
83
+ fn work ( & self , _: Params ) -> Result < Value , Error > { rpc_unimplemented ! ( ) }
84
+
85
+ /// Used for submitting a proof-of-work solution.
86
+ fn submit_work ( & self , _: Params ) -> Result < Value , Error > { rpc_unimplemented ! ( ) }
87
+
88
+ /// Used for submitting mining hashrate.
89
+ fn submit_hashrate ( & self , _: Params ) -> Result < Value , Error > { rpc_unimplemented ! ( ) }
30
90
31
91
/// Should be used to convert object to io delegate.
32
92
fn to_delegate ( self ) -> IoDelegate < Self > {
33
93
let mut delegate = IoDelegate :: new ( Arc :: new ( self ) ) ;
34
94
delegate. add_method ( "eth_protocolVersion" , Eth :: protocol_version) ;
95
+ delegate. add_method ( "eth_hashrate" , Eth :: hashrate) ;
35
96
delegate. add_method ( "eth_coinbase" , Eth :: author) ;
97
+ delegate. add_method ( "eth_mining" , Eth :: is_mining) ;
36
98
delegate. add_method ( "eth_gasPrice" , Eth :: gas_price) ;
99
+ delegate. add_method ( "eth_accounts" , Eth :: accounts) ;
37
100
delegate. add_method ( "eth_blockNumber" , Eth :: block_number) ;
101
+ delegate. add_method ( "eth_balance" , Eth :: balance) ;
102
+ delegate. add_method ( "eth_getStorageAt" , Eth :: storage_at) ;
103
+ delegate. add_method ( "eth_getTransactionCount" , Eth :: transaction_count) ;
104
+ delegate. add_method ( "eth_getBlockTransactionCountByHash" , Eth :: block_transaction_count) ;
105
+ delegate. add_method ( "eth_getBlockTransactionCountByNumber" , Eth :: block_transaction_count) ;
106
+ delegate. add_method ( "eth_getUncleCountByBlockHash" , Eth :: block_uncles_count) ;
107
+ delegate. add_method ( "eth_getUncleCountByBlockNumber" , Eth :: block_uncles_count) ;
108
+ delegate. add_method ( "eth_code" , Eth :: code_at) ;
109
+ delegate. add_method ( "eth_sendTransaction" , Eth :: send_transaction) ;
110
+ delegate. add_method ( "eth_call" , Eth :: call) ;
111
+ delegate. add_method ( "eth_estimateGas" , Eth :: estimate_gas) ;
38
112
delegate. add_method ( "eth_getBlockByHash" , Eth :: block) ;
39
113
delegate. add_method ( "eth_getBlockByNumber" , Eth :: block) ;
40
- delegate. add_method ( "eth_mining" , Eth :: is_mining) ;
41
- delegate. add_method ( "eth_hashrate" , Eth :: hashrate) ;
42
- delegate. add_method ( "eth_getBlockTransactionCountByNumber" , Eth :: block_transaction_count) ;
114
+ delegate. add_method ( "eth_getTransactionByBlockHashAndIndex" , Eth :: transaction_at) ;
115
+ delegate. add_method ( "eth_getTransactionByBlockNumberAndIndex" , Eth :: transaction_at) ;
116
+ delegate. add_method ( "eth_getTransactionReceipt" , Eth :: transaction_receipt) ;
117
+ delegate. add_method ( "eth_getUncleByBlockHashAndIndex" , Eth :: uncle_at) ;
118
+ delegate. add_method ( "eth_getUncleByBlockNumberAndIndex" , Eth :: uncle_at) ;
119
+ delegate. add_method ( "eth_getCompilers" , Eth :: compilers) ;
120
+ delegate. add_method ( "eth_compileLLL" , Eth :: compile_lll) ;
121
+ delegate. add_method ( "eth_compileSolidity" , Eth :: compile_solidity) ;
122
+ delegate. add_method ( "eth_compileSerpent" , Eth :: compile_serpent) ;
123
+ delegate. add_method ( "eth_getLogs" , Eth :: logs) ;
124
+ delegate. add_method ( "eth_getWork" , Eth :: work) ;
125
+ delegate. add_method ( "eth_submitWork" , Eth :: submit_work) ;
126
+ delegate. add_method ( "eth_submitHashrate" , Eth :: submit_hashrate) ;
43
127
delegate
44
128
}
45
129
}
46
130
47
131
/// Eth filters rpc api (polling).
48
132
// TODO: do filters api properly
49
133
pub trait EthFilter : Sized + Send + Sync + ' static {
50
- /// Returns id of new block filter
51
- fn new_block_filter ( & self , _: Params ) -> Result < Value , Error > { rpcerr ! ( ) }
134
+ /// Returns id of new filter.
135
+ fn new_filter ( & self , _: Params ) -> Result < Value , Error > { rpc_unimplemented ! ( ) }
136
+
137
+ /// Returns id of new block filter.
138
+ fn new_block_filter ( & self , _: Params ) -> Result < Value , Error > { rpc_unimplemented ! ( ) }
139
+
140
+ /// Returns id of new block filter.
141
+ fn new_pending_transaction_filter ( & self , _: Params ) -> Result < Value , Error > { rpc_unimplemented ! ( ) }
142
+
143
+ /// Returns filter changes since last poll.
144
+ fn filter_changes ( & self , _: Params ) -> Result < Value , Error > { rpc_unimplemented ! ( ) }
52
145
53
- /// Returns id of new block filter
54
- fn new_pending_transaction_filter ( & self , _: Params ) -> Result < Value , Error > { rpcerr ! ( ) }
146
+ /// Returns filter logs.
147
+ fn filter_logs ( & self , _: Params ) -> Result < Value , Error > { rpc_unimplemented ! ( ) }
55
148
56
- /// Returns filter changes since last poll
57
- fn filter_changes ( & self , _: Params ) -> Result < Value , Error > { rpcerr ! ( ) }
149
+ /// Uninstalls filter.
150
+ fn uninstall_filter ( & self , _: Params ) -> Result < Value , Error > { rpc_unimplemented ! ( ) }
58
151
59
152
/// Should be used to convert object to io delegate.
60
153
fn to_delegate ( self ) -> IoDelegate < Self > {
61
154
let mut delegate = IoDelegate :: new ( Arc :: new ( self ) ) ;
155
+ delegate. add_method ( "eth_newFilter" , EthFilter :: new_filter) ;
62
156
delegate. add_method ( "eth_newBlockFilter" , EthFilter :: new_block_filter) ;
63
157
delegate. add_method ( "eth_newPendingTransactionFilter" , EthFilter :: new_pending_transaction_filter) ;
64
158
delegate. add_method ( "eth_getFilterChanges" , EthFilter :: filter_changes) ;
159
+ delegate. add_method ( "eth_getFilterLogs" , EthFilter :: filter_logs) ;
160
+ delegate. add_method ( "eth_uninstallFilter" , EthFilter :: uninstall_filter) ;
65
161
delegate
66
162
}
67
163
}
0 commit comments