/
StakingPage.js
656 lines (623 loc) · 25.3 KB
/
StakingPage.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
// @flow
import { Component } from 'react';
import type { Node, ComponentType } from 'react';
import { computed } from 'mobx';
import { observer } from 'mobx-react';
import { intlShape } from 'react-intl';
import globalMessages from '../../../i18n/global-messages';
import BannerContainer from '../../banners/BannerContainer';
import type { GeneratedData as BannerContainerData } from '../../banners/BannerContainer';
import type { InjectedOrGenerated } from '../../../types/injectedPropsType';
import type { GeneratedData as SidebarContainerData } from '../../SidebarContainer';
import type { GeneratedData as NavBarContainerRevampData } from '../../NavBarContainerRevamp';
import TopBarLayout from '../../../components/layout/TopBarLayout';
import SidebarContainer from '../../SidebarContainer';
import NavBarTitle from '../../../components/topbar/NavBarTitle';
import type { $npm$ReactIntl$IntlFormat } from 'react-intl';
import { PublicDeriver } from '../../../api/ada/lib/storage/models/PublicDeriver/index';
import { withLayout } from '../../../styles/context/layout';
import type { LayoutComponentMap } from '../../../styles/context/layout';
import NavBarContainerRevamp from '../../NavBarContainerRevamp';
import WalletEmptyBanner from '../WalletEmptyBanner';
import BuySellDialog from '../../../components/buySell/BuySellDialog';
import CardanoStakingPage from './CardanoStakingPage';
import type { ConfigType } from '../../../../config/config-types';
import { Box, styled } from '@mui/system';
import type { TxRequests } from '../../../stores/toplevel/TransactionsStore';
import SummaryCard from '../../../components/wallet/staking/dashboard-revamp/SummaryCard';
import StakingTabs from '../../../components/wallet/staking/dashboard-revamp/StakingTabs';
import OverviewModal from '../../../components/wallet/staking/dashboard-revamp/OverviewDialog';
import type { DelegationRequests, PoolMeta } from '../../../stores/toplevel/DelegationStore';
import LocalizableError from '../../../i18n/LocalizableError';
import { MultiToken } from '../../../api/common/lib/MultiToken';
import { genLookupOrFail } from '../../../stores/stateless/tokenHelpers';
import UnmangleTxDialogContainer from '../../transfer/UnmangleTxDialogContainer';
import DeregisterDialogContainer from '../../transfer/DeregisterDialogContainer';
import { calculateAndFormatValue } from '../../../utils/unit-of-account';
import type { TokenInfoMap } from '../../../stores/toplevel/TokenInfoStore';
import type { NetworkRow } from '../../../api/ada/lib/storage/database/primitives/tables';
import type { UnitOfAccountSettingType } from '../../../types/unitOfAccountType';
import {
isCardanoHaskell,
isJormungandr,
} from '../../../api/ada/lib/storage/database/prepackaged/networks';
import type { AdaDelegationRequests } from '../../../stores/ada/AdaDelegationStore';
import EpochProgressContainer from './EpochProgressContainer';
import type { GeneratedData as UnmangleTxDialogContainerData } from '../../transfer/UnmangleTxDialogContainer';
import WithdrawalTxDialogContainer from '../../transfer/WithdrawalTxDialogContainer';
import type { GeneratedData as WithdrawalTxDialogContainerData } from '../../transfer/WithdrawalTxDialogContainer';
import type { GeneratedData as DeregisterDialogContainerData } from '../../transfer/DeregisterDialogContainer';
import UndelegateDialog from '../../../components/wallet/staking/dashboard/UndelegateDialog';
import type { PoolRequest } from '../../../api/jormungandr/lib/storage/bridge/delegationUtils';
import { generateGraphData } from '../../../utils/graph';
import type { TokenEntry } from '../../../api/common/lib/MultiToken';
import { ApiOptions, getApiForNetwork } from '../../../api/common/utils';
import type {
CurrentTimeRequests,
TimeCalcRequests,
} from '../../../stores/base/BaseCardanoTimeStore';
import moment from 'moment';
export type GeneratedData = typeof StakingPage.prototype.generated;
// populated by ConfigWebpackPlugin
declare var CONFIG: ConfigType;
type Props = {|
...InjectedOrGenerated<GeneratedData>,
actions: any,
stores: any,
|};
type InjectedProps = {|
+renderLayoutComponent: LayoutComponentMap => Node,
|};
type AllProps = {| ...Props, ...InjectedProps |};
@observer
class StakingPage extends Component<AllProps> {
static contextTypes: {| intl: $npm$ReactIntl$IntlFormat |} = {
intl: intlShape.isRequired,
};
onClose: void => void = () => {
this.generated.actions.dialogs.closeActiveDialog.trigger();
};
_isRegistered: (PublicDeriver<>) => ?boolean = publicDeriver => {
if (!isCardanoHaskell(publicDeriver.getParent().getNetworkInfo())) {
return undefined;
}
const adaDelegationRequests = this.generated.stores.substores.ada.delegation.getDelegationRequests(
publicDeriver
);
if (adaDelegationRequests == null) return undefined;
return adaDelegationRequests.getRegistrationHistory.result?.current;
};
_generateUserSummary: ({|
delegationRequests: DelegationRequests,
publicDeriver: PublicDeriver<>,
errorIfPresent: void | {| error: LocalizableError |},
|}) => Node = request => {
const { actions, stores } = this.generated;
const showRewardAmount =
request.delegationRequests.getCurrentDelegation.wasExecuted &&
request.delegationRequests.getDelegatedBalance.wasExecuted &&
request.errorIfPresent == null;
const defaultToken = request.publicDeriver.getParent().getDefaultToken();
const currentlyDelegating =
(request.delegationRequests.getCurrentDelegation.result?.currEpoch?.pools ?? []).length > 0;
return (
<SummaryCard
onOverviewClick={() =>
actions.dialogs.open.trigger({
dialog: OverviewModal,
})
}
unitOfAccount={this.toUnitOfAccount}
getTokenInfo={genLookupOrFail(stores.tokenInfoStore.tokenInfo)}
shouldHideBalance={stores.profile.shouldHideBalance}
totalRewards={
!showRewardAmount || request.delegationRequests.getDelegatedBalance.result == null
? undefined
: request.delegationRequests.getDelegatedBalance.result.accountPart
}
totalDelegated={(() => {
if (!showRewardAmount) return undefined;
if (request.delegationRequests.getDelegatedBalance.result == null) return undefined;
return currentlyDelegating
? request.delegationRequests.getDelegatedBalance.result.utxoPart.joinAddCopy(
request.delegationRequests.getDelegatedBalance.result.accountPart
)
: new MultiToken([], defaultToken);
})()}
/>
);
};
getErrorInFetch: (PublicDeriver<>) => void | {| error: LocalizableError |} = publicDeriver => {
const delegationStore = this.generated.stores.delegation;
const delegationRequests = delegationStore.getDelegationRequests(publicDeriver);
if (delegationRequests == null) {
throw new Error(`${nameof(StakingPage)} opened for non-reward wallet`);
}
if (delegationRequests.error != null) {
return { error: delegationRequests.error };
}
if (delegationRequests.getCurrentDelegation.result != null) {
const currentDelegation = delegationRequests.getCurrentDelegation.result;
const currEpochInfo = currentDelegation.currEpoch;
if (currEpochInfo == null) {
return undefined;
}
}
return undefined;
};
getEpochLengthInDays: (PublicDeriver<>) => ?number = publicDeriver => {
const timeStore = this.generated.stores.time;
const timeCalcRequests = timeStore.getTimeCalcRequests(publicDeriver);
const getEpochLength = timeCalcRequests.requests.currentEpochLength.result;
if (getEpochLength == null) return null;
const getSlotLength = timeCalcRequests.requests.currentSlotLength.result;
if (getSlotLength == null) return null;
const epochLengthInSeconds = getEpochLength() * getSlotLength();
const epochLengthInDays = epochLengthInSeconds / (60 * 60 * 24);
return epochLengthInDays;
};
getStakePools: (PublicDeriver<>) => Node | void = publicDeriver => {
const timeStore = this.generated.stores.time;
const timeCalcRequests = timeStore.getTimeCalcRequests(publicDeriver);
const currTimeRequests = timeStore.getCurrentTimeRequests(publicDeriver);
const toAbsoluteSlot = timeCalcRequests.requests.toAbsoluteSlot.result;
if (toAbsoluteSlot == null) return undefined;
const toRealTime = timeCalcRequests.requests.toRealTime.result;
if (toRealTime == null) return undefined;
const timeSinceGenesis = timeCalcRequests.requests.timeSinceGenesis.result;
if (timeSinceGenesis == null) return undefined;
const getEpochLength = timeCalcRequests.requests.currentEpochLength.result;
if (getEpochLength == null) return undefined;
const currentEpoch = currTimeRequests.currentEpoch;
const epochLength = getEpochLength();
const getDateFromEpoch = epoch => {
const epochTime = toRealTime({
absoluteSlotNum: toAbsoluteSlot({
epoch,
// in Jormungandr, rewards were distributed at the start of the epoch
// in Haskell, rewards are calculated at the start of the epoch but distributed at the end
slot: isJormungandr(publicDeriver.getParent().getNetworkInfo()) ? 0 : getEpochLength(),
}),
timeSinceGenesisFunc: timeSinceGenesis,
});
const epochMoment = moment(epochTime).format('lll');
return epochMoment;
};
const endEpochDate = getDateFromEpoch(currentEpoch);
const previousEpochDate = getDateFromEpoch(currentEpoch - 1);
const delegationStore = this.generated.stores.delegation;
const delegationRequests = delegationStore.getDelegationRequests(publicDeriver);
if (delegationRequests == null) {
throw new Error(`${nameof(StakingPage)} opened for non-reward wallet`);
}
if (
!delegationRequests.getCurrentDelegation.wasExecuted ||
delegationRequests.getCurrentDelegation.isExecuting ||
delegationRequests.getCurrentDelegation.result == null
) {
return null;
}
if (delegationRequests.getCurrentDelegation.result.currEpoch == null) {
return null;
}
const currentPools = delegationRequests.getCurrentDelegation.result.currEpoch.pools;
const { intl } = this.context;
const currentPage = this.generated.stores.delegation.selectedPage;
const currentPool = currentPools[0][currentPage];
const meta = this.generated.stores.delegation.getLocalPoolInfo(
publicDeriver.getParent().getNetworkInfo(),
String(currentPool)
);
if (meta == null) {
// server hasn't returned information about the stake pool yet
return undefined;
}
const name = meta.info?.name ?? intl.formatMessage(globalMessages.unknownPoolLabel);
const delegatedPool = {
id: String(currentPool),
name,
};
// TODO: implement this eventually
// const stakePoolMeta = {
// avatar: '',
// websiteUrl: '',
// roa: ' 5.08%',
// socialLinks: {
// fb: '',
// tw: '',
// },
// };
return (
<StakingTabs
epochProgress={{
startEpochDate: previousEpochDate,
currentEpoch,
endEpochDate,
percentage: Math.floor((100 * currTimeRequests.currentSlot) / epochLength),
}}
delegatedPool={delegatedPool}
undelegate={
// don't support undelegation for ratio stake since it's a less intuitive UX
currentPools.length === 1 && isJormungandr(publicDeriver.getParent().getNetworkInfo())
? async () => {
this.generated.actions.dialogs.open.trigger({ dialog: UndelegateDialog });
await this.generated.actions.jormungandr.delegationTransaction.createTransaction.trigger(
{
publicDeriver,
poolRequest: undefined,
}
);
}
: undefined
}
graphData={generateGraphData({
delegationRequests,
publicDeriver,
currentEpoch:
this.generated.stores.time.getCurrentTimeRequests(publicDeriver).currentEpoch,
shouldHideBalance: this.generated.stores.profile.shouldHideBalance,
getLocalPoolInfo: this.generated.stores.delegation.getLocalPoolInfo,
tokenInfo: this.generated.stores.tokenInfoStore.tokenInfo,
})}
epochLength={this.getEpochLengthInDays(publicDeriver)}
/>
);
};
toUnitOfAccount: TokenEntry => void | {| currency: string, amount: string |} = entry => {
const { stores } = this.generated;
const tokenRow = stores.tokenInfoStore.tokenInfo
.get(entry.networkId.toString())
?.get(entry.identifier);
if (tokenRow == null) return undefined;
if (!stores.profile.unitOfAccount.enabled) return undefined;
const currency = stores.profile.unitOfAccount.currency;
const shiftedAmount = entry.amount.shiftedBy(-tokenRow.Metadata.numberOfDecimals);
const ticker = tokenRow.Metadata.ticker;
if (ticker == null) {
throw new Error('unexpected main token type');
}
const coinPrice = stores.coinPriceStore.getCurrentPrice(ticker, currency);
if (coinPrice == null) return { currency, amount: '-' };
return {
currency,
amount: calculateAndFormatValue(shiftedAmount, coinPrice),
};
};
render(): Node {
const sidebarContainer = <SidebarContainer {...this.generated.SidebarContainerProps} />;
const publicDeriver = this.generated.stores.wallets.selected;
if (publicDeriver == null) {
throw new Error(`${nameof(StakingPage)} no public deriver. Should never happen`);
}
const { stores } = this.generated;
const { uiDialogs, delegation: delegationStore } = stores;
const delegationRequests = delegationStore.getDelegationRequests(publicDeriver);
if (delegationRequests == null) {
throw new Error(`${nameof(StakingPage)} opened for non-reward wallet`);
}
const txRequests = stores.transactions.getTxRequests(publicDeriver);
const balance = txRequests.requests.getBalanceRequest.result;
const isWalletWithNoFunds = balance != null && balance.getDefaultEntry().amount.isZero();
const errorIfPresent = this.getErrorInFetch(publicDeriver);
const showRewardAmount =
delegationRequests.getCurrentDelegation.wasExecuted &&
delegationRequests.getDelegatedBalance.wasExecuted &&
errorIfPresent == null;
const delegationHistory = delegationRequests.getCurrentDelegation.result?.fullHistory;
const hasNeverDelegated = delegationHistory != null && delegationHistory.length === 0;
const showStakePoolTabs =
errorIfPresent == null ? this.getStakePools(publicDeriver) : errorIfPresent;
return (
<TopBarLayout
banner={<BannerContainer {...this.generated.BannerContainerProps} />}
sidebar={sidebarContainer}
navbar={
<NavBarContainerRevamp
{...this.generated.NavBarContainerRevampProps}
title={
<NavBarTitle
title={this.context.intl.formatMessage(globalMessages.stakingDashboard)}
/>
}
/>
}
showInContainer
showAsCard
>
<Box>
{isWalletWithNoFunds ? (
<WalletEmptyBanner
isOpen={this.generated.stores.transactions.showWalletEmptyBanner}
onClose={this.generated.actions.transactions.closeWalletEmptyBanner.trigger}
onBuySellClick={() =>
this.generated.actions.dialogs.open.trigger({ dialog: BuySellDialog })
}
/>
) : null}
{hasNeverDelegated ? null : (
<WrapperCards>
{this._generateUserSummary({ delegationRequests, publicDeriver, errorIfPresent })}
{showStakePoolTabs}
</WrapperCards>
)}
<CardanoStakingPage
stores={this.props.stores}
actions={this.props.actions}
urlTemplate={CONFIG.seiza.simpleTemplate}
/>
{uiDialogs.isOpen(OverviewModal) ? (
<OverviewModal
onClose={this.onClose}
getTokenInfo={genLookupOrFail(this.generated.stores.tokenInfoStore.tokenInfo)}
totalRewards={
!showRewardAmount || delegationRequests.getDelegatedBalance.result == null
? undefined
: delegationRequests.getDelegatedBalance.result.accountPart
}
shouldHideBalance={this.generated.stores.profile.shouldHideBalance}
unitOfAccount={this.toUnitOfAccount}
withdrawRewards={
this._isRegistered(delegationRequests.publicDeriver) === true
? () => {
this.generated.actions.dialogs.open.trigger({
dialog: DeregisterDialogContainer,
});
}
: undefined
}
/>
) : null}
{uiDialogs.isOpen(DeregisterDialogContainer) ? (
<DeregisterDialogContainer
{...this.generated.DeregisterDialogContainerProps}
alwaysShowDeregister
onNext={() => {
// note: purposely don't await
// since the next dialog will properly render the spinner
this.generated.actions.ada.delegationTransaction.createWithdrawalTxForWallet.trigger(
{
publicDeriver,
}
);
this.generated.actions.dialogs.open.trigger({
dialog: WithdrawalTxDialogContainer,
});
}}
/>
) : null}
{uiDialogs.isOpen(UnmangleTxDialogContainer) ? (
<UnmangleTxDialogContainer
{...this.generated.UnmangleTxDialogContainerProps}
onClose={this.onClose}
/>
) : null}
{uiDialogs.isOpen(WithdrawalTxDialogContainer) ? (
<WithdrawalTxDialogContainer
{...this.generated.WithdrawalTxDialogContainerProps}
onClose={() => {
this.generated.actions.ada.delegationTransaction.reset.trigger({
justTransaction: false,
});
this.generated.actions.dialogs.closeActiveDialog.trigger();
}}
/>
) : null}
</Box>
</TopBarLayout>
);
}
@computed get generated(): {|
BannerContainerProps: InjectedOrGenerated<BannerContainerData>,
NavBarContainerRevampProps: InjectedOrGenerated<NavBarContainerRevampData>,
SidebarContainerProps: InjectedOrGenerated<SidebarContainerData>,
DeregisterDialogContainerProps: InjectedOrGenerated<DeregisterDialogContainerData>,
UnmangleTxDialogContainerProps: InjectedOrGenerated<UnmangleTxDialogContainerData>,
WithdrawalTxDialogContainerProps: InjectedOrGenerated<WithdrawalTxDialogContainerData>,
actions: {|
ada: {|
delegationTransaction: {|
reset: {| trigger: (params: {| justTransaction: boolean |}) => void |},
createWithdrawalTxForWallet: {|
trigger: (params: {| publicDeriver: PublicDeriver<> |}) => Promise<void>,
|},
|},
|},
jormungandr: {|
delegationTransaction: {|
createTransaction: {|
trigger: (params: {|
poolRequest: PoolRequest,
publicDeriver: PublicDeriver<>,
|}) => Promise<void>,
|},
|},
|},
dialogs: {|
open: {|
trigger: (params: {|
dialog: any,
params?: any,
|}) => void,
|},
closeActiveDialog: {|
trigger: (params: void) => void,
|},
|},
transactions: {|
closeWalletEmptyBanner: {|
trigger: (params: void) => void,
|},
closeDelegationBanner: {|
trigger: (params: void) => void,
|},
|},
|},
stores: {|
uiDialogs: {|
getParam: <T>(number | string) => T,
isOpen: any => boolean,
|},
coinPriceStore: {|
getCurrentPrice: (from: string, to: string) => ?string,
|},
substores: {|
ada: {|
delegation: {|
getDelegationRequests: (PublicDeriver<>) => void | AdaDelegationRequests,
|},
|},
|},
time: {|
getCurrentTimeRequests: (PublicDeriver<>) => CurrentTimeRequests,
getTimeCalcRequests: (PublicDeriver<>) => TimeCalcRequests,
|},
delegation: {|
selectedPage: number,
getLocalPoolInfo: ($ReadOnly<NetworkRow>, string) => void | PoolMeta,
getDelegationRequests: (PublicDeriver<>) => void | DelegationRequests,
|},
profile: {|
shouldHideBalance: boolean,
unitOfAccount: UnitOfAccountSettingType,
|},
tokenInfoStore: {|
tokenInfo: TokenInfoMap,
|},
wallets: {| selected: null | PublicDeriver<> |},
transactions: {|
showWalletEmptyBanner: boolean,
showDelegationBanner: boolean,
getTxRequests: (PublicDeriver<>) => TxRequests,
|},
|},
|} {
if (this.props.generated !== undefined) {
return this.props.generated;
}
if (this.props.stores == null || this.props.actions == null) {
throw new Error(`${nameof(StakingPage)} no way to generated props`);
}
const { stores, actions } = this.props;
const selected = stores.wallets.selected;
if (selected == null) {
throw new Error(`${nameof(EpochProgressContainer)} no wallet selected`);
}
const api = getApiForNetwork(selected.getParent().getNetworkInfo());
const time = (() => {
if (api === ApiOptions.ada) {
return {
getTimeCalcRequests: stores.substores.ada.time.getTimeCalcRequests,
getCurrentTimeRequests: stores.substores.ada.time.getCurrentTimeRequests,
};
}
if (api === ApiOptions.jormungandr) {
return {
getTimeCalcRequests: stores.substores.jormungandr.time.getTimeCalcRequests,
getCurrentTimeRequests: stores.substores.jormungandr.time.getCurrentTimeRequests,
};
}
return {
getTimeCalcRequests: (undefined: any),
getCurrentTimeRequests: () => {
throw new Error(`${nameof(StakingPage)} api not supported`);
},
};
})();
return Object.freeze({
stores: {
wallets: {
selected: stores.wallets.selected,
},
profile: {
shouldHideBalance: stores.profile.shouldHideBalance,
unitOfAccount: stores.profile.unitOfAccount,
},
delegation: {
selectedPage: stores.delegation.selectedPage,
getLocalPoolInfo: stores.delegation.getLocalPoolInfo,
getDelegationRequests: stores.delegation.getDelegationRequests,
},
time,
uiDialogs: {
isOpen: stores.uiDialogs.isOpen,
getParam: stores.uiDialogs.getParam,
},
transactions: {
showWalletEmptyBanner: stores.transactions.showWalletEmptyBanner,
showDelegationBanner: stores.transactions.showDelegationBanner,
getTxRequests: stores.transactions.getTxRequests,
},
tokenInfoStore: {
tokenInfo: stores.tokenInfoStore.tokenInfo,
},
coinPriceStore: {
getCurrentPrice: stores.coinPriceStore.getCurrentPrice,
},
substores: {
ada: {
delegation: {
getDelegationRequests: stores.substores.ada.delegation.getDelegationRequests,
},
},
},
},
actions: {
ada: {
delegationTransaction: {
reset: {
trigger: actions.ada.delegationTransaction.reset.trigger,
},
createWithdrawalTxForWallet: {
trigger: actions.ada.delegationTransaction.createWithdrawalTxForWallet.trigger,
},
},
},
jormungandr: {
delegationTransaction: {
createTransaction: {
trigger: actions.jormungandr.delegationTransaction.createTransaction.trigger,
},
},
},
transactions: {
closeWalletEmptyBanner: {
trigger: actions.transactions.closeWalletEmptyBanner.trigger,
},
closeDelegationBanner: {
trigger: actions.transactions.closeDelegationBanner.trigger,
},
},
dialogs: {
open: {
trigger: actions.dialogs.open.trigger,
},
closeActiveDialog: { trigger: actions.dialogs.closeActiveDialog.trigger },
},
},
SidebarContainerProps: ({ actions, stores }: InjectedOrGenerated<SidebarContainerData>),
NavBarContainerRevampProps: ({
actions,
stores,
}: InjectedOrGenerated<NavBarContainerRevampData>),
BannerContainerProps: ({ actions, stores }: InjectedOrGenerated<BannerContainerData>),
UnmangleTxDialogContainerProps: ({
stores,
actions,
}: InjectedOrGenerated<UnmangleTxDialogContainerData>),
WithdrawalTxDialogContainerProps: ({
stores,
actions,
}: InjectedOrGenerated<WithdrawalTxDialogContainerData>),
DeregisterDialogContainerProps: ({
stores,
actions,
}: InjectedOrGenerated<DeregisterDialogContainerData>),
});
}
}
export default (withLayout(StakingPage): ComponentType<Props>);
const WrapperCards = styled(Box)({
display: 'flex',
justifyContent: 'space-between',
marginBottom: '40px',
});