Skip to content

Commit

Permalink
update swagger postAnyAddress description including timelocks and cor…
Browse files Browse the repository at this point in the history
…rect FromJSON of ApiSharedWaller

more swagger polishing
  • Loading branch information
paweljakubas committed Apr 8, 2021
1 parent 456eba2 commit 1dcdf51
Show file tree
Hide file tree
Showing 7 changed files with 5,400 additions and 1,526 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -24,6 +24,7 @@ cabal.sandbox.config
.ghci
*.tix
hie.yaml
stack.yaml.lock

### Nix ###
result*
Expand Down
10 changes: 7 additions & 3 deletions lib/core/src/Cardano/Wallet/Api/Types.hs
Expand Up @@ -1056,6 +1056,7 @@ data ApiSharedWalletPostData = ApiSharedWalletPostData
, paymentScriptTemplate :: !ScriptTemplate
, delegationScriptTemplate :: !(Maybe ScriptTemplate)
} deriving (Eq, Generic, Show)
deriving anyclass NFData

data ApiActiveSharedWallet = ApiActiveSharedWallet
{ id :: !(ApiT WalletId)
Expand Down Expand Up @@ -1086,16 +1087,19 @@ data ApiPendingSharedWallet = ApiPendingSharedWallet
data ApiSharedWallet = ApiSharedWallet
{ wallet :: Either ApiPendingSharedWallet ApiActiveSharedWallet
} deriving (Eq, Generic, Show)
deriving anyclass NFData

data ApiScriptTemplateUpdate =
PaymentScriptTemplate | DelegationScriptTemplate | BothScriptTemplates
deriving (Eq, Generic, Show, Bounded, Enum)
deriving (Eq, Generic, Show, Bounded, Enum)
deriving anyclass NFData

data ApiSharedWalletPatchData = ApiSharedWalletPatchData
{ cosigner :: !(ApiT Cosigner)
, accountPublicKey :: !ApiAccountPublicKey
, scriptTemplateUpdate :: !ApiScriptTemplateUpdate
} deriving (Eq, Generic, Show)
deriving anyclass NFData

-- | Error codes returned by the API, in the form of snake_cased strings
data ApiErrorCode
Expand Down Expand Up @@ -2317,8 +2321,8 @@ instance ToJSON ApiPendingSharedWallet where
instance FromJSON ApiSharedWallet where
parseJSON obj = do
balance <-
(withObject "postData" $
\o -> o .:? "balance" :: Aeson.Parser (Maybe ApiActiveSharedWallet)) obj
(withObject "ActiveSharedWallet" $
\o -> o .:? "balance" :: Aeson.Parser (Maybe ApiWalletBalance)) obj
case balance of
Nothing -> do
xs <- parseJSON obj :: Aeson.Parser ApiPendingSharedWallet
Expand Down

0 comments on commit 1dcdf51

Please sign in to comment.