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) CURRENT_NONCE=$(curl -s "http://localhost:8006/rpc/getBalance/$GENESIS_ADDR" | jq .nonce)
echo "Current nonce: $CURRENT_NONCE" echo "Current nonce: $CURRENT_NONCE"
# Create new transaction with correct nonce # Send new transaction using CLI tool
NEW_TX=$(cat << EOF echo "Submitting new transaction using CLI tool:"
{ python /opt/aitbc/cli/simple_wallet.py send \
"type": "transfer", --from aitbc1genesis \
"sender": "$GENESIS_ADDR", --to $WALLET_ADDR \
"nonce": $((CURRENT_NONCE + 1)), --amount 1000 \
"fee": 10, --fee 10 \
"payload": {}, --password-file /var/lib/aitbc/keystore/.password \
"recipient": "$WALLET_ADDR", --rpc-url http://localhost:8006
"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"
# Wait for new transaction to be mined # Wait for new transaction to be mined
echo "Waiting 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..." echo "Sending test transactions..."
for i in {1..3}; do for i in {1..3}; do
echo "Sending transaction $i..." echo "Sending transaction $i..."
# Create a small test transaction # Send test transaction using CLI tool
TEST_TX=$(cat << EOF python /opt/aitbc/cli/simple_wallet.py send \
{ --from aitbc1genesis \
"type": "transfer", --to $WALLET_ADDR \
"sender": "$GENESIS_ADDR", --amount 100 \
"nonce": $((i + 1)), --fee 10 \
"fee": 10, --password-file /var/lib/aitbc/keystore/.password \
"payload": {}, --rpc-url http://localhost:8006
"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"
sleep 1 sleep 1
done done