Skip to content

Commit

Permalink
handle fee recipient errors (#242)
Browse files Browse the repository at this point in the history
* handle fee recipient errors

* testing updating node version

* reverting node version

* kicking off ci again

* addressing feedback

---------

Co-authored-by: Raul Jordan <[email protected]>
  • Loading branch information
james-prysm and rauljordan authored Feb 23, 2023
1 parent de04d2b commit 12e37ba
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/app/modules/core/interceptors/mock.interceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
HttpEvent,
HttpInterceptor,
HttpResponse,
HttpErrorResponse,
} from '@angular/common/http';
import { Observable, of } from 'rxjs';

Expand Down
18 changes: 14 additions & 4 deletions src/app/modules/core/services/validator.service.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -63,7 +63,17 @@ export class ValidatorService {
}

getFeeRecipient(publicKey:string): Observable< ListFeeRecipientResponse>{
return this.http.get<ListFeeRecipientResponse>(`${this.keymanagerUrl}/validator/${base64ToHex(publicKey)}/feerecipient`)
return this.http.get<ListFeeRecipientResponse>(`${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){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
matTooltipPosition="left"
matTooltip="Copy to Clipboard"
(click)="copyFeeRecipientToClipboard(row.feeRecipient)"
class="cursor-pointer"> {{row.feeRecipient | slice:0:8 }}... </td>
class="cursor-pointer"> {{
row.feeRecipient === UNSET_RECIPIENT ? UNSET_RECIPIENT : (row.feeRecipient | slice:0:8)+"..." }} </td>
</ng-container>
<ng-container matColumnDef="balance">
<th mat-header-cell *matHeaderCellDef mat-sort-header>ETH Balance</th>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 12e37ba

Please sign in to comment.