import { Injectable } from '@angular/core' ; import { Observable } from 'rxjs' ; import { HttpService } from 'src/app/core/services/http/http.service' ; import { UpdateDepositRequestInterface } from '@features/staking/models/update-deposit-request.interface' ; import { BridgeTxRequestInterface } from '@features/staking/models/bridge-tx-request.interface' ; import { pluck } from 'rxjs/operators' ; import { ENVIRONMENT } from 'src/environments/environment' ; @ Injectable ( ) export class StakingApiService { private readonly stakingApiPath = ENVIRONMENT . staking . apiUrl ; constructor ( private readonly httpService ) { } return public getApr ( ) { return this . httpService . get < number > ( 'apr/' , { } , this . stakingApiPath ) . pipe ( pluck ( 'value' ) ) ; } return public getRefillTime ( ) { return this . httpService . get < string > ( 'apr/refill-time' , { } , this . stakingApiPath ) . pipe ( pluck ( 'value' ) ) ; } param walletAddress return public getUsersDeposit ( walletAddress ) { return this . httpService . get < number > ( 'balance/' , { walletAddress } , this . stakingApiPath ) . pipe ( pluck ( 'balance' ) ) ; } param request return public updateUsersDeposit ( request ) { return this . httpService . post < void > ( 'balance/deposit' , { ... request } , this . stakingApiPath ) ; } param request return public updateUsersDepositAfterWithdraw ( request ) { return this . httpService . post < void > ( 'balance/withdraw' , { ... request } , this . stakingApiPath ) ; } param request return public sendBridgeTxHash ( request ) { return this . httpService . post < void > ( 'transfer-crypto/' , { ... request } , this . stakingApiPath ) ; } return public getBridgeContractAddress ( ) { return this . httpService . get < string > ( 'transfer-crypto/wallet-address' , { } , this . stakingApiPath ) . pipe ( pluck ( 'walletAddress' ) ) ; } }