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 = (
3131 delegationTracker : DelegationTracker
3232) : BalanceTracker => ( {
3333 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+ ) ,
3452 // 'Unregistering' balance will be reflected in utxo
3553 deposit$ : computeDepositCoin (
3654 protocolParameters$ ,
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ export interface TransactionalObservables<T> {
2121
2222export interface BalanceTracker {
2323 rewardAccounts : {
24+ availableRewards$ : Observable < Cardano . Lovelace > ;
2425 rewards$ : Observable < Cardano . Lovelace > ;
2526 deposit$ : Observable < Cardano . Lovelace > ;
2627 } ;
You can’t perform that action at this time.
0 commit comments