@fairmint/canton-node-sdk
Version:
Canton Node SDK
46 lines • 1.88 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.GetTransactionTreeById = exports.GetTransactionTreeByIdParamsSchema = void 0;
const zod_1 = require("zod");
const core_1 = require("../../../../../core");
const endpoint = '/v2/updates/transaction-tree-by-id/{update-id}';
exports.GetTransactionTreeByIdParamsSchema = zod_1.z.object({
updateId: zod_1.z.string(),
verbose: zod_1.z.boolean().optional(),
parties: zod_1.z.array(zod_1.z.string()).optional(),
});
/**
* Retrieves transaction tree data by update ID
*
* @example
* ```typescript
* const transactionTree = await client.getTransactionTreeById({
* updateId: '1220d01cce13fa797bad7de3ea61e919b20dce545d41f05e026ec4b65f1a61c71215',
* parties: ['party1', 'party2']
* });
* ```;
*
* @param updateId - The update ID to retrieve transaction tree for
* @param parties - Optional array of party IDs to filter transactions by
*/
exports.GetTransactionTreeById = (0, core_1.createApiOperation)({
paramsSchema: exports.GetTransactionTreeByIdParamsSchema,
method: 'GET',
buildUrl: (params, apiUrl, client) => {
const currentPartyId = client.getPartyId();
const readParties = Array.from(new Set([currentPartyId, ...(params.parties ?? [])]));
const baseUrl = `${apiUrl}${endpoint.replace('{update-id}', params.updateId)}`;
const queryParams = new URLSearchParams();
if (readParties.length > 0) {
readParties.forEach((party) => {
queryParams.append('parties', party);
});
}
if (params.verbose) {
queryParams.set('verbose', params.verbose.toString());
}
const queryString = queryParams.toString();
return queryString ? `${baseUrl}?${queryString}` : baseUrl;
},
});
//# sourceMappingURL=get-transaction-tree-by-id.js.map