radiator 0.4.2 → 0.4.3rc1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 285ec34c9c380e2a03bab4b824732a8e33b73fe1
4
- data.tar.gz: 1e4abfc40ad1daa039196506070281a8c3cbeeb0
2
+ SHA256:
3
+ metadata.gz: a9d28192bf25f525f3d74816bac83122940de506583d246bd45f0f28e4c9f079
4
+ data.tar.gz: '04080dc2ea84133f3270d8334e88003cd90f3e8c864957830c56069d7403c32b'
5
5
  SHA512:
6
- metadata.gz: cfe36e8b0c211e10917d6aacd6728008f6e71d0d00f9ad8b12234316b71e20a1192957bf21ab1e2c6327ec8ad676314e2617f52545c83853556e1575472b166a
7
- data.tar.gz: 459aaa2810541bed6a7dccb0374c61c96c6e686137613ea8b389ad2ba8146bb7ca0ed1a71deb9c56c0e936db80cd314369b9cd2ef372c3da7db44d6470171fbe
6
+ metadata.gz: b77ca0678dca622514343a073fda466de1364dc34bbe332df364033ed3473e6f67ce70310b6f56fdf4bf24a5d28952aad62b859964d1dd349ac4cf01a06e73a1
7
+ data.tar.gz: a3c303475f044552442d90d756e8941e0aa71855972892a137903d34a0a7fcfff0e98c7143f53ac97e51c6ded8defcf79aa60e13202cf047d7cdef9f9712b7b9
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- radiator (0.4.2)
4
+ radiator (0.4.3rc1)
5
5
  awesome_print (~> 1.7, >= 1.7.0)
6
6
  bitcoin-ruby (~> 0.0, >= 0.0.11)
7
7
  ffi (~> 1.9, >= 1.9.18)
@@ -22,15 +22,15 @@ GEM
22
22
  crack (0.4.3)
23
23
  safe_yaml (~> 1.0.0)
24
24
  docile (1.1.5)
25
- ffi (1.9.23)
25
+ ffi (1.9.25)
26
26
  hashdiff (0.3.7)
27
- hashie (3.5.7)
27
+ hashie (3.6.0)
28
28
  json (2.1.0)
29
29
  little-plugger (1.1.4)
30
30
  logging (2.2.2)
31
31
  little-plugger (~> 1.1)
32
32
  multi_json (~> 1.10)
33
- method_source (0.9.0)
33
+ method_source (0.9.1)
34
34
  minitest (5.11.3)
35
35
  minitest-line (0.6.5)
36
36
  minitest (~> 5.0)
@@ -42,7 +42,7 @@ GEM
42
42
  pry (0.11.3)
43
43
  coderay (~> 1.1.0)
44
44
  method_source (~> 0.9.0)
45
- public_suffix (3.0.2)
45
+ public_suffix (3.0.3)
46
46
  rake (12.3.1)
47
47
  safe_yaml (1.0.4)
48
48
  simplecov (0.15.1)
@@ -51,11 +51,11 @@ GEM
51
51
  simplecov-html (~> 0.10.0)
52
52
  simplecov-html (0.10.2)
53
53
  vcr (3.0.3)
54
- webmock (3.4.1)
54
+ webmock (3.4.2)
55
55
  addressable (>= 2.3.6)
56
56
  crack (>= 0.3.2)
57
57
  hashdiff
58
- yard (0.9.12)
58
+ yard (0.9.16)
59
59
 
60
60
  PLATFORMS
61
61
  ruby
@@ -74,4 +74,4 @@ DEPENDENCIES
74
74
  yard (~> 0.9.9)
75
75
 
76
76
  BUNDLED WITH
77
- 1.16.1
77
+ 1.16.5
data/lib/radiator/api.rb CHANGED
@@ -181,9 +181,9 @@ module Radiator
181
181
  #
182
182
  # api = Radiator::Api.new(url: 'https://api.example.com')
