From c45c9e63395dff28c96dd34e9abe04173dcb3400 Mon Sep 17 00:00:00 2001 From: Brian Long Date: Sun, 8 Mar 2026 09:34:02 -0600 Subject: [PATCH 1/8] Adds two methods & miscellaneous clean up. Update to Ruby 3.2.10 --- .ruby-version | 2 +- Gemfile.lock | 104 ++++++++++-------- README.md | 31 +++++- doc/SolanaRpcRuby/MethodsWrapper.html | 5 +- doc/method_list.html | 22 +++- lib/solana_rpc_ruby/methods_wrapper.rb | 50 ++++++++- .../solana_rpc_ruby/methods_wrapper_spec.rb | 80 ++++++++++++++ spec/spec_helper.rb | 7 +- 8 files changed, 238 insertions(+), 63 deletions(-) diff --git a/.ruby-version b/.ruby-version index 0aec50e..f15386a 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -3.1.4 +3.2.10 diff --git a/Gemfile.lock b/Gemfile.lock index 8969f3d..4776d94 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -66,51 +66,61 @@ GEM minitest (>= 5.1) tzinfo (~> 2.0) zeitwerk (~> 2.3) - addressable (2.8.7) - public_suffix (>= 2.0.2, < 7.0) + addressable (2.8.9) + public_suffix (>= 2.0.2, < 8.0) ast (2.4.3) base64 (0.3.0) - bigdecimal (3.2.3) + bigdecimal (4.0.1) builder (3.3.0) codecov (0.6.0) simplecov (>= 0.15, < 0.22) coderay (1.1.3) - concurrent-ruby (1.3.5) - crack (1.0.0) + concurrent-ruby (1.3.6) + crack (1.0.1) bigdecimal rexml crass (1.0.6) - date (3.4.1) + date (3.5.1) diff-lcs (1.6.2) docile (1.4.1) dotenv (2.8.1) + drb (2.2.3) erubi (1.13.1) eventmachine (1.2.7) faye-websocket (0.12.0) eventmachine (>= 0.12.0) websocket-driver (>= 0.8.0) - globalid (1.2.1) + globalid (1.3.0) activesupport (>= 6.1) hashdiff (1.2.1) - i18n (1.14.7) + i18n (1.14.8) concurrent-ruby (~> 1.0) - json (2.13.2) + io-console (0.8.2) + json (2.19.1) + json-schema (6.2.0) + addressable (~> 2.8) + bigdecimal (>= 3.1, < 5) language_server-protocol (3.17.0.5) lint_roller (1.1.0) logger (1.7.0) - loofah (2.24.1) + loofah (2.25.0) crass (~> 1.0.2) nokogiri (>= 1.12.0) - mail (2.8.1) + mail (2.9.0) + logger mini_mime (>= 0.1.1) net-imap net-pop net-smtp - marcel (1.0.4) + marcel (1.1.0) + mcp (0.8.0) + json-schema (>= 4.1) method_source (1.1.0) mini_mime (1.1.5) - minitest (5.25.5) - net-imap (0.5.10) + minitest (6.0.2) + drb (~> 2.0) + prism (~> 1.5) + net-imap (0.6.3) date net-protocol net-pop (0.1.2) @@ -119,22 +129,21 @@ GEM timeout net-smtp (0.5.1) net-protocol - nio4r (2.7.4) - nokogiri (1.18.10-arm64-darwin) - racc (~> 1.4) - nokogiri (1.18.10-x86_64-linux-gnu) + nio4r (2.7.5) + nokogiri (1.19.1-arm64-darwin) racc (~> 1.4) parallel (1.27.0) - parser (3.3.9.0) + parser (3.3.10.2) ast (~> 2.4.1) racc - prism (1.5.1) - pry (0.15.2) + prism (1.9.0) + pry (0.16.0) coderay (~> 1.1) method_source (~> 1.0) - public_suffix (6.0.2) + reline (>= 0.6.0) + public_suffix (7.0.5) racc (1.8.1) - rack (2.2.17) + rack (2.2.22) rack-test (2.2.0) rack (>= 1.3) rails (6.1.7.10) @@ -156,8 +165,8 @@ GEM activesupport (>= 5.0.0) minitest nokogiri (>= 1.6) - rails-html-sanitizer (1.6.2) - loofah (~> 2.21) + rails-html-sanitizer (1.7.0) + loofah (~> 2.25) 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) @@ -166,19 +175,21 @@ GEM rake (>= 12.2) thor (~> 1.0) rainbow (3.1.1) - rake (13.3.0) + rake (13.3.1) regexp_parser (2.11.3) + reline (0.6.3) + io-console (~> 0.5) rexml (3.4.4) - rspec (3.13.1) + rspec (3.13.2) rspec-core (~> 3.13.0) rspec-expectations (~> 3.13.0) rspec-mocks (~> 3.13.0) - rspec-core (3.13.5) + rspec-core (3.13.6) rspec-support (~> 3.13.0) rspec-expectations (3.13.5) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-mocks (3.13.5) + rspec-mocks (3.13.8) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) rspec-rails (4.1.2) @@ -189,31 +200,32 @@ GEM rspec-expectations (~> 3.10) rspec-mocks (~> 3.10) rspec-support (~> 3.10) - rspec-support (3.13.5) - rubocop (1.80.2) + rspec-support (3.13.7) + rubocop (1.85.1) json (~> 2.3) language_server-protocol (~> 3.17.0.2) lint_roller (~> 1.1.0) + mcp (~> 0.6) parallel (~> 1.10) parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 2.9.3, < 3.0) - rubocop-ast (>= 1.46.0, < 2.0) + rubocop-ast (>= 1.49.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 4.0) - rubocop-ast (1.46.0) + rubocop-ast (1.49.0) parser (>= 3.3.7.2) - prism (~> 1.4) + prism (~> 1.7) rubocop-capybara (2.22.1) lint_roller (~> 1.1) rubocop (~> 1.72, >= 1.72.1) - rubocop-factory_bot (2.27.1) + rubocop-factory_bot (2.28.0) lint_roller (~> 1.1) rubocop (~> 1.72, >= 1.72.1) - rubocop-performance (1.26.0) + rubocop-performance (1.26.1) lint_roller (~> 1.1) rubocop (>= 1.75.0, < 2.0) - rubocop-ast (>= 1.44.0, < 2.0) + rubocop-ast (>= 1.47.1, < 2.0) rubocop-rspec (2.31.0) rubocop (~> 1.40) rubocop-capybara (~> 2.17) @@ -236,16 +248,15 @@ GEM actionpack (>= 6.1) activesupport (>= 6.1) sprockets (>= 3.0.0) - thor (1.4.0) - timeout (0.4.3) + thor (1.5.0) + timeout (0.6.0) tzinfo (2.0.6) concurrent-ruby (~> 1.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) + unicode-emoji (4.2.0) + vcr (6.4.0) + webmock (3.26.1) addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) @@ -253,11 +264,10 @@ GEM base64 websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) - zeitwerk (2.6.18) + zeitwerk (2.7.5) PLATFORMS - arm64-darwin-24 - x86_64-linux + arm64-darwin-25 DEPENDENCIES codecov (~> 0.4) @@ -277,4 +287,4 @@ DEPENDENCIES webmock (~> 3.13) BUNDLED WITH - 2.3.26 + 2.4.19 diff --git a/README.md b/README.md index 3755bce..f6eba99 100644 --- a/README.md +++ b/README.md @@ -5,13 +5,13 @@ ![Stars](https://img.shields.io/github/stars/Block-Logic/solana-rpc-ruby.svg) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) # solana_rpc_ruby -A Solana RPC Client for Ruby. This gem provides a wrapper methods for Solana RPC JSON API https://docs.solana.com/developing/clients/jsonrpc-api. +A Solana RPC Client for Ruby. This gem provides a wrapper methods for Solana RPC JSON API https://solana.com/docs/rpc. ## Getting started ### Requirements -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. +This gem requires Ruby 3.2+ (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. Add the following line to your Gemfile: @@ -198,6 +198,33 @@ Gem is coming with demo scripts that you can run and test API and Websockets. 3. Run `ruby demo.rb` or `ruby demo_ws_METHOD.rb` to see example output. 4. Check the gem or Solana JSON RPC API docs to get more information about method usage and modify demo scripts loosely. +### Method lists + +#### HTTP methods (`SolanaRpcRuby::MethodsWrapper`) +Current methods: +`get_account_info`, `get_balance`, `get_block`, `get_block_height`, `get_block_production`, `get_block_commitment`, +`get_blocks`, `get_blocks_with_limit`, `get_block_time`, `get_cluster_nodes`, `get_epoch_info`, `get_epoch_schedule`, +`get_fee_for_message`, `get_first_available_block`, `get_genesis_hash`, `get_health`, `get_highest_snapshot_slot`, +`get_identity`, `get_inflation_governor`, `get_inflation_rate`, `get_inflation_reward`, `get_largest_accounts`, +`get_latest_blockhash`, `get_leader_schedule`, `get_max_retransmit_slot`, `get_max_shred_insert_slot`, +`get_minimum_balance_for_rent_exemption`, `get_multiple_accounts`, `get_program_accounts`, +`get_recent_performance_samples`, `get_signatures_for_address`, `get_signature_statuses`, `get_slot`, +`get_slot_leader`, `get_slot_leaders`, `get_stake_activation`, `get_stake_minimum_delegation`, `get_supply`, +`get_token_account_balance`, `get_token_accounts_by_delegate`, `get_token_accounts_by_owner`, +`get_token_largest_accounts`, `get_token_supply`, `get_transaction`, `get_transaction_count`, `get_version`, +`get_vote_accounts`, `is_blockhash_valid`, `minimum_ledger_slot`, `request_airdrop`, `send_transaction`, +`simulate_transaction`, `get_recent_prioritization_fees`. + +Deprecated compatibility methods: +`get_confirmed_blocks`, `get_fee_calculator_for_blockhash`, `get_fee_rate_governor`, `get_fees`, +`get_recent_blockhash`, `get_snapshot_slot`. + +#### Websocket methods (`SolanaRpcRuby::WebsocketsMethodsWrapper`) +`account_subscribe`, `account_unsubscribe`, `block_subscribe`, `block_unsubscribe`, `logs_subscribe`, +`logs_unsubscribe`, `program_subscribe`, `program_unsubscribe`, `signature_subscribe`, `signature_unsubscribe`, +`slot_subscribe`, `slot_unsubscribe`, `slots_updates_subscribe`, `slots_updates_unsubscribe`, `root_subscribe`, +`root_unsubscribe`, `vote_subscribe`, `vote_unsubscribe`. + All info about methods you can find in the docs on: https://www.rubydoc.info/github/Block-Logic/solana-rpc-ruby/main/SolanaRpcRuby Also, as a reference you can use docs from solana: https://docs.solana.com/developing/clients/jsonrpc-api diff --git a/doc/SolanaRpcRuby/MethodsWrapper.html b/doc/SolanaRpcRuby/MethodsWrapper.html index ccda24e..8b52f30 100644 --- a/doc/SolanaRpcRuby/MethodsWrapper.html +++ b/doc/SolanaRpcRuby/MethodsWrapper.html @@ -1925,6 +1925,9 @@

+ +
+
@@ -9082,4 +9085,4 @@

- \ No newline at end of file + diff --git a/doc/method_list.html b/doc/method_list.html index cad3730..4555aa5 100644 --- a/doc/method_list.html +++ b/doc/method_list.html @@ -44,7 +44,7 @@

Method List