feat: multi-wallet architecture with localStorage state, EIP-712 verification, cross-tab WS leadership
- wallets.js: WalletManager state management with chain validation - verifier.js: WalletVerifier EIP-712 signing via window.ethereum - stream.js: WalletStreamManager with BroadcastChannel leader election, backoff + jitter - AGENTS.md: updated with coding guidelines
This commit is contained in:
43
wallet_test.html
Normal file
43
wallet_test.html
Normal file
@ -0,0 +1,43 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Wallet Verifier Test Harness</title>
|
||||
<style>
|
||||
body { font-family: sans-serif; padding: 40px; background: #1a1a1a; color: #fff; }
|
||||
button { padding: 12px 24px; font-size: 16px; cursor: pointer; background: #3b82f6; color: white; border: none; border-radius: 6px; }
|
||||
button:hover { background: #2563eb; }
|
||||
#log { margin-top: 20px; padding: 15px; background: #2a2a2a; border-radius: 6px; white-space: pre-wrap; font-family: monospace; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Dione Multi-Wallet Verifier Test</h2>
|
||||
<button id="connectBtn">⚡ Connect & Verify Wallet</button>
|
||||
<div id="log">Click the button to start initialization...</div>
|
||||
|
||||
<script type="module">
|
||||
import { WalletManager } from './wallets.js';
|
||||
import { WalletVerifier } from './verifier.js';
|
||||
|
||||
const wm = new WalletManager();
|
||||
wm.loadWallets();
|
||||
const verifier = new WalletVerifier(wm);
|
||||
|
||||
const logDiv = document.getElementById('log');
|
||||
|
||||
document.getElementById('connectBtn').addEventListener('click', async () => {
|
||||
logDiv.innerText = "Triggering wallet connection...\nCheck your extension popup!";
|
||||
try {
|
||||
const result = await verifier.triggerWalletVerification('base', 'My Dev Wallet');
|
||||
if (result.success) {
|
||||
logDiv.style.color = '#4ade80';
|
||||
logDiv.innerText = `🎉 SUCCESS!\n\nVerified Wallet:\n${JSON.stringify(result.wallet, null, 2)}\n\nFull LocalStorage State:\n${localStorage.getItem('cbbtc_tracked_wallets')}`;
|
||||
}
|
||||
} catch (error) {
|
||||
logDiv.style.color = '#f87171';
|
||||
logDiv.innerText = `❌ ERROR CAUGHT:\n${error.message}`;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user