solana_rpc_ruby 1.1.1 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +22 -0
- data/LICENSE +20 -674
- data/README.md +14 -9
- data/lib/solana_rpc_ruby/api_client.rb +22 -12
- data/lib/solana_rpc_ruby/api_error.rb +13 -2
- data/lib/solana_rpc_ruby/methods_wrapper.rb +303 -109
- data/lib/solana_rpc_ruby/version.rb +1 -1
- data/lib/solana_rpc_ruby/websocket_client.rb +0 -18
- data/lib/solana_rpc_ruby/websocket_methods_wrapper.rb +82 -31
- metadata +6 -6
@@ -29,7 +29,7 @@ module SolanaRpcRuby
|
|
29
29
|
# @param cluster [String] cluster where requests will be sent.
|
30
30
|
# @param id [Integer] unique client-generated identifying integer.
|
31
31
|
def initialize(
|
32
|
-
api_client: ApiClient,
|
32
|
+
api_client: ApiClient,
|
33
33
|
cluster: SolanaRpcRuby.cluster,
|
34
34
|
id: rand(1...99_999)
|
35
35
|
)
|
@@ -40,16 +40,18 @@ module SolanaRpcRuby
|
|
40
40
|
end
|
41
41
|
|
42
42
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getaccountinfo
|
43
|
+
#
|
43
44
|
# Returns all information associated with the account of provided Pubkey
|
44
45
|
#
|
45
46
|
# @param account_pubkey [String]
|
46
47
|
# @param encoding [String]
|
48
|
+
# @param commitment [String]
|
47
49
|
# @param data_slice [Hash]
|
48
50
|
# @option data_slice [Integer] :offset
|
49
51
|
# @option data_slice [Integer] :length
|
50
52
|
#
|
51
53
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
52
|
-
def get_account_info(account_pubkey, encoding: '', data_slice: {})
|
54
|
+
def get_account_info(account_pubkey, encoding: '', data_slice: {}, commitment: '')
|
53
55
|
http_method = :post
|
54
56
|
method = create_method_name(__method__)
|
55
57
|
|
@@ -58,6 +60,7 @@ module SolanaRpcRuby
|
|
58
60
|
|
59
61
|
params_hash['encoding'] = encoding unless blank?(encoding)
|
60
62
|
params_hash['dataSlice'] = data_slice unless data_slice.empty?
|
63
|
+
params_hash['commitment'] = commitment unless blank?(commitment)
|
61
64
|
|
62
65
|
params << account_pubkey
|
63
66
|
params << params_hash unless params_hash.empty?
|
@@ -68,6 +71,7 @@ module SolanaRpcRuby
|
|
68
71
|
end
|
69
72
|
|
70
73
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getbalance
|
74
|
+
#
|
71
75
|
# Returns the balance of the account of provided Pubkey
|
72
76
|
#
|
73
77
|
# @param account_pubkey [String]
|
@@ -94,6 +98,7 @@ module SolanaRpcRuby
|
|
94
98
|
|
95
99
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getblock
|
96
100
|
# NEW: This method is only available in solana-core v1.7 or newer. Please use getConfirmedBlock for solana-core v1.6
|
101
|
+
#
|
97
102
|
# Returns identity and transaction information about a confirmed block in the ledger
|
98
103
|
#
|
99
104
|
# @param slot [Integer]
|
@@ -124,6 +129,7 @@ module SolanaRpcRuby
|
|
124
129
|
end
|
125
130
|
|
126
131
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getblockheight
|
132
|
+
#
|
127
133
|
# Returns the current block height of the node
|
128
134
|
#
|
129
135
|
# @param commitment [String]
|
@@ -145,6 +151,7 @@ module SolanaRpcRuby
|
|
145
151
|
end
|
146
152
|
|
147
153
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getblockproduction
|
154
|
+
#
|
148
155
|
# Returns recent block production information from the current or previous epoch.
|
149
156
|
#
|
150
157
|
# @param identity [String]
|
@@ -167,6 +174,7 @@ module SolanaRpcRuby
|
|
167
174
|
|
168
175
|
params_hash['identity'] = identity unless blank?(identity)
|
169
176
|
params_hash['range'] = range_hash unless range_hash.empty?
|
177
|
+
params_hash['commitment'] = commitment unless blank?(commitment)
|
170
178
|
|
171
179
|
params << params_hash unless params_hash.empty?
|
172
180
|
|
@@ -176,6 +184,7 @@ module SolanaRpcRuby
|
|
176
184
|
end
|
177
185
|
|
178
186
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getblockcommitment
|
187
|
+
#
|
179
188
|
# Returns commitment for particular block
|
180
189
|
#
|
181
190
|
# @param block [Integer]
|
@@ -196,20 +205,25 @@ module SolanaRpcRuby
|
|
196
205
|
|
197
206
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getblocks
|
198
207
|
# NEW: This method is only available in solana-core v1.7 or newer. Please use getConfirmedBlocks for solana-core v1.6
|
208
|
+
#
|
199
209
|
# Returns a list of confirmed blocks between two slots
|
200
210
|
#
|
201
211
|
# @param start_slot [Integer]
|
202
212
|
# @param end_slot [Integer]
|
203
213
|
#
|
204
214
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
205
|
-
def get_blocks(start_slot, end_slot: nil)
|
215
|
+
def get_blocks(start_slot, end_slot: nil, commitment: nil)
|
206
216
|
http_method = :post
|
207
217
|
method = create_method_name(__method__)
|
208
218
|
|
209
219
|
params = []
|
220
|
+
params_hash = {}
|
210
221
|
|
211
222
|
params << start_slot
|
212
223
|
params << end_slot unless end_slot.nil?
|
224
|
+
params_hash['commitment'] = commitment unless blank?(commitment)
|
225
|
+
|
226
|
+
params << params_hash unless params_hash.empty?
|
213
227
|
|
214
228
|
body = create_json_body(method, method_params: params)
|
215
229
|
|
@@ -218,6 +232,7 @@ module SolanaRpcRuby
|
|
218
232
|
|
219
233
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getblockswithlimit
|
220
234
|
# NEW: This method is only available in solana-core v1.7 or newer. Please use getConfirmedBlocks for solana-core v1.6
|
235
|
+
#
|
221
236
|
# Returns a list of confirmed blocks starting at the given slot
|
222
237
|
#
|
223
238
|
# @param start_slot [Integer]
|
@@ -244,6 +259,7 @@ module SolanaRpcRuby
|
|
244
259
|
end
|
245
260
|
|
246
261
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getblocktime
|
262
|
+
#
|
247
263
|
# Returns the estimated production time of a block.
|
248
264
|
#
|
249
265
|
# @param block [Integer]
|
@@ -263,6 +279,7 @@ module SolanaRpcRuby
|
|
263
279
|
end
|
264
280
|
|
265
281
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getclusternodes
|
282
|
+
#
|
266
283
|
# Returns information about all the nodes participating in the cluster
|
267
284
|
#
|
268
285
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
@@ -276,28 +293,7 @@ module SolanaRpcRuby
|
|
276
293
|
end
|
277
294
|
|
278
295
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getepochinfo
|
279
|
-
# DEPRECATED: Please use getBlocks instead This method is expected to be removed in solana-core v1.8
|
280
|
-
# Returns a list of confirmed blocks between two slots
|
281
296
|
#
|
282
|
-
# @param start_slot [Integer]
|
283
|
-
# @param end_slot [Integer]
|
284
|
-
#
|
285
|
-
# @return [Response, ApiError] Response when success, ApiError on failure.
|
286
|
-
def get_confirmed_blocks(start_slot, end_slot: nil)
|
287
|
-
http_method = :post
|
288
|
-
method = create_method_name(__method__)
|
289
|
-
|
290
|
-
params = []
|
291
|
-
|
292
|
-
params << start_slot
|
293
|
-
params << end_slot unless end_slot.nil? # optional
|
294
|
-
|
295
|
-
body = create_json_body(method, method_params: params)
|
296
|
-
|
297
|
-
send_request(body, http_method)
|
298
|
-
end
|
299
|
-
|
300
|
-
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getepochinfo
|
301
297
|
# Returns information about the current epoch
|
302
298
|
#
|
303
299
|
# @param commitment [String]
|
@@ -320,6 +316,7 @@ module SolanaRpcRuby
|
|
320
316
|
end
|
321
317
|
|
322
318
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getepochschedule
|
319
|
+
#
|
323
320
|
# Returns epoch schedule information from this cluster's genesis config
|
324
321
|
#
|
325
322
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
@@ -332,35 +329,37 @@ module SolanaRpcRuby
|
|
332
329
|
send_request(body, http_method)
|
333
330
|
end
|
334
331
|
|
335
|
-
# @see https://docs.solana.com/developing/clients/jsonrpc-api#
|
336
|
-
#
|
332
|
+
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getfeeformessage
|
333
|
+
# NEW: This method is only available in solana-core v1.9 or newer. Please use getFees for solana-core v1.8
|
337
334
|
#
|
338
|
-
#
|
335
|
+
# Get the fee the network will charge for a particular Message
|
336
|
+
#
|
337
|
+
# @param message [String]
|
339
338
|
# @param commitment [String]
|
340
339
|
#
|
341
340
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
342
|
-
def
|
341
|
+
def get_fee_for_message(message, commitment: nil)
|
343
342
|
http_method = :post
|
344
343
|
method = create_method_name(__method__)
|
345
344
|
|
346
345
|
params = []
|
347
346
|
params_hash = {}
|
348
347
|
|
348
|
+
params << message
|
349
349
|
params_hash['commitment'] = commitment unless blank?(commitment)
|
350
350
|
|
351
|
-
params << query_blockhash
|
352
351
|
params << params_hash unless params_hash.empty?
|
353
|
-
|
354
352
|
body = create_json_body(method, method_params: params)
|
355
353
|
|
356
354
|
send_request(body, http_method)
|
357
355
|
end
|
358
356
|
|
359
|
-
# @see https://docs.solana.com/developing/clients/jsonrpc-api#
|
360
|
-
#
|
357
|
+
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getfirstavailableblock
|
358
|
+
#
|
359
|
+
# Returns the slot of the lowest confirmed block that has not been purged from the ledger
|
361
360
|
#
|
362
361
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
363
|
-
def
|
362
|
+
def get_first_available_block
|
364
363
|
http_method = :post
|
365
364
|
method = create_method_name(__method__)
|
366
365
|
|
@@ -369,33 +368,12 @@ module SolanaRpcRuby
|
|
369
368
|
send_request(body, http_method)
|
370
369
|
end
|
371
370
|
|
372
|
-
# @see https://docs.solana.com/developing/clients/jsonrpc-api#
|
373
|
-
# Returns a recent block hash from the ledger, a fee schedule that can be used to compute
|
374
|
-
# the cost of submitting a transaction using it, and the last slot in which the blockhash will be valid.
|
375
|
-
#
|
376
|
-
# @param commitment [String]
|
371
|
+
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getgenesishash
|
377
372
|
#
|
378
|
-
#
|
379
|
-
def get_fees(commitment: nil)
|
380
|
-
http_method = :post
|
381
|
-
method = create_method_name(__method__)
|
382
|
-
|
383
|
-
params = []
|
384
|
-
params_hash = {}
|
385
|
-
|
386
|
-
params_hash['commitment'] = commitment unless blank?(commitment)
|
387
|
-
params << params_hash unless params_hash.empty?
|
388
|
-
|
389
|
-
body = create_json_body(method, method_params: params)
|
390
|
-
|
391
|
-
send_request(body, http_method)
|
392
|
-
end
|
393
|
-
|
394
|
-
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getfirstavailableblock
|
395
|
-
# Returns the slot of the lowest confirmed block that has not been purged from the ledger
|
373
|
+
# Returns the genesis hash.
|
396
374
|
#
|
397
375
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
398
|
-
def
|
376
|
+
def get_genesis_hash
|
399
377
|
http_method = :post
|
400
378
|
method = create_method_name(__method__)
|
401
379
|
|
@@ -404,11 +382,12 @@ module SolanaRpcRuby
|
|
404
382
|
send_request(body, http_method)
|
405
383
|
end
|
406
384
|
|
407
|
-
# @see https://docs.solana.com/developing/clients/jsonrpc-api#
|
408
|
-
#
|
385
|
+
# @see https://docs.solana.com/developing/clients/jsonrpc-api#gethealth
|
386
|
+
#
|
387
|
+
# Returns the current health of the node.
|
409
388
|
#
|
410
389
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
411
|
-
def
|
390
|
+
def get_health
|
412
391
|
http_method = :post
|
413
392
|
method = create_method_name(__method__)
|
414
393
|
|
@@ -417,11 +396,15 @@ module SolanaRpcRuby
|
|
417
396
|
send_request(body, http_method)
|
418
397
|
end
|
419
398
|
|
420
|
-
# @see https://docs.solana.com/developing/clients/jsonrpc-api#
|
421
|
-
#
|
399
|
+
# @see https://docs.solana.com/developing/clients/jsonrpc-api#gethighestsnapshotslot
|
400
|
+
#
|
401
|
+
# NEW: This method is only available in solana-core v1.9 or newer. Please use getSnapshotSlot for solana-core v1.8
|
402
|
+
#
|
403
|
+
# Returns the highest slot information that the node has snapshots for.
|
404
|
+
# This will find the highest full snapshot slot, and the highest incremental snapshot slot based on the full snapshot slot, if there is one.
|
422
405
|
#
|
423
406
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
424
|
-
def
|
407
|
+
def get_highest_snapshot_slot
|
425
408
|
http_method = :post
|
426
409
|
method = create_method_name(__method__)
|
427
410
|
|
@@ -431,6 +414,7 @@ module SolanaRpcRuby
|
|
431
414
|
end
|
432
415
|
|
433
416
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getidentity
|
417
|
+
#
|
434
418
|
# Returns the identity pubkey for the current node.
|
435
419
|
#
|
436
420
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
@@ -444,6 +428,7 @@ module SolanaRpcRuby
|
|
444
428
|
end
|
445
429
|
|
446
430
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getinflationgovernor
|
431
|
+
#
|
447
432
|
# Returns the current inflation governor.
|
448
433
|
#
|
449
434
|
# @param commitment [String]
|
@@ -466,6 +451,7 @@ module SolanaRpcRuby
|
|
466
451
|
end
|
467
452
|
|
468
453
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getinflationrate
|
454
|
+
#
|
469
455
|
# Returns the specific inflation values for the current epoch.
|
470
456
|
#
|
471
457
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
@@ -479,6 +465,7 @@ module SolanaRpcRuby
|
|
479
465
|
end
|
480
466
|
|
481
467
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getinflationreward
|
468
|
+
#
|
482
469
|
# Returns the inflation reward for a list of addresses for an epoch.
|
483
470
|
#
|
484
471
|
# @param addresses [Array]
|
@@ -506,6 +493,7 @@ module SolanaRpcRuby
|
|
506
493
|
end
|
507
494
|
|
508
495
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getlargestaccounts
|
496
|
+
#
|
509
497
|
# Returns the 20 largest accounts, by lamport balance (results may be cached up to two hours)
|
510
498
|
#
|
511
499
|
# @param commitment [String]
|
@@ -529,7 +517,32 @@ module SolanaRpcRuby
|
|
529
517
|
send_request(body, http_method)
|
530
518
|
end
|
531
519
|
|
520
|
+
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getlatestblockhash
|
521
|
+
# NEW: This method is only available in solana-core v1.9 or newer. Please use getRecentBlockhash for solana-core v1.8
|
522
|
+
#
|
523
|
+
# Returns the latest blockhash.
|
524
|
+
#
|
525
|
+
# @param commitment [String]
|
526
|
+
#
|
527
|
+
# @return [Response, ApiError] Response when success, ApiError on failure.
|
528
|
+
def get_latest_blockhash(commitment: nil)
|
529
|
+
http_method = :post
|
530
|
+
method = create_method_name(__method__)
|
531
|
+
|
532
|
+
params = []
|
533
|
+
params_hash = {}
|
534
|
+
|
535
|
+
params_hash['commitment'] = commitment unless blank?(commitment)
|
536
|
+
|
537
|
+
params << params_hash unless params_hash.empty?
|
538
|
+
|
539
|
+
body = create_json_body(method, method_params: params)
|
540
|
+
|
541
|
+
send_request(body, http_method)
|
542
|
+
end
|
543
|
+
|
532
544
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getleaderschedule
|
545
|
+
#
|
533
546
|
# Returns the leader schedule for an epoch.
|
534
547
|
#
|
535
548
|
# @param epoch [Integer]
|
@@ -556,6 +569,7 @@ module SolanaRpcRuby
|
|
556
569
|
end
|
557
570
|
|
558
571
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getmaxretransmitslot
|
572
|
+
#
|
559
573
|
# Get the max slot seen from retransmit stage.
|
560
574
|
#
|
561
575
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
@@ -582,6 +596,7 @@ module SolanaRpcRuby
|
|
582
596
|
end
|
583
597
|
|
584
598
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getminimumbalanceforrentexemption
|
599
|
+
#
|
585
600
|
# Returns minimum balance required to make account rent exempt.
|
586
601
|
#
|
587
602
|
# @param account_data_length [String]
|
@@ -609,12 +624,15 @@ module SolanaRpcRuby
|
|
609
624
|
end
|
610
625
|
|
611
626
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getmultipleaccounts
|
627
|
+
#
|
612
628
|
# Returns the account information for a list of Pubkeys.
|
613
|
-
# @param account_data_length [String]
|
614
|
-
# @param commitment [String]
|
615
629
|
#
|
616
|
-
# @
|
630
|
+
# @param pubkeys [Array]
|
617
631
|
# @param commitment [String]
|
632
|
+
# @param encoding [String]
|
633
|
+
# @param data_slice [Hash]
|
634
|
+
# @option data_slice [Integer] :offset
|
635
|
+
# @option data_slice [Integer] :length
|
618
636
|
#
|
619
637
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
620
638
|
def get_multiple_accounts(
|
@@ -688,30 +706,8 @@ module SolanaRpcRuby
|
|
688
706
|
send_request(body, http_method)
|
689
707
|
end
|
690
708
|
|
691
|
-
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getrecentblockhash
|
692
|
-
# Returns a recent block hash from the ledger, and a fee schedule
|
693
|
-
# that can be used to compute the cost of submitting a transaction using it.
|
694
|
-
#
|
695
|
-
# @param commitment [String]
|
696
|
-
#
|
697
|
-
# @return [Response, ApiError] Response when success, ApiError on failure.
|
698
|
-
def get_recent_blockhash(commitment: nil)
|
699
|
-
http_method = :post
|
700
|
-
method = create_method_name(__method__)
|
701
|
-
|
702
|
-
params = []
|
703
|
-
params_hash = {}
|
704
|
-
|
705
|
-
params_hash['commitment'] = commitment unless blank?(commitment)
|
706
|
-
|
707
|
-
params << params_hash unless params_hash.empty?
|
708
|
-
|
709
|
-
body = create_json_body(method, method_params: params)
|
710
|
-
|
711
|
-
send_request(body, http_method)
|
712
|
-
end
|
713
|
-
|
714
709
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getrecentperformancesamples
|
710
|
+
#
|
715
711
|
# Returns a list of recent performance samples, in reverse slot order.
|
716
712
|
# Performance samples are taken every 60 seconds and include the number of transactions and slots that occur in a given time window.
|
717
713
|
#
|
@@ -731,19 +727,6 @@ module SolanaRpcRuby
|
|
731
727
|
send_request(body, http_method)
|
732
728
|
end
|
733
729
|
|
734
|
-
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getsnapshotslot
|
735
|
-
# Returns the highest slot that the node has a snapshot for.
|
736
|
-
#
|
737
|
-
# @return [Response, ApiError] Response when success, ApiError on failure.
|
738
|
-
def get_snapshot_slot
|
739
|
-
http_method = :post
|
740
|
-
method = create_method_name(__method__)
|
741
|
-
|
742
|
-
body = create_json_body(method)
|
743
|
-
|
744
|
-
send_request(body, http_method)
|
745
|
-
end
|
746
|
-
|
747
730
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getsignaturesforaddress
|
748
731
|
# NEW: This method is only available in solana-core v1.7 or newer.
|
749
732
|
# Please use getConfirmedSignaturesForAddress2 for solana-core v1.6
|
@@ -816,6 +799,7 @@ module SolanaRpcRuby
|
|
816
799
|
end
|
817
800
|
|
818
801
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getslot
|
802
|
+
#
|
819
803
|
# Returns the current slot the node is processing.
|
820
804
|
#
|
821
805
|
# @param commitment [String]
|
@@ -838,6 +822,7 @@ module SolanaRpcRuby
|
|
838
822
|
end
|
839
823
|
|
840
824
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getslotleader
|
825
|
+
#
|
841
826
|
# Returns the current slot leader
|
842
827
|
#
|
843
828
|
# @param commitment [String]
|
@@ -860,6 +845,7 @@ module SolanaRpcRuby
|
|
860
845
|
end
|
861
846
|
|
862
847
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getslotleaders
|
848
|
+
#
|
863
849
|
# Returns the slot leaders for a given slot range.
|
864
850
|
#
|
865
851
|
# @param start_slot [Integer]
|
@@ -878,6 +864,7 @@ module SolanaRpcRuby
|
|
878
864
|
end
|
879
865
|
|
880
866
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getstakeactivation
|
867
|
+
#
|
881
868
|
# Returns epoch activation information for a stake account.
|
882
869
|
#
|
883
870
|
# @param pubkey [String]
|
@@ -904,12 +891,14 @@ module SolanaRpcRuby
|
|
904
891
|
end
|
905
892
|
|
906
893
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getsupply
|
894
|
+
#
|
907
895
|
# Returns information about the current supply.
|
908
896
|
#
|
909
897
|
# @param commitment [String]
|
898
|
+
# @param exclude_non_circulating_accounts_list [Boolean]
|
910
899
|
#
|
911
900
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
912
|
-
def get_supply(commitment: nil)
|
901
|
+
def get_supply(commitment: nil, exclude_non_circulating_accounts_list: nil)
|
913
902
|
http_method = :post
|
914
903
|
method = create_method_name(__method__)
|
915
904
|
|
@@ -917,6 +906,8 @@ module SolanaRpcRuby
|
|
917
906
|
params_hash = {}
|
918
907
|
|
919
908
|
params_hash['commitment'] = commitment unless blank?(commitment)
|
909
|
+
params_hash['exclude_non_circulating_accounts_list'] = exclude_non_circulating_accounts_list \
|
910
|
+
unless exclude_non_circulating_accounts_list.nil?
|
920
911
|
|
921
912
|
params << params_hash unless params_hash.empty?
|
922
913
|
|
@@ -1080,6 +1071,35 @@ module SolanaRpcRuby
|
|
1080
1071
|
send_request(body, http_method)
|
1081
1072
|
end
|
1082
1073
|
|
1074
|
+
# @see https://docs.solana.com/developing/clients/jsonrpc-api#gettokensupply
|
1075
|
+
#
|
1076
|
+
# Returns the total supply of an SPL Token type.
|
1077
|
+
#
|
1078
|
+
# @param token_mint_pubkey [String]
|
1079
|
+
# @param commitment [String]
|
1080
|
+
#
|
1081
|
+
# @return [Response, ApiError] Response when success, ApiError on failure.
|
1082
|
+
def get_token_supply(
|
1083
|
+
token_mint_pubkey,
|
1084
|
+
commitment: nil
|
1085
|
+
)
|
1086
|
+
|
1087
|
+
http_method = :post
|
1088
|
+
method = create_method_name(__method__)
|
1089
|
+
|
1090
|
+
params = []
|
1091
|
+
params_hash = {}
|
1092
|
+
|
1093
|
+
params_hash['commitment'] = commitment unless blank?(commitment)
|
1094
|
+
|
1095
|
+
params << token_mint_pubkey
|
1096
|
+
params << params_hash unless params_hash.empty?
|
1097
|
+
|
1098
|
+
body = create_json_body(method, method_params: params)
|
1099
|
+
|
1100
|
+
send_request(body, http_method)
|
1101
|
+
end
|
1102
|
+
|
1083
1103
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#gettransaction
|
1084
1104
|
#
|
1085
1105
|
# Returns transaction details for a confirmed transaction
|
@@ -1145,13 +1165,21 @@ module SolanaRpcRuby
|
|
1145
1165
|
end
|
1146
1166
|
|
1147
1167
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getvoteaccounts
|
1168
|
+
#
|
1148
1169
|
# Returns the account info and associated stake for all the voting accounts in the current bank.
|
1149
1170
|
#
|
1150
1171
|
# @param commitment [String]
|
1151
1172
|
# @param vote_pubkey [String]
|
1173
|
+
# @param keep_unstaked_delinquents [Boolean]
|
1174
|
+
# @param delinquent_slot_distance [Integer] NOTE: For the sake of consistency between ecosystem products, it is not recommended that this argument be specified.
|
1152
1175
|
#
|
1153
1176
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
1154
|
-
def get_vote_accounts(
|
1177
|
+
def get_vote_accounts(
|
1178
|
+
commitment: nil,
|
1179
|
+
vote_pubkey: nil,
|
1180
|
+
keep_unstaked_delinquents: nil,
|
1181
|
+
delinquent_slot_distance: nil
|
1182
|
+
)
|
1155
1183
|
http_method = :post
|
1156
1184
|
method = create_method_name(__method__)
|
1157
1185
|
|
@@ -1160,6 +1188,8 @@ module SolanaRpcRuby
|
|
1160
1188
|
|
1161
1189
|
params_hash['votePubkey'] = vote_pubkey unless blank?(vote_pubkey)
|
1162
1190
|
params_hash['commitment'] = commitment unless blank?(commitment)
|
1191
|
+
params_hash['keep_unstaked_delinquents'] = keep_unstaked_delinquents unless keep_unstaked_delinquents.nil?
|
1192
|
+
params_hash['delinquent_slot_distance'] = delinquent_slot_distance unless blank?(delinquent_slot_distance)
|
1163
1193
|
|
1164
1194
|
params << params_hash unless params_hash.empty?
|
1165
1195
|
|
@@ -1168,16 +1198,28 @@ module SolanaRpcRuby
|
|
1168
1198
|
send_request(body, http_method)
|
1169
1199
|
end
|
1170
1200
|
|
1171
|
-
# @see https://docs.solana.com/developing/clients/jsonrpc-api#
|
1201
|
+
# @see https://docs.solana.com/developing/clients/jsonrpc-api#isblockhashvalid
|
1202
|
+
# NEW: This method is only available in solana-core v1.9 or newer. Please use getFeeCalculatorForBlockhash for solana-core v1.8
|
1172
1203
|
#
|
1173
|
-
# Returns
|
1204
|
+
# Returns whether a blockhash is still valid or not.
|
1205
|
+
#
|
1206
|
+
# @param blockhash [String]
|
1207
|
+
# @param commitment [String]
|
1174
1208
|
#
|
1175
1209
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
1176
|
-
def
|
1210
|
+
def is_blockhash_valid(blockhash, commitment: nil)
|
1177
1211
|
http_method = :post
|
1178
1212
|
method = create_method_name(__method__)
|
1179
1213
|
|
1180
|
-
|
1214
|
+
params = []
|
1215
|
+
params_hash = {}
|
1216
|
+
|
1217
|
+
params_hash['commitment'] = commitment unless blank?(commitment)
|
1218
|
+
|
1219
|
+
params << blockhash
|
1220
|
+
params << params_hash unless params_hash.empty?
|
1221
|
+
|
1222
|
+
body = create_json_body(method, method_params: params)
|
1181
1223
|
|
1182
1224
|
send_request(body, http_method)
|
1183
1225
|
end
|
@@ -1212,6 +1254,7 @@ module SolanaRpcRuby
|
|
1212
1254
|
|
1213
1255
|
params = []
|
1214
1256
|
params_hash = {}
|
1257
|
+
params_hash['commitment'] = commitment unless blank?(commitment)
|
1215
1258
|
|
1216
1259
|
params << pubkey
|
1217
1260
|
params << lamports
|
@@ -1230,13 +1273,15 @@ module SolanaRpcRuby
|
|
1230
1273
|
# @param skip_pre_flight [Boolean]
|
1231
1274
|
# @param pre_flight_commitment [String]
|
1232
1275
|
# @param encoding [String]
|
1276
|
+
# @param max_retries [Integer]
|
1233
1277
|
#
|
1234
1278
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
1235
1279
|
def send_transaction(
|
1236
1280
|
transaction_signature,
|
1237
1281
|
skip_pre_flight: false,
|
1238
1282
|
pre_flight_commitment: nil,
|
1239
|
-
encoding: ''
|
1283
|
+
encoding: '',
|
1284
|
+
max_retries: nil
|
1240
1285
|
)
|
1241
1286
|
http_method = :post
|
1242
1287
|
method = create_method_name(__method__)
|
@@ -1247,6 +1292,7 @@ module SolanaRpcRuby
|
|
1247
1292
|
params_hash['skipPreFlight'] = skip_pre_flight unless skip_pre_flight.nil?
|
1248
1293
|
params_hash['preflightCommitment'] = pre_flight_commitment unless blank?(pre_flight_commitment)
|
1249
1294
|
params_hash['encoding'] = encoding unless blank?(encoding)
|
1295
|
+
params_hash['max_retries'] = max_retries unless blank?(max_retries)
|
1250
1296
|
|
1251
1297
|
params << transaction_signature
|
1252
1298
|
params << params_hash unless params_hash.empty?
|
@@ -1306,7 +1352,155 @@ module SolanaRpcRuby
|
|
1306
1352
|
send_request(body, http_method)
|
1307
1353
|
end
|
1308
1354
|
|
1355
|
+
|
1356
|
+
######## DEPRECATED METHODS #########
|
1357
|
+
|
1358
|
+
# @deprecated Please use getBlocks instead This method is expected to be removed in solana-core v1.8
|
1359
|
+
#
|
1360
|
+
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getepochinfo
|
1361
|
+
#
|
1362
|
+
# Returns a list of confirmed blocks between two slots
|
1363
|
+
#
|
1364
|
+
# @param start_slot [Integer]
|
1365
|
+
# @param end_slot [Integer]
|
1366
|
+
#
|
1367
|
+
# @return [Response, ApiError] Response when success, ApiError on failure.
|
1368
|
+
def get_confirmed_blocks(start_slot, end_slot: nil)
|
1369
|
+
warn 'DEPRECATED: Please use getBlocks instead. This method is expected to be removed in solana-core v1.8'
|
1370
|
+
|
1371
|
+
http_method = :post
|
1372
|
+
method = create_method_name(__method__)
|
1373
|
+
|
1374
|
+
params = []
|
1375
|
+
|
1376
|
+
params << start_slot
|
1377
|
+
params << end_slot unless end_slot.nil? # optional
|
1378
|
+
|
1379
|
+
body = create_json_body(method, method_params: params)
|
1380
|
+
|
1381
|
+
send_request(body, http_method)
|
1382
|
+
end
|
1383
|
+
|
1384
|
+
# @deprecated Please use isBlockhashValid or getFeeForMessage instead This method is expected to be removed in solana-core v2.0
|
1385
|
+
#
|
1386
|
+
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getfeecalculatorforblockhash
|
1387
|
+
#
|
1388
|
+
# Returns the fee calculator associated with the query blockhash, or null if the blockhash has expired
|
1389
|
+
#
|
1390
|
+
# @param query_blockhash [String]
|
1391
|
+
# @param commitment [String]
|
1392
|
+
#
|
1393
|
+
# @return [Response, ApiError] Response when success, ApiError on failure.
|
1394
|
+
def get_fee_calculator_for_blockhash(query_blockhash, commitment: nil)
|
1395
|
+
warn "DEPRECATED: Please use isBlockhashValid or getFeeForMessage instead. This method is expected to be removed in solana-core v2.0"
|
1396
|
+
|
1397
|
+
http_method = :post
|
1398
|
+
method = create_method_name(__method__)
|
1399
|
+
|
1400
|
+
params = []
|
1401
|
+
params_hash = {}
|
1402
|
+
|
1403
|
+
params_hash['commitment'] = commitment unless blank?(commitment)
|
1404
|
+
|
1405
|
+
params << query_blockhash
|
1406
|
+
params << params_hash unless params_hash.empty?
|
1407
|
+
|
1408
|
+
body = create_json_body(method, method_params: params)
|
1409
|
+
|
1410
|
+
send_request(body, http_method)
|
1411
|
+
end
|
1412
|
+
|
1413
|
+
# @deprecated Please check solana docs for substitution.
|
1414
|
+
#
|
1415
|
+
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getfeerategovernor
|
1416
|
+
#
|
1417
|
+
# Returns the fee rate governor information from the root bank
|
1418
|
+
#
|
1419
|
+
# @return [Response, ApiError] Response when success, ApiError on failure.
|
1420
|
+
def get_fee_rate_governor
|
1421
|
+
warn "DEPRECATED Please check solana docs for substitution."
|
1422
|
+
|
1423
|
+
http_method = :post
|
1424
|
+
method = create_method_name(__method__)
|
1425
|
+
|
1426
|
+
body = create_json_body(method)
|
1427
|
+
|
1428
|
+
send_request(body, http_method)
|
1429
|
+
end
|
1430
|
+
|
1431
|
+
# @deprecated DEPRECATED: Please use getFeeForMessage instead This method is expected to be removed in solana-core v2.0
|
1432
|
+
#
|
1433
|
+
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getfees
|
1434
|
+
#
|
1435
|
+
# Returns a recent block hash from the ledger, a fee schedule that can be used to compute
|
1436
|
+
# the cost of submitting a transaction using it, and the last slot in which the blockhash will be valid.
|
1437
|
+
#
|
1438
|
+
# @param commitment [String]
|
1439
|
+
#
|
1440
|
+
# @return [Response, ApiError] Response when success, ApiError on failure.
|
1441
|
+
def get_fees(commitment: nil)
|
1442
|
+
warn "DEPRECATED: Please use getFeeForMessage instead This method is expected to be removed in solana-core v2.0"
|
1443
|
+
|
1444
|
+
http_method = :post
|
1445
|
+
method = create_method_name(__method__)
|
1446
|
+
|
1447
|
+
params = []
|
1448
|
+
params_hash = {}
|
1449
|
+
|
1450
|
+
params_hash['commitment'] = commitment unless blank?(commitment)
|
1451
|
+
params << params_hash unless params_hash.empty?
|
1452
|
+
|
1453
|
+
body = create_json_body(method, method_params: params)
|
1454
|
+
|
1455
|
+
send_request(body, http_method)
|
1456
|
+
end
|
1457
|
+
|
1458
|
+
# @depreated Please use getFeeForMessage instead This method is expected to be removed in solana-core v2.0
|
1459
|
+
#
|
1460
|
+
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getrecentblockhash
|
1461
|
+
#
|
1462
|
+
# Returns a recent block hash from the ledger, and a fee schedule
|
1463
|
+
# that can be used to compute the cost of submitting a transaction using it.
|
1464
|
+
#
|
1465
|
+
# @param commitment [String]
|
1466
|
+
#
|
1467
|
+
# @return [Response, ApiError] Response when success, ApiError on failure.
|
1468
|
+
def get_recent_blockhash(commitment: nil)
|
1469
|
+
warn "DEPRECATED: Please use getFeeForMessage instead This method is expected to be removed in solana-core v2.0"
|
1470
|
+
http_method = :post
|
1471
|
+
method = create_method_name(__method__)
|
1472
|
+
|
1473
|
+
params = []
|
1474
|
+
params_hash = {}
|
1475
|
+
|
1476
|
+
params_hash['commitment'] = commitment unless blank?(commitment)
|
1477
|
+
|
1478
|
+
params << params_hash unless params_hash.empty?
|
1479
|
+
|
1480
|
+
body = create_json_body(method, method_params: params)
|
1481
|
+
|
1482
|
+
send_request(body, http_method)
|
1483
|
+
end
|
1484
|
+
|
1485
|
+
# @deprecated Please use getHighestSnapshotSlot instead This method is expected to be removed in solana-core v2.0
|
1486
|
+
#
|
1487
|
+
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getsnapshotslot
|
1488
|
+
#
|
1489
|
+
# Returns the highest slot that the node has a snapshot for.
|
1490
|
+
#
|
1491
|
+
# @return [Response, ApiError] Response when success, ApiError on failure.
|
1492
|
+
def get_snapshot_slot
|
1493
|
+
warn "DEPRECATED: Please use getHighestSnapshotSlot instead This method is expected to be removed in solana-core v2.0"
|
1494
|
+
http_method = :post
|
1495
|
+
method = create_method_name(__method__)
|
1496
|
+
|
1497
|
+
body = create_json_body(method)
|
1498
|
+
|
1499
|
+
send_request(body, http_method)
|
1500
|
+
end
|
1501
|
+
|
1309
1502
|
private
|
1503
|
+
|
1310
1504
|
def send_request(body, http_method)
|
1311
1505
|
api_response = api_client.call_api(
|
1312
1506
|
body: body,
|