Class: Solana::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/solana-ruby/client.rb

Overview

Client class for interacting with the Solana JSON RPC API over HTTP and WS.

Instance Method Summary collapse

Constructor Details

#initialize(api_endpoint = Solana::Utils::MAINNET) ⇒ Client

Initializes a new Client.

Parameters:

  • api_endpoint (String, nil) (defaults to: Solana::Utils::MAINNET)

    Optional API endpoint. Mainnet by default



16
17
18
# File 'lib/solana-ruby/client.rb', line 16

def initialize(api_endpoint = Solana::Utils::MAINNET)
  @api_endpoint = api_endpoint
end

Instance Method Details

#account_subscribe(pubkey, options = {}) {|Object| ... } ⇒ Object

Subscribes to account changes.

Parameters:

  • pubkey (String)

    The public key of the account.

  • options (Hash) (defaults to: {})

    Optional parameters for the subscription.

Yields:

  • (Object)

    The response from the subscription.



524
525
526
# File 'lib/solana-ruby/client.rb', line 524

def (pubkey, options = {}, &block)
  request_ws('accountSubscribe', [pubkey, options], &block)
end

#account_unsubscribe(subscription_id) {|Object| ... } ⇒ Object

Unsubscribes from account changes.

Parameters:

  • subscription_id (Integer)

    The subscription ID.

Yields:

  • (Object)

    The response from the unsubscription.



533
534
535
# File 'lib/solana-ruby/client.rb', line 533

def (subscription_id, &block)
  request_ws('accountUnsubscribe', [subscription_id], &block)
end

#block_subscribe(filter, options = {}) {|Object| ... } ⇒ Object

Subscribes to new blocks.

Parameters:

  • options (Hash) (defaults to: {})

    Optional parameters for the subscription.

Yields:

  • (Object)

    The response from the subscription.



542
543
544
# File 'lib/solana-ruby/client.rb', line 542

def block_subscribe(filter, options = {}, &block)
  request_ws('blockSubscribe', [filter, options], &block)
end

#block_unsubscribe(subscription_id) {|Object| ... } ⇒ Object

Unsubscribes from new blocks.

Parameters:

  • subscription_id (Integer)

    The subscription ID.

Yields:

  • (Object)

    The response from the unsubscription.



551
552
553
# File 'lib/solana-ruby/client.rb', line 551

def block_unsubscribe(subscription_id, &block)
  request_ws('blockUnsubscribe', [subscription_id], &block)
end

#get_account_info(pubkey, options = {}, &block) ⇒ Hash

Retrieves account information for a given public key.

Parameters:

  • pubkey (String)

    The public key of the account.

  • options (Hash) (defaults to: {})

    Optional parameters for the request.

Returns:

  • (Hash)

    The account information.



26
27
28
# File 'lib/solana-ruby/client.rb', line 26

def (pubkey, options = {}, &block)
  request_http('getAccountInfo', [pubkey, options], &block)
end

#get_balance(pubkey, options = {}, &block) ⇒ Integer

Retrieves the balance for a given public key.

Parameters:

  • pubkey (String)

    The public key of the account.

  • options (Hash) (defaults to: {})

    Optional parameters for the request.

Returns:

  • (Integer)

    The balance in lamports.



36
37
38
# File 'lib/solana-ruby/client.rb', line 36

def get_balance(pubkey, options = {}, &block)
  request_http('getBalance', [pubkey, options], &block)
end

#get_block(slot_number, options = {}, &block) ⇒ Hash

Retrieves information about a specific block.

Parameters:

  • slot_number (Integer)

    The slot number of the block.

  • options (Hash) (defaults to: {})

    Optional parameters for the request.

Returns:

  • (Hash)

    The block information.



46
47
48
# File 'lib/solana-ruby/client.rb', line 46

def get_block(slot_number, options = {}, &block)
  request_http('getBlock', [slot_number, options], &block)
end

#get_block_commitment(slot_number, options = {}, &block) ⇒ Hash

Retrieves block commitment information for a specific block.

Parameters:

  • slot_number (Integer)

    The slot number of the block.

  • options (Hash) (defaults to: {})

    Optional parameters for the request.

