Support for Test Liquid Native Asset
This commit is contained in:
parent
fd34761a93
commit
504f46cad9
@ -1,7 +1,9 @@
|
|||||||
import { CpfpInfo, TransactionExtended, TransactionStripped } from '../mempool.interfaces';
|
import { CpfpInfo, TransactionExtended, TransactionStripped } from '../mempool.interfaces';
|
||||||
import config from '../config';
|
import config from '../config';
|
||||||
export class Common {
|
export class Common {
|
||||||
static nativeAssetId = '6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d';
|
static nativeAssetId = config.MEMPOOL.NETWORK === 'liquidtestnet' ?
|
||||||
|
'144c654344aa716d6f3abcc1ca90e5641e4e2a7f633bc09fe3baf64585819a49'
|
||||||
|
: '6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d';
|
||||||
|
|
||||||
static median(numbers: number[]) {
|
static median(numbers: number[]) {
|
||||||
let medianNr = 0;
|
let medianNr = 0;
|
||||||
|
@ -2,7 +2,7 @@ const configFile = require('../mempool-config.json');
|
|||||||
|
|
||||||
interface IConfig {
|
interface IConfig {
|
||||||
MEMPOOL: {
|
MEMPOOL: {
|
||||||
NETWORK: 'mainnet' | 'testnet' | 'signet' | 'liquid';
|
NETWORK: 'mainnet' | 'testnet' | 'signet' | 'liquid' | 'liquidtestnet';
|
||||||
BACKEND: 'esplora' | 'electrum' | 'none';
|
BACKEND: 'esplora' | 'electrum' | 'none';
|
||||||
HTTP_PORT: number;
|
HTTP_PORT: number;
|
||||||
SPAWN_CLUSTER_PROCS: number;
|
SPAWN_CLUSTER_PROCS: number;
|
||||||
|
@ -7,6 +7,7 @@ import { ActivatedRoute, Router } from '@angular/router';
|
|||||||
import { merge, combineLatest, Observable } from 'rxjs';
|
import { merge, combineLatest, Observable } from 'rxjs';
|
||||||
import { AssetExtended } from '../interfaces/electrs.interface';
|
import { AssetExtended } from '../interfaces/electrs.interface';
|
||||||
import { SeoService } from '../services/seo.service';
|
import { SeoService } from '../services/seo.service';
|
||||||
|
import { StateService } from '../services/state.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-assets',
|
selector: 'app-assets',
|
||||||
@ -15,7 +16,8 @@ import { SeoService } from '../services/seo.service';
|
|||||||
changeDetection: ChangeDetectionStrategy.OnPush
|
changeDetection: ChangeDetectionStrategy.OnPush
|
||||||
})
|
})
|
||||||
export class AssetsComponent implements OnInit {
|
export class AssetsComponent implements OnInit {
|
||||||
nativeAssetId = environment.nativeAssetId;
|
nativeAssetId = this.stateService.network === 'liquidtestnet' ? environment.nativeTestAssetId : environment.nativeAssetId;
|
||||||
|
|
||||||
assets: AssetExtended[];
|
assets: AssetExtended[];
|
||||||
assetsCache: AssetExtended[];
|
assetsCache: AssetExtended[];
|
||||||
searchForm: FormGroup;
|
searchForm: FormGroup;
|
||||||
@ -34,6 +36,7 @@ export class AssetsComponent implements OnInit {
|
|||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private seoService: SeoService,
|
private seoService: SeoService,
|
||||||
|
private stateService: StateService,
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
@ -52,12 +55,22 @@ export class AssetsComponent implements OnInit {
|
|||||||
take(1),
|
take(1),
|
||||||
mergeMap(([assets, qp]) => {
|
mergeMap(([assets, qp]) => {
|
||||||
this.assets = Object.values(assets);
|
this.assets = Object.values(assets);
|
||||||
// @ts-ignore
|
if (this.stateService.network === 'liquid') {
|
||||||
this.assets.push({
|
// @ts-ignore
|
||||||
name: 'Liquid Bitcoin',
|
this.assets.push({
|
||||||
ticker: 'L-BTC',
|
name: 'Liquid Bitcoin',
|
||||||
asset_id: this.nativeAssetId,
|
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.assets = this.assets.sort((a: any, b: any) => a.name.localeCompare(b.name));
|
||||||
this.assetsCache = this.assets;
|
this.assetsCache = this.assets;
|
||||||
this.searchForm.get('searchText').enable();
|
this.searchForm.get('searchText').enable();
|
||||||
|
@ -20,7 +20,7 @@ import { moveDec } from 'src/app/bitcoin.utils';
|
|||||||
})
|
})
|
||||||
export class AssetComponent implements OnInit, OnDestroy {
|
export class AssetComponent implements OnInit, OnDestroy {
|
||||||
network = '';
|
network = '';
|
||||||
nativeAssetId = environment.nativeAssetId;
|
nativeAssetId = this.stateService.network === 'liquidtestnet' ? environment.nativeTestAssetId : environment.nativeAssetId;
|
||||||
|
|
||||||
asset: Asset;
|
asset: Asset;
|
||||||
blindedIssuance: boolean;
|
blindedIssuance: boolean;
|
||||||
|
@ -15,7 +15,7 @@ import { map } from 'rxjs/operators';
|
|||||||
})
|
})
|
||||||
export class TransactionsListComponent implements OnInit, OnChanges {
|
export class TransactionsListComponent implements OnInit, OnChanges {
|
||||||
network = '';
|
network = '';
|
||||||
nativeAssetId = environment.nativeAssetId;
|
nativeAssetId = this.stateService.network === 'liquidtestnet' ? environment.nativeTestAssetId : environment.nativeAssetId;
|
||||||
displayDetails = false;
|
displayDetails = false;
|
||||||
|
|
||||||
@Input() transactions: Transaction[];
|
@Input() transactions: Transaction[];
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
export const environment = {
|
export const environment = {
|
||||||
production: true,
|
production: true,
|
||||||
nativeAssetId: '6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d',
|
nativeAssetId: '6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d',
|
||||||
|
nativeTestAssetId: '144c654344aa716d6f3abcc1ca90e5641e4e2a7f633bc09fe3baf64585819a49',
|
||||||
};
|
};
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
export const environment = {
|
export const environment = {
|
||||||
production: false,
|
production: false,
|
||||||
nativeAssetId: '6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d',
|
nativeAssetId: '6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d',
|
||||||
|
nativeTestAssetId: '144c654344aa716d6f3abcc1ca90e5641e4e2a7f633bc09fe3baf64585819a49',
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user