183
183
  #
184
- # @param options [Hash] The attributes to initialize the Radiator::Api with.
184
+ # @param options [::Hash] The attributes to initialize the Radiator::Api with.
185
185
  # @option options [String] :url URL that points at a full node, like `https://api.steemit.com`. Default from DEFAULT_URL.
186
- # @option options [Array<String>] :failover_urls An array that contains one or more full nodes to fall back on. Default from DEFAULT_FAILOVER_URLS.
186
+ # @option options [::Array<String>] :failover_urls An array that contains one or more full nodes to fall back on. Default from DEFAULT_FAILOVER_URLS.
187
187
  # @option options [Logger] :logger An instance of `Logger` to send debug messages to.
188
188
  # @option options [Boolean] :recover_transactions_on_error Have Radiator try to recover transactions that are accepted but could not be confirmed due to an error like network timeout. Default: `true`
189
189
  # @option options [Integer] :max_requests Maximum number of requests on a connection before it is considered expired and automatically closed.
@@ -286,9 +286,9 @@ module Radiator
286
286
  # transactions += block.transactions
287
287
  # end
288
288
  #
289
- # @param block_number [Fixnum || Array<Fixnum>]
289
+ # @param block_number [Fixnum || ::Array<Fixnum>]
290
290
  # @param block the block to execute for each result, optional.
291
- # @return [Array]
291
+ # @return [::Array]
292
292
  def get_blocks(block_number, &block)
293
293
  block_number = [*(block_number)].flatten
294
294
 
@@ -41,7 +41,7 @@ module Radiator
41
41
  if args.size == 1
42
42
  case args[0]
43
43
  when String then split_slug(args[0])
44
- when Hash then [args[0]['author'], args[0]['permlink']]
44
+ when ::Hash then [args[0]['author'], args[0]['permlink']]
45
45
  end
46
46
  else
47
47
  args
@@ -73,7 +73,7 @@ module Radiator
73
73
  # transactions = block.transactions
74
74
  #
75
75
  # @param block_number [Fixnum]
76
- # @return [Hash]
76
+ # @return [::Hash]
77
77
  def find_block(block_number)
78
78
  api.get_blocks(block_number).first
79
79
  end
@@ -87,7 +87,7 @@ module Radiator
87
87
  # vesting_shares = ned.vesting_shares
88
88
  #
89
89
  # @param account_name [String] Name of the account to find.
90
- # @return [Hash]
90
+ # @return [::Hash]
91
91
  def find_account(account_name)
92
92
  api.get_accounts([account_name]) do |accounts, err|
93
93
  raise ChainError, ErrorParser.new(err) if !!err
@@ -108,8 +108,8 @@ module Radiator
108
108
  #
109
109
  # comment = steem.find_comment('@inertia/kinda-spooky') # by slug
110
110
  #
111
- # @param args [String || Array<String>] Slug or author, permlink of comment.
112
- # @return [Hash]
111
+ # @param args [String || ::Array<String>] Slug or author, permlink of comment.
112
+ # @return [::Hash]
113
113
  def find_comment(*args)
114
114
  author, permlink = Chain.parse_slug(args)
115
115
 
@@ -168,7 +168,7 @@ module Radiator
168
168
  # List of accounts followed by account.
169
169
  #
170
170
  # @param account_name String Name of the account.
171
- # @return [Array<String>]
171
+ # @return [::Array<String>]
172
172
  def followed_by(account_name)
173
173
  return [] if account_name.nil?
174
174
 
@@ -191,7 +191,7 @@ module Radiator
191
191
  # List of accounts following account.
192
192
  #
193
193
  # @param account_name String Name of the account.
194
- # @return [Array<String>]
194
+ # @return [::Array<String>]
195
195
  def following(account_name)
196
196
  return [] if account_name.nil?
197
197
 
@@ -200,7 +200,7 @@ module Radiator
200
200
  case match
201
201
  when String
