solana_rpc_ruby 1.0.0.pre → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/lib/generators/solana_rpc_ruby/install_generator.rb +1 -1
- data/lib/generators/templates/solana_rpc_ruby_config.rb +5 -8
- data/lib/solana_rpc_ruby.rb +0 -4
- data/lib/solana_rpc_ruby/api_client.rb +11 -12
- data/lib/solana_rpc_ruby/api_error.rb +5 -5
- data/lib/solana_rpc_ruby/methods_wrapper.rb +178 -173
- data/lib/solana_rpc_ruby/version.rb +1 -1
- data/solana_rpc_ruby.gemspec +5 -1
- metadata +8 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7e06c7b9170275c6f9c2db723a176c2299c9bfbfb17f162f3ae4932b96a2bec
|
4
|
+
data.tar.gz: 81a53fd34e8f748201a118dcc8d19572aee2da3faf96376f2271370a5ac6364f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e51c2162d5f3f8e49d33847f9f37e38ec3088d0a7deaf7900d0c3eb7239370be2836e1d93407e529f9833def7dc76cf9e7eb74aa4a23ca2cda415f4244a0ea1b
|
7
|
+
data.tar.gz: 719c862c3d0a4e8a6dbe44a9300b05df6aa6be22dd689ffcfd0e1b8fb778f0d5f44aa90d5bfc80cb6a7dfeed61c0e5bd4a3cec3b9ee2155ac26f971e4428353e
|
data/README.md
CHANGED
@@ -21,7 +21,7 @@ Next, you need to run the generator:
|
|
21
21
|
rails g solana_rpc_ruby:install
|
22
22
|
```
|
23
23
|
|
24
|
-
The latter command will generate a new config file `config/solana_rpc_ruby_config.rb` looking like this:
|
24
|
+
The latter command will generate a new config file `config/initializers/solana_rpc_ruby_config.rb` looking like this:
|
25
25
|
|
26
26
|
```ruby
|
27
27
|
require 'solana_rpc_ruby'
|
@@ -29,7 +29,6 @@ require 'solana_rpc_ruby'
|
|
29
29
|
SolanaRpcRuby.config do |c|
|
30
30
|
c.cluster = 'https://api.testnet.solana.com'
|
31
31
|
c.json_rpc_version = '2.0'
|
32
|
-
c.encoding = 'base58'
|
33
32
|
# ...other options
|
34
33
|
end
|
35
34
|
```
|
@@ -43,7 +42,8 @@ response = method_wrapper.get_account_info(account_pubkey)
|
|
43
42
|
puts response
|
44
43
|
```
|
45
44
|
|
46
|
-
All info about methods you can find in the docs on:
|
45
|
+
All info about methods you can find in the docs on: https://www.rubydoc.info/github/Block-Logic/solana-rpc-ruby/main/SolanaRpcRuby
|
46
|
+
|
47
47
|
Also, as a reference you can use docs from solana: https://docs.solana.com/developing/clients/jsonrpc-api
|
48
48
|
## License
|
49
49
|
|
@@ -6,7 +6,7 @@ module SolanaRpcRuby
|
|
6
6
|
|
7
7
|
desc 'Creates a SolanaRpcRuby config file.'
|
8
8
|
def copy_config
|
9
|
-
template 'solana_rpc_ruby_config.rb', "#{Rails.root}/config/solana_rpc_ruby.rb"
|
9
|
+
template 'solana_rpc_ruby_config.rb', "#{Rails.root}/config/initializers/solana_rpc_ruby.rb"
|
10
10
|
end
|
11
11
|
end
|
12
12
|
end
|
@@ -1,14 +1,11 @@
|
|
1
1
|
require_relative 'solana_rpc_ruby'
|
2
2
|
|
3
|
-
# DEVNET_CLUSTER = 'https://api.devnet.solana.com'
|
4
|
-
# MAINNET_CLUSTER = 'https://api.mainnet-beta.solana.com'
|
5
|
-
# TESTNET_CLUSTER = 'https://api.testnet.solana.com'
|
6
|
-
|
7
3
|
SolanaRpcRuby.config do |c|
|
8
|
-
# These are
|
4
|
+
# These are options that you can set before using gem:
|
9
5
|
#
|
6
|
+
# You can use this setting or pass cluster directly, check the docs.
|
10
7
|
# c.cluster = 'https://api.testnet.solana.com'
|
11
|
-
|
12
|
-
#
|
13
|
-
|
8
|
+
|
9
|
+
# This one is mandatory.
|
10
|
+
c.json_rpc_version = '2.0'
|
14
11
|
end
|
data/lib/solana_rpc_ruby.rb
CHANGED
@@ -14,10 +14,6 @@ module SolanaRpcRuby
|
|
14
14
|
# @return [String] json rpc version.
|
15
15
|
attr_accessor :json_rpc_version
|
16
16
|
|
17
|
-
# Default encoding that will be used.
|
18
|
-
# @return [String] encoding.
|
19
|
-
attr_accessor :encoding
|
20
|
-
|
21
17
|
# Config set from initializer.
|
22
18
|
# @return [String] encoding.
|
23
19
|
def config
|
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'net/http'
|
2
|
-
|
3
2
|
module SolanaRpcRuby
|
4
3
|
##
|
5
4
|
# ApiClient class serves as a client for solana JSON RPC API.
|
@@ -14,29 +13,29 @@ module SolanaRpcRuby
|
|
14
13
|
attr_accessor :default_headers
|
15
14
|
|
16
15
|
# Initialize object with cluster address where requests will be sent.
|
17
|
-
#
|
18
|
-
# @param cluster [String]
|
16
|
+
#
|
17
|
+
# @param cluster [String]
|
19
18
|
def initialize(cluster = nil)
|
20
19
|
@cluster = cluster || SolanaRpcRuby.cluster
|
21
20
|
|
22
21
|
message = 'Cluster is missing. Please provide default cluster in config or pass it to the client directly.'
|
23
22
|
raise ArgumentError, message unless @cluster
|
24
23
|
end
|
25
|
-
|
24
|
+
|
26
25
|
# Sends request to the api.
|
27
26
|
#
|
28
|
-
# @param body [Hash]
|
27
|
+
# @param body [Hash]
|
29
28
|
# @param http_method [Symbol]
|
30
29
|
# @param params [Hash]
|
31
|
-
#
|
30
|
+
#
|
32
31
|
# @return [Object] Net::HTTPOK
|
33
32
|
def call_api(body:, http_method:, params: {})
|
34
33
|
uri = URI(@cluster)
|
35
34
|
rpc_response = Net::HTTP.public_send(
|
36
|
-
http_method,
|
37
|
-
uri,
|
38
|
-
body,
|
39
|
-
default_headers,
|
35
|
+
http_method,
|
36
|
+
uri,
|
37
|
+
body,
|
38
|
+
default_headers,
|
40
39
|
)
|
41
40
|
|
42
41
|
rpc_response
|
@@ -44,12 +43,12 @@ module SolanaRpcRuby
|
|
44
43
|
rescue Timeout::Error,
|
45
44
|
Net::HTTPError,
|
46
45
|
Net::HTTPNotFound,
|
47
|
-
Net::
|
46
|
+
Net::HTTPClientException,
|
48
47
|
Net::HTTPFatalError,
|
49
48
|
Net::ReadTimeout => e
|
50
|
-
|
51
49
|
fail ApiError.new(message: e.message)
|
52
50
|
rescue StandardError => e
|
51
|
+
|
53
52
|
message = "#{e.class} #{e.message}\n Backtrace: \n #{e.backtrace}"
|
54
53
|
fail ApiError.new(message: message)
|
55
54
|
end
|
@@ -6,20 +6,20 @@ module SolanaRpcRuby
|
|
6
6
|
# Error code.
|
7
7
|
# @return [Integer]
|
8
8
|
attr_reader :code
|
9
|
-
|
9
|
+
|
10
10
|
# Error message.
|
11
11
|
# @return [String]
|
12
12
|
attr_reader :message
|
13
|
-
|
13
|
+
|
14
14
|
# Initialize object with json response from the API with error.
|
15
|
-
#
|
15
|
+
#
|
16
16
|
# @param code [Integer]
|
17
17
|
# @param message [String]
|
18
|
-
#
|
18
|
+
#
|
19
19
|
# @return [SolanaRpcRuby::ApiError]
|
20
20
|
def initialize(code: nil, message:)
|
21
21
|
@code = code
|
22
|
-
@message = message
|
22
|
+
@message = message.to_s
|
23
23
|
|
24
24
|
super message
|
25
25
|
end
|
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'json'
|
2
|
-
require 'pry'
|
3
2
|
require_relative 'request_body'
|
4
3
|
require_relative 'helper_methods'
|
5
4
|
|
@@ -21,22 +20,22 @@ module SolanaRpcRuby
|
|
21
20
|
attr_accessor :cluster
|
22
21
|
|
23
22
|
# Initialize object with cluster address where requests will be sent.
|
24
|
-
#
|
23
|
+
#
|
25
24
|
# @param api_client [ApiClient]
|
26
|
-
# @param cluster [String] cluster where requests will be sent.
|
25
|
+
# @param cluster [String] cluster where requests will be sent.
|
27
26
|
def initialize(api_client: ApiClient, cluster: SolanaRpcRuby.cluster)
|
28
27
|
@api_client = api_client.new(cluster)
|
29
28
|
end
|
30
29
|
|
31
30
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getaccountinfo
|
32
31
|
# Returns all information associated with the account of provided Pubkey
|
33
|
-
#
|
32
|
+
#
|
34
33
|
# @param account_pubkey [String]
|
35
34
|
# @param encoding [String]
|
36
35
|
# @param data_slice [Hash]
|
37
36
|
# @option data_slice [Integer] :offset
|
38
37
|
# @option data_slice [Integer] :length
|
39
|
-
#
|
38
|
+
#
|
40
39
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
41
40
|
def get_account_info(account_pubkey, encoding: '', data_slice: {})
|
42
41
|
http_method = :post
|
@@ -58,10 +57,10 @@ module SolanaRpcRuby
|
|
58
57
|
|
59
58
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getbalance
|
60
59
|
# Returns the balance of the account of provided Pubkey
|
61
|
-
#
|
60
|
+
#
|
62
61
|
# @param account_pubkey [String]
|
63
62
|
# @param commitment [String]
|
64
|
-
#
|
63
|
+
#
|
65
64
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
66
65
|
def get_balance(account_pubkey, commitment: nil)
|
67
66
|
http_method = :post
|
@@ -84,13 +83,13 @@ module SolanaRpcRuby
|
|
84
83
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getblock
|
85
84
|
# NEW: This method is only available in solana-core v1.7 or newer. Please use getConfirmedBlock for solana-core v1.6
|
86
85
|
# Returns identity and transaction information about a confirmed block in the ledger
|
87
|
-
#
|
86
|
+
#
|
88
87
|
# @param slot [Integer]
|
89
88
|
# @param encoding [String]
|
90
89
|
# @param transaction_details [String]
|
91
90
|
# @param rewards [Boolean]
|
92
91
|
# @param commitment [String]
|
93
|
-
#
|
92
|
+
#
|
94
93
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
95
94
|
def get_block(slot, encoding: '', transaction_details: '', rewards: true, commitment: nil)
|
96
95
|
http_method = :post
|
@@ -114,9 +113,9 @@ module SolanaRpcRuby
|
|
114
113
|
|
115
114
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getblockheight
|
116
115
|
# Returns the current block height of the node
|
117
|
-
#
|
116
|
+
#
|
118
117
|
# @param commitment [String]
|
119
|
-
#
|
118
|
+
#
|
120
119
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
121
120
|
def get_block_height(commitment: nil)
|
122
121
|
http_method = :post
|
@@ -135,13 +134,13 @@ module SolanaRpcRuby
|
|
135
134
|
|
136
135
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getblockproduction
|
137
136
|
# Returns recent block production information from the current or previous epoch.
|
138
|
-
#
|
137
|
+
#
|
139
138
|
# @param identity [String]
|
140
139
|
# @param range [Hash]
|
141
140
|
# @option range [Integer] first_slot (required for range)
|
142
141
|
# @option range [Integer] last_slot (optional for range)
|
143
142
|
# @param commitment [String]
|
144
|
-
#
|
143
|
+
#
|
145
144
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
146
145
|
def get_block_production(identity: nil, range: {}, commitment: nil)
|
147
146
|
http_method = :post
|
@@ -153,7 +152,7 @@ module SolanaRpcRuby
|
|
153
152
|
|
154
153
|
range_hash['firstSlot'] = range[:first_slot] unless !range.key?(:first_slot)
|
155
154
|
range_hash['lastSlot'] = range[:last_slot] unless !range.key?(:last_slot)
|
156
|
-
|
155
|
+
|
157
156
|
params_hash['identity'] = identity unless blank?(identity)
|
158
157
|
params_hash['range'] = range_hash unless range_hash.empty?
|
159
158
|
|
@@ -166,9 +165,9 @@ module SolanaRpcRuby
|
|
166
165
|
|
167
166
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getblockcommitment
|
168
167
|
# Returns commitment for particular block
|
169
|
-
#
|
168
|
+
#
|
170
169
|
# @param block [Integer]
|
171
|
-
#
|
170
|
+
#
|
172
171
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
173
172
|
def get_block_commitment(block)
|
174
173
|
http_method = :post
|
@@ -186,10 +185,10 @@ module SolanaRpcRuby
|
|
186
185
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getblocks
|
187
186
|
# NEW: This method is only available in solana-core v1.7 or newer. Please use getConfirmedBlocks for solana-core v1.6
|
188
187
|
# Returns a list of confirmed blocks between two slots
|
189
|
-
#
|
188
|
+
#
|
190
189
|
# @param start_slot [Integer]
|
191
190
|
# @param end_slot [Integer]
|
192
|
-
#
|
191
|
+
#
|
193
192
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
194
193
|
def get_blocks(start_slot, end_slot: nil)
|
195
194
|
http_method = :post
|
@@ -208,11 +207,11 @@ module SolanaRpcRuby
|
|
208
207
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getblockswithlimit
|
209
208
|
# NEW: This method is only available in solana-core v1.7 or newer. Please use getConfirmedBlocks for solana-core v1.6
|
210
209
|
# Returns a list of confirmed blocks starting at the given slot
|
211
|
-
#
|
210
|
+
#
|
212
211
|
# @param start_slot [Integer]
|
213
212
|
# @param limit [Integer]
|
214
213
|
# @param commitment [String]
|
215
|
-
#
|
214
|
+
#
|
216
215
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
217
216
|
def get_blocks_with_limit(start_slot, limit, commitment: nil)
|
218
217
|
http_method = :post
|
@@ -234,9 +233,9 @@ module SolanaRpcRuby
|
|
234
233
|
|
235
234
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getblocktime
|
236
235
|
# Returns the estimated production time of a block.
|
237
|
-
#
|
236
|
+
#
|
238
237
|
# @param block [Integer]
|
239
|
-
#
|
238
|
+
#
|
240
239
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
241
240
|
def get_block_time(block)
|
242
241
|
http_method = :post
|
@@ -253,7 +252,7 @@ module SolanaRpcRuby
|
|
253
252
|
|
254
253
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getclusternodes
|
255
254
|
# Returns information about all the nodes participating in the cluster
|
256
|
-
#
|
255
|
+
#
|
257
256
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
258
257
|
def get_cluster_nodes
|
259
258
|
http_method = :post
|
@@ -267,10 +266,10 @@ module SolanaRpcRuby
|
|
267
266
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getepochinfo
|
268
267
|
# DEPRECATED: Please use getBlocks instead This method is expected to be removed in solana-core v1.8
|
269
268
|
# Returns a list of confirmed blocks between two slots
|
270
|
-
#
|
269
|
+
#
|
271
270
|
# @param start_slot [Integer]
|
272
271
|
# @param end_slot [Integer]
|
273
|
-
#
|
272
|
+
#
|
274
273
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
275
274
|
def get_confirmed_blocks(start_slot, end_slot: nil)
|
276
275
|
http_method = :post
|
@@ -288,9 +287,9 @@ module SolanaRpcRuby
|
|
288
287
|
|
289
288
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getepochinfo
|
290
289
|
# Returns information about the current epoch
|
291
|
-
#
|
290
|
+
#
|
292
291
|
# @param commitment [String]
|
293
|
-
#
|
292
|
+
#
|
294
293
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
295
294
|
def get_epoch_info(commitment: nil)
|
296
295
|
http_method = :post
|
@@ -300,7 +299,7 @@ module SolanaRpcRuby
|
|
300
299
|
params_hash = {}
|
301
300
|
|
302
301
|
params_hash['commitment'] = commitment unless blank?(commitment)
|
303
|
-
|
302
|
+
|
304
303
|
params << params_hash unless params_hash.empty?
|
305
304
|
|
306
305
|
body = create_json_body(method, method_params: params)
|
@@ -310,7 +309,7 @@ module SolanaRpcRuby
|
|
310
309
|
|
311
310
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getepochschedule
|
312
311
|
# Returns epoch schedule information from this cluster's genesis config
|
313
|
-
#
|
312
|
+
#
|
314
313
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
315
314
|
def get_epoch_schedule
|
316
315
|
http_method = :post
|
@@ -323,10 +322,10 @@ module SolanaRpcRuby
|
|
323
322
|
|
324
323
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getfeecalculatorforblockhash
|
325
324
|
# Returns the fee calculator associated with the query blockhash, or null if the blockhash has expired
|
326
|
-
#
|
325
|
+
#
|
327
326
|
# @param query_blockhash [String]
|
328
327
|
# @param commitment [String]
|
329
|
-
#
|
328
|
+
#
|
330
329
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
331
330
|
def get_fee_calculator_for_blockhash(query_blockhash, commitment: nil)
|
332
331
|
http_method = :post
|
@@ -347,7 +346,7 @@ module SolanaRpcRuby
|
|
347
346
|
|
348
347
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getfeerategovernor
|
349
348
|
# Returns the fee rate governor information from the root bank
|
350
|
-
#
|
349
|
+
#
|
351
350
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
352
351
|
def get_fee_rate_governor
|
353
352
|
http_method = :post
|
@@ -359,11 +358,11 @@ module SolanaRpcRuby
|
|
359
358
|
end
|
360
359
|
|
361
360
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getfees
|
362
|
-
# Returns a recent block hash from the ledger, a fee schedule that can be used to compute
|
361
|
+
# Returns a recent block hash from the ledger, a fee schedule that can be used to compute
|
363
362
|
# the cost of submitting a transaction using it, and the last slot in which the blockhash will be valid.
|
364
|
-
#
|
363
|
+
#
|
365
364
|
# @param commitment [String]
|
366
|
-
#
|
365
|
+
#
|
367
366
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
368
367
|
def get_fees(commitment: nil)
|
369
368
|
http_method = :post
|
@@ -382,7 +381,7 @@ module SolanaRpcRuby
|
|
382
381
|
|
383
382
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getfirstavailableblock
|
384
383
|
# Returns the slot of the lowest confirmed block that has not been purged from the ledger
|
385
|
-
#
|
384
|
+
#
|
386
385
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
387
386
|
def get_first_available_block
|
388
387
|
http_method = :post
|
@@ -395,12 +394,12 @@ module SolanaRpcRuby
|
|
395
394
|
|
396
395
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getgenesishash
|
397
396
|
# Returns the genesis hash.
|
398
|
-
#
|
397
|
+
#
|
399
398
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
400
399
|
def get_genesis_hash
|
401
400
|
http_method = :post
|
402
401
|
method = create_method_name(__method__)
|
403
|
-
|
402
|
+
|
404
403
|
body = create_json_body(method)
|
405
404
|
|
406
405
|
send_request(body, http_method)
|
@@ -408,12 +407,12 @@ module SolanaRpcRuby
|
|
408
407
|
|
409
408
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#gethealth
|
410
409
|
# Returns the current health of the node.
|
411
|
-
#
|
410
|
+
#
|
412
411
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
413
412
|
def get_health
|
414
413
|
http_method = :post
|
415
414
|
method = create_method_name(__method__)
|
416
|
-
|
415
|
+
|
417
416
|
body = create_json_body(method)
|
418
417
|
|
419
418
|
send_request(body, http_method)
|
@@ -421,12 +420,12 @@ module SolanaRpcRuby
|
|
421
420
|
|
422
421
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getidentity
|
423
422
|
# Returns the identity pubkey for the current node.
|
424
|
-
#
|
423
|
+
#
|
425
424
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
426
425
|
def get_identity
|
427
426
|
http_method = :post
|
428
427
|
method = create_method_name(__method__)
|
429
|
-
|
428
|
+
|
430
429
|
body = create_json_body(method)
|
431
430
|
|
432
431
|
send_request(body, http_method)
|
@@ -434,9 +433,9 @@ module SolanaRpcRuby
|
|
434
433
|
|
435
434
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getinflationgovernor
|
436
435
|
# Returns the current inflation governor.
|
437
|
-
#
|
436
|
+
#
|
438
437
|
# @param commitment [String]
|
439
|
-
#
|
438
|
+
#
|
440
439
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
441
440
|
def get_inflation_governor(commitment: nil)
|
442
441
|
http_method = :post
|
@@ -448,7 +447,7 @@ module SolanaRpcRuby
|
|
448
447
|
params_hash['commitment'] = commitment unless blank?(commitment)
|
449
448
|
|
450
449
|
params << params_hash unless params_hash.empty?
|
451
|
-
|
450
|
+
|
452
451
|
body = create_json_body(method, method_params: params)
|
453
452
|
|
454
453
|
send_request(body, http_method)
|
@@ -456,12 +455,12 @@ module SolanaRpcRuby
|
|
456
455
|
|
457
456
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getinflationrate
|
458
457
|
# Returns the specific inflation values for the current epoch.
|
459
|
-
#
|
458
|
+
#
|
460
459
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
461
460
|
def get_inflation_rate
|
462
461
|
http_method = :post
|
463
462
|
method = create_method_name(__method__)
|
464
|
-
|
463
|
+
|
465
464
|
body = create_json_body(method)
|
466
465
|
|
467
466
|
send_request(body, http_method)
|
@@ -469,16 +468,16 @@ module SolanaRpcRuby
|
|
469
468
|
|
470
469
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getinflationreward
|
471
470
|
# Returns the inflation reward for a list of addresses for an epoch.
|
472
|
-
#
|
471
|
+
#
|
473
472
|
# @param addresses [Array]
|
474
473
|
# @param commitment [String]
|
475
474
|
# @param epoch [Integer]
|
476
|
-
#
|
475
|
+
#
|
477
476
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
478
477
|
def get_inflation_reward(addresses, commitment: nil, epoch: nil)
|
479
478
|
http_method = :post
|
480
479
|
method = create_method_name(__method__)
|
481
|
-
|
480
|
+
|
482
481
|
params = []
|
483
482
|
params_hash = {}
|
484
483
|
|
@@ -496,15 +495,15 @@ module SolanaRpcRuby
|
|
496
495
|
|
497
496
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getlargestaccounts
|
498
497
|
# Returns the 20 largest accounts, by lamport balance (results may be cached up to two hours)
|
499
|
-
#
|
498
|
+
#
|
500
499
|
# @param commitment [String]
|
501
500
|
# @param filter [String]
|
502
|
-
#
|
501
|
+
#
|
503
502
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
504
503
|
def get_largest_accounts(commitment: nil, filter: '')
|
505
504
|
http_method = :post
|
506
505
|
method = create_method_name(__method__)
|
507
|
-
|
506
|
+
|
508
507
|
params = []
|
509
508
|
params_hash = {}
|
510
509
|
|
@@ -520,16 +519,16 @@ module SolanaRpcRuby
|
|
520
519
|
|
521
520
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getleaderschedule
|
522
521
|
# Returns the leader schedule for an epoch.
|
523
|
-
#
|
522
|
+
#
|
524
523
|
# @param epoch [Integer]
|
525
524
|
# @param commitment [String]
|
526
525
|
# @param identity [String]
|
527
|
-
#
|
526
|
+
#
|
528
527
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
529
528
|
def get_leader_schedule(epoch: nil, commitment: nil, identity: '')
|
530
529
|
http_method = :post
|
531
530
|
method = create_method_name(__method__)
|
532
|
-
|
531
|
+
|
533
532
|
params = []
|
534
533
|
params_hash = {}
|
535
534
|
|
@@ -546,12 +545,12 @@ module SolanaRpcRuby
|
|
546
545
|
|
547
546
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getmaxretransmitslot
|
548
547
|
# Get the max slot seen from retransmit stage.
|
549
|
-
#
|
548
|
+
#
|
550
549
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
551
550
|
def get_max_retransmit_slot
|
552
551
|
http_method = :post
|
553
552
|
method = create_method_name(__method__)
|
554
|
-
|
553
|
+
|
555
554
|
body = create_json_body(method)
|
556
555
|
|
557
556
|
send_request(body, http_method)
|
@@ -559,12 +558,12 @@ module SolanaRpcRuby
|
|
559
558
|
|
560
559
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getmaxshredinsertslot
|
561
560
|
# Get the max slot seen from after shred insert.
|
562
|
-
#
|
561
|
+
#
|
563
562
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
564
563
|
def get_max_shred_insert_slot
|
565
564
|
http_method = :post
|
566
565
|
method = create_method_name(__method__)
|
567
|
-
|
566
|
+
|
568
567
|
body = create_json_body(method)
|
569
568
|
|
570
569
|
send_request(body, http_method)
|
@@ -572,23 +571,23 @@ module SolanaRpcRuby
|
|
572
571
|
|
573
572
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getminimumbalanceforrentexemption
|
574
573
|
# Returns minimum balance required to make account rent exempt.
|
575
|
-
#
|
574
|
+
#
|
576
575
|
# @param account_data_length [String]
|
577
576
|
# @param commitment [String]
|
578
|
-
#
|
577
|
+
#
|
579
578
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
580
579
|
def get_minimum_balance_for_rent_exemption(
|
581
|
-
account_data_length,
|
580
|
+
account_data_length,
|
582
581
|
commitment: nil
|
583
582
|
)
|
584
583
|
http_method = :post
|
585
584
|
method = create_method_name(__method__)
|
586
|
-
|
585
|
+
|
587
586
|
params = []
|
588
587
|
params_hash = {}
|
589
588
|
|
590
589
|
params_hash['commitment'] = commitment unless blank?(commitment)
|
591
|
-
|
590
|
+
|
592
591
|
params << account_data_length
|
593
592
|
params << params_hash unless params_hash.empty?
|
594
593
|
|
@@ -597,31 +596,31 @@ module SolanaRpcRuby
|
|
597
596
|
send_request(body, http_method)
|
598
597
|
end
|
599
598
|
|
600
|
-
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getmultipleaccounts
|
599
|
+
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getmultipleaccounts
|
601
600
|
# Returns the account information for a list of Pubkeys.
|
602
601
|
# @param account_data_length [String]
|
603
602
|
# @param commitment [String]
|
604
|
-
#
|
603
|
+
#
|
605
604
|
# @return [Response, ApiError] Response when success, ApiError on failure. # @param account_data_length [String]
|
606
605
|
# @param commitment [String]
|
607
|
-
#
|
606
|
+
#
|
608
607
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
609
608
|
def get_multiple_accounts(
|
610
|
-
pubkeys,
|
609
|
+
pubkeys,
|
611
610
|
commitment: nil,
|
612
611
|
encoding: '',
|
613
612
|
data_slice: {}
|
614
613
|
)
|
615
614
|
http_method = :post
|
616
615
|
method = create_method_name(__method__)
|
617
|
-
|
616
|
+
|
618
617
|
params = []
|
619
618
|
params_hash = {}
|
620
|
-
|
619
|
+
|
621
620
|
params_hash['commitment'] = commitment unless blank?(commitment)
|
622
621
|
params_hash['encoding'] = encoding unless blank?(encoding)
|
623
622
|
params_hash['dataSlice'] = data_slice unless data_slice.empty?
|
624
|
-
|
623
|
+
|
625
624
|
params << pubkeys
|
626
625
|
params << params_hash unless params_hash.empty?
|
627
626
|
|
@@ -632,7 +631,7 @@ module SolanaRpcRuby
|
|
632
631
|
|
633
632
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getprogramaccounts
|
634
633
|
# Returns all accounts owned by the provided program Pubkey
|
635
|
-
#
|
634
|
+
#
|
636
635
|
# @param pubkey [String]
|
637
636
|
# @param commitment [String]
|
638
637
|
# @param encoding [String]
|
@@ -640,11 +639,17 @@ module SolanaRpcRuby
|
|
640
639
|
# @option data_slice [Integer] :offset
|
641
640
|
# @option data_slice [Integer] :length
|
642
641
|
# @param filters [Array<Hash, Hash>]
|
642
|
+
# @option filters [Hash<String, Integer>]
|
643
|
+
# * dataSize, Integer, 1
|
644
|
+
# @option filters [Hash<String, Hash>]
|
645
|
+
# * memcmp, Hash<String, Object>
|
646
|
+
# * offset, Integer, 1
|
647
|
+
# * bytes, String, '3Mc6vR'
|
643
648
|
# @param with_context [Boolean]
|
644
|
-
#
|
649
|
+
#
|
645
650
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
646
651
|
def get_program_accounts(
|
647
|
-
pubkey,
|
652
|
+
pubkey,
|
648
653
|
commitment: nil,
|
649
654
|
encoding: '',
|
650
655
|
data_slice: {},
|
@@ -653,10 +658,10 @@ module SolanaRpcRuby
|
|
653
658
|
)
|
654
659
|
http_method = :post
|
655
660
|
method = create_method_name(__method__)
|
656
|
-
|
661
|
+
|
657
662
|
params = []
|
658
663
|
params_hash = {}
|
659
|
-
|
664
|
+
|
660
665
|
params_hash['commitment'] = commitment unless blank?(commitment)
|
661
666
|
params_hash['encoding'] = encoding unless blank?(encoding)
|
662
667
|
params_hash['dataSlice'] = data_slice unless data_slice.empty?
|
@@ -672,19 +677,19 @@ module SolanaRpcRuby
|
|
672
677
|
end
|
673
678
|
|
674
679
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getrecentblockhash
|
675
|
-
# Returns a recent block hash from the ledger, and a fee schedule
|
680
|
+
# Returns a recent block hash from the ledger, and a fee schedule
|
676
681
|
# that can be used to compute the cost of submitting a transaction using it.
|
677
|
-
#
|
682
|
+
#
|
678
683
|
# @param commitment [String]
|
679
|
-
#
|
684
|
+
#
|
680
685
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
681
686
|
def get_recent_blockhash(commitment: nil)
|
682
687
|
http_method = :post
|
683
688
|
method = create_method_name(__method__)
|
684
|
-
|
689
|
+
|
685
690
|
params = []
|
686
691
|
params_hash = {}
|
687
|
-
|
692
|
+
|
688
693
|
params_hash['commitment'] = commitment unless blank?(commitment)
|
689
694
|
|
690
695
|
params << params_hash unless params_hash.empty?
|
@@ -695,16 +700,16 @@ module SolanaRpcRuby
|
|
695
700
|
end
|
696
701
|
|
697
702
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getrecentperformancesamples
|
698
|
-
# Returns a list of recent performance samples, in reverse slot order.
|
703
|
+
# Returns a list of recent performance samples, in reverse slot order.
|
699
704
|
# Performance samples are taken every 60 seconds and include the number of transactions and slots that occur in a given time window.
|
700
|
-
#
|
705
|
+
#
|
701
706
|
# @param limit [Integer]
|
702
|
-
#
|
707
|
+
#
|
703
708
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
704
709
|
def get_recent_performance_samples(limit: nil)
|
705
710
|
http_method = :post
|
706
711
|
method = create_method_name(__method__)
|
707
|
-
|
712
|
+
|
708
713
|
params = []
|
709
714
|
|
710
715
|
params << limit unless limit.nil?
|
@@ -716,7 +721,7 @@ module SolanaRpcRuby
|
|
716
721
|
|
717
722
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getsnapshotslot
|
718
723
|
# Returns the highest slot that the node has a snapshot for.
|
719
|
-
#
|
724
|
+
#
|
720
725
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
721
726
|
def get_snapshot_slot
|
722
727
|
http_method = :post
|
@@ -728,18 +733,18 @@ module SolanaRpcRuby
|
|
728
733
|
end
|
729
734
|
|
730
735
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getsignaturesforaddress
|
731
|
-
# NEW: This method is only available in solana-core v1.7 or newer.
|
736
|
+
# NEW: This method is only available in solana-core v1.7 or newer.
|
732
737
|
# Please use getConfirmedSignaturesForAddress2 for solana-core v1.6
|
733
|
-
#
|
734
|
-
# Returns confirmed signatures for transactions involving an address backwards
|
738
|
+
#
|
739
|
+
# Returns confirmed signatures for transactions involving an address backwards
|
735
740
|
# in time from the provided signature or most recent confirmed block
|
736
|
-
#
|
741
|
+
#
|
737
742
|
# @param account_address [String]
|
738
743
|
# @param limit [Integer]
|
739
744
|
# @param before [String]
|
740
745
|
# @param until_ [String]
|
741
746
|
# @param commitment [String]
|
742
|
-
#
|
747
|
+
#
|
743
748
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
744
749
|
def get_signatures_for_address(
|
745
750
|
account_address,
|
@@ -750,7 +755,7 @@ module SolanaRpcRuby
|
|
750
755
|
)
|
751
756
|
http_method = :post
|
752
757
|
method = create_method_name(__method__)
|
753
|
-
|
758
|
+
|
754
759
|
params = []
|
755
760
|
params_hash = {}
|
756
761
|
|
@@ -767,16 +772,16 @@ module SolanaRpcRuby
|
|
767
772
|
send_request(body, http_method)
|
768
773
|
end
|
769
774
|
|
770
|
-
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getsignaturestatuses # NEW: This method is only available in solana-core v1.7 or newer.
|
771
|
-
#
|
772
|
-
# Returns the statuses of a list of signatures.
|
773
|
-
# Unless the searchTransactionHistory configuration parameter is included,
|
774
|
-
# this method only searches the recent status cache of signatures,
|
775
|
+
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getsignaturestatuses # NEW: This method is only available in solana-core v1.7 or newer.
|
776
|
+
#
|
777
|
+
# Returns the statuses of a list of signatures.
|
778
|
+
# Unless the searchTransactionHistory configuration parameter is included,
|
779
|
+
# this method only searches the recent status cache of signatures,
|
775
780
|
# which retains statuses for all active slots plus MAX_RECENT_BLOCKHASHES rooted slots.
|
776
|
-
#
|
781
|
+
#
|
777
782
|
# @param transaction_signatures [Array]
|
778
783
|
# @param search_transaction_history [Boolean]
|
779
|
-
#
|
784
|
+
#
|
780
785
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
781
786
|
def get_signature_statuses(
|
782
787
|
transaction_signatures,
|
@@ -784,7 +789,7 @@ module SolanaRpcRuby
|
|
784
789
|
)
|
785
790
|
http_method = :post
|
786
791
|
method = create_method_name(__method__)
|
787
|
-
|
792
|
+
|
788
793
|
params = []
|
789
794
|
params_hash = {}
|
790
795
|
|
@@ -800,17 +805,17 @@ module SolanaRpcRuby
|
|
800
805
|
|
801
806
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getslot
|
802
807
|
# Returns the current slot the node is processing.
|
803
|
-
#
|
808
|
+
#
|
804
809
|
# @param commitment [String]
|
805
|
-
#
|
810
|
+
#
|
806
811
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
807
812
|
def get_slot(commitment: nil)
|
808
813
|
http_method = :post
|
809
814
|
method = create_method_name(__method__)
|
810
|
-
|
815
|
+
|
811
816
|
params = []
|
812
817
|
params_hash = {}
|
813
|
-
|
818
|
+
|
814
819
|
params_hash['commitment'] = commitment unless blank?(commitment)
|
815
820
|
|
816
821
|
params << params_hash unless params_hash.empty?
|
@@ -822,19 +827,19 @@ module SolanaRpcRuby
|
|
822
827
|
|
823
828
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getslotleader
|
824
829
|
# Returns the current slot leader
|
825
|
-
#
|
830
|
+
#
|
826
831
|
# @param commitment [String]
|
827
|
-
#
|
832
|
+
#
|
828
833
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
829
834
|
def get_slot_leader(commitment: nil)
|
830
835
|
http_method = :post
|
831
836
|
method = create_method_name(__method__)
|
832
|
-
|
837
|
+
|
833
838
|
params = []
|
834
839
|
params_hash = {}
|
835
840
|
|
836
841
|
params_hash['commitment'] = commitment unless blank?(commitment)
|
837
|
-
|
842
|
+
|
838
843
|
params << params_hash unless params_hash.empty?
|
839
844
|
|
840
845
|
body = create_json_body(method, method_params: params)
|
@@ -844,15 +849,15 @@ module SolanaRpcRuby
|
|
844
849
|
|
845
850
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getslotleaders
|
846
851
|
# Returns the slot leaders for a given slot range.
|
847
|
-
#
|
852
|
+
#
|
848
853
|
# @param start_slot [Integer]
|
849
854
|
# @param limit [Integer]
|
850
|
-
#
|
855
|
+
#
|
851
856
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
852
857
|
def get_slot_leaders(start_slot, limit)
|
853
858
|
http_method = :post
|
854
859
|
method = create_method_name(__method__)
|
855
|
-
|
860
|
+
|
856
861
|
params = [start_slot, limit]
|
857
862
|
|
858
863
|
body = create_json_body(method, method_params: params)
|
@@ -862,16 +867,16 @@ module SolanaRpcRuby
|
|
862
867
|
|
863
868
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getstakeactivation
|
864
869
|
# Returns epoch activation information for a stake account.
|
865
|
-
#
|
870
|
+
#
|
866
871
|
# @param pubkey [String]
|
867
872
|
# @param commitment [String]
|
868
873
|
# @param epoch [Integer]
|
869
|
-
#
|
874
|
+
#
|
870
875
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
871
876
|
def get_stake_activation(pubkey, commitment: nil, epoch: nil)
|
872
877
|
http_method = :post
|
873
878
|
method = create_method_name(__method__)
|
874
|
-
|
879
|
+
|
875
880
|
params = []
|
876
881
|
params_hash = {}
|
877
882
|
|
@@ -888,14 +893,14 @@ module SolanaRpcRuby
|
|
888
893
|
|
889
894
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getsupply
|
890
895
|
# Returns information about the current supply.
|
891
|
-
#
|
896
|
+
#
|
892
897
|
# @param commitment [String]
|
893
|
-
#
|
898
|
+
#
|
894
899
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
895
900
|
def get_supply(commitment: nil)
|
896
901
|
http_method = :post
|
897
902
|
method = create_method_name(__method__)
|
898
|
-
|
903
|
+
|
899
904
|
params = []
|
900
905
|
params_hash = {}
|
901
906
|
|
@@ -909,17 +914,17 @@ module SolanaRpcRuby
|
|
909
914
|
end
|
910
915
|
|
911
916
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#gettokenaccountbalance
|
912
|
-
#
|
917
|
+
#
|
913
918
|
# Returns the token balance of an SPL Token account.
|
914
|
-
#
|
919
|
+
#
|
915
920
|
# @param token_account_pubkey [String]
|
916
921
|
# @param commitment [String]
|
917
|
-
#
|
922
|
+
#
|
918
923
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
919
924
|
def get_token_account_balance(token_account_pubkey, commitment: nil)
|
920
925
|
http_method = :post
|
921
926
|
method = create_method_name(__method__)
|
922
|
-
|
927
|
+
|
923
928
|
params = []
|
924
929
|
params_hash = {}
|
925
930
|
|
@@ -934,11 +939,11 @@ module SolanaRpcRuby
|
|
934
939
|
end
|
935
940
|
|
936
941
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#gettokenaccountsbydelegate # Returns the token balance of an SPL Token account.
|
937
|
-
#
|
942
|
+
#
|
938
943
|
# Returns all SPL Token accounts by approved Delegate.
|
939
|
-
#
|
944
|
+
#
|
940
945
|
# IMPORTANT: According to docs there should be mint or program_id passed in, not both.
|
941
|
-
#
|
946
|
+
#
|
942
947
|
# @param token_account_pubkey [String]
|
943
948
|
# @param mint [String]
|
944
949
|
# @param program_id [String]
|
@@ -947,7 +952,7 @@ module SolanaRpcRuby
|
|
947
952
|
# @param data_slice [Hash]
|
948
953
|
# @option data_slice [Integer] :offset
|
949
954
|
# @option data_slice [Integer] :length
|
950
|
-
#
|
955
|
+
#
|
951
956
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
952
957
|
def get_token_accounts_by_delegate(
|
953
958
|
token_account_pubkey,
|
@@ -957,22 +962,22 @@ module SolanaRpcRuby
|
|
957
962
|
encoding: '',
|
958
963
|
data_slice: {}
|
959
964
|
)
|
960
|
-
|
961
|
-
raise ArgumentError, 'You should pass mint or program_id, not both.' if !mint
|
965
|
+
|
966
|
+
raise ArgumentError, 'You should pass mint or program_id, not both.' if !blank?(mint) && !blank?(program_id)
|
962
967
|
|
963
968
|
http_method = :post
|
964
969
|
method = create_method_name(__method__)
|
965
|
-
|
970
|
+
|
966
971
|
params = []
|
967
972
|
params_hash = {}
|
968
973
|
params_hash_2 = {}
|
969
974
|
|
970
|
-
params_hash['mint'] = mint unless mint
|
971
|
-
params_hash['programId'] = program_id unless program_id
|
975
|
+
params_hash['mint'] = mint unless blank?(mint)
|
976
|
+
params_hash['programId'] = program_id unless blank?(program_id)
|
972
977
|
|
973
978
|
params_hash_2['commitment'] = commitment unless blank?(commitment)
|
974
979
|
params_hash_2['encoding'] = encoding unless blank?(encoding)
|
975
|
-
params_hash_2['dataSlice'] = data_slice unless data_slice
|
980
|
+
params_hash_2['dataSlice'] = data_slice unless blank?(data_slice)
|
976
981
|
|
977
982
|
params << token_account_pubkey
|
978
983
|
params << params_hash unless params_hash.empty?
|
@@ -983,12 +988,12 @@ module SolanaRpcRuby
|
|
983
988
|
send_request(body, http_method)
|
984
989
|
end
|
985
990
|
|
986
|
-
# @see https://docs.solana.com/developing/clients/jsonrpc-api#gettokenaccountsbyowner #
|
987
|
-
#
|
991
|
+
# @see https://docs.solana.com/developing/clients/jsonrpc-api#gettokenaccountsbyowner #
|
992
|
+
#
|
988
993
|
# Returns all SPL Token accounts by token owner.
|
989
|
-
#
|
994
|
+
#
|
990
995
|
# IMPORTANT: According to docs there should be mint or program_id passed in, not both.
|
991
|
-
#
|
996
|
+
#
|
992
997
|
# @param token_account_pubkey [String]
|
993
998
|
# @param mint [String]
|
994
999
|
# @param program_id [String]
|
@@ -997,7 +1002,7 @@ module SolanaRpcRuby
|
|
997
1002
|
# @param data_slice [Hash]
|
998
1003
|
# @option data_slice [Integer] :offset
|
999
1004
|
# @option data_slice [Integer] :length
|
1000
|
-
#
|
1005
|
+
#
|
1001
1006
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
1002
1007
|
def get_token_accounts_by_owner(
|
1003
1008
|
token_account_pubkey,
|
@@ -1012,7 +1017,7 @@ module SolanaRpcRuby
|
|
1012
1017
|
|
1013
1018
|
http_method = :post
|
1014
1019
|
method = create_method_name(__method__)
|
1015
|
-
|
1020
|
+
|
1016
1021
|
params = []
|
1017
1022
|
params_hash = {}
|
1018
1023
|
params_hash_2 = {}
|
@@ -1034,13 +1039,13 @@ module SolanaRpcRuby
|
|
1034
1039
|
send_request(body, http_method)
|
1035
1040
|
end
|
1036
1041
|
|
1037
|
-
# @see https://docs.solana.com/developing/clients/jsonrpc-api#gettokenlargestaccounts #
|
1038
|
-
#
|
1042
|
+
# @see https://docs.solana.com/developing/clients/jsonrpc-api#gettokenlargestaccounts #
|
1043
|
+
#
|
1039
1044
|
# Returns the 20 largest accounts of a particular SPL Token type.
|
1040
|
-
#
|
1045
|
+
#
|
1041
1046
|
# @param token_mint_pubkey [String]
|
1042
1047
|
# @param commitment [String]
|
1043
|
-
#
|
1048
|
+
#
|
1044
1049
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
1045
1050
|
def get_token_largest_accounts(
|
1046
1051
|
token_mint_pubkey,
|
@@ -1049,7 +1054,7 @@ module SolanaRpcRuby
|
|
1049
1054
|
|
1050
1055
|
http_method = :post
|
1051
1056
|
method = create_method_name(__method__)
|
1052
|
-
|
1057
|
+
|
1053
1058
|
params = []
|
1054
1059
|
params_hash = {}
|
1055
1060
|
|
@@ -1063,19 +1068,19 @@ module SolanaRpcRuby
|
|
1063
1068
|
send_request(body, http_method)
|
1064
1069
|
end
|
1065
1070
|
|
1066
|
-
# @see https://docs.solana.com/developing/clients/jsonrpc-api#gettransaction
|
1067
|
-
#
|
1071
|
+
# @see https://docs.solana.com/developing/clients/jsonrpc-api#gettransaction
|
1072
|
+
#
|
1068
1073
|
# Returns transaction details for a confirmed transaction
|
1069
|
-
#
|
1074
|
+
#
|
1070
1075
|
# @param transaction_signature [String]
|
1071
1076
|
# @param encoding [String]
|
1072
1077
|
# @param commitment [String]
|
1073
|
-
#
|
1078
|
+
#
|
1074
1079
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
1075
1080
|
def get_transaction(transaction_signature, encoding: '', commitment: nil)
|
1076
1081
|
http_method = :post
|
1077
1082
|
method = create_method_name(__method__)
|
1078
|
-
|
1083
|
+
|
1079
1084
|
params = []
|
1080
1085
|
params_hash = {}
|
1081
1086
|
|
@@ -1090,17 +1095,17 @@ module SolanaRpcRuby
|
|
1090
1095
|
send_request(body, http_method)
|
1091
1096
|
end
|
1092
1097
|
|
1093
|
-
# @see https://docs.solana.com/developing/clients/jsonrpc-api#gettransactioncount
|
1094
|
-
#
|
1098
|
+
# @see https://docs.solana.com/developing/clients/jsonrpc-api#gettransactioncount
|
1099
|
+
#
|
1095
1100
|
# Returns the current Transaction count from the ledger
|
1096
|
-
#
|
1101
|
+
#
|
1097
1102
|
# @param commitment [String]
|
1098
|
-
#
|
1103
|
+
#
|
1099
1104
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
1100
1105
|
def get_transaction_count(commitment: nil)
|
1101
1106
|
http_method = :post
|
1102
1107
|
method = create_method_name(__method__)
|
1103
|
-
|
1108
|
+
|
1104
1109
|
params = []
|
1105
1110
|
params_hash = {}
|
1106
1111
|
|
@@ -1114,9 +1119,9 @@ module SolanaRpcRuby
|
|
1114
1119
|
end
|
1115
1120
|
|
1116
1121
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getversion
|
1117
|
-
#
|
1122
|
+
#
|
1118
1123
|
# Returns the current solana versions running on the node.
|
1119
|
-
#
|
1124
|
+
#
|
1120
1125
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
1121
1126
|
def get_version
|
1122
1127
|
http_method = :post
|
@@ -1129,10 +1134,10 @@ module SolanaRpcRuby
|
|
1129
1134
|
|
1130
1135
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#getvoteaccounts
|
1131
1136
|
# Returns the account info and associated stake for all the voting accounts in the current bank.
|
1132
|
-
#
|
1137
|
+
#
|
1133
1138
|
# @param commitment [String]
|
1134
1139
|
# @param vote_pubkey [String]
|
1135
|
-
#
|
1140
|
+
#
|
1136
1141
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
1137
1142
|
def get_vote_accounts(commitment: nil, vote_pubkey: nil)
|
1138
1143
|
http_method = :post
|
@@ -1152,9 +1157,9 @@ module SolanaRpcRuby
|
|
1152
1157
|
end
|
1153
1158
|
|
1154
1159
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#minimumledgerslot
|
1155
|
-
#
|
1160
|
+
#
|
1156
1161
|
# Returns the current solana versions running on the node.
|
1157
|
-
#
|
1162
|
+
#
|
1158
1163
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
1159
1164
|
def get_version
|
1160
1165
|
http_method = :post
|
@@ -1166,10 +1171,10 @@ module SolanaRpcRuby
|
|
1166
1171
|
end
|
1167
1172
|
|
1168
1173
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#minimumledgerslot
|
1169
|
-
#
|
1170
|
-
# Returns the lowest slot that the node has information about in its ledger.
|
1174
|
+
#
|
1175
|
+
# Returns the lowest slot that the node has information about in its ledger.
|
1171
1176
|
# This value may increase over time if the node is configured to purge older ledger data
|
1172
|
-
#
|
1177
|
+
#
|
1173
1178
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
1174
1179
|
def minimum_ledger_slot
|
1175
1180
|
http_method = :post
|
@@ -1181,13 +1186,13 @@ module SolanaRpcRuby
|
|
1181
1186
|
end
|
1182
1187
|
|
1183
1188
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#requestairdrop
|
1184
|
-
#
|
1189
|
+
#
|
1185
1190
|
# Requests an airdrop of lamports to a Pubkey
|
1186
|
-
#
|
1191
|
+
#
|
1187
1192
|
# @param pubkey [String]
|
1188
1193
|
# @param lamports [Integer]
|
1189
1194
|
# @param commitment [String]
|
1190
|
-
#
|
1195
|
+
#
|
1191
1196
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
1192
1197
|
def request_airdrop(pubkey, lamports, commitment: nil)
|
1193
1198
|
http_method = :post
|
@@ -1206,17 +1211,17 @@ module SolanaRpcRuby
|
|
1206
1211
|
end
|
1207
1212
|
|
1208
1213
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#sendtransaction
|
1209
|
-
#
|
1214
|
+
#
|
1210
1215
|
# Submits a signed transaction to the cluster for processing.
|
1211
|
-
#
|
1216
|
+
#
|
1212
1217
|
# @param transaction_signature [String]
|
1213
1218
|
# @param skip_pre_flight [Boolean]
|
1214
1219
|
# @param pre_flight_commitment [String]
|
1215
1220
|
# @param encoding [String]
|
1216
|
-
#
|
1221
|
+
#
|
1217
1222
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
1218
1223
|
def send_transaction(
|
1219
|
-
transaction_signature,
|
1224
|
+
transaction_signature,
|
1220
1225
|
skip_pre_flight: false,
|
1221
1226
|
pre_flight_commitment: nil,
|
1222
1227
|
encoding: ''
|
@@ -1241,10 +1246,10 @@ module SolanaRpcRuby
|
|
1241
1246
|
|
1242
1247
|
|
1243
1248
|
# @see https://docs.solana.com/developing/clients/jsonrpc-api#simulatetransaction
|
1244
|
-
#
|
1249
|
+
#
|
1245
1250
|
# Simulate sending a transaction
|
1246
1251
|
# accounts_addresses should be an empty array (?)
|
1247
|
-
#
|
1252
|
+
#
|
1248
1253
|
# @param transaction_signature [String]
|
1249
1254
|
# @param accounts_addresses [Array]
|
1250
1255
|
# @param sig_verify [Boolean]
|
@@ -1252,7 +1257,7 @@ module SolanaRpcRuby
|
|
1252
1257
|
# @param encoding [String]
|
1253
1258
|
# @param replace_recent_blockhash [Boolean]
|
1254
1259
|
# @param accounts_encoding [String]
|
1255
|
-
#
|
1260
|
+
#
|
1256
1261
|
# @return [Response, ApiError] Response when success, ApiError on failure.
|
1257
1262
|
def simulate_transaction(
|
1258
1263
|
transaction_signature,
|
@@ -1299,7 +1304,7 @@ module SolanaRpcRuby
|
|
1299
1304
|
if api_response.body
|
1300
1305
|
response = Response.new(api_response)
|
1301
1306
|
|
1302
|
-
fail ApiError.new(response.parsed_response) if response.parsed_response.key?('error')
|
1307
|
+
fail ApiError.new(message: response.parsed_response) if response.parsed_response.key?('error')
|
1303
1308
|
|
1304
1309
|
return response
|
1305
1310
|
end
|
data/solana_rpc_ruby.gemspec
CHANGED
@@ -23,7 +23,11 @@ Gem::Specification.new do |spec|
|
|
23
23
|
'Rakefile'
|
24
24
|
]
|
25
25
|
spec.extra_rdoc_files = ['README.md']
|
26
|
-
|
26
|
+
spec.metadata= {
|
27
|
+
'documentation_uri' => 'https://www.rubydoc.info/github/Block-Logic/solana-rpc-ruby',
|
28
|
+
'source_code_uri' => 'https://github.com/Block-Logic/solana-rpc-ruby'
|
29
|
+
}
|
30
|
+
|
27
31
|
spec.add_development_dependency 'rubocop', '~> 1.15'
|
28
32
|
spec.add_development_dependency 'rubocop-performance', '~> 1.11'
|
29
33
|
spec.add_development_dependency 'rubocop-rspec', '~> 2.3'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solana_rpc_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Block Logic Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-07-
|
11
|
+
date: 2021-07-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -222,7 +222,9 @@ files:
|
|
222
222
|
homepage: https://github.com/Block-Logic/solana-rpc-ruby
|
223
223
|
licenses:
|
224
224
|
- MIT
|
225
|
-
metadata:
|
225
|
+
metadata:
|
226
|
+
documentation_uri: https://www.rubydoc.info/github/Block-Logic/solana-rpc-ruby
|
227
|
+
source_code_uri: https://github.com/Block-Logic/solana-rpc-ruby
|
226
228
|
post_install_message:
|
227
229
|
rdoc_options: []
|
228
230
|
require_paths:
|
@@ -234,11 +236,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
234
236
|
version: 2.6.5
|
235
237
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
236
238
|
requirements:
|
237
|
-
- - "
|
239
|
+
- - ">="
|
238
240
|
- !ruby/object:Gem::Version
|
239
|
-
version:
|
241
|
+
version: '0'
|
240
242
|
requirements: []
|
241
|
-
rubygems_version: 3.
|
243
|
+
rubygems_version: 3.2.2
|
242
244
|
signing_key:
|
243
245
|
specification_version: 4
|
244
246
|
summary: Ruby wrapper for solana JSON RPC API.
|