Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4f9b13f
commit 48a820f
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { Ogmios } from '@cardano-sdk/core'; | ||
|
||
export interface Balance extends Ogmios.Value { | ||
rewards: Ogmios.Lovelace; | ||
} | ||
|
||
export interface Balances { | ||
total: Balance; | ||
available: Balance; | ||
} | ||
|
||
export interface BalanceTrackerEvents { | ||
balanceChanged: Balances; | ||
} | ||
|
||
// export class BalanceTracker extends Emittery<BalanceTrackerEvents> implements Balances { | ||
// total: Balance; | ||
// available: Balance; | ||
|
||
// constructor(utxoRepository: UtxoRepository) { | ||
// super(); | ||
// const totalValue = this.#getBalance(utxoRepository.allUtxos); | ||
// const availableValue = this.#getBalance(utxoRepository.availableUtxos); | ||
// const totalRewards = utxoRepository.rewards; | ||
// const availableRewards = utxoRepository.availableRewards; | ||
// } | ||
|
||
// #getBalance(utxo: Utxo): Ogmios.Value { | ||
// return Ogmios.util.coalesceValueQuantities( | ||
// utxo.map(([_, txOut]) => { | ||
// const { coins, assets } = txOut.value; | ||
// return { | ||
// coins: BigInt(coins), | ||
// assets | ||
// }; | ||
// }) | ||
// ); | ||
// } | ||
// } |