ethereum_client 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/ethereum_client.rb +296 -0
- data/spec/ethereum_client_spec.rb +30 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d923211debc51a9095e1c991de53353fa047445
|
4
|
+
data.tar.gz: 5104422dba5715acab4ce522bc9f3f9a7c2f568d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44b5e442a29a05715dcf389598b4c7d81cf4255ba3c37687eb04e7775a2978f7e6fd7b83485e1dbb4f8fd184e695d3f8e48932a32277c2f6b11a7abfaa5f0c94
|
7
|
+
data.tar.gz: 3db6003133bdefb75a6c1601047d58ad662374068e502cc8ee7db2becbb10fe22552844e8dd20f59ee0625002f09d690565701327dc10da7c568baebdff9e6a2
|
data/lib/ethereum_client.rb
CHANGED
@@ -10,6 +10,9 @@ module EthereumClient
|
|
10
10
|
'Accept' => 'application/json'
|
11
11
|
}.freeze
|
12
12
|
|
13
|
+
# Returns the current client version.
|
14
|
+
#
|
15
|
+
# https://github.com/ethereum/wiki/wiki/JSON-RPC#web3_clientversion
|
13
16
|
def web3_client_version
|
14
17
|
payload = {
|
15
18
|
method: 'web3_clientVersion'
|
@@ -18,6 +21,9 @@ module EthereumClient
|
|
18
21
|
post(payload)
|
19
22
|
end
|
20
23
|
|
24
|
+
# Returns Keccak-256 (not the standardized SHA3-256) of the given data.
|
25
|
+
#
|
26
|
+
# https://github.com/ethereum/wiki/wiki/JSON-RPC#web3_sha3
|
21
27
|
def web3_sha3(string)
|
22
28
|
payload = {
|
23
29
|
method: 'web3_sha3',
|
@@ -27,6 +33,296 @@ module EthereumClient
|
|
27
33
|
post(payload)
|
28
34
|
end
|
29
35
|
|
36
|
+
# Returns the current network protocol version.
|
37
|
+
#
|
38
|
+
# https://github.com/ethereum/wiki/wiki/JSON-RPC#net_version
|
39
|
+
def net_version
|
40
|
+
raise NotImplementedError, 'net_version not yet implemented'
|
41
|
+
end
|
42
|
+
|
43
|
+
# Returns true if client is actively listening for network connections.
|
44
|
+
#
|
45
|
+
# https://github.com/ethereum/wiki/wiki/JSON-RPC#net_listening
|
46
|
+
def net_listening
|
47
|
+
raise NotImplementedError, 'net_listening not yet implemented'
|
48
|
+
end
|
49
|
+
|
50
|
+
# Returns number of peers currenly connected to the client.
|
51
|
+
#
|
52
|
+
# https://github.com/ethereum/wiki/wiki/JSON-RPC#net_peercount
|
53
|
+
def net_peer_count
|
54
|
+
raise NotImplementedError, 'net_peer_count not yet implemented'
|
55
|
+
end
|
56
|
+
|
57
|
+
# Returns the current ethereum protocol version.
|
58
|
+
#
|
59
|
+
# https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_protocolversion
|
60
|
+
def eth_protocol_version
|
61
|
+
raise NotImplementedError, 'eth_protocol_version not yet implemented'
|
62
|
+
end
|
63
|
+
|
64
|
+
# Returns an object with data about the sync status or +false+.
|
65
|
+
#
|
66
|
+
# https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_syncing
|
67
|
+
def eth_syncing
|
68
|
+
raise NotImplementedError, 'eth_syncing not yet implemented'
|
69
|
+
end
|
70
|
+
|
71
|
+
# https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_coinbase
|
72
|
+
def eth_coinbase
|
73
|
+
raise NotImplementedError, 'eth_coinbase not yet implemented'
|
74
|
+
end
|
75
|
+
|
76
|
+
# https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_mining
|
77
|
+
def eth_mining
|
78
|
+
raise NotImplementedError, 'eth_mining not yet implemented'
|
79
|
+
end
|
80
|
+
|
81
|
+
# https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_hashrate
|
82
|
+
def eth_hashrate
|
83
|
+
raise NotImplementedError, 'eth_hashrate not yet implemented'
|
84
|
+
end
|
85
|
+
|
86
|
+
# https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gasprice
|
87
|
+
def eth_gas_price
|
88
|
+
raise NotImplementedError, 'eth_gas_price not yet implemented'
|
89
|
+
end
|
90
|
+
|
91
|
+
# https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_accounts
|
92
|
+
def eth_accounts
|
93
|
+
raise NotImplementedError, 'eth_accounts not yet implemented'
|
94
|
+
end
|
95
|
+
|
96
|
+
# https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_blocknumber
|
97
|
+
def eth_block_number
|
98
|
+
raise NotImplementedError, 'eth_block_number not yet implemented'
|
99
|
+
end
|
100
|
+
|
101
|
+
# https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getbalance
|
102
|
+
def eth_get_balance(address, block_number)
|
103
|
+
raise NotImplementedError, 'eth_get_balance not yet implemented'
|
104
|
+
end
|
105
|
+
|
106
|
+
# https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getstorageat
|
107
|
+
def eth_get_storage_at(address, position, block_number)
|
108
|
+
raise NotImplementedError, 'eth_get_storage_at not yet implemented'
|
109
|
+
end
|
110
|
+
|
111
|
+
# https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactioncount
|
112
|
+
def eth_get_transaction_count(address, block_number)
|
113
|
+
raise NotImplementedError, 'eth_get_transaction_count not yet implemented'
|
114
|
+
end
|
115
|
+
|
116
|
+
# https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblocktransactioncountbyhash
|
117
|
+
def eth_get_block_transaction_count_by_hash(block_hash)
|
118
|
+
raise NotImplementedError, 'eth_get_block_transaction_count_by_hash not yet implemented'
|
119
|
+
end
|
120
|
+
|
121
|
+
# https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblocktransactioncountbynumber
|
122
|
+
def eth_get_block_transaction_count_by_number(block_number)
|
123
|
+
raise NotImplementedError, 'eth_get_block_transaction_count_by_number not yet implemented'
|
124
|
+
end
|
125
|
+
|
126
|
+
# https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getunclecountbyblockhash
|
127
|
+
def eth_get_uncle_count_by_block_hash(block_hash)
|
128
|
+
raise NotImplementedError, 'eth_get_uncle_count_by_block_hash not yet implemented'
|
129
|
+
end
|
130
|
+
|
131
|
+
# https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getunclecountbyblocknumber
|
132
|
+
def eth_get_uncle_count_by_block_number(block_number)
|
133
|
+
raise NotImplementedError, 'eth_get_uncle_count_by_block_number not yet implemented'
|
134
|
+
end
|
135
|
+
|
136
|
+
# https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getcode
|
137
|
+
def eth_get_code(address, block_number)
|
138
|
+
raise NotImplementedError, 'eth_get_code not yet implemented'
|
139
|
+
end
|
140
|
+
|
141
|
+
# https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign
|
142
|
+
def eth_sign(address, data)
|
143
|
+
raise NotImplementedError, 'eth_sign not yet implemented'
|
144
|
+
end
|
145
|
+
|
146
|
+
# https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sendtransaction
|
147
|
+
def eth_send_transaction(object)
|
148
|
+
raise NotImplementedError, 'eth_send_transaction not yet implemented'
|
149
|
+
end
|
150
|
+
|
151
|
+
# https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sendrawtransaction
|
152
|
+
def eth_send_raw_transaction(signed_transaction_data)
|
153
|
+
raise NotImplementedError, 'eth_send_raw_transaction not yet implemented'
|
154
|
+
end
|
155
|
+
|
156
|
+
# https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_call
|
157
|
+
def eth_call(object)
|
158
|
+
raise NotImplementedError, 'eth_call not yet implemented'
|
159
|
+
end
|
160
|
+
|
161
|
+
# https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_estimategas
|
162
|
+
def eth_estimate_gas(object)
|
163
|
+
raise NotImplementedError, 'eth_estimate_gas not yet implemented'
|
164
|
+
end
|
165
|
+
|
166
|
+
# https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblockbyhash
|
167
|
+
def eth_get_block_by_hash(block_hash, full)
|
168
|
+
raise NotImplementedError, 'eth_get_block_by_hash not yet implemented'
|
169
|
+
end
|
170
|
+
|
171
|
+
# https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblockbynumber
|
172
|
+
def eth_get_block_by_number(block_number, full)
|
173
|
+
raise NotImplementedError, 'eth_get_block_by_number not yet implemented'
|
174
|
+
end
|
175
|
+
|
176
|
+
# https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionbyhash
|
177
|
+
def eth_get_transaction_by_hash(transaction_hash)
|
178
|
+
raise NotImplementedError, 'eth_get_transaction_by_hash not yet implemented'
|
179
|
+
end
|
180
|
+
|
181
|
+
# https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionbyblockhashandindex
|
182
|
+
def eth_get_transaction_by_block_hash_and_index(block_hash, transaction_index)
|
183
|
+
raise NotImplementedError, 'eth_get_transaction_by_block_hash_and_index not yet implemented'
|
184
|
+
end
|
185
|
+
|
186
|
+
# https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionbyblocknumberandindex
|
187
|
+
def eth_get_transaction_by_block_number_and_index(block_number, transaction_index)
|
188
|
+
raise NotImplementedError, 'eth_get_transaction_by_block_number_and_index not yet implemented'
|
189
|
+
end
|
190
|
+
|
191
|
+
# https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionreceipt
|
192
|
+
def eth_get_transaction_receipt(transaction_hash)
|
193
|
+
raise NotImplementedError, 'eth_get_transaction_receipt not yet implemented'
|
194
|
+
end
|
195
|
+
|
196
|
+
# https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getunclebyblockhashandindex
|
197
|
+
def eth_get_uncle_by_block_hash_and_index(block_hash, uncle_index)
|
198
|
+
raise NotImplementedError, 'eth_get_uncle_by_block_hash_and_index not yet implemented'
|
199
|
+
end
|
200
|
+
|
201
|
+
# https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getunclebyblocknumberandindex
|
202
|
+
def eth_get_uncle_by_block_number_and_index(block_number, uncle_index)
|
203
|
+
raise NotImplementedError, 'eth_get_uncle_by_block_number_and_index not yet implemented'
|
204
|
+
end
|
205
|
+
|
206
|
+
# https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getcompilers
|
207
|
+
def eth_get_compilers
|
208
|
+
raise NotImplementedError, 'eth_get_compilers not yet implemented'
|
209
|
+
end
|
210
|
+
|
211
|
+
# https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_compilesolidity
|
212
|
+
def eth_compile_solidity(code)
|
213
|
+
raise NotImplementedError, 'eth_compile_solidity not yet implemented'
|
214
|
+
end
|
215
|
+
|
216
|
+
# https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_compilelll
|
217
|
+
def eth_compile_LLL(code)
|
218
|
+
raise NotImplementedError, 'eth_compile_LLL not yet implemented'
|
219
|
+
end
|
220
|
+
|
221
|
+
# https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_compileserpent
|
222
|
+
def eth_compile_serpent(code)
|
223
|
+
raise NotImplementedError, 'eth_compile_serpent not yet implemented'
|
224
|
+
end
|
225
|
+
|
226
|
+
# https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_newfilter
|
227
|
+
def eth_new_filter(object)
|
228
|
+
raise NotImplementedError, 'eth_new_filter not yet implemented'
|
229
|
+
end
|
230
|
+
|
231
|
+
# https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_newblockfilter
|
232
|
+
def eth_new_block_filter
|
233
|
+
raise NotImplementedError, 'eth_new_block_filter not yet implemented'
|
234
|
+
end
|
235
|
+
|
236
|
+
# https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_newpendingtransactionfilter
|
237
|
+
def eth_new_pending_transaction_filter
|
238
|
+
raise NotImplementedError, 'eth_new_pending_transaction_filter not yet implemented'
|
239
|
+
end
|
240
|
+
|
241
|
+
# https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_uninstallfilter
|
242
|
+
def eth_uninstall_filter(filter_id)
|
243
|
+
raise NotImplementedError, 'eth_uninstall_filter not yet implemented'
|
244
|
+
end
|
245
|
+
|
246
|
+
# https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getfilterchanges
|
247
|
+
def eth_get_filter_changes(filter_id)
|
248
|
+
raise NotImplementedError, 'eth_get_filter_changes not yet implemented'
|
249
|
+
end
|
250
|
+
|
251
|
+
# https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getfilterlogs
|
252
|
+
def eth_get_filter_logs(filter_id)
|
253
|
+
raise NotImplementedError, 'eth_get_filter_logs not yet implemented'
|
254
|
+
end
|
255
|
+
|
256
|
+
# https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getlogs
|
257
|
+
def eth_get_logs(filter)
|
258
|
+
raise NotImplementedError, 'eth_get_logs not yet implemented'
|
259
|
+
end
|
260
|
+
|
261
|
+
# https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getwork
|
262
|
+
def eth_get_work
|
263
|
+
raise NotImplementedError, 'eth_get_work not yet implemented'
|
264
|
+
end
|
265
|
+
|
266
|
+
# https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_submitwork
|
267
|
+
def eth_submit_work(nonce_found, headers_pow_hash, mix_digest)
|
268
|
+
raise NotImplementedError, 'eth_submit_work not yet implemented'
|
269
|
+
end
|
270
|
+
|
271
|
+
# https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_submithashrate
|
272
|
+
def eth_submit_hashrate(hashrate, random)
|
273
|
+
raise NotImplementedError, 'eth_submit_hashrate not yet implemented'
|
274
|
+
end
|
275
|
+
|
276
|
+
# https://github.com/ethereum/wiki/wiki/JSON-RPC#shh_version
|
277
|
+
def shh_version
|
278
|
+
raise NotImplementedError, 'shh_version not yet implemented'
|
279
|
+
end
|
280
|
+
|
281
|
+
# https://github.com/ethereum/wiki/wiki/JSON-RPC#shh_post
|
282
|
+
def shh_post(object)
|
283
|
+
raise NotImplementedError, 'shh_post not yet implemented'
|
284
|
+
end
|
285
|
+
|
286
|
+
# https://github.com/ethereum/wiki/wiki/JSON-RPC#shh_newidentity
|
287
|
+
def shh_new_identity
|
288
|
+
raise NotImplementedError, 'shh_new_identity not yet implemented'
|
289
|
+
end
|
290
|
+
|
291
|
+
# https://github.com/ethereum/wiki/wiki/JSON-RPC#shh_hasidentity
|
292
|
+
def shh_has_identity(address)
|
293
|
+
raise NotImplementedError, 'shh_has_identity not yet implemented'
|
294
|
+
end
|
295
|
+
|
296
|
+
# https://github.com/ethereum/wiki/wiki/JSON-RPC#shh_newgroup
|
297
|
+
def shh_new_group
|
298
|
+
raise NotImplementedError, 'shh_new_group not yet implemented'
|
299
|
+
end
|
300
|
+
|
301
|
+
# https://github.com/ethereum/wiki/wiki/JSON-RPC#shh_addtogroup
|
302
|
+
def shh_add_to_group(address)
|
303
|
+
raise NotImplementedError, 'shh_add_to_group not yet implemented'
|
304
|
+
end
|
305
|
+
|
306
|
+
# https://github.com/ethereum/wiki/wiki/JSON-RPC#shh_newfilter
|
307
|
+
def shh_new_filter(object)
|
308
|
+
raise NotImplementedError, 'shh_new_filter not yet implemented'
|
309
|
+
end
|
310
|
+
|
311
|
+
# https://github.com/ethereum/wiki/wiki/JSON-RPC#shh_uninstallfilter
|
312
|
+
def shh_uninstall_filter(filter_id)
|
313
|
+
raise NotImplementedError, 'shh_uninstall_filter not yet implemented'
|
314
|
+
end
|
315
|
+
|
316
|
+
# https://github.com/ethereum/wiki/wiki/JSON-RPC#shh_getfilterchanges
|
317
|
+
def shh_get_filter_changes(filter_id)
|
318
|
+
raise NotImplementedError, 'shh_get_filter_changes not yet implemented'
|
319
|
+
end
|
320
|
+
|
321
|
+
# https://github.com/ethereum/wiki/wiki/JSON-RPC#shh_getmessages
|
322
|
+
def shh_get_messages(filter_id)
|
323
|
+
raise NotImplementedError, 'shh_get_messages not yet implemented'
|
324
|
+
end
|
325
|
+
|
30
326
|
private
|
31
327
|
|
32
328
|
def post(payload)
|
@@ -61,4 +61,34 @@ RSpec.describe EthereumClient do
|
|
61
61
|
end
|
62
62
|
end
|
63
63
|
end
|
64
|
+
|
65
|
+
describe '.net_version' do
|
66
|
+
it 'raises error' do
|
67
|
+
expect { subject.net_version }.to raise_error(NotImplementedError, 'net_version not yet implemented')
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
describe '.net_listening' do
|
72
|
+
it 'raises error' do
|
73
|
+
expect { subject.net_listening }.to raise_error(NotImplementedError, 'net_listening not yet implemented')
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
describe '.net_peer_count' do
|
78
|
+
it 'raises error' do
|
79
|
+
expect { subject.net_peer_count }.to raise_error(NotImplementedError, 'net_peer_count not yet implemented')
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
describe '.eth_protocol_version' do
|
84
|
+
it 'raises error' do
|
85
|
+
expect { subject.eth_protocol_version }.to raise_error(NotImplementedError, 'eth_protocol_version not yet implemented')
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
describe '.eth_syncing' do
|
90
|
+
it 'raises error' do
|
91
|
+
expect { subject.eth_syncing }.to raise_error(NotImplementedError, 'eth_syncing not yet implemented')
|
92
|
+
end
|
93
|
+
end
|
64
94
|
end
|