@canton-network/core-ledger-client 0.27.0 → 0.27.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/acs/acs-helper.d.ts +4 -4
- package/dist/acs/acs-helper.d.ts.map +1 -1
- package/dist/amulet-service.d.ts.map +1 -1
- package/dist/index.cjs +90 -250
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +83 -247
- package/dist/index.js.map +1 -1
- package/dist/ledger-api-utils.d.ts +0 -20
- package/dist/ledger-api-utils.d.ts.map +1 -1
- package/dist/ledger-client.d.ts +12 -2
- package/dist/ledger-client.d.ts.map +1 -1
- package/dist/token-standard-service.d.ts +3 -3
- package/dist/token-standard-service.d.ts.map +1 -1
- package/dist/txparse/parser.d.ts +2 -2
- package/dist/txparse/parser.d.ts.map +1 -1
- package/dist/txparse/types.d.ts +3 -3
- package/dist/txparse/types.d.ts.map +1 -1
- package/package.json +7 -6
- package/dist/generated-clients/asyncapi-3.4.7.d.ts +0 -994
- package/dist/generated-clients/asyncapi-3.4.7.d.ts.map +0 -1
- package/dist/generated-clients/openapi-3.3.0-SNAPSHOT.d.ts +0 -6114
- package/dist/generated-clients/openapi-3.3.0-SNAPSHOT.d.ts.map +0 -1
- package/dist/generated-clients/openapi-3.4.7.d.ts +0 -7143
- package/dist/generated-clients/openapi-3.4.7.d.ts.map +0 -1
- package/dist/web-socket-client.d.ts +0 -44
- package/dist/web-socket-client.d.ts.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
export * from './token-standard-service.js';
|
|
2
2
|
export { AmuletService } from './amulet-service.js';
|
|
3
3
|
export * from './ledger-client.js';
|
|
4
|
-
export * from './generated-clients/openapi-3.3.0-SNAPSHOT.js';
|
|
5
4
|
export * from './acs/acs-container.js';
|
|
6
5
|
export * from './acs/ws-support.js';
|
|
7
6
|
export type { Transaction, TokenStandardEvent, Holding, HoldingLock, HoldingsChange, HoldingsChangeSummary, TransferInstructionView, TokenStandardChoice, PrettyTransactions, PrettyContract, ViewValue, Label, TransferIn, TransferOut, MergeSplit, Burn, Mint, Unlock, ExpireDust, RawArchive, RawCreate, } from './txparse/types.js';
|
|
8
7
|
export { TransactionParser } from './txparse/parser.js';
|
|
9
8
|
export { TokenStandardTransactionInterfaces } from './constants.js';
|
|
10
9
|
export { awaitCompletion, promiseWithTimeout, isJsCantonError, asJsCantonError, JsCantonError, JSContractEntry, defaultRetryableOptions, } from './ledger-api-utils.js';
|
|
11
|
-
export * from '
|
|
12
|
-
export { GetUpdatesRequest, JsGetUpdatesResponse, CompletionResponse, } from './generated-clients/asyncapi-3.4.7.js';
|
|
10
|
+
export * from '@canton-network/core-ledger-client-types';
|
|
13
11
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,cAAc,6BAA6B,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,cAAc,oBAAoB,CAAA;AAClC,cAAc
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,cAAc,6BAA6B,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,cAAc,oBAAoB,CAAA;AAClC,cAAc,wBAAwB,CAAA;AACtC,cAAc,qBAAqB,CAAA;AACnC,YAAY,EACR,WAAW,EACX,kBAAkB,EAClB,OAAO,EACP,WAAW,EACX,cAAc,EACd,qBAAqB,EACrB,uBAAuB,EACvB,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,SAAS,EACT,KAAK,EACL,UAAU,EACV,WAAW,EACX,UAAU,EACV,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,UAAU,EACV,UAAU,EACV,SAAS,GACZ,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,EAAE,kCAAkC,EAAE,MAAM,gBAAgB,CAAA;AAEnE,OAAO,EACH,eAAe,EACf,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,aAAa,EACb,eAAe,EACf,uBAAuB,GAC1B,MAAM,uBAAuB,CAAA;AAE9B,cAAc,0CAA0C,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { HOLDING_INTERFACE_ID, TRANSFER_FACTORY_INTERFACE_ID, TRANSFER_INSTRUCTION_INTERFACE_ID, ALLOCATION_FACTORY_INTERFACE_ID, ALLOCATION_INSTRUCTION_INTERFACE_ID, ALLOCATION_INTERFACE_ID, ALLOCATION_REQUEST_INTERFACE_ID, TokenStandardClient, FEATURED_APP_DELEGATE_PROXY_INTERFACE_ID } from '@canton-network/core-token-standard';
|
|
2
|
+
import { EventFilterBySetup } from '@canton-network/core-ledger-client-types';
|
|
3
|
+
export * from '@canton-network/core-ledger-client-types';
|
|
2
4
|
import { ErrorInfo, RetryInfo } from '@canton-network/core-ledger-proto';
|
|
3
5
|
import BigNumber from 'bignumber.js';
|
|
4
6
|
import createClient from 'openapi-fetch';
|
|
@@ -43,131 +45,6 @@ var AllKnownMetaKeys = [
|
|
|
43
45
|
ReasonMetaKey,
|
|
44
46
|
BurnedMetaKey
|
|
45
47
|
];
|
|
46
|
-
function createIdentiferFilter(type, id) {
|
|
47
|
-
if (type === "Template") {
|
|
48
|
-
return {
|
|
49
|
-
identifierFilter: {
|
|
50
|
-
TemplateFilter: {
|
|
51
|
-
value: {
|
|
52
|
-
templateId: id,
|
|
53
|
-
includeCreatedEventBlob: true
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
} else {
|
|
59
|
-
return {
|
|
60
|
-
identifierFilter: {
|
|
61
|
-
InterfaceFilter: {
|
|
62
|
-
value: {
|
|
63
|
-
interfaceId: id,
|
|
64
|
-
includeInterfaceView: true,
|
|
65
|
-
includeCreatedEventBlob: true
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
function createWildcardFilter() {
|
|
73
|
-
return {
|
|
74
|
-
identifierFilter: {
|
|
75
|
-
WildcardFilter: {
|
|
76
|
-
value: {
|
|
77
|
-
includeCreatedEventBlob: true
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
function buildCumulativeFilters(templateIds, interfaceIds, includeWildcard) {
|
|
84
|
-
if (templateIds.length > 0) {
|
|
85
|
-
return [
|
|
86
|
-
...templateIds.map(
|
|
87
|
-
(templateId) => createIdentiferFilter("Template", templateId)
|
|
88
|
-
),
|
|
89
|
-
...includeWildcard ? [createWildcardFilter()] : []
|
|
90
|
-
];
|
|
91
|
-
} else {
|
|
92
|
-
return [
|
|
93
|
-
...interfaceIds.map(
|
|
94
|
-
(interfaceId) => createIdentiferFilter("Interface", interfaceId)
|
|
95
|
-
),
|
|
96
|
-
...includeWildcard ? [createWildcardFilter()] : []
|
|
97
|
-
];
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
function buildFilter(templateIds, interfaceIds, options, additionalProps) {
|
|
101
|
-
const { isMasterUser = false, partyId, includeWildcard = false } = options;
|
|
102
|
-
if (isMasterUser) {
|
|
103
|
-
return {
|
|
104
|
-
filtersByParty: {},
|
|
105
|
-
filtersForAnyParty: filtersForAnyParty(
|
|
106
|
-
templateIds,
|
|
107
|
-
interfaceIds,
|
|
108
|
-
includeWildcard
|
|
109
|
-
),
|
|
110
|
-
...additionalProps
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
if (!partyId) {
|
|
114
|
-
throw new Error("Party must be provided for non-master users");
|
|
115
|
-
}
|
|
116
|
-
return {
|
|
117
|
-
filtersByParty: filtersByParty(
|
|
118
|
-
partyId,
|
|
119
|
-
templateIds,
|
|
120
|
-
interfaceIds,
|
|
121
|
-
includeWildcard
|
|
122
|
-
),
|
|
123
|
-
...additionalProps
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
function TransactionFilterBySetup(options) {
|
|
127
|
-
const { templateIds, interfaceIds, ...baseOptions } = options;
|
|
128
|
-
return buildFilter(
|
|
129
|
-
normalizeToArray(templateIds || []),
|
|
130
|
-
normalizeToArray(interfaceIds || []),
|
|
131
|
-
baseOptions
|
|
132
|
-
);
|
|
133
|
-
}
|
|
134
|
-
function EventFilterBySetup(options) {
|
|
135
|
-
const {
|
|
136
|
-
templateIds,
|
|
137
|
-
interfaceIds,
|
|
138
|
-
verbose = false,
|
|
139
|
-
...baseOptions
|
|
140
|
-
} = options;
|
|
141
|
-
return buildFilter(
|
|
142
|
-
normalizeToArray(templateIds || []),
|
|
143
|
-
normalizeToArray(interfaceIds || []),
|
|
144
|
-
baseOptions,
|
|
145
|
-
{ verbose }
|
|
146
|
-
);
|
|
147
|
-
}
|
|
148
|
-
function filtersByParty(party, templateIds, interfaceIds, includeWildcard) {
|
|
149
|
-
return {
|
|
150
|
-
[party]: {
|
|
151
|
-
cumulative: buildCumulativeFilters(
|
|
152
|
-
templateIds,
|
|
153
|
-
interfaceIds,
|
|
154
|
-
includeWildcard
|
|
155
|
-
)
|
|
156
|
-
}
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
|
-
function filtersForAnyParty(interfaceNames, templateIds, includeWildcard) {
|
|
160
|
-
return {
|
|
161
|
-
cumulative: buildCumulativeFilters(
|
|
162
|
-
templateIds,
|
|
163
|
-
interfaceNames,
|
|
164
|
-
includeWildcard
|
|
165
|
-
)
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
function normalizeToArray(value) {
|
|
169
|
-
return Array.isArray(value) ? value : [value];
|
|
170
|
-
}
|
|
171
48
|
function hasInterface(interfaceId, event) {
|
|
172
49
|
return (event.implementedInterfaces || []).some(
|
|
173
50
|
(id) => matchInterfaceIds(id, interfaceId)
|
|
@@ -1324,14 +1201,15 @@ var CoreService = class _CoreService {
|
|
|
1324
1201
|
}
|
|
1325
1202
|
return cIds;
|
|
1326
1203
|
}
|
|
1327
|
-
async listContractsByInterface(interfaceId, partyId, limit, offset) {
|
|
1204
|
+
async listContractsByInterface(interfaceId, partyId, limit, offset, continueUntilCompletion) {
|
|
1328
1205
|
try {
|
|
1329
1206
|
const ledgerEnd = offset ?? (await this.ledgerClient.getWithRetry("/v2/state/ledger-end")).offset;
|
|
1330
1207
|
const options = {
|
|
1331
1208
|
offset: ledgerEnd,
|
|
1332
1209
|
interfaceIds: [interfaceId],
|
|
1333
1210
|
parties: [partyId],
|
|
1334
|
-
filterByParty: true
|
|
1211
|
+
filterByParty: true,
|
|
1212
|
+
continueUntilCompletion: Boolean(continueUntilCompletion)
|
|
1335
1213
|
};
|
|
1336
1214
|
if (limit !== void 0) {
|
|
1337
1215
|
options.limit = limit;
|
|
@@ -2099,12 +1977,13 @@ var TokenStandardService = class {
|
|
|
2099
1977
|
}
|
|
2100
1978
|
// <T> is shape of viewValue related to queried interface.
|
|
2101
1979
|
// i.e. when querying by TransferInstruction interfaceId, <T> would be TransferInstructionView from daml codegen
|
|
2102
|
-
async listContractsByInterface(interfaceId, partyId, limit, offset) {
|
|
1980
|
+
async listContractsByInterface(interfaceId, partyId, limit, offset, continueUntilCompletion) {
|
|
2103
1981
|
return this.core.listContractsByInterface(
|
|
2104
1982
|
interfaceId,
|
|
2105
1983
|
partyId,
|
|
2106
1984
|
limit,
|
|
2107
|
-
offset
|
|
1985
|
+
offset,
|
|
1986
|
+
continueUntilCompletion
|
|
2108
1987
|
);
|
|
2109
1988
|
}
|
|
2110
1989
|
async listHoldingTransactions(partyId, afterOffset, beforeOffset) {
|
|
@@ -3284,23 +3163,33 @@ var LedgerClient = class {
|
|
|
3284
3163
|
}
|
|
3285
3164
|
}
|
|
3286
3165
|
/*
|
|
3287
|
-
if limit is provided, this function performs a one-time query
|
|
3166
|
+
if limit is provided, this function performs a one-time query. Automatically splits into multiple `/v2/updates` calls with `continueUntilCompletion` on.
|
|
3288
3167
|
if limit is omitted, results may be served from the ACS cache
|
|
3289
3168
|
current cache design doesn't support limiting queries because updates/deltas for the acs at offset x will be incorrect
|
|
3290
3169
|
TODO: expose query mode vs subscribe mode to call queryActiveContracts vs subscribeActiveContracts
|
|
3291
3170
|
*/
|
|
3292
3171
|
async activeContracts(options) {
|
|
3293
|
-
const {
|
|
3172
|
+
const {
|
|
3173
|
+
offset,
|
|
3174
|
+
templateIds,
|
|
3175
|
+
parties,
|
|
3176
|
+
interfaceIds,
|
|
3177
|
+
limit,
|
|
3178
|
+
continueUntilCompletion
|
|
3179
|
+
} = options;
|
|
3294
3180
|
const hasLimit = typeof limit === "number";
|
|
3295
3181
|
if (hasLimit) {
|
|
3296
3182
|
const filter2 = this.buildActiveContractFilter(options);
|
|
3183
|
+
if (continueUntilCompletion)
|
|
3184
|
+
return await this.fetchActiveContractsUntilComplete(
|
|
3185
|
+
filter2,
|
|
3186
|
+
limit
|
|
3187
|
+
);
|
|
3297
3188
|
return await this.postWithRetry(
|
|
3298
3189
|
"/v2/state/active-contracts",
|
|
3299
3190
|
filter2,
|
|
3300
3191
|
defaultRetryableOptions,
|
|
3301
|
-
{
|
|
3302
|
-
query: limit ? { limit: limit.toString() } : {}
|
|
3303
|
-
}
|
|
3192
|
+
{ query: { limit: limit.toString() } }
|
|
3304
3193
|
);
|
|
3305
3194
|
}
|
|
3306
3195
|
this.logger.debug(options, "options for active contracts");
|
|
@@ -3327,6 +3216,65 @@ var LedgerClient = class {
|
|
|
3327
3216
|
defaultRetryableOptions
|
|
3328
3217
|
);
|
|
3329
3218
|
}
|
|
3219
|
+
/**
|
|
3220
|
+
* Fetches active contracts by splitting requests into multiple `/v2/updates` calls.
|
|
3221
|
+
* Should only be used when the number of contracts exceeds http-list-max-elements-limit (200 by default).
|
|
3222
|
+
* For limits at or below http-list-max-elements-limit, use a single `/v2/state/active-contracts` call instead.
|
|
3223
|
+
* @param activeContractsArgs The request parameters for active contracts query
|
|
3224
|
+
* @returns A promise that resolves to an array of active contract responses
|
|
3225
|
+
* @private
|
|
3226
|
+
*/
|
|
3227
|
+
async fetchActiveContractsUntilComplete(activeContractsArgs, limit) {
|
|
3228
|
+
const result = [];
|
|
3229
|
+
const ledgerEnd = await this.getWithRetry("/v2/state/ledger-end");
|
|
3230
|
+
const bodyRequest = {
|
|
3231
|
+
beginExclusive: 0,
|
|
3232
|
+
endInclusive: ledgerEnd.offset,
|
|
3233
|
+
verbose: false
|
|
3234
|
+
};
|
|
3235
|
+
if (activeContractsArgs.filter)
|
|
3236
|
+
bodyRequest.filter = activeContractsArgs.filter;
|
|
3237
|
+
let currentOffset = 0;
|
|
3238
|
+
while (currentOffset < ledgerEnd.offset) {
|
|
3239
|
+
bodyRequest.beginExclusive = currentOffset;
|
|
3240
|
+
const newResults = (await this.postWithRetry(
|
|
3241
|
+
"/v2/updates",
|
|
3242
|
+
bodyRequest,
|
|
3243
|
+
defaultRetryableOptions,
|
|
3244
|
+
{
|
|
3245
|
+
query: { limit: limit.toString() }
|
|
3246
|
+
}
|
|
3247
|
+
)).filter(({ update }) => "Transaction" in update).map(({ update }) => {
|
|
3248
|
+
if ("Transaction" in update) {
|
|
3249
|
+
return update.Transaction.value;
|
|
3250
|
+
}
|
|
3251
|
+
throw new Error("Expected Transaction update");
|
|
3252
|
+
}).map((data) => {
|
|
3253
|
+
const createdEvent = data.events?.find(
|
|
3254
|
+
(event) => typeof event === "object" && event !== null && "CreatedEvent" in event
|
|
3255
|
+
);
|
|
3256
|
+
if (!createdEvent || !("CreatedEvent" in createdEvent)) {
|
|
3257
|
+
throw new Error(
|
|
3258
|
+
"CreatedEvent not found in transaction events"
|
|
3259
|
+
);
|
|
3260
|
+
}
|
|
3261
|
+
currentOffset = Math.max(currentOffset, data.offset);
|
|
3262
|
+
return {
|
|
3263
|
+
workflowId: data.workflowId,
|
|
3264
|
+
contractEntry: {
|
|
3265
|
+
JsActiveContract: {
|
|
3266
|
+
synchronizerId: data.synchronizerId,
|
|
3267
|
+
createdEvent: createdEvent.CreatedEvent,
|
|
3268
|
+
reassignmentCounter: data.offset
|
|
3269
|
+
}
|
|
3270
|
+
}
|
|
3271
|
+
};
|
|
3272
|
+
});
|
|
3273
|
+
result.push(...newResults);
|
|
3274
|
+
if (!newResults.length) currentOffset++;
|
|
3275
|
+
}
|
|
3276
|
+
return result;
|
|
3277
|
+
}
|
|
3330
3278
|
buildActiveContractFilter(options) {
|
|
3331
3279
|
const filter = {
|
|
3332
3280
|
filter: {
|
|
@@ -3486,118 +3434,6 @@ var WSSupportWithBackOffSwitch = class {
|
|
|
3486
3434
|
}
|
|
3487
3435
|
};
|
|
3488
3436
|
|
|
3489
|
-
|
|
3490
|
-
var CHANNELS = {
|
|
3491
|
-
v2_commands_completions: "/v2/commands/completions",
|
|
3492
|
-
v2_updates: "/v2/updates"};
|
|
3493
|
-
|
|
3494
|
-
// src/web-socket-client.ts
|
|
3495
|
-
var WebSocketClient = class {
|
|
3496
|
-
constructor({
|
|
3497
|
-
baseUrl,
|
|
3498
|
-
isAdmin,
|
|
3499
|
-
accessTokenProvider,
|
|
3500
|
-
logger,
|
|
3501
|
-
wsSupportBackOff
|
|
3502
|
-
}) {
|
|
3503
|
-
__publicField(this, "ws", null);
|
|
3504
|
-
__publicField(this, "baseUrl");
|
|
3505
|
-
__publicField(this, "token", "");
|
|
3506
|
-
__publicField(this, "isAdmin");
|
|
3507
|
-
__publicField(this, "protocol", []);
|
|
3508
|
-
__publicField(this, "logger");
|
|
3509
|
-
__publicField(this, "wsSupportBackOff");
|
|
3510
|
-
__publicField(this, "accessTokenProvider");
|
|
3511
|
-
this.logger = logger.child({ component: "WebSocketClient" });
|
|
3512
|
-
this.baseUrl = baseUrl;
|
|
3513
|
-
this.wsSupportBackOff = wsSupportBackOff;
|
|
3514
|
-
this.accessTokenProvider = accessTokenProvider;
|
|
3515
|
-
this.isAdmin = isAdmin ?? false;
|
|
3516
|
-
}
|
|
3517
|
-
async init() {
|
|
3518
|
-
this.token = this.isAdmin ? await this.accessTokenProvider.getAdminAccessToken() : await this.accessTokenProvider.getUserAccessToken();
|
|
3519
|
-
this.protocol = [`jwt.token.${this.token}`, "daml.ws.auth"];
|
|
3520
|
-
this.logger.info(
|
|
3521
|
-
`initializing websocket client with ${this.protocol.length} protocols`
|
|
3522
|
-
);
|
|
3523
|
-
}
|
|
3524
|
-
generate(wsUrl, request) {
|
|
3525
|
-
const messageQueue = [];
|
|
3526
|
-
let resolveNext = null;
|
|
3527
|
-
let isClosed = false;
|
|
3528
|
-
let streamError = null;
|
|
3529
|
-
const generator = async function* () {
|
|
3530
|
-
await this.init();
|
|
3531
|
-
this.logger.debug(request);
|
|
3532
|
-
const ws = new WebSocket(wsUrl, this.protocol);
|
|
3533
|
-
ws.onopen = () => {
|
|
3534
|
-
ws.send(JSON.stringify(request));
|
|
3535
|
-
};
|
|
3536
|
-
ws.onmessage = (event) => {
|
|
3537
|
-
messageQueue.push(JSON.parse(event.data));
|
|
3538
|
-
this.logger.debug(event.data, `Received event`);
|
|
3539
|
-
resolveNext?.();
|
|
3540
|
-
};
|
|
3541
|
-
ws.onerror = () => {
|
|
3542
|
-
streamError = new Error("WebSocket Handshake/Connection failed");
|
|
3543
|
-
this.logger.error(`Encountered ws.onError`);
|
|
3544
|
-
isClosed = true;
|
|
3545
|
-
resolveNext?.();
|
|
3546
|
-
};
|
|
3547
|
-
ws.onclose = (event) => {
|
|
3548
|
-
this.logger.debug(
|
|
3549
|
-
`CLOSING WEBSOCKET CONNECTION code: ${event.code}, reason: ${event.reason}`
|
|
3550
|
-
);
|
|
3551
|
-
isClosed = true;
|
|
3552
|
-
resolveNext?.();
|
|
3553
|
-
};
|
|
3554
|
-
try {
|
|
3555
|
-
while (true) {
|
|
3556
|
-
if (messageQueue.length === 0) {
|
|
3557
|
-
if (isClosed) break;
|
|
3558
|
-
await new Promise((r) => resolveNext = r);
|
|
3559
|
-
}
|
|
3560
|
-
if (streamError) throw streamError;
|
|
3561
|
-
while (messageQueue.length > 0) {
|
|
3562
|
-
yield messageQueue.shift();
|
|
3563
|
-
}
|
|
3564
|
-
if (isClosed && messageQueue.length === 0) break;
|
|
3565
|
-
}
|
|
3566
|
-
} finally {
|
|
3567
|
-
if (ws.readyState === WebSocket.OPEN) ws.close();
|
|
3568
|
-
this.logger.info("Generator cleanup: WebSocket closed.");
|
|
3569
|
-
}
|
|
3570
|
-
};
|
|
3571
|
-
return generator.call(this);
|
|
3572
|
-
}
|
|
3573
|
-
streamUpdates(options) {
|
|
3574
|
-
const wsUpdatesUrl = `${this.baseUrl}${CHANNELS.v2_updates}`;
|
|
3575
|
-
const filter = options.templateIds ? TransactionFilterBySetup({
|
|
3576
|
-
templateIds: options.templateIds,
|
|
3577
|
-
partyId: options.partyId
|
|
3578
|
-
}) : TransactionFilterBySetup({
|
|
3579
|
-
interfaceIds: options.interfaceIds,
|
|
3580
|
-
partyId: options.partyId
|
|
3581
|
-
});
|
|
3582
|
-
const request = {
|
|
3583
|
-
beginExclusive: options.beginExclusive,
|
|
3584
|
-
endInclusive: options.endInclusive,
|
|
3585
|
-
verbose: options.verbose ?? true,
|
|
3586
|
-
filter
|
|
3587
|
-
};
|
|
3588
|
-
return this.generate(wsUpdatesUrl, request);
|
|
3589
|
-
}
|
|
3590
|
-
streamCompletions(options) {
|
|
3591
|
-
const wsCompletionsUrl = `${this.baseUrl}${CHANNELS.v2_commands_completions}`;
|
|
3592
|
-
const request = {
|
|
3593
|
-
beginExclusive: options.beginExclusive,
|
|
3594
|
-
userId: options.userId,
|
|
3595
|
-
parties: options.parties
|
|
3596
|
-
};
|
|
3597
|
-
return this.generate(wsCompletionsUrl, request);
|
|
3598
|
-
}
|
|
3599
|
-
};
|
|
3600
|
-
|
|
3601
|
-
export { ACSContainer, ACS_UPDATE_CONFIG, AmuletService, CoreService, LedgerClient, TokenStandardService, TokenStandardTransactionInterfaces, TransactionParser, WSSupportWithBackOffSwitch, WebSocketClient, asJsCantonError, awaitCompletion, defaultRetryableOptions, isJsCantonError, promiseWithTimeout, supportedVersions };
|
|
3437
|
+
export { ACSContainer, ACS_UPDATE_CONFIG, AmuletService, CoreService, LedgerClient, TokenStandardService, TokenStandardTransactionInterfaces, TransactionParser, WSSupportWithBackOffSwitch, asJsCantonError, awaitCompletion, defaultRetryableOptions, isJsCantonError, promiseWithTimeout, supportedVersions };
|
|
3602
3438
|
//# sourceMappingURL=index.js.map
|
|
3603
3439
|
//# sourceMappingURL=index.js.map
|