fix: restructure transaction payload to match RPC server schema
Some checks failed
CLI Tests / test-cli (push) Has been cancelled
Cross-Node Transaction Testing / transaction-test (push) Has been cancelled
Deploy to Testnet / deploy-testnet (push) Has been cancelled
Multi-Node Stress Testing / stress-test (push) Has been cancelled
Security Scanning / security-scan (push) Has been cancelled

- Move amount and recipient/to to top level instead of nested in payload
- Remove chain_id from top level (not in TransactionRequest schema)
- Match TransactionRequest model in apps/blockchain-node/src/aitbc_chain/rpc/transactions.py
- Fixes 422 validation error: field amount is required
- Fixes int_from_flo error by ensuring amount and fee are integers
This commit is contained in:
aitbc
2026-05-26 14:01:38 +02:00
parent dd1c3c69a5
commit fe1525cc05

View File

@@ -104,16 +104,15 @@ def _send_transaction_impl(from_wallet: str, to_address: str, amount: float, fee
actual_nonce = 0
# Create transaction
# Match RPC server schema (TransactionRequest in apps/blockchain-node/src/aitbc_chain/rpc/transactions.py)
transaction = {
"type": "TRANSFER",
"chain_id": chain_id,
"from": sender_address,
"nonce": actual_nonce,
"to": to_address,
"amount": int(amount),
"fee": int(fee),
"payload": {
"recipient": to_address,
"amount": int(amount)
}
"nonce": actual_nonce,
"payload": {}
}
# Sign transaction