Class: SolanaRpcRuby::MethodsWrapper
- Inherits:
-
Object
- Object
- SolanaRpcRuby::MethodsWrapper
- Includes:
- HelperMethods, RequestBody
- Defined in:
- lib/solana_rpc_ruby/methods_wrapper.rb
Overview
MethodsWrapper class serves as a wrapper for solana JSON RPC API methods. All informations about params:
Instance Attribute Summary collapse
-
#api_client ⇒ SolanaRpcRuby::ApiClient
Determines which cluster will be used to send requests.
-
#cluster ⇒ String
Cluster where requests will be sent.
-
#id ⇒ Integer
Unique client-generated identifying integer.
Instance Method Summary collapse
-
#get_account_info(account_pubkey, encoding: '', data_slice: {}, commitment: '') ⇒ Response, ApiError
Returns all information associated with the account of provided Pubkey.
-
#get_balance(account_pubkey, commitment: nil) ⇒ Response, ApiError
Returns the balance of the account of provided Pubkey.
-
#get_block(slot, encoding: '', transaction_details: '', rewards: true, commitment: nil) ⇒ Response, ApiError
NEW: This method is only available in solana-core v1.7 or newer.
-
#get_block_commitment(block) ⇒ Response, ApiError
Returns commitment for particular block.
-
#get_block_height(commitment: nil) ⇒ Response, ApiError
Returns the current block height of the node.
-
#get_block_production(identity: nil, range: {}, commitment: nil) ⇒ Response, ApiError
Returns recent block production information from the current or previous epoch.
-
#get_block_time(block) ⇒ Response, ApiError
Returns the estimated production time of a block.
-
#get_blocks(start_slot, end_slot: nil, commitment: nil) ⇒ Response, ApiError
NEW: This method is only available in solana-core v1.7 or newer.
-
#get_blocks_with_limit(start_slot, limit, commitment: nil) ⇒ Response, ApiError
NEW: This method is only available in solana-core v1.7 or newer.
-
#get_cluster_nodes ⇒ Response, ApiError
Returns information about all the nodes participating in the cluster.
-
#get_confirmed_blocks(start_slot, end_slot: nil) ⇒ Response, ApiError
deprecated
Deprecated.
Please use getBlocks instead This method is expected to be removed in solana-core v1.8
-
#get_epoch_info(commitment: nil) ⇒ Response, ApiError
Returns information about the current epoch.
-
#get_epoch_schedule ⇒ Response, ApiError
Returns epoch schedule information from this cluster’s genesis config.
-
#get_fee_calculator_for_blockhash(query_blockhash, commitment: nil) ⇒ Response, ApiError
deprecated
Deprecated.
Please use isBlockhashValid or getFeeForMessage instead This method is expected to be removed in solana-core v2.0
-
#get_fee_for_message(message, commitment: nil) ⇒ Response, ApiError
NEW: This method is only available in solana-core v1.9 or newer.
-
#get_fee_rate_governor ⇒ Response, ApiError
deprecated
Deprecated.
Please check solana docs for substitution.
-
#get_fees(commitment: nil) ⇒ Response, ApiError
deprecated
Deprecated.
DEPRECATED: Please use getFeeForMessage instead This method is expected to be removed in solana-core v2.0
-
#get_first_available_block ⇒ Response, ApiError
Returns the slot of the lowest confirmed block that has not been purged from the ledger.
-
#get_genesis_hash ⇒ Response, ApiError
Returns the genesis hash.
-
#get_health ⇒ Response, ApiError
Returns the current health of the node.
-
#get_highest_snapshot_slot ⇒ Response, ApiError
NEW: This method is only available in solana-core v1.9 or newer.
-
#get_identity ⇒ Response, ApiError
Returns the identity pubkey for the current node.
-
#get_inflation_governor(commitment: nil) ⇒ Response, ApiError
Returns the current inflation governor.
-
#get_inflation_rate ⇒ Response, ApiError
Returns the specific inflation values for the current epoch.
-
#get_inflation_reward(addresses, commitment: nil, epoch: nil) ⇒ Response, ApiError
Returns the inflation reward for a list of addresses for an epoch.
-
#get_largest_accounts(commitment: nil, filter: '') ⇒ Response, ApiError
Returns the 20 largest accounts, by lamport balance (results may be cached up to two hours).
-
#get_latest_blockhash(commitment: nil) ⇒ Response, ApiError
NEW: This method is only available in solana-core v1.9 or newer.
-
#get_leader_schedule(epoch: nil, commitment: nil, identity: '') ⇒ Response, ApiError
Returns the leader schedule for an epoch.
-
#get_max_retransmit_slot ⇒ Response, ApiError
Get the max slot seen from retransmit stage.
-
#get_max_shred_insert_slot ⇒ Response, ApiError
Get the max slot seen from after shred insert.
-
#get_minimum_balance_for_rent_exemption(account_data_length, commitment: nil) ⇒ Response, ApiError
Returns minimum balance required to make account rent exempt.
-
#get_multiple_accounts(pubkeys, commitment: nil, encoding: '', data_slice: {}) ⇒ Response, ApiError
Returns the account information for a list of Pubkeys.
-
#get_program_accounts(pubkey, commitment: nil, encoding: '', data_slice: {}, filters: [], with_context: false) ⇒ Response, ApiError
Returns all accounts owned by the provided program Pubkey.
-
#get_recent_blockhash(commitment: nil) ⇒ Response, ApiError
Returns a recent block hash from the ledger, and a fee schedule that can be used to compute the cost of submitting a transaction using it.
-
#get_recent_performance_samples(limit: nil) ⇒ Response, ApiError
Returns a list of recent performance samples, in reverse slot order.
-
#get_signature_statuses(transaction_signatures, search_transaction_history: false) ⇒ Response, ApiError
Returns the statuses of a list of signatures.
-
#get_signatures_for_address(account_address, limit: nil, before: '', until_: '', commitment: nil) ⇒ Response, ApiError
NEW: This method is only available in solana-core v1.7 or newer.
-
#get_slot(commitment: nil) ⇒ Response, ApiError
Returns the current slot the node is processing.
-
#get_slot_leader(commitment: nil) ⇒ Response, ApiError
Returns the current slot leader.
-
#get_slot_leaders(start_slot, limit) ⇒ Response, ApiError
Returns the slot leaders for a given slot range.
-
#get_snapshot_slot ⇒ Response, ApiError
deprecated
Deprecated.
Please use getHighestSnapshotSlot instead This method is expected to be removed in solana-core v2.0
-
#get_stake_activation(pubkey, commitment: nil, epoch: nil) ⇒ Response, ApiError
Returns epoch activation information for a stake account.
-
#get_supply(commitment: nil, exclude_non_circulating_accounts_list: nil) ⇒ Response, ApiError
Returns information about the current supply.
-
#get_token_account_balance(token_account_pubkey, commitment: nil) ⇒ Response, ApiError
Returns the token balance of an SPL Token account.
-
#get_token_accounts_by_delegate(token_account_pubkey, mint: '', program_id: '', commitment: nil, encoding: '', data_slice: {}) ⇒ Response, ApiError
Returns all SPL Token accounts by approved Delegate.
-
#get_token_accounts_by_owner(token_account_pubkey, mint: '', program_id: '', commitment: nil, encoding: '', data_slice: {}) ⇒ Response, ApiError
Returns all SPL Token accounts by token owner.
-
#get_token_largest_accounts(token_mint_pubkey, commitment: nil) ⇒ Response, ApiError
Returns the 20 largest accounts of a particular SPL Token type.
-
#get_token_supply(token_mint_pubkey, commitment: nil) ⇒ Response, ApiError
Returns the total supply of an SPL Token type.
-
#get_transaction(transaction_signature, encoding: '', commitment: nil) ⇒ Response, ApiError
Returns transaction details for a confirmed transaction.
-
#get_transaction_count(commitment: nil) ⇒ Response, ApiError
Returns the current Transaction count from the ledger.
-
#get_version ⇒ Response, ApiError
Returns the current solana versions running on the node.
-
#get_vote_accounts(commitment: nil, vote_pubkey: nil, keep_unstaked_delinquents: nil, delinquent_slot_distance: nil) ⇒ Response, ApiError
Returns the account info and associated stake for all the voting accounts in the current bank.
-
#initialize(api_client: ApiClient, cluster: SolanaRpcRuby.cluster, id: rand(1...99_999)) ⇒ MethodsWrapper
constructor
Initialize object with cluster address where requests will be sent.
-
#is_blockhash_valid(blockhash, commitment: nil) ⇒ Response, ApiError
NEW: This method is only available in solana-core v1.9 or newer.
-
#minimum_ledger_slot ⇒ Response, ApiError
Returns the lowest slot that the node has information about in its ledger.
-
#request_airdrop(pubkey, lamports, commitment: nil) ⇒ Response, ApiError
Requests an airdrop of lamports to a Pubkey.
-
#send_transaction(transaction_signature, skip_pre_flight: false, pre_flight_commitment: nil, encoding: '', max_retries: nil) ⇒ Response, ApiError
Submits a signed transaction to the cluster for processing.
-
#simulate_transaction(transaction_signature, accounts_addresses, sig_verify: false, commitment: nil, encoding: '', replace_recent_blockhash: false, accounts_encoding: '') ⇒ Response, ApiError
Simulate sending a transaction accounts_addresses should be an empty array (?).
Methods included from HelperMethods
Methods included from RequestBody
Constructor Details
#initialize(api_client: ApiClient, cluster: SolanaRpcRuby.cluster, id: rand(1...99_999)) ⇒ MethodsWrapper
Initialize object with cluster address where requests will be sent.
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/solana_rpc_ruby/methods_wrapper.rb', line 31 def initialize( api_client: ApiClient, cluster: SolanaRpcRuby.cluster, id: rand(1...99_999) ) @api_client = api_client.new(cluster) @cluster = cluster @id = id end |
Instance Attribute Details
#api_client ⇒ SolanaRpcRuby::ApiClient
Determines which cluster will be used to send requests.
16 17 18 |
# File 'lib/solana_rpc_ruby/methods_wrapper.rb', line 16 def api_client @api_client end |
#cluster ⇒ String
Cluster where requests will be sent.
20 21 22 |
# File 'lib/solana_rpc_ruby/methods_wrapper.rb', line 20 def cluster @cluster end |
#id ⇒ Integer
Unique client-generated identifying integer.
24 25 26 |
# File 'lib/solana_rpc_ruby/methods_wrapper.rb', line 24 def id @id end |
Instance Method Details
#get_account_info(account_pubkey, encoding: '', data_slice: {}, commitment: '') ⇒ Response, ApiError
Returns all information associated with the account of provided Pubkey
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/solana_rpc_ruby/methods_wrapper.rb', line 54 def get_account_info(account_pubkey, encoding: '', data_slice: {}, commitment: '') http_method = :post method = create_method_name(__method__) params = [] params_hash = {} params_hash['encoding'] = encoding unless blank?(encoding) params_hash['dataSlice'] = data_slice unless data_slice.empty? params_hash['commitment'] = commitment unless blank?(commitment) params << account_pubkey params << params_hash unless params_hash.empty? body = create_json_body(method, method_params: params) send_request(body, http_method) end |
#get_balance(account_pubkey, commitment: nil) ⇒ Response, ApiError
Returns the balance of the account of provided Pubkey
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/solana_rpc_ruby/methods_wrapper.rb', line 81 def get_balance(account_pubkey, commitment: nil) http_method = :post method = create_method_name(__method__) params = [] params_hash = {} params_hash['commitment'] = commitment unless blank?(commitment) params << account_pubkey params << params_hash unless params_hash.empty? body = create_json_body(method, method_params: params) send_request(body, http_method) end |
#get_block(slot, encoding: '', transaction_details: '', rewards: true, commitment: nil) ⇒ Response, ApiError
NEW: This method is only available in solana-core v1.7 or newer. Please use getConfirmedBlock for solana-core v1.6
Returns identity and transaction information about a confirmed block in the ledger
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/solana_rpc_ruby/methods_wrapper.rb', line 111 def get_block(slot, encoding: '', transaction_details: '', rewards: true, commitment: nil) http_method = :post method = create_method_name(__method__) params = [] params_hash = {} params_hash['encoding'] = encoding unless blank?(encoding) params_hash['transactionDetails'] = transaction_details unless blank?(transaction_details) params_hash['rewards'] = rewards unless rewards.nil? params_hash['commitment'] = commitment unless blank?(commitment) params << slot params << params_hash unless params_hash.empty? body = create_json_body(method, method_params: params) send_request(body, http_method) end |
#get_block_commitment(block) ⇒ Response, ApiError
Returns commitment for particular block
193 194 195 196 197 198 199 200 201 202 203 204 |
# File 'lib/solana_rpc_ruby/methods_wrapper.rb', line 193 def get_block_commitment(block) http_method = :post method = create_method_name(__method__) params = [] params << block body = create_json_body(method, method_params: params) send_request(body, http_method) end |
#get_block_height(commitment: nil) ⇒ Response, ApiError
Returns the current block height of the node
138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
# File 'lib/solana_rpc_ruby/methods_wrapper.rb', line 138 def get_block_height(commitment: nil) http_method = :post method = create_method_name(__method__) params = [] params_hash = {} params_hash['commitment'] = commitment unless blank?(commitment) params << params_hash unless params_hash.empty? body = create_json_body(method, method_params: params) send_request(body, http_method) end |
#get_block_production(identity: nil, range: {}, commitment: nil) ⇒ Response, ApiError
Returns recent block production information from the current or previous epoch.
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
# File 'lib/solana_rpc_ruby/methods_wrapper.rb', line 164 def get_block_production(identity: nil, range: {}, commitment: nil) http_method = :post method = create_method_name(__method__) params = [] params_hash = {} range_hash = {} range_hash['firstSlot'] = range[:first_slot] unless !range.key?(:first_slot) range_hash['lastSlot'] = range[:last_slot] unless !range.key?(:last_slot) params_hash['identity'] = identity unless blank?(identity) params_hash['range'] = range_hash unless range_hash.empty? params_hash['commitment'] = commitment unless blank?(commitment) params << params_hash unless params_hash.empty? body = create_json_body(method, method_params: params) send_request(body, http_method) end |
#get_block_time(block) ⇒ Response, ApiError
Returns the estimated production time of a block.
268 269 270 271 272 273 274 275 276 277 278 279 |
# File 'lib/solana_rpc_ruby/methods_wrapper.rb', line 268 def get_block_time(block) http_method = :post method = create_method_name(__method__) params = [] params << block body = create_json_body(method, method_params: params) send_request(body, http_method) end |
#get_blocks(start_slot, end_slot: nil, commitment: nil) ⇒ Response, ApiError
NEW: This method is only available in solana-core v1.7 or newer. Please use getConfirmedBlocks for solana-core v1.6
Returns a list of confirmed blocks between two slots
215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 |
# File 'lib/solana_rpc_ruby/methods_wrapper.rb', line 215 def get_blocks(start_slot, end_slot: nil, commitment: nil) http_method = :post method = create_method_name(__method__) params = [] params_hash = {} params << start_slot params << end_slot unless end_slot.nil? params_hash['commitment'] = commitment unless blank?(commitment) params << params_hash unless params_hash.empty? body = create_json_body(method, method_params: params) send_request(body, http_method) end |
#get_blocks_with_limit(start_slot, limit, commitment: nil) ⇒ Response, ApiError
NEW: This method is only available in solana-core v1.7 or newer. Please use getConfirmedBlocks for solana-core v1.6
Returns a list of confirmed blocks starting at the given slot
243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 |
# File 'lib/solana_rpc_ruby/methods_wrapper.rb', line 243 def get_blocks_with_limit(start_slot, limit, commitment: nil) http_method = :post method = create_method_name(__method__) params = [] params_hash = {} params_hash['commitment'] = commitment unless blank?(commitment) params << start_slot params << limit params << params_hash unless params_hash.empty? body = create_json_body(method, method_params: params) send_request(body, http_method) end |
#get_cluster_nodes ⇒ Response, ApiError
Returns information about all the nodes participating in the cluster
286 287 288 289 290 291 292 293 |
# File 'lib/solana_rpc_ruby/methods_wrapper.rb', line 286 def get_cluster_nodes http_method = :post method = create_method_name(__method__) body = create_json_body(method) send_request(body, http_method) end |
#get_confirmed_blocks(start_slot, end_slot: nil) ⇒ Response, ApiError
Please use getBlocks instead This method is expected to be removed in solana-core v1.8
Returns a list of confirmed blocks between two slots
1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 |
# File 'lib/solana_rpc_ruby/methods_wrapper.rb', line 1368 def get_confirmed_blocks(start_slot, end_slot: nil) warn 'DEPRECATED: Please use getBlocks instead. This method is expected to be removed in solana-core v1.8' http_method = :post method = create_method_name(__method__) params = [] params << start_slot params << end_slot unless end_slot.nil? # optional body = create_json_body(method, method_params: params) send_request(body, http_method) end |
#get_epoch_info(commitment: nil) ⇒ Response, ApiError
Returns information about the current epoch
302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 |
# File 'lib/solana_rpc_ruby/methods_wrapper.rb', line 302 def get_epoch_info(commitment: nil) http_method = :post method = create_method_name(__method__) params = [] params_hash = {} params_hash['commitment'] = commitment unless blank?(commitment) params << params_hash unless params_hash.empty? body = create_json_body(method, method_params: params) send_request(body, http_method) end |
#get_epoch_schedule ⇒ Response, ApiError
Returns epoch schedule information from this cluster’s genesis config
323 324 325 326 327 328 329 330 |
# File 'lib/solana_rpc_ruby/methods_wrapper.rb', line 323 def get_epoch_schedule http_method = :post method = create_method_name(__method__) body = create_json_body(method) send_request(body, http_method) end |
#get_fee_calculator_for_blockhash(query_blockhash, commitment: nil) ⇒ Response, ApiError
Please use isBlockhashValid or getFeeForMessage instead This method is expected to be removed in solana-core v2.0
Returns the fee calculator associated with the query blockhash, or null if the blockhash has expired
1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 |
# File 'lib/solana_rpc_ruby/methods_wrapper.rb', line 1394 def get_fee_calculator_for_blockhash(query_blockhash, commitment: nil) warn "DEPRECATED: Please use isBlockhashValid or getFeeForMessage instead. This method is expected to be removed in solana-core v2.0" http_method = :post method = create_method_name(__method__) params = [] params_hash = {} params_hash['commitment'] = commitment unless blank?(commitment) params << query_blockhash params << params_hash unless params_hash.empty? body = create_json_body(method, method_params: params) send_request(body, http_method) end |
#get_fee_for_message(message, commitment: nil) ⇒ Response, ApiError
NEW: This method is only available in solana-core v1.9 or newer. Please use getFees for solana-core v1.8
Get the fee the network will charge for a particular Message
341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 |
# File 'lib/solana_rpc_ruby/methods_wrapper.rb', line 341 def (, commitment: nil) http_method = :post method = create_method_name(__method__) params = [] params_hash = {} params << params_hash['commitment'] = commitment unless blank?(commitment) params << params_hash unless params_hash.empty? body = create_json_body(method, method_params: params) send_request(body, http_method) end |
#get_fee_rate_governor ⇒ Response, ApiError
Please check solana docs for substitution.
Returns the fee rate governor information from the root bank
1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 |
# File 'lib/solana_rpc_ruby/methods_wrapper.rb', line 1420 def get_fee_rate_governor warn "DEPRECATED Please check solana docs for substitution." http_method = :post method = create_method_name(__method__) body = create_json_body(method) send_request(body, http_method) end |
#get_fees(commitment: nil) ⇒ Response, ApiError
DEPRECATED: Please use getFeeForMessage instead This method is expected to be removed in solana-core v2.0
Returns a recent block hash from the ledger, a fee schedule that can be used to compute the cost of submitting a transaction using it, and the last slot in which the blockhash will be valid.
1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 |
# File 'lib/solana_rpc_ruby/methods_wrapper.rb', line 1441 def get_fees(commitment: nil) warn "DEPRECATED: Please use getFeeForMessage instead This method is expected to be removed in solana-core v2.0" http_method = :post method = create_method_name(__method__) params = [] params_hash = {} params_hash['commitment'] = commitment unless blank?(commitment) params << params_hash unless params_hash.empty? body = create_json_body(method, method_params: params) send_request(body, http_method) end |
#get_first_available_block ⇒ Response, ApiError
Returns the slot of the lowest confirmed block that has not been purged from the ledger
362 363 364 365 366 367 368 369 |
# File 'lib/solana_rpc_ruby/methods_wrapper.rb', line 362 def get_first_available_block http_method = :post method = create_method_name(__method__) body = create_json_body(method) send_request(body, http_method) end |
#get_genesis_hash ⇒ Response, ApiError
Returns the genesis hash.
376 377 378 379 380 381 382 383 |
# File 'lib/solana_rpc_ruby/methods_wrapper.rb', line 376 def get_genesis_hash http_method = :post method = create_method_name(__method__) body = create_json_body(method) send_request(body, http_method) end |
#get_health ⇒ Response, ApiError
Returns the current health of the node.
390 391 392 393 394 395 396 397 |
# File 'lib/solana_rpc_ruby/methods_wrapper.rb', line 390 def get_health http_method = :post method = create_method_name(__method__) body = create_json_body(method) send_request(body, http_method) end |
#get_highest_snapshot_slot ⇒ Response, ApiError
NEW: This method is only available in solana-core v1.9 or newer. Please use getSnapshotSlot for solana-core v1.8
Returns the highest slot information that the node has snapshots for. This will find the highest full snapshot slot, and the highest incremental snapshot slot based on the full snapshot slot, if there is one.
407 408 409 410 411 412 413 414 |
# File 'lib/solana_rpc_ruby/methods_wrapper.rb', line 407 def get_highest_snapshot_slot http_method = :post method = create_method_name(__method__) body = create_json_body(method) send_request(body, http_method) end |
#get_identity ⇒ Response, ApiError
Returns the identity pubkey for the current node.
421 422 423 424 425 426 427 428 |
# File 'lib/solana_rpc_ruby/methods_wrapper.rb', line 421 def get_identity http_method = :post method = create_method_name(__method__) body = create_json_body(method) send_request(body, http_method) end |
#get_inflation_governor(commitment: nil) ⇒ Response, ApiError
Returns the current inflation governor.
437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 |
# File 'lib/solana_rpc_ruby/methods_wrapper.rb', line 437 def get_inflation_governor(commitment: nil) http_method = :post method = create_method_name(__method__) params = [] params_hash = {} params_hash['commitment'] = commitment unless blank?(commitment) params << params_hash unless params_hash.empty? body = create_json_body(method, method_params: params) send_request(body, http_method) end |
#get_inflation_rate ⇒ Response, ApiError
Returns the specific inflation values for the current epoch.
458 459 460 461 462 463 464 465 |
# File 'lib/solana_rpc_ruby/methods_wrapper.rb', line 458 def get_inflation_rate http_method = :post method = create_method_name(__method__) body = create_json_body(method) send_request(body, http_method) end |
#get_inflation_reward(addresses, commitment: nil, epoch: nil) ⇒ Response, ApiError
Returns the inflation reward for a list of addresses for an epoch.
476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 |
# File 'lib/solana_rpc_ruby/methods_wrapper.rb', line 476 def get_inflation_reward(addresses, commitment: nil, epoch: nil) http_method = :post method = create_method_name(__method__) params = [] params_hash = {} params << addresses params_hash['commitment'] = commitment unless blank?(commitment) params_hash['epoch'] = epoch unless epoch.nil? params << params_hash unless params_hash.empty? body = create_json_body(method, method_params: params) send_request(body, http_method) end |
#get_largest_accounts(commitment: nil, filter: '') ⇒ Response, ApiError
Returns the 20 largest accounts, by lamport balance (results may be cached up to two hours)
503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 |
# File 'lib/solana_rpc_ruby/methods_wrapper.rb', line 503 def get_largest_accounts(commitment: nil, filter: '') http_method = :post method = create_method_name(__method__) params = [] params_hash = {} params_hash['commitment'] = commitment unless blank?(commitment) params_hash['filter'] = filter unless filter.empty? params << params_hash unless params_hash.empty? body = create_json_body(method, method_params: params) send_request(body, http_method) end |
#get_latest_blockhash(commitment: nil) ⇒ Response, ApiError
NEW: This method is only available in solana-core v1.9 or newer. Please use getRecentBlockhash for solana-core v1.8
Returns the latest blockhash.
528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 |
# File 'lib/solana_rpc_ruby/methods_wrapper.rb', line 528 def get_latest_blockhash(commitment: nil) http_method = :post method = create_method_name(__method__) params = [] params_hash = {} params_hash['commitment'] = commitment unless blank?(commitment) params << params_hash unless params_hash.empty? body = create_json_body(method, method_params: params) send_request(body, http_method) end |
#get_leader_schedule(epoch: nil, commitment: nil, identity: '') ⇒ Response, ApiError
Returns the leader schedule for an epoch.
553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 |
# File 'lib/solana_rpc_ruby/methods_wrapper.rb', line 553 def get_leader_schedule(epoch: nil, commitment: nil, identity: '') http_method = :post method = create_method_name(__method__) params = [] params_hash = {} params_hash['epoch'] = epoch unless epoch.nil? params_hash['identity'] = identity unless identity.empty? params_hash['commitment'] = commitment unless blank?(commitment) params << params_hash unless params_hash.empty? body = create_json_body(method, method_params: params) send_request(body, http_method) end |
#get_max_retransmit_slot ⇒ Response, ApiError
Get the max slot seen from retransmit stage.
576 577 578 579 580 581 582 583 |
# File 'lib/solana_rpc_ruby/methods_wrapper.rb', line 576 def get_max_retransmit_slot http_method = :post method = create_method_name(__method__) body = create_json_body(method) send_request(body, http_method) end |
#get_max_shred_insert_slot ⇒ Response, ApiError
Get the max slot seen from after shred insert.
589 590 591 592 593 594 595 596 |
# File 'lib/solana_rpc_ruby/methods_wrapper.rb', line 589 def get_max_shred_insert_slot http_method = :post method = create_method_name(__method__) body = create_json_body(method) send_request(body, http_method) end |
#get_minimum_balance_for_rent_exemption(account_data_length, commitment: nil) ⇒ Response, ApiError
Returns minimum balance required to make account rent exempt.
606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 |
# File 'lib/solana_rpc_ruby/methods_wrapper.rb', line 606 def get_minimum_balance_for_rent_exemption( account_data_length, commitment: nil ) http_method = :post method = create_method_name(__method__) params = [] params_hash = {} params_hash['commitment'] = commitment unless blank?(commitment) params << account_data_length params << params_hash unless params_hash.empty? body = create_json_body(method, method_params: params) send_request(body, http_method) end |
#get_multiple_accounts(pubkeys, commitment: nil, encoding: '', data_slice: {}) ⇒ Response, ApiError
Returns the account information for a list of Pubkeys.
638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 |
# File 'lib/solana_rpc_ruby/methods_wrapper.rb', line 638 def get_multiple_accounts( pubkeys, commitment: nil, encoding: '', data_slice: {} ) http_method = :post method = create_method_name(__method__) params = [] params_hash = {} params_hash['commitment'] = commitment unless blank?(commitment) params_hash['encoding'] = encoding unless blank?(encoding) params_hash['dataSlice'] = data_slice unless data_slice.empty? params << pubkeys params << params_hash unless params_hash.empty? body = create_json_body(method, method_params: params) send_request(body, http_method) end |
#get_program_accounts(pubkey, commitment: nil, encoding: '', data_slice: {}, filters: [], with_context: false) ⇒ Response, ApiError
Returns all accounts owned by the provided program Pubkey
681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 |
# File 'lib/solana_rpc_ruby/methods_wrapper.rb', line 681 def get_program_accounts( pubkey, commitment: nil, encoding: '', data_slice: {}, filters: [], with_context: false ) http_method = :post method = create_method_name(__method__) params = [] params_hash = {} params_hash['commitment'] = commitment unless blank?(commitment) params_hash['encoding'] = encoding unless blank?(encoding) params_hash['dataSlice'] = data_slice unless data_slice.empty? params_hash['filters'] = filters unless filters.empty? params_hash['withContext'] = with_context params << pubkey params << params_hash unless params_hash.empty? body = create_json_body(method, method_params: params) send_request(body, http_method) end |
#get_recent_blockhash(commitment: nil) ⇒ Response, ApiError
Returns a recent block hash from the ledger, and a fee schedule that can be used to compute the cost of submitting a transaction using it.
1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 |
# File 'lib/solana_rpc_ruby/methods_wrapper.rb', line 1468 def get_recent_blockhash(commitment: nil) warn "DEPRECATED: Please use getFeeForMessage instead This method is expected to be removed in solana-core v2.0" http_method = :post method = create_method_name(__method__) params = [] params_hash = {} params_hash['commitment'] = commitment unless blank?(commitment) params << params_hash unless params_hash.empty? body = create_json_body(method, method_params: params) send_request(body, http_method) end |
#get_recent_performance_samples(limit: nil) ⇒ Response, ApiError
Returns a list of recent performance samples, in reverse slot order. Performance samples are taken every 60 seconds and include the number of transactions and slots that occur in a given time window.
717 718 719 720 721 722 723 724 725 726 727 728 |
# File 'lib/solana_rpc_ruby/methods_wrapper.rb', line 717 def get_recent_performance_samples(limit: nil) http_method = :post method = create_method_name(__method__) params = [] params << limit unless limit.nil? body = create_json_body(method, method_params: params) send_request(body, http_method) end |
#get_signature_statuses(transaction_signatures, search_transaction_history: false) ⇒ Response, ApiError
Returns the statuses of a list of signatures. Unless the searchTransactionHistory configuration parameter is included, this method only searches the recent status cache of signatures, which retains statuses for all active slots plus MAX_RECENT_BLOCKHASHES rooted slots.
781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 |
# File 'lib/solana_rpc_ruby/methods_wrapper.rb', line 781 def get_signature_statuses( transaction_signatures, search_transaction_history: false ) http_method = :post method = create_method_name(__method__) params = [] params_hash = {} params_hash['searchTransactionHistory'] = search_transaction_history unless search_transaction_history.nil? params << transaction_signatures params << params_hash unless params_hash.empty? body = create_json_body(method, method_params: params) send_request(body, http_method) end |
#get_signatures_for_address(account_address, limit: nil, before: '', until_: '', commitment: nil) ⇒ Response, ApiError
NEW: This method is only available in solana-core v1.7 or newer. Please use getConfirmedSignaturesForAddress2 for solana-core v1.6
Returns confirmed signatures for transactions involving an address backwards in time from the provided signature or most recent confirmed block
744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 |
# File 'lib/solana_rpc_ruby/methods_wrapper.rb', line 744 def get_signatures_for_address( account_address, limit: nil, before: '', until_: '', commitment: nil ) http_method = :post method = create_method_name(__method__) params = [] params_hash = {} params_hash['limit'] = limit unless limit.nil? params_hash['before'] = before unless before.empty? params_hash['until'] = until_ unless until_.empty? params_hash['commitment'] = commitment unless blank?(commitment) params << account_address params << params_hash unless params_hash.empty? body = create_json_body(method, method_params: params) send_request(body, http_method) end |
#get_slot(commitment: nil) ⇒ Response, ApiError
Returns the current slot the node is processing.
808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 |
# File 'lib/solana_rpc_ruby/methods_wrapper.rb', line 808 def get_slot(commitment: nil) http_method = :post method = create_method_name(__method__) params = [] params_hash = {} params_hash['commitment'] = commitment unless blank?(commitment) params << params_hash unless params_hash.empty? body = create_json_body(method, method_params: params) send_request(body, http_method) end |
#get_slot_leader(commitment: nil) ⇒ Response, ApiError
Returns the current slot leader
831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 |
# File 'lib/solana_rpc_ruby/methods_wrapper.rb', line 831 def get_slot_leader(commitment: nil) http_method = :post method = create_method_name(__method__) params = [] params_hash = {} params_hash['commitment'] = commitment unless blank?(commitment) params << params_hash unless params_hash.empty? body = create_json_body(method, method_params: params) send_request(body, http_method) end |
#get_slot_leaders(start_slot, limit) ⇒ Response, ApiError
Returns the slot leaders for a given slot range.
855 856 857 858 859 860 861 862 863 864 |
# File 'lib/solana_rpc_ruby/methods_wrapper.rb', line 855 def get_slot_leaders(start_slot, limit) http_method = :post method = create_method_name(__method__) params = [start_slot, limit] body = create_json_body(method, method_params: params) send_request(body, http_method) end |
#get_snapshot_slot ⇒ Response, ApiError
Please use getHighestSnapshotSlot instead This method is expected to be removed in solana-core v2.0
Returns the highest slot that the node has a snapshot for.
1492 1493 1494 1495 1496 1497 1498 1499 1500 |
# File 'lib/solana_rpc_ruby/methods_wrapper.rb', line 1492 def get_snapshot_slot warn "DEPRECATED: Please use getHighestSnapshotSlot instead This method is expected to be removed in solana-core v2.0" http_method = :post method = create_method_name(__method__) body = create_json_body(method) send_request(body, http_method) end |
#get_stake_activation(pubkey, commitment: nil, epoch: nil) ⇒ Response, ApiError
Returns epoch activation information for a stake account.
875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 |
# File 'lib/solana_rpc_ruby/methods_wrapper.rb', line 875 def get_stake_activation(pubkey, commitment: nil, epoch: nil) http_method = :post method = create_method_name(__method__) params = [] params_hash = {} params_hash['commitment'] = commitment unless blank?(commitment) params_hash['epoch'] = epoch unless epoch.nil? params << pubkey params << params_hash unless params_hash.empty? body = create_json_body(method, method_params: params) send_request(body, http_method) end |
#get_supply(commitment: nil, exclude_non_circulating_accounts_list: nil) ⇒ Response, ApiError
Returns information about the current supply.
901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 |
# File 'lib/solana_rpc_ruby/methods_wrapper.rb', line 901 def get_supply(commitment: nil, exclude_non_circulating_accounts_list: nil) http_method = :post method = create_method_name(__method__) params = [] params_hash = {} params_hash['commitment'] = commitment unless blank?(commitment) params_hash['exclude_non_circulating_accounts_list'] = exclude_non_circulating_accounts_list \ unless exclude_non_circulating_accounts_list.nil? params << params_hash unless params_hash.empty? body = create_json_body(method, method_params: params) send_request(body, http_method) end |
#get_token_account_balance(token_account_pubkey, commitment: nil) ⇒ Response, ApiError
Returns the token balance of an SPL Token account.
927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 |
# File 'lib/solana_rpc_ruby/methods_wrapper.rb', line 927 def get_token_account_balance(token_account_pubkey, commitment: nil) http_method = :post method = create_method_name(__method__) params = [] params_hash = {} params_hash['commitment'] = commitment unless blank?(commitment) params << token_account_pubkey params << params_hash unless params_hash.empty? body = create_json_body(method, method_params: params) send_request(body, http_method) end |
#get_token_accounts_by_delegate(token_account_pubkey, mint: '', program_id: '', commitment: nil, encoding: '', data_slice: {}) ⇒ Response, ApiError
Returns all SPL Token accounts by approved Delegate.
IMPORTANT: According to docs there should be mint or program_id passed in, not both.
960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 |
# File 'lib/solana_rpc_ruby/methods_wrapper.rb', line 960 def get_token_accounts_by_delegate( token_account_pubkey, mint: '', program_id: '', commitment: nil, encoding: '', data_slice: {} ) raise ArgumentError, 'You should pass mint or program_id, not both.' if !blank?(mint) && !blank?(program_id) http_method = :post method = create_method_name(__method__) params = [] params_hash = {} params_hash_2 = {} params_hash['mint'] = mint unless blank?(mint) params_hash['programId'] = program_id unless blank?(program_id) params_hash_2['commitment'] = commitment unless blank?(commitment) params_hash_2['encoding'] = encoding unless blank?(encoding) params_hash_2['dataSlice'] = data_slice unless blank?(data_slice) params << token_account_pubkey params << params_hash unless params_hash.empty? params << params_hash_2 if params_hash_2.any? body = create_json_body(method, method_params: params) send_request(body, http_method) end |
#get_token_accounts_by_owner(token_account_pubkey, mint: '', program_id: '', commitment: nil, encoding: '', data_slice: {}) ⇒ Response, ApiError
Returns all SPL Token accounts by token owner.
IMPORTANT: According to docs there should be mint or program_id passed in, not both.
1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 |
# File 'lib/solana_rpc_ruby/methods_wrapper.rb', line 1010 def get_token_accounts_by_owner( token_account_pubkey, mint: '', program_id: '', commitment: nil, encoding: '', data_slice: {} ) raise ArgumentError, 'You should pass mint or program_id, not both.' if !mint.empty? && !program_id.empty? http_method = :post method = create_method_name(__method__) params = [] params_hash = {} params_hash_2 = {} param_data_slice = {} params_hash['mint'] = mint unless mint.empty? params_hash['programId'] = program_id unless program_id.empty? params_hash_2['commitment'] = commitment unless blank?(commitment) params_hash_2['encoding'] = encoding unless blank?(encoding) params_hash_2['dataSlice'] = data_slice unless data_slice.empty? params << token_account_pubkey params << params_hash unless params_hash.empty? params << params_hash_2 unless params_hash_2.empty? body = create_json_body(method, method_params: params) send_request(body, http_method) end |
#get_token_largest_accounts(token_mint_pubkey, commitment: nil) ⇒ Response, ApiError
Returns the 20 largest accounts of a particular SPL Token type.
1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 |
# File 'lib/solana_rpc_ruby/methods_wrapper.rb', line 1053 def get_token_largest_accounts( token_mint_pubkey, commitment: nil ) http_method = :post method = create_method_name(__method__) params = [] params_hash = {} params_hash['commitment'] = commitment unless blank?(commitment) params << token_mint_pubkey params << params_hash unless params_hash.empty? body = create_json_body(method, method_params: params) send_request(body, http_method) end |
#get_token_supply(token_mint_pubkey, commitment: nil) ⇒ Response, ApiError
Returns the total supply of an SPL Token type.
1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 |
# File 'lib/solana_rpc_ruby/methods_wrapper.rb', line 1082 def get_token_supply( token_mint_pubkey, commitment: nil ) http_method = :post method = create_method_name(__method__) params = [] params_hash = {} params_hash['commitment'] = commitment unless blank?(commitment) params << token_mint_pubkey params << params_hash unless params_hash.empty? body = create_json_body(method, method_params: params) send_request(body, http_method) end |
#get_transaction(transaction_signature, encoding: '', commitment: nil) ⇒ Response, ApiError
Returns transaction details for a confirmed transaction
1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 |
# File 'lib/solana_rpc_ruby/methods_wrapper.rb', line 1112 def get_transaction(transaction_signature, encoding: '', commitment: nil) http_method = :post method = create_method_name(__method__) params = [] params_hash = {} params_hash['commitment'] = commitment unless blank?(commitment) params_hash['encoding'] = encoding unless blank?(encoding) params << transaction_signature params << params_hash unless params_hash.empty? body = create_json_body(method, method_params: params) send_request(body, http_method) end |
#get_transaction_count(commitment: nil) ⇒ Response, ApiError
Returns the current Transaction count from the ledger
1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 |
# File 'lib/solana_rpc_ruby/methods_wrapper.rb', line 1137 def get_transaction_count(commitment: nil) http_method = :post method = create_method_name(__method__) params = [] params_hash = {} params_hash['commitment'] = commitment unless blank?(commitment) params << params_hash unless params_hash.empty? body = create_json_body(method, method_params: params) send_request(body, http_method) end |
#get_version ⇒ Response, ApiError
Returns the current solana versions running on the node.
1158 1159 1160 1161 1162 1163 1164 1165 |
# File 'lib/solana_rpc_ruby/methods_wrapper.rb', line 1158 def get_version http_method = :post method = create_method_name(__method__) body = create_json_body(method) send_request(body, http_method) end |
#get_vote_accounts(commitment: nil, vote_pubkey: nil, keep_unstaked_delinquents: nil, delinquent_slot_distance: nil) ⇒ Response, ApiError
Returns the account info and associated stake for all the voting accounts in the current bank.
1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 |
# File 'lib/solana_rpc_ruby/methods_wrapper.rb', line 1177 def get_vote_accounts( commitment: nil, vote_pubkey: nil, keep_unstaked_delinquents: nil, delinquent_slot_distance: nil ) http_method = :post method = create_method_name(__method__) params = [] params_hash = {} params_hash['votePubkey'] = vote_pubkey unless blank?(vote_pubkey) params_hash['commitment'] = commitment unless blank?(commitment) params_hash['keep_unstaked_delinquents'] = keep_unstaked_delinquents unless keep_unstaked_delinquents.nil? params_hash['delinquent_slot_distance'] = delinquent_slot_distance unless blank?(delinquent_slot_distance) params << params_hash unless params_hash.empty? body = create_json_body(method, method_params: params) send_request(body, http_method) end |
#is_blockhash_valid(blockhash, commitment: nil) ⇒ Response, ApiError
NEW: This method is only available in solana-core v1.9 or newer. Please use getFeeCalculatorForBlockhash for solana-core v1.8
Returns whether a blockhash is still valid or not.
1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 |
# File 'lib/solana_rpc_ruby/methods_wrapper.rb', line 1210 def is_blockhash_valid(blockhash, commitment: nil) http_method = :post method = create_method_name(__method__) params = [] params_hash = {} params_hash['commitment'] = commitment unless blank?(commitment) params << blockhash params << params_hash unless params_hash.empty? body = create_json_body(method, method_params: params) send_request(body, http_method) end |
#minimum_ledger_slot ⇒ Response, ApiError
Returns the lowest slot that the node has information about in its ledger. This value may increase over time if the node is configured to purge older ledger data
1233 1234 1235 1236 1237 1238 1239 1240 |
# File 'lib/solana_rpc_ruby/methods_wrapper.rb', line 1233 def minimum_ledger_slot http_method = :post method = create_method_name(__method__) body = create_json_body(method) send_request(body, http_method) end |
#request_airdrop(pubkey, lamports, commitment: nil) ⇒ Response, ApiError
Requests an airdrop of lamports to a Pubkey
1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 |
# File 'lib/solana_rpc_ruby/methods_wrapper.rb', line 1251 def request_airdrop(pubkey, lamports, commitment: nil) http_method = :post method = create_method_name(__method__) params = [] params_hash = {} params_hash['commitment'] = commitment unless blank?(commitment) params << pubkey params << lamports params << params_hash unless params_hash.empty? body = create_json_body(method, method_params: params) send_request(body, http_method) end |
#send_transaction(transaction_signature, skip_pre_flight: false, pre_flight_commitment: nil, encoding: '', max_retries: nil) ⇒ Response, ApiError
Submits a signed transaction to the cluster for processing.
1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 |
# File 'lib/solana_rpc_ruby/methods_wrapper.rb', line 1279 def send_transaction( transaction_signature, skip_pre_flight: false, pre_flight_commitment: nil, encoding: '', max_retries: nil ) http_method = :post method = create_method_name(__method__) params = [] params_hash = {} params_hash['skipPreFlight'] = skip_pre_flight unless skip_pre_flight.nil? params_hash['preflightCommitment'] = pre_flight_commitment unless blank?(pre_flight_commitment) params_hash['encoding'] = encoding unless blank?(encoding) params_hash['max_retries'] = max_retries unless blank?(max_retries) params << transaction_signature params << params_hash unless params_hash.empty? body = create_json_body(method, method_params: params) send_request(body, http_method) end |
#simulate_transaction(transaction_signature, accounts_addresses, sig_verify: false, commitment: nil, encoding: '', replace_recent_blockhash: false, accounts_encoding: '') ⇒ Response, ApiError
Simulate sending a transaction accounts_addresses should be an empty array (?)
1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 |
# File 'lib/solana_rpc_ruby/methods_wrapper.rb', line 1320 def simulate_transaction( transaction_signature, accounts_addresses, sig_verify: false, commitment: nil, encoding: '', replace_recent_blockhash: false, accounts_encoding: '' ) raise ArgumentError, 'Params sig_verify and replace_recent_blockhash cannot both be set to true.' \ if sig_verify && replace_recent_blockhash http_method = :post method = create_method_name(__method__) params = [] params_hash = {} params_hash['accounts'] = {} params_hash['accounts']['addresses'] = accounts_addresses params_hash['accounts']['encoding'] = accounts_encoding unless blank?(accounts_encoding) params_hash['sigVerify'] = sig_verify unless sig_verify.nil? params_hash['commitment'] = commitment unless blank?(commitment) params_hash['encoding'] = encoding unless blank?(encoding) params_hash['replaceRecentBlockhash'] = replace_recent_blockhash unless replace_recent_blockhash.nil? params << transaction_signature params << params_hash unless params_hash.empty? body = create_json_body(method, method_params: params) send_request(body, http_method) end |