-
Notifications
You must be signed in to change notification settings - Fork 135
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
api v2 #2
api v2 #2
Conversation
This pr implements this apiv2 proposal. This implementation uses option 1. (see proposal) for error reporting. I tried to implement option 3., but it turns out negative trait bounds would be required for differentiating result return types from non-result return types. Negative trait bounds are still a work in progress in rustc. |
Again, this pr relies on mimblewimble/grin#2596, so compilation will fail until that pr is accepted. |
Looks really good so far, very happy to see progress here and I'm going to keep checking out and testing locally as you go to provide more detailed feedback. Will have a think about the APIOwner naming. I think Igno indicated that we'll be addressing mimblewimble/grin#2596 once a couple of other things are in there. |
Add WIP JSON RPC handler for APIOwner via proc-macro generated API, using the easy-jsonrpc crate.
rust-secp has been updated now |
@bddap I've just completed some other chunks of work, so the V2 API is becoming the largest thing on my radar at the moment. Would you mind getting this to a state where it can be merged, then we can take that TODO list and turn it into a meta-issue and start tackling the work in parallel? |
@yeastplume sounds great. Glad to have help on this. I'll work on getting this to a mergeable state. Can you look into mimblewimble/grin#2659? It needs to be merged before this. |
@yeastplume Would there be value in make the api compatible with the appropriate parts of the open banking api's (https://openbanking.atlassian.net/wiki/spaces/DZ/pages/23363964/Read+Write+Data+API+Specifications) The banking sector in the UK is being forced to provide these apis and most other countries are heading down a similar route. Could simplify adoption by wallet providers? |
@bddap mimblewimble/grin#2659 was merged so let me know if there's anything else you need @graemes We decided that using JSON-RPC is more appropriate than providing rest APIs, and I don't think the crypto space in general is too concerned with banking data standards (given there are many challenges unique to crypto that wouldn't be addressed by them) so I don't think we'd gain anything by deciding to adhere to them. If anyone felt strongly about it I'm sure they could wrap our JSON-RPC api to conform. |
@yeastplume this pr is ready to merge. Couple more things to do post-mergeSome OwnerApi/ForeignApi doctests are kinda BS at the moment. They expect errors because the NodeClient they are testing against is not running.
Since we are updating APIs, now is a good time to step back and examine OwnerApi/ForeignApi methods. Which ones can we get rid of? Which ones should we change. @yeastplume you are probably well suited to that task.
|
@bddap Thanks, I'll merge this now then create another meta issue with all of the tasks The doctests were written when everyone is in the same crate, and including them now involves circular dependencies which we can't have due to crates.io requirements. I'd actually started an empty node client at some stage to try to get around it, will leave the task up as a todo |
* APIv2 Rewrite first draft Add WIP JSON RPC handler for APIOwner via proc-macro generated API, using the easy-jsonrpc crate. * patch dependency on grin core to get serializable errors * doctest ownerapi, update easyjsonrpc version * begin impl ForeignApi * mimblewimble/grin#2659 is merged, switch from using forked repo * write jsonrpc doctests for ForeignApi
This pr adds the ability to generate jsonrpc handlers for APIOwner and APIForeign via proceedural macro.
Since the handler generator is not specific to grin I've split it into its own crate, easy-jsonrpc. easy-jsonrpc provides a macro, jsonrpc_server, which decorates a trait definition and generates appropriate jsonrpc handlers.
This pr introduces a new trait, OwnerAPI, which the existing struct APIOwner implements. A new trait was added for several reasons:
TODO
OwnerAPI::accounts
for an example.Blockers
This pr requires mimblewimble/grin#2596, which implements serde for error types.