refactor: replace all manual transaction JSON with CLI tool
All checks were successful
Documentation Validation / validate-docs (push) Successful in 13s

- Remove manual TX_JSON creation in gift delivery section
- Remove manual TEST_TX creation in performance testing
- Replace with simple_wallet.py CLI commands
- Eliminate all manual JSON transaction building
- Ensure all transaction operations use CLI tool
- Maintain same functionality with cleaner CLI interface

This completes the CLI tool implementation by ensuring
all transaction operations use the CLI tool instead of
manual JSON construction.
This commit is contained in:
aitbc1
2026-03-29 16:04:50 +02:00
parent e9d69f24f0
commit 61b3cc0e59

View File

@@ -841,25 +841,15 @@ if [ "$FINAL_BALANCE" -eq "0" ]; then
CURRENT_NONCE=$(curl -s "http://localhost:8006/rpc/getBalance/$GENESIS_ADDR" | jq .nonce)
echo "Current nonce: $CURRENT_NONCE"
# Create new transaction with correct nonce
NEW_TX=$(cat << EOF
{
"type": "transfer",
"sender": "$GENESIS_ADDR",
"nonce": $((CURRENT_NONCE + 1)),
"fee": 10,
"payload": {},
"recipient": "$WALLET_ADDR",
"value": 1000
}
EOF
)
echo "Submitting new transaction:"
echo "$NEW_TX" | jq .
NEW_TX_RESULT=$(curl -X POST http://localhost:8006/rpc/sendTx -H "Content-Type: application/json" -d "$NEW_TX")
echo "New transaction result: $NEW_TX_RESULT"
# Send new transaction using CLI tool
echo "Submitting new transaction using CLI tool:"
python /opt/aitbc/cli/simple_wallet.py send \
--from aitbc1genesis \
--to $WALLET_ADDR \
--amount 1000 \
--fee 10 \
--password-file /var/lib/aitbc/keystore/.password \
--rpc-url http://localhost:8006
# Wait for new transaction to be mined
echo "Waiting for new transaction to be mined..."
@@ -1026,22 +1016,14 @@ echo "=== Performance Testing ==="
echo "Sending test transactions..."
for i in {1..3}; do
echo "Sending transaction $i..."
# Create a small test transaction
TEST_TX=$(cat << EOF
{
"type": "transfer",
"sender": "$GENESIS_ADDR",
"nonce": $((i + 1)),
"fee": 10,
"payload": {},
"recipient": "$WALLET_ADDR",
"value": 100
}
EOF
)
TX_RESULT=$(curl -X POST http://localhost:8006/rpc/sendTx -H "Content-Type: application/json" -d "$TEST_TX")
echo "Transaction $i result: $TX_RESULT"
# Send test transaction using CLI tool
python /opt/aitbc/cli/simple_wallet.py send \
--from aitbc1genesis \
--to $WALLET_ADDR \
--amount 100 \
--fee 10 \
--password-file /var/lib/aitbc/keystore/.password \
--rpc-url http://localhost:8006
sleep 1
done