near / near-jsonrpc-client-rs

Lower-level API for interfacing with the NEAR Protocol via JSONRPC.
https://docs.rs/near-jsonrpc-client
Apache License 2.0
47 stars 42 forks source link

Typed request/response #46

Open mfornet opened 2 years ago

mfornet commented 2 years ago

Looking at [this example](https://github.com/near/near-jsonrpc-client-rs/blob/master/examples/contract_view_method.rs) I wonder if we can have an updated interface, where if a CallFunction was used as a request, then the response is a CallResult and it is not required to match against QueryResponseKind.

miraclx commented 2 years ago

Yeah, that's one of the pain points of the type-system we've highlighted so far. I guess, semantically speaking, it sorta makes sense: as there are multiple types of query requests, so too there should be multiple types of query responses. However, we expect to smoothen out cases like that in the higher-level near-api-rs down the line.