hive-ruby 1.0.0.pre.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +54 -0
  3. data/CONTRIBUTING.md +79 -0
  4. data/Gemfile +3 -0
  5. data/Gemfile.lock +91 -0
  6. data/LICENSE +21 -0
  7. data/README.md +248 -0
  8. data/Rakefile +358 -0
  9. data/gource.sh +6 -0
  10. data/hive-ruby.gemspec +40 -0
  11. data/images/Anthony Martin.png +0 -0
  12. data/lib/hive.rb +89 -0
  13. data/lib/hive/api.rb +223 -0
  14. data/lib/hive/base_error.rb +218 -0
  15. data/lib/hive/block_api.rb +78 -0
  16. data/lib/hive/bridge.rb +12 -0
  17. data/lib/hive/broadcast.rb +1334 -0
  18. data/lib/hive/chain_config.rb +34 -0
  19. data/lib/hive/fallback.rb +287 -0
  20. data/lib/hive/formatter.rb +14 -0
  21. data/lib/hive/jsonrpc.rb +112 -0
  22. data/lib/hive/marshal.rb +231 -0
  23. data/lib/hive/mixins/jsonable.rb +37 -0
  24. data/lib/hive/mixins/retriable.rb +58 -0
  25. data/lib/hive/mixins/serializable.rb +45 -0
  26. data/lib/hive/operation.rb +141 -0
  27. data/lib/hive/operation/account_create.rb +10 -0
  28. data/lib/hive/operation/account_create_with_delegation.rb +12 -0
  29. data/lib/hive/operation/account_update.rb +8 -0
  30. data/lib/hive/operation/account_witness_proxy.rb +4 -0
  31. data/lib/hive/operation/account_witness_vote.rb +5 -0
  32. data/lib/hive/operation/cancel_transfer_from_savings.rb +4 -0
  33. data/lib/hive/operation/challenge_authority.rb +5 -0
  34. data/lib/hive/operation/change_recovery_account.rb +5 -0
  35. data/lib/hive/operation/claim_account.rb +5 -0
  36. data/lib/hive/operation/claim_reward_balance.rb +6 -0
  37. data/lib/hive/operation/comment.rb +9 -0
  38. data/lib/hive/operation/comment_options.rb +10 -0
  39. data/lib/hive/operation/convert.rb +5 -0
  40. data/lib/hive/operation/create_claimed_account.rb +10 -0
  41. data/lib/hive/operation/custom.rb +5 -0
  42. data/lib/hive/operation/custom_binary.rb +8 -0
  43. data/lib/hive/operation/custom_json.rb +6 -0
  44. data/lib/hive/operation/decline_voting_rights.rb +4 -0
  45. data/lib/hive/operation/delegate_vesting_shares.rb +5 -0
  46. data/lib/hive/operation/delete_comment.rb +4 -0
  47. data/lib/hive/operation/escrow_approve.rb +8 -0
  48. data/lib/hive/operation/escrow_dispute.rb +7 -0
  49. data/lib/hive/operation/escrow_release.rb +10 -0
  50. data/lib/hive/operation/escrow_transfer.rb +12 -0
  51. data/lib/hive/operation/feed_publish.rb +4 -0
  52. data/lib/hive/operation/limit_order_cancel.rb +4 -0
  53. data/lib/hive/operation/limit_order_create.rb +8 -0
  54. data/lib/hive/operation/limit_order_create2.rb +8 -0
  55. data/lib/hive/operation/prove_authority.rb +4 -0
  56. data/lib/hive/operation/recover_account.rb +6 -0
  57. data/lib/hive/operation/report_over_production.rb +5 -0
  58. data/lib/hive/operation/request_account_recovery.rb +6 -0
  59. data/lib/hive/operation/reset_account.rb +5 -0
  60. data/lib/hive/operation/set_reset_account.rb +5 -0
  61. data/lib/hive/operation/set_withdraw_vesting_route.rb +6 -0
  62. data/lib/hive/operation/transfer.rb +6 -0
  63. data/lib/hive/operation/transfer_from_savings.rb +7 -0
  64. data/lib/hive/operation/transfer_to_savings.rb +6 -0
  65. data/lib/hive/operation/transfer_to_vesting.rb +5 -0
  66. data/lib/hive/operation/vote.rb +6 -0
  67. data/lib/hive/operation/withdraw_vesting.rb +4 -0
  68. data/lib/hive/operation/witness_set_properties.rb +5 -0
  69. data/lib/hive/operation/witness_update.rb +7 -0
  70. data/lib/hive/rpc/base_client.rb +179 -0
  71. data/lib/hive/rpc/http_client.rb +143 -0
  72. data/lib/hive/rpc/thread_safe_http_client.rb +35 -0
  73. data/lib/hive/stream.rb +385 -0
  74. data/lib/hive/transaction.rb +115 -0
  75. data/lib/hive/transaction_builder.rb +406 -0
  76. data/lib/hive/type/amount.rb +126 -0
  77. data/lib/hive/type/base_type.rb +10 -0
  78. data/lib/hive/utils.rb +17 -0
  79. data/lib/hive/version.rb +4 -0
  80. metadata +502 -0
