From 2ee656a176107dced72968291d5fda743a3be785 Mon Sep 17 00:00:00 2001 From: softsimon Date: Sun, 16 Jun 2024 10:50:31 +0200 Subject: [PATCH] Renaming default to root network --- frontend/mempool-frontend-config.sample.json | 2 +- frontend/src/app/lightning/lightning-api.service.ts | 2 +- frontend/src/app/services/api.service.ts | 2 +- frontend/src/app/services/electrs-api.service.ts | 2 +- frontend/src/app/services/navigation.service.ts | 6 +++--- frontend/src/app/services/state.service.ts | 10 +++++----- frontend/src/app/services/websocket.service.ts | 4 ++-- .../app/shared/pipes/relative-url/relative-url.pipe.ts | 2 +- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/frontend/mempool-frontend-config.sample.json b/frontend/mempool-frontend-config.sample.json index 43c24b7e5..cafedd63f 100644 --- a/frontend/mempool-frontend-config.sample.json +++ b/frontend/mempool-frontend-config.sample.json @@ -13,7 +13,7 @@ "BLOCK_WEIGHT_UNITS": 4000000, "MEMPOOL_BLOCKS_AMOUNT": 8, "BASE_MODULE": "mempool", - "DEFAULT_NETWORK": "", + "ROOT_NETWORK": "", "MEMPOOL_WEBSITE_URL": "https://mempool.space", "LIQUID_WEBSITE_URL": "https://liquid.network", "MINING_DASHBOARD": true, diff --git a/frontend/src/app/lightning/lightning-api.service.ts b/frontend/src/app/lightning/lightning-api.service.ts index 200a24c58..74f048d68 100644 --- a/frontend/src/app/lightning/lightning-api.service.ts +++ b/frontend/src/app/lightning/lightning-api.service.ts @@ -23,7 +23,7 @@ export class LightningApiService { } this.apiBasePath = ''; // assume mainnet by default this.stateService.networkChanged$.subscribe((network) => { - this.apiBasePath = network && network !== this.stateService.env.DEFAULT_NETWORK ? '/' + network : ''; + this.apiBasePath = network && network !== this.stateService.env.ROOT_NETWORK ? '/' + network : ''; }); } diff --git a/frontend/src/app/services/api.service.ts b/frontend/src/app/services/api.service.ts index e763ae246..6b0d60ccf 100644 --- a/frontend/src/app/services/api.service.ts +++ b/frontend/src/app/services/api.service.ts @@ -29,7 +29,7 @@ export class ApiService { } this.apiBasePath = ''; // assume mainnet by default this.stateService.networkChanged$.subscribe((network) => { - this.apiBasePath = network && network !== this.stateService.env.DEFAULT_NETWORK ? '/' + network : ''; + this.apiBasePath = network && network !== this.stateService.env.ROOT_NETWORK ? '/' + network : ''; }); } diff --git a/frontend/src/app/services/electrs-api.service.ts b/frontend/src/app/services/electrs-api.service.ts index 974efea52..7faaea87c 100644 --- a/frontend/src/app/services/electrs-api.service.ts +++ b/frontend/src/app/services/electrs-api.service.ts @@ -25,7 +25,7 @@ export class ElectrsApiService { } this.apiBasePath = ''; // assume mainnet by default this.stateService.networkChanged$.subscribe((network) => { - this.apiBasePath = network && network !== this.stateService.env.DEFAULT_NETWORK ? '/' + network : ''; + this.apiBasePath = network && network !== this.stateService.env.ROOT_NETWORK ? '/' + network : ''; }); } diff --git a/frontend/src/app/services/navigation.service.ts b/frontend/src/app/services/navigation.service.ts index 5dd5dfded..aed114c75 100644 --- a/frontend/src/app/services/navigation.service.ts +++ b/frontend/src/app/services/navigation.service.ts @@ -13,9 +13,9 @@ export class NavigationService { bitcoin: { subnets: [ { name: 'mainnet', path: '' }, - { name: 'testnet', path: this.stateService.env.DEFAULT_NETWORK === 'testnet' ? '/' : '/testnet' }, - { name: 'testnet4', path: this.stateService.env.DEFAULT_NETWORK === 'testnet4' ? '/' : '/testnet4' }, - { name: 'signet', path: this.stateService.env.DEFAULT_NETWORK === 'signet' ? '/' : '/signet' }, + { name: 'testnet', path: this.stateService.env.ROOT_NETWORK === 'testnet' ? '/' : '/testnet' }, + { name: 'testnet4', path: this.stateService.env.ROOT_NETWORK === 'testnet4' ? '/' : '/testnet4' }, + { name: 'signet', path: this.stateService.env.ROOT_NETWORK === 'signet' ? '/' : '/signet' }, ], }, liquid: { diff --git a/frontend/src/app/services/state.service.ts b/frontend/src/app/services/state.service.ts index 1e60030f4..d339e688a 100644 --- a/frontend/src/app/services/state.service.ts +++ b/frontend/src/app/services/state.service.ts @@ -53,7 +53,7 @@ export interface Env { KEEP_BLOCKS_AMOUNT: number; OFFICIAL_MEMPOOL_SPACE: boolean; BASE_MODULE: string; - DEFAULT_NETWORK: string; + ROOT_NETWORK: string; NGINX_PROTOCOL?: string; NGINX_HOSTNAME?: string; NGINX_PORT?: string; @@ -86,7 +86,7 @@ const defaultEnv: Env = { 'LIQUID_ENABLED': false, 'LIQUID_TESTNET_ENABLED': false, 'BASE_MODULE': 'mempool', - 'DEFAULT_NETWORK': '', + 'ROOT_NETWORK': '', 'ITEMS_PER_PAGE': 10, 'KEEP_BLOCKS_AMOUNT': 8, 'OFFICIAL_MEMPOOL_SPACE': false, @@ -206,7 +206,7 @@ export class StateService { this.env.MINING_DASHBOARD = false; } - this.network = this.env.DEFAULT_NETWORK; + this.network = this.env.ROOT_NETWORK; if (this.isBrowser) { this.setNetworkBasedonUrl(window.location.pathname); @@ -363,8 +363,8 @@ export class StateService { this.networkChanged$.next(this.env.BASE_MODULE); } } else if (this.network !== '') { - this.network = this.env.DEFAULT_NETWORK; - this.networkChanged$.next(this.env.DEFAULT_NETWORK); + this.network = this.env.ROOT_NETWORK; + this.networkChanged$.next(this.env.ROOT_NETWORK); } } } diff --git a/frontend/src/app/services/websocket.service.ts b/frontend/src/app/services/websocket.service.ts index 6d5507632..22aef76e7 100644 --- a/frontend/src/app/services/websocket.service.ts +++ b/frontend/src/app/services/websocket.service.ts @@ -55,7 +55,7 @@ export class WebsocketService { .pipe(take(1)) .subscribe((response) => this.handleResponse(response)); } else { - this.network = this.stateService.network === this.stateService.env.DEFAULT_NETWORK ? '' : this.stateService.network; + this.network = this.stateService.network === this.stateService.env.ROOT_NETWORK ? '' : this.stateService.network; this.websocketSubject = webSocket(this.webSocketUrl.replace('{network}', this.network ? '/' + this.network : '')); const { response: theInitData } = this.transferState.get(initData, null) || {}; @@ -75,7 +75,7 @@ export class WebsocketService { if (network === this.network) { return; } - this.network = network === this.stateService.env.DEFAULT_NETWORK ? '' : network; + this.network = network === this.stateService.env.ROOT_NETWORK ? '' : network; clearTimeout(this.onlineCheckTimeout); clearTimeout(this.onlineCheckTimeoutTwo); diff --git a/frontend/src/app/shared/pipes/relative-url/relative-url.pipe.ts b/frontend/src/app/shared/pipes/relative-url/relative-url.pipe.ts index 52723b0a0..8eab3eb0b 100644 --- a/frontend/src/app/shared/pipes/relative-url/relative-url.pipe.ts +++ b/frontend/src/app/shared/pipes/relative-url/relative-url.pipe.ts @@ -12,7 +12,7 @@ export class RelativeUrlPipe implements PipeTransform { transform(value: string, swapNetwork?: string): string { let network = swapNetwork || this.stateService.network; - if (network === 'mainnet' || network === this.stateService.env.DEFAULT_NETWORK) { + if (network === 'mainnet' || network === this.stateService.env.ROOT_NETWORK) { network = ''; } if (this.stateService.env.BASE_MODULE === 'liquid' && network === 'liquidtestnet') {