Skip to content
CCPEDIAby Unity Nodes
Discussions/App Development/Is it possible to FetchByContractKey when using the gRPC Ledger API?Forum ↗

Is it possible to FetchByContractKey when using the gRPC Ledger API?

App Development4 posts486 views3 likesLast activity Dec 2023
LA
lashenhurstOP
Aug 2021

Hi all,

I’m looking through the Ledger API reference documentation, and I’m not seeing any functionality where I can query the ledger with a contract key.

Is this possible? Or do I really have to go through the Active Contracts Set and filter down until I get what I’m looking for?

Thanks in advance!

CO
cocreature
Aug 2021

At the moment that’s not possible, you have to go via the active contract set. The JSON API supports this more efficiently or you could build up your own index client-side to make that more efficient.

LA
lashenhurst
Aug 2021

I hope this is reasonably high on the priority list. Imagine looking for one contract in tens of thousands, and having to filter through all of them to respond to a user request, and the JSON API is no use to you because it doesn’t support pagination, so you can’t respond when the user requests a list of objects without dumping all tens of thousands in to your application’s memory.

A_
a_putkov
Dec 2023

Update for posterity on this old thread. The capability to retrieve a contract by contract key was indeed introduced in the Ledger API. The documentation is available following the link below. Ledger API Reference — Daml SDK 2.7.6 documentation

← Back to Discussions