This repository was archived by the owner on Dec 2, 2024. It is now read-only.
-
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
3 changed files
with
117 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
{-# LANGUAGE NamedFieldPuns #-} | ||
module Main where | ||
|
||
import Cardano.Api qualified as C | ||
import Marconi.Indexers qualified as I | ||
import Options.Applicative qualified as Opt | ||
import Plutus.Streaming (withChainSyncEventStream) | ||
|
||
data Args = Args | ||
{ socket :: FilePath | ||
, dbPath :: FilePath | ||
, networkId :: C.NetworkId | ||
} deriving (Show) | ||
|
||
args :: Opt.Parser Args | ||
args = Args | ||
<$> Opt.strOption (Opt.long "socket" <> Opt.metavar "FILE" <> Opt.help "Socket path to node") | ||
<*> Opt.strOption (Opt.long "db" <> Opt.metavar "FILE" <> Opt.help "Path to the utxo database.") | ||
<*> pNetworkId | ||
where | ||
pNetworkId :: Opt.Parser C.NetworkId | ||
pNetworkId = | ||
pMainnet Opt.<|> fmap C.Testnet pTestnetMagic | ||
where | ||
pMainnet :: Opt.Parser C.NetworkId | ||
pMainnet = | ||
Opt.flag' C.Mainnet | ||
( Opt.long "mainnet" | ||
<> Opt.help "Use the mainnet magic id." | ||
) | ||
|
||
pTestnetMagic :: Opt.Parser C.NetworkMagic | ||
pTestnetMagic = | ||
C.NetworkMagic <$> | ||
Opt.option Opt.auto | ||
( Opt.long "testnet-magic" | ||
<> Opt.metavar "NATURAL" | ||
<> Opt.help "Specify a testnet magic id." | ||
) | ||
|
||
opts :: Opt.ParserInfo Args | ||
opts = Opt.info (args Opt.<**> Opt.helper) | ||
( Opt.fullDesc | ||
<> Opt.header "marconi-mamba - Cardano blockchain indexer" ) | ||
|
||
main :: IO () | ||
main = do | ||
Args {socket, dbPath, networkId} <- Opt.execParser opts | ||
let indexers = I.combineIndexers [(I.utxoWorker Nothing, dbPath)] | ||
|
||
let chainPoint = C.ChainPointAtGenesis | ||
withChainSyncEventStream socket networkId chainPoint indexers |
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,64 @@ | ||
cabal-version: 3.0 | ||
name: marconi-mamba | ||
version: 0.1.0.0 | ||
license: Apache-2.0 | ||
license-files: | ||
LICENSE | ||
NOTICE | ||
|
||
author: Markus Läll | ||
maintainer: markus.lall@iohk.io | ||
homepage: https://github.com/input-output-hk/plutus-apps#readme | ||
bug-reports: https://github.com/input-output-hk/plutus-apps/issues | ||
description: | ||
Please see the README on GitHub at <https://github.com/input-output-hk/plutus-apps#readme> | ||
|
||
build-type: Simple | ||
|
||
source-repository head | ||
type: git | ||
location: https://github.com/input-output-hk/plutus-apps | ||
|
||
common lang | ||
default-language: Haskell2010 | ||
default-extensions: | ||
DeriveFoldable | ||
DeriveFunctor | ||
DeriveGeneric | ||
DeriveLift | ||
DeriveTraversable | ||
ExplicitForAll | ||
GeneralizedNewtypeDeriving | ||
ImportQualifiedPost | ||
ScopedTypeVariables | ||
StandaloneDeriving | ||
|
||
ghc-options: | ||
-Wall -Widentities -Wincomplete-record-updates | ||
-Wincomplete-uni-patterns -Wmissing-import-lists | ||
-Wnoncanonical-monad-instances -Wredundant-constraints | ||
-Wunused-packages | ||
|
||
executable marconi-mamba | ||
import: lang | ||
hs-source-dirs: app | ||
main-is: Main.hs | ||
|
||
-------------------- | ||
-- Local components | ||
-------------------- | ||
build-depends: | ||
, marconi | ||
, plutus-streaming | ||
|
||
-------------------------- | ||
-- Other IOG dependencies | ||
-------------------------- | ||
build-depends: cardano-api | ||
|
||
------------------------ | ||
-- Non-IOG dependencies | ||
------------------------ | ||
build-depends: | ||
, base >=4.9 && <5 | ||
, optparse-applicative |