import { ChangeDetectionStrategy , Component , Inject } from '@angular/core' ; import { POLYMORPHEUS_CONTEXT } from '@tinkoff/ng-polymorpheus' ; import { TuiDialogContext , TuiDialogService , TuiNotification } from '@taiga-ui/core' ; import { Router } from '@angular/router' ; import BigNumber from 'bignumber.js' ; import { BehaviorSubject , Observable } from 'rxjs' ; import { NotificationsService } from '@core/services/notifications/notifications.service' ; import { BLOCKCHAIN_NAME } from '@shared/models/blockchain/blockchain-name' ; import { StakingService } from '@features/staking/services/staking.service' ; /**
 * The modal which allows user to choose staking method.
 */ @ Component ( { selector : 'app-swap-modal' , templateUrl : './swap-modal.component.html' , styleUrls : [ './swap-modal.component.scss' ] , changeDetection : ChangeDetectionStrategy . OnPush } ) export class SwapModalComponent { private readonly _bridgeSwapButtonLoading$ = new BehaviorSubject < boolean > ( false ) ; get bridgeSwapButtonLoading$ ( ) : Observable < boolean > { return this . _bridgeSwapButtonLoading$ . asObservable ( ) ; } public isEthBlockchain : boolean ; constructor ( @ Inject ( POLYMORPHEUS_CONTEXT ) private readonly context , private readonly router , private readonly stakingService , private readonly dialogService , private readonly notificationsService ) { this . isEthBlockchain = this . context . data . blockchain === BLOCKCHAIN_NAME . ETHEREUM ; } public navigateToSwaps ( ) { this . router . navigate ( [ '/swaps' ] ) . then ( ( ) => this . context . completeWith ( false ) ) ; } public swapViaPlatform ( ) { this . notificationsService . show ( 'Staking is disabled due to Staking contract is full.' , { status : TuiNotification . Warning , autoClose : 10000 } ) ; } }