202
202
  @error['message'] && @error['message'].include?(match)
203
- when Array
203
+ when ::Array
204
204
  if @error['message']
205
205
  match.map { |m| m.include?(match) }.include? true
206
206
  else
@@ -12,10 +12,10 @@ module Radiator
12
12
  # steem.post(options)
13
13
  # steem.broadcast!
14
14
  #
15
- # @param options [Hash] options
15
+ # @param options [::Hash] options
16
16
  # @option options [String] :title Title of the post.
17
17
  # @option options [String] :body Body of the post.
18
- # @option options [Array<String>] :tags Tags of the post.
18
+ # @option options [::Array<String>] :tags Tags of the post.
19
19
  # @option options [String] :permlink (automatic) Permlink of the post, defaults to formatted title.
20
20
  # @option options [String] :parent_permlink (automatic) Parent permlink of the post, defaults to first tag.
21
21
  # @option options [String] :parent_author (optional) Parent author of the post (only used if reply).
@@ -9,7 +9,7 @@ module Radiator
9
9
  # steem.claim_reward_balance(reward_sbd: '100.000 SBD')
10
10
  # steem.broadcast!
11
11
  #
12
- # @param options [Hash] options
12
+ # @param options [::Hash] options
13
13
  # @option options [String] :reward_steem The amount of STEEM to claim, like: `100.000 STEEM`
14
14
  # @option options [String] :reward_sbd The amount of SBD to claim, like: `100.000 SBD`
15
15
  # @option options [String] :reward_vests The amount of VESTS to claim, like: `100.000000 VESTS`
@@ -45,7 +45,7 @@ module Radiator
45
45
  # steem.transfer(amount: '1.000 SBD', to: 'account name', memo: 'this is a memo')
46
46
  # steem.broadcast!
47
47
  #
48
- # @param options [Hash] options
48
+ # @param options [::Hash] options
49
49
  # @option options [String] :amount The amount to transfer, like: `100.000 STEEM`
50
50
  # @option options [String] :to The account receiving the transfer.
51
51
  # @option options [String] :memo ('') The memo for the transfer.
@@ -38,8 +38,8 @@ module Radiator
38
38
  when Integer then paks(v)
39
39
  when TrueClass then pakC(1)
40
40
  when FalseClass then pakC(0)
41
- when Array then pakArr(v)
42
- when Hash then pakHash(v)
41
+ when ::Array then pakArr(v)
42
+ when ::Hash then pakHash(v)
43
43
  when NilClass then next
44
44
  else
45
45
  raise OperationError, "Unsupported type: #{v.class}"
@@ -1,80 +1,98 @@
1
1
  module Radiator
2
2
  module OperationIds
3
3
  # These IDS are derrived from:
4
- # https://github.com/steemit/steem/blob/b169ad4317653d46cb776bdc8ef4c25ff178743d/libraries/protocol/include/steemit/protocol/operations.hpp
4
+ # https://github.com/steemit/steem/blob/127a441fbac2f06804359968bda83b66e602c891/libraries/protocol/include/steem/protocol/operations.hpp
5
5
 
