Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(#400): ogmios provider #403

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/haskell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,11 @@ jobs:
- name: Generate documentation (cabal haddock)
run: cabal haddock --html --hyperlink-source --haddock-options="--use-unicode" --haddock-quickjump
- name: Upload haddock documentation
uses: actions/upload-pages-artifact@v1.0.8
uses: actions/upload-pages-artifact@v3.0.1
with:
path: ./dist-newstyle/build/x86_64-linux/ghc-9.6.5/${{env.ATLAS_VERSION}}/doc/html/atlas-cardano/
- name: Upload artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: source-distribution-file
name: source-distribution-file-${{ matrix.runs-on }}
path: ./dist-newstyle/sdist/${{env.ATLAS_VERSION}}.tar.gz
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 0.11.1

* Adds support of Ogmios-Kupo provider, see section on providers at https://atlas-app.io/getting-started/endpoints.
* `ToJSON` instance for `GYTxOutRefCbor`.
* New `GeniusYield.Debug` module to perform Atlas's operation from repl.

## 0.11.0

* Allows reference scripts to be of version greater than the minimum supported constrained version of `GYTxSkeleton`. Thanks [@SeungheonOh](https://github.com/SeungheonOh) for finding [this bug](https://github.com/geniusyield/atlas/issues/404)! Please visit the linked issue for more details.
Expand Down
3 changes: 2 additions & 1 deletion atlas-cardano.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 3.8
name: atlas-cardano
version: 0.11.0
version: 0.11.1
synopsis: Application backend for Plutus smart contracts on Cardano
description:
Atlas is an all-in-one, Haskell-native application backend for writing off-chain code for on-chain Plutus smart contracts.
Expand Down Expand Up @@ -85,6 +85,7 @@ library
GeniusYield.Providers.Kupo
GeniusYield.Providers.Maestro
GeniusYield.Providers.Node
GeniusYield.Providers.Ogmios
GeniusYield.Providers.Sentry
GeniusYield.ReadJSON
GeniusYield.Scripts.TestToken
Expand Down
30 changes: 30 additions & 0 deletions src/GeniusYield/GYConfig.hs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ module GeniusYield.GYConfig (
coreProviderIO,
findMaestroTokenAndNetId,
isNodeKupo,
isOgmiosKupo,
isMaestro,
isBlockfrost,
) where
Expand Down Expand Up @@ -43,6 +44,7 @@ import GeniusYield.Providers.Kupo qualified as KupoApi
import GeniusYield.Providers.Maestro qualified as MaestroApi
import GeniusYield.Providers.Node (nodeGetDRepState, nodeGetDRepsState, nodeStakeAddressInfo)
import GeniusYield.Providers.Node qualified as Node
import GeniusYield.Providers.Ogmios qualified as OgmiosApi
import GeniusYield.ReadJSON (readJSON)
import GeniusYield.Types

Expand All @@ -67,13 +69,15 @@ The supported providers. The options are:
In JSON format, this essentially corresponds to:

= { socketPath: FilePath, kupoUrl: string }
| { ogmiosUrl: string, kupoUrl: string }
| { maestroToken: string, turboSubmit: boolean }
| { blockfrostKey: string }

The constructor tags don't need to appear in the JSON.
-}
data GYCoreProviderInfo
= GYNodeKupo {cpiSocketPath :: !FilePath, cpiKupoUrl :: !Text}
| GYOgmiosKupo {cpiOgmiosUrl :: !Text, cpiKupoUrl :: !Text}
| GYMaestro {cpiMaestroToken :: !(Confidential Text), cpiTurboSubmit :: !(Maybe Bool)}
| GYBlockfrost {cpiBlockfrostKey :: !(Confidential Text)}
deriving stock Show
Expand All @@ -93,6 +97,10 @@ isNodeKupo :: GYCoreProviderInfo -> Bool
isNodeKupo GYNodeKupo {} = True
isNodeKupo _ = False

isOgmiosKupo :: GYCoreProviderInfo -> Bool
isOgmiosKupo GYOgmiosKupo {} = True
isOgmiosKupo _ = False

isMaestro :: GYCoreProviderInfo -> Bool
isMaestro GYMaestro {} = True
isMaestro _ = False
Expand Down Expand Up @@ -178,6 +186,28 @@ withCfgProviders
, nodeGetDRepsState info
, Node.nodeStakePools info
)
GYOgmiosKupo ogmiosUrl kupoUrl -> do
oEnv <- OgmiosApi.newOgmiosApiEnv $ Text.unpack ogmiosUrl
kEnv <- KupoApi.newKupoApiEnv $ Text.unpack kupoUrl
ogmiosSlotActions <- makeSlotActions slotCachingTime $ OgmiosApi.ogmiosGetSlotOfCurrentBlock oEnv
ogmiosGetParams <-
makeGetParameters
(OgmiosApi.ogmiosProtocolParameters oEnv)
(OgmiosApi.ogmiosStartTime oEnv)
(OgmiosApi.ogmiosEraSummaries oEnv)
(OgmiosApi.ogmiosGetSlotOfCurrentBlock oEnv)
pure
( ogmiosGetParams
, ogmiosSlotActions
, KupoApi.kupoQueryUtxo kEnv
, KupoApi.kupoLookupDatum kEnv
, OgmiosApi.ogmiosSubmitTx oEnv
, KupoApi.kupoAwaitTxConfirmed kEnv
, OgmiosApi.ogmiosStakeAddressInfo oEnv
, OgmiosApi.ogmiosGetDRepState oEnv
, OgmiosApi.ogmiosGetDRepsState oEnv
, OgmiosApi.ogmiosStakePools oEnv
)
GYMaestro (Confidential apiToken) turboSubmit -> do
maestroApiEnv <- MaestroApi.networkIdToMaestroEnv apiToken cfgNetworkId
maestroSlotActions <- makeSlotActions slotCachingTime $ MaestroApi.maestroGetSlotOfCurrentBlock maestroApiEnv
Expand Down
Loading
Loading