240 lines
6.5 KiB
HTML
240 lines
6.5 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Ethereum WebAssembly Demo</title>
|
|
<style>
|
|
body {
|
|
font-family: Arial, sans-serif;
|
|
max-width: 800px;
|
|
margin: 0 auto;
|
|
padding: 20px;
|
|
line-height: 1.6;
|
|
}
|
|
.container {
|
|
border: 1px solid #ddd;
|
|
padding: 20px;
|
|
border-radius: 5px;
|
|
margin-bottom: 20px;
|
|
}
|
|
button {
|
|
background-color: #4CAF50;
|
|
border: none;
|
|
color: white;
|
|
padding: 10px 20px;
|
|
text-align: center;
|
|
text-decoration: none;
|
|
display: inline-block;
|
|
font-size: 16px;
|
|
margin: 4px 2px;
|
|
cursor: pointer;
|
|
border-radius: 4px;
|
|
}
|
|
button.secondary {
|
|
background-color: #6c757d;
|
|
}
|
|
button.danger {
|
|
background-color: #dc3545;
|
|
}
|
|
input, textarea, select {
|
|
padding: 8px;
|
|
margin: 5px;
|
|
border: 1px solid #ddd;
|
|
border-radius: 4px;
|
|
width: 80%;
|
|
}
|
|
.result {
|
|
margin-top: 10px;
|
|
padding: 10px;
|
|
background-color: #f5f5f5;
|
|
border-radius: 4px;
|
|
word-break: break-all;
|
|
}
|
|
.key-display {
|
|
font-family: monospace;
|
|
font-size: 12px;
|
|
word-break: break-all;
|
|
}
|
|
.note {
|
|
font-style: italic;
|
|
color: #666;
|
|
font-size: 14px;
|
|
}
|
|
.form-group {
|
|
margin-bottom: 15px;
|
|
}
|
|
.form-group label {
|
|
display: block;
|
|
margin-bottom: 5px;
|
|
font-weight: bold;
|
|
}
|
|
.status {
|
|
padding: 10px;
|
|
margin-bottom: 15px;
|
|
border-radius: 4px;
|
|
}
|
|
.status.logged-in {
|
|
background-color: #d4edda;
|
|
color: #155724;
|
|
}
|
|
.status.logged-out {
|
|
background-color: #f8d7da;
|
|
color: #721c24;
|
|
}
|
|
.hidden {
|
|
display: none;
|
|
}
|
|
.address-container {
|
|
margin-top: 15px;
|
|
padding: 10px;
|
|
background-color: #f8f9fa;
|
|
border-radius: 4px;
|
|
border: 1px solid #ddd;
|
|
}
|
|
.address-label {
|
|
font-weight: bold;
|
|
margin-bottom: 5px;
|
|
}
|
|
.address-value {
|
|
font-family: monospace;
|
|
word-break: break-all;
|
|
background-color: #e9ecef;
|
|
padding: 8px;
|
|
border-radius: 4px;
|
|
margin-bottom: 10px;
|
|
border: 1px solid #ced4da;
|
|
}
|
|
.nav-links {
|
|
margin-bottom: 20px;
|
|
}
|
|
.nav-links a {
|
|
margin-right: 15px;
|
|
text-decoration: none;
|
|
color: #007bff;
|
|
}
|
|
.nav-links a:hover {
|
|
text-decoration: underline;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<h1>Ethereum WebAssembly Demo</h1>
|
|
|
|
<div class="nav-links">
|
|
<a href="index.html">Main Crypto Demo</a>
|
|
<a href="ethereum.html">Ethereum Demo</a>
|
|
</div>
|
|
|
|
<!-- Login/Space Management Section -->
|
|
<div class="container" id="login-container">
|
|
<h2>Key Space Management</h2>
|
|
|
|
<div id="login-status" class="status logged-out">
|
|
Status: Not logged in
|
|
</div>
|
|
|
|
<div id="login-form">
|
|
<div class="form-group">
|
|
<label for="space-name">Space Name:</label>
|
|
<input type="text" id="space-name" placeholder="Enter space name" />
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="space-password">Password:</label>
|
|
<input type="password" id="space-password" placeholder="Enter password" />
|
|
</div>
|
|
|
|
<div>
|
|
<button id="login-button">Login</button>
|
|
<button id="create-space-button">Create New Space</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="logout-form" class="hidden">
|
|
<div class="form-group">
|
|
<label>Current Space: <span id="current-space-name"></span></label>
|
|
</div>
|
|
<div class="form-group">
|
|
<button id="logout-button" class="danger">Logout</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="result" id="space-result">Result will appear here</div>
|
|
</div>
|
|
|
|
<!-- Keypair Management Section -->
|
|
<div class="container" id="keypair-management-container">
|
|
<h2>Keypair Management</h2>
|
|
|
|
<div id="keypair-form">
|
|
<div class="form-group">
|
|
<label for="keypair-name">Keypair Name:</label>
|
|
<input type="text" id="keypair-name" placeholder="Enter keypair name" />
|
|
<button id="create-keypair-button">Create Keypair</button>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="select-keypair">Select Keypair:</label>
|
|
<select id="select-keypair">
|
|
<option value="">-- Select a keypair --</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="result" id="keypair-management-result">Result will appear here</div>
|
|
</div>
|
|
|
|
<!-- Ethereum Wallet Section -->
|
|
<div class="container" id="ethereum-wallet-container">
|
|
<h2>Ethereum Wallet</h2>
|
|
|
|
<div class="note">Note: All operations use the Gnosis Chain (xDAI)</div>
|
|
|
|
<div class="form-group">
|
|
<button id="create-ethereum-wallet-button">Create Ethereum Wallet from Selected Keypair</button>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="wallet-name">Create from Name and Keypair:</label>
|
|
<input type="text" id="wallet-name" placeholder="Enter name for deterministic derivation" />
|
|
<button id="create-from-name-button">Create from Name</button>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="private-key">Import Private Key:</label>
|
|
<input type="text" id="private-key" placeholder="Enter private key (with or without 0x prefix)" />
|
|
<button id="import-private-key-button">Import Private Key</button>
|
|
</div>
|
|
|
|
<div id="ethereum-wallet-info" class="hidden">
|
|
<div class="address-container">
|
|
<div class="address-label">Ethereum Address:</div>
|
|
<div class="address-value" id="ethereum-address-value"></div>
|
|
<button id="copy-address-button" class="secondary">Copy Address</button>
|
|
</div>
|
|
|
|
<div class="address-container">
|
|
<div class="address-label">Private Key (hex):</div>
|
|
<div class="address-value" id="ethereum-private-key-value"></div>
|
|
<button id="copy-private-key-button" class="secondary">Copy Private Key</button>
|
|
<div class="note">Warning: Never share your private key with anyone!</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="result" id="ethereum-wallet-result">Result will appear here</div>
|
|
</div>
|
|
|
|
<!-- Ethereum Balance Section -->
|
|
<div class="container" id="ethereum-balance-container">
|
|
<h2>Check Ethereum Balance</h2>
|
|
|
|
<div class="form-group">
|
|
<button id="check-balance-button">Check Current Wallet Balance</button>
|
|
</div>
|
|
|
|
<div class="result" id="balance-result">Balance will appear here</div>
|
|
</div>
|
|
|
|
<script type="module" src="./js/ethereum.js"></script>
|
|
</body>
|
|
</html> |