Add config for public acceleration data

This commit is contained in:
Mononaut 2024-04-02 08:19:35 +00:00
parent 68a7a89fd6
commit 37aee77eb4
No known key found for this signature in database
GPG key ID: A3F058E41374C04E
5 changed files with 9 additions and 2 deletions

View file

@ -37,6 +37,7 @@ __MAINNET_BLOCK_AUDIT_START_HEIGHT__=${MAINNET_BLOCK_AUDIT_START_HEIGHT:=0}
__TESTNET_BLOCK_AUDIT_START_HEIGHT__=${TESTNET_BLOCK_AUDIT_START_HEIGHT:=0} __TESTNET_BLOCK_AUDIT_START_HEIGHT__=${TESTNET_BLOCK_AUDIT_START_HEIGHT:=0}
__SIGNET_BLOCK_AUDIT_START_HEIGHT__=${SIGNET_BLOCK_AUDIT_START_HEIGHT:=0} __SIGNET_BLOCK_AUDIT_START_HEIGHT__=${SIGNET_BLOCK_AUDIT_START_HEIGHT:=0}
__ACCELERATOR__=${ACCELERATOR:=false} __ACCELERATOR__=${ACCELERATOR:=false}
__PUBLIC_ACCELERATIONS__=${PUBLIC_ACCELERATIONS:=false}
__HISTORICAL_PRICE__=${HISTORICAL_PRICE:=true} __HISTORICAL_PRICE__=${HISTORICAL_PRICE:=true}
__ADDITIONAL_CURRENCIES__=${ADDITIONAL_CURRENCIES:=false} __ADDITIONAL_CURRENCIES__=${ADDITIONAL_CURRENCIES:=false}
@ -62,6 +63,7 @@ export __MAINNET_BLOCK_AUDIT_START_HEIGHT__
export __TESTNET_BLOCK_AUDIT_START_HEIGHT__ export __TESTNET_BLOCK_AUDIT_START_HEIGHT__
export __SIGNET_BLOCK_AUDIT_START_HEIGHT__ export __SIGNET_BLOCK_AUDIT_START_HEIGHT__
export __ACCELERATOR__ export __ACCELERATOR__
export __PUBLIC_ACCELERATIONS__
export __HISTORICAL_PRICE__ export __HISTORICAL_PRICE__
export __ADDITIONAL_CURRENCIES__ export __ADDITIONAL_CURRENCIES__

View file

@ -21,5 +21,6 @@
"LIGHTNING": false, "LIGHTNING": false,
"HISTORICAL_PRICE": true, "HISTORICAL_PRICE": true,
"ADDITIONAL_CURRENCIES": false, "ADDITIONAL_CURRENCIES": false,
"ACCELERATOR": false "ACCELERATOR": false,
"PUBLIC_ACCELERATIONS": false
} }

View file

@ -2,7 +2,7 @@ import { Component, OnInit, OnDestroy, ViewChildren, QueryList, Inject, PLATFORM
import { Location } from '@angular/common'; import { Location } from '@angular/common';
import { ActivatedRoute, ParamMap, Router } from '@angular/router'; import { ActivatedRoute, ParamMap, Router } from '@angular/router';
import { ElectrsApiService } from '../../services/electrs-api.service'; import { ElectrsApiService } from '../../services/electrs-api.service';
import { switchMap, tap, throttleTime, catchError, map, shareReplay, startWith } from 'rxjs/operators'; import { switchMap, tap, throttleTime, catchError, map, shareReplay, startWith, filter } from 'rxjs/operators';
import { Transaction, Vout } from '../../interfaces/electrs.interface'; import { Transaction, Vout } from '../../interfaces/electrs.interface';
import { Observable, of, Subscription, asyncScheduler, EMPTY, combineLatest, forkJoin } from 'rxjs'; import { Observable, of, Subscription, asyncScheduler, EMPTY, combineLatest, forkJoin } from 'rxjs';
import { StateService } from '../../services/state.service'; import { StateService } from '../../services/state.service';
@ -484,6 +484,7 @@ export class BlockComponent implements OnInit, OnDestroy {
}); });
this.oobSubscription = block$.pipe( this.oobSubscription = block$.pipe(
filter(() => this.stateService.env.PUBLIC_ACCELERATIONS === true),
switchMap((block) => this.apiService.getAccelerationsByHeight$(block.height) switchMap((block) => this.apiService.getAccelerationsByHeight$(block.height)
.pipe( .pipe(
map(accelerations => { map(accelerations => {

View file

@ -121,6 +121,7 @@ export class PoolComponent implements OnInit {
); );
this.oobFees$ = this.route.params.pipe(map((params) => params.slug)).pipe( this.oobFees$ = this.route.params.pipe(map((params) => params.slug)).pipe(
filter(() => this.stateService.env.PUBLIC_ACCELERATIONS === true),
switchMap(slug => { switchMap(slug => {
return combineLatest([ return combineLatest([
this.apiService.getAccelerationTotals$(this.slug, '1w'), this.apiService.getAccelerationTotals$(this.slug, '1w'),

View file

@ -46,6 +46,7 @@ export interface Env {
SIGNET_BLOCK_AUDIT_START_HEIGHT: number; SIGNET_BLOCK_AUDIT_START_HEIGHT: number;
HISTORICAL_PRICE: boolean; HISTORICAL_PRICE: boolean;
ACCELERATOR: boolean; ACCELERATOR: boolean;
PUBLIC_ACCELERATIONS: boolean;
ADDITIONAL_CURRENCIES: boolean; ADDITIONAL_CURRENCIES: boolean;
GIT_COMMIT_HASH_MEMPOOL_SPACE?: string; GIT_COMMIT_HASH_MEMPOOL_SPACE?: string;
PACKAGE_JSON_VERSION_MEMPOOL_SPACE?: string; PACKAGE_JSON_VERSION_MEMPOOL_SPACE?: string;
@ -77,6 +78,7 @@ const defaultEnv: Env = {
'SIGNET_BLOCK_AUDIT_START_HEIGHT': 0, 'SIGNET_BLOCK_AUDIT_START_HEIGHT': 0,
'HISTORICAL_PRICE': true, 'HISTORICAL_PRICE': true,
'ACCELERATOR': false, 'ACCELERATOR': false,
'PUBLIC_ACCELERATIONS': false,
'ADDITIONAL_CURRENCIES': false, 'ADDITIONAL_CURRENCIES': false,
}; };