Get active Canton contracts
Reads the active contracts of a vault account’s Canton wallet. The body mirrors Canton’s POST /v2/state/active-contracts eventFormat, see https://cantonfoundation.mintlify.app/reference/json-api-reference/post-v2stateactive-contracts
filtersByPartymust hold exactly one key, and it must be the vault account’s own Canton party. Get it from the vault’s Canton deposit address.filtersForAnyParty,activeAtOffsetand paging are not supported.cumulativeholds 1 to 20 filters.- Template and interface ids are in package-name form,
#package-name:Module:Entity. - The read is at the current ledger end. No ledger offset,
hasMoreor page token is returned. - At most 1000 contracts, about 3 MiB in total, are returned. There is no paging yet. When more than 1000 contracts match, or the matching contracts are larger than about 3 MiB in total, the answer is 400: narrow the filter.
- A filter that names a template or interface id the ledger does not know is a 400: check the ids.
createArgumentis free-form and depends on the template.
POST
/
operations
/
canton
/
active_contracts
TypeScript
const response: Promise<FireblocksResponse<ActiveContractsResponse>> = fireblocks.cantonBeta.getCantonActiveContracts(cantonBetaApiGetCantonActiveContractsRequest);CompletableFuture<ApiResponse<ActiveContractsResponse>> response = fireblocks.cantonBeta().getCantonActiveContracts(activeContractsRequest, idempotencyKey);response = fireblocks.canton_beta.get_canton_active_contracts(active_contracts_request, idempotency_key);curl --request POST \
--url https://api.fireblocks.io/v1/operations/canton/active_contracts \
--header 'Content-Type: application/json' \
--data '
{
"vaultAccountId": "12",
"blockchainId": "CANTON",
"payload": {
"eventFormat": {
"filtersByParty": {
"placeholder-vault-party": {
"cumulative": [
{
"identifierFilter": {
"TemplateFilter": {
"value": {
"templateId": "#my-package:MyModule:MyTemplate",
"includeCreatedEventBlob": false
}
}
}
}
]
}
}
}
}
}
'const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
vaultAccountId: '12',
blockchainId: 'CANTON',
payload: {
eventFormat: {
filtersByParty: {
'placeholder-vault-party': {
cumulative: [
{
identifierFilter: {
TemplateFilter: {
value: {templateId: '#my-package:MyModule:MyTemplate', includeCreatedEventBlob: false}
}
}
}
]
}
}
}
}
})
};
fetch('https://api.fireblocks.io/v1/operations/canton/active_contracts', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.fireblocks.io/v1/operations/canton/active_contracts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'vaultAccountId' => '12',
'blockchainId' => 'CANTON',
'payload' => [
'eventFormat' => [
'filtersByParty' => [
'placeholder-vault-party' => [
'cumulative' => [
[
'identifierFilter' => [
'TemplateFilter' => [
'value' => [
'templateId' => '#my-package:MyModule:MyTemplate',
'includeCreatedEventBlob' => false
]
]
]
]
]
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.fireblocks.io/v1/operations/canton/active_contracts"
payload := strings.NewReader("{\n \"vaultAccountId\": \"12\",\n \"blockchainId\": \"CANTON\",\n \"payload\": {\n \"eventFormat\": {\n \"filtersByParty\": {\n \"placeholder-vault-party\": {\n \"cumulative\": [\n {\n \"identifierFilter\": {\n \"TemplateFilter\": {\n \"value\": {\n \"templateId\": \"#my-package:MyModule:MyTemplate\",\n \"includeCreatedEventBlob\": false\n }\n }\n }\n }\n ]\n }\n }\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}require 'uri'
require 'net/http'
url = URI("https://api.fireblocks.io/v1/operations/canton/active_contracts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"vaultAccountId\": \"12\",\n \"blockchainId\": \"CANTON\",\n \"payload\": {\n \"eventFormat\": {\n \"filtersByParty\": {\n \"placeholder-vault-party\": {\n \"cumulative\": [\n {\n \"identifierFilter\": {\n \"TemplateFilter\": {\n \"value\": {\n \"templateId\": \"#my-package:MyModule:MyTemplate\",\n \"includeCreatedEventBlob\": false\n }\n }\n }\n }\n ]\n }\n }\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"activeContracts": []
}{
"message": "<string>",
"code": 123
}{
"message": "<string>",
"code": 123
}{
"message": "<string>",
"code": 123
}{
"message": "<string>",
"code": 123
}Headers
Body
application/json
Which vault account and blockchain to read, and the Canton filter to apply.
Response
The active contracts at the current ledger end.
The active contracts at the current ledger end. Not paged, and no ledger offset is returned.
Was this page helpful?
⌘I
TypeScript
const response: Promise<FireblocksResponse<ActiveContractsResponse>> = fireblocks.cantonBeta.getCantonActiveContracts(cantonBetaApiGetCantonActiveContractsRequest);CompletableFuture<ApiResponse<ActiveContractsResponse>> response = fireblocks.cantonBeta().getCantonActiveContracts(activeContractsRequest, idempotencyKey);response = fireblocks.canton_beta.get_canton_active_contracts(active_contracts_request, idempotency_key);curl --request POST \
--url https://api.fireblocks.io/v1/operations/canton/active_contracts \
--header 'Content-Type: application/json' \
--data '
{
"vaultAccountId": "12",
"blockchainId": "CANTON",
"payload": {
"eventFormat": {
"filtersByParty": {
"placeholder-vault-party": {
"cumulative": [
{
"identifierFilter": {
"TemplateFilter": {
"value": {
"templateId": "#my-package:MyModule:MyTemplate",
"includeCreatedEventBlob": false
}
}
}
}
]
}
}
}
}
}
'const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
vaultAccountId: '12',
blockchainId: 'CANTON',
payload: {
eventFormat: {
filtersByParty: {
'placeholder-vault-party': {
cumulative: [
{
identifierFilter: {
TemplateFilter: {
value: {templateId: '#my-package:MyModule:MyTemplate', includeCreatedEventBlob: false}
}
}
}
]
}
}
}
}
})
};
fetch('https://api.fireblocks.io/v1/operations/canton/active_contracts', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.fireblocks.io/v1/operations/canton/active_contracts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'vaultAccountId' => '12',
'blockchainId' => 'CANTON',
'payload' => [
'eventFormat' => [
'filtersByParty' => [
'placeholder-vault-party' => [
'cumulative' => [
[
'identifierFilter' => [
'TemplateFilter' => [
'value' => [
'templateId' => '#my-package:MyModule:MyTemplate',
'includeCreatedEventBlob' => false
]
]
]
]
]
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.fireblocks.io/v1/operations/canton/active_contracts"
payload := strings.NewReader("{\n \"vaultAccountId\": \"12\",\n \"blockchainId\": \"CANTON\",\n \"payload\": {\n \"eventFormat\": {\n \"filtersByParty\": {\n \"placeholder-vault-party\": {\n \"cumulative\": [\n {\n \"identifierFilter\": {\n \"TemplateFilter\": {\n \"value\": {\n \"templateId\": \"#my-package:MyModule:MyTemplate\",\n \"includeCreatedEventBlob\": false\n }\n }\n }\n }\n ]\n }\n }\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}require 'uri'
require 'net/http'
url = URI("https://api.fireblocks.io/v1/operations/canton/active_contracts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"vaultAccountId\": \"12\",\n \"blockchainId\": \"CANTON\",\n \"payload\": {\n \"eventFormat\": {\n \"filtersByParty\": {\n \"placeholder-vault-party\": {\n \"cumulative\": [\n {\n \"identifierFilter\": {\n \"TemplateFilter\": {\n \"value\": {\n \"templateId\": \"#my-package:MyModule:MyTemplate\",\n \"includeCreatedEventBlob\": false\n }\n }\n }\n }\n ]\n }\n }\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"activeContracts": []
}{
"message": "<string>",
"code": 123
}{
"message": "<string>",
"code": 123
}{
"message": "<string>",
"code": 123
}{
"message": "<string>",
"code": 123
}