File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed
packages/wallet/src/services Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,24 @@ export const createBalanceTracker = (
31
31
delegationTracker : DelegationTracker
32
32
) : BalanceTracker => ( {
33
33
rewardAccounts : {
34
+ availableRewards$ : delegationTracker . rewardAccounts$ . pipe (
35
+ map ( ( accounts ) =>
36
+ accounts
37
+ . filter ( ( { dRepDelegatee } ) => {
38
+ if ( ! dRepDelegatee ) return false ;
39
+
40
+ const { delegateRepresentative } = dRepDelegatee ;
41
+
42
+ return (
43
+ Cardano . isDRepAlwaysAbstain ( delegateRepresentative ) ||
44
+ Cardano . isDRepAlwaysNoConfidence ( delegateRepresentative ) ||
45
+ ( Cardano . isDrepInfo ( delegateRepresentative ) && delegateRepresentative . active )
46
+ ) ;
47
+ } )
48
+ . reduce ( ( sum , { rewardBalance } ) => sum + rewardBalance , 0n )
49
+ ) ,
50
+ distinctUntilChanged ( )
51
+ ) ,
34
52
// 'Unregistering' balance will be reflected in utxo
35
53
deposit$ : computeDepositCoin (
36
54
protocolParameters$ ,
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ export interface TransactionalObservables<T> {
21
21
22
22
export interface BalanceTracker {
23
23
rewardAccounts : {
24
+ availableRewards$ : Observable < Cardano . Lovelace > ;
24
25
rewards$ : Observable < Cardano . Lovelace > ;
25
26
deposit$ : Observable < Cardano . Lovelace > ;
26
27
} ;
You can’t perform that action at this time.
0 commit comments