Hide address received/sent from address page when using electrum API.

fixes #294
This commit is contained in:
softsimon 2021-02-01 04:52:24 +07:00
parent fd869c732d
commit 2a5a4ddac0
No known key found for this signature in database
GPG Key ID: 488D7DCFB5A430D7
4 changed files with 14 additions and 9 deletions

View File

@ -86,7 +86,8 @@ class BitcoindElectrsApi extends BitcoinApi implements AbstractBitcoinApi {
'spent_txo_count': 0, 'spent_txo_count': 0,
'spent_txo_sum': balance.unconfirmed < 0 ? -balance.unconfirmed : 0, 'spent_txo_sum': balance.unconfirmed < 0 ? -balance.unconfirmed : 0,
'tx_count': unconfirmed, 'tx_count': unconfirmed,
} },
'electrum': true,
}; };
} catch (e) { } catch (e) {
if (e === 'failed to get confirmed status') { if (e === 'failed to get confirmed status') {

View File

@ -91,6 +91,7 @@ export namespace IEsploraApi {
address: string; address: string;
chain_stats: ChainStats; chain_stats: ChainStats;
mempool_stats: MempoolStats; mempool_stats: MempoolStats;
electrum?: boolean;
} }
export interface ChainStats { export interface ChainStats {

View File

@ -16,14 +16,16 @@
<div class="col"> <div class="col">
<table class="table table-borderless table-striped"> <table class="table table-borderless table-striped">
<tbody> <tbody>
<tr> <ng-template [ngIf]="!address.electrum">
<td i18n="address.total-received">Total received</td> <tr>
<td *ngIf="address.chain_stats.funded_txo_sum !== undefined; else confidentialTd"><app-amount [satoshis]="receieved" [noFiat]="true"></app-amount></td> <td i18n="address.total-received">Total received</td>
</tr> <td *ngIf="address.chain_stats.funded_txo_sum !== undefined; else confidentialTd"><app-amount [satoshis]="receieved" [noFiat]="true"></app-amount></td>
<tr> </tr>
<td i18n="address.total-sent">Total sent</td> <tr>
<td *ngIf="address.chain_stats.spent_txo_sum !== undefined; else confidentialTd"><app-amount [satoshis]="sent" [noFiat]="true"></app-amount></td> <td i18n="address.total-sent">Total sent</td>
</tr> <td *ngIf="address.chain_stats.spent_txo_sum !== undefined; else confidentialTd"><app-amount [satoshis]="sent" [noFiat]="true"></app-amount></td>
</tr>
</ng-template>
<tr> <tr>
<td i18n="address.balance">Balance</td> <td i18n="address.balance">Balance</td>
<td *ngIf="address.chain_stats.funded_txo_sum !== undefined; else confidentialTd"><app-amount [satoshis]="receieved - sent" [noFiat]="true"></app-amount> (<app-fiat [value]="receieved - sent"></app-fiat>)</td> <td *ngIf="address.chain_stats.funded_txo_sum !== undefined; else confidentialTd"><app-amount [satoshis]="receieved - sent" [noFiat]="true"></app-amount> (<app-fiat [value]="receieved - sent"></app-fiat>)</td>

View File

@ -98,6 +98,7 @@ export interface Block {
} }
export interface Address { export interface Address {
electrum?: boolean;
address: string; address: string;
chain_stats: ChainStats; chain_stats: ChainStats;
mempool_stats: MempoolStats; mempool_stats: MempoolStats;