Skip to content

Commit c6f9c84

Browse files
committed
remove: deprecated methods
1 parent 39dd4a9 commit c6f9c84

File tree

5 files changed

+14
-52
lines changed

5 files changed

+14
-52
lines changed

docs/pages/clients/client.mdx

+3-13
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import Callout from 'nextra-theme-docs/callout'
2727
- [get_epoch_info](#get_epoch_info)
2828
- [get_epoch_schedule](#get_epoch_schedule)
2929
- [get_fee_for_message](#get_fee_for_message)
30-
- [get_fees](#get_fees)
3130
- [get_first_available_block](#get_first_available_block)
3231
- [get_genesis_hash](#get_genesis_hash)
3332
- [get_health](#get_health)
@@ -42,7 +41,7 @@ import Callout from 'nextra-theme-docs/callout'
4241
- [get_minimum_balance_for_rent_exmeption](#get_minimum_balance_for_rent_exmeption)
4342
- [get_multiple_accounts](#get_multiple_accounts)
4443
- [get_program_accounts](#get_program_accounts)
45-
- [get_recent_blockhash](#get_recent_blockhash)
44+
- [get_latest_blockhash](#get_latest_blockhash)
4645
- [get_recent_performance_samples](#get_recent_performance_samples)
4746
- [get_signatures_for_address](#get_signatures_for_address)
4847
- [get_signature_statuses](#get_signature_statuses)
@@ -189,15 +188,6 @@ def get_fee_for_message(message: str)
189188
<p style={{fontSize:"1rem"}}>This method is only available in solana-core v1.9 or newer</p>
190189
</Callout>
191190

192-
#### .get_fees
193-
Returns a recent block hash from the ledger, a fee schedule that can be used to compute the cost of submitting a transaction using it, and the last slot in which the blockhash will be valid.
194-
195-
<Code>
196-
```python
197-
def get_fees()
198-
```
199-
</Code>
200-
201191
#### .get_first_available_block
202192
Returns the slot of the lowest confirmed block that has not been purged from the ledger.
203193

@@ -327,12 +317,12 @@ def get_program_accounts()
327317
```
328318
</Code>
329319

330-
#### .get_recent_blockhash
320+
#### .get_latest_blockhash
331321
Returns a recent block hash from the ledger, and a fee schedule that can be used to compute the cost of submitting a transaction using it.
332322

333323
<Code>
334324
```python
335-
def get_recent_blockhash()
325+
def get_latest_blockhash()
336326
```
337327
</Code>
338328

docs/pages/clients/client_async.mdx

+3-12
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import Callout from 'nextra-theme-docs/callout'
2727
- [get_epoch_info](#get_epoch_info)
2828
- [get_epoch_schedule](#get_epoch_schedule)
2929
- [get_fee_for_message](#get_fee_for_message)
30-
- [get_fees](#get_fees)
3130
- [get_first_available_block](#get_first_available_block)
3231
- [get_genesis_hash](#get_genesis_hash)
3332
- [get_health](#get_health)
@@ -42,7 +41,7 @@ import Callout from 'nextra-theme-docs/callout'
4241
- [get_minimum_balance_for_rent_exmeption](#get_minimum_balance_for_rent_exmeption)
4342
- [get_multiple_accounts](#get_multiple_accounts)
4443
- [get_program_accounts](#get_program_accounts)
45-
- [get_recent_blockhash](#get_recent_blockhash)
44+
- [get_latest_blockhash](#get_latest_blockhash)
4645
- [get_recent_performance_samples](#get_recent_performance_samples)
4746
- [get_supply](#get_supply)
4847
- [get_token_accounts_by_owner](#get_token_accounts_by_owner)
@@ -188,14 +187,6 @@ async def get_fee_for_message(message: str)
188187
<p style={{fontSize:"1rem"}}>This method is only available in solana-core v1.9 or newer. For now, use get_fees method.</p>
189188
</Callout>
190189

191-
#### .get_fees
192-
Returns a recent block hash from the ledger, a fee schedule that can be used to compute the cost of submitting a transaction using it, and the last slot in which the blockhash will be valid.
193-
194-
<Code>
195-
```python
196-
async def get_fees()
197-
```
198-
</Code>
199190

200191
#### .get_first_available_block
201192
Returns the slot of the lowest confirmed block that has not been purged from the ledger.
@@ -327,12 +318,12 @@ async def get_program_accounts()
327318
```
328319
</Code>
329320

330-
#### .get_recent_blockhash
321+
#### .get_latest_blockhash
331322
Returns a recent block hash from the ledger, and a fee schedule that can be used to compute the cost of submitting a transaction using it.
332323

333324
<Code>
334325
```python
335-
async def get_recent_blockhash()
326+
async def get_latest_blockhash()
336327
```
337328
</Code>
338329

solathon/async_client.py

+2-13
Original file line numberDiff line numberDiff line change
@@ -191,16 +191,6 @@ async def get_fee_for_message(self, message: Text) -> RPCResponse:
191191
"""
192192
return await self.build_and_send_request_async("getFeeForMessage", [message])
193193

194-
# Going to be deprecated
195-
async def get_fees(self) -> RPCResponse:
196-
"""
197-
Returns the fees information.
198-
199-
Returns:
200-
- RPCResponse: The response from the Solana RPC server.
201-
"""
202-
return await self.build_and_send_request_async("getFees", [None])
203-
204194
async def get_first_available_block(self) -> RPCResponse:
205195
"""
206196
Returns the first available block.
@@ -342,14 +332,13 @@ async def get_program_accounts(self, public_key: PublicKey) -> RPCResponse:
342332
"""
343333
return await self.build_and_send_request_async("getProgramAccounts", [public_key])
344334

345-
# Will switch to getFeeForMessage (latest)
346-
async def get_recent_blockhash(self) -> RPCResponse:
335+
async def get_latest_blockhash(self) -> RPCResponse:
347336
"""
348337
Returns a recent blockhash from the ledger.
349338
350339
:return: RPCResponse object containing the recent blockhash.
351340
"""
352-
return await self.build_and_send_request_async("getRecentBlockhash", [None])
341+
return await self.build_and_send_request_async("getLatestBlockhash", [None])
353342

354343
async def get_recent_performance_samples(self) -> RPCResponse:
355344
"""

solathon/client.py

+2-13
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
TransactionElementType,
5050
)
5151

52-
5352
ENDPOINTS = (
5453
"https://api.mainnet-beta.solana.com",
5554
"https://api.devnet.solana.com",
@@ -313,15 +312,6 @@ def get_fee_for_message(
313312
return response["value"]
314313
return response
315314

316-
# Going to be deprecated
317-
def get_fees(self) -> RPCResponse:
318-
"""
319-
Returns the fees.
320-
321-
Returns:
322-
RPCResponse: The response from the RPC endpoint.
323-
"""
324-
return self.build_and_send_request("getFees", [None])
325315

326316
def get_first_available_block(self) -> RPCResponse[int] | int:
327317
"""
@@ -509,8 +499,7 @@ def get_program_accounts(
509499
return [ProgramAccount(account) for account in response]
510500
return response
511501

512-
# Will switch to getFeeForMessage (latest)
513-
def get_recent_blockhash(
502+
def get_latest_blockhash(
514503
self, commitment: Optional[Commitment] = None
515504
) -> RPCResponse[BlockHashType] | BlockHash:
516505
"""
@@ -523,7 +512,7 @@ def get_recent_blockhash(
523512
RPCResponse: The response from the RPC endpoint.
524513
"""
525514
commitment = validate_commitment(commitment) if commitment else None
526-
response = self.build_and_send_request("getRecentBlockhash", [commitment])
515+
response = self.build_and_send_request("getLatestBlockhash", [commitment])
527516
if self.clean_response:
528517
return BlockHash(response["value"])
529518
return response

solathon/core/types/block.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,10 @@ class BlockHash:
286286

287287
def __init__(self, response: BlockHashType) -> None:
288288
self.blockhash = response['blockhash']
289-
self.fee_calculator = FeeCalculator(response['feeCalculator'])
289+
if "feeCalculator" in response:
290+
self.fee_calculator = FeeCalculator(response['feeCalculator'])
291+
else:
292+
self.fee_calculator = None
290293

291294
def __repr__(self) -> str:
292295
return f"BlockHash(blockhash={self.blockhash!r}, fee_calculator={self.fee_calculator!r})"

0 commit comments

Comments
 (0)