Returns:

  • (Hash)

    The block commitment information.



56
57
58
# File 'lib/solana-ruby/client.rb', line 56

def get_block_commitment(slot_number, options = {}, &block)
  request_http('getBlockCommitment', [slot_number, options], &block)
end

#get_block_height(options = {}, &block) ⇒ Integer

Retrieves the current block height.

Parameters:

  • options (Hash) (defaults to: {})

    Optional parameters for the request.

Returns:

  • (Integer)

    The current block height.



65
66
67
# File 'lib/solana-ruby/client.rb', line 65

def get_block_height(options = {}, &block)
  request_http('getBlockHeight', [options], &block)
end

#get_block_production(options = {}, &block) ⇒ Hash

Retrieves block production information.

Parameters:

  • options (Hash) (defaults to: {})

    Optional parameters for the request.

Returns:

  • (Hash)

    The block production information.



74
75
76
# File 'lib/solana-ruby/client.rb', line 74

def get_block_production(options = {}, &block)
  request_http('getBlockProduction', [options], &block)
end

#get_block_time(slot_number, &block) ⇒ Integer

Retrieves the estimated production time of a specific block.

Parameters:

  • slot_number (Integer)

    The slot number of the block.

Returns:

  • (Integer)

    The estimated production time in seconds.



83
84
85
# File 'lib/solana-ruby/client.rb', line 83

def get_block_time(slot_number, &block)
  request_http('getBlockTime', [slot_number], &block)
end

#get_blocks(start_slot, options = {}, &block) ⇒ Array<Integer>

Retrieves a list of confirmed blocks between two slot numbers.

Parameters:

  • start_slot (Integer)

    The start slot number.

  • options (Hash) (defaults to: {})

    Optional parameters for the request.

Returns:

  • (Array<Integer>)

    The list of confirmed blocks.



93
94
95
# File 'lib/solana-ruby/client.rb', line 93

def get_blocks(start_slot, options = {}, &block)
  request_http('getBlocks', [start_slot, options], &block)
end

#get_blocks_with_limit(start_slot, limit, options = {}, &block) ⇒ Array<Integer>

Retrieves a list of confirmed blocks starting from a given slot number with a limit on the number of blocks.

Parameters:

  • start_slot (Integer)

    The start slot number.

  • limit (Integer)

    The maximum number of blocks to return.

  • options (Hash) (defaults to: {})

    Optional parameters for the request.

Returns:

  • (Array<Integer>)

    The list of confirmed blocks.



104
105
106
# File 'lib/solana-ruby/client.rb', line 104

def get_blocks_with_limit(start_slot, limit, options = {}, &block)
  request_http('getBlocksWithLimit', [start_slot, limit, options], &block)
end

#get_cluster_nodes(&block) ⇒ Array<Hash>

Retrieves the list of cluster nodes.

Returns:

  • (Array<Hash>)

    The list of cluster nodes.



112
113
114
# File 'lib/solana-ruby/client.rb', line 112

def get_cluster_nodes(&block)
  request_http('getClusterNodes', &block)
end

#get_epoch_info(options = {}, &block) ⇒ Hash

Retrieves epoch information.

Parameters:

  • options (Hash) (defaults to: {})

    Optional parameters for the request.

Returns:

  • (Hash)

    The epoch information.



121
122
123
# File 'lib/solana-ruby/client.rb', line 121

def get_epoch_info(options = {}, &block)
  request_http('getEpochInfo', [options], &block)
end

#get_epoch_schedule(&block) ⇒ Hash

Retrieves the epoch schedule.

Returns:

  • (Hash)

    The epoch schedule.



129
130
131
# File 'lib/solana-ruby/client.rb', line 129

def get_epoch_schedule(&block)
  request_http('getEpochSchedule', &block)
end

#get_fee_for_message(message, options = {}, &block) ⇒ Integer

Retrieves the fee for a given message.

Parameters:

  • message (String)

    The message for which the fee is to be calculated.

  • options (Hash) (defaults to: {})

    Optional parameters for the request.

Returns:

  • (Integer)

    The fee for the message.



