feat: Add comprehensive staking interface to PaperclipWallet
- Add staking RPC methods for validators, delegation, and rewards - Implement complete staking UI with validator selection and delegation - Add reward claiming functionality and validator creation interface - Include professional staking dashboard with real-time data - Integrate staking navigation into existing wallet interface
This commit is contained in:
386
assets/styles/staking.css
Normal file
386
assets/styles/staking.css
Normal file
@@ -0,0 +1,386 @@
|
||||
/* PaperclipChain Staking Interface Styles */
|
||||
|
||||
.staking-container {
|
||||
padding: 20px;
|
||||
background: #f5f5f5;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.staking-overview {
|
||||
display: flex;
|
||||
gap: 20px;
|
||||
margin-bottom: 30px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.staking-card {
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
color: white;
|
||||
padding: 20px;
|
||||
border-radius: 12px;
|
||||
flex: 1;
|
||||
min-width: 200px;
|
||||
box-shadow: 0 4px 15px rgba(0,0,0,0.1);
|
||||
transition: transform 0.3s ease;
|
||||
}
|
||||
|
||||
.staking-card:hover {
|
||||
transform: translateY(-5px);
|
||||
}
|
||||
|
||||
.staking-card h3 {
|
||||
margin: 0 0 10px 0;
|
||||
font-size: 14px;
|
||||
opacity: 0.9;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
|
||||
.staking-card .amount {
|
||||
font-size: 24px;
|
||||
font-weight: bold;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.staking-card .subtitle {
|
||||
font-size: 12px;
|
||||
opacity: 0.8;
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.staking-card.success {
|
||||
background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
|
||||
}
|
||||
|
||||
.staking-card.warning {
|
||||
background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
|
||||
}
|
||||
|
||||
.staking-card.info {
|
||||
background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
|
||||
}
|
||||
|
||||
.quick-actions {
|
||||
background: white;
|
||||
padding: 20px;
|
||||
border-radius: 12px;
|
||||
margin-bottom: 30px;
|
||||
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
||||
}
|
||||
|
||||
.quick-actions h3 {
|
||||
margin-top: 0;
|
||||
color: #333;
|
||||
border-bottom: 2px solid #eee;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
.action-buttons {
|
||||
display: flex;
|
||||
gap: 15px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.btn-staking {
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 12px 24px;
|
||||
border-radius: 8px;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
text-decoration: none;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.btn-staking:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.btn-staking.warning {
|
||||
background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
|
||||
}
|
||||
|
||||
.btn-staking.warning:hover {
|
||||
box-shadow: 0 5px 15px rgba(255, 152, 0, 0.4);
|
||||
}
|
||||
|
||||
.btn-staking.success {
|
||||
background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
|
||||
}
|
||||
|
||||
.btn-staking.success:hover {
|
||||
box-shadow: 0 5px 15px rgba(76, 175, 80, 0.4);
|
||||
}
|
||||
|
||||
.btn-staking.info {
|
||||
background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
|
||||
}
|
||||
|
||||
.btn-staking.info:hover {
|
||||
box-shadow: 0 5px 15px rgba(33, 150, 243, 0.4);
|
||||
}
|
||||
|
||||
.validators-section {
|
||||
background: white;
|
||||
padding: 20px;
|
||||
border-radius: 12px;
|
||||
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
||||
}
|
||||
|
||||
.validators-section h3 {
|
||||
margin-top: 0;
|
||||
color: #333;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
border-bottom: 2px solid #eee;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
.refresh-btn {
|
||||
background: #f8f9fa;
|
||||
border: 1px solid #dee2e6;
|
||||
padding: 8px 12px;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
transition: background 0.3s ease;
|
||||
}
|
||||
|
||||
.refresh-btn:hover {
|
||||
background: #e9ecef;
|
||||
}
|
||||
|
||||
.validators-table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.validators-table th,
|
||||
.validators-table td {
|
||||
padding: 12px;
|
||||
text-align: left;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
|
||||
.validators-table th {
|
||||
background: #f8f9fa;
|
||||
font-weight: 600;
|
||||
color: #495057;
|
||||
border-top: 1px solid #eee;
|
||||
}
|
||||
|
||||
.validators-table tbody tr:hover {
|
||||
background: #f8f9fa;
|
||||
}
|
||||
|
||||
.validator-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.validator-info strong {
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.validator-info small {
|
||||
color: #6c757d;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.status-badge {
|
||||
padding: 4px 8px;
|
||||
border-radius: 12px;
|
||||
font-size: 11px;
|
||||
font-weight: 500;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.status-badge.active {
|
||||
background: #d4edda;
|
||||
color: #155724;
|
||||
}
|
||||
|
||||
.status-badge.inactive {
|
||||
background: #f8d7da;
|
||||
color: #721c24;
|
||||
}
|
||||
|
||||
.btn-validator-action {
|
||||
padding: 6px 12px;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
font-size: 12px;
|
||||
cursor: pointer;
|
||||
margin-right: 5px;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.btn-validator-action.delegate {
|
||||
background: #007bff;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.btn-validator-action.delegate:hover {
|
||||
background: #0056b3;
|
||||
}
|
||||
|
||||
.btn-validator-action.undelegate {
|
||||
background: #ffc107;
|
||||
color: #212529;
|
||||
}
|
||||
|
||||
.btn-validator-action.undelegate:hover {
|
||||
background: #e0a800;
|
||||
}
|
||||
|
||||
.btn-validator-action:disabled {
|
||||
opacity: 0.5;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
/* Modal Styles */
|
||||
.staking-modal .modal-body {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.staking-modal .form-group {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.staking-modal label {
|
||||
display: block;
|
||||
margin-bottom: 5px;
|
||||
font-weight: 500;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.staking-modal input,
|
||||
.staking-modal select {
|
||||
width: 100%;
|
||||
padding: 10px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 6px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.staking-modal input:focus,
|
||||
.staking-modal select:focus {
|
||||
outline: none;
|
||||
border-color: #667eea;
|
||||
box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
|
||||
}
|
||||
|
||||
.staking-modal .help-text {
|
||||
font-size: 12px;
|
||||
color: #6c757d;
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.staking-modal .alert {
|
||||
padding: 10px 15px;
|
||||
border-radius: 6px;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.staking-modal .alert.warning {
|
||||
background: #fff3cd;
|
||||
border: 1px solid #ffeaa7;
|
||||
color: #856404;
|
||||
}
|
||||
|
||||
.staking-modal .alert.info {
|
||||
background: #d1ecf1;
|
||||
border: 1px solid #bee5eb;
|
||||
color: #0c5460;
|
||||
}
|
||||
|
||||
.modal-buttons {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
justify-content: flex-end;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.modal-buttons .btn {
|
||||
padding: 10px 20px;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.modal-buttons .btn-secondary {
|
||||
background: #6c757d;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.modal-buttons .btn-primary {
|
||||
background: #667eea;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.modal-buttons .btn:hover {
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
/* Responsive Design */
|
||||
@media (max-width: 768px) {
|
||||
.staking-overview {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.action-buttons {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.validators-table {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.validators-table th,
|
||||
.validators-table td {
|
||||
padding: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
/* Loading States */
|
||||
.loading {
|
||||
text-align: center;
|
||||
padding: 40px;
|
||||
color: #6c757d;
|
||||
}
|
||||
|
||||
.loading i {
|
||||
font-size: 24px;
|
||||
margin-bottom: 10px;
|
||||
animation: spin 1s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% { transform: rotate(0deg); }
|
||||
100% { transform: rotate(360deg); }
|
||||
}
|
||||
|
||||
/* Success/Error Messages */
|
||||
.message {
|
||||
padding: 15px;
|
||||
border-radius: 6px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.message.success {
|
||||
background: #d4edda;
|
||||
color: #155724;
|
||||
border: 1px solid #c3e6cb;
|
||||
}
|
||||
|
||||
.message.error {
|
||||
background: #f8d7da;
|
||||
color: #721c24;
|
||||
border: 1px solid #f5c6cb;
|
||||
}
|
||||
214
assets/templates/staking.html
Normal file
214
assets/templates/staking.html
Normal file
@@ -0,0 +1,214 @@
|
||||
<!-- PaperclipChain Staking Interface -->
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h2>Staking & Delegation
|
||||
<small>Earn rewards by staking your CLIPS</small>
|
||||
</h2>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<!-- Staking Overview -->
|
||||
<div class="row mb-4">
|
||||
<div class="col-md-3">
|
||||
<div class="info-box bg-clips">
|
||||
<div class="info-box-icon">
|
||||
<i class="fas fa-coins"></i>
|
||||
</div>
|
||||
<div class="info-box-content">
|
||||
<span class="info-box-text">Total Staked</span>
|
||||
<span class="info-box-number" id="totalStakedAmount">0 CLIPS</span>
|
||||
<div class="progress">
|
||||
<div class="progress-bar" style="width: 0%" id="totalStakedProgress"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="info-box bg-success">
|
||||
<div class="info-box-icon">
|
||||
<i class="fas fa-trophy"></i>
|
||||
</div>
|
||||
<div class="info-box-content">
|
||||
<span class="info-box-text">Pending Rewards</span>
|
||||
<span class="info-box-number" id="pendingRewards">0 CLIPS</span>
|
||||
<div class="progress">
|
||||
<div class="progress-bar bg-success" style="width: 0%" id="rewardsProgress"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="info-box bg-warning">
|
||||
<div class="info-box-icon">
|
||||
<i class="fas fa-users"></i>
|
||||
</div>
|
||||
<div class="info-box-content">
|
||||
<span class="info-box-text">Active Validators</span>
|
||||
<span class="info-box-number" id="activeValidators">0</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="info-box bg-info">
|
||||
<div class="info-box-icon">
|
||||
<i class="fas fa-percentage"></i>
|
||||
</div>
|
||||
<div class="info-box-content">
|
||||
<span class="info-box-text">Network APY</span>
|
||||
<span class="info-box-number" id="networkAPY">~8%</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Quick Actions -->
|
||||
<div class="row mb-4">
|
||||
<div class="col-md-12">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">Quick Actions</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="btn-group" role="group">
|
||||
<button type="button" class="btn btn-clips" id="btnDelegate">
|
||||
<i class="fas fa-arrow-up"></i> Delegate
|
||||
</button>
|
||||
<button type="button" class="btn btn-warning" id="btnUndelegate">
|
||||
<i class="fas fa-arrow-down"></i> Undelegate
|
||||
</button>
|
||||
<button type="button" class="btn btn-success" id="btnClaimRewards">
|
||||
<i class="fas fa-gift"></i> Claim Rewards
|
||||
</button>
|
||||
<button type="button" class="btn btn-info" id="btnCreateValidator">
|
||||
<i class="fas fa-plus"></i> Become Validator
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Validators List -->
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">Validators</h3>
|
||||
<div class="card-tools">
|
||||
<button type="button" class="btn btn-tool" id="btnRefreshValidators" data-toggle="tooltip" title="Refresh">
|
||||
<i class="fas fa-sync"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-bordered" id="validatorsTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Validator</th>
|
||||
<th>Status</th>
|
||||
<th>Self Stake</th>
|
||||
<th>Delegated</th>
|
||||
<th>Commission</th>
|
||||
<th>APY</th>
|
||||
<th>Your Stake</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="validatorsTableBody">
|
||||
<!-- Validators will be populated here -->
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Delegate Modal -->
|
||||
<div id="dlgDelegate" class="modalDialog" data-izimodal-title="Delegate to Validator" data-izimodal-subtitle="Stake your CLIPS to earn rewards" data-izimodal-icon="icon-home">
|
||||
<div class="modalBody">
|
||||
<div class="form-group">
|
||||
<label for="delegateValidator">Select Validator:</label>
|
||||
<select class="form-control" id="delegateValidator">
|
||||
<option value="">Select a validator...</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="delegateAmount">Amount to Delegate (CLIPS):</label>
|
||||
<input type="number" class="form-control" id="delegateAmount" placeholder="Minimum 100 CLIPS" min="100" step="0.000001">
|
||||
<small class="form-text text-muted">Available balance: <span id="availableBalance">0 CLIPS</span></small>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="delegateWallet">From Wallet:</label>
|
||||
<select class="form-control" id="delegateWallet">
|
||||
<!-- Wallets will be populated here -->
|
||||
</select>
|
||||
</div>
|
||||
<button type="button" class="btn btn-secondary btn-dialog-cancel" id="btnDelegateCancel">Cancel</button>
|
||||
<button type="button" class="btn btn-clips btn-dialog-confirm" id="btnDelegateConfirm">Delegate</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Undelegate Modal -->
|
||||
<div id="dlgUndelegate" class="modalDialog" data-izimodal-title="Undelegate from Validator" data-izimodal-subtitle="Withdraw your staked CLIPS" data-izimodal-icon="icon-home">
|
||||
<div class="modalBody">
|
||||
<div class="form-group">
|
||||
<label for="undelegateValidator">Validator:</label>
|
||||
<select class="form-control" id="undelegateValidator">
|
||||
<option value="">Select a validator...</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="undelegateAmount">Amount to Undelegate (CLIPS):</label>
|
||||
<input type="number" class="form-control" id="undelegateAmount" placeholder="Enter amount" min="0.000001" step="0.000001">
|
||||
<small class="form-text text-muted">Your stake: <span id="yourStakeAmount">0 CLIPS</span></small>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="undelegateWallet">To Wallet:</label>
|
||||
<select class="form-control" id="undelegateWallet">
|
||||
<!-- Wallets will be populated here -->
|
||||
</select>
|
||||
</div>
|
||||
<div class="alert alert-warning">
|
||||
<i class="fas fa-exclamation-triangle"></i>
|
||||
<strong>Note:</strong> Undelegated funds may have a cooldown period before they become available.
|
||||
</div>
|
||||
<button type="button" class="btn btn-secondary btn-dialog-cancel" id="btnUndelegateCancel">Cancel</button>
|
||||
<button type="button" class="btn btn-warning btn-dialog-confirm" id="btnUndelegateConfirm">Undelegate</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Create Validator Modal -->
|
||||
<div id="dlgCreateValidator" class="modalDialog" data-izimodal-title="Become a Validator" data-izimodal-subtitle="Create a new validator node" data-izimodal-icon="icon-home">
|
||||
<div class="modalBody">
|
||||
<div class="alert alert-info">
|
||||
<i class="fas fa-info-circle"></i>
|
||||
<strong>Requirements:</strong> Minimum 10,000 CLIPS stake required to create a validator.
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="validatorStake">Initial Stake (CLIPS):</label>
|
||||
<input type="number" class="form-control" id="validatorStake" placeholder="Minimum 10,000 CLIPS" min="10000" step="0.000001">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="validatorCommission">Commission Rate (%):</label>
|
||||
<input type="number" class="form-control" id="validatorCommission" placeholder="0-50%" min="0" max="50" step="0.01" value="5">
|
||||
<small class="form-text text-muted">Percentage of rewards you'll keep as commission</small>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="validatorWallet">Validator Wallet:</label>
|
||||
<select class="form-control" id="validatorWallet">
|
||||
<!-- Wallets will be populated here -->
|
||||
</select>
|
||||
</div>
|
||||
<button type="button" class="btn btn-secondary btn-dialog-cancel" id="btnCreateValidatorCancel">Cancel</button>
|
||||
<button type="button" class="btn btn-info btn-dialog-confirm" id="btnCreateValidatorConfirm">Create Validator</button>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user