diff --git a/.github/workflows/specs.yml b/.github/workflows/specs.yml index 3bf56e3..347e552 100644 --- a/.github/workflows/specs.yml +++ b/.github/workflows/specs.yml @@ -5,11 +5,11 @@ on: [push] jobs: test: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 strategy: matrix: - ruby-version: ['3.0', '2.7'] + ruby-version: ['3.1', '3.2'] steps: - uses: actions/checkout@v4 diff --git a/.ruby-version b/.ruby-version index a603bb5..0aec50e 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.7.5 +3.1.4 diff --git a/CHANGELOG.md b/CHANGELOG.md index a7b8519..05d1c24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,3 +40,8 @@ ## 1.3.1 * Adds supports of maxSupportedTransactionVersion for get_block method + +## 2.0.0 +* Fix get_transaction when running without encoding parameter +* Add support for maxSupportedTransactionVersion for get_transaction +* Update ruby to 3.1.4 and bundler to 2.3.26 \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock index 278eb54..8969f3d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,168 +1,186 @@ PATH remote: . specs: - solana_rpc_ruby (1.3.1) + solana_rpc_ruby (2.0.0) faye-websocket (~> 0.11) GEM remote: http://rubygems.org/ specs: - actioncable (6.1.4) - actionpack (= 6.1.4) - activesupport (= 6.1.4) + actioncable (6.1.7.10) + actionpack (= 6.1.7.10) + activesupport (= 6.1.7.10) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (6.1.4) - actionpack (= 6.1.4) - activejob (= 6.1.4) - activerecord (= 6.1.4) - activestorage (= 6.1.4) - activesupport (= 6.1.4) + actionmailbox (6.1.7.10) + actionpack (= 6.1.7.10) + activejob (= 6.1.7.10) + activerecord (= 6.1.7.10) + activestorage (= 6.1.7.10) + activesupport (= 6.1.7.10) mail (>= 2.7.1) - actionmailer (6.1.4) - actionpack (= 6.1.4) - actionview (= 6.1.4) - activejob (= 6.1.4) - activesupport (= 6.1.4) + actionmailer (6.1.7.10) + actionpack (= 6.1.7.10) + actionview (= 6.1.7.10) + activejob (= 6.1.7.10) + activesupport (= 6.1.7.10) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (6.1.4) - actionview (= 6.1.4) - activesupport (= 6.1.4) + actionpack (6.1.7.10) + actionview (= 6.1.7.10) + activesupport (= 6.1.7.10) rack (~> 2.0, >= 2.0.9) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.1.4) - actionpack (= 6.1.4) - activerecord (= 6.1.4) - activestorage (= 6.1.4) - activesupport (= 6.1.4) + actiontext (6.1.7.10) + actionpack (= 6.1.7.10) + activerecord (= 6.1.7.10) + activestorage (= 6.1.7.10) + activesupport (= 6.1.7.10) nokogiri (>= 1.8.5) - actionview (6.1.4) - activesupport (= 6.1.4) + actionview (6.1.7.10) + activesupport (= 6.1.7.10) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (6.1.4) - activesupport (= 6.1.4) + activejob (6.1.7.10) + activesupport (= 6.1.7.10) globalid (>= 0.3.6) - activemodel (6.1.4) - activesupport (= 6.1.4) - activerecord (6.1.4) - activemodel (= 6.1.4) - activesupport (= 6.1.4) - activestorage (6.1.4) - actionpack (= 6.1.4) - activejob (= 6.1.4) - activerecord (= 6.1.4) - activesupport (= 6.1.4) - marcel (~> 1.0.0) + activemodel (6.1.7.10) + activesupport (= 6.1.7.10) + activerecord (6.1.7.10) + activemodel (= 6.1.7.10) + activesupport (= 6.1.7.10) + activestorage (6.1.7.10) + actionpack (= 6.1.7.10) + activejob (= 6.1.7.10) + activerecord (= 6.1.7.10) + activesupport (= 6.1.7.10) + marcel (~> 1.0) mini_mime (>= 1.1.0) - activesupport (6.1.4) + activesupport (6.1.7.10) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) tzinfo (~> 2.0) zeitwerk (~> 2.3) - addressable (2.8.0) - public_suffix (>= 2.0.2, < 5.0) - ast (2.4.2) - builder (3.2.4) - codecov (0.5.2) + addressable (2.8.7) + public_suffix (>= 2.0.2, < 7.0) + ast (2.4.3) + base64 (0.3.0) + bigdecimal (3.2.3) + builder (3.3.0) + codecov (0.6.0) simplecov (>= 0.15, < 0.22) coderay (1.1.3) - concurrent-ruby (1.1.9) - crack (0.4.5) + concurrent-ruby (1.3.5) + crack (1.0.0) + bigdecimal rexml crass (1.0.6) - diff-lcs (1.4.4) - docile (1.4.0) - dotenv (2.7.6) - erubi (1.10.0) + date (3.4.1) + diff-lcs (1.6.2) + docile (1.4.1) + dotenv (2.8.1) + erubi (1.13.1) eventmachine (1.2.7) - faye-websocket (0.11.1) + faye-websocket (0.12.0) eventmachine (>= 0.12.0) - websocket-driver (>= 0.5.1) - globalid (0.5.2) - activesupport (>= 5.0) - hashdiff (1.0.1) - i18n (1.8.10) + websocket-driver (>= 0.8.0) + globalid (1.2.1) + activesupport (>= 6.1) + hashdiff (1.2.1) + i18n (1.14.7) concurrent-ruby (~> 1.0) - loofah (2.11.0) + json (2.13.2) + language_server-protocol (3.17.0.5) + lint_roller (1.1.0) + logger (1.7.0) + loofah (2.24.1) crass (~> 1.0.2) - nokogiri (>= 1.5.9) - mail (2.7.1) + nokogiri (>= 1.12.0) + mail (2.8.1) mini_mime (>= 0.1.1) - marcel (1.0.1) - method_source (1.0.0) - mini_mime (1.1.0) - mini_portile2 (2.8.1) - minitest (5.14.4) - nio4r (2.5.8) - nokogiri (1.14.2) - mini_portile2 (~> 2.8.0) + net-imap + net-pop + net-smtp + marcel (1.0.4) + method_source (1.1.0) + mini_mime (1.1.5) + minitest (5.25.5) + net-imap (0.5.10) + date + net-protocol + net-pop (0.1.2) + net-protocol + net-protocol (0.2.2) + timeout + net-smtp (0.5.1) + net-protocol + nio4r (2.7.4) + nokogiri (1.18.10-arm64-darwin) racc (~> 1.4) - nokogiri (1.14.2-arm64-darwin) + nokogiri (1.18.10-x86_64-linux-gnu) racc (~> 1.4) - nokogiri (1.14.2-x86_64-darwin) - racc (~> 1.4) - nokogiri (1.14.2-x86_64-linux) - racc (~> 1.4) - parallel (1.20.1) - parser (3.0.2.0) + parallel (1.27.0) + parser (3.3.9.0) ast (~> 2.4.1) - pry (0.14.1) + racc + prism (1.5.1) + pry (0.15.2) coderay (~> 1.1) method_source (~> 1.0) - public_suffix (4.0.6) - racc (1.6.2) - rack (2.2.3) - rack-test (1.1.0) - rack (>= 1.0, < 3) - rails (6.1.4) - actioncable (= 6.1.4) - actionmailbox (= 6.1.4) - actionmailer (= 6.1.4) - actionpack (= 6.1.4) - actiontext (= 6.1.4) - actionview (= 6.1.4) - activejob (= 6.1.4) - activemodel (= 6.1.4) - activerecord (= 6.1.4) - activestorage (= 6.1.4) - activesupport (= 6.1.4) + public_suffix (6.0.2) + racc (1.8.1) + rack (2.2.17) + rack-test (2.2.0) + rack (>= 1.3) + rails (6.1.7.10) + actioncable (= 6.1.7.10) + actionmailbox (= 6.1.7.10) + actionmailer (= 6.1.7.10) + actionpack (= 6.1.7.10) + actiontext (= 6.1.7.10) + actionview (= 6.1.7.10) + activejob (= 6.1.7.10) + activemodel (= 6.1.7.10) + activerecord (= 6.1.7.10) + activestorage (= 6.1.7.10) + activesupport (= 6.1.7.10) bundler (>= 1.15.0) - railties (= 6.1.4) + railties (= 6.1.7.10) sprockets-rails (>= 2.0.0) - rails-dom-testing (2.0.3) - activesupport (>= 4.2.0) + rails-dom-testing (2.3.0) + activesupport (>= 5.0.0) + minitest nokogiri (>= 1.6) - rails-html-sanitizer (1.3.0) - loofah (~> 2.3) - railties (6.1.4) - actionpack (= 6.1.4) - activesupport (= 6.1.4) + rails-html-sanitizer (1.6.2) + loofah (~> 2.21) + nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) + railties (6.1.7.10) + actionpack (= 6.1.7.10) + activesupport (= 6.1.7.10) method_source - rake (>= 0.13) + rake (>= 12.2) thor (~> 1.0) - rainbow (3.0.0) - rake (13.0.6) - regexp_parser (2.1.1) - rexml (3.2.5) - rspec (3.10.0) - rspec-core (~> 3.10.0) - rspec-expectations (~> 3.10.0) - rspec-mocks (~> 3.10.0) - rspec-core (3.10.1) - rspec-support (~> 3.10.0) - rspec-expectations (3.10.1) + rainbow (3.1.1) + rake (13.3.0) + regexp_parser (2.11.3) + rexml (3.4.4) + rspec (3.13.1) + rspec-core (~> 3.13.0) + rspec-expectations (~> 3.13.0) + rspec-mocks (~> 3.13.0) + rspec-core (3.13.5) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.5) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.10.0) - rspec-mocks (3.10.2) + rspec-support (~> 3.13.0) + rspec-mocks (3.13.5) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.10.0) + rspec-support (~> 3.13.0) rspec-rails (4.1.2) actionpack (>= 4.2) activesupport (>= 4.2) @@ -171,57 +189,74 @@ GEM rspec-expectations (~> 3.10) rspec-mocks (~> 3.10) rspec-support (~> 3.10) - rspec-support (3.10.2) - rubocop (1.18.4) + rspec-support (3.13.5) + rubocop (1.80.2) + json (~> 2.3) + language_server-protocol (~> 3.17.0.2) + lint_roller (~> 1.1.0) parallel (~> 1.10) - parser (>= 3.0.0.0) + parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 1.8, < 3.0) - rexml - rubocop-ast (>= 1.8.0, < 2.0) + regexp_parser (>= 2.9.3, < 3.0) + rubocop-ast (>= 1.46.0, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 3.0) - rubocop-ast (1.9.0) - parser (>= 3.0.1.1) - rubocop-performance (1.11.4) - rubocop (>= 1.7.0, < 2.0) - rubocop-ast (>= 0.4.0) - rubocop-rspec (2.4.0) - rubocop (~> 1.0) - rubocop-ast (>= 1.1.0) - ruby-progressbar (1.11.0) + unicode-display_width (>= 2.4.0, < 4.0) + rubocop-ast (1.46.0) + parser (>= 3.3.7.2) + prism (~> 1.4) + rubocop-capybara (2.22.1) + lint_roller (~> 1.1) + rubocop (~> 1.72, >= 1.72.1) + rubocop-factory_bot (2.27.1) + lint_roller (~> 1.1) + rubocop (~> 1.72, >= 1.72.1) + rubocop-performance (1.26.0) + lint_roller (~> 1.1) + rubocop (>= 1.75.0, < 2.0) + rubocop-ast (>= 1.44.0, < 2.0) + rubocop-rspec (2.31.0) + rubocop (~> 1.40) + rubocop-capybara (~> 2.17) + rubocop-factory_bot (~> 2.22) + rubocop-rspec_rails (~> 2.28) + rubocop-rspec_rails (2.29.1) + rubocop (~> 1.61) + ruby-progressbar (1.13.0) simplecov (0.21.2) docile (~> 1.1) simplecov-html (~> 0.11) simplecov_json_formatter (~> 0.1) - simplecov-html (0.12.3) - simplecov_json_formatter (0.1.3) - sprockets (4.0.2) + simplecov-html (0.13.2) + simplecov_json_formatter (0.1.4) + sprockets (4.2.2) concurrent-ruby (~> 1.0) - rack (> 1, < 3) - sprockets-rails (3.2.2) - actionpack (>= 4.0) - activesupport (>= 4.0) + logger + rack (>= 2.2.4, < 4) + sprockets-rails (3.5.2) + actionpack (>= 6.1) + activesupport (>= 6.1) sprockets (>= 3.0.0) - thor (1.1.0) - tzinfo (2.0.4) + thor (1.4.0) + timeout (0.4.3) + tzinfo (2.0.6) concurrent-ruby (~> 1.0) - unicode-display_width (2.0.0) - vcr (6.0.0) - webmock (3.14.0) + unicode-display_width (3.2.0) + unicode-emoji (~> 4.1) + unicode-emoji (4.1.0) + vcr (6.3.1) + base64 + webmock (3.25.1) addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) - websocket-driver (0.7.5) + websocket-driver (0.8.0) + base64 websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) - zeitwerk (2.4.2) + zeitwerk (2.6.18) PLATFORMS - -darwin-21 - arm64-darwin-22 - ruby - x86_64-darwin-21 + arm64-darwin-24 x86_64-linux DEPENDENCIES @@ -242,4 +277,4 @@ DEPENDENCIES webmock (~> 3.13) BUNDLED WITH - 2.2.2 + 2.3.26 diff --git a/lib/solana_rpc_ruby/helper_methods.rb b/lib/solana_rpc_ruby/helper_methods.rb index 83fe096..9c54231 100644 --- a/lib/solana_rpc_ruby/helper_methods.rb +++ b/lib/solana_rpc_ruby/helper_methods.rb @@ -11,7 +11,7 @@ def blank?(object) raise ArgumentError, 'Object must be a String, Array or Hash or Integer or nil class.' end - object.nil? || object.try(:empty?) + object.nil? || (object.respond_to?(:empty?) && object.empty?) end # Creates method name to match names required by Solana RPC JSON. diff --git a/lib/solana_rpc_ruby/methods_wrapper.rb b/lib/solana_rpc_ruby/methods_wrapper.rb index 8bd3e72..aeb4c05 100644 --- a/lib/solana_rpc_ruby/methods_wrapper.rb +++ b/lib/solana_rpc_ruby/methods_wrapper.rb @@ -1113,7 +1113,7 @@ def get_token_supply( # @param commitment [String] # # @return [Response, ApiError] Response when success, ApiError on failure. - def get_transaction(transaction_signature, encoding: '', commitment: nil) + def get_transaction(transaction_signature, encoding: '', commitment: nil, max_supported_transaction_version: nil) http_method = :post method = create_method_name(__method__) @@ -1122,6 +1122,7 @@ def get_transaction(transaction_signature, encoding: '', commitment: nil) params_hash['commitment'] = commitment unless blank?(commitment) params_hash['encoding'] = encoding unless blank?(encoding) + params_hash['maxSupportedTransactionVersion'] = max_supported_transaction_version unless blank?(max_supported_transaction_version) params << transaction_signature params << params_hash unless params_hash.empty? diff --git a/lib/solana_rpc_ruby/version.rb b/lib/solana_rpc_ruby/version.rb index 355d0b1..ee52c57 100644 --- a/lib/solana_rpc_ruby/version.rb +++ b/lib/solana_rpc_ruby/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module SolanaRpcRuby - VERSION = '1.3.1' + VERSION = '2.0.0' end diff --git a/spec/dummy/config/application.rb b/spec/dummy/config/application.rb index f59e129..9dcdd3a 100644 --- a/spec/dummy/config/application.rb +++ b/spec/dummy/config/application.rb @@ -1,5 +1,19 @@ + require_relative "boot" +# Monkey patch for Ruby 3.3+ and Rails < 7.1 incompatibility +unless defined?(Logger) + require 'logger' +end +unless defined?(ActiveSupport::LoggerThreadSafeLevel::Logger) + module ActiveSupport + module LoggerThreadSafeLevel + Logger = ::Logger + end + end +end + + require "rails" # Pick the frameworks you want: require "active_model/railtie"