@@ -10,6 +10,7 @@ use jsonrpc_derive::rpc;
1010use solana_account:: Account ;
1111use solana_account_decoder:: parse_token:: UiTokenAmount ;
1212use solana_account_decoder:: { encode_ui_account, UiAccount , UiAccountEncoding } ;
13+ use solana_client:: nonblocking:: rpc_client:: RpcClient ;
1314use solana_client:: rpc_config:: RpcAccountInfoConfig ;
1415use solana_client:: rpc_response:: RpcBlockCommitment ;
1516use solana_client:: rpc_response:: RpcResponseContext ;
@@ -30,16 +31,16 @@ pub trait AccountsData {
3031 /// This method queries the blockchain for the account associated with the provided
3132 /// public key string. It can be used to inspect balances, ownership, and program-related metadata.
3233 ///
33- /// # Parameters
34+ /// ## Parameters
3435 /// - `pubkey_str`: A base-58 encoded string representing the account's public key.
3536 /// - `config`: Optional configuration that controls encoding, commitment level,
3637 /// data slicing, and other response details.
3738 ///
38- /// # Returns
39+ /// ## Returns
3940 /// A [`RpcResponse`] containing an optional [`UiAccount`] object if the account exists.
4041 /// If the account does not exist, the response will contain `null`.
4142 ///
42- /// # Example Request (JSON-RPC)
43+ /// ## Example Request (JSON-RPC)
4344 /// ```json
4445 /// {
4546 /// "jsonrpc": "2.0",
@@ -55,7 +56,7 @@ pub trait AccountsData {
5556 /// }
5657 /// ```
5758 ///
58- /// # Example Response
59+ /// ## Example Response
5960 /// ```json
6061 /// {
6162 /// "jsonrpc": "2.0",
@@ -80,11 +81,11 @@ pub trait AccountsData {
8081 /// }
8182 /// ```
8283 ///
83- /// # Errors
84+ /// ## Errors
8485 /// - Returns an error if the public key is malformed or invalid
8586 /// - Returns an internal error if the ledger cannot be accessed
8687 ///
87- /// # See also
88+ /// ## See also
8889 /// - [`UiAccount`]: A readable structure representing on-chain accounts
8990 #[ rpc( meta, name = "getAccountInfo" ) ]
9091 fn get_account_info (
@@ -100,15 +101,15 @@ pub trait AccountsData {
100101 /// and with what level of lockout. This can be used to analyze consensus progress and
101102 /// determine finality confidence.
102103 ///
103- /// # Parameters
104+ /// ## Parameters
104105 /// - `block`: The target slot (block) to query.
105106 ///
106- /// # Returns
107+ /// ## Returns
107108 /// A [`RpcBlockCommitment`] containing a [`BlockCommitmentArray`], which is an array of 32
108109 /// integers representing the number of votes at each lockout level for that block. Each index
109110 /// corresponds to a lockout level (i.e., confidence in finality).
110111 ///
111- /// # Example Request (JSON-RPC)
112+ /// ## Example Request (JSON-RPC)
112113 /// ```json
113114 /// {
114115 /// "jsonrpc": "2.0",
@@ -118,7 +119,7 @@ pub trait AccountsData {
118119 /// }
119120 /// ```
120121 ///
121- /// # Example Response
122+ /// ## Example Response
122123 /// ```json
123124 /// {
124125 /// "jsonrpc": "2.0",
@@ -130,11 +131,11 @@ pub trait AccountsData {
130131 /// }
131132 /// ```
132133 ///
133- /// # Errors
134+ /// ## Errors
134135 /// - If the slot is not found in the current bank or has been purged, this call may return an error.
135136 /// - May fail if the RPC node is lagging behind or doesn't have voting history for the slot.
136137 ///
137- /// # See also
138+ /// ## See also
138139 /// - [`BlockCommitmentArray`]: An array representing votes by lockout level
139140 /// - [`RpcBlockCommitment`]: Wrapper struct for the full response
140141 #[ rpc( meta, name = "getBlockCommitment" ) ]
@@ -150,16 +151,16 @@ pub trait AccountsData {
150151 /// network roundtrips. It returns a list of `UiAccount` values in the same order as
151152 /// the provided public keys.
152153 ///
153- /// # Parameters
154+ /// ## Parameters
154155 /// - `pubkey_strs`: A list of base-58 encoded public key strings representing accounts to query.
155156 /// - `config`: Optional configuration to control encoding, commitment level, data slicing, etc.
156157 ///
157- /// # Returns
158+ /// ## Returns
158159 /// A [`RpcResponse`] wrapping a vector of optional [`UiAccount`] objects.
159160 /// Each element in the response corresponds to the public key at the same index in the request.
160161 /// If an account is not found, the corresponding entry will be `null`.
161162 ///
162- /// # Example Request (JSON-RPC)
163+ /// ## Example Request (JSON-RPC)
163164 /// ```json
164165 /// {
165166 /// "jsonrpc": "2.0",
@@ -178,7 +179,7 @@ pub trait AccountsData {
178179 /// }
179180 /// ```
180181 ///
181- /// # Example Response
182+ /// ## Example Response
182183 /// ```json
183184 /// {
184185 /// "jsonrpc": "2.0",
@@ -204,11 +205,11 @@ pub trait AccountsData {
204205 /// }
205206 /// ```
206207 ///
207- /// # Errors
208+ /// ## Errors
208209 /// - If any public key is malformed or invalid, the entire call may fail.
209210 /// - Returns an internal error if the ledger cannot be accessed or some accounts are purged.
210211 ///
211- /// # See also
212+ /// ## See also
212213 /// - [`UiAccount`]: Human-readable representation of an account
213214 /// - [`get_account_info`]: Use when querying a single account
214215 #[ rpc( meta, name = "getMultipleAccounts" ) ]
@@ -225,15 +226,15 @@ pub trait AccountsData {
225226 /// user-friendly information (like the UI amount in human-readable format). It is useful
226227 /// for token-related applications, such as checking balances in wallets or exchanges.
227228 ///
228- /// # Parameters
229+ /// ## Parameters
229230 /// - `pubkey_str`: The base-58 encoded string of the public key of the token account.
230231 /// - `commitment`: Optional commitment configuration to specify the desired confirmation level of the query.
231232 ///
232- /// # Returns
233+ /// ## Returns
233234 /// A [`RpcResponse`] containing the token balance in a [`UiTokenAmount`] struct.
234235 /// If the account doesn't hold any tokens or is invalid, the response will contain `null`.
235236 ///
236- /// # Example Request (JSON-RPC)
237+ /// ## Example Request (JSON-RPC)
237238 /// ```json
238239 /// {
239240 /// "jsonrpc": "2.0",
@@ -248,7 +249,7 @@ pub trait AccountsData {
248249 /// }
249250 /// ```
250251 ///
251- /// # Example Response
252+ /// ## Example Response
252253 /// ```json
253254 /// {
254255 /// "jsonrpc": "2.0",
@@ -267,11 +268,11 @@ pub trait AccountsData {
267268 /// }
268269 /// ```
269270 ///
270- /// # Errors
271+ /// ## Errors
271272 /// - If the provided public key is invalid or does not exist.
272273 /// - If the account is not a valid token account or does not hold any tokens.
273274 ///
274- /// # See also
275+ /// ## See also
275276 /// - [`UiTokenAmount`]: Represents the token balance in user-friendly format.
276277 #[ rpc( meta, name = "getTokenAccountBalance" ) ]
277278 fn get_token_account_balance (
@@ -287,15 +288,15 @@ pub trait AccountsData {
287288 /// amount and human-readable UI-formatted values. It can be useful for tracking token issuance
288289 /// and verifying the supply of a token on-chain.
289290 ///
290- /// # Parameters
291+ /// ## Parameters
291292 /// - `mint_str`: The base-58 encoded string of the mint address for the token.
292293 /// - `commitment`: Optional commitment configuration to specify the desired confirmation level of the query.
293294 ///
294- /// # Returns
295+ /// ## Returns
295296 /// A [`RpcResponse`] containing the total token supply in a [`UiTokenAmount`] struct.
296297 /// If the token does not exist or is invalid, the response will return an error.
297298 ///
298- /// # Example Request (JSON-RPC)
299+ /// ## Example Request (JSON-RPC)
299300 /// ```json
300301 /// {
301302 /// "jsonrpc": "2.0",
@@ -310,7 +311,7 @@ pub trait AccountsData {
310311 /// }
311312 /// ```
312313 ///
313- /// # Example Response
314+ /// ## Example Response
314315 /// ```json
315316 /// {
316317 /// "jsonrpc": "2.0",
@@ -329,11 +330,11 @@ pub trait AccountsData {
329330 /// }
330331 /// ```
331332 ///
332- /// # Errors
333+ /// ## Errors
333334 /// - If the mint address is invalid or does not correspond to a token.
334335 /// - If the token supply cannot be fetched due to network issues or node synchronization problems.
335336 ///
336- /// # See also
337+ /// ## See also
337338 /// - [`UiTokenAmount`]: Represents the token balance or supply in a user-friendly format.
338339 #[ rpc( meta, name = "getTokenSupply" ) ]
339340 fn get_token_supply (
@@ -369,7 +370,8 @@ impl AccountsData for SurfpoolAccountsDataRpc {
369370
370371 // Drop the lock on the state while we fetch accounts
371372 let absolute_slot = state_reader. epoch_info . absolute_slot ;
372- let rpc_client = state_reader. rpc_client . clone ( ) ;
373+
374+ let rpc_client = RpcClient :: new ( state_reader. rpc_url . clone ( ) ) ;
373375 let encoding = config. encoding . clone ( ) ;
374376 let data_slice = config. data_slice . clone ( ) ;
375377 drop ( state_reader) ;
@@ -444,7 +446,7 @@ impl AccountsData for SurfpoolAccountsDataRpc {
444446
445447 // Drop the lock on the state while we fetch accounts
446448 let absolute_slot = state_reader. epoch_info . absolute_slot ;
447- let rpc_client = state_reader. rpc_client . clone ( ) ;
449+ let rpc_client = RpcClient :: new ( state_reader. rpc_url . clone ( ) ) ;
448450 let encoding = config. encoding . clone ( ) ;
449451 let data_slice = config. data_slice . clone ( ) ;
450452 drop ( state_reader) ;
0 commit comments