6
6
  IDS = [
7
- :vote,
8
- :comment,
9
-
10
- :transfer,
11
- :transfer_to_vesting,
12
- :withdraw_vesting,
13
-
14
- :limit_order_create,
15
- :limit_order_cancel,
16
-
17
- :feed_publish,
18
- :convert,
19
-
20
- :account_create,
21
- :account_update,
22
-
23
- :witness_update,
24
- :account_witness_vote,
25
- :account_witness_proxy,
26
-
27
- :pow,
28
-
29
- :custom,
30
-
31
- :report_over_production,
32
-
33
- :delete_comment,
34
- :custom_json,
35
- :comment_options,
36
- :set_withdraw_vesting_route,
37
- :limit_order_create2,
38
- :challenge_authority,
39
- :prove_authority,
40
- :request_account_recovery,
41
- :recover_account,
42
- :change_recovery_account,
43
- :escrow_transfer,
44
- :escrow_dispute,
45
- :escrow_release,
46
- :pow2,
47
- :escrow_approve,
48
- :transfer_to_savings,
49
- :transfer_from_savings,
50
- :cancel_transfer_from_savings,
51
- :custom_binary,
52
- :decline_voting_rights,
53
- :reset_account,
54
- :set_reset_account,
55
- :claim_reward_balance,
56
- :delegate_vesting_shares,
57
- :account_create_with_delegation,
58
-
7
+ :vote_operation,
8
+ :comment_operation,
9
+
10
+ :transfer_operation,
11
+ :transfer_to_vesting_operation,
12
+ :withdraw_vesting_operation,
13
+
14
+ :limit_order_create_operation,
15
+ :limit_order_cancel_operation,
16
+
17
+ :feed_publish_operation,
18
+ :convert_operation,
19
+
20
+ :account_create_operation,
21
+ :account_update_operation,
22
+
23
+ :witness_update_operation,
24
+ :account_witness_vote_operation,
25
+ :account_witness_proxy_operation,
26
+
27
+ :pow_operation,
28
+
29
+ :custom_operation,
30
+
31
+ :report_over_production_operation,
32
+
33
+ :delete_comment_operation,
34
+ :custom_json_operation,
35
+ :comment_options_operation,
36
+ :set_withdraw_vesting_route_operation,
37
+ :limit_order_create2_operation,
38
+ :claim_account_operation,
39
+ :create_claimed_account_operation,
40
+ :request_account_recovery_operation,
41
+ :recover_account_operation,
42
+ :change_recovery_account_operation,
43
+ :escrow_transfer_operation,
44
+ :escrow_dispute_operation,
45
+ :escrow_release_operation,
46
+ :pow2_operation,
47
+ :escrow_approve_operation,
48
+ :transfer_to_savings_operation,
49
+ :transfer_from_savings_operation,
50
+ :cancel_transfer_from_savings_operation,
51
+ :custom_binary_operation,
52
+ :decline_voting_rights_operation,
53
+ :reset_account_operation,
54
+ :set_reset_account_operation,
55
+ :claim_reward_balance_operation,
56
+ :delegate_vesting_shares_operation,
57
+ :account_create_with_delegation_operation,
58
+ :witness_set_properties_operation,
59
+
60
+ # SMT operations
61
+ :claim_reward_balance2_operation,
62
+
63
+ :smt_setup_operation,
64
+ :smt_cap_reveal_operation,
65
+ :smt_refund_operation,
66
+ :smt_setup_emissions_operation,
67
+ :smt_set_setup_parameters_operation,
68
+ :smt_set_runtime_parameters_operation,
69
+ :smt_create_operation,
70
+
59
71
  # virtual operations below this point
60
- :fill_convert_request,
61
- :author_reward,
62
- :curation_reward,
63
- :comment_reward,
64
- :liquidity_reward,
65
- :interest,
66
- :fill_vesting_withdraw,
67
- :fill_order,
68
- :shutdown_witness,
69
- :fill_transfer_from_savings,
70
- :hardfork,
71
- :comment_payout_update,
72
- :return_vesting_delegation,
73
- :comment_benefactor_reward
72
+ :fill_convert_request_operation,
73
+ :author_reward_operation,
74
+ :curation_reward_operation,
75
+ :comment_reward_operation,
76
+ :liquidity_reward_operation,
77
+ :interest_operation,
78
+ :fill_vesting_withdraw_operation,
79
+ :fill_order_operation,
80
+ :shutdown_witness_operation,
81
+ :fill_transfer_from_savings_operation,
82
+ :hardfork_operation,
83
+ :comment_payout_update_operation,
84
+ :return_vesting_delegation_operation,
85
+ :comment_benefactor_reward_operation,
86
+ :producer_reward_operation,
87
+ :clear_null_account_balance_operation
74
88
  ]