139
140
141
# File 'lib/solana-ruby/client.rb', line 139

def get_fee_for_message(message, options = {}, &block)
  request_http('getFeeForMessage', [message, options], &block)
end

#get_first_available_block(&block) ⇒ Integer

Retrieves the slot of the first available block.

Returns:

  • (Integer)

    The slot of the first available block.



147
148
149
# File 'lib/solana-ruby/client.rb', line 147

def get_first_available_block(&block)
  request_http('getFirstAvailableBlock', &block)
end

#get_genesis_hash(&block) ⇒ String

Retrieves the genesis hash.

Returns:

  • (String)

    The genesis hash.



155
156
157
# File 'lib/solana-ruby/client.rb', line 155

def get_genesis_hash(&block)
  request_http('getGenesisHash', &block)
end

#get_health(&block) ⇒ String

Checks the health of the node.

Returns:

  • (String)

    The health status of the node.



163
164
165
# File 'lib/solana-ruby/client.rb', line 163

def get_health(&block)
  request_http('getHealth', &block)
end

#get_highest_snapshot_slot(&block) ⇒ Integer

Retrieves the highest snapshot slot.

Returns:

  • (Integer)

    The highest snapshot slot.



171
172
173
# File 'lib/solana-ruby/client.rb', line 171

def get_highest_snapshot_slot(&block)
  request_http('getHighestSnapshotSlot', &block)
end

#get_identity(&block) ⇒ Hash

Retrieves the identity of the node.

Returns:

  • (Hash)

    The identity information of the node.



179
180
181
# File 'lib/solana-ruby/client.rb', line 179

def get_identity(&block)
  request_http('getIdentity', &block)
end

#get_inflation_governor(options = {}, &block) ⇒ Hash

Retrieves the current inflation governor settings.

Parameters:

  • options (Hash) (defaults to: {})

    Optional parameters for the request.

Returns:

  • (Hash)

    The inflation governor settings.



188
189
190
# File 'lib/solana-ruby/client.rb', line 188

def get_inflation_governor(options = {}, &block)
  request_http('getInflationGovernor', [options], &block)
end

#get_inflation_rate(&block) ⇒ Hash

Retrieves the current inflation rate.

Returns:

  • (Hash)

    The inflation rate.



196
197
198
# File 'lib/solana-ruby/client.rb', line 196

def get_inflation_rate(&block)
  request_http('getInflationRate', &block)
end

#get_inflation_reward(addresses, options = {}, &block) ⇒ Array<Hash>

Retrieves the inflation reward for a given list of addresses.

Parameters:

  • addresses (Array<String>)

    The list of addresses.

  • options (Hash) (defaults to: {})

    Optional parameters for the request.

Returns:

  • (Array<Hash>)

    The inflation rewards for the addresses.



206
207
208
# File 'lib/solana-ruby/client.rb', line 206

def get_inflation_reward(addresses, options = {}, &block)
  request_http('getInflationReward', [addresses, options], &block)
end

#get_largest_accounts(options = {}, &block) ⇒ Array<Hash>

Retrieves the largest accounts.

Parameters:

  • options (Hash) (defaults to: {})

    Optional parameters for the request.

Returns:

  • (Array<Hash>)

    The largest accounts.



215
216
217
# File 'lib/solana-ruby/client.rb', line 215

def get_largest_accounts(options = {}, &block)
  request_http('getLargestAccounts', [options], &block)
end

#get_latest_blockhash(options = {}, &block) ⇒ Hash

Retrieves the latest blockhash.

Parameters:

  • options (Hash) (defaults to: {})

    Optional parameters for the request.

Returns:

  • (Hash)

    The latest blockhash.



224
225
226
# File 'lib/solana-ruby/client.rb', line 224

def get_latest_blockhash(options = {}, &block)
  request_http('getLatestBlockhash', [options], &block)
end

#get_leader_schedule(slot_number = nil, options = {}, &block) ⇒ Hash

TODO

Retrieves the leader schedule.

Parameters:

  • options (Hash) (defaults to: {})

    Optional parameters for the request.

Returns:

  • (Hash)

    The leader schedule.



