Complete markdown files cleanup and organization
- Organized 252 files across project - Root directory: 187 → 2 files (98.9% reduction) - Moved configuration guides to docs/04-configuration/ - Moved troubleshooting guides to docs/09-troubleshooting/ - Moved quick start guides to docs/01-getting-started/ - Moved reports to reports/ directory - Archived temporary files - Generated comprehensive reports and documentation - Created maintenance scripts and guides All files organized according to established standards.
This commit is contained in:
35
scripts/lib/error-handling.sh
Executable file
35
scripts/lib/error-handling.sh
Executable file
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env bash
|
||||
# Error handling utilities
|
||||
|
||||
handle_rpc_error() {
|
||||
local error="$1"
|
||||
if echo "$error" | grep -q "insufficient funds"; then
|
||||
echo "ERROR: Insufficient balance for transaction"
|
||||
return 1
|
||||
elif echo "$error" | grep -q "nonce too low"; then
|
||||
echo "ERROR: Transaction nonce too low. Wait for pending transactions."
|
||||
return 1
|
||||
elif echo "$error" | grep -q "replacement transaction underpriced"; then
|
||||
echo "ERROR: Pending transaction exists. Wait or increase gas price."
|
||||
return 1
|
||||
elif echo "$error" | grep -q "execution reverted"; then
|
||||
echo "ERROR: Transaction reverted. Check contract state."
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
retry_transaction() {
|
||||
local command="$1"
|
||||
local max_retries=3
|
||||
local retry=0
|
||||
|
||||
while [ $retry -lt $max_retries ]; do
|
||||
if eval "$command"; then
|
||||
return 0
|
||||
fi
|
||||
((retry++))
|
||||
sleep 5
|
||||
done
|
||||
return 1
|
||||
}
|
||||
20
scripts/lib/transaction-logger.sh
Executable file
20
scripts/lib/transaction-logger.sh
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env bash
|
||||
# Transaction logging utilities
|
||||
|
||||
LOG_DIR="${LOG_DIR:-/home/intlc/projects/proxmox/logs}"
|
||||
LOG_FILE="$LOG_DIR/bridge-transactions-$(date +%Y%m%d).log"
|
||||
|
||||
log_transaction() {
|
||||
local tx_hash="$1"
|
||||
local chain="$2"
|
||||
local amount="$3"
|
||||
local status="$4"
|
||||
|
||||
echo "[$(date -u +"%Y-%m-%d %H:%M:%S UTC")] $status | $chain | $amount | $tx_hash" >> "$LOG_FILE"
|
||||
}
|
||||
|
||||
get_transaction_status() {
|
||||
local tx_hash="$1"
|
||||
local rpc_url="$2"
|
||||
cast tx "$tx_hash" --rpc-url "$rpc_url" 2>/dev/null | grep -E "status|blockNumber" || echo "Pending"
|
||||
}
|
||||
Reference in New Issue
Block a user