Skip to content

Commit

Permalink
Merge pull request #46 from blockfrost/srk/chores
Browse files Browse the repository at this point in the history
Add missing lenses and `ToCapture` instances
  • Loading branch information
sorki committed Dec 28, 2023
2 parents 45bc0bf + dab1e87 commit f496978
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
12 changes: 11 additions & 1 deletion blockfrost-api/src/Blockfrost/API/Cardano/Utils.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module Blockfrost.API.Cardano.Utils
import Data.Text
import Servant.API
import Servant.API.Generic
import Servant.Docs (DocCapture (..), ToCapture (..))

import Blockfrost.Types.Cardano.Utils
import Blockfrost.Types.Shared.CBOR
Expand All @@ -23,7 +24,7 @@ data UtilsAPI route =
:> "xpub"
:> Capture "xpub" Text
:> Capture "role" Integer
:> Capture "Index" Integer
:> Capture "index" Integer
:> Get '[JSON] DerivedAddress

, _txEvaluate
Expand All @@ -48,3 +49,12 @@ data UtilsAPI route =
:> Post '[JSON] TxEval

} deriving (Generic)

instance ToCapture (Capture "role" Integer) where
toCapture _ = DocCapture "role" "Account role"

instance ToCapture (Capture "index" Integer) where
toCapture _ = DocCapture "index" "Address index"

instance ToCapture (Capture "xpub" Text) where
toCapture _ = DocCapture "xpub" "Hexadecimal xpub"
11 changes: 11 additions & 0 deletions blockfrost-api/src/Blockfrost/Lens.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ makeFields ''AccountDelegation
makeFields ''AccountRegistration
makeFields ''AccountWithdrawal
makeFields ''AccountMir
makeFields ''AddressAssociatedTotal

makeLensesWith blockfrostFieldRules ''AddressInfo
makeLensesWith blockfrostFieldRules ''AddressInfoExtended
makeFields ''AddressDetails
makeFields ''AddressUtxo
makeFields ''AddressTransaction
Expand All @@ -32,6 +34,7 @@ makeFields ''AssetMetadata
makeFields ''AssetHistory
makeFields ''AssetTransaction
makeFields ''AssetAddress
makeFields ''MetadataMediaFile

makeFields ''Block

Expand All @@ -53,6 +56,7 @@ makeFieldsNoPrefix ''NetworkEraSummary
makeFieldsNoPrefix ''NetworkEraBound
makeFieldsNoPrefix ''NetworkEraParameters

makeFields ''Pool
makeFields ''PoolEpoch
makeFields ''PoolInfo
makeFields ''PoolHistory
Expand All @@ -77,6 +81,12 @@ makeFields ''TransactionMetaJSON
makeFields ''TransactionMetaCBOR
makeFields ''TransactionRedeemer

makeFields ''DerivedAddress
makeFields ''TxEval
makeFields ''TxEvalBudget
makeFields ''TxEvalResult
makeFields ''TxEvalInput

makeLensesWith blockfrostFieldRules ''IPFSAdd
makeLensesWith blockfrostFieldRules ''IPFSPinChange
makeLensesWith blockfrostFieldRules ''IPFSPin
Expand All @@ -88,3 +98,4 @@ makeFields ''NutlinkTicker
-- * Shared
makeFields ''BlockIndex
makePrisms ''Amount
makePrisms ''AmountExtended

0 comments on commit f496978

Please sign in to comment.