steem-ruby 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: af48ecaba4ce86c2a21a91bd5299939408505ab7
4
+ data.tar.gz: e8dfa541ebb4000a6dbb6f05e318fdecda6a9f98
5
+ SHA512:
6
+ metadata.gz: 5d57efdf7b7e1d64b7b513b6e44c68304603525e6bb09001df3494c7616f823d3adf90572e6b73ee474f79c78aa55530a1a73338f8b2af519e38f070d41835b8
7
+ data.tar.gz: 1056b940f606dd018b5cfcd1f134273b7e59e0587776d7841f2a6ef80aa3b1cbe3e562ddcfb31581c885205e608e816c78a510831a29cdc46c4308d59c6659c9
data/.gitignore ADDED
@@ -0,0 +1,54 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /spec/examples.txt
9
+ /test/tmp/
10
+ /test/fixtures/vcr_cassettes/
11
+ /test/version_tmp/
12
+ /tmp/
13
+
14
+ # Used by dotenv library to load environment variables.
15
+ # .env
16
+
17
+ ## Specific to RubyMotion:
18
+ .dat*
19
+ .repl_history
20
+ build/
21
+ *.bridgesupport
22
+ build-iPhoneOS/
23
+ build-iPhoneSimulator/
24
+
25
+ ## Specific to RubyMotion (use of CocoaPods):
26
+ #
27
+ # We recommend against adding the Pods directory to your .gitignore. However
28
+ # you should judge for yourself, the pros and cons are mentioned at:
29
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
30
+ #
31
+ # vendor/Pods/
32
+
33
+ ## Documentation cache and generated files:
34
+ /.yardoc/
35
+ /_yardoc/
36
+ /doc/
37
+ /rdoc/
38
+
39
+ ## Environment normalization:
40
+ /.bundle/
41
+ /vendor/bundle
42
+ /lib/bundler/man/
43
+
44
+ # for a library or gem, you might want to ignore these files since the code is
45
+ # intended to run in multiple environments; otherwise, check them in:
46
+ # Gemfile.lock
47
+ # .ruby-version
48
+ # .ruby-gemset
49
+
50
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
51
+ .rvmrc
52
+
53
+ # gource output
54
+ output.mp4
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,79 @@
1
+
2
+ # Contributing
3
+
4
+ Everyone is welcome to contribute code to Steemit, Inc. projects. We have a Code of Conduct;
5
+ we ask that you please follow it in all your interactions with our team and your fellow
6
+ contributors.
7
+
8
+ Please note that this contributing guide only applies to our development presence.
9
+
10
+ ## How to contribute
11
+
12
+ 1. File an issue describing the problem you would like to
13
+ solve or the feature you would like to add. It saves unnecessary work on your part,
14
+ in case there's a nontechnical reason we can't accept a particular change.
15
+ Please note that we can and will _automatically close all pull requests that do not refer to
16
+ an issue_.
17
+ 2. Learn the conventions of the project you are submitting code to, even implicit ones,
18
+ and follow them. In case you have a question about a project's conventions, please
19
+ ask on the issue you filed. This includes writing tests, formatting code, and documentation.
20
+ 3. File a pull request against your Github issue and fill out the pull request template.
21
+ Remember, you are agreeing to license your code and any intellectual property associated
22
+ with your code under the same terms as the repository you are contributing to.
23
+ 4. If one of our teammates asks you to make changes, please make them. Our rule is that all
24
+ requests for changes in code review are resolved in favor of the reviewer. Our teammates
25
+ follow this rule too!
26
+
27
+ ## Code of Conduct
28
+
29
+ Again, please note that this Code of Conduct _only applies to our development presence_.
30
+
31
+ ### Our Pledge
32
+
33
+ We welcome your membership in our project and community under the rules that we have set below.
34
+
35
+ In the interest of fostering an open and welcoming environment, we as
36
+ contributors and maintainers will work to make your participation in
37
+ our project and community as fulfilling as possible.
38
+
39
+ ### Our Rules
40
+
41
+ All members of our project and community must:
42
+
43
+ 1. Show empathy toward other project and community members
44
+ 2. Use welcoming and inclusive language
45
+ 3. Respect differing viewpoints and experiences
46
+ 4. Gracefully accept constructive criticism
47
+
48
+ All members of our project and community must not:
49
+
50
+ 1. Harm our project and community, or advocate harm to our project and community
51
+ 2. Insult or make derogatory comments about others
52
+ 3. Interact with others after they have withdrawn permission to do so
53
+
54
+ ### Our Responsibilities
55
+
56
+ We will use any and all lawful means at our disposal to enforce our rules. This includes
57
+ but is not limited to:
58
+
59
+ 1. Rejecting contributions
60
+ 2. Removing comments, commits, code, wiki edits, and issues
61
+ 3. Banning abusers
62
+
63
+ We will clarify standards of acceptable behavior and we will take appropriate
64
+ and fair corrective action in response to any instances of unacceptable behavior.
65
+
66
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
67
+ reported by contacting us at github.abuse@steemit.com. All
68
+ complaints will be reviewed and investigated and will result in a response that
69
+ is deemed necessary and appropriate to the circumstances. We
70
+ maintain strict confidentiality with regard to the reporter of an incident.
71
+ Further details of specific enforcement policies may be posted separately.
72
+
73
+ ### Attribution
74
+
75
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
76
+ available at [http://contributor-covenant.org/version/1/4][version]
77
+
78
+ [homepage]: http://contributor-covenant.org
79
+ [version]: http://contributor-covenant.org/version/1/4/gg
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,73 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ steem-ruby (0.1.0)
5
+ bitcoin-ruby (~> 0.0, >= 0.0.18)
6
+ ffi (~> 1.9, >= 1.9.23)
7
+ hashie (~> 3.5, >= 3.5.7)
8
+ json (~> 2.1, >= 2.1.0)
9
+ logging (~> 2.2, >= 2.2.0)
10
+
11
+ GEM
12
+ remote: https://rubygems.org/
13
+ specs:
14
+ addressable (2.5.2)
15
+ public_suffix (>= 2.0.2, < 4.0)
16
+ awesome_print (1.8.0)
17
+ bitcoin-ruby (0.0.18)
18
+ coderay (1.1.2)
19
+ crack (0.4.3)
20
+ safe_yaml (~> 1.0.0)
21
+ docile (1.3.0)
22
+ ffi (1.9.23)
23
+ hashdiff (0.3.7)
24
+ hashie (3.5.7)
25
+ json (2.1.0)
26
+ little-plugger (1.1.4)
27
+ logging (2.2.2)
28
+ little-plugger (~> 1.1)
29
+ multi_json (~> 1.10)
30
+ method_source (0.9.0)
31
+ minitest (5.10.3)
32
+ minitest-line (0.6.4)
33
+ minitest (~> 5.0)
34
+ minitest-proveit (1.0.0)
35
+ minitest (> 5, < 7)
36
+ multi_json (1.13.1)
37
+ pry (0.11.3)
38
+ coderay (~> 1.1.0)
39
+ method_source (~> 0.9.0)
40
+ public_suffix (3.0.2)
41
+ rake (12.3.1)
42
+ safe_yaml (1.0.4)
43
+ simplecov (0.16.1)
44
+ docile (~> 1.1)
45
+ json (>= 1.8, < 3)
46
+ simplecov-html (~> 0.10.0)
47
+ simplecov-html (0.10.2)
48
+ vcr (4.0.0)
49
+ webmock (3.3.0)
50
+ addressable (>= 2.3.6)
51
+ crack (>= 0.3.2)
52
+ hashdiff
53
+ yard (0.9.12)
54
+
55
+ PLATFORMS
56
+ ruby
57
+
58
+ DEPENDENCIES
59
+ awesome_print (~> 1.8, >= 1.8.0)
60
+ bundler (~> 1.16, >= 1.16.1)
61
+ minitest (~> 5.10, >= 5.10.3)
62
+ minitest-line (~> 0.6, >= 0.6.4)
63
+ minitest-proveit (~> 1.0, >= 1.0.0)
64
+ pry (~> 0.11, >= 0.11.3)
65
+ rake (~> 12.3, >= 12.3.0)
66
+ simplecov (~> 0.15, >= 0.15.1)
67
+ steem-ruby!
68
+ vcr (~> 4.0, >= 4.0.0)
69
+ webmock (~> 3.3, >= 3.3.0)
70
+ yard (~> 0.9, >= 0.9.12)
71
+
72
+ BUNDLED WITH
73
+ 1.16.1
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018 steem-ruby
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
data/README.md ADDED
@@ -0,0 +1,77 @@
1
+ # `steem-ruby`
2
+
3
+ Steem-ruby the Ruby API for Steem blockchain.
4
+
5
+ Full documentation: http://www.rubydoc.info/gems/steem-ruby
6
+
7
+ ## Getting Started
8
+
9
+ The steem-ruby gem is compatible with Ruby 2.2.5 or later.
10
+
11
+ ### Install the gem for your project
12
+
13
+ *(Assuming that [Ruby is installed](https://www.ruby-lang.org/en/downloads/) on your computer, as well as [RubyGems](http://rubygems.org/pages/download))*
14
+
15
+ To install the gem on your computer, run in shell:
16
+
17
+ ```bash
18
+ gem install steem-ruby
19
+ ```
20
+
21
+ ... then add in your code:
22
+
23
+ ```ruby
24
+ require 'steem'
25
+ ```
26
+
27
+ To add the gem as a dependency to your project with [Bundler](http://bundler.io/), you can add this line in your Gemfile:
28
+
29
+ ```ruby
30
+ gem 'steem-ruby', require: 'steem'
31
+ ```
32
+
33
+ ## Examples
34
+
35
+ ### Broadcast Vote
36
+
37
+ ```ruby
38
+ params = {
39
+ voter: voter,
40
+ author: author,
41
+ permlink: permlink,
42
+ weight: weight
43
+ }
44
+
45
+ Steem::Broadcast.vote(wif: wif, params: params) do |result|
46
+ puts result
47
+ end
48
+ ```
49
+
50
+ ### Get Accounts
51
+
52
+ ```ruby
53
+ api = Steem::DatabaseApi.new
54
+
55
+ api.find_accounts(accounts: ['steemit', 'alice']) do |result|
56
+ puts result.accounts
57
+ end
58
+ ```
59
+
60
+ ### Reputation Formatter
61
+
62
+ ```ruby
63
+ rep = Steem::Formatter.reputation(account.reputation)
64
+ puts rep
65
+ ```
66
+
67
+ ## Contributions
68
+
69
+ Patches are welcome! Contributors are listed in the `steem-ruby.gemspec` file. Please run the tests (`rake test`) before opening a pull request and make sure that you are passing all of them. If you would like to contribute, but don't know what to work on, check the issues list.
70
+
71
+ ## Issues
72
+
73
+ When you find issues, please report them!
74
+
75
+ ## License
76
+
77
+ MIT
data/Rakefile ADDED
@@ -0,0 +1,115 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rake/testtask'
3
+ require 'yard'
4
+ require 'steem'
5
+
6
+ Rake::TestTask.new(test: 'clean:vcr') 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/steem/account_by_key_api_test.rb',
29
+ 'test/steem/account_history_api_test.rb',
30
+ 'test/steem/block_api_test.rb',
31
+ 'test/steem/database_api_test.rb',
32
+ 'test/steem/follow_api_test.rb',
33
+ 'test/steem/jsonrpc_test.rb',
34
+ 'test/steem/market_history_api_test.rb',
35
+ 'test/steem/tags_api_test.rb',
36
+ 'test/steem/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/steem/broadcast_test.rb',
54
+ 'test/steem/transaction_builder_test.rb'
55
+ ]
56
+ t.ruby_opts << if ENV['HELL_ENABLED']
57
+ '-W2'
58
+ else
59
+ '-W1'
60
+ end
61
+ end
62
+ end
63
+
64
+ YARD::Rake::YardocTask.new do |t|
65
+ t.files = ['lib/**/*.rb']
66
+ end
67
+
68
+ task default: :test
69
+
70
+ desc 'Ruby console with steem already required.'
71
+ task :console do
72
+ exec 'irb -r steem -I ./lib'
73
+ end
74
+
75
+ namespace :clean do
76
+ desc 'Remove test/fixtures/vcr_cassettes/*.yml so they can be rebuilt fresh.'
77
+ task :vcr do |t|
78
+ cmd = 'echo Cleaned cassettes: $(rm -v test/fixtures/vcr_cassettes/*.yml | wc -l)'
79
+ system cmd
80
+ end
81
+ end
82
+
83
+ namespace :show do
84
+ desc 'Shows known API names.'
85
+ task :apis do
86
+ url = ENV['URL']
87
+ jsonrpc = Steem::Jsonrpc.new(url: url)
88
+ api_methods = jsonrpc.get_api_methods
89
+ puts api_methods.keys
90
+ end
91
+
92
+ desc 'Shows known method names for specified API.'
93
+ task :methods, [:api] do |t, args|
94
+ url = ENV['URL']
95
+ jsonrpc = Steem::Jsonrpc.new(url: url)
96
+ api_methods = jsonrpc.get_api_methods
97
+ api_methods[args[:api]].each do |method|
98
+ jsonrpc.get_signature(method: "#{args[:api]}.#{method}") do |signature|
99
+ print "#{method} "
100
+ params = signature.args.map do |k, v|
101
+ 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/
102
+ "#{k}: Time"
103
+ elsif v.class == Hashie::Array
104
+ "#{k}: []"
105
+ elsif v.class == Hashie::Mash
106
+ "#{k}: {}"
107
+ else
108
+ "#{k}: #{v.class}"
109
+ end
110
+ end
111
+ puts params.join(', ')
112
+ end
113
+ end
114
+ end
115
+ 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
Binary file
data/lib/steem/api.rb ADDED
@@ -0,0 +1,190 @@
1
+ module Steem
2
+ # This ruby API works with
3
+ # {https://github.com/steemit/steem/releases steemd-0.19.4} and other Appbase
4
+ # compatible upstreams. To access different API namespaces, use the
5
+ # following:
6
+ #
7
+ # api = Steem::Api.new
8
+ # api.get_dynamic_global_properties
9
+ #
10
+ # The above example will make an instance that can access the
11
+ # {https://developers.steem.io/apidefinitions/condenser-api condenser_api}
12
+ # namespace. Alternatively, you may also create a direct instances with its
13
+ # full name, if you prefer:
14
+ #
15
+ # api = Steem::CondenserApi.new
16
+ # api.get_dynamic_global_properties
17
+ #
18
+ # If you know the name of another API that is supported by the remote node,
19
+ # you can create an instance to that instead, for example:
20
+ #
21
+ # api = Steem::MarketHistoryApi.new
22
+ # api.get_volume
23
+ #
24
+ # All known API by namespace:
25
+ #
26
+ # * {AccountByKeyApi}
27
+ # * {AccountHistoryApi}
28
+ # * {BlockApi}
29
+ # * {DatabaseApi}
30
+ # * {FollowApi}
31
+ # * {Jsonrpc}
32
+ # * {MarketHistoryApi}
33
+ # * {NetworkBroadcastApi}
34
+ # * {TagsApi}
35
+ # * {WitnessApi}
36
+ #
37
+ # Also see: {https://developers.steem.io/apidefinitions.html Complete API Definitions}
38
+ class Api
39
+ attr_accessor :chain, :methods
40
+
41
+ # Use this for debugging naive thread handler.
42
+ # DEFAULT_RPC_CLIENT = RPC::BaseClient
43
+ DEFAULT_RPC_CLIENT = RPC::ThreadSafeClient
44
+
45
+ def self.api_name=(api_name)
46
+ @api_name = api_name.to_s.
47
+ gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
48
+ gsub(/([a-z\d])([A-Z])/,'\1_\2').
49
+ tr('-', '_').downcase.to_sym
50
+ end
51
+
52
+ def self.api_name
53
+ @api_name
54
+ end
55
+
56
+ def self.api_class_name
57
+ @api_name.to_s.split('_').map(&:capitalize).join
58
+ end
59
+
60
+ def self.jsonrpc=(jsonrpc)
61
+ @jsonrpc = jsonrpc
62
+ end
63
+
64
+ def self.jsonrpc
65
+ @jsonrpc
66
+ end
67
+
68
+ def initialize(options = {})
69
+ @chain = options[:chain] || :steem
70
+ @error_pipe = options[:error_pipe] || STDERR
71
+ @api_name = self.class.api_name ||= :condenser_api
72
+ @rpc_client = options[:rpc_client] || DEFAULT_RPC_CLIENT.new(options.merge(api_name: @api_name))
73
+
74
+ if @api_name == :jsonrpc
75
+ Api::jsonrpc = self
76
+ else
77
+ # Note, we have to wait until initialize to check this because we don't
78
+ # have access to instance options until now.
79
+
80
+ Api::jsonrpc = Jsonrpc.new(options)
81
+ @methods = Api::jsonrpc.get_api_methods
82
+
83
+ unless !!@methods[@api_name]
84
+ raise UnknownApiError, "#{@api_name} (known APIs: #{@methods.keys.join(' ')})"
85
+ end
86
+
87
+ @methods = @methods[@api_name]
88
+ end
89
+
90
+ @try_count = 0
91
+ end
92
+
93
+ def inspect
94
+ properties = %w(chain methods).map do |prop|
95
+ if !!(v = instance_variable_get("@#{prop}"))
96
+ case v
97
+ when Array then "@#{prop}=<#{v.size} #{v.size == 1 ? 'element' : 'elements'}>"
98
+ else; "@#{prop}=#{v}"
99
+ end
100
+ end
101
+ end.compact.join(', ')
102
+
103
+ "#<#{self.class.api_class_name} [#{properties}]>"
104
+ end
105
+ private
106
+ def self.args_keys_to_s(rpc_method_name)
107
+ args = signature(rpc_method_name).args
108
+ args_keys = JSON[args.to_json]
109
+ end
110
+
111
+ def self.signature(rpc_method_name)
112
+ @@signatures ||= {}
113
+ @@signatures[rpc_method_name] ||= jsonrpc.get_signature(method: rpc_method_name).result
114
+ end
115
+
116
+ def self.raise_error_response(rpc_method_name, rpc_args, response)
117
+ raise UnknownError, "#{rpc_method_name}: #{response}" if response.error.nil?
118
+
119
+ error = response.error
120
+
121
+ if error.message == 'Invalid Request'
122
+ raise Steem::ArgumentError, "Unexpected arguments: #{rpc_args.inspect}. Expected: #{rpc_method_name} (#{args_keys_to_s(rpc_method_name)})"
123
+ end
124
+
125
+ BaseError.build_error(error, rpc_method_name)
126
+ end
127
+
128
+ def respond_to_missing?(m, include_private = false)
129
+ methods.nil? ? false : methods.include?(m.to_sym)
130
+ end
131
+
132
+ def method_missing(m, *args, &block)
133
+ super unless respond_to_missing?(m)
134
+
135
+ rpc_method_name = "#{@api_name}.#{m}"
136
+ rpc_args = case @api_name
137
+ when :condenser_api then args
138
+ when :jsonrpc then args.first
139
+ else
140
+ expected_args = Api::signature(rpc_method_name).args || []
141
+ expected_args_key_string = if expected_args.size > 0
142
+ " (#{Api::args_keys_to_s(rpc_method_name)})"
143
+ end
144
+ expected_args_size = expected_args.size
145
+
146
+ begin
147
+ args = args.first.to_h
148
+ args_size = args.size
149
+
150
+ # Some argument are optional, but if the arguments passed are greater
151
+ # than the expected arguments size, we can warn.
152
+ if args_size > expected_args_size
153
+ error_pipe.puts "Warning #{rpc_method_name} expects arguments: #{expected_args_size}, got: #{args_size}"
154
+ end
155
+ rescue NoMethodError => e
156
+ error = Steem::ArgumentError.new("#{rpc_method_name} expects arguments: #{expected_args_size}", e)
157
+ raise error
158
+ rescue
159
+ raise Steem::ArgumentError, "#{rpc_method_name} expects arguments: #{expected_args_size}"
160
+ end
161
+
162
+ args
163
+ end
164
+
165
+ response = @rpc_client.rpc_post(@api_name, m, rpc_args)
166
+
167
+ if defined?(response.error) && !!response.error
168
+ if !!response.error.message
169
+ Api::raise_error_response rpc_method_name, rpc_args, response
170
+ else
171
+ raise Steem::ArgumentError, response.error.inspect
172
+ end
173
+ end
174
+
175
+ if !!block
176
+ case response
177
+ when Hashie::Mash then yield response.result, response.error, response.id
178
+ when Hashie::Array
179
+ response.each do |r|
180
+ r = Hashie::Mash.new(r)
181
+ yield r.result, r.error, r.id
182
+ end
183
+ else; yield response
184
+ end
185
+ else
186
+ return response
187
+ end
188
+ end
189
+ end
190
+ end