Skip to content

Commit

Permalink
feat: update path for orders interaction
Browse files Browse the repository at this point in the history
Closes: #21
  • Loading branch information
sourabhxyz committed Mar 5, 2024
1 parent c81b960 commit 74b3216
Show file tree
Hide file tree
Showing 3 changed files with 598 additions and 5 deletions.
9 changes: 5 additions & 4 deletions geniusyield-orderbot/src/GeniusYield/OrderBot/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,12 @@ instance FromJSON OrderAssetPair where
-- >>> toUrlPiece $ OAssetPair {currencyAsset = GYLovelace, commodityAsset = GYToken "f43a62fdc3965df486de8a0d32fe800963589c41b38946602a0dc535" "AGIX"}
-- "_f43a62fdc3965df486de8a0d32fe800963589c41b38946602a0dc535.41474958"
instance ToHttpApiData OrderAssetPair where
toUrlPiece OAssetPair {..} = toUrlPiece' currencyAsset <> "_" <> toUrlPiece' commodityAsset
toUrlPiece OAssetPair {..} = toUrlPiece currencyAsset <> "_" <> toUrlPiece commodityAsset
where
toUrlPiece' t = case toUrlPiece t of
"lovelace" ""
anyOther anyOther

-- toUrlPiece' t = case toUrlPiece t of
-- "lovelace" → ""
-- anyOther → anyOther

-- >>> parseUrlPiece "f43a62fdc3965df486de8a0d32fe800963589c41b38946602a0dc535.41474958_f43a62fdc3965df486de8a0d32fe800963589c41b38946602a0dc535.41474958" :: Either Text OrderAssetPair
-- Right (OAssetPair {currencyAsset = GYToken "f43a62fdc3965df486de8a0d32fe800963589c41b38946602a0dc535" "AGIX", commodityAsset = GYToken "f43a62fdc3965df486de8a0d32fe800963589c41b38946602a0dc535" "AGIX"})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,15 @@ type DEXPartialOrderAPI =
"trading_fees"
:> Get '[JSON] TradingFees
:<|> "orders"
:> "place"
:> "open"
:> "tx"
:> "generate"
:> ReqBody '[JSON] PlaceOrderRequest
:> Post '[JSON] PlaceOrderResponse
:<|> "orders"
:> "cancel"
:> "tx"
:> "generate"
:> ReqBody '[JSON] CancelOrderRequest
:> Post '[JSON] CancelOrderResponse
:<|> "orders"
Expand Down
Loading

0 comments on commit 74b3216

Please sign in to comment.