radiator 0.4.7 → 0.4.8.pre.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -7
- data/Rakefile +50 -20
- data/lib/radiator.rb +3 -1
- data/lib/radiator/api.rb +83 -10
- data/lib/radiator/bridge.rb +34 -0
- data/lib/radiator/chain_config.rb +9 -2
- data/lib/radiator/database_api.rb +1 -1
- data/lib/radiator/follow_api.rb +1 -1
- data/lib/radiator/market_history_api.rb +1 -1
- data/lib/radiator/operation.rb +3 -2
- data/lib/radiator/operation_types.rb +43 -27
- data/lib/radiator/ssc/base_steem_smart_contract_rpc.rb +1 -1
- data/lib/radiator/stream.rb +15 -6
- data/lib/radiator/transaction.rb +28 -1
- data/lib/radiator/type/amount.rb +26 -51
- data/lib/radiator/type/price.rb +2 -2
- data/lib/radiator/version.rb +1 -1
- data/radiator.gemspec +13 -11
- data/test/fixtures/empty.json +1 -0
- data/test/fixtures/error.json +29 -0
- data/test/fixtures/follow_api_get_followers.json +1 -0
- data/test/fixtures/get_account.json +165 -0
- data/test/fixtures/get_account_count.json +1 -0
- data/test/fixtures/get_account_references.json +1 -0
- data/test/fixtures/get_block.json +193 -0
- data/test/fixtures/get_dynamic_global_properties.json +32 -0
- data/test/fixtures/get_feed_history.json +684 -0
- data/test/fixtures/get_hardfork_version.json +1 -0
- data/test/fixtures/get_key_references.json +14 -0
- data/test/fixtures/get_stats_for_time.json +57 -0
- data/test/fixtures/get_vesting_delegation.json +936 -0
- data/test/fixtures/golos_get_dynamic_global_properties.json +32 -0
- data/test/fixtures/market_history_api_get_market_history_buckets.json +1 -0
- data/test/fixtures/market_history_api_get_order_book.json +109 -0
- data/test/fixtures/market_history_api_get_recent_trades.json +55 -0
- data/test/fixtures/market_history_api_get_ticker.json +11 -0
- data/test/fixtures/market_history_api_get_volume.json +1 -0
- data/test/fixtures/null.json +1 -0
- data/test/fixtures/vcr_cassettes/account_by_key_api_all_methods.yml +525 -0
- data/test/fixtures/vcr_cassettes/account_by_key_api_jsonrpc.yml +52 -0
- data/test/fixtures/vcr_cassettes/all_methods.yml +18155 -0
- data/test/fixtures/vcr_cassettes/api_all_methods.yml +13254 -0
- data/test/fixtures/vcr_cassettes/base_per_debt.yml +4946 -0
- data/test/fixtures/vcr_cassettes/base_per_mvest.yml +3969 -0
- data/test/fixtures/vcr_cassettes/block_time.yml +3322 -0
- data/test/fixtures/vcr_cassettes/broadcast_transaction.yml +1186 -0
- data/test/fixtures/vcr_cassettes/condenser_all_all_methods.yml +13297 -0
- data/test/fixtures/vcr_cassettes/expiration_initialize.yml +3428 -0
- data/test/fixtures/vcr_cassettes/find_account.yml +3681 -0
- data/test/fixtures/vcr_cassettes/find_block.yml +3589 -0
- data/test/fixtures/vcr_cassettes/find_comment.yml +11464 -0
- data/test/fixtures/vcr_cassettes/follow_api_jsonrpc.yml +52 -0
- data/test/fixtures/vcr_cassettes/get_account_count.yml +575 -0
- data/test/fixtures/vcr_cassettes/get_account_references.yml +608 -0
- data/test/fixtures/vcr_cassettes/get_accounts.yml +674 -0
- data/test/fixtures/vcr_cassettes/get_accounts_no_argument.yml +608 -0
- data/test/fixtures/vcr_cassettes/get_dynamic_global_properties.yml +661 -0
- data/test/fixtures/vcr_cassettes/get_feed_history.yml +1106 -0
- data/test/fixtures/vcr_cassettes/get_hardfork_version.yml +577 -0
- data/test/fixtures/vcr_cassettes/get_key_references.yml +987 -0
- data/test/fixtures/vcr_cassettes/get_market_history.yml +1043 -0
- data/test/fixtures/vcr_cassettes/get_market_history_buckets.yml +1043 -0
- data/test/fixtures/vcr_cassettes/get_order_book.yml +1091 -0
- data/test/fixtures/vcr_cassettes/get_recent_trades.yml +1043 -0
- data/test/fixtures/vcr_cassettes/get_ticker.yml +1047 -0
- data/test/fixtures/vcr_cassettes/get_trade_history.yml +1049 -0
- data/test/fixtures/vcr_cassettes/get_vesting_delegations.yml +523 -0
- data/test/fixtures/vcr_cassettes/get_volume.yml +1051 -0
- data/test/fixtures/vcr_cassettes/get_witness_by_account.yml +575 -0
- data/test/fixtures/vcr_cassettes/look_up_witnesses.yml +523 -0
- data/test/fixtures/vcr_cassettes/market_history_api_all_methods.yml +4373 -0
- data/test/fixtures/vcr_cassettes/network_broadcast_api_all_methods.yml +1288 -0
- data/test/fixtures/vcr_cassettes/properties.yml +3627 -0
- data/test/fixtures/vcr_cassettes/recover_transaction.yml +1099 -0
- data/test/fixtures/vcr_cassettes/ssc_blockchain_block_info.yml +92 -0
- data/test/fixtures/vcr_cassettes/ssc_blockchain_block_info_invalid.yml +90 -0
- data/test/fixtures/vcr_cassettes/ssc_blockchain_latest_block_info.yml +91 -0
- data/test/fixtures/vcr_cassettes/ssc_blockchain_transaction_info.yml +92 -0
- data/test/fixtures/vcr_cassettes/ssc_contracts_contract.yml +366 -0
- data/test/fixtures/vcr_cassettes/ssc_contracts_find.yml +91 -0
- data/test/fixtures/vcr_cassettes/ssc_contracts_find_one.yml +89 -0
- data/test/fixtures/vcr_cassettes/stream_jsonrpc.yml +8253 -0
- data/test/fixtures/vcr_cassettes/transaction_expiration_initialize_nil.yml +3176 -0
- data/test/fixtures/vcr_cassettes/transaction_jsonrpc.yml +151 -0
- data/test/fixtures/vcr_cassettes/unknown_chain_id.yml +3343 -0
- data/test/fixtures/vcr_cassettes/valid_chains.yml +3124 -0
- data/test/radiator/account_by_key_api_test.rb +46 -0
- data/test/radiator/api_test.rb +135 -0
- data/test/radiator/chain_stats_api_test.rb +49 -0
- data/test/radiator/chain_test.rb +153 -0
- data/test/radiator/condenser_api_test.rb +48 -0
- data/test/radiator/follow_api_test.rb +48 -0
- data/test/radiator/market_history_api_test.rb +100 -0
- data/test/radiator/network_broadcast_api_test.rb +48 -0
- data/test/radiator/operation_test.rb +117 -0
- data/test/radiator/ssc/blockchain_test.rb +58 -0
- data/test/radiator/ssc/contracts_test.rb +65 -0
- data/test/radiator/stream_test.rb +48 -0
- data/test/radiator/tag_api_test.rb +40 -0
- data/test/radiator/transaction_test.rb +755 -0
- data/test/test_helper.rb +66 -0
- metadata +182 -73
- data/.codeclimate.yml +0 -19
- data/.gitignore +0 -52
- data/.travis.yml +0 -23
- data/gource.sh +0 -8
- data/images/Anthony Martin.png +0 -0
- data/images/Marvin Hofmann.jpg +0 -0
- data/images/Marvin Hofmann.png +0 -0
- data/lib/steem.rb +0 -17
@@ -4,18 +4,18 @@ module Radiator
|
|
4
4
|
module OperationTypes
|
5
5
|
TYPES = {
|
6
6
|
transfer: {
|
7
|
-
amount: Type::Amount
|
7
|
+
amount: Hive::Type::Amount
|
8
8
|
},
|
9
9
|
transfer_to_vesting: {
|
10
|
-
amount: Type::Amount
|
10
|
+
amount: Hive::Type::Amount
|
11
11
|
},
|
12
12
|
withdraw_vesting: {
|
13
|
-
vesting_shares: Type::Amount
|
13
|
+
vesting_shares: Hive::Type::Amount
|
14
14
|
},
|
15
15
|
limit_order_create: {
|
16
16
|
orderid: Type::Uint32,
|
17
|
-
amount_to_sell: Type::Amount,
|
18
|
-
min_to_receive: Type::Amount,
|
17
|
+
amount_to_sell: Hive::Type::Amount,
|
18
|
+
min_to_receive: Hive::Type::Amount,
|
19
19
|
expiration: Type::PointInTime
|
20
20
|
},
|
21
21
|
limit_order_cancel: {
|
@@ -26,10 +26,10 @@ module Radiator
|
|
26
26
|
},
|
27
27
|
convert: {
|
28
28
|
requestid: Type::Uint32,
|
29
|
-
amount: Type::Amount
|
29
|
+
amount: Hive::Type::Amount
|
30
30
|
},
|
31
31
|
account_create: {
|
32
|
-
fee: Type::Amount,
|
32
|
+
fee: Hive::Type::Amount,
|
33
33
|
owner: Type::Permission,
|
34
34
|
active: Type::Permission,
|
35
35
|
posting: Type::Permission,
|
@@ -51,7 +51,7 @@ module Radiator
|
|
51
51
|
id: Type::Uint16
|
52
52
|
},
|
53
53
|
comment_options: {
|
54
|
-
max_accepted_payout: Type::Amount,
|
54
|
+
max_accepted_payout: Hive::Type::Amount,
|
55
55
|
allow_replies: Type::Future
|
56
56
|
},
|
57
57
|
set_withdraw_vesting_route: {
|
@@ -59,7 +59,7 @@ module Radiator
|
|
59
59
|
},
|
60
60
|
limit_order_create2: {
|
61
61
|
orderid: Type::Uint32,
|
62
|
-
amount_to_sell: Type::Amount,
|
62
|
+
amount_to_sell: Hive::Type::Amount,
|
63
63
|
exchange_rate: Type::Price,
|
64
64
|
expiration: Type::PointInTime
|
65
65
|
},
|
@@ -71,10 +71,12 @@ module Radiator
|
|
71
71
|
recent_owner_Permission: Type::Permission
|
72
72
|
},
|
73
73
|
escrow_transfer: {
|
74
|
-
sbd_amount: Type::Amount,
|
75
|
-
|
74
|
+
sbd_amount: Steem::Type::Amount,
|
75
|
+
hbd_amount: Hive::Type::Amount,
|
76
|
+
steem_amount: Steem::Type::Amount,
|
77
|
+
hive_amount: Hive::Type::Amount,
|
76
78
|
escrow_id: Type::Uint32,
|
77
|
-
fee: Type::Amount,
|
79
|
+
fee: Hive::Type::Amount,
|
78
80
|
ratification_deadline: Type::PointInTime,
|
79
81
|
escrow_expiration: Type::PointInTime
|
80
82
|
},
|
@@ -83,40 +85,46 @@ module Radiator
|
|
83
85
|
},
|
84
86
|
escrow_release: {
|
85
87
|
escrow_id: Type::Uint32,
|
86
|
-
sbd_amount: Type::Amount,
|
87
|
-
|
88
|
+
sbd_amount: Steem::Type::Amount,
|
89
|
+
hbd_amount: Hive::Type::Amount,
|
90
|
+
steem_amount: Steem::Type::Amount,
|
91
|
+
hive_amount: Hive::Type::Amount
|
88
92
|
},
|
89
93
|
escrow_approve: {
|
90
94
|
escrow_id: Type::Uint32
|
91
95
|
},
|
92
96
|
transfer_to_savings: {
|
93
|
-
amount: Type::Amount
|
97
|
+
amount: Hive::Type::Amount
|
94
98
|
},
|
95
99
|
transfer_from_savings: {
|
96
100
|
request_id: Type::Uint32,
|
97
|
-
amount: Type::Amount
|
101
|
+
amount: Hive::Type::Amount
|
98
102
|
},
|
99
103
|
cancel_transfer_from_savings: {
|
100
104
|
request_id: Type::Uint32
|
101
105
|
},
|
102
106
|
reset_account: {
|
103
|
-
new_owner_permission: Type::Amount
|
107
|
+
new_owner_permission: Hive::Type::Amount
|
104
108
|
},
|
105
109
|
set_reset_account: {
|
106
|
-
reward_steem: Type::Amount,
|
107
|
-
|
108
|
-
|
110
|
+
reward_steem: Steem::Type::Amount,
|
111
|
+
reward_hive: Hive::Type::Amount,
|
112
|
+
reward_sbd: Steem::Type::Amount,
|
113
|
+
reward_hbd: Hive::Type::Amount,
|
114
|
+
reward_vests: Hive::Type::Amount
|
109
115
|
},
|
110
116
|
claim_reward_balance: {
|
111
|
-
reward_steem: Type::Amount,
|
112
|
-
|
113
|
-
|
117
|
+
reward_steem: Steem::Type::Amount,
|
118
|
+
reward_hive: Hive::Type::Amount,
|
119
|
+
reward_sbd: Steem::Type::Amount,
|
120
|
+
reward_hbd: Hive::Type::Amount,
|
121
|
+
reward_vests: Hive::Type::Amount
|
114
122
|
},
|
115
123
|
delegate_vesting_shares: {
|
116
|
-
vesting_shares: Type::Amount
|
124
|
+
vesting_shares: Hive::Type::Amount
|
117
125
|
},
|
118
126
|
claim_account: {
|
119
|
-
fee: Type::Amount
|
127
|
+
fee: Hive::Type::Amount
|
120
128
|
},
|
121
129
|
witness_update: {
|
122
130
|
block_signing_key: Type::PublicKey,
|
@@ -127,13 +135,21 @@ module Radiator
|
|
127
135
|
}
|
128
136
|
}
|
129
137
|
|
130
|
-
def type(key, param, value)
|
138
|
+
def type(chain, key, param, value)
|
131
139
|
return if value.nil?
|
132
140
|
|
133
141
|
t = TYPES[key] or return value
|
134
142
|
p = t[param] or return value
|
135
143
|
|
136
|
-
p
|
144
|
+
if p == Hive::Type::Amount
|
145
|
+
case chain
|
146
|
+
when :steem then Steem::Type::Amount.new(value)
|
147
|
+
else
|
148
|
+
p.new(value)
|
149
|
+
end
|
150
|
+
else
|
151
|
+
p.new(value)
|
152
|
+
end
|
137
153
|
end
|
138
154
|
end
|
139
155
|
end
|
@@ -75,7 +75,7 @@ module Radiator
|
|
75
75
|
http.keep_alive = 30
|
76
76
|
http.idle_timeout = 10
|
77
77
|
http.max_requests = @max_requests
|
78
|
-
http.retry_change_requests = true
|
78
|
+
http.retry_change_requests = true if defined? http.retry_change_requests
|
79
79
|
http.reuse_ssl_sessions = @reuse_ssl_sessions
|
80
80
|
end
|
81
81
|
else
|
data/lib/radiator/stream.rb
CHANGED
@@ -258,7 +258,7 @@ module Radiator
|
|
258
258
|
break if stop?
|
259
259
|
|
260
260
|
catch :sequence do; begin
|
261
|
-
head_block =
|
261
|
+
head_block = database_api.get_dynamic_global_properties do |properties, error|
|
262
262
|
if !!error
|
263
263
|
standby "Node responded with: #{error.message || 'unknown error'}, retrying ...", {
|
264
264
|
error: error,
|
@@ -268,7 +268,7 @@ module Radiator
|
|
268
268
|
|
269
269
|
break if stop?
|
270
270
|
|
271
|
-
if properties.head_block_number.nil?
|
271
|
+
if properties.nil? || properties.head_block_number.nil?
|
272
272
|
# This can happen if a reverse proxy is acting up.
|
273
273
|
standby "Bad block sequence after height: #{latest_block_number}", {
|
274
274
|
and: {throw: :sequence}
|
@@ -281,7 +281,7 @@ module Radiator
|
|
281
281
|
else; raise StreamError, '"mode" has to be "head" or "irreversible"'
|
282
282
|
end
|
283
283
|
end
|
284
|
-
|
284
|
+
|
285
285
|
if head_block == latest_block_number
|
286
286
|
# This can happen when there's a delay in block production.
|
287
287
|
|
@@ -390,6 +390,7 @@ module Radiator
|
|
390
390
|
|
391
391
|
@api = nil
|
392
392
|
@block_api = nil
|
393
|
+
@database_api = nil if @api.nil? || @block_api.nil?
|
393
394
|
GC.start
|
394
395
|
end
|
395
396
|
|
@@ -435,6 +436,14 @@ module Radiator
|
|
435
436
|
else; nil
|
436
437
|
end
|
437
438
|
end
|
439
|
+
|
440
|
+
def database_api
|
441
|
+
@database_api ||= case @chain
|
442
|
+
when :steem then Steem::DatabaseApi.new(url: @api.send(:uri).to_s)
|
443
|
+
when :hive then Hive::DatabaseApi.new(url: @api.send(:uri).to_s)
|
444
|
+
else; api
|
445
|
+
end
|
446
|
+
end
|
438
447
|
private
|
439
448
|
def method_missing(m, *args, &block)
|
440
449
|
super unless respond_to_missing?(m)
|
@@ -445,11 +454,11 @@ module Radiator
|
|
445
454
|
break if stop?
|
446
455
|
|
447
456
|
value = if (n = method_params(m)).nil?
|
448
|
-
key_value =
|
457
|
+
key_value = database_api.get_dynamic_global_properties.result[m]
|
449
458
|
else
|
450
459
|
key = n.keys.first
|
451
460
|
if !!n[key]
|
452
|
-
r =
|
461
|
+
r = database_api.get_dynamic_global_properties.result
|
453
462
|
key_value = param = r[n[key]]
|
454
463
|
result = nil
|
455
464
|
loop do
|
@@ -466,7 +475,7 @@ module Radiator
|
|
466
475
|
reset_timeout
|
467
476
|
result
|
468
477
|
else
|
469
|
-
key_value =
|
478
|
+
key_value = database_api.get_dynamic_global_properties.result[key]
|
470
479
|
end
|
471
480
|
end
|
472
481
|
unless @latest_values.include? key_value
|
data/lib/radiator/transaction.rb
CHANGED
@@ -81,6 +81,11 @@ module Radiator
|
|
81
81
|
|
82
82
|
case chain.to_s.downcase.to_sym
|
83
83
|
when :steem then NETWORKS_STEEM_CHAIN_ID
|
84
|
+
when :hive
|
85
|
+
database_api = Hive::DatabaseApi.new(url: @url)
|
86
|
+
database_api.get_config do |config|
|
87
|
+
config['HIVE_CHAIN_ID']
|
88
|
+
end rescue nil || NETWORKS_HIVE_CHAIN_ID
|
84
89
|
when :test then NETWORKS_TEST_CHAIN_ID
|
85
90
|
end
|
86
91
|
end
|
@@ -88,6 +93,7 @@ module Radiator
|
|
88
93
|
def url
|
89
94
|
case chain.to_s.downcase.to_sym
|
90
95
|
when :steem then NETWORKS_STEEM_DEFAULT_NODE
|
96
|
+
when :hive then NETWORKS_HIVE_DEFAULT_NODE
|
91
97
|
when :test then NETWORKS_TEST_DEFAULT_NODE
|
92
98
|
end
|
93
99
|
end
|
@@ -114,6 +120,26 @@ module Radiator
|
|
114
120
|
else
|
115
121
|
self
|
116
122
|
end
|
123
|
+
rescue OperationError => e
|
124
|
+
trx_builder, network_api = case @chain.to_sym
|
125
|
+
when :steem then [
|
126
|
+
Steem::TransactionBuilder.new(wif: @wif),
|
127
|
+
Steem::NetworkBroadcastApi.new(url: @url)
|
128
|
+
]
|
129
|
+
when :hive then [
|
130
|
+
Hive::TransactionBuilder.new(wif: @wif),
|
131
|
+
Hive::NetworkBroadcastApi.new(url: @url)
|
132
|
+
]
|
133
|
+
end
|
134
|
+
|
135
|
+
raise e if trx_builder.nil?
|
136
|
+
|
137
|
+
@operations.each do |op|
|
138
|
+
type = op.delete(:type)
|
139
|
+
trx_builder.put({type => op})
|
140
|
+
end
|
141
|
+
|
142
|
+
network_api.broadcast_transaction_synchronous(trx_builder.transaction)
|
117
143
|
ensure
|
118
144
|
shutdown
|
119
145
|
end
|
@@ -122,7 +148,7 @@ module Radiator
|
|
122
148
|
@operations = @operations.map do |op|
|
123
149
|
case op
|
124
150
|
when Operation then op
|
125
|
-
else; Operation.new(op)
|
151
|
+
else; Operation.new(op.merge(chain: @chain))
|
126
152
|
end
|
127
153
|
end
|
128
154
|
end
|
@@ -251,6 +277,7 @@ module Radiator
|
|
251
277
|
bytes << op.to_bytes
|
252
278
|
end
|
253
279
|
|
280
|
+
# FIXME Should pakC(0) instead?
|
254
281
|
bytes << 0x00 # extensions
|
255
282
|
|
256
283
|
bytes
|
data/lib/radiator/type/amount.rb
CHANGED
@@ -1,58 +1,33 @@
|
|
1
|
+
# @deprecated Using Radiator::Type::Amount class provided is deprecated. Please use: Hive::Type::Amount
|
1
2
|
module Radiator
|
2
3
|
module Type
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
case value
|
12
|
-
when ::Array
|
13
|
-
a, @precision, @nai = value
|
14
|
-
@asset = case @nai
|
15
|
-
when '@@000000013' then 'SBD'
|
16
|
-
when '@@000000021' then 'STEEM'
|
17
|
-
when '@@000000037' then 'VESTS'
|
18
|
-
else; raise TypeError, "Asset #{@asset} unknown."
|
19
|
-
end
|
20
|
-
@amount = "%.#{@precision}f" % (a.to_f / 10 ** @precision)
|
21
|
-
else
|
22
|
-
@amount, @asset = value.strip.split(' ')
|
23
|
-
@precision = case @asset
|
24
|
-
when 'STEEM' then 3
|
25
|
-
when 'VESTS' then 6
|
26
|
-
when 'SBD' then 3
|
27
|
-
when 'CORE' then 3
|
28
|
-
when 'CESTS' then 6
|
29
|
-
when 'TEST' then 3
|
30
|
-
else; raise TypeError, "Asset #{@asset} unknown."
|
31
|
-
end
|
4
|
+
class Amount < Hive::Type::Amount
|
5
|
+
def initialize(options = {})
|
6
|
+
unless defined? @@deprecated_warning_shown
|
7
|
+
warn "[DEPRECATED] Using Radiator::Type::Amount class provided is deprecated. Please use: Hive::Type::Amount"
|
8
|
+
@@deprecated_warning_shown = true
|
9
|
+
|
10
|
+
super(options.merge(chain: :steem))
|
32
11
|
end
|
33
12
|
end
|
34
|
-
|
35
|
-
def to_bytes
|
36
|
-
asset = @asset.ljust(7, "\x00")
|
37
|
-
amount = (@amount.to_f * 10 ** @precision).round
|
38
|
-
|
39
|
-
[amount].pack('q') +
|
40
|
-
[@precision].pack('c') +
|
41
|
-
asset
|
42
|
-
end
|
43
|
-
|
44
|
-
def to_a
|
45
|
-
case @asset
|
46
|
-
when 'STEEM' then [(@amount.to_f * 1000).to_i.to_s, 3, '@@000000021']
|
47
|
-
when 'VESTS' then [(@amount.to_f * 1000000).to_i.to_s, 6, '@@000000037']
|
48
|
-
when 'SBD' then [(@amount.to_f * 1000).to_i.to_s, 3, '@@000000013']
|
49
|
-
else; raise TypeError, "Asset #{@asset} unknown."
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
def to_s
|
54
|
-
"#{@amount} #{@asset}"
|
55
|
-
end
|
56
13
|
end
|
57
14
|
end
|
58
15
|
end
|
16
|
+
|
17
|
+
# Patch for legacy serializer.
|
18
|
+
class Hive::Type::Amount
|
19
|
+
def to_bytes
|
20
|
+
asset = case @asset
|
21
|
+
when 'HBD' then 'SBD'
|
22
|
+
when 'HIVE' then 'STEEM'
|
23
|
+
else; @asset
|
24
|
+
end
|
25
|
+
|
26
|
+
asset = asset.ljust(7, "\x00")
|
27
|
+
amount = (@amount.to_f * 10 ** @precision).round
|
28
|
+
|
29
|
+
[amount].pack('q') +
|
30
|
+
[@precision].pack('c') +
|
31
|
+
asset
|
32
|
+
end
|
33
|
+
end
|
data/lib/radiator/type/price.rb
CHANGED
@@ -5,8 +5,8 @@ module Radiator
|
|
5
5
|
def initialize(value)
|
6
6
|
super(:price, value)
|
7
7
|
|
8
|
-
@base = Amount.new(@value[:base])
|
9
|
-
@quote = Amount.new(@value[:quote])
|
8
|
+
@base = Hive::Type::Amount.new(@value[:base])
|
9
|
+
@quote = Hive::Type::Amount.new(@value[:quote])
|
10
10
|
end
|
11
11
|
|
12
12
|
def to_bytes
|
data/lib/radiator/version.rb
CHANGED
data/radiator.gemspec
CHANGED
@@ -9,34 +9,36 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ['Anthony Martin']
|
10
10
|
spec.email = ['radiator@martin-studio.com']
|
11
11
|
|
12
|
-
spec.summary = %q{
|
13
|
-
spec.description = %q{Client for accessing the
|
12
|
+
spec.summary = %q{Hive/Steem RPC Ruby Client}
|
13
|
+
spec.description = %q{Client for accessing the Hive/Steem blockchain.}
|
14
14
|
spec.homepage = 'https://github.com/inertia186/radiator'
|
15
15
|
spec.license = 'CC0-1.0'
|
16
16
|
|
17
|
-
spec.files =
|
17
|
+
spec.files = Dir['lib/**/*', 'test/**/*', 'Gemfile', 'LICENSE', 'Rakefile', 'README.md', 'radiator.gemspec']
|
18
18
|
spec.require_paths = ['lib']
|
19
19
|
|
20
20
|
spec.add_development_dependency 'bundler', '~> 2.0', '>= 2.0.1'
|
21
|
-
spec.add_development_dependency 'rake', '~>
|
21
|
+
spec.add_development_dependency 'rake', '~> 13.0', '>= 13.0.1'
|
22
22
|
spec.add_development_dependency 'minitest', '~> 5.10', '>= 5.10.3'
|
23
23
|
spec.add_development_dependency 'minitest-line', '~> 0.6.3'
|
24
24
|
spec.add_development_dependency 'minitest-proveit', '~> 1.0', '>= 1.0.0'
|
25
25
|
spec.add_development_dependency 'webmock', '~> 3.6', '>= 3.6.0'
|
26
|
-
spec.add_development_dependency 'simplecov', '~> 0.
|
27
|
-
spec.add_development_dependency 'vcr', '~>
|
26
|
+
spec.add_development_dependency 'simplecov', '~> 0.19.0'
|
27
|
+
spec.add_development_dependency 'vcr', '~> 6.0', '>= 6.0.0'
|
28
28
|
spec.add_development_dependency 'yard', '~> 0.9.20'
|
29
29
|
spec.add_development_dependency 'pry', '~> 0.11', '>= 0.11.3'
|
30
30
|
spec.add_development_dependency 'rb-readline', '~> 0.5', '>= 0.5.5'
|
31
|
-
spec.add_development_dependency 'irb', '~> 1.
|
31
|
+
spec.add_development_dependency 'irb', '~> 1.2', '>= 1.2.1'
|
32
32
|
|
33
33
|
# net-http-persistent has an open-ended dependency because radiator directly
|
34
|
-
# supports net-http-persistent-
|
34
|
+
# supports net-http-persistent-4.0.0 as well as net-http-persistent-2.5.2.
|
35
35
|
spec.add_dependency('net-http-persistent', '>= 2.5.2')
|
36
|
+
spec.add_dependency('steem-ruby', '~> 0.9', '>= 0.9.4')
|
37
|
+
spec.add_dependency('hive-ruby', '~> 1.0', '>= 1.0.1')
|
36
38
|
spec.add_dependency('json', '~> 2.0', '>= 2.0.2')
|
37
39
|
spec.add_dependency('logging', '~> 2.2', '>= 2.2.0')
|
38
|
-
spec.add_dependency('hashie', '~> 3.5', '>= 3.5.
|
39
|
-
spec.add_dependency('bitcoin-ruby', '
|
40
|
-
spec.add_dependency('ffi', '~> 1.9', '>= 1.9.18')
|
40
|
+
spec.add_dependency('hashie', '~> 3.5', '>= 3.5.7') # locked by steem-ruby
|
41
|
+
spec.add_dependency('bitcoin-ruby', '0.0.20') # (was 0.0.19)
|
42
|
+
spec.add_dependency('ffi', '~> 1.9', '>= 1.9.18') # (was 1.11.2)
|
41
43
|
spec.add_dependency('awesome_print', '~> 1.7', '>= 1.7.0')
|
42
44
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
{"id":1,"result":[]}
|