From 60ea1f91aadfbbdea2e5cd7b1aed773f7f7d5a15 Mon Sep 17 00:00:00 2001 From: aitbc Date: Tue, 26 May 2026 15:03:13 +0200 Subject: [PATCH] fix: use validated top-level fields in submit_transaction - Use tx_data.sender and tx_data.recipient instead of reading from payload - Use tx_data.amount instead of tx_data.payload.get('amount') - Fixes 'transaction.to is required' error when CLI sends fields at top level - Pydantic model already validates and aliases from/to to sender/recipient --- apps/blockchain-node/src/aitbc_chain/rpc/transactions.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/blockchain-node/src/aitbc_chain/rpc/transactions.py b/apps/blockchain-node/src/aitbc_chain/rpc/transactions.py index ada8529c..fc428717 100644 --- a/apps/blockchain-node/src/aitbc_chain/rpc/transactions.py +++ b/apps/blockchain-node/src/aitbc_chain/rpc/transactions.py @@ -89,10 +89,11 @@ async def submit_transaction( chain_id = get_chain_id(None) # Convert TransactionRequest to dict for normalization + # Use validated top-level fields instead of reading from payload tx_data_dict = { "from": tx_data.sender, - "to": tx_data.payload.get("to"), - "amount": tx_data.payload.get("amount", tx_data.payload.get("value", 0)), + "to": tx_data.recipient, + "amount": tx_data.amount, "fee": tx_data.fee, "nonce": tx_data.nonce, "payload": tx_data.payload,