75
89
 
76
90
  def id(op)
77
- IDS.find_index op
91
+ if op.to_s =~ /_operation$/
92
+ IDS.find_index op
93
+ else
94
+ IDS.find_index "#{op}_operation".to_sym
95
+ end
78
96
  end
79
97
  end
80
98
  end
@@ -33,7 +33,13 @@ module Radiator
33
33
  owner: Type::Permission,
34
34
  active: Type::Permission,
35
35
  posting: Type::Permission,
36
- memo: Type::Permission
36
+ memo: Type::PublicKey
37
+ },
38
+ create_claimed_account: {
39
+ owner: Type::Permission,
40
+ active: Type::Permission,
41
+ posting: Type::Permission,
42
+ memo: Type::PublicKey
37
43
  },
38
44
  account_update: {
39
45
  owner: Type::Permission,
@@ -108,6 +114,16 @@ module Radiator
108
114
  },
109
115
  delegate_vesting_shares: {
110
116
  vesting_shares: Type::Amount
117
+ },
118
+ claim_account: {
119
+ fee: Type::Amount
120
+ },
121
+ witness_update: {
122
+ block_signing_key: Type::PublicKey,
123
+ props: Type::Array
124
+ },
125
+ witness_set_properties: {
126
+ props: Type::Hash
111
127
  }
112
128
  }
113
129
 
@@ -121,15 +121,15 @@ module Radiator
121
121
  # interest
122
122
  # shutdown_witness
123
123
  #
124
- # @param type [symbol || Array<symbol>] the type(s) of operation, optional.
124
+ # @param type [symbol || ::Array<symbol>] the type(s) of operation, optional.
125
125
  # @param start starting block
126
126
  # @param mode we have the choice between
127
127
  # * :head the last block
128
128
  # * :irreversible the block that is confirmed by 2/3 of all block producers and is thus irreversible!
129
129
  # @param block the block to execute for each result, optional. Yields: |op, trx_id, block_num, api|
130
- # @param options [Hash] additional options
130
+ # @param options [::Hash] additional options
131
131
  # @option options [Boollean] :include_virtual Also stream virtual options. Setting this true will impact performance. Default: false.
132
- # @return [Hash]
132
+ # @return [::Hash]
133
133
  def operations(type = nil, start = nil, mode = :irreversible, options = {include_virtual: false}, &block)
134
134
  type = [type].flatten.compact.map(&:to_sym)
135
135
  include_virtual = !!options[:include_virtual]
@@ -202,7 +202,7 @@ module Radiator
202
202
  # * :head the last block
203
203
  # * :irreversible the block that is confirmed by 2/3 of all block producers and is thus irreversible!
204
204
  # @param block the block to execute for each result, optional. Yields: |tx, trx_id, api|
205
- # @return [Hash]
205
+ # @return [::Hash]
206
206
  def transactions(start = nil, mode = :irreversible, &block)
207
207
  blocks(start, mode) do |b, block_number|
208
208
  next if (_transactions = b.transactions).nil?
@@ -245,7 +245,7 @@ module Radiator
245
245
  # * :irreversible the block that is confirmed by 2/3 of all block producers and is thus irreversible!
246
246
  # @param max_blocks_per_node the number of blocks to read before trying a new node
247
247
  # @param block the block to execute for each result, optional. Yields: |bk, num, api|
248
- # @return [Hash]
248
+ # @return [::Hash]
249
249
  def blocks(start = nil, mode = :irreversible, max_blocks_per_node = MAX_BLOCKS_PER_NODE, &block)
250
250
  reset_api
251
251
 
