quantumtaskai-caprover/static/js/wallet-test.js
thecyberlearn b0e8c917ef Initial clean CapRover deployment - no secrets
Complete Django AI agent marketplace with security optimizations
and clean deployment documentation without any API keys or secrets.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-04 10:50:55 +05:30

43 lines
1.4 KiB
JavaScript

/**
* Quick wallet balance update test
* Run this in browser console to test wallet balance updates
*/
function testWalletUpdate() {
console.log('Testing wallet balance update...');
// Get current balance from data attribute
const currentBalance = parseFloat(document.body.getAttribute('data-user-balance') || '0');
console.log('Current balance from data attribute:', currentBalance);
// Get header balance element
const headerBalance = document.querySelector('[data-wallet-balance]');
console.log('Header balance element found:', !!headerBalance);
if (headerBalance) {
console.log('Current header text:', headerBalance.textContent);
}
// Test updating to a new balance
const testBalance = currentBalance - 6.0;
console.log('Testing update to:', testBalance);
if (window.WorkflowsCore) {
WorkflowsCore.updateWalletBalance(testBalance);
console.log('✅ WorkflowsCore.updateWalletBalance() called');
// Check if it worked
if (headerBalance) {
console.log('New header text:', headerBalance.textContent);
}
console.log('New data attribute:', document.body.getAttribute('data-user-balance'));
} else {
console.log('❌ WorkflowsCore not available');
}
}
// Auto-run test
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', testWalletUpdate);
} else {
testWalletUpdate();
}