solana_rpc_ruby 1.2.0 → 1.3.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 445e4852f291cb7e6d417e3a3277905c7c2935ed40ec9cdca3e1d5f2f599f8ab
4
- data.tar.gz: 36f27011567ebd56e0f0b86db2fa93c04e66c55351d0307a014b432a3988f8e5
3
+ metadata.gz: e9d44c623f36aaad5aeb068bc6b1ca71786bd988068eb97f2e250a176bd10178
4
+ data.tar.gz: 9239493fe02ecf843e0de7bf26898702b1c68d508a21cc8ad98e82f67d21da36
5
5
  SHA512:
6
- metadata.gz: 9be80c9efcff01f3324cee479e4262cafd9ca8cc43dfc7d19e6bf537f336428a5bacf124b4d920955c364638fd355e9bdbe33bf425bc458a2d37025bbfbb794e
7
- data.tar.gz: 86e7db1d6cdf6b2a5b208b7b5b8fdae6766fbeb5e919ff8dfd23c845c9c8d5105827f4609d10ad01581f0049a1dfbd1c9e9ded0937f621ad7912856837397da2
6
+ metadata.gz: e01eaeff30dfd9ae82022aa265181a241ea5f0f6ac0910d321dd486e1fad7f3af43ba2fb242123201d61ca003fbf776b41281a7e76299b348c5090d17125597c
7
+ data.tar.gz: a8a49e3b09624652222fad6e02146b81414a5ebb527a2168090f03f051d2f81daac9d7f9a46997fe194327c35fa868807cd95564f73c00c74fa4a778ba3f2705
data/CHANGELOG.md CHANGED
@@ -33,3 +33,10 @@
33
33
  * Add warns to deprecated methods
34
34
  * Update docs
35
35
  * Small fixes
36
+
37
+ ## 1.3.0
38
+ * Upgrade Ruby to v2.7.5
39
+ * Minor dependency upgrades
40
+
41
+ ## 1.3.1
42
+ * Adds supports of maxSupportedTransactionVersion for get_block method
data/README.md CHANGED
@@ -11,7 +11,8 @@ A Solana RPC Client for Ruby. This gem provides a wrapper methods for Solana RPC
11
11
 
12
12
  ### Requirements
13
13
 
14
- This gem requires Ruby 2.6+ and h Rails 6.0+. It MIGHT work with lower versions, but was not tested with them.
14
+ This gem requires Ruby 2.7+ (as denoted in the `.ruby-version` file) and it has Rails 6.0+ on board. It MIGHT work with lower versions, but was not tested with them.
15
+
15
16
  Add the following line to your Gemfile:
16
17
 
17
18
  ```ruby
@@ -3,14 +3,15 @@ module SolanaRpcRuby
3
3
  module HelperMethods
4
4
  # Checks if the object is nil or empty.
5
5
  #
6
- # @param object [String, Array, Hash]
6
+ # @param object [String, Array, Hash, Integer, NilClass]
7
7
  #
8
8
  # @return [Boolean]
9
9
  def blank?(object)
10
- raise ArgumentError, 'Object must be a String, Array or Hash or nil class.'\
11
- unless object.is_a?(String) || object.is_a?(Array) || object.is_a?(Hash) || object.nil?
12
-
13
- object.nil? || object.empty?
10
+ unless [String, Array, Hash, Integer, NilClass].include? object.class
11
+ raise ArgumentError, 'Object must be a String, Array or Hash or Integer or nil class.'
12
+ end
13
+
14
+ object.nil? || object.try(:empty?)
14
15
  end
15
16
 
16
17
  # Creates method name to match names required by Solana RPC JSON.
@@ -108,22 +108,26 @@ module SolanaRpcRuby
108
108
  # @param commitment [String]
109
109
  #
110
110
  # @return [Response, ApiError] Response when success, ApiError on failure.
111
- def get_block(slot, encoding: '', transaction_details: '', rewards: true, commitment: nil)
112
- http_method = :post
113
- method = create_method_name(__method__)
111
+ def get_block(slot, params = {})
112
+ params[:rewards] ||= true
113
+ params[:max_supported_transaction_version] ||= 0
114
114
 
115
- params = []
115
+ http_method = :post
116
+ method = create_method_name(__method__)
116
117
 
117
- params_hash = {}
118
- params_hash['encoding'] = encoding unless blank?(encoding)
119
- params_hash['transactionDetails'] = transaction_details unless blank?(transaction_details)
120
- params_hash['rewards'] = rewards unless rewards.nil?
121
- params_hash['commitment'] = commitment unless blank?(commitment)
118
+ params_build = {}
119
+ params_build['encoding'] = params[:encoding] unless blank?(params[:encoding])
120
+ params_build['transactionDetails'] = params[:transaction_details] unless blank?(params[:transaction_details])
121
+ params_build['rewards'] = params[:rewards] unless params[:rewards].nil?
122
+ params_build['commitment'] = params[:commitment] unless blank?(params[:commitment])
123
+ params_build['maxSupportedTransactionVersion'] =
124
+ params[:max_supported_transaction_version] unless blank?(params[:max_supported_transaction_version])
122
125
 
123
- params << slot
124
- params << params_hash unless params_hash.empty?
126
+ params_request = []
127
+ params_request << slot
128
+ params_request << params_build unless params_build.empty?
125
129
 
126
- body = create_json_body(method, method_params: params)
130
+ body = create_json_body(method, method_params: params_request)
127
131
 
128
132
  send_request(body, http_method)
129
133
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SolanaRpcRuby
4
- VERSION = '1.2.0'
4
+ VERSION = '1.3.1'
5
5
  end
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
12
12
  spec.homepage = 'https://github.com/Block-Logic/solana-rpc-ruby'
13
13
  spec.license = 'MIT'
14
14
  spec.platform = Gem::Platform::RUBY
15
- spec.required_ruby_version = '>= 2.6.5'
15
+ spec.required_ruby_version = '>= 2.7.5'
16
16
  spec.files = Dir[
17
17
  'README.md', 'LICENSE', 'CHANGELOG.md',
18
18
  'lib/**/*.rb',
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solana_rpc_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Block Logic Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-13 00:00:00.000000000 Z
11
+ date: 2023-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faye-websocket
@@ -249,14 +249,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
249
249
  requirements:
250
250
  - - ">="
251
251
  - !ruby/object:Gem::Version
252
- version: 2.6.5
252
+ version: 2.7.5
253
253
  required_rubygems_version: !ruby/object:Gem::Requirement
254
254
  requirements:
255
255
  - - ">="
256
256
  - !ruby/object:Gem::Version
257
257
  version: '0'
258
258
  requirements: []
259
- rubygems_version: 3.2.2
259
+ rubygems_version: 3.1.6
260
260
  signing_key:
261
261
  specification_version: 4
262
262
  summary: Ruby wrapper for solana JSON RPC API.