@@ -0,0 +1,17 @@
1
+ module Radiator
2
+ module Type
3
+ class Array < Serializer
4
+ def initialize(value)
5
+ super(:array, true)
6
+ end
7
+
8
+ def to_bytes
9
+ pakArr(@value)
10
+ end
11
+
12
+ def to_s
13
+ @value.to_json
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ module Radiator
2
+ module Type
3
+ class Hash < Serializer
4
+ def initialize(value)
5
+ super(:hash, true)
6
+ end
7
+
8
+ def to_bytes
9
+ pakHash(@value)
10
+ end
11
+
12
+ def to_s
13
+ @value.to_json
14
+ end
15
+ end
16
+ end
17
+ end
@@ -7,7 +7,7 @@ module Radiator
7
7
  super(:amount, value)
8
8
 
9
9
  case value
10
- when Array
10
+ when ::Array
11
11
  a, p, t = value
12
12
  @asset = case t
13
13
  when '@@000000013' then 'SBD'
@@ -13,7 +13,7 @@ module Radiator
13
13
  def to_h
14
14
  v = @value.map do |b|
15
15
  case b
16
- when Array then {account: b.first, weight: b.last}
16
+ when ::Array then {account: b.first, weight: b.last}
17
17
  else; {account: b.keys.first, weight: b.values.first}
18
18
  end
19
19
  end
@@ -117,8 +117,8 @@ module Radiator
117
117
  when Integer then paks(v)
118
118
  when TrueClass then pakC(1)
119
119
  when FalseClass then pakC(0)
120
- when Array then pakArr(v)
121
- when Hash then pakHash(v)
120
+ when ::Array then pakArr(v)
121
+ when ::Hash then pakHash(v)
122
122
  when NilClass then next
123
123
  else
124
124
  raise OperationError, "Unsupported type: #{v.class}"
@@ -134,8 +134,8 @@ module Radiator
134
134
  when Integer then paks(v)
135
135
  when TrueClass then pakC(1)
136
136
  when FalseClass then pakC(0)
137
- when Array then pakArr(v)
138
- when Hash then pakHash(v)
137
+ when ::Array then pakArr(v)
138
+ when ::Hash then pakHash(v)
139
139
  when NilClass then next
140
140
  else
141
141
  raise OperationError, "Unsupported type: #{v.class}"
@@ -1,4 +1,4 @@
1
1
  module Radiator
2
- VERSION = '0.4.2'
2
+ VERSION = '0.4.3rc1'
3
3
  AGENT_ID = "radiator/#{VERSION}"
4
4
  end
data/lib/radiator.rb CHANGED
@@ -13,6 +13,8 @@ module Radiator
13
13
  require 'radiator/type/public_key'
14
14
  require 'radiator/type/beneficiaries'
15
15
  require 'radiator/type/price'
16
+ require 'radiator/type/array'
17
+ require 'radiator/type/hash'
16
18
  require 'radiator/type/future'
17
19
  require 'radiator/logger'
18
20
  require 'radiator/chain_config'
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.2
4
+ version: 0.4.3rc1
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-06-01 00:00:00.000000000 Z
11
+ date: 2018-11-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -372,6 +372,8 @@ files:
372
372
  - lib/radiator/stream.rb
373
373
  - lib/radiator/tag_api.rb
374
374
  - lib/radiator/transaction.rb
375
+ - lib/radiator/type/Array.rb
376
+ - lib/radiator/type/Hash.rb
375
377
  - lib/radiator/type/amount.rb
376
378
  - lib/radiator/type/beneficiaries.rb
377
379
  - lib/radiator/type/future.rb
@@ -401,12 +403,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
401
403
  version: '0'
402
404
  required_rubygems_version: !ruby/object:Gem::Requirement
403
405
  requirements:
404
- - - ">="
406
+ - - ">"
405
407
  - !ruby/object:Gem::Version
406
- version: '0'
408
+ version: 1.3.1
407
409
  requirements: []
408
410
  rubyforge_project:
409
- rubygems_version: 2.6.14
411
+ rubygems_version: 2.7.7
410
412
  signing_key:
411
413
  specification_version: 4
412
414
  summary: STEEM RPC Ruby Client