-
Notifications
You must be signed in to change notification settings - Fork 214
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
Showing
6 changed files
with
72 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
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
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
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
57 changes: 57 additions & 0 deletions
57
lib/network-layer/src/Cardano/Wallet/Network/LocalStateQuery/UTxO.hs
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,57 @@ | ||
{-# LANGUAGE GADTs #-} | ||
-- | | ||
-- Copyright: © 2024 Cardano Foundation | ||
-- License: Apache-2.0 | ||
-- | ||
-- A local state query that looks up UTxOs based on TxIns. | ||
-- | ||
module Cardano.Wallet.Network.LocalStateQuery.UTxO | ||
( getUTxOByTxIn | ||
) where | ||
|
||
import Prelude | ||
|
||
import Cardano.Ledger.TxIn | ||
( TxIn | ||
) | ||
import Cardano.Ledger.UTxO | ||
( UTxO | ||
) | ||
import Cardano.Wallet.Network.Implementation.Ouroboros | ||
( LSQ (..) | ||
) | ||
import Cardano.Wallet.Network.LocalStateQuery.Extra | ||
( onAnyEra | ||
) | ||
import Data.Set | ||
( Set | ||
) | ||
import Internal.Cardano.Write.Tx | ||
( MaybeInRecentEra (..) | ||
) | ||
import Ouroboros.Consensus.Cardano | ||
( CardanoBlock | ||
) | ||
import Ouroboros.Consensus.Shelley.Eras | ||
( StandardCrypto | ||
) | ||
|
||
import qualified Ouroboros.Consensus.Shelley.Ledger as Shelley | ||
|
||
{----------------------------------------------------------------------------- | ||
Local State Query for GetUTxOByTxIn | ||
------------------------------------------------------------------------------} | ||
-- | ||
type LSQ' m = LSQ (CardanoBlock StandardCrypto) m | ||
|
||
getUTxOByTxIn | ||
:: Set (TxIn StandardCrypto) -> LSQ' m (MaybeInRecentEra UTxO) | ||
getUTxOByTxIn ins = | ||
onAnyEra | ||
(pure InNonRecentEraByron) | ||
(pure InNonRecentEraShelley) | ||
(pure InNonRecentEraAllegra) | ||
(pure InNonRecentEraMary) | ||
(pure InNonRecentEraAlonzo) | ||
(InRecentEraBabbage <$> LSQry (Shelley.GetUTxOByTxIn ins)) | ||
(InRecentEraConway <$> LSQry (Shelley.GetUTxOByTxIn ins)) |
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