234
235
236
# File 'lib/solana-ruby/client.rb', line 234

def get_leader_schedule(slot_number = nil, options = {}, &block)
  request_http('getLeaderSchedule', [slot_number, options], &block)
end

#get_max_retransmit_slot(&block) ⇒ Integer

Retrieves the maximum retransmit slot.

Returns:

  • (Integer)

    The maximum retransmit slot.



242
243
244
# File 'lib/solana-ruby/client.rb', line 242

def get_max_retransmit_slot(&block)
  request_http('getMaxRetransmitSlot', &block)
end

#get_max_shred_insert_slot(&block) ⇒ Integer

Retrieves the maximum shred insert slot.

Returns:

  • (Integer)

    The maximum shred insert slot.



250
251
252
# File 'lib/solana-ruby/client.rb', line 250

def get_max_shred_insert_slot(&block)
  request_http('getMaxShredInsertSlot', &block)
end

#get_minimum_balance_for_rent_exemption(data_length, options = {}, &block) ⇒ Integer

Retrieves the minimum balance required for rent exemption for a given data length.

Parameters:

  • data_length (Integer)

    The length of the data in bytes.

  • options (Hash) (defaults to: {})

    Optional parameters for the request.

Returns:

  • (Integer)

    The minimum balance for rent exemption.



260
261
262
# File 'lib/solana-ruby/client.rb', line 260

def get_minimum_balance_for_rent_exemption(data_length, options = {}, &block)
  request_http('getMinimumBalanceForRentExemption', [data_length, options], &block)
end

#get_multiple_accounts(pubkeys, options = {}, &block) ⇒ Array<Hash>

Retrieves information for multiple accounts.

Parameters:

  • pubkeys (Array<String>)

    The list of public keys.

  • options (Hash) (defaults to: {})

    Optional parameters for the request.

Returns:

  • (Array<Hash>)

    The information for the accounts.



270
271
272
# File 'lib/solana-ruby/client.rb', line 270

def get_multiple_accounts(pubkeys, options = {}, &block)
  request_http('getMultipleAccounts', [pubkeys, options], &block)
end

#get_program_accounts(pubkey, options = {}, &block) ⇒ Array<Hash>

Retrieves information for accounts owned by a specific program.

Parameters:

  • pubkey (String)

    The public key of the program.

  • options (Hash) (defaults to: {})

    Optional parameters for the request.

Returns:

  • (Array<Hash>)

    The information for the program accounts.



280
281
282
# File 'lib/solana-ruby/client.rb', line 280

def get_program_accounts(pubkey, options = {}, &block)
  request_http('getProgramAccounts', [pubkey, options], &block)
end

#get_recent_performance_samples(limit = 720, options = {}, &block) ⇒ Array<Hash>

Retrieves recent performance samples.

Parameters:

  • limit (Integer) (defaults to: 720)

    The number of performance samples to retrieve.

  • options (Hash) (defaults to: {})

    Optional parameters for the request.

Returns:

  • (Array<Hash>)

    The recent performance samples.



290
291
292
# File 'lib/solana-ruby/client.rb', line 290

def get_recent_performance_samples(limit = 720, options = {}, &block)
  request_http('getRecentPerformanceSamples', [limit, options], &block)
end

#get_recent_prioritization_fees(addresses = [], &block) ⇒ Hash

Retrieves recent prioritization fees.

Parameters:

  • addresses (Array<String>) (defaults to: [])

    Optional array of addresses to filter the fees by.

Returns:

  • (Hash)

    The recent prioritization fees.



299
300
301
# File 'lib/solana-ruby/client.rb', line 299

def get_recent_prioritization_fees(addresses = [], &block)
  request_http('getRecentPrioritizationFees', [addresses], &block)
end

#get_signature_statuses(signatures, options = {}, &block) ⇒ Array<Hash>

Retrieves the status of given transaction signatures.

Parameters:

  • signatures (Array<String>)

    The list of transaction signatures.

  • options (Hash) (defaults to: {})

    Optional parameters for the request.

Returns:

  • (Array<Hash>)

    The status of the transaction signatures.



