Detect confidential assets and display properly.

fixes #109
This commit is contained in:
softsimon 2020-11-22 16:19:57 +07:00
parent 11d67cf756
commit 01689c8433
No known key found for this signature in database
GPG Key ID: 488D7DCFB5A430D7
2 changed files with 11 additions and 5 deletions

View File

@ -49,15 +49,15 @@
</tr> </tr>
<tr *ngIf="!isNativeAsset"> <tr *ngIf="!isNativeAsset">
<td>Issued amount</td> <td>Issued amount</td>
<td>{{ formatAmount(asset.chain_stats.issued_amount, assetContract[3]) | number: '1.0-' + assetContract[3] }} {{ assetContract[1] }}</td> <td *ngIf="!blindedIssuance; else confidentialTd">{{ formatAmount(asset.chain_stats.issued_amount, assetContract[3]) | number: '1.0-' + assetContract[3] }} {{ assetContract[1] }}</td>
</tr> </tr>
<tr> <tr>
<td>Burned amount</td> <td>Burned amount</td>
<td>{{ formatAmount(asset.chain_stats.burned_amount, assetContract[3]) | number: '1.0-' + assetContract[3] }} {{ assetContract[1] }}</td> <td *ngIf="!blindedIssuance; else confidentialTd">{{ formatAmount(asset.chain_stats.burned_amount, assetContract[3]) | number: '1.0-' + assetContract[3] }} {{ assetContract[1] }}</td>
</tr> </tr>
<tr *ngIf="!isNativeAsset"> <tr *ngIf="!isNativeAsset">
<td>Circulating amount</td> <td>Circulating amount</td>
<td>{{ formatAmount(asset.chain_stats.issued_amount - asset.chain_stats.burned_amount, assetContract[3]) | number: '1.0-' + assetContract[3] }} {{ assetContract[1] }}</td> <td *ngIf="!blindedIssuance; else confidentialTd">{{ formatAmount(asset.chain_stats.issued_amount - asset.chain_stats.burned_amount, assetContract[3]) | number: '1.0-' + assetContract[3] }} {{ assetContract[1] }}</td>
</tr> </tr>
<tr *ngIf="isNativeAsset"> <tr *ngIf="isNativeAsset">
<td>Circulating amount</td> <td>Circulating amount</td>
@ -137,4 +137,8 @@
</div> </div>
<br> <br>
<ng-template #confidentialTd>
<td>Confidential</td>
</ng-template>

View File

@ -11,7 +11,7 @@ import { of, merge, Subscription, combineLatest } from 'rxjs';
import { SeoService } from 'src/app/services/seo.service'; import { SeoService } from 'src/app/services/seo.service';
import { environment } from 'src/environments/environment'; import { environment } from 'src/environments/environment';
import { AssetsService } from 'src/app/services/assets.service'; import { AssetsService } from 'src/app/services/assets.service';
import { formatNumber, moveDec } from 'src/app/bitcoin.utils'; import { moveDec } from 'src/app/bitcoin.utils';
@Component({ @Component({
selector: 'app-asset', selector: 'app-asset',
@ -23,6 +23,7 @@ export class AssetComponent implements OnInit, OnDestroy {
nativeAssetId = environment.nativeAssetId; nativeAssetId = environment.nativeAssetId;
asset: Asset; asset: Asset;
blindedIssuance: boolean;
assetContract: any; assetContract: any;
assetString: string; assetString: string;
isLoadingAsset = true; isLoadingAsset = true;
@ -101,6 +102,7 @@ export class AssetComponent implements OnInit, OnDestroy {
if (!this.assetContract) { if (!this.assetContract) {
this.assetContract = [null, '?', 'Unknown', 0]; this.assetContract = [null, '?', 'Unknown', 0];
} }
this.blindedIssuance = this.asset.chain_stats.has_blinded_issuances || this.asset.mempool_stats.has_blinded_issuances;
this.isNativeAsset = asset.asset_id === this.nativeAssetId; this.isNativeAsset = asset.asset_id === this.nativeAssetId;
this.updateChainStats(); this.updateChainStats();
this.websocketService.startTrackAsset(asset.asset_id); this.websocketService.startTrackAsset(asset.asset_id);