Skip to content
This repository has been archived by the owner on Sep 27, 2024. It is now read-only.

Commit

Permalink
Subtract fee from amount when sending privately.
Browse files Browse the repository at this point in the history
Part of #82.
  • Loading branch information
sproxet committed Oct 8, 2019
1 parent 778fd1e commit 1b4f537
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/daemon/zcoind.ts
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,9 @@ export class Zcoind {
return data.txid;
}

// Publicly send amount satoshi XZC to recipient. resolve()s with txid, or reject()s if we have insufficient funds
// or the call fails for some other reason.
// Publicly send amount satoshi XZC to recipient, subtracting the fee from the amount.
//
// resolve()s with txid, or reject()s if we have insufficient funds or the call fails for some other reason.
async privateSend(auth: string, label: string, recipient: string, amount: number): Promise<string> {
const data = await this.send(auth, 'create', 'sendPrivate', {
outputs: [
Expand All @@ -389,7 +390,8 @@ export class Zcoind {
amount
}
],
label
label,
subtractFeeFromAmount: true
});

return data;
Expand Down
12 changes: 12 additions & 0 deletions src/renderer/components/PaymentSidebars/Send.vue
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,13 @@
</div>
</div>

<div
v-if="privateOrPublic === 'private'"
class="fee-warning"
>
Very slightly less will be sent because of fees.
</div>

<div class="amount-available">
{{ convertToCoin(availableBalance) }} XZC available for {{ privateOrPublic }} send.
<div v-if="unavailableBalance > 0">
Expand Down Expand Up @@ -528,6 +535,11 @@ fieldset {
color: $color--polo-dark;
}
.fee-warning {
font-style: italic;
font-size: 0.85em;
}
.amount-available {
text-align: right;
color: $color--polo-dark;
Expand Down

0 comments on commit 1b4f537

Please sign in to comment.