309
310
311
# File 'lib/solana-ruby/client.rb', line 309

def get_signature_statuses(signatures, options = {}, &block)
  request_http('getSignatureStatuses', [signatures, options], &block)
end

#get_signatures_for_address(address, options = {}, &block) ⇒ Array<Hash>

Retrieves the signatures for a given address.

Parameters:

  • address (String)

    The address for which to retrieve signatures.

  • options (Hash) (defaults to: {})

    Optional parameters for the request.

Returns:

  • (Array<Hash>)

    The signatures for the address.



319
320
321
# File 'lib/solana-ruby/client.rb', line 319

def get_signatures_for_address(address, options = {}, &block)
  request_http('getSignaturesForAddress', [address, options], &block)
end

#get_slot(options = {}, &block) ⇒ Integer

Retrieves the current slot.

Parameters:

  • options (Hash) (defaults to: {})

    Optional parameters for the request.

Returns:

  • (Integer)

    The current slot.



328
329
330
# File 'lib/solana-ruby/client.rb', line 328

def get_slot(options = {}, &block)
  request_http('getSlot', [options], &block)
end

#get_slot_leader(options = {}, &block) ⇒ String

Retrieves the current slot leader.

Parameters:

  • options (Hash) (defaults to: {})

    Optional parameters for the request.

Returns:

  • (String)

    The current slot leader.



337
338
339
# File 'lib/solana-ruby/client.rb', line 337

def get_slot_leader(options = {}, &block)
  request_http('getSlotLeader', [options], &block)
end

#get_slot_leaders(start_slot, limit, options = {}, &block) ⇒ Array<String>

Retrieves the slot leaders starting from a given slot with a limit on the number of leaders.

Parameters:

  • start_slot (Integer)

    The start slot number.

  • limit (Integer)

    The maximum number of leaders to return.

  • options (Hash) (defaults to: {})

    Optional parameters for the request.

Returns:

  • (Array<String>)

    The slot leaders.



348
349
350
# File 'lib/solana-ruby/client.rb', line 348

def get_slot_leaders(start_slot, limit, options = {}, &block)
  request_http('getSlotLeaders', [start_slot, limit, options], &block)
end

#get_stake_activation(pubkey, options = {}, &block) ⇒ Hash

Retrieves the stake activation information for a given public key.

Parameters:

  • pubkey (String)

    The public key of the stake account.

  • options (Hash) (defaults to: {})

    Optional parameters for the request.

Returns:

  • (Hash)

    The stake activation information.



358
359
360
# File 'lib/solana-ruby/client.rb', line 358

def get_stake_activation(pubkey, options = {}, &block)
  request_http('getStakeActivation', [pubkey, options], &block)
end

#get_stake_minimum_delegation(options = {}, &block) ⇒ Integer

Retrieves the minimum delegation for a stake account.

Parameters:

  • options (Hash) (defaults to: {})

    Optional parameters for the request.

Returns:

  • (Integer)

    The minimum delegation.



367
368
369
# File 'lib/solana-ruby/client.rb', line 367

def get_stake_minimum_delegation(options = {}, &block)
  request_http('getStakeMinimumDelegation', [options], &block)
end

#get_supply(options = {}, &block) ⇒ Hash

Retrieves the supply information.

Parameters:

  • options (Hash) (defaults to: {})

    Optional parameters for the request.

Returns:

  • (Hash)

    The supply information.



376
377
378
# File 'lib/solana-ruby/client.rb', line 376

def get_supply(options = {}, &block)
  request_http('getSupply', [options], &block)
end

#get_token_account_balance(pubkey, options = {}, &block) ⇒ Hash

Retrieves the token balance for a given token account.

Parameters:

  • pubkey (String)

    The public key of the token account.

  • options (Hash) (defaults to: {})

    Optional parameters for the request.

Returns:

  • (Hash)

    The token balance.



386
387
388
# File 'lib/solana-ruby/client.rb', line 386

def (pubkey, options = {}, &block)
  request_http('getTokenAccountBalance', [pubkey, options], &block)
end

#get_token_accounts_by_delegate(delegate, opts = {}, options = {}, &block) ⇒ Array<Hash>

