radiator 0.4.1 → 0.4.2pre1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/Gemfile.lock +1 -1
- data/README.md +2 -1
- data/lib/radiator/api.rb +22 -3
- data/lib/radiator/chain.rb +6 -6
- data/lib/radiator/mixins/acts_as_poster.rb +4 -4
- data/lib/radiator/mixins/acts_as_voter.rb +4 -4
- data/lib/radiator/mixins/acts_as_wallet.rb +4 -4
- data/lib/radiator/operation.rb +16 -1
- data/lib/radiator/stream.rb +7 -1
- data/lib/radiator/transaction.rb +21 -3
- data/lib/radiator/version.rb +1 -1
- data/lib/steem.rb +6 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9205ff2b00976d4717752ad47112efd596b15ccc
|
4
|
+
data.tar.gz: cfce2cbd7f2cc5140d5c03fd7d01df79ffee29aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3965f9a9479b748ba9bbf74e88e4318503709b88426f11c95d24175bc1948f592e95a413f6f694245628e8d89902b748e3544d09bccd71bf18b16221289d764
|
7
|
+
data.tar.gz: d94606774f9783caad74c04307f7a1428b05fd6e3b1e8ce9c632da2fd231efcd468651b28a8339c32847c5b34e1e6ccfc517a2fcd13bcdef22f1a2fe78a73e29
|
data/.travis.yml
CHANGED
@@ -18,6 +18,6 @@ before_script:
|
|
18
18
|
script:
|
19
19
|
- TESTOPTS="--verbose" bundle exec rake test
|
20
20
|
after_script:
|
21
|
-
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
21
|
+
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT --coverage-input-type simplecov
|
22
22
|
notifications:
|
23
23
|
slack: galacticaactual:rhAXgZ68aoikbxBBA05xIUVC
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -541,13 +541,14 @@ https://github.com/inertia186/radiator/issues/12
|
|
541
541
|
* `HELL_ENABLED=true rake`
|
542
542
|
* To run a stream test on the live STEEM blockchain with debug logging enabled:
|
543
543
|
* `LOG=DEBUG rake test_live_stream`
|
544
|
+
|
544
545
|
---
|
545
546
|
|
546
547
|
<center>
|
547
548
|
<img src="http://www.steemimg.com/images/2016/08/19/RadiatorCoolingFan-54in-Webfdcb1.png" />
|
548
549
|
</center>
|
549
550
|
|
550
|
-
See my previous Ruby How To posts in: [/
|
551
|
+
See my previous Ruby How To posts in: [#radiator](https://steemit.com/created/radiator) [#ruby](https://steemit.com/created/ruby)
|
551
552
|
|
552
553
|
## Get in touch!
|
553
554
|
|
data/lib/radiator/api.rb
CHANGED
@@ -9,7 +9,7 @@ require 'net/http/persistent'
|
|
9
9
|
module Radiator
|
10
10
|
# Radiator::Api allows you to call remote methods to interact with the STEEM
|
11
11
|
# blockchain. The `Api` class is a shortened name for
|
12
|
-
# `Radiator::
|
12
|
+
# `Radiator::CondenserApi`.
|
13
13
|
#
|
14
14
|
# Examples:
|
15
15
|
#
|
@@ -248,6 +248,12 @@ module Radiator
|
|
248
248
|
true
|
249
249
|
end
|
250
250
|
|
251
|
+
@use_condenser_namespace = if options.keys.include? :use_condenser_namespace
|
252
|
+
options[:use_condenser_namespace]
|
253
|
+
else
|
254
|
+
true
|
255
|
+
end
|
256
|
+
|
251
257
|
if defined? Net::HTTP::Persistent::DEFAULT_POOL_SIZE
|
252
258
|
@pool_size = options[:pool_size] || Net::HTTP::Persistent::DEFAULT_POOL_SIZE
|
253
259
|
end
|
@@ -288,11 +294,19 @@ module Radiator
|
|
288
294
|
|
289
295
|
if !!block
|
290
296
|
block_number.each do |i|
|
291
|
-
|
297
|
+
if use_condenser_namespace?
|
298
|
+
yield api.get_block(i)
|
299
|
+
else
|
300
|
+
yield block_api.get_block(block_num: i).result, i
|
301
|
+
end
|
292
302
|
end
|
293
303
|
else
|
294
304
|
block_number.map do |i|
|
295
|
-
|
305
|
+
if use_condenser_namespace?
|
306
|
+
api.get_block(i)
|
307
|
+
else
|
308
|
+
block_api.get_block(block_num: i).result
|
309
|
+
end
|
296
310
|
end
|
297
311
|
end
|
298
312
|
end
|
@@ -519,6 +533,7 @@ module Radiator
|
|
519
533
|
properties = %w(
|
520
534
|
chain url backoff_at max_requests ssl_verify_mode ssl_version persist
|
521
535
|
recover_transactions_on_error reuse_ssl_sessions pool_size
|
536
|
+
use_condenser_namespace
|
522
537
|
).map do |prop|
|
523
538
|
if !!(v = instance_variable_get("@#{prop}"))
|
524
539
|
"@#{prop}=#{v}"
|
@@ -543,6 +558,10 @@ module Radiator
|
|
543
558
|
|
544
559
|
@uri.nil? && @http_id.nil? && !http_active && @api.nil? && @block_api.nil?
|
545
560
|
end
|
561
|
+
|
562
|
+
def use_condenser_namespace?
|
563
|
+
@use_condenser_namespace
|
564
|
+
end
|
546
565
|
private
|
547
566
|
def self.methods_json_path
|
548
567
|
@methods_json_path ||= "#{File.dirname(__FILE__)}/methods.json"
|
data/lib/radiator/chain.rb
CHANGED
@@ -3,17 +3,17 @@ module Radiator
|
|
3
3
|
#
|
4
4
|
# To vote on a post/comment:
|
5
5
|
#
|
6
|
-
# steem =
|
6
|
+
# steem = Radiator::Chain.new(chain: :steem, account_name: 'your account name', wif: 'your wif')
|
7
7
|
# steem.vote!(10000, 'author', 'post-or-comment-permlink')
|
8
8
|
#
|
9
9
|
# To post and vote in the same transaction:
|
10
10
|
#
|
11
|
-
# steem =
|
11
|
+
# steem = Radiator::Chain.new(chain: :steem, account_name: 'your account name', wif: 'your wif')
|
12
12
|
# steem.post!(title: 'title of my post', body: 'body of my post', tags: ['tag'], self_upvote: 10000)
|
13
13
|
#
|
14
14
|
# To post and vote with declined payout:
|
15
15
|
#
|
16
|
-
# steem =
|
16
|
+
# steem = Radiator::Chain.new(chain: :steem, account_name: 'your account name', wif: 'your wif')
|
17
17
|
#
|
18
18
|
# options = {
|
19
19
|
# title: 'title of my post',
|
@@ -68,7 +68,7 @@ module Radiator
|
|
68
68
|
#
|
69
69
|
# Example:
|
70
70
|
#
|
71
|
-
# steem =
|
71
|
+
# steem = Radiator::Chain.new(chain: :steem)
|
72
72
|
# block = steem.find_block(12345678)
|
73
73
|
# transactions = block.transactions
|
74
74
|
#
|
@@ -82,7 +82,7 @@ module Radiator
|
|
82
82
|
#
|
83
83
|
# Example:
|
84
84
|
#
|
85
|
-
# steem =
|
85
|
+
# steem = Radiator::Chain.new(chain: :steem)
|
86
86
|
# ned = steem.find_account('ned')
|
87
87
|
# vesting_shares = ned.vesting_shares
|
88
88
|
#
|
@@ -100,7 +100,7 @@ module Radiator
|
|
100
100
|
#
|
101
101
|
# Example:
|
102
102
|
#
|
103
|
-
# steem =
|
103
|
+
# steem = Radiator::Chain.new(chain: :steem)
|
104
104
|
# comment = steem.find_comment('inertia', 'kinda-spooky') # by account, permlink
|
105
105
|
# active_votes = comment.active_votes
|
106
106
|
#
|
@@ -3,7 +3,7 @@ module Radiator
|
|
3
3
|
module ActsAsPoster
|
4
4
|
# Creates a post operation.
|
5
5
|
#
|
6
|
-
# steem =
|
6
|
+
# steem = Radiator::Chain.new(chain: :steem, account_name: 'your account name', wif: 'your wif')
|
7
7
|
# options = {
|
8
8
|
# title: 'This is my fancy post title.',
|
9
9
|
# body: 'This is my fancy post body.',
|
@@ -80,7 +80,7 @@ module Radiator
|
|
80
80
|
|
81
81
|
# Create a vote operation and broadcasts it right away.
|
82
82
|
#
|
83
|
-
# steem =
|
83
|
+
# steem = Radiator::Chain.new(chain: :steem, account_name: 'your account name', wif: 'your wif')
|
84
84
|
# options = {
|
85
85
|
# title: 'This is my fancy post title.',
|
86
86
|
# body: 'This is my fancy post body.',
|
@@ -95,7 +95,7 @@ module Radiator
|
|
95
95
|
#
|
96
96
|
# Examples:
|
97
97
|
#
|
98
|
-
# steem =
|
98
|
+
# steem = Radiator::Chain.new(chain: :steem, account_name: 'your account name', wif: 'your wif')
|
99
99
|
# steem.delete_comment('permlink')
|
100
100
|
# steem.broadcast!
|
101
101
|
#
|
@@ -114,7 +114,7 @@ module Radiator
|
|
114
114
|
#
|
115
115
|
# Examples:
|
116
116
|
#
|
117
|
-
# steem =
|
117
|
+
# steem = Radiator::Chain.new(chain: :steem, account_name: 'your account name', wif: 'your wif')
|
118
118
|
# steem.delete_comment!('permlink')
|
119
119
|
#
|
120
120
|
# @see delete_comment
|
@@ -5,13 +5,13 @@ module Radiator
|
|
5
5
|
#
|
6
6
|
# Examples:
|
7
7
|
#
|
8
|
-
# steem =
|
8
|
+
# steem = Radiator::Chain.new(chain: :steem, account_name: 'your account name', wif: 'your wif')
|
9
9
|
# steem.vote(10000, 'author', 'permlink')
|
10
10
|
# steem.broadcast!
|
11
11
|
#
|
12
12
|
# ... or ...
|
13
13
|
#
|
14
|
-
# steem =
|
14
|
+
# steem = Radiator::Chain.new(chain: :steem, account_name: 'your account name', wif: 'your wif')
|
15
15
|
# steem.vote(10000, '@author/permlink')
|
16
16
|
# steem.broadcast!
|
17
17
|
#
|
@@ -35,12 +35,12 @@ module Radiator
|
|
35
35
|
#
|
36
36
|
# Examples:
|
37
37
|
#
|
38
|
-
# steem =
|
38
|
+
# steem = Radiator::Chain.new(chain: :steem, account_name: 'your account name', wif: 'your wif')
|
39
39
|
# steem.vote!(10000, 'author', 'permlink')
|
40
40
|
#
|
41
41
|
# ... or ...
|
42
42
|
#
|
43
|
-
# steem =
|
43
|
+
# steem = Radiator::Chain.new(chain: :steem, account_name: 'your account name', wif: 'your wif')
|
44
44
|
# steem.vote!(10000, '@author/permlink')
|
45
45
|
#
|
46
46
|
# @see vote
|
@@ -5,7 +5,7 @@ module Radiator
|
|
5
5
|
#
|
6
6
|
# Examples:
|
7
7
|
#
|
8
|
-
# steem =
|
8
|
+
# steem = Radiator::Chain.new(chain: :steem, account_name: 'your account name', wif: 'your wif')
|
9
9
|
# steem.claim_reward_balance(reward_sbd: '100.000 SBD')
|
10
10
|
# steem.broadcast!
|
11
11
|
#
|
@@ -33,7 +33,7 @@ module Radiator
|
|
33
33
|
#
|
34
34
|
# Examples:
|
35
35
|
#
|
36
|
-
# steem =
|
36
|
+
# steem = Radiator::Chain.new(chain: :steem, account_name: 'your account name', wif: 'your wif')
|
37
37
|
# steem.claim_reward_balance!(reward_sbd: '100.000 SBD')
|
38
38
|
#
|
39
39
|
# @see claim_reward_balance
|
@@ -41,7 +41,7 @@ module Radiator
|
|
41
41
|
|
42
42
|
# Create a transfer operation.
|
43
43
|
#
|
44
|
-
# steem =
|
44
|
+
# steem = Radiator::Chain.new(chain: :steem, account_name: 'your account name', wif: 'your active wif')
|
45
45
|
# steem.transfer(amount: '1.000 SBD', to: 'account name', memo: 'this is a memo')
|
46
46
|
# steem.broadcast!
|
47
47
|
#
|
@@ -57,7 +57,7 @@ module Radiator
|
|
57
57
|
|
58
58
|
# Create a transfer operation and broadcasts it right away.
|
59
59
|
#
|
60
|
-
# steem =
|
60
|
+
# steem = Radiator::Chain.new(chain: :steem, account_name: 'your account name', wif: 'your wif')
|
61
61
|
# steem.transfer!(amount: '1.000 SBD', to: 'account name', memo: 'this is a memo')
|
62
62
|
#
|
63
63
|
# @see transfer
|
data/lib/radiator/operation.rb
CHANGED
@@ -12,6 +12,12 @@ module Radiator
|
|
12
12
|
instance_variable_set("@#{k}", type(@type, k, v))
|
13
13
|
end
|
14
14
|
|
15
|
+
@use_condenser_namespace = if options.keys.include? :use_condenser_namespace
|
16
|
+
options.delete(:use_condenser_namespace)
|
17
|
+
else
|
18
|
+
true
|
19
|
+
end
|
20
|
+
|
15
21
|
unless Operation::known_operation_names.include? @type
|
16
22
|
raise OperationError, "Unsupported operation type: #{@type}"
|
17
23
|
end
|
@@ -55,7 +61,12 @@ module Radiator
|
|
55
61
|
|
56
62
|
params[p] = case v
|
57
63
|
when Radiator::Type::Beneficiaries then [[0, v.to_h]]
|
58
|
-
when Radiator::Type::Amount
|
64
|
+
when Radiator::Type::Amount
|
65
|
+
if use_condenser_namespace?
|
66
|
+
v.to_s
|
67
|
+
else
|
68
|
+
v.to_a
|
69
|
+
end
|
59
70
|
else; v
|
60
71
|
end
|
61
72
|
end
|
@@ -82,5 +93,9 @@ module Radiator
|
|
82
93
|
end
|
83
94
|
end
|
84
95
|
end
|
96
|
+
|
97
|
+
def use_condenser_namespace?
|
98
|
+
@use_condenser_namespace
|
99
|
+
end
|
85
100
|
end
|
86
101
|
end
|
data/lib/radiator/stream.rb
CHANGED
@@ -326,7 +326,13 @@ module Radiator
|
|
326
326
|
end
|
327
327
|
end
|
328
328
|
|
329
|
-
|
329
|
+
scoped_api, block_options = if use_condenser_namespace?
|
330
|
+
[api, n]
|
331
|
+
else
|
332
|
+
[block_api, {block_num: n}]
|
333
|
+
end
|
334
|
+
|
335
|
+
scoped_api.get_block(n) do |current_block, error|
|
330
336
|
if !!error
|
331
337
|
if error.message == 'Unable to acquire database lock'
|
332
338
|
start = n
|
data/lib/radiator/transaction.rb
CHANGED
@@ -11,7 +11,7 @@ module Radiator
|
|
11
11
|
|
12
12
|
VALID_OPTIONS = %w(
|
13
13
|
wif private_key ref_block_num ref_block_prefix expiration
|
14
|
-
chain
|
14
|
+
chain use_condenser_namespace
|
15
15
|
).map(&:to_sym)
|
16
16
|
VALID_OPTIONS.each { |option| attr_accessor option }
|
17
17
|
|
@@ -66,7 +66,13 @@ module Radiator
|
|
66
66
|
|
67
67
|
@api = Api.new(options)
|
68
68
|
@network_broadcast_api = NetworkBroadcastApi.new(options)
|
69
|
-
|
69
|
+
|
70
|
+
@use_condenser_namespace = if options.keys.include? :use_condenser_namespace
|
71
|
+
options[:use_condenser_namespace]
|
72
|
+
else
|
73
|
+
true
|
74
|
+
end
|
75
|
+
|
70
76
|
ObjectSpace.define_finalizer(self, self.class.finalize(@api, @network_broadcast_api, @self_logger, @logger))
|
71
77
|
end
|
72
78
|
|
@@ -91,7 +97,7 @@ module Radiator
|
|
91
97
|
|
92
98
|
if broadcast
|
93
99
|
loop do
|
94
|
-
response =
|
100
|
+
response = broadcast_payload(payload)
|
95
101
|
|
96
102
|
if !!response.error
|
97
103
|
parser = ErrorParser.new(response)
|
@@ -137,7 +143,19 @@ module Radiator
|
|
137
143
|
end
|
138
144
|
end
|
139
145
|
end
|
146
|
+
|
147
|
+
def use_condenser_namespace?
|
148
|
+
!!@use_condenser_namespace
|
149
|
+
end
|
140
150
|
private
|
151
|
+
def broadcast_payload(payload)
|
152
|
+
if use_condenser_namespace?
|
153
|
+
@api.broadcast_transaction_synchronous(payload)
|
154
|
+
else
|
155
|
+
@network_broadcast_api.broadcast_transaction_synchronous(trx: payload)
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
141
159
|
def payload
|
142
160
|
@payload ||= {
|
143
161
|
expiration: @expiration.strftime('%Y-%m-%dT%H:%M:%S'),
|
data/lib/radiator/version.rb
CHANGED
data/lib/steem.rb
CHANGED
@@ -1,8 +1,14 @@
|
|
1
1
|
# Steem chain client for broadcasting common operations.
|
2
2
|
#
|
3
3
|
# @see Radiator::Chain
|
4
|
+
# @deprecated Using Steem class provided by Radiator is deprecated. Please use: Radiator::Chain.new(chain: :steem)
|
4
5
|
class Steem < Radiator::Chain
|
5
6
|
def initialize(options = {})
|
7
|
+
unless defined? @@deprecated_warning_shown
|
8
|
+
warn "[DEPRECATED] Using Steem class provided by Radiator is deprecated. Please use: Radiator::Chain.new(chain: :steem)"
|
9
|
+
@@deprecated_warning_shown = true
|
10
|
+
end
|
11
|
+
|
6
12
|
super(options.merge(chain: :steem))
|
7
13
|
end
|
8
14
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: radiator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2pre1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anthony Martin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-05-
|
11
|
+
date: 2018-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -401,9 +401,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
401
401
|
version: '0'
|
402
402
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
403
403
|
requirements:
|
404
|
-
- - "
|
404
|
+
- - ">"
|
405
405
|
- !ruby/object:Gem::Version
|
406
|
-
version:
|
406
|
+
version: 1.3.1
|
407
407
|
requirements: []
|
408
408
|
rubyforge_project:
|
409
409
|
rubygems_version: 2.6.14
|