steem-mechanize 0.0.2 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Gemfile.lock +8 -8
- data/Rakefile +128 -36
- data/lib/steem/mechanize/version.rb +1 -1
- data/steem-mechanize.gemspec +2 -2
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a7b76c3958c5b4a56eb79b633df88665a323a82a87099962e64f9d436c25d49b
|
4
|
+
data.tar.gz: 696d82c0c2e3bc6780e1fd0d4c3b76e1b32fe2f23e74b4631a1ca3abfa4eac2a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 373c6bda0652603ae7e5bdfcfde07ca97cb1334fa7fcd919e04f7f901aba292c782bb25fbf2d75683e619c4da1af379d4a632d1ab6993a9b314703a65626525a
|
7
|
+
data.tar.gz: d40641e13c0e15eae050f1ec293536ecc4c27f450dffe6bffcdad60efa481e24b12842be19d234109c0da5d2b8ea9b9b7fdea4214ebf71648562ece4fe746684
|
data/Gemfile.lock
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
steem-mechanize (0.0.
|
4
|
+
steem-mechanize (0.0.4)
|
5
5
|
mechanize (~> 2.7, >= 2.7.5)
|
6
|
-
steem-ruby (~> 0.9, >= 0.9.
|
6
|
+
steem-ruby (~> 0.9, >= 0.9.3)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
@@ -13,7 +13,7 @@ GEM
|
|
13
13
|
domain_name (0.5.20180417)
|
14
14
|
unf (>= 0.0.5, < 1.0.0)
|
15
15
|
ffi (1.9.25)
|
16
|
-
hashie (3.
|
16
|
+
hashie (3.6.0)
|
17
17
|
http-cookie (1.0.3)
|
18
18
|
domain_name (~> 0.5)
|
19
19
|
json (2.1.0)
|
@@ -30,19 +30,19 @@ GEM
|
|
30
30
|
nokogiri (~> 1.6)
|
31
31
|
ntlm-http (~> 0.1, >= 0.1.1)
|
32
32
|
webrobots (>= 0.0.9, < 0.2)
|
33
|
-
mime-types (3.
|
33
|
+
mime-types (3.2.2)
|
34
34
|
mime-types-data (~> 3.2015)
|
35
|
-
mime-types-data (3.
|
35
|
+
mime-types-data (3.2018.0812)
|
36
36
|
mini_portile2 (2.3.0)
|
37
37
|
multi_json (1.13.1)
|
38
38
|
net-http-digest_auth (1.4.1)
|
39
39
|
net-http-persistent (3.0.0)
|
40
40
|
connection_pool (~> 2.2)
|
41
|
-
nokogiri (1.8.
|
41
|
+
nokogiri (1.8.5)
|
42
42
|
mini_portile2 (~> 2.3.0)
|
43
43
|
ntlm-http (0.1.1)
|
44
44
|
rake (12.3.1)
|
45
|
-
steem-ruby (0.9.
|
45
|
+
steem-ruby (0.9.3)
|
46
46
|
bitcoin-ruby (~> 0.0, >= 0.0.18)
|
47
47
|
ffi (~> 1.9, >= 1.9.23)
|
48
48
|
hashie (~> 3.5, >= 3.5.7)
|
@@ -62,4 +62,4 @@ DEPENDENCIES
|
|
62
62
|
steem-mechanize!
|
63
63
|
|
64
64
|
BUNDLED WITH
|
65
|
-
1.16.
|
65
|
+
1.16.5
|
data/Rakefile
CHANGED
@@ -70,49 +70,141 @@ end
|
|
70
70
|
|
71
71
|
namespace :stream do
|
72
72
|
desc 'Test the ability to stream a block range.'
|
73
|
-
task :block_range do
|
74
|
-
|
73
|
+
task :block_range, [:mode, :at_block_num] do |t, args|
|
74
|
+
mode = (args[:mode] || 'irreversible').to_sym
|
75
|
+
first_block_num = args[:at_block_num].to_i if !!args[:at_block_num]
|
76
|
+
stream = Steem::Stream.new(url: ENV['TEST_NODE'], mode: mode)
|
75
77
|
api = Steem::Api.new(url: ENV['TEST_NODE'])
|
76
78
|
last_block_num = nil
|
77
|
-
first_block_num = nil
|
78
79
|
last_timestamp = nil
|
80
|
+
range_complete = false
|
79
81
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
82
|
+
api.get_dynamic_global_properties do |properties|
|
83
|
+
current_block_num = if mode == :head
|
84
|
+
properties.head_block_number
|
85
|
+
else
|
86
|
+
properties.last_irreversible_block_num
|
87
|
+
end
|
88
|
+
|
89
|
+
# First pass replays latest a random number of blocks to test chunking.
|
90
|
+
first_block_num ||= current_block_num - (rand * 200).to_i
|
91
|
+
|
92
|
+
range = first_block_num..current_block_num
|
93
|
+
puts "Initial block range: #{range.size}"
|
94
|
+
|
95
|
+
stream.blocks(at_block_num: range.first) do |block, block_num|
|
96
|
+
current_timestamp = Time.parse(block.timestamp + 'Z')
|
85
97
|
|
86
|
-
if
|
87
|
-
|
88
|
-
|
89
|
-
block_api.get_blocks(block_range: range) do |block, block_num|
|
90
|
-
if block.nil?
|
91
|
-
puts "Bug: Got nil block for block_num: #{block_num}"
|
92
|
-
exit
|
93
|
-
end
|
94
|
-
|
95
|
-
current_timestamp = Time.parse(block.timestamp + 'Z')
|
96
|
-
|
97
|
-
if !!last_timestamp && block_num != last_block_num + 1
|
98
|
-
puts "Bug: Last block number was #{last_block_num} then jumped to: #{block_num}"
|
99
|
-
exit
|
100
|
-
end
|
101
|
-
|
102
|
-
if !!last_timestamp && current_timestamp < last_timestamp
|
103
|
-
puts "Bug: Went back in time. Last timestamp was #{last_timestamp}, then jumped back to #{current_timestamp}"
|
104
|
-
exit
|
105
|
-
end
|
106
|
-
|
107
|
-
puts "\t#{block_num} Timestamp: #{current_timestamp}, witness: #{block.witness}"
|
108
|
-
last_block_num = block_num
|
109
|
-
last_timestamp = current_timestamp
|
110
|
-
end
|
111
|
-
|
112
|
-
first_block_num = range.max + 1
|
98
|
+
if !range_complete && block_num > range.last
|
99
|
+
puts 'Done with initial range.'
|
100
|
+
range_complete = true
|
113
101
|
end
|
114
102
|
|
115
|
-
|
103
|
+
if !!last_timestamp && block_num != last_block_num + 1
|
104
|
+
puts "Bug: Last block number was #{last_block_num} then jumped to: #{block_num}"
|
105
|
+
exit
|
106
|
+
end
|
107
|
+
|
108
|
+
if !!last_timestamp && current_timestamp < last_timestamp
|
109
|
+
puts "Bug: Went back in time. Last timestamp was #{last_timestamp}, then jumped back to #{current_timestamp}"
|
110
|
+
exit
|
111
|
+
end
|
112
|
+
|
113
|
+
puts "\t#{block_num} Timestamp: #{current_timestamp}, witness: #{block.witness}"
|
114
|
+
last_block_num = block_num
|
115
|
+
last_timestamp = current_timestamp
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
desc 'Test the ability to stream a block range of transactions.'
|
121
|
+
task :trx_range, [:mode, :at_block_num] do |t, args|
|
122
|
+
mode = (args[:mode] || 'irreversible').to_sym
|
123
|
+
first_block_num = args[:at_block_num].to_i if !!args[:at_block_num]
|
124
|
+
stream = Steem::Stream.new(url: ENV['TEST_NODE'], mode: mode)
|
125
|
+
api = Steem::Api.new(url: ENV['TEST_NODE'])
|
126
|
+
|
127
|
+
api.get_dynamic_global_properties do |properties|
|
128
|
+
current_block_num = if mode == :head
|
129
|
+
properties.head_block_number
|
130
|
+
else
|
131
|
+
properties.last_irreversible_block_num
|
132
|
+
end
|
133
|
+
|
134
|
+
# First pass replays latest a random number of blocks to test chunking.
|
135
|
+
first_block_num ||= current_block_num - (rand * 200).to_i
|
136
|
+
|
137
|
+
stream.transactions(at_block_num: first_block_num) do |trx, trx_id, block_num|
|
138
|
+
puts "#{block_num} :: #{trx_id}; ops: #{trx.operations.map(&:type).join(', ')}"
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
desc 'Test the ability to stream a block range of operations.'
|
144
|
+
task :op_range, [:mode, :at_block_num] do |t, args|
|
145
|
+
mode = (args[:mode] || 'irreversible').to_sym
|
146
|
+
first_block_num = args[:at_block_num].to_i if !!args[:at_block_num]
|
147
|
+
stream = Steem::Stream.new(url: ENV['TEST_NODE'], mode: mode)
|
148
|
+
api = Steem::Api.new(url: ENV['TEST_NODE'])
|
149
|
+
|
150
|
+
api.get_dynamic_global_properties do |properties|
|
151
|
+
current_block_num = if mode == :head
|
152
|
+
properties.head_block_number
|
153
|
+
else
|
154
|
+
properties.last_irreversible_block_num
|
155
|
+
end
|
156
|
+
|
157
|
+
# First pass replays latest a random number of blocks to test chunking.
|
158
|
+
first_block_num ||= current_block_num - (rand * 200).to_i
|
159
|
+
|
160
|
+
stream.operations(at_block_num: first_block_num) do |op, trx_id, block_num|
|
161
|
+
puts "#{block_num} :: #{trx_id}; op: #{op.type}"
|
162
|
+
end
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
desc 'Test the ability to stream a block range of virtual operations.'
|
167
|
+
task :vop_range, [:mode, :at_block_num] do |t, args|
|
168
|
+
mode = (args[:mode] || 'irreversible').to_sym
|
169
|
+
first_block_num = args[:at_block_num].to_i if !!args[:at_block_num]
|
170
|
+
stream = Steem::Stream.new(url: ENV['TEST_NODE'], mode: mode)
|
171
|
+
api = Steem::Api.new(url: ENV['TEST_NODE'])
|
172
|
+
|
173
|
+
api.get_dynamic_global_properties do |properties|
|
174
|
+
current_block_num = if mode == :head
|
175
|
+
properties.head_block_number
|
176
|
+
else
|
177
|
+
properties.last_irreversible_block_num
|
178
|
+
end
|
179
|
+
|
180
|
+
# First pass replays latest a random number of blocks to test chunking.
|
181
|
+
first_block_num ||= current_block_num - (rand * 200).to_i
|
182
|
+
|
183
|
+
stream.operations(at_block_num: first_block_num, only_virtual: true) do |op, trx_id, block_num|
|
184
|
+
puts "#{block_num} :: #{trx_id}; op: #{op.type}"
|
185
|
+
end
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
desc 'Test the ability to stream a block range of all operations (including virtual).'
|
190
|
+
task :all_op_range, [:mode, :at_block_num] do |t, args|
|
191
|
+
mode = (args[:mode] || 'irreversible').to_sym
|
192
|
+
first_block_num = args[:at_block_num].to_i if !!args[:at_block_num]
|
193
|
+
stream = Steem::Stream.new(url: ENV['TEST_NODE'], mode: mode)
|
194
|
+
api = Steem::Api.new(url: ENV['TEST_NODE'])
|
195
|
+
|
196
|
+
api.get_dynamic_global_properties do |properties|
|
197
|
+
current_block_num = if mode == :head
|
198
|
+
properties.head_block_number
|
199
|
+
else
|
200
|
+
properties.last_irreversible_block_num
|
201
|
+
end
|
202
|
+
|
203
|
+
# First pass replays latest a random number of blocks to test chunking.
|
204
|
+
first_block_num ||= current_block_num - (rand * 200).to_i
|
205
|
+
|
206
|
+
stream.operations(at_block_num: first_block_num, include_virtual: true) do |op, trx_id, block_num|
|
207
|
+
puts "#{block_num} :: #{trx_id}; op: #{op.type}"
|
116
208
|
end
|
117
209
|
end
|
118
210
|
end
|
data/steem-mechanize.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
|
|
11
11
|
|
12
12
|
spec.summary = %q{Steem Mechanize Client}
|
13
13
|
spec.description = %q{Mechanized ruby client for accessing the Steem blockchain.}
|
14
|
-
spec.homepage = 'https://github.com/
|
14
|
+
spec.homepage = 'https://github.com/steemit/steem-mechanize'
|
15
15
|
spec.license = 'MIT'
|
16
16
|
|
17
17
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test)/}) }
|
@@ -20,6 +20,6 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.add_development_dependency 'bundler', '~> 1.16', '>= 1.16.1'
|
21
21
|
spec.add_development_dependency 'rake', '~> 12.3', '>= 12.3.0'
|
22
22
|
|
23
|
-
spec.add_dependency 'steem-ruby', '~> 0.9', '>= 0.9.
|
23
|
+
spec.add_dependency 'steem-ruby', '~> 0.9', '>= 0.9.3'
|
24
24
|
spec.add_dependency 'mechanize', '~> 2.7', '>= 2.7.5'
|
25
25
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: steem-mechanize
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
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-
|
11
|
+
date: 2018-10-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -59,7 +59,7 @@ dependencies:
|
|
59
59
|
version: '0.9'
|
60
60
|
- - ">="
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: 0.9.
|
62
|
+
version: 0.9.3
|
63
63
|
type: :runtime
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -69,7 +69,7 @@ dependencies:
|
|
69
69
|
version: '0.9'
|
70
70
|
- - ">="
|
71
71
|
- !ruby/object:Gem::Version
|
72
|
-
version: 0.9.
|
72
|
+
version: 0.9.3
|
73
73
|
- !ruby/object:Gem::Dependency
|
74
74
|
name: mechanize
|
75
75
|
requirement: !ruby/object:Gem::Requirement
|
@@ -107,7 +107,7 @@ files:
|
|
107
107
|
- lib/steem/mechanize/rpc/mechanize_client.rb
|
108
108
|
- lib/steem/mechanize/version.rb
|
109
109
|
- steem-mechanize.gemspec
|
110
|
-
homepage: https://github.com/
|
110
|
+
homepage: https://github.com/steemit/steem-mechanize
|
111
111
|
licenses:
|
112
112
|
- MIT
|
113
113
|
metadata: {}
|
@@ -127,7 +127,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
127
127
|
version: '0'
|
128
128
|
requirements: []
|
129
129
|
rubyforge_project:
|
130
|
-
rubygems_version: 2.
|
130
|
+
rubygems_version: 2.7.7
|
131
131
|
signing_key:
|
132
132
|
specification_version: 4
|
133
133
|
summary: Steem Mechanize Client
|