@canton-network/core-ledger-client 0.18.1 → 0.19.0

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/index.js CHANGED
@@ -1481,13 +1481,11 @@ var CoreService = class _CoreService {
1481
1481
  }
1482
1482
  return cIds;
1483
1483
  }
1484
- async listContractsByInterface(interfaceId, partyId, limit) {
1484
+ async listContractsByInterface(interfaceId, partyId, limit, offset) {
1485
1485
  try {
1486
- const ledgerEnd = await this.ledgerClient.getWithRetry(
1487
- "/v2/state/ledger-end"
1488
- );
1486
+ const ledgerEnd = offset ?? (await this.ledgerClient.getWithRetry("/v2/state/ledger-end")).offset;
1489
1487
  const options = {
1490
- offset: ledgerEnd.offset,
1488
+ offset: ledgerEnd,
1491
1489
  interfaceIds: [interfaceId],
1492
1490
  parties: [partyId],
1493
1491
  filterByParty: true,
@@ -1499,7 +1497,7 @@ var CoreService = class _CoreService {
1499
1497
  isActiveContractEntry
1500
1498
  );
1501
1499
  return activeContractEntries.map(
1502
- (response) => this.toPrettyContract(interfaceId, response)
1500
+ (response) => this.toPrettyContract(interfaceId, response, ledgerEnd)
1503
1501
  );
1504
1502
  } catch (err) {
1505
1503
  this.logger.error(
@@ -1563,7 +1561,7 @@ var CoreService = class _CoreService {
1563
1561
  }
1564
1562
  // returns object with JsActiveContract content
1565
1563
  // and contractId and interface view value extracted from it as separate fields for convenience
1566
- toPrettyContract(interfaceId, response) {
1564
+ toPrettyContract(interfaceId, response, offset) {
1567
1565
  const activeContract = response.contractEntry.JsActiveContract;
1568
1566
  const { createdEvent } = activeContract;
1569
1567
  return {
@@ -1572,7 +1570,8 @@ var CoreService = class _CoreService {
1572
1570
  interfaceViewValue: ensureInterfaceViewIsPresent(
1573
1571
  createdEvent,
1574
1572
  interfaceId
1575
- ).viewValue
1573
+ ).viewValue,
1574
+ fetchedAtOffset: offset
1576
1575
  };
1577
1576
  }
1578
1577
  };
@@ -2288,11 +2287,12 @@ var TokenStandardService = class {
2288
2287
  }
2289
2288
  // <T> is shape of viewValue related to queried interface.
2290
2289
  // i.e. when querying by TransferInstruction interfaceId, <T> would be TransferInstructionView from daml codegen
2291
- async listContractsByInterface(interfaceId, partyId, limit) {
2290
+ async listContractsByInterface(interfaceId, partyId, limit, offset) {
2292
2291
  return this.core.listContractsByInterface(
2293
2292
  interfaceId,
2294
2293
  partyId,
2295
- limit
2294
+ limit,
2295
+ offset
2296
2296
  );
2297
2297
  }
2298
2298
  async listHoldingTransactions(partyId, afterOffset, beforeOffset) {