diff --git a/chia/_tests/wallet/test_wallet.py b/chia/_tests/wallet/test_wallet.py index 5cb4753f09a0..9aad369c0722 100644 --- a/chia/_tests/wallet/test_wallet.py +++ b/chia/_tests/wallet/test_wallet.py @@ -393,7 +393,7 @@ async def test_wallet_clawback_clawback(self, wallet_environments: WalletTestFra assert len(txs["transactions"]) == 1 assert not txs["transactions"][0]["confirmed"] assert txs["transactions"][0]["metadata"]["recipient_puzzle_hash"][2:] == normal_puzhash.hex() - assert txs["transactions"][0]["metadata"]["coin_id"] == merkle_coin.name().hex() + assert txs["transactions"][0]["metadata"]["coin_id"][2:] == merkle_coin.name().hex() with pytest.raises(ValueError): await api_0.spend_clawback_coins({}) @@ -577,7 +577,7 @@ async def test_wallet_clawback_sent_self(self, wallet_environments: WalletTestFr assert txs["transactions"][0]["confirmed"] assert txs["transactions"][1]["confirmed"] assert txs["transactions"][0]["memos"] != txs["transactions"][1]["memos"] - assert list(txs["transactions"][0]["memos"].values())[0] == b"Test".hex() + assert list(txs["transactions"][0]["memos"].values())[0][2:] == b"Test".hex() @pytest.mark.parametrize( "wallet_environments", diff --git a/chia/rpc/wallet_request_types.py b/chia/rpc/wallet_request_types.py index f6b30467ab48..1a7df6d6b837 100644 --- a/chia/rpc/wallet_request_types.py +++ b/chia/rpc/wallet_request_types.py @@ -14,6 +14,7 @@ from chia.util.streamable import Streamable, streamable from chia.wallet.conditions import Condition, ConditionValidTimes from chia.wallet.notification_store import Notification +from chia.wallet.puzzles.clawback.metadata import ClawbackMetadata from chia.wallet.signer_protocol import ( SignedTransaction, SigningInstructions, @@ -351,14 +352,15 @@ def __post_init__(self) -> None: raise ValueError(f"There is no known sort {self.sort_key}") -# utilities for GetTransactionsResponse +# utility for GetTransactionsResponse @streamable @dataclass(frozen=True) -class TransactionRecordMetadata(Streamable): +class TransactionRecordMetadata(ClawbackMetadata): coin_id: bytes32 spent: bool +# utility for GetTransactionsResponse @streamable @dataclass(frozen=True) class UserFriendlyTransactionRecordWithMetadata(UserFriendlyTransactionRecord): diff --git a/chia/rpc/wallet_rpc_api.py b/chia/rpc/wallet_rpc_api.py index 9bc7a70716b6..9c5ff1d65b3a 100644 --- a/chia/rpc/wallet_rpc_api.py +++ b/chia/rpc/wallet_rpc_api.py @@ -1320,12 +1320,7 @@ async def get_transactions(self, request: GetTransactions) -> GetTransactionsRes tx["metadata"]["coin_id"] = coin.name().hex() tx["metadata"]["spent"] = record.spent return GetTransactionsResponse( - transactions=[ - UserFriendlyTransactionRecordWithMetadata.from_transaction_record( - TransactionRecord.from_json_dict_convenience(tx), self.service.config - ) - for tx in tx_list - ], + transactions=[UserFriendlyTransactionRecordWithMetadata.from_json_dict(tx) for tx in tx_list], wallet_id=request.wallet_id, )