@fairmint/canton-node-sdk
Version:
Canton Node SDK
59 lines • 2.16 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.GetUpdateTrees = void 0;
const core_1 = require("../../../../../core");
const operations_1 = require("../../../schemas/operations");
/**
* @description Query update transactions tree list (blocking call)
* @example
* ```typescript
* const updateTrees = await client.getUpdateTrees({
* beginExclusive: 1000,
* endInclusive: 2000,
* limit: 100,
* streamIdleTimeoutMs: 5000,
* updateFormat: {
* includeTransactions: {
* eventFormat: {
* filtersByParty: {
* 'party1': { cumulative: [] }
* },
* verbose: true
* },
* transactionShape: 'TRANSACTION_SHAPE_ACS_DELTA'
* }
* }
* });
* ```
* @param beginExclusive - Beginning of the requested ledger section (non-negative integer)
* @param endInclusive - End of the requested ledger section (optional)
* @param limit - Maximum number of elements to return (optional)
* @param streamIdleTimeoutMs - Timeout to complete and send result if no new elements are received (optional)
* @param updateFormat - Update format for the request
*/
exports.GetUpdateTrees = (0, core_1.createApiOperation)({
paramsSchema: operations_1.GetUpdateTreesParamsSchema,
method: 'POST',
buildUrl: (params, apiUrl) => {
const baseUrl = `${apiUrl}/v2/updates/trees`;
const queryParams = new URLSearchParams();
if (params.limit !== undefined) {
queryParams.append('limit', params.limit.toString());
}
if (params.streamIdleTimeoutMs !== undefined) {
queryParams.append('stream_idle_timeout_ms', params.streamIdleTimeoutMs.toString());
}
const queryString = queryParams.toString();
return queryString ? `${baseUrl}?${queryString}` : baseUrl;
},
buildRequestData: (params) => {
// Build request body
const request = {
beginExclusive: params.beginExclusive,
endInclusive: params.endInclusive,
updateFormat: params.updateFormat,
};
return request;
},
});
//# sourceMappingURL=get-trees.js.map