Skip to content

Commit

Permalink
remove references to compile_message()
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinheavey committed Jul 5, 2024
1 parent 3b57d5a commit 8076411
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/solana/rpc/async_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 3 additions & 4 deletions tests/integration/test_async_http_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
7 changes: 3 additions & 4 deletions tests/integration/test_http_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 8076411

Please sign in to comment.