-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
style: handle fourmolu suggestions...
- Loading branch information
1 parent
96c77c8
commit cef00a8
Showing
11 changed files
with
173 additions
and
156 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 |
---|---|---|
|
@@ -158,21 +158,21 @@ assetPairToKVT ac i = K.fromText (f ac) Aeson..= toUrlPiece i | |
|
||
instance Swagger.ToSchema GYBalance where | ||
declareNamedSchema _ = do | ||
pure $ | ||
Swagger.named "GYBalance" $ | ||
mempty | ||
& Swagger.type_ | ||
?~ Swagger.SwaggerObject | ||
& Swagger.example | ||
?~ toJSON | ||
( GYBalance $ | ||
valueFromList | ||
[ (GYLovelace, 22), | ||
(GYToken "ff80aaaf03a273b8f5c558168dc0e2377eea810badbae6eceefc14ef" "GOLD", 101) | ||
] | ||
) | ||
& Swagger.description | ||
?~ "A multi asset quantity, represented as map where each key represents an asset: policy ID and token name in hex concatenated by a dot." | ||
pure | ||
$ Swagger.named "GYBalance" | ||
$ mempty | ||
& Swagger.type_ | ||
?~ Swagger.SwaggerObject | ||
& Swagger.example | ||
?~ toJSON | ||
( GYBalance | ||
$ valueFromList | ||
[ (GYLovelace, 22), | ||
(GYToken "ff80aaaf03a273b8f5c558168dc0e2377eea810badbae6eceefc14ef" "GOLD", 101) | ||
] | ||
) | ||
& Swagger.description | ||
?~ "A multi asset quantity, represented as map where each key represents an asset: policy ID and token name in hex concatenated by a dot." | ||
|
||
------------------------------------------------------------------------------- | ||
-- Server's API. | ||
|
@@ -218,49 +218,49 @@ geniusYieldAPIOpenApi ∷ OpenApi | |
geniusYieldAPIOpenApi = | ||
toOpenApi geniusYieldAPI | ||
& info | ||
. title | ||
.~ "GeniusYield DEX Server API" | ||
& info | ||
. title | ||
.~ "GeniusYield DEX Server API" | ||
& info | ||
. version | ||
.~ "0.0.1" | ||
& info | ||
.~ "0.0.1" | ||
& info | ||
. license | ||
?~ ("Apache-2.0" & url ?~ URL "https://opensource.org/licenses/apache-2-0") | ||
& info | ||
?~ ("Apache-2.0" & url ?~ URL "https://opensource.org/licenses/apache-2-0") | ||
& info | ||
. contact | ||
?~ ( mempty | ||
& url | ||
?~ URL "https://www.geniusyield.co/" | ||
?~ ( mempty | ||
& url | ||
?~ URL "https://www.geniusyield.co/" | ||
?~ "[email protected]" | ||
?~ "[email protected]" | ||
& name | ||
?~ "GeniusYield Technical Support" | ||
) | ||
& info | ||
?~ "GeniusYield Technical Support" | ||
) | ||
& info | ||
. description | ||
?~ "API to interact with GeniusYield DEX." | ||
& applyTagsFor (subOperations (Proxy ∷ Proxy ("tx" +> TxAPI)) (Proxy ∷ Proxy GeniusYieldAPI)) ["Transaction" & description ?~ "Endpoints related to transaction hex such as submitting a transaction"] | ||
& applyTagsFor (subOperations (Proxy ∷ Proxy ("markets" +> MarketsAPI)) (Proxy ∷ Proxy GeniusYieldAPI)) ["Markets" & description ?~ "Endpoints related to accessing markets information"] | ||
& applyTagsFor (subOperations (Proxy ∷ Proxy ("orders" +> OrdersAPI)) (Proxy ∷ Proxy GeniusYieldAPI)) ["Orders" & description ?~ "Endpoints related to interacting with orders"] | ||
& applyTagsFor (subOperations (Proxy ∷ Proxy ("settings" +> SettingsAPI)) (Proxy ∷ Proxy GeniusYieldAPI)) ["Settings" & description ?~ "Endpoint to get server settings such as network, version, and revision"] | ||
& applyTagsFor (subOperations (Proxy ∷ Proxy ("trading-fees" +> TradingFeesAPI)) (Proxy ∷ Proxy GeniusYieldAPI)) ["Trading Fees" & description ?~ "Endpoint to get trading fees of DEX."] | ||
& applyTagsFor (subOperations (Proxy ∷ Proxy ("assets" +> AssetsAPI)) (Proxy ∷ Proxy GeniusYieldAPI)) ["Assets" & description ?~ "Endpoint to fetch asset details."] | ||
& applyTagsFor (subOperations (Proxy ∷ Proxy ("order-books" +> OrderBookAPI)) (Proxy ∷ Proxy GeniusYieldAPI)) ["Order Book" & description ?~ "Endpoint to fetch order book."] | ||
& applyTagsFor (subOperations (Proxy ∷ Proxy ("historical-prices" +> HistoricalPricesAPI)) (Proxy ∷ Proxy GeniusYieldAPI)) ["Historical Prices" & description ?~ "Endpoints to fetch historical prices."] | ||
& applyTagsFor (subOperations (Proxy ∷ Proxy ("balances" +> BalancesAPI)) (Proxy ∷ Proxy GeniusYieldAPI)) ["Balances" & description ?~ "Endpoint to fetch token balances."] | ||
?~ "API to interact with GeniusYield DEX." | ||
& applyTagsFor (subOperations (Proxy ∷ Proxy ("tx" +> TxAPI)) (Proxy ∷ Proxy GeniusYieldAPI)) ["Transaction" & description ?~ "Endpoints related to transaction hex such as submitting a transaction"] | ||
& applyTagsFor (subOperations (Proxy ∷ Proxy ("markets" +> MarketsAPI)) (Proxy ∷ Proxy GeniusYieldAPI)) ["Markets" & description ?~ "Endpoints related to accessing markets information"] | ||
& applyTagsFor (subOperations (Proxy ∷ Proxy ("orders" +> OrdersAPI)) (Proxy ∷ Proxy GeniusYieldAPI)) ["Orders" & description ?~ "Endpoints related to interacting with orders"] | ||
& applyTagsFor (subOperations (Proxy ∷ Proxy ("settings" +> SettingsAPI)) (Proxy ∷ Proxy GeniusYieldAPI)) ["Settings" & description ?~ "Endpoint to get server settings such as network, version, and revision"] | ||
& applyTagsFor (subOperations (Proxy ∷ Proxy ("trading-fees" +> TradingFeesAPI)) (Proxy ∷ Proxy GeniusYieldAPI)) ["Trading Fees" & description ?~ "Endpoint to get trading fees of DEX."] | ||
& applyTagsFor (subOperations (Proxy ∷ Proxy ("assets" +> AssetsAPI)) (Proxy ∷ Proxy GeniusYieldAPI)) ["Assets" & description ?~ "Endpoint to fetch asset details."] | ||
& applyTagsFor (subOperations (Proxy ∷ Proxy ("order-books" +> OrderBookAPI)) (Proxy ∷ Proxy GeniusYieldAPI)) ["Order Book" & description ?~ "Endpoint to fetch order book."] | ||
& applyTagsFor (subOperations (Proxy ∷ Proxy ("historical-prices" +> HistoricalPricesAPI)) (Proxy ∷ Proxy GeniusYieldAPI)) ["Historical Prices" & description ?~ "Endpoints to fetch historical prices."] | ||
& applyTagsFor (subOperations (Proxy ∷ Proxy ("balances" +> BalancesAPI)) (Proxy ∷ Proxy GeniusYieldAPI)) ["Balances" & description ?~ "Endpoint to fetch token balances."] | ||
|
||
geniusYieldServer ∷ Ctx → ServerT GeniusYieldAPI IO | ||
geniusYieldServer ctx = | ||
ignoredAuthResult $ | ||
handleSettings ctx | ||
:<|> handleOrdersApi ctx | ||
:<|> handleMarketsApi ctx | ||
:<|> handleTxApi ctx | ||
:<|> handleTradingFeesApi ctx | ||
:<|> handleAssetsApi ctx | ||
:<|> handleOrderBookApi ctx | ||
:<|> handleHistoricalPricesApi ctx | ||
:<|> handleBalancesApi ctx | ||
ignoredAuthResult | ||
$ handleSettings ctx | ||
:<|> handleOrdersApi ctx | ||
:<|> handleMarketsApi ctx | ||
:<|> handleTxApi ctx | ||
:<|> handleTradingFeesApi ctx | ||
:<|> handleAssetsApi ctx | ||
:<|> handleOrderBookApi ctx | ||
:<|> handleHistoricalPricesApi ctx | ||
:<|> handleBalancesApi ctx | ||
where | ||
ignoredAuthResult f _authResult = f | ||
|
||
|
@@ -341,8 +341,8 @@ handleOrderBookApi ctx@Ctx {..} orderAssetPair mownAddress = do | |
) | ||
([] :!: []) | ||
os' | ||
pure $ | ||
OrderBookInfo | ||
pure | ||
$ OrderBookInfo | ||
{ obiMarketPairId = orderAssetPair, | ||
obiTimestamp = gytime, | ||
obiAsks = sortBy (\a b → compare (oiPrice a) (oiPrice b)) asks, -- sort by increasing price | ||
|
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
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
Oops, something went wrong.