New config that lets frontend connect to a separate Bisq mempool backend.
This commit is contained in:
parent
0ded140c72
commit
24e40b25fd
@ -2,6 +2,7 @@
|
|||||||
"TESTNET_ENABLED": false,
|
"TESTNET_ENABLED": false,
|
||||||
"LIQUID_ENABLED": false,
|
"LIQUID_ENABLED": false,
|
||||||
"BISQ_ENABLED": false,
|
"BISQ_ENABLED": false,
|
||||||
|
"BISQ_SEPARATE_BACKEND": false,
|
||||||
"ELCTRS_ITEMS_PER_PAGE": 25,
|
"ELCTRS_ITEMS_PER_PAGE": 25,
|
||||||
"KEEP_BLOCKS_AMOUNT": 8
|
"KEEP_BLOCKS_AMOUNT": 8
|
||||||
}
|
}
|
@ -38,6 +38,7 @@ interface Env {
|
|||||||
TESTNET_ENABLED: boolean;
|
TESTNET_ENABLED: boolean;
|
||||||
LIQUID_ENABLED: boolean;
|
LIQUID_ENABLED: boolean;
|
||||||
BISQ_ENABLED: boolean;
|
BISQ_ENABLED: boolean;
|
||||||
|
BISQ_SEPARATE_BACKEND: boolean;
|
||||||
ELCTRS_ITEMS_PER_PAGE: number;
|
ELCTRS_ITEMS_PER_PAGE: number;
|
||||||
KEEP_BLOCKS_AMOUNT: number;
|
KEEP_BLOCKS_AMOUNT: number;
|
||||||
}
|
}
|
||||||
@ -46,6 +47,7 @@ const defaultEnv: Env = {
|
|||||||
'TESTNET_ENABLED': false,
|
'TESTNET_ENABLED': false,
|
||||||
'LIQUID_ENABLED': false,
|
'LIQUID_ENABLED': false,
|
||||||
'BISQ_ENABLED': false,
|
'BISQ_ENABLED': false,
|
||||||
|
'BISQ_SEPARATE_BACKEND': false,
|
||||||
'ELCTRS_ITEMS_PER_PAGE': 25,
|
'ELCTRS_ITEMS_PER_PAGE': 25,
|
||||||
'KEEP_BLOCKS_AMOUNT': 8
|
'KEEP_BLOCKS_AMOUNT': 8
|
||||||
};
|
};
|
||||||
|
@ -3,6 +3,7 @@ import { HttpClient, HttpParams, HttpResponse } from '@angular/common/http';
|
|||||||
import { OptimizedMempoolStats } from '../interfaces/node-api.interface';
|
import { OptimizedMempoolStats } from '../interfaces/node-api.interface';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { StateService } from './state.service';
|
import { StateService } from './state.service';
|
||||||
|
import { env } from '../app.constants';
|
||||||
|
|
||||||
const API_BASE_URL = '{network}/api/v1';
|
const API_BASE_URL = '{network}/api/v1';
|
||||||
|
|
||||||
@ -18,7 +19,7 @@ export class ApiService {
|
|||||||
) {
|
) {
|
||||||
this.apiBaseUrl = API_BASE_URL.replace('{network}', '');
|
this.apiBaseUrl = API_BASE_URL.replace('{network}', '');
|
||||||
this.stateService.networkChanged$.subscribe((network) => {
|
this.stateService.networkChanged$.subscribe((network) => {
|
||||||
if (network === 'bisq') {
|
if (network === 'bisq' && !env.BISQ_SEPARATE_BACKEND) {
|
||||||
network = '';
|
network = '';
|
||||||
}
|
}
|
||||||
this.apiBaseUrl = API_BASE_URL.replace('{network}', network ? '/' + network : '');
|
this.apiBaseUrl = API_BASE_URL.replace('{network}', network ? '/' + network : '');
|
||||||
|
@ -3,6 +3,7 @@ import { HttpClient } from '@angular/common/http';
|
|||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { Block, Transaction, Address, Outspend, Recent, Asset } from '../interfaces/electrs.interface';
|
import { Block, Transaction, Address, Outspend, Recent, Asset } from '../interfaces/electrs.interface';
|
||||||
import { StateService } from './state.service';
|
import { StateService } from './state.service';
|
||||||
|
import { env } from '../app.constants';
|
||||||
|
|
||||||
const API_BASE_URL = '{network}/api';
|
const API_BASE_URL = '{network}/api';
|
||||||
|
|
||||||
@ -18,7 +19,7 @@ export class ElectrsApiService {
|
|||||||
) {
|
) {
|
||||||
this.apiBaseUrl = API_BASE_URL.replace('{network}', '');
|
this.apiBaseUrl = API_BASE_URL.replace('{network}', '');
|
||||||
this.stateService.networkChanged$.subscribe((network) => {
|
this.stateService.networkChanged$.subscribe((network) => {
|
||||||
if (network === 'bisq') {
|
if (network === 'bisq' && !env.BISQ_SEPARATE_BACKEND) {
|
||||||
network = '';
|
network = '';
|
||||||
}
|
}
|
||||||
this.apiBaseUrl = API_BASE_URL.replace('{network}', network ? '/' + network : '');
|
this.apiBaseUrl = API_BASE_URL.replace('{network}', network ? '/' + network : '');
|
||||||
|
@ -4,6 +4,7 @@ import { WebsocketResponse } from '../interfaces/websocket.interface';
|
|||||||
import { StateService } from './state.service';
|
import { StateService } from './state.service';
|
||||||
import { Block, Transaction } from '../interfaces/electrs.interface';
|
import { Block, Transaction } from '../interfaces/electrs.interface';
|
||||||
import { Subscription } from 'rxjs';
|
import { Subscription } from 'rxjs';
|
||||||
|
import { env } from '../app.constants';
|
||||||
|
|
||||||
const WEB_SOCKET_PROTOCOL = (document.location.protocol === 'https:') ? 'wss:' : 'ws:';
|
const WEB_SOCKET_PROTOCOL = (document.location.protocol === 'https:') ? 'wss:' : 'ws:';
|
||||||
const WEB_SOCKET_URL = WEB_SOCKET_PROTOCOL + '//' + document.location.hostname + ':' + document.location.port + '{network}/api/v1/ws';
|
const WEB_SOCKET_URL = WEB_SOCKET_PROTOCOL + '//' + document.location.hostname + ':' + document.location.port + '{network}/api/v1/ws';
|
||||||
@ -29,12 +30,12 @@ export class WebsocketService {
|
|||||||
constructor(
|
constructor(
|
||||||
private stateService: StateService,
|
private stateService: StateService,
|
||||||
) {
|
) {
|
||||||
this.network = this.stateService.network === 'bisq' ? '' : this.stateService.network;
|
this.network = this.stateService.network === 'bisq' && !env.BISQ_SEPARATE_BACKEND ? '' : this.stateService.network;
|
||||||
this.websocketSubject = webSocket<WebsocketResponse>(WEB_SOCKET_URL.replace('{network}', this.network ? '/' + this.network : ''));
|
this.websocketSubject = webSocket<WebsocketResponse>(WEB_SOCKET_URL.replace('{network}', this.network ? '/' + this.network : ''));
|
||||||
this.startSubscription();
|
this.startSubscription();
|
||||||
|
|
||||||
this.stateService.networkChanged$.subscribe((network) => {
|
this.stateService.networkChanged$.subscribe((network) => {
|
||||||
if (network === 'bisq') {
|
if (network === 'bisq' && !env.BISQ_SEPARATE_BACKEND) {
|
||||||
network = '';
|
network = '';
|
||||||
}
|
}
|
||||||
if (network === this.network) {
|
if (network === this.network) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user