diff --git a/backend/src/api/common.ts b/backend/src/api/common.ts index 0a4a210d1..3d575c6dc 100644 --- a/backend/src/api/common.ts +++ b/backend/src/api/common.ts @@ -1,7 +1,9 @@ import { CpfpInfo, TransactionExtended, TransactionStripped } from '../mempool.interfaces'; import config from '../config'; export class Common { - static nativeAssetId = '6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d'; + static nativeAssetId = config.MEMPOOL.NETWORK === 'liquidtestnet' ? + '144c654344aa716d6f3abcc1ca90e5641e4e2a7f633bc09fe3baf64585819a49' + : '6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d'; static median(numbers: number[]) { let medianNr = 0; diff --git a/backend/src/config.ts b/backend/src/config.ts index 9513324d8..4c2888834 100644 --- a/backend/src/config.ts +++ b/backend/src/config.ts @@ -2,7 +2,7 @@ const configFile = require('../mempool-config.json'); interface IConfig { MEMPOOL: { - NETWORK: 'mainnet' | 'testnet' | 'signet' | 'liquid'; + NETWORK: 'mainnet' | 'testnet' | 'signet' | 'liquid' | 'liquidtestnet'; BACKEND: 'esplora' | 'electrum' | 'none'; HTTP_PORT: number; SPAWN_CLUSTER_PROCS: number; diff --git a/frontend/src/app/assets/assets.component.ts b/frontend/src/app/assets/assets.component.ts index 5f572241d..49c42d76e 100644 --- a/frontend/src/app/assets/assets.component.ts +++ b/frontend/src/app/assets/assets.component.ts @@ -7,6 +7,7 @@ import { ActivatedRoute, Router } from '@angular/router'; import { merge, combineLatest, Observable } from 'rxjs'; import { AssetExtended } from '../interfaces/electrs.interface'; import { SeoService } from '../services/seo.service'; +import { StateService } from '../services/state.service'; @Component({ selector: 'app-assets', @@ -15,7 +16,8 @@ import { SeoService } from '../services/seo.service'; changeDetection: ChangeDetectionStrategy.OnPush }) export class AssetsComponent implements OnInit { - nativeAssetId = environment.nativeAssetId; + nativeAssetId = this.stateService.network === 'liquidtestnet' ? environment.nativeTestAssetId : environment.nativeAssetId; + assets: AssetExtended[]; assetsCache: AssetExtended[]; searchForm: FormGroup; @@ -34,6 +36,7 @@ export class AssetsComponent implements OnInit { private route: ActivatedRoute, private router: Router, private seoService: SeoService, + private stateService: StateService, ) { } ngOnInit() { @@ -52,12 +55,22 @@ export class AssetsComponent implements OnInit { take(1), mergeMap(([assets, qp]) => { this.assets = Object.values(assets); - // @ts-ignore - this.assets.push({ - name: 'Liquid Bitcoin', - ticker: 'L-BTC', - asset_id: this.nativeAssetId, - }); + if (this.stateService.network === 'liquid') { + // @ts-ignore + this.assets.push({ + name: 'Liquid Bitcoin', + ticker: 'L-BTC', + asset_id: this.nativeAssetId, + }); + } else if (this.stateService.network === 'liquidtestnet') { + // @ts-ignore + this.assets.push({ + name: 'Test Liquid Bitcoin', + ticker: 'tL-BTC', + asset_id: this.nativeAssetId, + }); + } + this.assets = this.assets.sort((a: any, b: any) => a.name.localeCompare(b.name)); this.assetsCache = this.assets; this.searchForm.get('searchText').enable(); diff --git a/frontend/src/app/components/asset/asset.component.ts b/frontend/src/app/components/asset/asset.component.ts index e54a3727e..74b074d97 100644 --- a/frontend/src/app/components/asset/asset.component.ts +++ b/frontend/src/app/components/asset/asset.component.ts @@ -20,7 +20,7 @@ import { moveDec } from 'src/app/bitcoin.utils'; }) export class AssetComponent implements OnInit, OnDestroy { network = ''; - nativeAssetId = environment.nativeAssetId; + nativeAssetId = this.stateService.network === 'liquidtestnet' ? environment.nativeTestAssetId : environment.nativeAssetId; asset: Asset; blindedIssuance: boolean; diff --git a/frontend/src/app/components/transactions-list/transactions-list.component.ts b/frontend/src/app/components/transactions-list/transactions-list.component.ts index ac601ab1a..ecddf4436 100644 --- a/frontend/src/app/components/transactions-list/transactions-list.component.ts +++ b/frontend/src/app/components/transactions-list/transactions-list.component.ts @@ -15,7 +15,7 @@ import { map } from 'rxjs/operators'; }) export class TransactionsListComponent implements OnInit, OnChanges { network = ''; - nativeAssetId = environment.nativeAssetId; + nativeAssetId = this.stateService.network === 'liquidtestnet' ? environment.nativeTestAssetId : environment.nativeAssetId; displayDetails = false; @Input() transactions: Transaction[]; diff --git a/frontend/src/environments/environment.prod.ts b/frontend/src/environments/environment.prod.ts index 5c0708478..ed95312cb 100644 --- a/frontend/src/environments/environment.prod.ts +++ b/frontend/src/environments/environment.prod.ts @@ -1,4 +1,5 @@ export const environment = { production: true, nativeAssetId: '6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d', + nativeTestAssetId: '144c654344aa716d6f3abcc1ca90e5641e4e2a7f633bc09fe3baf64585819a49', }; diff --git a/frontend/src/environments/environment.ts b/frontend/src/environments/environment.ts index 3dec06541..c7224b679 100644 --- a/frontend/src/environments/environment.ts +++ b/frontend/src/environments/environment.ts @@ -5,6 +5,7 @@ export const environment = { production: false, nativeAssetId: '6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d', + nativeTestAssetId: '144c654344aa716d6f3abcc1ca90e5641e4e2a7f633bc09fe3baf64585819a49', }; /*