data/Rakefile ADDED
@@ -0,0 +1,358 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rake/testtask'
3
+ require 'yard'
4
+ require 'hive'
5
+
6
+ Rake::TestTask.new(test: ['clean:vcr', 'test:threads']) do |t|
7
+ t.libs << 'test'
8
+ t.libs << 'lib'
9
+ t.test_files = FileList['test/**/*_test.rb']
10
+ t.ruby_opts << if ENV['HELL_ENABLED']
11
+ '-W2'
12
+ else
13
+ '-W1'
14
+ end
15
+ end
16
+
17
+ namespace :test do
18
+ Rake::TestTask.new(static: 'clean:vcr') do |t|
19
+ t.description = <<-EOD
20
+ Run static tests, which are those that have static request/responses.
21
+ These are tests that are typically read-only and do not require heavy
22
+ matches on the json-rpc request body. Often, the only difference between
23
+ one execution and another is the json-rpc-id.
24
+ EOD
25
+ t.libs << 'test'
26
+ t.libs << 'lib'
27
+ t.test_files = [
28
+ 'test/hive/account_by_key_api_test.rb',
29
+ 'test/hive/account_history_api_test.rb',
30
+ 'test/hive/block_api_test.rb',
31
+ 'test/hive/database_api_test.rb',
32
+ 'test/hive/follow_api_test.rb',
33
+ 'test/hive/jsonrpc_test.rb',
34
+ 'test/hive/market_history_api_test.rb',
35
+ 'test/hive/tags_api_test.rb',
36
+ 'test/hive/witness_api_test.rb'
37
+ ]
38
+ t.ruby_opts << if ENV['HELL_ENABLED']
39
+ '-W2'
40
+ else
41
+ '-W1'
42
+ end
43
+ end
44
+
45
+ Rake::TestTask.new(broadcast: 'clean:vcr') do |t|
46
+ t.description = <<-EOD
47
+ Run broadcast tests, which are those that only use network_broadcast_api
48
+ and/or database_api.verify_authority (pretend: true).
49
+ EOD
50
+ t.libs << 'test'
51
+ t.libs << 'lib'
52
+ t.test_files = [
53
+ 'test/hive/broadcast_test.rb',
54
+ 'test/hive/transaction_builder_test.rb'
55
+ ]
56
+ t.ruby_opts << if ENV['HELL_ENABLED']
57
+ '-W2'
58
+ else
59
+ '-W1'
60
+ end
61
+ end
62
+
63
+ Rake::TestTask.new(testnet: 'clean:vcr') do |t|
64
+ t.description = <<-EOD
65
+ Run testnet tests, which are those that use network_broadcast_api to do
66
+ actual broadcast operations, on a specified (or default) testnet.
67
+ EOD
68
+ t.libs << 'test'
69
+ t.libs << 'lib'
70
+ t.test_files = [
71
+ 'test/hive/testnet_test.rb'
72
+ ]
73
+ t.ruby_opts << if ENV['HELL_ENABLED']
74
+ '-W2'
75
+ else
76
+ '-W1'
77
+ end
78
+ end
79
+
80
+ desc 'Tests the API using multiple threads.'
81
+ task :threads do
82
+ next if !!ENV['TEST']
83
+
84
+ threads = []
85
+ api = Hive::Api.new(url: ENV['TEST_NODE'])
86
+ database_api = Hive::DatabaseApi.new(url: ENV['TEST_NODE'])
87
+ witnesses = {}
88
+ keys = %i(created url total_missed props running_version
89
+ hardfork_version_vote hardfork_time_vote)
90
+ low_participation_warning_seen = false
91
+
92
+ if defined? Thread.report_on_exception
93
+ Thread.report_on_exception = true
94
+ end
95
+
96
+ database_api.get_active_witnesses do |result|
97
+ abort 'Bad result from: database_api.get_active_witnesses' if result.nil?
98
+
99
+ print "Found #{result.witnesses.size} witnesses ..."
100
+
101
+ result.witnesses.each do |witness_name|
102
+ if witness_name == '' && !low_participation_warning_seen
103
+ warn "\nWarning: low witness participation detected."
104
+ low_participation_warning_seen = true
105
+
106
+ next
107
+ end
108
+
109
+ threads << Thread.new do
110
+ api.get_witness_by_account(witness_name) do |witness|
111
+ witnesses[witness.owner] = witness.map do |k, v|
112
+ [k, v] if keys.include? k.to_sym
113
+ end.compact.to_h
114
+
115
+ sbd_exchange_rate = witness[:sbd_exchange_rate]
116
+ base = sbd_exchange_rate[:base].to_f
117
+
118
+ if (quote = sbd_exchange_rate[:quote].to_f) > 0
119
+ rate = (base / quote).round(3)
120
+ witnesses[witness.owner][:sbd_exchange_rate] = rate
121
+ else
122
+ witnesses[witness.owner][:sbd_exchange_rate] = nil
123
+ end
124
+
125
+ last_sbd_exchange_update = witness[:last_sbd_exchange_update]
126
+ last_sbd_exchange_update = Time.parse(last_sbd_exchange_update + 'Z')
127
+ last_sbd_exchange_elapsed = '%.2f hours ago' % ((Time.now.utc - last_sbd_exchange_update) / 60)
128
+ witnesses[witness.owner][:last_sbd_exchange_elapsed] = last_sbd_exchange_elapsed
129
+ end
130
+ end
131
+ end
132
+ end
133
+
134
+ threads.each do |thread|
135
+ print '.'
136
+ thread.join
137
+ end
138
+
139
+ puts ' done!'
140
+
141
+ if threads.size != witnesses.size
142
+ puts "Bug: expected #{threads.size} witnesses, only found #{witnesses.size}."
143
+ else
144
+ puts JSON.pretty_generate witnesses rescue puts witnesses
145
+ end
146
+ end
147
+ end
148
+
149
+ namespace :stream do
150
+ desc 'Test the ability to stream a block range.'
151
+ task :block_range, [:mode, :at_block_num] do |t, args|
152
+ mode = (args[:mode] || 'irreversible').to_sym
153
+ first_block_num = args[:at_block_num].to_i if !!args[:at_block_num]
154
+ stream = Hive::Stream.new(url: ENV['TEST_NODE'], mode: mode)
155
+ api = Hive::Api.new(url: ENV['TEST_NODE'])
156
+ last_block_num = nil
157
+ last_timestamp = nil
158
+ range_complete = false
159
+
160
+ api.get_dynamic_global_properties do |properties|
161
+ current_block_num = if mode == :head
162
+ properties.head_block_number
163
+ else
164
+ properties.last_irreversible_block_num
165
+ end
166
+
167
+ # First pass replays latest a random number of blocks to test chunking.
168
+ first_block_num ||= current_block_num - (rand * 200).to_i
169
+
170
+ range = first_block_num..current_block_num
171
+ puts "Initial block range: #{range.size}"
172
+
173
+ stream.blocks(at_block_num: range.first) do |block, block_num|
174
+ current_timestamp = Time.parse(block.timestamp + 'Z')
175
+
176
+ if !range_complete && block_num > range.last
177
+ puts 'Done with initial range.'
178
+ range_complete = true
179
+ end
180
+
181
+ if !!last_timestamp && block_num != last_block_num + 1
182
+ puts "Bug: Last block number was #{last_block_num} then jumped to: #{block_num}"
183
+ exit
184
+ end
185
+
186
+ if !!last_timestamp && current_timestamp < last_timestamp
187
+ puts "Bug: Went back in time. Last timestamp was #{last_timestamp}, then jumped back to #{current_timestamp}"
188
+ exit
189
+ end
190
+
191
+ puts "\t#{block_num} Timestamp: #{current_timestamp}, witness: #{block.witness}"
192
+ last_block_num = block_num
193
+ last_timestamp = current_timestamp
194
+ end
195
+ end
196
+ end
197
+
198
+ desc 'Test the ability to stream a block range of transactions.'
199
+ task :trx_range, [:mode, :at_block_num] do |t, args|
200
+ mode = (args[:mode] || 'irreversible').to_sym
201
+ first_block_num = args[:at_block_num].to_i if !!args[:at_block_num]
202
+ stream = Hive::Stream.new(url: ENV['TEST_NODE'], mode: mode)
203
+ api = Hive::Api.new(url: ENV['TEST_NODE'])
204
+
205
+ api.get_dynamic_global_properties do |properties|
206
+ current_block_num = if mode == :head
207
+ properties.head_block_number
208
+ else
209
+ properties.last_irreversible_block_num
210
+ end
211
+
212
+ # First pass replays latest a random number of blocks to test chunking.
213
+ first_block_num ||= current_block_num - (rand * 200).to_i
214
+
215
+ stream.transactions(at_block_num: first_block_num) do |trx, trx_id, block_num|
216
+ puts "#{block_num} :: #{trx_id}; ops: #{trx.operations.map(&:type).join(', ')}"
217
+ end
218
+ end
219
+ end
220
+
221
+ desc 'Test the ability to stream a block range of operations.'
222
+ task :op_range, [:mode, :at_block_num] do |t, args|
223
+ mode = (args[:mode] || 'irreversible').to_sym
224
+ first_block_num = args[:at_block_num].to_i if !!args[:at_block_num]
225
+ stream = Hive::Stream.new(url: ENV['TEST_NODE'], mode: mode)
226
+ api = Hive::Api.new(url: ENV['TEST_NODE'])
227
+
228
+ api.get_dynamic_global_properties do |properties|
229
+ current_block_num = if mode == :head
230
+ properties.head_block_number
231
+ else
232
+ properties.last_irreversible_block_num
233
+ end
234
+
235
+ # First pass replays latest a random number of blocks to test chunking.
236
+ first_block_num ||= current_block_num - (rand * 200).to_i
237
+
238
+ stream.operations(at_block_num: first_block_num) do |op, trx_id, block_num|
239
+ puts "#{block_num} :: #{trx_id}; op: #{op.type}"
240
+ end
241
+ end
242
+ end
243
+
244
+ desc 'Test the ability to stream a block range of virtual operations.'
245
+ task :vop_range, [:mode, :at_block_num] do |t, args|
246
+ mode = (args[:mode] || 'irreversible').to_sym
247
+ first_block_num = args[:at_block_num].to_i if !!args[:at_block_num]
248
+ stream = Hive::Stream.new(url: ENV['TEST_NODE'], mode: mode)
249
+ api = Hive::Api.new(url: ENV['TEST_NODE'])
250
+
251
+ api.get_dynamic_global_properties do |properties|
252
+ current_block_num = if mode == :head
253
+ properties.head_block_number
254
+ else
255
+ properties.last_irreversible_block_num
256
+ end
257
+
258
+ # First pass replays latest a random number of blocks to test chunking.
259
+ first_block_num ||= current_block_num - (rand * 200).to_i
260
+
261
+ stream.operations(at_block_num: first_block_num, only_virtual: true) do |op, trx_id, block_num|
262
+ puts "#{block_num} :: #{trx_id}; op: #{op.type}"
263
+ end
264
+ end
265
+ end
266
+
267
+ desc 'Test the ability to stream a block range of all operations (including virtual).'
268
+ task :all_op_range, [:mode, :at_block_num] do |t, args|
269
+ mode = (args[:mode] || 'irreversible').to_sym
270
+ first_block_num = args[:at_block_num].to_i if !!args[:at_block_num]
271
+ stream = Hive::Stream.new(url: ENV['TEST_NODE'], mode: mode)
272
+ api = Hive::Api.new(url: ENV['TEST_NODE'])
273
+
274
+ api.get_dynamic_global_properties do |properties|
275
+ current_block_num = if mode == :head
276
+ properties.head_block_number
277
+ else
278
+ properties.last_irreversible_block_num
279
+ end
280
+
281
+ # First pass replays latest a random number of blocks to test chunking.
282
+ first_block_num ||= current_block_num - (rand * 200).to_i
283
+
284
+ stream.operations(at_block_num: first_block_num, include_virtual: true) do |op, trx_id, block_num|
285
+ puts "#{block_num} :: #{trx_id}; op: #{op.type}"
286
+ end
287
+ end
288
+ end
289
+ end
290
+
291
+ YARD::Rake::YardocTask.new do |t|
292
+ t.files = ['lib/**/*.rb']
293
+ end
294
+
295
+ task default: :test
296
+
297
+ desc 'Ruby console with hive already required.'
298
+ task :console do
299
+ exec 'irb -r hive -I ./lib'
300
+ end
301
+
302
+ namespace :clean do
303
+ desc 'Remove test/fixtures/vcr_cassettes/*.yml so they can be rebuilt fresh.'
304
+ task :vcr do |t|
305
+ cmd = 'echo Cleaned cassettes: $(rm -v test/fixtures/vcr_cassettes/*.yml | wc -l)'
306
+ system cmd
307
+ end
308
+ end
309
+
310
+ namespace :show do
311
+ desc 'Shows known API names.'
312
+ task :apis do
313
+ url = ENV['URL']
314
+ jsonrpc = Hive::Jsonrpc.new(url: url)
315
+ api_methods = jsonrpc.get_api_methods
316
+ puts api_methods.keys
317
+ end
318
+
319
+ desc 'Shows known method names for specified API.'
320
+ task :methods, [:api] do |t, args|
321
+ url = ENV['URL']
322
+ jsonrpc = Hive::Jsonrpc.new(url: url)
323
+ api_methods = jsonrpc.get_api_methods
324
+
325
+ api_names = if !!args[:api]
326
+ [args[:api]]
327
+ else
328
+ Hive::Fallback::API_METHODS.keys
329
+ end
330
+
331
+ api_names.each do |api_name|
332
+ unless !!api_methods[api_name.to_s]
333
+ puts "Skipped API: #{api_name}"
334
+
335
+ next
336
+ end
337
+
338
+ api_methods[api_name.to_s].each do |method|
339
+ jsonrpc.get_signature(method: "#{api_name}.#{method}") do |signature|
340
+ print "#{api_name}.#{method} "
341
+
342
+ params = signature.args.map do |k, v|
343
+ if v =~ /\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2]\d|3[0-1])T(2[0-3]|[01]\d):[0-5]\d:[0-5]\d/
344
+ "#{k}: Time"
345
+ elsif v.class == Hashie::Array
346
+ "#{k}: []"
347
+ elsif v.class == Hashie::Mash
348
+ "#{k}: {}"
349
+ else
350
+ "#{k}: #{v.class}"
351
+ end
352
+ end
353
+ puts params.join(', ')
354
+ end
355
+ end
356
+ end
357
+ end
358
+ end
data/gource.sh ADDED
@@ -0,0 +1,6 @@
1
+ #!/bin/bash
2
+
3
+ gource ./ --user-image-dir images --hide usernames -s 0.5 -b 000000 \
4
+ -1280x720 --output-ppm-stream - |\
5
+ ffmpeg -y -r 28 -f image2pipe -vcodec ppm -i - -vcodec libx264 -preset slow \
6
+ -crf 28 -threads 0 output.mp4
data/hive-ruby.gemspec ADDED
@@ -0,0 +1,40 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'hive/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'hive-ruby'
8
+ spec.version = Hive::VERSION
9
+ spec.authors = ['Anthony Martin']
10
+ spec.email = ['hive-ruby@martin-studio.com']
11
+
12
+ spec.summary = %q{Hive Ruby Client}
13
+ spec.description = %q{Client for accessing the Hive blockchain.}
14
+ spec.homepage = 'https://gitlab.syncad.com/hive/hive-ruby'
15
+ spec.license = 'MIT'
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test)/}) }
18
+ spec.require_paths = ['lib']
19
+
20
+ spec.add_development_dependency 'bundler', '~> 1.16', '>= 1.16.1'
21
+ spec.add_development_dependency 'rake', '~> 13.0.1', '>= 12.3.0'
22
+ spec.add_development_dependency 'minitest', '~> 5.10', '>= 5.10.3'
23
+ spec.add_development_dependency 'minitest-line', '~> 0.6', '>= 0.6.4'
24
+ spec.add_development_dependency 'minitest-proveit', '~> 1.0', '>= 1.0.0'
25
+ spec.add_development_dependency 'webmock', '~> 3.3', '>= 3.3.0'
26
+ spec.add_development_dependency 'simplecov', '~> 0.15', '>= 0.15.1'
27
+ spec.add_development_dependency 'vcr', '~> 5.1', '>= 4.0.0'
28
+ spec.add_development_dependency 'yard', '~> 0.9', '>= 0.9.12'
29
+ spec.add_development_dependency 'pry', '~> 0.11', '>= 0.11.3'
30
+ spec.add_development_dependency 'awesome_print', '~> 1.8', '>= 1.8.0'
31
+ spec.add_development_dependency 'irb', '~> 1.2', '>= 1.2.3'
32
+
33
+ spec.add_dependency 'json', '~> 2.1', '>= 2.1.0'
34
+ spec.add_dependency 'logging', '~> 2.2', '>= 2.2.0'
35
+ spec.add_dependency 'hashie', '~> 3.5', '>= 3.5.7'
36
+ spec.add_dependency 'bitcoin-ruby', '~> 0.0', '>= 0.0.18'
37
+ spec.add_dependency 'ffi', '~> 1.9', '>= 1.9.23'
38
+ spec.add_dependency 'bindata', '~> 2.4', '>= 2.4.4'
39
+ spec.add_dependency 'base58', '~> 0.2', '>= 0.2.3'
40
+ end
Binary file
data/lib/hive.rb ADDED
@@ -0,0 +1,89 @@
1
+ # encoding: UTF-8
2
+ require 'json' unless defined?(JSON)
3
+ require 'net/https'
4
+
5
+ require 'hashie'
6
+ require 'hive/version'
7
+ require 'hive/utils'
8
+ require 'hive/base_error'
9
+ require 'hive/mixins/serializable'
10
+ require 'hive/mixins/jsonable'
11
+ require 'hive/mixins/retriable'
12
+ require 'hive/chain_config'
13
+ require 'hive/type/base_type'
14
+ require 'hive/type/amount'
15
+ require 'hive/operation'
16
+ require 'hive/operation/account_create.rb'
17
+ require 'hive/operation/account_create_with_delegation.rb'
18
+ require 'hive/operation/account_update.rb'
19
+ require 'hive/operation/account_witness_proxy.rb'
20
+ require 'hive/operation/account_witness_vote.rb'
21
+ require 'hive/operation/cancel_transfer_from_savings.rb'
22
+ require 'hive/operation/challenge_authority.rb'
23
+ require 'hive/operation/change_recovery_account.rb'
24
+ require 'hive/operation/claim_account.rb'
25
+ require 'hive/operation/claim_reward_balance.rb'
26
+ require 'hive/operation/comment.rb'
27
+ require 'hive/operation/comment_options.rb'
28
+ require 'hive/operation/convert.rb'
29
+ require 'hive/operation/create_claimed_account.rb'
30
+ require 'hive/operation/custom.rb'
31
+ require 'hive/operation/custom_binary.rb'
32
+ require 'hive/operation/custom_json.rb'
33
+ require 'hive/operation/decline_voting_rights.rb'
34
+ require 'hive/operation/delegate_vesting_shares.rb'
35
+ require 'hive/operation/delete_comment.rb'
36
+ require 'hive/operation/escrow_approve.rb'
37
+ require 'hive/operation/escrow_dispute.rb'
38
+ require 'hive/operation/escrow_release.rb'
39
+ require 'hive/operation/escrow_transfer.rb'
40
+ require 'hive/operation/feed_publish.rb'
41
+ require 'hive/operation/limit_order_cancel.rb'
42
+ require 'hive/operation/limit_order_create.rb'
43
+ require 'hive/operation/limit_order_create2.rb'
44
+ require 'hive/operation/prove_authority.rb'
45
+ require 'hive/operation/recover_account.rb'
46
+ require 'hive/operation/report_over_production.rb'
47
+ require 'hive/operation/request_account_recovery.rb'
48
+ require 'hive/operation/reset_account.rb'
49
+ require 'hive/operation/set_reset_account.rb'
50
+ require 'hive/operation/set_withdraw_vesting_route.rb'
51
+ require 'hive/operation/transfer.rb'
52
+ require 'hive/operation/transfer_from_savings.rb'
53
+ require 'hive/operation/transfer_to_savings.rb'
54
+ require 'hive/operation/transfer_to_vesting.rb'
55
+ require 'hive/operation/vote.rb'
56
+ require 'hive/operation/withdraw_vesting.rb'
57
+ require 'hive/operation/witness_update.rb'
58
+ require 'hive/operation/witness_set_properties.rb'
59
+ require 'hive/marshal'
60
+ require 'hive/transaction'
61
+ require 'hive/transaction_builder'
62
+ require 'hive/rpc/base_client'
63
+ require 'hive/rpc/http_client'
64
+ require 'hive/rpc/thread_safe_http_client'
65
+ require 'hive/api'
66
+ require 'hive/jsonrpc'
67
+ require 'hive/block_api'
68
+ require 'hive/formatter'
69
+ require 'hive/broadcast'
70
+ require 'hive/stream'
71
+ require 'hive/fallback'
72
+ require 'hive/bridge'
73
+
74
+ module Hive
75
+ def self.api_classes
76
+ @api_classes ||= {}
77
+ end
78
+
79
+ def self.const_missing(const)
80
+ super unless const.to_s.end_with? 'Api'
81
+
82
+ api = api_classes[const]
83
+ api ||= Api.clone(freeze: true) rescue Api.clone
84
+ api.api_name = const
85
+ api_classes[const] = api
86
+ end
87
+ end
88
+
89
+ Hashie.logger = Logger.new(ENV['HASHIE_LOGGER'])