From c8639ec71d70758d1616b86796b6dc99a478a3f8 Mon Sep 17 00:00:00 2001 From: softsimon Date: Tue, 4 Jan 2022 05:26:46 +0400 Subject: [PATCH] Fixing missing assets data for Liquid Testnet native asset fixes #1068 --- .../src/app/components/asset/asset.component.html | 14 +++++++------- frontend/src/app/services/assets.service.ts | 9 ++++++++- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/frontend/src/app/components/asset/asset.component.html b/frontend/src/app/components/asset/asset.component.html index 0b6eed756..c79e260b6 100644 --- a/frontend/src/app/components/asset/asset.component.html +++ b/frontend/src/app/components/asset/asset.component.html @@ -31,7 +31,7 @@ Issuer {{ assetContract[0] }} - + Issuance TX {{ asset.issuance_txin.txid | shortenString : 13 }} @@ -42,15 +42,15 @@
- + - + - + @@ -58,11 +58,11 @@ - + - + @@ -78,7 +78,7 @@

{{ (transactions?.length | number) || '?' }} of {{ txCount | number }}  - Peg In/Out and Burn Transactions + Peg In/Out and Burn Transactions Issuance and Burn Transactions

diff --git a/frontend/src/app/services/assets.service.ts b/frontend/src/app/services/assets.service.ts index 8331ab7d1..260a48b7b 100644 --- a/frontend/src/app/services/assets.service.ts +++ b/frontend/src/app/services/assets.service.ts @@ -1,7 +1,7 @@ import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { Observable } from 'rxjs'; -import { shareReplay, switchMap } from 'rxjs/operators'; +import { map, shareReplay, switchMap } from 'rxjs/operators'; import { StateService } from './state.service'; @Injectable({ @@ -29,6 +29,13 @@ export class AssetsService { this.getAssetsMinimalJson$ = this.stateService.networkChanged$ .pipe( switchMap(() => this.httpClient.get(`${apiBaseUrl}/resources/assets${this.stateService.network === 'liquidtestnet' ? '-testnet' : ''}.minimal.json`)), + map((assetsMinimal) => { + if (this.stateService.network === 'liquidtestnet') { + // Hard coding the Liquid Testnet native asset + assetsMinimal['144c654344aa716d6f3abcc1ca90e5641e4e2a7f633bc09fe3baf64585819a49'] = [null, "tL-BTC", "Test Liquid Bitcoin", 8]; + } + return assetsMinimal; + }), shareReplay(1), ); this.getMiningPools$ = this.httpClient.get(apiBaseUrl + '/resources/pools.json').pipe(shareReplay(1));
Pegged in {{ formatAmount(asset.chain_stats.peg_in_amount, assetContract[3]) | number: '1.0-' + assetContract[3] }} {{ assetContract[1] }}
Pegged out {{ formatAmount(asset.chain_stats.peg_out_amount, assetContract[3]) | number: '1.0-' + assetContract[3] }} {{ assetContract[1] }}
Issued amount {{ formatAmount(asset.chain_stats.issued_amount, assetContract[3]) | number: '1.0-' + assetContract[3] }} {{ assetContract[1] }}
Burned amount {{ formatAmount(asset.chain_stats.burned_amount, assetContract[3]) | number: '1.0-' + assetContract[3] }} {{ assetContract[1] }}
Circulating amount {{ formatAmount(asset.chain_stats.issued_amount - asset.chain_stats.burned_amount, assetContract[3]) | number: '1.0-' + assetContract[3] }} {{ assetContract[1] }}
Circulating amount {{ formatAmount(asset.chain_stats.peg_in_amount - asset.chain_stats.burned_amount - asset.chain_stats.peg_out_amount, assetContract[3]) | number: '1.0-' + assetContract[3] }} {{ assetContract[1] }}