Grpcurl sample for TransactionService.GetTransactions in Canton 2.x
App Development4 posts70 views5 likesLast activity Jan 2025
WA
WallaceKellyOP
Jan 2025Is there a sample of using grpcurl to call the gRPC method TransactionService.GetTransactions. I’m having trouble getting the filters_by_party correct.
WA
WallaceKelly
Jan 2025Here is a sample payload:
{
"begin": {
"boundary": "LEDGER_BEGIN"
},
"filter": {
"filters_by_party": {
"alice::12205e2e474d5ca29ddcdd2cc9a48a05d8cc2ff66ab279314644ed0c2de8c411860e": {
"inclusive": {
"template_ids": [
{
"package_id": "41bf1be36c59d3eeb80168738d02b3590461f9faa4e94bddf44003080643bfb0",
"module_name": "Assets",
"entity_name": "Asset"
}
]
}
}
}
}
}
And a sample command:
cat queries/subscribe-by-templateIds.json \
| grpcurl --plaintext -d @ localhost:4001 \
com.daml.ledger.api.v1.TransactionService.GetTransactions
And a sample response:
{
"transactions": [
{
"transaction_id": "1220d14c94b4238d26c6684ba8ccf4e0e67b39ae6c11fa2a43cea66586268f44e7a5",
"command_id": "ff633431-a159-458d-b936-f1d428a93899",
"effective_at": "2025-01-14T13:22:20.026406Z",
"events": [
{
"created": {
"event_id": "#1220d14c94b4238d26c6684ba8ccf4e0e67b39ae6c11fa2a43cea66586268f44e7a5:0",
"contract_id": "00293dc5221330c8d7a93a13f5917da31b16563e57537277ff8fbd1f5d6ccce131ca031220dd6e6dfa0ce99ea713b26651d635da1071c92fa1bd664ea81a105e934f653942",
"template_id": {
"package_id": "41bf1be36c59d3eeb80168738d02b3590461f9faa4e94bddf44003080643bfb0",
"module_name": "Assets",
"entity_name": "Asset"
},
"create_arguments": {
"fields": [
{
"value": {
"party": "alice::12205e2e474d5ca29ddcdd2cc9a48a05d8cc2ff66ab279314644ed0c2de8c411860e"
}
},
{
"value": {
"party": "alice::12205e2e474d5ca29ddcdd2cc9a48a05d8cc2ff66ab279314644ed0c2de8c411860e"
}
},
{
"value": {
"text": "TV"
}
}
]
},
"witness_parties": [
"alice::12205e2e474d5ca29ddcdd2cc9a48a05d8cc2ff66ab279314644ed0c2de8c411860e"
],
"agreement_text": "",
"signatories": [
"alice::12205e2e474d5ca29ddcdd2cc9a48a05d8cc2ff66ab279314644ed0c2de8c411860e"
],
"created_at": "2025-01-14T13:22:20.026406Z"
}
}
],
"offset": "000000000000000007",
"trace_context": {
"traceparent": "00-20a4906246f1bb4d3d74dd69afdbc6f7-f013d2c976934b37-01"
}
}
]
}
This was done with 2.10.0-rc1.
SO
sormeter
Jan 2025For building up gRPC requests from the CLI, the tool grpcui can be useful
Spin up a grpcui instance against your running grpc service, then from the UI you can browse the available endpoints and see the payloads expected for each, and use the UI to generate the structure for you
daml sandbox
❯ grpcui --plaintext localhost:6865
{
"ledgerId": "someLedgerId",
"begin": {
"boundary": "LEDGER_BEGIN"
},
"filter": {
"filtersByParty": {
"someParty": {}
}
}
}
or with inclusive filters
WA
WallaceKelly
Jan 2025

