ruby-client 1.1.5 → 1.2.3
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/api.rb +100 -20
- data/lib/nimiq/version.rb +1 -1
- data/lib/{rpcclient.rb → rpc.rb} +4 -1
- data/lib/ruby-client.rb +1 -1
- data/lib/types.rb +111 -0
- data/spec/client_spec.rb +304 -0
- metadata +7 -23
- data/Gemfile +0 -6
- data/Gemfile.lock +0 -92
- data/LICENSE +0 -177
- data/README.md +0 -49
- data/Rakefile +0 -14
- data/main.rb +0 -153
- data/ruby-client-1.0.0.gem +0 -0
- data/ruby-client-1.0.1.gem +0 -0
- data/ruby-client-1.0.2.gem +0 -0
- data/ruby-client-1.0.3.gem +0 -0
- data/ruby-client-1.0.4.gem +0 -0
- data/ruby-client-1.0.5.gem +0 -0
- data/ruby-client-1.1.1.gem +0 -0
- data/ruby-client-1.1.2.gem +0 -0
- data/ruby-client-1.1.3.gem +0 -0
- data/ruby-client-1.1.4.gem +0 -0
- data/ruby-client.gemspec +0 -33
- data/rubyclient-1.0.0.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a137cb7c34ec19c512aeba486576004f912971dc22a7ccbba363c20f2151bb7
|
4
|
+
data.tar.gz: 3852d552b5fb140c2c09f54367b6ff0b971e39760da206ea5c2a5c1498ef3fcd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5afd35c9c9955d3900fb07f938c6e6301220175f11743ea1d9929f5a81f424372319e8a5f8d47ca1c30510ef6cb37b195e29a230467476fbd316f98008d81e54
|
7
|
+
data.tar.gz: 43b2d1cf3f0523b4a975edfe486df8786e1fb8497dab245a008f8adbf381cff24e0c2981e960f7713d379c3f0561c49dc37c058f5dbff80d294fae267d1d5df9
|
data/lib/api.rb
CHANGED
@@ -14,22 +14,32 @@
|
|
14
14
|
limitations under the License.
|
15
15
|
=end
|
16
16
|
|
17
|
+
require "sorbet-runtime"
|
18
|
+
require_relative "types"
|
19
|
+
|
17
20
|
module Api
|
18
21
|
attr_accessor :rpc
|
22
|
+
extend T::Sig
|
19
23
|
|
20
24
|
# accounts - Returns a list of addresses owned by client.
|
25
|
+
sig { returns(T::Array[Types::Account]) }
|
26
|
+
|
21
27
|
def accounts
|
22
28
|
result = @rpc.request("accounts")
|
23
29
|
return result
|
24
30
|
end
|
25
31
|
|
26
32
|
# block_number - Returns the height of most recent block.
|
33
|
+
sig { returns(Integer) }
|
34
|
+
|
27
35
|
def block_number
|
28
36
|
result = @rpc.request("blockNumber")
|
29
37
|
return result
|
30
38
|
end
|
31
39
|
|
32
40
|
# consensus - Returns information on the current consensus state.
|
41
|
+
sig { returns(String) }
|
42
|
+
|
33
43
|
def consensus
|
34
44
|
result = @rpc.request("consensus")
|
35
45
|
return result
|
@@ -41,6 +51,8 @@ module Api
|
|
41
51
|
# To reset the constant to the default value, the parameter "reset" should be used.
|
42
52
|
# - @param [String] name - The class and name of the constant. (format should be Class.CONSTANT)
|
43
53
|
# - @param [Integer] value - The new value of the constant or "reset". (optional)
|
54
|
+
sig { params(name: String, value: T.nilable(Integer)).returns(Integer) }
|
55
|
+
|
44
56
|
def constant(name, value = nil)
|
45
57
|
if value
|
46
58
|
result = @rpc.request("constant", name, value)
|
@@ -51,6 +63,8 @@ module Api
|
|
51
63
|
end
|
52
64
|
|
53
65
|
# create_account - Creates a new account and stores its private key in the client store.
|
66
|
+
sig { returns(Types::Wallet) }
|
67
|
+
|
54
68
|
def create_account
|
55
69
|
result = @rpc.request("createAccount")
|
56
70
|
return result
|
@@ -59,21 +73,27 @@ module Api
|
|
59
73
|
# create_raw_transaction - Creates and signs a transaction without sending it.
|
60
74
|
# The transaction can then be send via `send_raw_transaction` without accidentally replaying it.
|
61
75
|
# - @param [TransactionObject] transaction - The transaction object.
|
76
|
+
sig { params(transaction: Types::TransactionOutgoing).returns(String) }
|
77
|
+
|
62
78
|
def create_raw_transaction(transaction)
|
63
79
|
result = @rpc.request("createRawTransaction", transaction)
|
64
80
|
return result
|
65
81
|
end
|
66
82
|
|
67
|
-
#
|
68
|
-
#
|
69
|
-
#
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
83
|
+
# NEW
|
84
|
+
# get_raw_transaction_info - Checks signed_transaction raw information.
|
85
|
+
# - @param [String] signed_transaction - The hex encoded signed transaction.
|
86
|
+
sig { params(signed_transaction: String).returns(Object) }
|
87
|
+
|
88
|
+
def get_raw_transaction_info(signed_transaction)
|
89
|
+
result = @rpc.request("getRawTransactionInfo", signed_transaction)
|
90
|
+
return result
|
91
|
+
end
|
74
92
|
|
75
93
|
# get_account - Returns details for the account of given address.
|
76
94
|
# - @param [String] address - Address to get account details.
|
95
|
+
sig { params(address: String).returns(Types::Account) }
|
96
|
+
|
77
97
|
def get_account(address)
|
78
98
|
result = @rpc.request("getAccount", address)
|
79
99
|
return result
|
@@ -81,6 +101,8 @@ module Api
|
|
81
101
|
|
82
102
|
# get_balance - Returns the balance of the account of given address.
|
83
103
|
# - @param [String] address - Address to check for balance.
|
104
|
+
sig { params(address: String).returns(Integer) }
|
105
|
+
|
84
106
|
def get_balance(address)
|
85
107
|
result = @rpc.request("getBalance", address)
|
86
108
|
return result
|
@@ -89,6 +111,8 @@ module Api
|
|
89
111
|
# get_block_by_hash - Returns information about a block by hash.
|
90
112
|
# - @param [String] block_hash - Hash of the block to gather information on.
|
91
113
|
# - @param [Boolean] full_transactions (optional) - If true it returns the full transaction objects, if false only the hashes of the transactions. (default false)
|
114
|
+
sig { params(block_hash: String, full_transactions: T.nilable(T::Boolean)).returns(Types::Block) }
|
115
|
+
|
92
116
|
def get_block_by_hash(block_hash, full_transactions = nil)
|
93
117
|
if full_transactions
|
94
118
|
result = @rpc.request("getBlockByHash", block_hash, full_transactions)
|
@@ -101,6 +125,8 @@ module Api
|
|
101
125
|
# get_block_by_number - Returns information about a block by block number.
|
102
126
|
# - @param [Integer] block_number - The height of the block to gather information on.
|
103
127
|
# - @param [Boolean] full_transactions (optional) - If true it returns the full transaction objects, if false only the hashes of the transactions. (default false)
|
128
|
+
sig { params(block_number: Integer, full_transactions: T.nilable(T::Boolean)).returns(Types::Block) }
|
129
|
+
|
104
130
|
def get_block_by_number(block_number, full_transactions = nil)
|
105
131
|
if full_transactions
|
106
132
|
result = @rpc.request("getBlockByNumber", block_number, full_transactions)
|
@@ -113,14 +139,18 @@ module Api
|
|
113
139
|
# get_block_template - Returns a template to build the next block for mining.
|
114
140
|
# This will consider pool instructions when connected to a pool.
|
115
141
|
# - @param [String] address (optional) - Address to use as a miner for this block. This overrides the address provided during startup or from the pool.
|
116
|
-
# - @param [String]
|
117
|
-
|
142
|
+
# - @param [String] data_field (optional) - Hex-encoded value for the extra data field. This overrides the address provided during startup or from the pool.
|
143
|
+
sig { params(address: T.nilable(Integer), data_field: T.nilable(String)).returns(Types::BlockTemplate) }
|
144
|
+
|
145
|
+
def get_block_template(address = nil, data_field = nil)
|
118
146
|
result = @rpc.request("getBlockTemplate")
|
119
147
|
return result
|
120
148
|
end
|
121
149
|
|
122
150
|
# get_block_transaction_count_by_hash - Returns the number of transactions in a block from a block matching the given block hash.
|
123
151
|
# - @param [String] block_hash - Hash of the block.
|
152
|
+
sig { params(block_hash: String).returns(Integer) }
|
153
|
+
|
124
154
|
def get_block_transaction_count_by_hash(block_hash)
|
125
155
|
result = @rpc.request("getBlockTransactionCountByHash", block_hash)
|
126
156
|
return result
|
@@ -128,29 +158,37 @@ module Api
|
|
128
158
|
|
129
159
|
# get_block_transaction_count_by_number - Returns the number of transactions in a block matching the given block number.
|
130
160
|
# - @param [Integer] block_number - Height of the block.
|
161
|
+
sig { params(block_number: Integer).returns(Integer) }
|
162
|
+
|
131
163
|
def get_block_transaction_count_by_number(block_number)
|
132
164
|
result = @rpc.request("getBlockTransactionCountByNumber", block_number)
|
133
165
|
return result
|
134
166
|
end
|
135
167
|
|
136
168
|
# get_transaction_by_block_hash_and_index - Returns information about a transaction by block hash and transaction index position.
|
137
|
-
# - @param [
|
169
|
+
# - @param [String] block_hash - Hash of the block containing the transaction.
|
138
170
|
# - @param [Integer] transaction_index - Index of the transaction in the block.
|
171
|
+
sig { params(block_hash: String, transaction_index: Integer).returns(T.nilable(Types::Transaction)) }
|
172
|
+
|
139
173
|
def get_transaction_by_block_hash_and_index(block_hash, transaction_index)
|
140
174
|
result = @rpc.request("getTransactionByBlockHashAndIndex", block_hash, transaction_index)
|
141
175
|
return result
|
142
176
|
end
|
143
177
|
|
144
178
|
# get_transaction_by_block_number_and_index - Returns information about a transaction by block number and transaction index position.
|
145
|
-
# - @param [Integer]
|
179
|
+
# - @param [Integer] block_hash_index - Height of the block containing the transaction.
|
146
180
|
# - @param [Integer] transaction_index - Index of the transaction in the block.
|
147
|
-
|
148
|
-
|
181
|
+
sig { params(block_hash_index: Integer, transaction_index: Integer).returns(T.nilable(Types::Transaction)) }
|
182
|
+
|
183
|
+
def get_transaction_by_block_number_and_index(block_hash_index, transaction_index)
|
184
|
+
result = @rpc.request("getTransactionByBlockNumberAndIndex", block_hash_index, transaction_index)
|
149
185
|
return result
|
150
186
|
end
|
151
187
|
|
152
188
|
# get_transaction_by_hash - Returns the information about a transaction requested by transaction hash.
|
153
189
|
# - @param [String] transaction_hash - Hash of a transaction.
|
190
|
+
sig { params(transaction_hash: String).returns(T.nilable(Types::Transaction)) }
|
191
|
+
|
154
192
|
def get_transaction_by_hash(transaction_hash)
|
155
193
|
result = @rpc.request("getTransactionByHash", transaction_hash)
|
156
194
|
return result
|
@@ -159,6 +197,8 @@ module Api
|
|
159
197
|
# get_transaction_receipt - Returns the receipt of a transaction by transaction hash.
|
160
198
|
# Note That the receipt is not available for pending transactions.
|
161
199
|
# - @param [String] transaction_hash - Hash of a transaction.
|
200
|
+
sig { params(transaction_hash: String).returns(T.nilable(Types::TransactionReceipt)) }
|
201
|
+
|
162
202
|
def get_transaction_receipt(transaction_hash)
|
163
203
|
result = @rpc.request("getTransactionReceipt", transaction_hash)
|
164
204
|
return result
|
@@ -167,6 +207,8 @@ module Api
|
|
167
207
|
# get_transactions_by_address - Returns the latest transactions successfully performed by or for an address.
|
168
208
|
# - @param [String] address - Address of which transactions should be gathered.
|
169
209
|
# - @param [Integer] transactions_number (optional) - Number of transactions that shall be returned. (default 1000)
|
210
|
+
sig { params(address: String, transactions_number: T.nilable(Integer)).returns(T.nilable(T::Array[Types::Transaction])) }
|
211
|
+
|
170
212
|
def get_transactions_by_address(address, transactions_number = nil)
|
171
213
|
if transactions_number
|
172
214
|
result = @rpc.request("getTransactionsByAddress", address, transactions_number)
|
@@ -178,13 +220,17 @@ module Api
|
|
178
220
|
|
179
221
|
# get_work - Returns instructions to mine the next block. This will consider pool instructions when connected to a pool.
|
180
222
|
# - @param [String] address (optional) - Address to use as a miner for this block. This overrides the address provided during startup or from the pool.
|
181
|
-
# - @param [String]
|
182
|
-
|
183
|
-
|
223
|
+
# - @param [String] data_field (optional) - Hex-encoded value for the extra data field. This overrides the address provided during startup or from the pool.
|
224
|
+
sig { params(address: T.nilable(String), data_field: T.nilable(String)).returns(Types::MiningWork) }
|
225
|
+
|
226
|
+
def get_work(address = nil, data_field = nil)
|
227
|
+
result = @rpc.request("getWork", address, data_field)
|
184
228
|
return result
|
185
229
|
end
|
186
230
|
|
187
231
|
# hashrate - Returns the number of hashes per second that the node is mining with.
|
232
|
+
sig { returns(T.any(Integer, Float)) }
|
233
|
+
|
188
234
|
def hashrate
|
189
235
|
result = @rpc.request("hashrate")
|
190
236
|
return result
|
@@ -193,24 +239,32 @@ module Api
|
|
193
239
|
# log - Sets the log level of the node.
|
194
240
|
# - @param [String] tag - If the tag is '*' the log level will be set globally, otherwise the log level is applied only on this tag.
|
195
241
|
# - @param [String] log_level - Log levels valid options: `trace`, `verbose`, `debug`, `info`, `warn`, `error`, `assert`.
|
242
|
+
sig { params(tag: String, log_level: String).returns(T::Boolean) }
|
243
|
+
|
196
244
|
def log(tag, log_level)
|
197
245
|
result = @rpc.request("log", tag, log_level)
|
198
246
|
return result
|
199
247
|
end
|
200
248
|
|
201
249
|
# mempool - Returns information on the current mempool situation. This will provide an overview of the number of transactions sorted into buckets based on their fee per byte (in smallest unit).
|
250
|
+
sig { returns(Object) }
|
251
|
+
|
202
252
|
def mempool
|
203
253
|
result = @rpc.request("mempool")
|
204
254
|
return result
|
205
255
|
end
|
206
256
|
|
207
257
|
# mempool_content - Returns transactions that are currently in the mempool.
|
208
|
-
|
258
|
+
sig { params(include_full_transactions: T.nilable(T::Boolean)).returns(T.any(T.nilable(T::Array[Types::Transaction]), T.nilable(T::Array))) }
|
259
|
+
|
260
|
+
def mempool_content(include_full_transactions = nil)
|
209
261
|
result = @rpc.request("mempoolContent")
|
210
262
|
return result
|
211
263
|
end
|
212
264
|
|
213
265
|
# miner_address - Returns the miner address.
|
266
|
+
sig { returns(String) }
|
267
|
+
|
214
268
|
def miner_address
|
215
269
|
result = @rpc.request("minerAddress")
|
216
270
|
return result
|
@@ -218,6 +272,8 @@ module Api
|
|
218
272
|
|
219
273
|
# miner_threads - Returns or sets the number of CPU threads for the miner.
|
220
274
|
# - @param [Integer] set_threads (optional) - The number of threads to allocate for mining.
|
275
|
+
sig { params(set_threads: T.nilable(Integer)).returns(Integer) }
|
276
|
+
|
221
277
|
def miner_threads(set_threads = nil)
|
222
278
|
if set_threads
|
223
279
|
result = @rpc.request("minerThreads", set_threads)
|
@@ -229,6 +285,8 @@ module Api
|
|
229
285
|
|
230
286
|
# min_fee_per_byte - Returns or sets the minimum fee per byte.
|
231
287
|
# - @param [Integer] set_min_fee (optional) - The new minimum fee per byte.
|
288
|
+
sig { params(set_min_fee: T.nilable(Integer)).returns(Integer) }
|
289
|
+
|
232
290
|
def min_fee_per_byte(set_min_fee = nil)
|
233
291
|
if set_min_fee
|
234
292
|
result = @rpc.request("minFeePerByte", set_min_fee)
|
@@ -239,18 +297,24 @@ module Api
|
|
239
297
|
end
|
240
298
|
|
241
299
|
# mining - Returns `true` if client is actively mining new blocks.
|
300
|
+
sig { returns(T::Boolean) }
|
301
|
+
|
242
302
|
def mining
|
243
303
|
result = @rpc.request("mining")
|
244
304
|
return result
|
245
305
|
end
|
246
306
|
|
247
307
|
# peer_count - Returns number of peers currently connected to the client.
|
308
|
+
sig { returns(Integer) }
|
309
|
+
|
248
310
|
def peer_count
|
249
311
|
result = @rpc.request("peerCount")
|
250
312
|
return result
|
251
313
|
end
|
252
314
|
|
253
315
|
# peer_list - Returns list of peers known to the client.
|
316
|
+
sig { returns(T::Array[Types::Peer]) }
|
317
|
+
|
254
318
|
def peer_list
|
255
319
|
result = @rpc.request("peerList")
|
256
320
|
return result
|
@@ -258,6 +322,8 @@ module Api
|
|
258
322
|
|
259
323
|
# peer_state - Returns the state of the peer.
|
260
324
|
# - @param [String] peer_address - The address of the peer.
|
325
|
+
sig { params(peer_address: String).returns(Types::Peer) }
|
326
|
+
|
261
327
|
def peer_state(peer_address)
|
262
328
|
result = @rpc.request("peerState", peer_address)
|
263
329
|
return result
|
@@ -266,9 +332,11 @@ module Api
|
|
266
332
|
# pool - Returns or sets the mining pool.
|
267
333
|
# When no parameter is given, it returns the current mining pool. When a value is given as parameter, it sets the mining pool to that value.
|
268
334
|
# - @param [String/Boolean] pool_address (optional) - The mining pool connection string (url:port) or boolean to enable/disable pool mining.
|
269
|
-
|
270
|
-
|
271
|
-
|
335
|
+
sig { params(pool_address_or_action: T.nilable(T.any(String, T::Boolean))).returns(T.nilable(String)) }
|
336
|
+
|
337
|
+
def pool(pool_address_or_action = nil)
|
338
|
+
if pool_address_or_action
|
339
|
+
result = @rpc.request("pool", pool_address_or_action)
|
272
340
|
else
|
273
341
|
result = @rpc.request("pool")
|
274
342
|
end
|
@@ -276,12 +344,16 @@ module Api
|
|
276
344
|
end
|
277
345
|
|
278
346
|
# pool_confirmed_balance - Returns the confirmed mining pool balance.
|
347
|
+
sig { returns(Integer) }
|
348
|
+
|
279
349
|
def pool_confirmed_balance
|
280
350
|
result = @rpc.request("poolConfirmedBalance")
|
281
351
|
return result
|
282
352
|
end
|
283
353
|
|
284
354
|
# pool_connection_state - Returns the connection state to mining pool.
|
355
|
+
sig { returns(Integer) }
|
356
|
+
|
285
357
|
def pool_connection_state
|
286
358
|
result = @rpc.request("poolConnectionState")
|
287
359
|
return result
|
@@ -289,6 +361,8 @@ module Api
|
|
289
361
|
|
290
362
|
# send_raw_transaction - Sends a signed message call transaction or a contract creation, if the data field contains code.
|
291
363
|
# - @param [String] signed_transaction - The hex encoded signed transaction.
|
364
|
+
sig { params(signed_transaction: String).returns(Object) }
|
365
|
+
|
292
366
|
def send_raw_transaction(signed_transaction)
|
293
367
|
result = @rpc.request("sendRawTransaction", signed_transaction)
|
294
368
|
return result
|
@@ -296,6 +370,8 @@ module Api
|
|
296
370
|
|
297
371
|
# send_transaction - Creates new message call transaction or a contract creation, if the data field contains code.
|
298
372
|
# - @param [TransactionObject] transaction - The transaction object.
|
373
|
+
sig { params(transaction: Types::TransactionOutgoing).returns(String) }
|
374
|
+
|
299
375
|
def send_transaction(transaction)
|
300
376
|
result = @rpc.request("sendTransaction", transaction)
|
301
377
|
return result
|
@@ -304,12 +380,16 @@ module Api
|
|
304
380
|
# submit_block - Submits a block to the node. When the block is valid, the node will forward it to other nodes in the network.
|
305
381
|
# When submitting work from getWork, remember to include the suffix.
|
306
382
|
# - @param [String] block - Hex-encoded full block (including header, interlink and body).
|
383
|
+
sig { params(block: String) }
|
384
|
+
|
307
385
|
def submit_block(block)
|
308
386
|
result = @rpc.request("submitBlock", block)
|
309
387
|
return result
|
310
388
|
end
|
311
389
|
|
312
390
|
# syncing - Returns an object with data about the sync status or `false`.
|
391
|
+
sig { returns(T.any(Object, T::Boolean)) }
|
392
|
+
|
313
393
|
def syncing
|
314
394
|
result = @rpc.request("syncing")
|
315
395
|
return result
|
data/lib/nimiq/version.rb
CHANGED
data/lib/{rpcclient.rb → rpc.rb}
RENAMED
@@ -20,7 +20,7 @@ require "net/http"
|
|
20
20
|
# :nodoc: all
|
21
21
|
module ClientRPC
|
22
22
|
class Connect
|
23
|
-
attr_accessor :options, :uri
|
23
|
+
attr_accessor :options, :uri, :ssl
|
24
24
|
|
25
25
|
DEFAULTS = {
|
26
26
|
host: "localhost",
|
@@ -54,6 +54,7 @@ module ClientRPC
|
|
54
54
|
user = uri.user
|
55
55
|
pass = uri.password
|
56
56
|
http = Net::HTTP.new(uri.host, uri.port)
|
57
|
+
http.use_ssl = true if @ssl
|
57
58
|
request = Net::HTTP::Get.new(uri.request_uri)
|
58
59
|
request.basic_auth(user, pass)
|
59
60
|
request.body = request_body("", nil)
|
@@ -68,6 +69,7 @@ module ClientRPC
|
|
68
69
|
user = uri.user
|
69
70
|
pass = uri.password
|
70
71
|
http = Net::HTTP.new(uri.host, uri.port)
|
72
|
+
http.use_ssl = true if @ssl
|
71
73
|
request = Net::HTTP::Post.new(uri.request_uri)
|
72
74
|
request.basic_auth(user, pass)
|
73
75
|
request.body = request_body(name, params)
|
@@ -89,6 +91,7 @@ module ClientRPC
|
|
89
91
|
host = options[:host]
|
90
92
|
newhost = url_strip(host.dup)
|
91
93
|
if (options[:host].include? "https")
|
94
|
+
@ssl = true
|
92
95
|
return "https://#{options[:user]}:#{options[:pass]}@#{newhost}:#{options[:port]}"
|
93
96
|
else
|
94
97
|
return "http://#{options[:user]}:#{options[:pass]}@#{newhost}:#{options[:port]}"
|
data/lib/ruby-client.rb
CHANGED
data/lib/types.rb
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
require "sorbet-runtime"
|
2
|
+
|
3
|
+
# :nodoc: all
|
4
|
+
module Types
|
5
|
+
extend T::Sig
|
6
|
+
|
7
|
+
Block = {
|
8
|
+
number: Integer,
|
9
|
+
hash: String,
|
10
|
+
pow: String,
|
11
|
+
parentHash: String,
|
12
|
+
nonce: Integer,
|
13
|
+
bodyHash: String,
|
14
|
+
accountsHash: String,
|
15
|
+
miner: String,
|
16
|
+
minerAddress: String,
|
17
|
+
difficulty: String,
|
18
|
+
extraData: String,
|
19
|
+
size: Integer,
|
20
|
+
timestamp: Integer,
|
21
|
+
transactions: Array,
|
22
|
+
confirmations: T.nilable(Integer),
|
23
|
+
}
|
24
|
+
|
25
|
+
BlockTemplate = {
|
26
|
+
header: {
|
27
|
+
version: Integer,
|
28
|
+
prevHash: String,
|
29
|
+
interlinkHash: String,
|
30
|
+
accountsHash: String,
|
31
|
+
nBits: Integer,
|
32
|
+
height: Integer,
|
33
|
+
},
|
34
|
+
interlink: String,
|
35
|
+
body: {
|
36
|
+
hash: String,
|
37
|
+
minerAddr: String,
|
38
|
+
extraData: String,
|
39
|
+
transactions: T::Array[String],
|
40
|
+
prunedAccounts: T::Array[String],
|
41
|
+
merkleHashes: T::Array[String],
|
42
|
+
},
|
43
|
+
target: Integer,
|
44
|
+
}
|
45
|
+
|
46
|
+
Wallet = {
|
47
|
+
id: String,
|
48
|
+
address: String,
|
49
|
+
publicKey: String,
|
50
|
+
}
|
51
|
+
|
52
|
+
Account = {
|
53
|
+
id: String,
|
54
|
+
address: String,
|
55
|
+
balance: Integer,
|
56
|
+
type: Integer,
|
57
|
+
}
|
58
|
+
|
59
|
+
Transaction = {
|
60
|
+
hash: String,
|
61
|
+
blockHash: T.nilable(String),
|
62
|
+
blockNumber: T.nilable(Integer),
|
63
|
+
timestamp: T.nilable(Integer),
|
64
|
+
confirmations: T.nilable(Integer),
|
65
|
+
transactionIndex: T.nilable(Integer),
|
66
|
+
from: String,
|
67
|
+
fromAddress: String,
|
68
|
+
to: String,
|
69
|
+
toAddress: String,
|
70
|
+
value: Integer,
|
71
|
+
fee: Integer,
|
72
|
+
data: T.nilable(String),
|
73
|
+
flags: Integer,
|
74
|
+
}
|
75
|
+
|
76
|
+
TransactionOutgoing = {
|
77
|
+
from: String,
|
78
|
+
to: String,
|
79
|
+
value: Integer,
|
80
|
+
fee: Integer,
|
81
|
+
}
|
82
|
+
|
83
|
+
TransactionReceipt = {
|
84
|
+
transactionHash: String,
|
85
|
+
transactionIndex: Integer,
|
86
|
+
blockNumber: Integer,
|
87
|
+
blockHash: String,
|
88
|
+
confirmations: Integer,
|
89
|
+
timestamp: Integer,
|
90
|
+
}
|
91
|
+
|
92
|
+
MiningWork = {
|
93
|
+
data: String,
|
94
|
+
suffix: String,
|
95
|
+
target: Integer,
|
96
|
+
algorithm: String,
|
97
|
+
}
|
98
|
+
|
99
|
+
Peer = {
|
100
|
+
id: String,
|
101
|
+
address: String,
|
102
|
+
addressState: Integer,
|
103
|
+
connectionState: T.nilable(Integer),
|
104
|
+
version: T.nilable(Integer),
|
105
|
+
timeOffset: T.nilable(Integer),
|
106
|
+
headHash: T.nilable(String),
|
107
|
+
latency: T.nilable(Integer),
|
108
|
+
rx: T.nilable(Integer),
|
109
|
+
tx: T.nilable(Integer),
|
110
|
+
}
|
111
|
+
end
|