-
Notifications
You must be signed in to change notification settings - Fork 213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ListAddresses
, PutWallet
, PutWalletPassphrase
to the Servant API definition.
#125
Conversation
PutWallet
operation to the Servant API definition.PutWallet
and PutWalletPassphrase
to the Servant API definition.
52b9fe2
to
a055001
Compare
Arg! We agreed on the scope during the last meeting:
I've put the ticket in QA already; let's get these merged, but we can move on to something else now 👍 |
Nothing -> error $ | ||
"unable to find the definition for " <> show name <> " in the spec" | ||
Just schema -> | ||
return $ NamedSchema (Just name) schema |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'd even push it further and make it all "automagic" via a Typeable
instance 🤔 ?
PutWallet
and PutWalletPassphrase
to the Servant API definition.ListAddresses
, PutWallet
, PutWalletPassphrase
to the Servant API definition.
src/Cardano/Wallet/Api.hs
Outdated
@@ -24,8 +42,11 @@ type Api = Wallets | |||
type Wallets = | |||
DeleteWallet | |||
:<|> GetWallet | |||
:<|> ListAddresses |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea was to have groups matching the groups from the API specification 😅
So I'd suggest to have:
type Wallets =
DeleteWallet
:<|> GetWallet
:<|> ListWallets
:<|> PostWallet
:<|> PutWallet
:<|> PutWalletPassphrase
type Addresses =
listAddresses
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting! I was under the impression that the listAddresses
operation was within the wallets
group:
/wallets/{walletId}/addresses:
get:
operationId: listAddresses
Should we update the specification to move it to another group?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, the spec is correct here. Endpoints are grouped by tags
, cf:
https://github.com/input-output-hk/cardano-wallet/blob/master/specifications/api/swagger.yaml#L896
https://github.com/input-output-hk/cardano-wallet/blob/master/specifications/api/swagger.yaml#L844
So, even if, conceptually, the Address
resource is a sub-resource of the Wallet
resource, operations related to addresses are in a separate group to be easier to identify (same apply for transactions).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay! I've moved ListAddresses
to a separate group.
506fc0e
to
ffaaa0a
Compare
src/Cardano/Wallet/Api/Types.hs
Outdated
} deriving (Eq, Generic, Show) | ||
|
||
data AddressState = Used | Unused | ||
deriving (Eq, Generic, Show) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That, we want in our Primitive.Model
the same way we have other metadata about various core types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
src/Cardano/Wallet/Api/Types.hs
Outdated
instance FromJSON (ApiT P.Address) where | ||
parseJSON = | ||
parseJSON >=> | ||
maybe |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd drop the pointfree here and use a do-notation
to makes the reading a bit clearer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough :)
"state": "unused", | ||
"id": "Kgihnukc1UStfMcKxBjRew4jnt7Z53JAUiKZkw3XErXy9NTxZNfmVarXhP9rs99PDFFA" | ||
} | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really like we have golden tests for all types. It helps controlling the shape of the JSON objects right away 👌
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
{}, | ||
{}, | ||
{ | ||
"name": "ro8n&(V$]%dJ吚 (v]QSu1𩈾DfZ|*w?\\Iy,X%d9k}[𦴽YFJtW?7ZJv_-jYz_KpB`iE@$*4aV)`𠪚V`Q&0O7=ZmB<KG3Y5$\\>WO$1(/4子tmkNd;Zcte𥗼fay>nqh𨃮wQwW~u:`,pzhSB6|&~p}\"dS6🢓_3#*+f#5𠷓>:-Yq58Q_:𠷒as0/^j7;^BafT3I3y䖜jY0<CiwxqJ.Ofx<\" 1FDU9HrlD$7𨸴cEIq+*>~" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's the kind of name I imagine @piotr-iohk would use on a wallet yeah 😶
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Buried deep within this name is the character "䖜", which apparently is "the fighting sound made by two tigers" (https://en.wiktionary.org/wiki/%E4%96%9C)
I had interpreted the scope to be everything within issue #53, which states:
But now I notice that it also states (later on):
In which case I now understand your comment. :) In that case, perhaps we should update the the scope of issue #53, so that it no longer states "all endpoints"? |
@jonathanknowles Yes, let's update the scope. I mean, no big deal, we'll to get them done at some point. But I'd integrate endpoints incrementally and start implementing handlers and CLI commands for those we already have, so that we are able to deliver something already. |
Okay! |
Done. |
52fd12c
to
9776437
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
I've rebased and squashed on top of latest master
👍
9776437
to
b3baaae
Compare
Issue Number
Issue #118
Overview
ListAddresses
operation to the Servant API definition.PutWallet
operation to the Servant API definition.PutWalletPassphrase
operation to the Servant API definition.