Retrieves token accounts by delegate.

Parameters:

  • delegate (String)

    The delegate address.

  • opts (Hash) (defaults to: {})

    Additional options for the request.

  • options (Hash) (defaults to: {})

    Optional parameters for the request.

Returns:

  • (Array<Hash>)

    The token accounts by delegate.



397
398
399
# File 'lib/solana-ruby/client.rb', line 397

def get_token_accounts_by_delegate(delegate, opts = {}, options = {}, &block)
  request_http('getTokenAccountsByDelegate', [delegate, opts, options], &block)
end

#get_token_accounts_by_owner(owner, opts = {}, options = {}, &block) ⇒ Array<Hash>

Retrieves token accounts by owner.

Parameters:

  • owner (String)

    The owner address.

  • opts (Hash) (defaults to: {})

    Additional options for the request.

  • options (Hash) (defaults to: {})

    Optional parameters for the request.

Returns:

  • (Array<Hash>)

    The token accounts by owner.



408
409
410
# File 'lib/solana-ruby/client.rb', line 408

def get_token_accounts_by_owner(owner, opts = {}, options = {}, &block)
  request_http('getTokenAccountsByOwner', [owner, opts, options], &block)
end

#get_token_largest_accounts(pubkey, options = {}, &block) ⇒ Array<Hash>

Retrieves the largest accounts for a given token.

Parameters:

  • pubkey (String)

    The public key of the token.

  • options (Hash) (defaults to: {})

    Optional parameters for the request.

Returns:

  • (Array<Hash>)

    The largest accounts for the token.



418
419
420
# File 'lib/solana-ruby/client.rb', line 418

def get_token_largest_accounts(pubkey, options = {}, &block)
  request_http('getTokenLargestAccounts', [pubkey, options], &block)
end

#get_token_supply(pubkey, options = {}, &block) ⇒ Hash

Retrieves the supply of a given token.

Parameters:

  • pubkey (String)

    The public key of the token.

  • options (Hash) (defaults to: {})

    Optional parameters for the request.

Returns:

  • (Hash)

    The token supply.



428
429
430
# File 'lib/solana-ruby/client.rb', line 428

def get_token_supply(pubkey, options = {}, &block)
  request_http('getTokenSupply', [pubkey, options], &block)
end

#get_transaction(signature, options = {}, &block) ⇒ Hash

Retrieves transaction details for a given signature.

Parameters:

  • signature (String)

    The transaction signature.

  • options (Hash) (defaults to: {})

    Optional parameters for the request.

Returns:

  • (Hash)

    The transaction details.



438
439
440
# File 'lib/solana-ruby/client.rb', line 438

def get_transaction(signature, options = {}, &block)
  request_http('getTransaction', [signature, options], &block)
end

#get_transaction_count(options = {}, &block) ⇒ Integer

Retrieves the total number of transactions processed by the network.

Parameters:

  • options (Hash) (defaults to: {})

    Optional parameters for the request.

Returns:

  • (Integer)

    The total number of transactions.



447
448
449
# File 'lib/solana-ruby/client.rb', line 447

def get_transaction_count(options = {}, &block)
  request_http('getTransactionCount', [options], &block)
end

#get_version(&block) ⇒ Hash

Retrieves the current version of the Solana software.

Returns:

  • (Hash)

    The current version information.



455
456
457
# File 'lib/solana-ruby/client.rb', line 455

def get_version(&block)
  request_http('getVersion', &block)
end

#get_vote_accounts(options = {}, &block) ⇒ Hash

Retrieves the list of vote accounts.

Parameters:

  • options (Hash) (defaults to: {})

    Optional parameters for the request.

Returns:

  • (Hash)

    The list of vote accounts.



464
465
466
# File 'lib/solana-ruby/client.rb', line 464

def get_vote_accounts(options = {}, &block)
  request_http('getVoteAccounts', [options], &block)
end

#is_blockhash_valid(blockhash, options = {}, &block) ⇒ Boolean

Checks if a given blockhash is valid.

Parameters:

  • blockhash (String)

    The blockhash to check.

  • options (Hash) (defaults to: {})

    Optional parameters for the request.

