solana_rpc_ruby 1.3.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: c2de89a051209d77ca5d7ee6bce5c28c654ae65cdba126707e5b1b8abc4f235c
4
- data.tar.gz: 6912c79881f16f9c5f412e883c5be7491499063ec6b0b5455b79adfe0dbc10c8
3
+ metadata.gz: e9d44c623f36aaad5aeb068bc6b1ca71786bd988068eb97f2e250a176bd10178
4
+ data.tar.gz: 9239493fe02ecf843e0de7bf26898702b1c68d508a21cc8ad98e82f67d21da36
5
5
  SHA512:
6
- metadata.gz: 4ceb2d841c44d496b1a9ceceb5908722c4e0dcd94481ca8b8ce85d70c081c33f2a054bc152d324e2e23177d948b03a57f3c4d26a1d9cfb4acef30ccc965d1150
7
- data.tar.gz: afd8ef590130974128ac2031c0b32c41a817529ad35f7b72b12f6a20738be4b589490ea5f034efc7eef1af2b6d242a5525d7764a58b739a0d0d88d4f312ad039
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
@@ -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.3.0'
4
+ VERSION = '1.3.1'
5
5
  end
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.3.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: 2023-03-15 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