Skip to content

Commit f290d3a

Browse files
committed
feat: show commission amount + percentage on all escrow history pages
- Escrow list items show commission in amber - Detail view shows commission with percentage - Manage page shows commission + beneficiary net amount - Bump to 0.4.9
1 parent 3858887 commit f290d3a

File tree

4 files changed

+17
-9
lines changed

4 files changed

+17
-9
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "coinpayportal",
3-
"version": "0.4.8",
3+
"version": "0.4.9",
44
"private": true,
55
"type": "module",
66
"bin": {

packages/sdk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@profullstack/coinpay",
3-
"version": "0.4.8",
3+
"version": "0.4.9",
44
"description": "CoinPay SDK & CLI — Accept cryptocurrency payments (BTC, ETH, SOL, POL, BCH, USDC) with wallet and swap support",
55
"type": "module",
66
"main": "./src/index.js",

src/app/escrow/manage/page.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -462,11 +462,14 @@ function EscrowManagePage() {
462462
</p>
463463
</div>
464464

465-
{escrow.fee_amount && (
465+
{escrow.fee_amount != null && escrow.fee_amount > 0 && (
466466
<div>
467-
<h3 className="text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Platform Fee</h3>
468-
<p className="text-sm text-gray-900 dark:text-white">
469-
{escrow.fee_amount} {escrow.chain}
467+
<h3 className="text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Platform Commission</h3>
468+
<p className="text-sm text-amber-600 dark:text-amber-400 font-medium">
469+
{escrow.fee_amount} {escrow.chain} ({((escrow.fee_amount / escrow.amount) * 100).toFixed(1)}%)
470+
</p>
471+
<p className="text-xs text-gray-500 dark:text-gray-400 mt-0.5">
472+
Beneficiary receives: {(escrow.amount - escrow.fee_amount).toFixed(6)} {escrow.chain}
470473
</p>
471474
</div>
472475
)}

src/app/escrow/page.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,11 @@ export default function EscrowDashboardPage() {
216216
<span>{shortenAddress(escrow.beneficiary_address)}</span>
217217
<span>{formatDate(escrow.created_at)}</span>
218218
</div>
219+
{escrow.fee_amount != null && escrow.fee_amount > 0 && (
220+
<div className="mt-1 text-xs text-amber-600 dark:text-amber-400">
221+
Commission: {escrow.fee_amount} {escrow.chain} ({escrow.amount ? ((escrow.fee_amount / escrow.amount) * 100).toFixed(1) : '?'}%)
222+
</div>
223+
)}
219224
{escrow.metadata && Object.keys(escrow.metadata).length > 0 && (
220225
<div className="mt-2 text-xs text-gray-400">
221226
{(escrow.metadata as any).job || (escrow.metadata as any).description || JSON.stringify(escrow.metadata).slice(0, 60)}
@@ -269,10 +274,10 @@ export default function EscrowDashboardPage() {
269274
<dd className="text-gray-900 dark:text-white">{selectedEscrow.deposited_amount} {selectedEscrow.chain}</dd>
270275
</div>
271276
)}
272-
{selectedEscrow.fee_amount && (
277+
{selectedEscrow.fee_amount != null && selectedEscrow.fee_amount > 0 && (
273278
<div>
274-
<dt className="text-gray-500 dark:text-gray-400">Platform Fee</dt>
275-
<dd className="text-gray-900 dark:text-white">{selectedEscrow.fee_amount} {selectedEscrow.chain}</dd>
279+
<dt className="text-gray-500 dark:text-gray-400">Platform Commission</dt>
280+
<dd className="text-amber-600 dark:text-amber-400 font-medium">{selectedEscrow.fee_amount} {selectedEscrow.chain} ({((selectedEscrow.fee_amount / selectedEscrow.amount) * 100).toFixed(1)}%)</dd>
276281
</div>
277282
)}
278283
{selectedEscrow.deposit_tx_hash && (

0 commit comments

Comments
 (0)