Returns:

  • (Boolean)

    Whether the blockhash is valid.



474
475
476
# File 'lib/solana-ruby/client.rb', line 474

def is_blockhash_valid(blockhash, options = {}, &block)
  request_http('isBlockhashValid', [blockhash, options], &block)
end

#logs_subscribe(filter, options = {}) {|Object| ... } ⇒ Object

Subscribes to log messages.

Parameters:

  • filter (String, Hash)

    The filter for log messages (e.g., a public key or a set of options).

  • options (Hash) (defaults to: {})

    Optional parameters for the subscription.

Yields:

  • (Object)

    The response from the subscription.



561
562
563
# File 'lib/solana-ruby/client.rb', line 561

def logs_subscribe(filter, options = {}, &block)
  request_ws('logsSubscribe', [filter, options], &block)
end

#logs_unsubscribe(subscription_id) {|Object| ... } ⇒ Object

Unsubscribes from log messages.

Parameters:

  • subscription_id (Integer)

    The subscription ID.

Yields:

  • (Object)

    The response from the unsubscription.



570
571
572
# File 'lib/solana-ruby/client.rb', line 570

def logs_unsubscribe(subscription_id, &block)
  request_ws('logsUnsubscribe', [subscription_id], &block)
end

#minimum_ledger_slot(&block) ⇒ Integer

Retrieves the minimum ledger slot.

Parameters:

  • options (Hash)

    Optional parameters for the request.

Returns:

  • (Integer)

    The minimum ledger slot.



483
484
485
# File 'lib/solana-ruby/client.rb', line 483

def minimum_ledger_slot(&block)
  request_http('minimumLedgerSlot', &block)
end

#program_subscribe(pubkey, options = {}) {|Object| ... } ⇒ Object

Subscribes to program changes.

Parameters:

  • pubkey (String)

    The public key of the program.

  • options (Hash) (defaults to: {})

    Optional parameters for the subscription.

Yields:

  • (Object)

    The response from the subscription.



580
581
582
# File 'lib/solana-ruby/client.rb', line 580

def program_subscribe(pubkey, options = {}, &block)
  request_ws('programSubscribe', [pubkey, options], &block)
end

#program_unsubscribe(subscription_id) {|Object| ... } ⇒ Object

Unsubscribes from program changes.

Parameters:

  • subscription_id (Integer)

    The subscription ID.

Yields:

  • (Object)

    The response from the unsubscription.



589
590
591
# File 'lib/solana-ruby/client.rb', line 589

def program_unsubscribe(subscription_id, &block)
  request_ws('programUnsubscribe', [subscription_id], &block)
end

#request_airdrop(pubkey, lamports, options = {}, &block) ⇒ Hash

Requests an airdrop to a given public key.

Parameters:

  • pubkey (String)

    The public key to receive the airdrop.

  • lamports (Integer)

    The amount of lamports to airdrop.

  • options (Hash) (defaults to: {})

    Optional parameters for the request.

Returns:

  • (Hash)

    The airdrop request response.



494
495
496
# File 'lib/solana-ruby/client.rb', line 494

def request_airdrop(pubkey, lamports, options = {}, &block)
  request_http('requestAirdrop', [pubkey, lamports, options], &block)
end

#root_subscribe {|Object| ... } ⇒ Object

Subscribes to root changes.

Yields:

  • (Object)

    The response from the subscription.



597
598
599
# File 'lib/solana-ruby/client.rb', line 597

def root_subscribe(&block)
  request_ws('rootSubscribe', &block)
end

#root_unsubscribe(subscription_id) {|Object| ... } ⇒ Object

Unsubscribes from root changes.

Parameters:

  • subscription_id (Integer)

    The subscription ID.

Yields:

  • (Object)

    The response from the unsubscription.



606
607
608
# File 'lib/solana-ruby/client.rb', line 606

def root_unsubscribe(subscription_id, &block)
  request_ws('rootUnsubscribe', [subscription_id], &block)
end

#send_transaction(transaction, options = {}, &block) ⇒ Hash

Sends a transaction.

