@fairmint/canton-node-sdk
Version:
Canton Node SDK
46 lines • 1.85 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.GetTransactionTreeByOffset = exports.GetTransactionTreeByOffsetParamsSchema = void 0;
const zod_1 = require("zod");
const core_1 = require("../../../../../core");
const endpoint = '/v2/updates/transaction-tree-by-offset/{offset}';
exports.GetTransactionTreeByOffsetParamsSchema = zod_1.z.object({
offset: zod_1.z.string(),
verbose: zod_1.z.boolean().optional(),
parties: zod_1.z.array(zod_1.z.string()).optional(),
});
/**
* Retrieves transaction tree data starting from a specific offset
*
* @example
* ```typescript
* const transactionTree = await client.getTransactionTreeByOffset({
* offset: '1000',
* parties: ['party1', 'party2']
* });
* ```;
*
* @param offset - The starting offset for transaction retrieval
* @param parties - Optional array of party IDs to filter transactions by
*/
exports.GetTransactionTreeByOffset = (0, core_1.createApiOperation)({
paramsSchema: exports.GetTransactionTreeByOffsetParamsSchema,
method: 'GET',
buildUrl: (params, apiUrl, client) => {
const currentPartyId = client.getPartyId();
const readParties = Array.from(new Set([currentPartyId, ...(params.parties ?? [])]));
const baseUrl = `${apiUrl}${endpoint.replace('{offset}', params.offset)}`;
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-offset.js.map