Some checks failed
Deploy to Phoenix / deploy (push) Has been cancelled
- ADD_CHAIN138_TO_LEDGER_LIVE: Ledger form done; public code review repo bis-innovations/LedgerLive; init/push commands - CONTRACT_DEPLOYMENT_RUNBOOK: Chain 138 gas price 1 gwei, 36-addr check, TransactionMirror workaround - CONTRACT_*: AddressMapper, MirrorManager deployed 2026-02-12; 36-address on-chain check - NEXT_STEPS_FOR_YOU: Ledger done; steps completable now (no LAN); run-completable-tasks-from-anywhere - MASTER_INDEX, OPERATOR_OPTIONAL, SMART_CONTRACTS_INVENTORY_SIMPLE: updates - LEDGER_BLOCKCHAIN_INTEGRATION_COMPLETE: bis-innovations/LedgerLive reference Co-authored-by: Cursor <cursoragent@cursor.com>
70 lines
2.1 KiB
Bash
Executable File
70 lines
2.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Check Transaction Status and Wait for Confirmation
|
|
# Monitors transaction until it's mined or fails
|
|
|
|
set -euo pipefail
|
|
|
|
TXHASH="${1:-}"
|
|
RPC_URL="${RPC_URL:-http://localhost:8545}"
|
|
TIMEOUT="${TIMEOUT:-600}" # 10 minutes default
|
|
CHECK_INTERVAL="${CHECK_INTERVAL:-10}" # Check every 10 seconds
|
|
|
|
# Colors
|
|
RED='\033[0;31m'
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[1;33m'
|
|
BLUE='\033[0;34m'
|
|
NC='\033[0m'
|
|
|
|
log_info() { echo -e "${BLUE}[INFO]${NC} $1"; }
|
|
log_success() { echo -e "${GREEN}[✓]${NC} $1"; }
|
|
log_warn() { echo -e "${YELLOW}[⚠]${NC} $1"; }
|
|
log_error() { echo -e "${RED}[✗]${NC} $1"; }
|
|
|
|
if [ -z "$TXHASH" ]; then
|
|
log_error "Transaction hash required"
|
|
echo "Usage: $0 <transaction_hash> [rpc_url]"
|
|
exit 1
|
|
fi
|
|
|
|
log_info "Monitoring transaction: $TXHASH"
|
|
log_info "RPC: $RPC_URL"
|
|
log_info "Timeout: ${TIMEOUT}s, Check interval: ${CHECK_INTERVAL}s"
|
|
|
|
START_TIME=$(date +%s)
|
|
ELAPSED=0
|
|
|
|
while [ $ELAPSED -lt $TIMEOUT ]; do
|
|
# Check transaction receipt
|
|
RECEIPT=$(cast receipt "$TXHASH" --rpc-url "$RPC_URL" 2>&1 || echo "")
|
|
|
|
if echo "$RECEIPT" | grep -q "status.*0x1"; then
|
|
log_success "Transaction CONFIRMED and SUCCESSFUL!"
|
|
echo "$RECEIPT" | grep -E "status|blockNumber|contractAddress|gasUsed" | head -5
|
|
exit 0
|
|
elif echo "$RECEIPT" | grep -q "status.*0x0"; then
|
|
log_error "Transaction CONFIRMED but FAILED!"
|
|
echo "$RECEIPT" | head -10
|
|
exit 1
|
|
else
|
|
# Check if transaction exists in mempool
|
|
TX=$(cast tx "$TXHASH" --rpc-url "$RPC_URL" 2>&1 || echo "")
|
|
if echo "$TX" | grep -q "blockNumber"; then
|
|
log_info "Transaction found in mempool, waiting for confirmation..."
|
|
else
|
|
log_warn "Transaction not found in mempool or on-chain"
|
|
fi
|
|
fi
|
|
|
|
ELAPSED=$(($(date +%s) - START_TIME))
|
|
REMAINING=$((TIMEOUT - ELAPSED))
|
|
log_info "Elapsed: ${ELAPSED}s, Remaining: ${REMAINING}s"
|
|
|
|
sleep $CHECK_INTERVAL
|
|
done
|
|
|
|
log_error "Timeout reached - transaction not confirmed"
|
|
log_info "Transaction may still be pending. Check manually:"
|
|
echo " cast receipt $TXHASH --rpc-url $RPC_URL"
|
|
exit 2
|