Add crypto logos to checkout UI and clean up sweep scripts
- Add Monero and Dogecoin logo images to static assets - Update cart_checkout.j2 to display crypto logos on payment buttons - Update crypto_checkout.j2 to show logos in checkout headers - Remove duplicate sweep script files (dogecoin-sweep-all.sh, sweep-all-doge.sh) - Update CLAUDE.md with development standards and testing guidelines
This commit is contained in:
parent
a4dba0b98a
commit
3e9066273a
8 changed files with 31 additions and 172 deletions
11
CLAUDE.md
11
CLAUDE.md
|
|
@ -88,6 +88,17 @@ SELECT * FROM mps_crypto_payment WHERE id = 'payment-uuid-here';
|
|||
### UUID Objects
|
||||
Always use `uuid_str` when you need a string copy of the identifier. Models inherit `uuid_str` property from `RBase`.
|
||||
|
||||
## Development Standards and Expectations
|
||||
|
||||
**CRITICAL WORK ETHIC**: The user pays significant money for development work and expects thorough, complete solutions. NEVER try to do the minimum or cut corners. When asked to implement features, provide comprehensive, production-ready implementations that consider all aspects of the request.
|
||||
|
||||
**TESTING INTEGRITY**: NEVER skip, delete, or disable unit tests or integration tests when they break. When tests fail:
|
||||
1. **FIX THE TESTS** - Update them to work with new functionality
|
||||
2. **FIX THE CODE** - If the tests reveal actual bugs, fix the underlying issue
|
||||
3. **ADD MORE TESTS** - Ensure new functionality is properly covered
|
||||
|
||||
Disabling or removing tests weakens the codebase and is unacceptable. Tests are critical safety nets that prevent regressions.
|
||||
|
||||
## Commit Message Guidelines
|
||||
|
||||
**CRITICAL**: Do not include Claude Code attribution in commit messages. Attributing human work to Claude is inappropriate and misrepresents the actual authorship of the code. All code changes should be attributed to the human developer who reviewed, approved, and committed the work.
|
||||
|
|
@ -1,82 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Dogecoin Sweep All Script
|
||||
# Sweeps ALL spendable DOGE funds to cold storage
|
||||
|
||||
set -e # Exit on any error
|
||||
|
||||
# Configuration
|
||||
DOGECOIN_CLI="/opt/dogecoin/dogecoin-cli"
|
||||
DOGECOIN_CONF="/opt/dogecoin/.dogecoin/dogecoin.conf"
|
||||
DOGECOIN_DATADIR="/opt/dogecoin/.dogecoin"
|
||||
|
||||
# Check if cold wallet address is provided
|
||||
if [ -z "$COLD_WALLET_ADDRESS" ]; then
|
||||
echo "ERROR: COLD_WALLET_ADDRESS environment variable not set!"
|
||||
echo "Usage: COLD_WALLET_ADDRESS=<doge-address> ./dogecoin-sweep-all.sh"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "=== SWEEPING ALL DOGECOIN WALLET FUNDS TO COLD STORAGE ==="
|
||||
echo "CAUTION: This will send ALL unlocked balance from wallet!"
|
||||
echo ""
|
||||
|
||||
# Check if dogecoin-cli is accessible
|
||||
if [ ! -f "$DOGECOIN_CLI" ]; then
|
||||
echo "❌ dogecoin-cli not found at $DOGECOIN_CLI"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if config exists
|
||||
if [ ! -f "$DOGECOIN_CONF" ]; then
|
||||
echo "❌ Dogecoin config not found at $DOGECOIN_CONF"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Checking wallet balance..."
|
||||
|
||||
# Test connection and get balance
|
||||
if ! balance=$($DOGECOIN_CLI -conf="$DOGECOIN_CONF" -datadir="$DOGECOIN_DATADIR" getbalance 2>/dev/null); then
|
||||
echo "❌ Dogecoin wallet not accessible. Is dogecoind running?"
|
||||
echo "Check service status: systemctl status dogecoind"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
unconfirmed=$($DOGECOIN_CLI -conf="$DOGECOIN_CONF" -datadir="$DOGECOIN_DATADIR" getunconfirmedbalance 2>/dev/null || echo "0")
|
||||
|
||||
# Check if there's balance to sweep
|
||||
if [ "$(echo "$balance == 0" | bc -l)" = "1" ]; then
|
||||
echo "No spendable balance to sweep!"
|
||||
echo "Balance: $balance DOGE"
|
||||
echo "Unconfirmed: $unconfirmed DOGE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Spendable balance: $balance DOGE"
|
||||
echo "Unconfirmed: $unconfirmed DOGE"
|
||||
echo ""
|
||||
echo "Target address: $COLD_WALLET_ADDRESS"
|
||||
echo ""
|
||||
|
||||
# Confirmation prompt
|
||||
read -p "Are you sure you want to sweep ALL spendable funds? (yes/no): " confirm
|
||||
if [ "$confirm" != "yes" ]; then
|
||||
echo "Cancelled."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Sweeping $balance DOGE to cold storage..."
|
||||
|
||||
# Send all funds (subtract fee from amount so ALL funds are sent)
|
||||
if txid=$($DOGECOIN_CLI -conf="$DOGECOIN_CONF" -datadir="$DOGECOIN_DATADIR" sendtoaddress "$COLD_WALLET_ADDRESS" "$balance" "" "" true 2>/dev/null); then
|
||||
echo "✓ Sweep successful!"
|
||||
echo "Amount: $balance DOGE"
|
||||
echo "Transaction ID: $txid"
|
||||
echo ""
|
||||
echo "New wallet balance:"
|
||||
$DOGECOIN_CLI -conf="$DOGECOIN_CONF" -datadir="$DOGECOIN_DATADIR" getbalance
|
||||
else
|
||||
echo "❌ Sweep failed!"
|
||||
exit 1
|
||||
fi
|
||||
BIN
make_post_sell/static/dogecoin-logo.png
Normal file
BIN
make_post_sell/static/dogecoin-logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 36 KiB |
BIN
make_post_sell/static/monero-symbol-480.png
Normal file
BIN
make_post_sell/static/monero-symbol-480.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.6 KiB |
|
|
@ -65,12 +65,12 @@
|
|||
{% if monero_enabled and xmr_processor_enabled and cart.requires_payment and cart.shop_product_dict|length == 1 %}
|
||||
<br/>
|
||||
{% if pending_crypto_quotes %}
|
||||
<button type="button" class="mps-button" style="background:#aaa; cursor:not-allowed;" disabled title="Complete or cancel your pending crypto payments first">Monero (XMR) - Complete Pending Payments First</button>
|
||||
<button type="button" class="mps-button" style="background:#aaa; cursor:not-allowed;" disabled title="Complete or cancel your pending crypto payments first"><img src="{{ request.static_url('make_post_sell:static/monero-symbol-480.png') }}" style="width:32px; height:32px; margin-right:8px; vertical-align:middle;">Monero (XMR) - Complete Pending Payments First</button>
|
||||
{% else %}
|
||||
<form method="POST" action="{{ request.route_url('crypto_xmr_start') }}">
|
||||
{% include "snippets/csrf.j2" %}
|
||||
<input type="hidden" name="cart_id" value="{{ cart.id }}" />
|
||||
<button type="submit" class="mps-button" style="background:#4c4;">Yes, Confirm Checkout with Monero (XMR)</button>
|
||||
<button type="submit" class="mps-button mps-button-green"><img src="{{ request.static_url('make_post_sell:static/monero-symbol-480.png') }}" style="width:32px; height:32px; margin-right:8px; vertical-align:middle;">Yes, Confirm Checkout with Monero (XMR)</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
{% if not request.has_xmr_refund_address %}
|
||||
|
|
@ -84,12 +84,12 @@
|
|||
{% if dogecoin_enabled and doge_processor_enabled and cart.requires_payment and cart.shop_product_dict|length == 1 %}
|
||||
<br/>
|
||||
{% if pending_crypto_quotes %}
|
||||
<button type="button" class="mps-button" style="background:#aaa; cursor:not-allowed;" disabled title="Complete or cancel your pending crypto payments first">Dogecoin (DOGE) 🐕 - Complete Pending Payments First</button>
|
||||
<button type="button" class="mps-button" style="background:#aaa; cursor:not-allowed;" disabled title="Complete or cancel your pending crypto payments first"><img src="{{ request.static_url('make_post_sell:static/dogecoin-logo.png') }}" style="width:32px; height:32px; margin-right:8px; vertical-align:middle;">Dogecoin (DOGE) - Complete Pending Payments First</button>
|
||||
{% else %}
|
||||
<form method="POST" action="{{ request.route_url('crypto_doge_start') }}">
|
||||
{% include "snippets/csrf.j2" %}
|
||||
<input type="hidden" name="cart_id" value="{{ cart.id }}" />
|
||||
<button type="submit" class="mps-button" style="background:#d4a574;">Yes, Confirm Checkout with Dogecoin (DOGE) 🐕</button>
|
||||
<button type="submit" class="mps-button mps-button-green"><img src="{{ request.static_url('make_post_sell:static/dogecoin-logo.png') }}" style="width:32px; height:32px; margin-right:8px; vertical-align:middle;">Yes, Confirm Checkout with Dogecoin (DOGE)</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
{% if not request.has_doge_refund_address %}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,14 @@
|
|||
{% block content -%}
|
||||
{% include "snippets/csrf.j2" %}
|
||||
<section class="one-column">
|
||||
<h2>{{ coin_name }} ({{ coin_symbol }}) Checkout</h2>
|
||||
<h2>
|
||||
{% if coin_symbol == 'XMR' %}
|
||||
<img src="{{ request.static_url('make_post_sell:static/monero-symbol-480.png') }}" style="width:150px; height:150px; margin-right:15px; vertical-align:middle;">
|
||||
{% elif coin_symbol == 'DOGE' %}
|
||||
<img src="{{ request.static_url('make_post_sell:static/dogecoin-logo.png') }}" style="width:150px; height:150px; margin-right:15px; vertical-align:middle;">
|
||||
{% endif %}
|
||||
{{ coin_name }} ({{ coin_symbol }}) Checkout
|
||||
</h2>
|
||||
|
||||
{% if address and amount_crypto %}
|
||||
{% if coin_symbol == 'XMR' %}
|
||||
|
|
|
|||
|
|
@ -1917,7 +1917,12 @@ class PassiveMonitoringTests(unittest.TestCase):
|
|||
|
||||
|
||||
class PassiveMonitoringIntegrationTests(unittest.TestCase):
|
||||
"""Integration tests for passive wallet monitoring with real DB."""
|
||||
"""Integration tests for passive wallet monitoring with real DB.
|
||||
|
||||
Uses invoice=None because expired and cancelled payments automatically
|
||||
delete their associated invoices, making None the correct state for
|
||||
these passive monitoring scenarios.
|
||||
"""
|
||||
|
||||
def setUp(self):
|
||||
from make_post_sell import main
|
||||
|
|
@ -1961,7 +1966,7 @@ class PassiveMonitoringIntegrationTests(unittest.TestCase):
|
|||
dbsession.add(processor)
|
||||
dbsession.flush()
|
||||
|
||||
# Create expired payment
|
||||
# Create expired payment (invoice=None is correct - expired payments delete their invoices)
|
||||
self.expired_payment = CryptoPayment(
|
||||
invoice=None,
|
||||
user=user,
|
||||
|
|
@ -1979,7 +1984,7 @@ class PassiveMonitoringIntegrationTests(unittest.TestCase):
|
|||
self.expired_payment.status = CryptoPayment.STATUS_EXPIRED
|
||||
dbsession.add(self.expired_payment)
|
||||
|
||||
# Create cancelled payment
|
||||
# Create cancelled payment (invoice=None is correct - cancelled payments delete their invoices)
|
||||
self.cancelled_payment = CryptoPayment(
|
||||
invoice=None,
|
||||
user=user,
|
||||
|
|
|
|||
|
|
@ -1,82 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Dogecoin Sweep All Script
|
||||
# Sweeps ALL spendable DOGE funds to cold storage
|
||||
|
||||
set -e # Exit on any error
|
||||
|
||||
# Configuration
|
||||
DOGECOIN_CLI="/opt/dogecoin/dogecoin-cli"
|
||||
DOGECOIN_CONF="/opt/dogecoin/.dogecoin/dogecoin.conf"
|
||||
DOGECOIN_DATADIR="/opt/dogecoin/.dogecoin"
|
||||
|
||||
# Check if cold wallet address is provided
|
||||
if [ -z "$COLD_WALLET_ADDRESS" ]; then
|
||||
echo "ERROR: COLD_WALLET_ADDRESS environment variable not set!"
|
||||
echo "Usage: COLD_WALLET_ADDRESS=<doge-address> ./sweep-all-doge.sh"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "=== SWEEPING ALL DOGECOIN WALLET FUNDS TO COLD STORAGE ==="
|
||||
echo "CAUTION: This will send ALL unlocked balance from wallet!"
|
||||
echo ""
|
||||
|
||||
# Check if dogecoin-cli is accessible
|
||||
if [ ! -f "$DOGECOIN_CLI" ]; then
|
||||
echo "❌ dogecoin-cli not found at $DOGECOIN_CLI"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if config exists
|
||||
if [ ! -f "$DOGECOIN_CONF" ]; then
|
||||
echo "❌ Dogecoin config not found at $DOGECOIN_CONF"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Checking wallet balance..."
|
||||
|
||||
# Test connection and get balance
|
||||
if ! balance=$($DOGECOIN_CLI -conf="$DOGECOIN_CONF" -datadir="$DOGECOIN_DATADIR" getbalance 2>/dev/null); then
|
||||
echo "❌ Dogecoin wallet not accessible. Is dogecoind running?"
|
||||
echo "Check service status: systemctl status dogecoind"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
unconfirmed=$($DOGECOIN_CLI -conf="$DOGECOIN_CONF" -datadir="$DOGECOIN_DATADIR" getunconfirmedbalance 2>/dev/null || echo "0")
|
||||
|
||||
# Check if there's balance to sweep
|
||||
if [ "$(echo "$balance == 0" | bc -l)" = "1" ]; then
|
||||
echo "No spendable balance to sweep!"
|
||||
echo "Balance: $balance DOGE"
|
||||
echo "Unconfirmed: $unconfirmed DOGE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Spendable balance: $balance DOGE"
|
||||
echo "Unconfirmed: $unconfirmed DOGE"
|
||||
echo ""
|
||||
echo "Target address: $COLD_WALLET_ADDRESS"
|
||||
echo ""
|
||||
|
||||
# Confirmation prompt
|
||||
read -p "Are you sure you want to sweep ALL spendable funds? (yes/no): " confirm
|
||||
if [ "$confirm" != "yes" ]; then
|
||||
echo "Cancelled."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Sweeping $balance DOGE to cold storage..."
|
||||
|
||||
# Send all funds (subtract fee from amount so ALL funds are sent)
|
||||
if txid=$($DOGECOIN_CLI -conf="$DOGECOIN_CONF" -datadir="$DOGECOIN_DATADIR" sendtoaddress "$COLD_WALLET_ADDRESS" "$balance" "" "" true 2>/dev/null); then
|
||||
echo "✓ Sweep successful!"
|
||||
echo "Amount: $balance DOGE"
|
||||
echo "Transaction ID: $txid"
|
||||
echo ""
|
||||
echo "New wallet balance:"
|
||||
$DOGECOIN_CLI -conf="$DOGECOIN_CONF" -datadir="$DOGECOIN_DATADIR" getbalance
|
||||
else
|
||||
echo "❌ Sweep failed!"
|
||||
exit 1
|
||||
fi
|
||||
Loading…
Add table
Add a link
Reference in a new issue