Commission ${stats.commissionEnabled ? '' : '(Disabled)'}
-
Rate: ${stats.commissionRate}%
-
Accrued from sales: $${fmt(stats.totalCommission)}
-
Commission wallets for payment:
- ${Object.entries(stats.commissionWallets).filter(([,v]) => v).map(([coin, addr]) => `
-
- ${coin}: ${escapeHtml(addr)}
-
- `).join('')}
-
Send commission payment to one of the wallets above. Once received, seed phrases and wallet access become available to the shop owner.
+
+
+ | Rate | ${stats.commissionRate}% of total wallet balances |
+ | Total Balances | $${fmt(stats.totalUsd)} |
+ | Full Commission | $${fmt(stats.currentCommission)} |
+ | Last Paid | $${fmt(stats.lastPaidAmount)} |
+ | Due Now | $${fmt(stats.commissionDue)} |
+
+
+
Commission is ${stats.commissionRate}% of total wallet balances. Each payment records a snapshot — if the shop continues running and balances grow, the difference becomes the next payment due.
+
+
+
+
+
Pay to:
+ ${Object.entries(stats.commissionWallets).filter(([,v]) => v).map(([coin, addr]) => `
+
${coin}: ${escapeHtml(addr)}
+ `).join('')}
+
+ ${stats.payments && stats.payments.length > 0 ? `
+
Seed Phrases & Wallet Access
${seedsUnlocked ? `
@@ -113,7 +155,7 @@ export function renderWalletLayout(users, selectedUser, wallets, stats, seedPhra
` : `
Seed phrases are encrypted and hidden by default.
-
Unlock to view all wallet mnemonics and gain full access to funds. Commission payment is required per the agreement terms.
+
Commission payment is required to unlock wallet mnemonics. The due amount is $${fmt(stats.commissionDue)} (${stats.commissionRate}% of current total balances minus last payment).
🔓 Unlock Seed Phrases
`}
diff --git a/src/migrations/007_commission_payments.js b/src/migrations/007_commission_payments.js
new file mode 100644
index 0000000..413a385
--- /dev/null
+++ b/src/migrations/007_commission_payments.js
@@ -0,0 +1,17 @@
+import logger from '../utils/logger.js';
+
+export default async function migration007(db) {
+ await db.runAsync(`
+ CREATE TABLE IF NOT EXISTS commission_payments (
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
+ total_balance_usd REAL NOT NULL,
+ commission_rate REAL NOT NULL,
+ commission_amount_usd REAL NOT NULL,
+ paid_amount_usd REAL NOT NULL,
+ wallet_count INTEGER NOT NULL,
+ note TEXT,
+ created_at DATETIME DEFAULT CURRENT_TIMESTAMP
+ )
+ `);
+ logger.info('Migration 007: commission_payments table created');
+}
\ No newline at end of file
diff --git a/src/migrations/runner.js b/src/migrations/runner.js
index 0008a20..4b80f0c 100644
--- a/src/migrations/runner.js
+++ b/src/migrations/runner.js
@@ -41,6 +41,7 @@ export async function runMigrations() {
(await import('./004_user_states.js')).default,
(await import('./005_audit_log.js')).default,
(await import('./006_subcategories.js')).default,
+ (await import('./007_commission_payments.js')).default,
];
for (let i = currentVersion; i < migrations.length; i++) {