I found 'Filterable map views' feature, how to use it?

I found ‘FIlterable map views’ feature from commit ab01dc123000c859c10609e77f3f0756403c5406, could you please give some example of its usage ?

4 Likes

The feature is visible in GraphIQL or in the Linera chain explorer

3 Likes

Hi @kikakkz,

The previous GraphQL API was structured in such a way that in order to see the value of a ‘map’ type object (such as chain(chainId: $chainId) { inboxes }) you had to know the keys somehow. This feature changes the API to add plural queries like

chain(chainId: $chainId) {
    inboxes {
        entries {
            key
        }
    }
}

It also adds filtering inputs to these queries like

chain(chainId: $chainId) {
    inboxes(inputs: { filters: … }) {
        …
    }
}

Currently the only filter we support is { keys: ["key1", "key2"] } to give a list of keys to which to restrict the query, but we plan to add more sophisticated queries in the future, as well as other inputs like pagination arguments.

As @ma2bd says, you can explore this new API in the GraphiQL IDE exported from the node service — in fact the motivation for this work was to make such exploration more accessible.

Thanks for your query! Does this answer your question satisfactorily?

— James Kay

2 Likes

@ma2bd @james.kay Thanks to reply. I’ll try the filter firstly, :smile:. We have a lot of scenarios to query with filter. Before I have to get all of them then filter in frontend.

@ma2bd @james.kay yeah, I can get some definition from GraphIQL. but when I try to look for the complex object, seems it’s not resolved (e.g. recipient in transfer function). could that also be supported to resolve complex object ?

GraphQL “scalar” objects are expected to be the JSON serialization of the corresponding Rust types. Right now, one has to look at the codebase but we have a task! Document the JSON-format of GraphQL scalars · Issue #1296 · linera-io/linera-protocol · GitHub

1 Like

We also have some work ongoing to resolve more complex objects in our GraphQL API and generally make connections between objects more immediate. #1269 is about resolving application APIs in the top-level GraphQL API, for example.

1 Like

understood~ for now i will check code to get the structure~