diff --git a/frontend/src/app/app.module.ts b/frontend/src/app/app.module.ts index 378ef11ed..6b7ec7f51 100644 --- a/frontend/src/app/app.module.ts +++ b/frontend/src/app/app.module.ts @@ -22,6 +22,7 @@ import { FiatCurrencyPipe } from './shared/pipes/fiat-currency.pipe'; import { ShortenStringPipe } from './shared/pipes/shorten-string-pipe/shorten-string.pipe'; import { CapAddressPipe } from './shared/pipes/cap-address-pipe/cap-address-pipe'; import { AppPreloadingStrategy } from './app.preloading-strategy'; +import { ServicesApiServices } from './services/services-api.service'; const providers = [ ElectrsApiService, @@ -40,6 +41,7 @@ const providers = [ FiatCurrencyPipe, CapAddressPipe, AppPreloadingStrategy, + ServicesApiServices, { provide: HTTP_INTERCEPTORS, useClass: HttpCacheInterceptor, multi: true } ]; diff --git a/frontend/src/app/components/about/about-sponsors.component.html b/frontend/src/app/components/about/about-sponsors.component.html index f76d74f8b..ae7232682 100644 --- a/frontend/src/app/components/about/about-sponsors.component.html +++ b/frontend/src/app/components/about/about-sponsors.component.html @@ -1,14 +1,14 @@

If you're an individual...

- Become a Community Sponsor + Become a Community Sponsor

If you're a business...

- Become an Enterprise Sponsor + Become an Enterprise Sponsor diff --git a/frontend/src/app/components/about/about-sponsors.component.ts b/frontend/src/app/components/about/about-sponsors.component.ts index 31863cd8f..6d8f4f7de 100644 --- a/frontend/src/app/components/about/about-sponsors.component.ts +++ b/frontend/src/app/components/about/about-sponsors.component.ts @@ -1,4 +1,4 @@ -import { Component } from '@angular/core'; +import { Component, Input } from '@angular/core'; import { EnterpriseService } from '../../services/enterprise.service'; @Component({ @@ -7,6 +7,8 @@ import { EnterpriseService } from '../../services/enterprise.service'; styleUrls: ['./about-sponsors.component.scss'], }) export class AboutSponsorsComponent { + @Input() host = 'https://mempool.space'; + constructor(private enterpriseService: EnterpriseService) { } diff --git a/frontend/src/app/components/accelerate-preview/accelerate-preview.component.ts b/frontend/src/app/components/accelerate-preview/accelerate-preview.component.ts index d8ebb3830..43ccce3b7 100644 --- a/frontend/src/app/components/accelerate-preview/accelerate-preview.component.ts +++ b/frontend/src/app/components/accelerate-preview/accelerate-preview.component.ts @@ -4,6 +4,7 @@ import { Subscription, catchError, of, tap } from 'rxjs'; import { StorageService } from '../../services/storage.service'; import { Transaction } from '../../interfaces/electrs.interface'; import { nextRoundNumber } from '../../shared/common.utils'; +import { ServicesApiServices } from '../../services/services-api.service'; import { AudioService } from '../../services/audio.service'; export type AccelerationEstimate = { @@ -62,7 +63,7 @@ export class AcceleratePreviewComponent implements OnInit, OnDestroy, OnChanges maxRateOptions: RateOption[] = []; constructor( - private apiService: ApiService, + private servicesApiService: ServicesApiServices, private storageService: StorageService, private audioService: AudioService, private cd: ChangeDetectorRef @@ -83,7 +84,7 @@ export class AcceleratePreviewComponent implements OnInit, OnDestroy, OnChanges ngOnInit() { this.user = this.storageService.getAuth()?.user ?? null; - this.estimateSubscription = this.apiService.estimate$(this.tx.txid).pipe( + this.estimateSubscription = this.servicesApiService.estimate$(this.tx.txid).pipe( tap((response) => { if (response.status === 204) { this.estimate = undefined; @@ -183,7 +184,7 @@ export class AcceleratePreviewComponent implements OnInit, OnDestroy, OnChanges if (this.accelerationSubscription) { this.accelerationSubscription.unsubscribe(); } - this.accelerationSubscription = this.apiService.accelerate$( + this.accelerationSubscription = this.servicesApiService.accelerate$( this.tx.txid, this.userBid ).subscribe({ @@ -213,4 +214,4 @@ export class AcceleratePreviewComponent implements OnInit, OnDestroy, OnChanges onResize(): void { this.isMobile = window.innerWidth <= 767.98; } -} \ No newline at end of file +} diff --git a/frontend/src/app/components/acceleration/acceleration-fees-graph/acceleration-fees-graph.component.ts b/frontend/src/app/components/acceleration/acceleration-fees-graph/acceleration-fees-graph.component.ts index c47232501..e786635ba 100644 --- a/frontend/src/app/components/acceleration/acceleration-fees-graph/acceleration-fees-graph.component.ts +++ b/frontend/src/app/components/acceleration/acceleration-fees-graph/acceleration-fees-graph.component.ts @@ -2,7 +2,6 @@ import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Inject, Input, L import { EChartsOption, graphic } from 'echarts'; import { Observable, Subscription, combineLatest, fromEvent } from 'rxjs'; import { map, max, startWith, switchMap, tap } from 'rxjs/operators'; -import { ApiService } from '../../../services/api.service'; import { SeoService } from '../../../services/seo.service'; import { formatNumber } from '@angular/common'; import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms'; @@ -11,6 +10,8 @@ import { StorageService } from '../../../services/storage.service'; import { MiningService } from '../../../services/mining.service'; import { ActivatedRoute } from '@angular/router'; import { Acceleration } from '../../../interfaces/node-api.interface'; +import { ServicesApiServices } from '../../../services/services-api.service'; +import { ApiService } from '../../../services/api.service'; @Component({ selector: 'app-acceleration-fees-graph', @@ -55,6 +56,7 @@ export class AccelerationFeesGraphComponent implements OnInit, OnDestroy { @Inject(LOCALE_ID) public locale: string, private seoService: SeoService, private apiService: ApiService, + private servicesApiService: ServicesApiServices, private formBuilder: UntypedFormBuilder, private storageService: StorageService, private miningService: MiningService, @@ -73,7 +75,7 @@ export class AccelerationFeesGraphComponent implements OnInit, OnDestroy { this.timespan = this.miningWindowPreference; this.statsObservable$ = combineLatest([ - (this.accelerations$ || this.apiService.getAccelerationHistory$({ timeframe: this.miningWindowPreference })), + (this.accelerations$ || this.servicesApiService.getAccelerationHistory$({ timeframe: this.miningWindowPreference })), this.apiService.getHistoricalBlockFees$(this.miningWindowPreference), fromEvent(window, 'resize').pipe(startWith(null)), ]).pipe( @@ -103,7 +105,7 @@ export class AccelerationFeesGraphComponent implements OnInit, OnDestroy { this.isLoading = true; this.storageService.setValue('miningWindowPreference', timespan); this.timespan = timespan; - return this.apiService.getAccelerationHistory$({}); + return this.servicesApiService.getAccelerationHistory$({}); }) ), this.radioGroupForm.get('dateSpan').valueChanges.pipe( diff --git a/frontend/src/app/components/acceleration/accelerations-list/accelerations-list.component.ts b/frontend/src/app/components/acceleration/accelerations-list/accelerations-list.component.ts index 69af8b966..c1ab011ea 100644 --- a/frontend/src/app/components/acceleration/accelerations-list/accelerations-list.component.ts +++ b/frontend/src/app/components/acceleration/accelerations-list/accelerations-list.component.ts @@ -1,9 +1,9 @@ import { Component, OnInit, ChangeDetectionStrategy, Input, ChangeDetectorRef } from '@angular/core'; import { Observable, catchError, of, switchMap, tap } from 'rxjs'; import { Acceleration, BlockExtended } from '../../../interfaces/node-api.interface'; -import { ApiService } from '../../../services/api.service'; import { StateService } from '../../../services/state.service'; import { WebsocketService } from '../../../services/websocket.service'; +import { ServicesApiServices } from '../../../services/services-api.service'; @Component({ selector: 'app-accelerations-list', @@ -26,7 +26,7 @@ export class AccelerationsListComponent implements OnInit { skeletonLines: number[] = []; constructor( - private apiService: ApiService, + private servicesApiService: ServicesApiServices, private websocketService: WebsocketService, public stateService: StateService, private cd: ChangeDetectorRef, @@ -41,7 +41,7 @@ export class AccelerationsListComponent implements OnInit { this.skeletonLines = this.widget === true ? [...Array(6).keys()] : [...Array(15).keys()]; this.paginationMaxSize = window.matchMedia('(max-width: 670px)').matches ? 3 : 5; - const accelerationObservable$ = this.accelerations$ || (this.pending ? this.apiService.getAccelerations$() : this.apiService.getAccelerationHistory$({ timeframe: '1m' })); + const accelerationObservable$ = this.accelerations$ || (this.pending ? this.servicesApiService.getAccelerations$() : this.servicesApiService.getAccelerationHistory$({ timeframe: '1m' })); this.accelerationList$ = accelerationObservable$.pipe( switchMap(accelerations => { if (this.pending) { diff --git a/frontend/src/app/components/acceleration/accelerator-dashboard/accelerator-dashboard.component.ts b/frontend/src/app/components/acceleration/accelerator-dashboard/accelerator-dashboard.component.ts index 07a513e7f..a2abc657a 100644 --- a/frontend/src/app/components/acceleration/accelerator-dashboard/accelerator-dashboard.component.ts +++ b/frontend/src/app/components/acceleration/accelerator-dashboard/accelerator-dashboard.component.ts @@ -3,12 +3,12 @@ import { SeoService } from '../../../services/seo.service'; import { WebsocketService } from '../../../services/websocket.service'; import { Acceleration, BlockExtended } from '../../../interfaces/node-api.interface'; import { StateService } from '../../../services/state.service'; -import { Observable, Subject, catchError, combineLatest, distinctUntilChanged, interval, map, of, share, startWith, switchMap, tap } from 'rxjs'; -import { ApiService } from '../../../services/api.service'; +import { Observable, catchError, combineLatest, distinctUntilChanged, interval, map, of, share, startWith, switchMap, tap } from 'rxjs'; import { Color } from '../../block-overview-graph/sprite-types'; import { hexToColor } from '../../block-overview-graph/utils'; import TxView from '../../block-overview-graph/tx-view'; import { feeLevels, mempoolFeeColors } from '../../../app.constants'; +import { ServicesApiServices } from '../../../services/services-api.service'; const acceleratedColor: Color = hexToColor('8F5FF6'); const normalColors = mempoolFeeColors.map(hex => hexToColor(hex + '5F')); @@ -35,7 +35,7 @@ export class AcceleratorDashboardComponent implements OnInit { constructor( private seoService: SeoService, private websocketService: WebsocketService, - private apiService: ApiService, + private serviceApiServices: ServicesApiServices, private stateService: StateService, ) { this.seoService.setTitle($localize`:@@a681a4e2011bb28157689dbaa387de0dd0aa0c11:Accelerator Dashboard`); @@ -48,7 +48,7 @@ export class AcceleratorDashboardComponent implements OnInit { this.pendingAccelerations$ = interval(30000).pipe( startWith(true), switchMap(() => { - return this.apiService.getAccelerations$().pipe( + return this.serviceApiServices.getAccelerations$().pipe( catchError(() => { return of([]); }), @@ -60,7 +60,7 @@ export class AcceleratorDashboardComponent implements OnInit { this.accelerations$ = this.stateService.chainTip$.pipe( distinctUntilChanged(), switchMap(() => { - return this.apiService.getAccelerationHistory$({ timeframe: '1m' }).pipe( + return this.serviceApiServices.getAccelerationHistory$({ timeframe: '1m' }).pipe( catchError(() => { return of([]); }), @@ -71,7 +71,7 @@ export class AcceleratorDashboardComponent implements OnInit { this.minedAccelerations$ = this.accelerations$.pipe( map(accelerations => { - return accelerations.filter(acc => ['mined', 'completed'].includes(acc.status)); + return accelerations.filter(acc => ['mined', 'completed', 'failed'].includes(acc.status)); }) ); diff --git a/frontend/src/app/components/acceleration/pending-stats/pending-stats.component.ts b/frontend/src/app/components/acceleration/pending-stats/pending-stats.component.ts index f344c37a0..ed7061156 100644 --- a/frontend/src/app/components/acceleration/pending-stats/pending-stats.component.ts +++ b/frontend/src/app/components/acceleration/pending-stats/pending-stats.component.ts @@ -1,8 +1,8 @@ import { ChangeDetectionStrategy, Component, Input, OnInit } from '@angular/core'; import { Observable, of } from 'rxjs'; import { switchMap } from 'rxjs/operators'; -import { ApiService } from '../../../services/api.service'; import { Acceleration } from '../../../interfaces/node-api.interface'; +import { ServicesApiServices } from '../../../services/services-api.service'; @Component({ selector: 'app-pending-stats', @@ -15,11 +15,11 @@ export class PendingStatsComponent implements OnInit { public accelerationStats$: Observable; constructor( - private apiService: ApiService, + private servicesApiService: ServicesApiServices, ) { } ngOnInit(): void { - this.accelerationStats$ = (this.accelerations$ || this.apiService.getAccelerations$()).pipe( + this.accelerationStats$ = (this.accelerations$ || this.servicesApiService.getAccelerations$()).pipe( switchMap(accelerations => { let totalAccelerations = 0; let totalFeeDelta = 0; diff --git a/frontend/src/app/components/block/block-preview.component.ts b/frontend/src/app/components/block/block-preview.component.ts index e634ae11f..3e1d9b409 100644 --- a/frontend/src/app/components/block/block-preview.component.ts +++ b/frontend/src/app/components/block/block-preview.component.ts @@ -10,6 +10,7 @@ import { BlockExtended, TransactionStripped } from '../../interfaces/node-api.in import { ApiService } from '../../services/api.service'; import { seoDescriptionNetwork } from '../../shared/common.utils'; import { BlockOverviewGraphComponent } from '../../components/block-overview-graph/block-overview-graph.component'; +import { ServicesApiServices } from '../../services/services-api.service'; @Component({ selector: 'app-block-preview', @@ -42,7 +43,8 @@ export class BlockPreviewComponent implements OnInit, OnDestroy { public stateService: StateService, private seoService: SeoService, private openGraphService: OpenGraphService, - private apiService: ApiService + private apiService: ApiService, + private servicesApiService: ServicesApiServices, ) { } ngOnInit() { @@ -134,7 +136,7 @@ export class BlockPreviewComponent implements OnInit, OnDestroy { return of(transactions); }) ), - this.stateService.env.ACCELERATOR === true && block.height > 819500 ? this.apiService.getAccelerationHistory$({ blockHash: block.id }) : of([]) + this.stateService.env.ACCELERATOR === true && block.height > 819500 ? this.servicesApiService.getAccelerationHistory$({ blockHash: block.id }) : of([]) ]); } ), diff --git a/frontend/src/app/components/block/block.component.ts b/frontend/src/app/components/block/block.component.ts index 6a995127b..5bba24852 100644 --- a/frontend/src/app/components/block/block.component.ts +++ b/frontend/src/app/components/block/block.component.ts @@ -16,6 +16,7 @@ import { detectWebGL } from '../../shared/graphs.utils'; import { seoDescriptionNetwork } from '../../shared/common.utils'; import { PriceService, Price } from '../../services/price.service'; import { CacheService } from '../../services/cache.service'; +import { ServicesApiServices } from '../../services/services-api.service'; @Component({ selector: 'app-block', @@ -103,6 +104,7 @@ export class BlockComponent implements OnInit, OnDestroy { private apiService: ApiService, private priceService: PriceService, private cacheService: CacheService, + private servicesApiService: ServicesApiServices, ) { this.webGlEnabled = detectWebGL(); } @@ -329,7 +331,7 @@ export class BlockComponent implements OnInit, OnDestroy { return of(null); }) ), - this.stateService.env.ACCELERATOR === true && block.height > 819500 ? this.apiService.getAccelerationHistory$({ blockHash: block.id }) : of([]) + this.stateService.env.ACCELERATOR === true && block.height > 819500 ? this.servicesApiService.getAccelerationHistory$({ blockHash: block.id }) : of([]) ]); }) ) diff --git a/frontend/src/app/components/menu/menu.component.html b/frontend/src/app/components/menu/menu.component.html index 1cc7bdd03..c72016ef5 100644 --- a/frontend/src/app/components/menu/menu.component.html +++ b/frontend/src/app/components/menu/menu.component.html @@ -2,8 +2,19 @@