Parameters:

  • transaction (Hash)

    The transaction to send.

  • options (Hash) (defaults to: {})

    Optional parameters for the request.

Returns:

  • (Hash)

    The response from the send transaction request.



504
505
506
# File 'lib/solana-ruby/client.rb', line 504

def send_transaction(transaction, options = {}, &block)
  request_http('sendTransaction', [transaction.to_json, options], &block)
end

#signature_subscribe(signature, options = {}) {|Object| ... } ⇒ Object

Subscribes to signature status changes.

Parameters:

  • signature (String)

    The signature to monitor.

  • options (Hash) (defaults to: {})

    Optional parameters for the subscription.

Yields:

  • (Object)

    The response from the subscription.



616
617
618
# File 'lib/solana-ruby/client.rb', line 616

def signature_subscribe(signature, options = {}, &block)
  request_ws('signatureSubscribe', [signature, options], &block)
end

#signature_unsubscribe(subscription_id) {|Object| ... } ⇒ Object

Unsubscribes from signature status changes.

Parameters:

  • subscription_id (Integer)

    The subscription ID.

Yields:

  • (Object)

    The response from the unsubscription.



625
626
627
# File 'lib/solana-ruby/client.rb', line 625

def signature_unsubscribe(subscription_id, &block)
  request_ws('signatureUnsubscribe', [subscription_id], &block)
end

#simulate_transaction(transaction, options = {}, &block) ⇒ Hash

Simulates a transaction.

Parameters:

  • transaction (Hash)

    The transaction to simulate.

  • options (Hash) (defaults to: {})

    Optional parameters for the request.

Returns:

  • (Hash)

    The simulation response.



514
515
516
# File 'lib/solana-ruby/client.rb', line 514

def simulate_transaction(transaction, options = {}, &block)
  request_http('simulateTransaction', [transaction.to_json, options], &block)
end

#slot_subscribe {|Object| ... } ⇒ Object

Subscribes to slot changes.

Yields:

  • (Object)

    The response from the subscription.



633
634
635
# File 'lib/solana-ruby/client.rb', line 633

def slot_subscribe(&block)
  request_ws('slotSubscribe', &block)
end

#slot_unsubscribe(subscription_id) {|Object| ... } ⇒ Object

Unsubscribes from slot changes.

Parameters:

  • subscription_id (Integer)

    The subscription ID.

Yields:

  • (Object)

    The response from the unsubscription.



642
643
644
# File 'lib/solana-ruby/client.rb', line 642

def slot_unsubscribe(subscription_id, &block)
  request_ws('slotUnsubscribe', [subscription_id], &block)
end

#slots_updates_subscribe {|Object| ... } ⇒ Object

Subscribes to slot updates.

Yields:

  • (Object)

    The response from the subscription.



650
651
652
# File 'lib/solana-ruby/client.rb', line 650

def slots_updates_subscribe(&block)
  request_ws('slotsUpdatesSubscribe', &block)
end

#slots_updates_unsubscribe(subscription_id) {|Object| ... } ⇒ Object

Unsubscribes from slot updates.

Parameters:

  • subscription_id (Integer)

    The subscription ID.

Yields:

  • (Object)

    The response from the unsubscription.



659
660
661
# File 'lib/solana-ruby/client.rb', line 659

def slots_updates_unsubscribe(subscription_id, &block)
  request_ws('slotsUpdatesUnsubscribe', [subscription_id], &block)
end

#vote_subscribe {|Object| ... } ⇒ Object

Subscribes to vote updates.

Yields:

  • (Object)

    The response from the subscription.



667
668
669
# File 'lib/solana-ruby/client.rb', line 667

def vote_subscribe(&block)
  request_ws('voteSubscribe', &block)
end

#vote_unsubscribe(subscription_id) {|Object| ... } ⇒ Object

Unsubscribes from vote updates.

Parameters:

  • subscription_id (Integer)

    The subscription ID.

Yields:

  • (Object)

    The response from the unsubscription.



676
677
678
# File 'lib/solana-ruby/client.rb', line 676

def vote_unsubscribe(subscription_id, &block)
  request_ws('voteUnsubscribe', [subscription_id], &block)
end