import { Injectable } from '@angular/core' ; import { EMPTY , Observable } from 'rxjs' ; import { catchError , take } from 'rxjs/operators' ; import { ApiResponse , ApiService } from '../../../../../common/api/api.service' ; import { FormToastService } from '../../../../../common/services/form-toast.service' ; /**
 * Handles the getting of a users withdrawals summary from the server.
 */ @ Injectable ( { providedIn : 'root' } ) export class WalletOnchainTransfersSummaryService { constructor ( private api , private toast ) { } param { string } offset returns { Observable < ApiResponse > } public getWithdrawals$ ( offset = '' ) { return this . api . get ( 'api/v3/rewards/withdrawals' , { offset : offset } ) . pipe ( take ( 1 ) , catchError ( e => this . handleError ( e ) ) ) ; } param e returns { Observable < null > } private handleError ( e ) { console . error ( e ) ; this . toast . error ( e . message ?? 'An unknown error has occurred' ) ; return EMPTY ; } }