solana-ruby 0.1.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 +7 -0
- data/lib/solana-ruby/client.rb +250 -0
- data/lib/solana-ruby/version.rb +3 -0
- data/lib/solana-ruby.rb +5 -0
- metadata +102 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 1a89b4b3a79a083057806945963669aab8ca3b312223ea7c1e13a41a26c0063b
|
4
|
+
data.tar.gz: 824eaaa7913f9b499bc6514f1d5fec3d48f3692f399a3205d069425ea32b328c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8317d94e7781fb218a31c73a2270daf7ccf5d782f4ec565e89c90994abf871827593a25cec9cb0c83e4bab9bc42a7fc30029c9b289785e3499d81f2c7549a8b9
|
7
|
+
data.tar.gz: e50e55dd5237008503167a603959cad90877ee88c1d43a434924d64db59688783de6445b3f8eb42e14575e2006a0dfc2635d324db6319683c7bf3494f1d701f7
|
@@ -0,0 +1,250 @@
|
|
1
|
+
require 'httparty'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
module SolanaRB
|
5
|
+
class Client
|
6
|
+
include HTTParty
|
7
|
+
base_uri 'https://api.mainnet-beta.solana.com'
|
8
|
+
|
9
|
+
def initialize(api_key = nil)
|
10
|
+
@api_key = api_key
|
11
|
+
end
|
12
|
+
|
13
|
+
def get_account_info(pubkey, options = {})
|
14
|
+
request('getAccountInfo', [pubkey, options])
|
15
|
+
end
|
16
|
+
|
17
|
+
def get_balance(pubkey, options = {})
|
18
|
+
request('getBalance', [pubkey, options])
|
19
|
+
end
|
20
|
+
|
21
|
+
def get_block(slot_number, options = {})
|
22
|
+
request('getBlock', [slot_number, options])
|
23
|
+
end
|
24
|
+
|
25
|
+
def get_block_commitment(slot_number, options = {})
|
26
|
+
request('getBlockCommitment', [slot_number, options])
|
27
|
+
end
|
28
|
+
|
29
|
+
def get_block_height(options = {})
|
30
|
+
request('getBlockHeight', [options])
|
31
|
+
end
|
32
|
+
|
33
|
+
def get_block_production(options = {})
|
34
|
+
request('getBlockProduction', [options])
|
35
|
+
end
|
36
|
+
|
37
|
+
def get_block_time(slot_number, options = {})
|
38
|
+
request('getBlockTime', [slot_number, options])
|
39
|
+
end
|
40
|
+
|
41
|
+
def get_blocks(start_slot, end_slot, options = {})
|
42
|
+
request('getBlocks', [start_slot, end_slot, options])
|
43
|
+
end
|
44
|
+
|
45
|
+
def get_blocks_with_limit(start_slot, limit, options = {})
|
46
|
+
request('getBlocksWithLimit', [start_slot, limit, options])
|
47
|
+
end
|
48
|
+
|
49
|
+
def get_cluster_nodes(options = {})
|
50
|
+
request('getClusterNodes', [options])
|
51
|
+
end
|
52
|
+
|
53
|
+
def get_epoch_info(options = {})
|
54
|
+
request('getEpochInfo', [options])
|
55
|
+
end
|
56
|
+
|
57
|
+
def get_epoch_schedule(options = {})
|
58
|
+
request('getEpochSchedule', [options])
|
59
|
+
end
|
60
|
+
|
61
|
+
def get_fee_for_message(message, options = {})
|
62
|
+
request('getFeeForMessage', [message, options])
|
63
|
+
end
|
64
|
+
|
65
|
+
def get_first_available_block(options = {})
|
66
|
+
request('getFirstAvailableBlock', [options])
|
67
|
+
end
|
68
|
+
|
69
|
+
def get_genesis_hash(options = {})
|
70
|
+
request('getGenesisHash', [options])
|
71
|
+
end
|
72
|
+
|
73
|
+
def get_health(options = {})
|
74
|
+
request('getHealth', [options])
|
75
|
+
end
|
76
|
+
|
77
|
+
def get_highest_snapshot_slot(options = {})
|
78
|
+
request('getHighestSnapshotSlot', [options])
|
79
|
+
end
|
80
|
+
|
81
|
+
def get_identity(options = {})
|
82
|
+
request('getIdentity', [options])
|
83
|
+
end
|
84
|
+
|
85
|
+
def get_inflation_governor(options = {})
|
86
|
+
request('getInflationGovernor', [options])
|
87
|
+
end
|
88
|
+
|
89
|
+
def get_inflation_rate(options = {})
|
90
|
+
request('getInflationRate', [options])
|
91
|
+
end
|
92
|
+
|
93
|
+
def get_inflation_reward(addresses, options = {})
|
94
|
+
request('getInflationReward', [addresses, options])
|
95
|
+
end
|
96
|
+
|
97
|
+
def get_largest_accounts(options = {})
|
98
|
+
request('getLargestAccounts', [options])
|
99
|
+
end
|
100
|
+
|
101
|
+
def get_latest_blockhash(options = {})
|
102
|
+
request('getLatestBlockhash', [options])
|
103
|
+
end
|
104
|
+
|
105
|
+
def get_leader_schedule(options = {})
|
106
|
+
request('getLeaderSchedule', [options])
|
107
|
+
end
|
108
|
+
|
109
|
+
def get_max_retransmit_slot(options = {})
|
110
|
+
request('getMaxRetransmitSlot', [options])
|
111
|
+
end
|
112
|
+
|
113
|
+
def get_max_shred_insert_slot(options = {})
|
114
|
+
request('getMaxShredInsertSlot', [options])
|
115
|
+
end
|
116
|
+
|
117
|
+
def get_minimum_balance_for_rent_exemption(data_length, options = {})
|
118
|
+
request('getMinimumBalanceForRentExemption', [data_length, options])
|
119
|
+
end
|
120
|
+
|
121
|
+
def get_multiple_accounts(pubkeys, options = {})
|
122
|
+
request('getMultipleAccounts', [pubkeys, options])
|
123
|
+
end
|
124
|
+
|
125
|
+
def get_program_accounts(pubkey, options = {})
|
126
|
+
request('getProgramAccounts', [pubkey, options])
|
127
|
+
end
|
128
|
+
|
129
|
+
def get_recent_performance_samples(options = {})
|
130
|
+
request('getRecentPerformanceSamples', [options])
|
131
|
+
end
|
132
|
+
|
133
|
+
def get_recent_prioritization_fees(options = {})
|
134
|
+
request('getRecentPrioritizationFees', [options])
|
135
|
+
end
|
136
|
+
|
137
|
+
def get_signature_statuses(signatures, options = {})
|
138
|
+
request('getSignatureStatuses', [signatures, options])
|
139
|
+
end
|
140
|
+
|
141
|
+
def get_signatures_for_address(address, options = {})
|
142
|
+
request('getSignaturesForAddress', [address, options])
|
143
|
+
end
|
144
|
+
|
145
|
+
def get_slot(options = {})
|
146
|
+
request('getSlot', [options])
|
147
|
+
end
|
148
|
+
|
149
|
+
def get_slot_leader(options = {})
|
150
|
+
request('getSlotLeader', [options])
|
151
|
+
end
|
152
|
+
|
153
|
+
def get_slot_leaders(start_slot, limit, options = {})
|
154
|
+
request('getSlotLeaders', [start_slot, limit, options])
|
155
|
+
end
|
156
|
+
|
157
|
+
def get_stake_activation(pubkey, options = {})
|
158
|
+
request('getStakeActivation', [pubkey, options])
|
159
|
+
end
|
160
|
+
|
161
|
+
def get_stake_minimum_delegation(options = {})
|
162
|
+
request('getStakeMinimumDelegation', [options])
|
163
|
+
end
|
164
|
+
|
165
|
+
def get_supply(options = {})
|
166
|
+
request('getSupply', [options])
|
167
|
+
end
|
168
|
+
|
169
|
+
def get_token_account_balance(pubkey, options = {})
|
170
|
+
request('getTokenAccountBalance', [pubkey, options])
|
171
|
+
end
|
172
|
+
|
173
|
+
def get_token_accounts_by_delegate(delegate, opts = {}, options = {})
|
174
|
+
request('getTokenAccountsByDelegate', [delegate, opts, options])
|
175
|
+
end
|
176
|
+
|
177
|
+
def get_token_accounts_by_owner(owner, opts = {}, options = {})
|
178
|
+
request('getTokenAccountsByOwner', [owner, opts, options])
|
179
|
+
end
|
180
|
+
|
181
|
+
def get_token_largest_accounts(pubkey, options = {})
|
182
|
+
request('getTokenLargestAccounts', [pubkey, options])
|
183
|
+
end
|
184
|
+
|
185
|
+
def get_token_supply(pubkey, options = {})
|
186
|
+
request('getTokenSupply', [pubkey, options])
|
187
|
+
end
|
188
|
+
|
189
|
+
def get_transaction(signature, options = {})
|
190
|
+
request('getTransaction', [signature, options])
|
191
|
+
end
|
192
|
+
|
193
|
+
def get_transaction_count(options = {})
|
194
|
+
request('getTransactionCount', [options])
|
195
|
+
end
|
196
|
+
|
197
|
+
def get_version(options = {})
|
198
|
+
request('getVersion', [options])
|
199
|
+
end
|
200
|
+
|
201
|
+
def get_vote_accounts(options = {})
|
202
|
+
request('getVoteAccounts', [options])
|
203
|
+
end
|
204
|
+
|
205
|
+
def is_blockhash_valid(blockhash, options = {})
|
206
|
+
request('isBlockhashValid', [blockhash, options])
|
207
|
+
end
|
208
|
+
|
209
|
+
def minimum_ledger_slot(options = {})
|
210
|
+
request('minimumLedgerSlot', [options])
|
211
|
+
end
|
212
|
+
|
213
|
+
def request_airdrop(pubkey, lamports, options = {})
|
214
|
+
request('requestAirdrop', [pubkey, lamports, options])
|
215
|
+
end
|
216
|
+
|
217
|
+
def send_transaction(transaction, options = {})
|
218
|
+
request('sendTransaction', [transaction, options])
|
219
|
+
end
|
220
|
+
|
221
|
+
def simulate_transaction(transaction, options = {})
|
222
|
+
request('simulateTransaction', [transaction, options])
|
223
|
+
end
|
224
|
+
|
225
|
+
private
|
226
|
+
|
227
|
+
def request(method, params = [])
|
228
|
+
options = {
|
229
|
+
headers: { 'Content-Type' => 'application/json' },
|
230
|
+
body: {
|
231
|
+
jsonrpc: '2.0',
|
232
|
+
method: method,
|
233
|
+
params: params,
|
234
|
+
id: 1
|
235
|
+
}.to_json
|
236
|
+
}
|
237
|
+
|
238
|
+
response = self.class.post('/', options)
|
239
|
+
handle_response(response)
|
240
|
+
end
|
241
|
+
|
242
|
+
def handle_response(response)
|
243
|
+
if response.success?
|
244
|
+
response.parsed_response['result']
|
245
|
+
else
|
246
|
+
raise "Request failed: #{response.code} #{response.message}"
|
247
|
+
end
|
248
|
+
end
|
249
|
+
end
|
250
|
+
end
|
data/lib/solana-ruby.rb
ADDED
metadata
ADDED
@@ -0,0 +1,102 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: solana-ruby
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Fabrice Renard
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2024-06-23 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: httparty
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.18.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.18.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: csv
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.1'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.1'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.10'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.10'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: webmock
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.14'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.14'
|
69
|
+
description: Provides an easy-to-use interface for interacting with the Solana blockchain.
|
70
|
+
email:
|
71
|
+
- fabrice.renard12@outlook.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- lib/solana-ruby.rb
|
77
|
+
- lib/solana-ruby/client.rb
|
78
|
+
- lib/solana-ruby/version.rb
|
79
|
+
homepage: https://github.com/fabricerenard12/solana-ruby
|
80
|
+
licenses:
|
81
|
+
- MIT
|
82
|
+
metadata: {}
|
83
|
+
post_install_message:
|
84
|
+
rdoc_options: []
|
85
|
+
require_paths:
|
86
|
+
- lib
|
87
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '3.0'
|
92
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
requirements: []
|
98
|
+
rubygems_version: 3.5.9
|
99
|
+
signing_key:
|
100
|
+
specification_version: 4
|
101
|
+
summary: A Ruby wrapper for the Solana blockchain API
|
102
|
+
test_files: []
|