From 6bcad0471e8ad7d3a4a9fab5d7eba410a521189d Mon Sep 17 00:00:00 2001 From: james-prysm Date: Mon, 20 Feb 2023 13:46:01 -0600 Subject: [PATCH 1/5] handle fee recipient errors --- .../core/interceptors/mock.interceptor.ts | 5 +++++ .../modules/core/services/validator.service.ts | 18 ++++++++++++++---- .../accounts-table.component.html | 3 ++- .../accounts-table/accounts-table.component.ts | 1 + 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/app/modules/core/interceptors/mock.interceptor.ts b/src/app/modules/core/interceptors/mock.interceptor.ts index a2eb26c0..596d4f9d 100644 --- a/src/app/modules/core/interceptors/mock.interceptor.ts +++ b/src/app/modules/core/interceptors/mock.interceptor.ts @@ -5,6 +5,7 @@ import { HttpEvent, HttpInterceptor, HttpResponse, + HttpErrorResponse, } from '@angular/common/http'; import { Observable, of } from 'rxjs'; @@ -37,6 +38,10 @@ export class MockInterceptor implements HttpInterceptor { status: 200, body: mock[request.method as keyof RestObject], })); + // throw new HttpErrorResponse({ + // error: "error occurred", + // status: 400 + // }); } } diff --git a/src/app/modules/core/services/validator.service.ts b/src/app/modules/core/services/validator.service.ts index fd668905..b7a32be9 100644 --- a/src/app/modules/core/services/validator.service.ts +++ b/src/app/modules/core/services/validator.service.ts @@ -1,7 +1,7 @@ -import { HttpClient } from '@angular/common/http'; +import { HttpClient, HttpErrorResponse } from '@angular/common/http'; import { Injectable } from '@angular/core'; -import { Observable, Subject, zip } from 'rxjs'; -import { map, share, switchMap } from 'rxjs/operators'; +import { Observable, Subject, zip,of } from 'rxjs'; +import { map, share, switchMap,catchError } from 'rxjs/operators'; import { ValidatorBalances, Validators, ValidatorSummaryResponse } from 'src/app/proto/eth/v1alpha1/beacon_chain'; @@ -63,7 +63,17 @@ export class ValidatorService { } getFeeRecipient(publicKey:string): Observable< ListFeeRecipientResponse>{ - return this.http.get(`${this.keymanagerUrl}/validator/${base64ToHex(publicKey)}/feerecipient`) + return this.http.get(`${this.keymanagerUrl}/validator/${base64ToHex(publicKey)}/feerecipient`).pipe( + catchError((err: HttpErrorResponse) => { + let UNSET_RECIPIENT = "set by beacon node"; + // just let the user know it's set by the beacon node if it's not set + return of({ + data: { + pubkey: base64ToHex(publicKey), + ethaddress: UNSET_RECIPIENT, + } + }); + })); } setFeeRecipient(publicKey:string,request: SetFeeRecipientRequest){ diff --git a/src/app/modules/wallet/components/accounts-table/accounts-table.component.html b/src/app/modules/wallet/components/accounts-table/accounts-table.component.html index c91f6240..10de6243 100644 --- a/src/app/modules/wallet/components/accounts-table/accounts-table.component.html +++ b/src/app/modules/wallet/components/accounts-table/accounts-table.component.html @@ -43,7 +43,8 @@ matTooltipPosition="left" matTooltip="Copy to Clipboard" (click)="copyFeeRecipientToClipboard(row.feeRecipient)" - class="cursor-pointer"> {{row.feeRecipient | slice:0:8 }}... + class="cursor-pointer"> {{ + row.feeRecipient === UNSET_RECIPIENT ? UNSET_RECIPIENT : (row.feeRecipient | slice:0:8)+"..." }} ETH Balance diff --git a/src/app/modules/wallet/components/accounts-table/accounts-table.component.ts b/src/app/modules/wallet/components/accounts-table/accounts-table.component.ts index fc59f43c..4bd545c4 100644 --- a/src/app/modules/wallet/components/accounts-table/accounts-table.component.ts +++ b/src/app/modules/wallet/components/accounts-table/accounts-table.component.ts @@ -37,6 +37,7 @@ export class AccountsTableComponent implements AfterViewInit,OnChanges { @ViewChild(MatSort, { static: false }) sort: MatSort | null = null; readonly LANDING_URL = '/' + LANDING_URL; + readonly UNSET_RECIPIENT = "set by beacon node"; constructor( private dialog: MatDialog, From f56ae3d997a09bc92b24239f3620b8f494879133 Mon Sep 17 00:00:00 2001 From: james-prysm Date: Mon, 20 Feb 2023 14:04:45 -0600 Subject: [PATCH 2/5] testing updating node version --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index cb9d68a3..956df302 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:14-alpine +FROM node:15-alpine # set working directory WORKDIR /app From 8e26504bba9f1c412624b64e8e2c8768436a6436 Mon Sep 17 00:00:00 2001 From: james-prysm Date: Mon, 20 Feb 2023 14:07:05 -0600 Subject: [PATCH 3/5] reverting node version --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 956df302..cb9d68a3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:15-alpine +FROM node:14-alpine # set working directory WORKDIR /app From 6b12e8fa9fb330c7957a0e21c77a9624a9648c55 Mon Sep 17 00:00:00 2001 From: james-prysm Date: Wed, 22 Feb 2023 09:48:45 -0600 Subject: [PATCH 4/5] kicking off ci again --- src/app/modules/wallet/pages/accounts/accounts.component.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/app/modules/wallet/pages/accounts/accounts.component.ts b/src/app/modules/wallet/pages/accounts/accounts.component.ts index c0a5f88f..5e5047d7 100644 --- a/src/app/modules/wallet/pages/accounts/accounts.component.ts +++ b/src/app/modules/wallet/pages/accounts/accounts.component.ts @@ -2,9 +2,8 @@ import { Component, OnInit, ViewChild } from '@angular/core'; import { MatPaginator, PageEvent } from '@angular/material/paginator'; import { MatTableDataSource } from '@angular/material/table'; import { SelectionModel } from '@angular/cdk/collections'; - import { BigNumber } from 'ethers'; -import { BehaviorSubject, forkJoin, Observable, of, throwError, zip } from 'rxjs'; +import { BehaviorSubject, Observable, throwError, zip } from 'rxjs'; import { catchError, debounceTime, From cd4aae6b4a554ba8e0633a554dcf4a8546a2e361 Mon Sep 17 00:00:00 2001 From: james-prysm Date: Wed, 22 Feb 2023 13:18:36 -0600 Subject: [PATCH 5/5] addressing feedback --- src/app/modules/core/interceptors/mock.interceptor.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/app/modules/core/interceptors/mock.interceptor.ts b/src/app/modules/core/interceptors/mock.interceptor.ts index 596d4f9d..4743ee82 100644 --- a/src/app/modules/core/interceptors/mock.interceptor.ts +++ b/src/app/modules/core/interceptors/mock.interceptor.ts @@ -38,10 +38,6 @@ export class MockInterceptor implements HttpInterceptor { status: 200, body: mock[request.method as keyof RestObject], })); - // throw new HttpErrorResponse({ - // error: "error occurred", - // status: 400 - // }); } }