Skip to content

Commit

Permalink
Remove 'certifying' type of redeemers in the API
Browse files Browse the repository at this point in the history
  I've mistakenly messed up when introducing this one originally an the type is plain wrong (it's Byron's certificate where it should be Shelley's). For now, the focus is on getting the balancing endpoint to work, and the case of redeemers for certificates is quite an edge-case, so it can be addressed in subsequent PRs.
  • Loading branch information
KtorZ committed Oct 12, 2021
1 parent 48aa861 commit 8ddd87c
Show file tree
Hide file tree
Showing 3 changed files with 2,251 additions and 3,163 deletions.
21 changes: 0 additions & 21 deletions lib/core/src/Cardano/Wallet/Api/Types.hs
Expand Up @@ -162,7 +162,6 @@ module Cardano.Wallet.Api.Types
, ApiBalanceTransactionPostData (..)
, ApiExternalInput (..)
, ApiRedeemer (..)
, ApiRedeemerCertificate (..)

-- * API Types (Byron)
, ApiByronWallet (..)
Expand Down Expand Up @@ -1022,16 +1021,8 @@ data ApiRedeemer (n :: NetworkDiscriminant)
= ApiRedeemerSpending ApiRedeemerData (ApiT TxIn)
| ApiRedeemerMinting ApiRedeemerData (ApiT W.TokenPolicyId)
| ApiRedeemerRewarding ApiRedeemerData (ApiT W.RewardAccount, Proxy n)
| ApiRedeemerCertifying ApiRedeemerData ApiRedeemerCertificate
deriving (Eq, Generic, Show)

data ApiRedeemerCertificate = ApiRedeemerCertificate
{ delegator :: !(ApiT (VerificationKey PaymentKey))
, delegate :: !(ApiT (VerificationKey PaymentKey))
, epochNumber :: !(ApiT EpochNo)
, signature :: !(ApiBytesT 'Base16 ByteString)
} deriving (Eq, Generic, Show)

instance ToJSON (ApiT (VerificationKey PaymentKey)) where
toJSON = toJSON . serialiseToBech32 . getApiT
instance FromJSON (ApiT (VerificationKey PaymentKey)) where
Expand Down Expand Up @@ -2744,8 +2735,6 @@ instance DecodeStakeAddress n => FromJSON (ApiRedeemer n) where
ApiRedeemerMinting bytes <$> (o .: "policy_id")
"rewarding" ->
ApiRedeemerRewarding bytes <$> (o .: "stake_address")
"certifying" ->
ApiRedeemerCertifying bytes <$> (o .: "certificate")
_ ->
fail "unknown purpose for redeemer."
instance EncodeStakeAddress n => ToJSON (ApiRedeemer n) where
Expand All @@ -2765,16 +2754,6 @@ instance EncodeStakeAddress n => ToJSON (ApiRedeemer n) where
, "data" .= bytes
, "stake_address" .= addr
]
ApiRedeemerCertifying bytes cert -> object
[ "purpose" .= ("certifying" :: Text)
, "data" .= bytes
, "certificate" .= cert
]

instance FromJSON ApiRedeemerCertificate where
parseJSON = genericParseJSON defaultRecordTypeOptions
instance ToJSON ApiRedeemerCertificate where
toJSON = genericToJSON defaultRecordTypeOptions

instance (DecodeStakeAddress n, DecodeAddress n)
=> FromJSON (ApiBalanceTransactionPostData n)
Expand Down

0 comments on commit 8ddd87c

Please sign in to comment.