diff --git a/src/solana/rpc/async_api.py b/src/solana/rpc/async_api.py index e2355ffc..c4aa4bba 100644 --- a/src/solana/rpc/async_api.py +++ b/src/solana/rpc/async_api.py @@ -423,7 +423,7 @@ async def get_fee_for_message( >>> msg = Message([transfer(TransferParams( ... from_pubkey=sender.pubkey(), to_pubkey=receiver.pubkey(), lamports=1000))]) >>> solana_client = AsyncClient("http://localhost:8899") - >>> (await solana_client.get_fee_for_message(txn.compile_message())).value # doctest: +SKIP + >>> (await solana_client.get_fee_for_message(msg)).value # doctest: +SKIP 5000 """ body = self._get_fee_for_message_body(message, commitment) diff --git a/tests/integration/test_async_http_client.py b/tests/integration/test_async_http_client.py index 355e6d4b..8e1c3ebc 100644 --- a/tests/integration/test_async_http_client.py +++ b/tests/integration/test_async_http_client.py @@ -3,6 +3,7 @@ import pytest import solders.system_program as sp +from solders.hash import Hash from solders.keypair import Keypair from solders.message import MessageV0, Message from solders.pubkey import Pubkey @@ -300,14 +301,12 @@ async def test_get_fee_for_transaction_message(stubbed_sender, stubbed_receiver, recent_blockhash = resp.value.blockhash assert recent_blockhash is not None # Create transfer tx transfer lamports from stubbed sender to stubbed_receiver - blockhash = (await test_http_client_async.get_latest_blockhash()).value.blockhash ixs = [ sp.transfer(sp.TransferParams(from_pubkey=stubbed_sender.pubkey(), to_pubkey=stubbed_receiver, lamports=1000)) ] - msg = Message.new_with_blockhash(ixs, stubbed_sender.pubkey(), blockhash) - transfer_tx = Transaction([stubbed_sender], msg, blockhash) + msg = Message.new_with_blockhash(ixs, stubbed_sender.pubkey(), Hash.default()) # Get fee for transaction message - fee_resp = await test_http_client_async.get_fee_for_message(transfer_tx.compile_message()) + fee_resp = await test_http_client_async.get_fee_for_message(msg) assert_valid_response(fee_resp) assert fee_resp.value is not None diff --git a/tests/integration/test_http_client.py b/tests/integration/test_http_client.py index eabd38de..eb3aedb7 100644 --- a/tests/integration/test_http_client.py +++ b/tests/integration/test_http_client.py @@ -3,6 +3,7 @@ import pytest import solders.system_program as sp +from solders.hash import Hash from solders.keypair import Keypair from solders.message import MessageV0, Message from solders.pubkey import Pubkey @@ -273,14 +274,12 @@ def test_get_fee_for_transaction(stubbed_sender, stubbed_receiver, test_http_cli recent_blockhash = resp.value.blockhash assert recent_blockhash is not None # Create transfer tx transfer lamports from stubbed sender to stubbed_receiver - blockhash = test_http_client.get_latest_blockhash().value.blockhash ixs = [ sp.transfer(sp.TransferParams(from_pubkey=stubbed_sender.pubkey(), to_pubkey=stubbed_receiver, lamports=1000)) ] - msg = Message.new_with_blockhash(ixs, stubbed_sender.pubkey(), blockhash) - transfer_tx = Transaction([stubbed_sender], msg, blockhash) + msg = Message.new_with_blockhash(ixs, stubbed_sender.pubkey(), Hash.default()) # get fee for transaction - fee_resp = test_http_client.get_fee_for_message(transfer_tx.compile_message()) + fee_resp = test_http_client.get_fee_for_message(msg) assert_valid_response(fee_resp) assert fee_resp.value is not None