custom dashboard wallet widgets
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient, HttpParams, HttpResponse } from '@angular/common/http';
|
||||
import { CpfpInfo, OptimizedMempoolStats, AddressInformation, LiquidPegs, ITranslators, PoolStat, BlockExtended, TransactionStripped, RewardStats, AuditScore, BlockSizesAndWeights,
|
||||
RbfTree, BlockAudit, CurrentPegs, AuditStatus, FederationAddress, FederationUtxo, RecentPeg, PegsVolume, AccelerationInfo, TestMempoolAcceptResult,
|
||||
SubmitPackageResult} from '../interfaces/node-api.interface';
|
||||
RbfTree, BlockAudit, CurrentPegs, AuditStatus, FederationAddress, FederationUtxo, RecentPeg, PegsVolume, AccelerationInfo, TestMempoolAcceptResult, WalletAddress, SubmitPackageResult } from '../interfaces/node-api.interface';
|
||||
import { BehaviorSubject, Observable, catchError, filter, map, of, shareReplay, take, tap } from 'rxjs';
|
||||
import { StateService } from './state.service';
|
||||
import { Transaction } from '../interfaces/electrs.interface';
|
||||
@@ -518,6 +517,12 @@ export class ApiService {
|
||||
);
|
||||
}
|
||||
|
||||
getWallet$(walletName: string): Observable<Record<string, WalletAddress>> {
|
||||
return this.httpClient.get<Record<string, WalletAddress>>(
|
||||
this.apiBaseUrl + this.apiBasePath + `/api/v1/wallet/${walletName}`
|
||||
);
|
||||
}
|
||||
|
||||
getAccelerationsByPool$(slug: string): Observable<AccelerationInfo[]> {
|
||||
return this.httpClient.get<AccelerationInfo[]>(
|
||||
this.apiBaseUrl + this.apiBasePath + `/api/v1/accelerations/pool/${slug}`
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Inject, Injectable, PLATFORM_ID, LOCALE_ID } from '@angular/core';
|
||||
import { ReplaySubject, BehaviorSubject, Subject, fromEvent, Observable } from 'rxjs';
|
||||
import { Transaction } from '../interfaces/electrs.interface';
|
||||
import { AddressTxSummary, Transaction } from '../interfaces/electrs.interface';
|
||||
import { AccelerationDelta, HealthCheckHost, IBackendInfo, MempoolBlock, MempoolBlockUpdate, MempoolInfo, Recommendedfees, ReplacedTransaction, ReplacementInfo, isMempoolState } from '../interfaces/websocket.interface';
|
||||
import { Acceleration, AccelerationPosition, BlockExtended, CpfpInfo, DifficultyAdjustment, MempoolPosition, OptimizedMempoolStats, RbfTree, TransactionStripped } from '../interfaces/node-api.interface';
|
||||
import { Router, NavigationStart } from '@angular/router';
|
||||
@@ -159,6 +159,7 @@ export class StateService {
|
||||
mempoolRemovedTransactions$ = new Subject<Transaction>();
|
||||
multiAddressTransactions$ = new Subject<{ [address: string]: { mempool: Transaction[], confirmed: Transaction[], removed: Transaction[] }}>();
|
||||
blockTransactions$ = new Subject<Transaction>();
|
||||
walletTransactions$ = new Subject<Record<string, AddressTxSummary[]>>();
|
||||
isLoadingWebSocket$ = new ReplaySubject<boolean>(1);
|
||||
isLoadingMempool$ = new BehaviorSubject<boolean>(true);
|
||||
vbytesPerSecond$ = new ReplaySubject<number>(1);
|
||||
|
||||
@@ -34,6 +34,8 @@ export class WebsocketService {
|
||||
private isTrackingAddress: string | false = false;
|
||||
private isTrackingAddresses: string[] | false = false;
|
||||
private isTrackingAccelerations: boolean = false;
|
||||
private isTrackingWallet: boolean = false;
|
||||
private trackingWalletName: string;
|
||||
private trackingMempoolBlock: number;
|
||||
private stoppingTrackMempoolBlock: any | null = null;
|
||||
private latestGitCommit = '';
|
||||
@@ -137,6 +139,9 @@ export class WebsocketService {
|
||||
if (this.isTrackingAccelerations) {
|
||||
this.startTrackAccelerations();
|
||||
}
|
||||
if (this.isTrackingWallet) {
|
||||
this.startTrackingWallet(this.trackingWalletName);
|
||||
}
|
||||
this.stateService.connectionState$.next(2);
|
||||
}
|
||||
|
||||
@@ -196,6 +201,18 @@ export class WebsocketService {
|
||||
this.isTrackingAddresses = false;
|
||||
}
|
||||
|
||||
startTrackingWallet(walletName: string) {
|
||||
this.websocketSubject.next({ 'track-wallet': walletName });
|
||||
this.isTrackingWallet = true;
|
||||
this.trackingWalletName = walletName;
|
||||
}
|
||||
|
||||
stopTrackingWallet() {
|
||||
this.websocketSubject.next({ 'track-wallet': 'stop' });
|
||||
this.isTrackingWallet = false;
|
||||
this.trackingWalletName = '';
|
||||
}
|
||||
|
||||
startTrackAsset(asset: string) {
|
||||
this.websocketSubject.next({ 'track-asset': asset });
|
||||
}
|
||||
@@ -452,6 +469,10 @@ export class WebsocketService {
|
||||
}
|
||||
}
|
||||
|
||||
if (response['wallet-transactions']) {
|
||||
this.stateService.walletTransactions$.next(response['wallet-transactions']);
|
||||
}
|
||||
|
||||
if (response['accelerations']) {
|
||||
if (response['accelerations'].accelerations) {
|
||||
this.stateService.accelerations$.next({
|
||||
|
||||
Reference in New Issue
Block a user