radiator 0.4.6 → 0.4.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/radiator/api.rb +25 -7
- data/lib/radiator/transaction.rb +13 -0
- data/lib/radiator/type/amount.rb +5 -4
- data/lib/radiator/type/beneficiaries.rb +8 -1
- data/lib/radiator/version.rb +1 -1
- data/radiator.gemspec +4 -4
- metadata +15 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 5d4835194b9dd10257a05f17429b84e542631bb4ca9baa46b4f44fc82738297b
|
4
|
+
data.tar.gz: d283de528aa0aa30bda8b74b8dff932764b6aea1cd3f14199a63a9c591d0a5ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 077ec7c4bfb834f6f8009a9c96b19c6604e9a369d076765e6db10bfd6be96b052137d8284009df953786af1587aed26ba89cd76f0e8048e6a000f456c89eb232
|
7
|
+
data.tar.gz: 29e16e9272db43795c1a8000db17bfb08a2746f51aac854e0800f12b98f312fe195732304949b3300bc406b5516c029ba2cb5d69124a7aca1addb4104f84fad0
|
data/lib/radiator/api.rb
CHANGED
@@ -147,6 +147,8 @@ module Radiator
|
|
147
147
|
'httpd://rpc.usesteem.com'
|
148
148
|
]
|
149
149
|
|
150
|
+
DEFAULT_RESTFUL_URL = 'https://anyx.io/v1'
|
151
|
+
|
150
152
|
# @private
|
151
153
|
POST_HEADERS = {
|
152
154
|
'Content-Type' => 'application/json',
|
@@ -163,6 +165,13 @@ module Radiator
|
|
163
165
|
end
|
164
166
|
end
|
165
167
|
|
168
|
+
def self.default_restful_url(chain)
|
169
|
+
case chain.to_sym
|
170
|
+
when :steem then DEFAULT_RESTFUL_URL
|
171
|
+
else; raise ApiError, "Unsupported chain: #{chain}"
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
166
175
|
def self.default_failover_urls(chain)
|
167
176
|
case chain.to_sym
|
168
177
|
when :steem then DEFAULT_STEEM_FAILOVER_URLS
|
@@ -190,6 +199,7 @@ module Radiator
|
|
190
199
|
@password = options[:password]
|
191
200
|
@chain = options[:chain] || :steem
|
192
201
|
@url = options[:url] || Api::default_url(@chain)
|
202
|
+
@restful_url = options[:restful_url] || Api::default_restful_url(@chain)
|
193
203
|
@preferred_url = @url.dup
|
194
204
|
@failover_urls = options[:failover_urls]
|
195
205
|
@debug = !!options[:debug]
|
@@ -789,15 +799,23 @@ module Radiator
|
|
789
799
|
|
790
800
|
if @recover_transactions_on_error
|
791
801
|
begin
|
792
|
-
|
793
|
-
|
794
|
-
|
795
|
-
response[:result][:
|
796
|
-
|
797
|
-
|
798
|
-
|
802
|
+
if !!@restful_url
|
803
|
+
JSON[open("#{@restful_url}/account_history_api/get_transaction?id=#{parser.trx_id}").read].tap do |tx|
|
804
|
+
response[:result][:block_num] = tx['block_num']
|
805
|
+
response[:result][:trx_num] = tx['transaction_num']
|
806
|
+
end
|
807
|
+
else
|
808
|
+
# Node operators often disable this operation.
|
809
|
+
api.get_transaction(parser.trx_id) do |tx|
|
810
|
+
if !!tx
|
811
|
+
response[:result][:block_num] = tx.block_num
|
812
|
+
response[:result][:trx_num] = tx.transaction_num
|
813
|
+
end
|
799
814
|
end
|
800
815
|
end
|
816
|
+
|
817
|
+
response[:recovered_by] = http_id
|
818
|
+
response.delete('error') # no need for this, now
|
801
819
|
rescue
|
802
820
|
debug "Couldn't find block for trx_id: #{parser.trx_id}, giving up."
|
803
821
|
end
|
data/lib/radiator/transaction.rb
CHANGED
@@ -147,6 +147,19 @@ module Radiator
|
|
147
147
|
def use_condenser_namespace?
|
148
148
|
!!@use_condenser_namespace
|
149
149
|
end
|
150
|
+
|
151
|
+
def inspect
|
152
|
+
properties = %w(
|
153
|
+
url ref_block_num ref_block_prefix expiration chain
|
154
|
+
use_condenser_namespace immutable_expiration payload
|
155
|
+
).map do |prop|
|
156
|
+
if !!(v = instance_variable_get("@#{prop}"))
|
157
|
+
"@#{prop}=#{v}"
|
158
|
+
end
|
159
|
+
end.compact.join(', ')
|
160
|
+
|
161
|
+
"#<#{self.class.name} [#{properties}]>"
|
162
|
+
end
|
150
163
|
private
|
151
164
|
def broadcast_payload(payload)
|
152
165
|
if use_condenser_namespace?
|
data/lib/radiator/type/amount.rb
CHANGED
@@ -3,20 +3,21 @@ module Radiator
|
|
3
3
|
|
4
4
|
# See: https://github.com/xeroc/piston-lib/blob/34a7525cee119ec9b24a99577ede2d54466fca0e/steembase/operations.py
|
5
5
|
class Amount < Serializer
|
6
|
+
attr_reader :amount, :precision, :nai, :asset
|
7
|
+
|
6
8
|
def initialize(value)
|
7
9
|
super(:amount, value)
|
8
10
|
|
9
11
|
case value
|
10
12
|
when ::Array
|
11
|
-
a,
|
12
|
-
@asset = case
|
13
|
+
a, @precision, @nai = value
|
14
|
+
@asset = case @nai
|
13
15
|
when '@@000000013' then 'SBD'
|
14
16
|
when '@@000000021' then 'STEEM'
|
15
17
|
when '@@000000037' then 'VESTS'
|
16
18
|
else; raise TypeError, "Asset #{@asset} unknown."
|
17
19
|
end
|
18
|
-
@
|
19
|
-
@amount = "%.#{p}f" % (a.to_f / 10 ** p)
|
20
|
+
@amount = "%.#{@precision}f" % (a.to_f / 10 ** @precision)
|
20
21
|
else
|
21
22
|
@amount, @asset = value.strip.split(' ')
|
22
23
|
@precision = case @asset
|
@@ -7,7 +7,14 @@ module Radiator
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def to_bytes
|
10
|
-
|
10
|
+
#set sz 1, op type 0, see
|
11
|
+
#https://github.com/steemit/steem-js/blob/733332d09582e95c0ea868a6ac5b6ee8a1f115ee/src/auth/serializer/src/operations.js#L355
|
12
|
+
varint(1) + varint(0) + varint(@value.size) + @value.map do |b|
|
13
|
+
case b
|
14
|
+
when ::Array then pakStr(b.first.to_s) + pakS(b.last)
|
15
|
+
else; pakStr(b.keys.first.to_s) + pakS(b.values.first)
|
16
|
+
end
|
17
|
+
end.join
|
11
18
|
end
|
12
19
|
|
13
20
|
def to_h
|
data/lib/radiator/version.rb
CHANGED
data/radiator.gemspec
CHANGED
@@ -22,10 +22,10 @@ Gem::Specification.new do |spec|
|
|
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
|
-
spec.add_development_dependency 'webmock', '~> 3.
|
26
|
-
spec.add_development_dependency 'simplecov', '~> 0.
|
27
|
-
spec.add_development_dependency 'vcr', '~>
|
28
|
-
spec.add_development_dependency 'yard', '~> 0.9.
|
25
|
+
spec.add_development_dependency 'webmock', '~> 3.6', '>= 3.6.0'
|
26
|
+
spec.add_development_dependency 'simplecov', '~> 0.17.0'
|
27
|
+
spec.add_development_dependency 'vcr', '~> 5.0', '>= 5.0.0'
|
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
31
|
spec.add_development_dependency 'irb', '~> 1.0', '>= 1.0.0'
|
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.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anthony Martin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-07-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -110,68 +110,68 @@ dependencies:
|
|
110
110
|
requirements:
|
111
111
|
- - "~>"
|
112
112
|
- !ruby/object:Gem::Version
|
113
|
-
version: '3.
|
113
|
+
version: '3.6'
|
114
114
|
- - ">="
|
115
115
|
- !ruby/object:Gem::Version
|
116
|
-
version: 3.
|
116
|
+
version: 3.6.0
|
117
117
|
type: :development
|
118
118
|
prerelease: false
|
119
119
|
version_requirements: !ruby/object:Gem::Requirement
|
120
120
|
requirements:
|
121
121
|
- - "~>"
|
122
122
|
- !ruby/object:Gem::Version
|
123
|
-
version: '3.
|
123
|
+
version: '3.6'
|
124
124
|
- - ">="
|
125
125
|
- !ruby/object:Gem::Version
|
126
|
-
version: 3.
|
126
|
+
version: 3.6.0
|
127
127
|
- !ruby/object:Gem::Dependency
|
128
128
|
name: simplecov
|
129
129
|
requirement: !ruby/object:Gem::Requirement
|
130
130
|
requirements:
|
131
131
|
- - "~>"
|
132
132
|
- !ruby/object:Gem::Version
|
133
|
-
version: 0.
|
133
|
+
version: 0.17.0
|
134
134
|
type: :development
|
135
135
|
prerelease: false
|
136
136
|
version_requirements: !ruby/object:Gem::Requirement
|
137
137
|
requirements:
|
138
138
|
- - "~>"
|
139
139
|
- !ruby/object:Gem::Version
|
140
|
-
version: 0.
|
140
|
+
version: 0.17.0
|
141
141
|
- !ruby/object:Gem::Dependency
|
142
142
|
name: vcr
|
143
143
|
requirement: !ruby/object:Gem::Requirement
|
144
144
|
requirements:
|
145
145
|
- - "~>"
|
146
146
|
- !ruby/object:Gem::Version
|
147
|
-
version: '
|
147
|
+
version: '5.0'
|
148
148
|
- - ">="
|
149
149
|
- !ruby/object:Gem::Version
|
150
|
-
version:
|
150
|
+
version: 5.0.0
|
151
151
|
type: :development
|
152
152
|
prerelease: false
|
153
153
|
version_requirements: !ruby/object:Gem::Requirement
|
154
154
|
requirements:
|
155
155
|
- - "~>"
|
156
156
|
- !ruby/object:Gem::Version
|
157
|
-
version: '
|
157
|
+
version: '5.0'
|
158
158
|
- - ">="
|
159
159
|
- !ruby/object:Gem::Version
|
160
|
-
version:
|
160
|
+
version: 5.0.0
|
161
161
|
- !ruby/object:Gem::Dependency
|
162
162
|
name: yard
|
163
163
|
requirement: !ruby/object:Gem::Requirement
|
164
164
|
requirements:
|
165
165
|
- - "~>"
|
166
166
|
- !ruby/object:Gem::Version
|
167
|
-
version: 0.9.
|
167
|
+
version: 0.9.20
|
168
168
|
type: :development
|
169
169
|
prerelease: false
|
170
170
|
version_requirements: !ruby/object:Gem::Requirement
|
171
171
|
requirements:
|
172
172
|
- - "~>"
|
173
173
|
- !ruby/object:Gem::Version
|
174
|
-
version: 0.9.
|
174
|
+
version: 0.9.20
|
175
175
|
- !ruby/object:Gem::Dependency
|
176
176
|
name: pry
|
177
177
|
requirement: !ruby/object:Gem::Requirement
|
@@ -451,7 +451,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
451
451
|
version: '0'
|
452
452
|
requirements: []
|
453
453
|
rubyforge_project:
|
454
|
-
rubygems_version: 2.
|
454
|
+
rubygems_version: 2.7.7
|
455
455
|
signing_key:
|
456
456
|
specification_version: 4
|
457
457
|
summary: STEEM RPC Ruby Client
|