
Research
/Security News
jscrambler npm Package Compromised in Supply Chain Attack
A compromised jscrambler npm release added a malicious preinstall hook that runs hidden native binaries on Linux, macOS, and Windows.
@canton-network/core-acs-reader
Advanced tools
Reader for active contract set (ACS) data from the Canton ledger, providing functions to retrieve and process active contract information for specified filters.
The ACS Reader abstracts the complexity of querying and managing active contracts from the Canton ledger. It offers both standard and paginated access patterns, with intelligent caching to minimize network overhead and improve application performance.
yarn add @canton-network/core-acs-reader
import { ACSReader } from '@canton-network/core-acs-reader'
import { ledgerProvider } from './your-ledger-setup'
// Initialize the reader
const reader = new ACSReader(ledgerProvider)
// Read active contracts with filtering
const contracts = await reader.read({
templateIds: ['templateId'],
parties: ['partyId'],
offset: 0,
})
// Get JavaScript contract objects (convenience method)
const jsContracts = await reader.readJsContracts({
templateIds: ['templateId'],
parties: ['partyId'],
})
The ACSReader class is the primary interface for querying active contracts. It maintains an internal cache and provides methods for both raw and processed contract data.
Standard Options (AcsOptions):
offset: Ledger offset to query from (automatically resolved if omitted)templateIds: Array of template IDs to filter byinterfaceIds: Array of interface IDs to filter byparties: Array of party IDs to filter byfilterByParty: Enable party-based filteringlimit: Maximum number of results to returncontinueUntilCompletion: Continue fetching until all data is retrievedPaginated Options (PaginatedAcsOptions):
Same as standard options, plus:
pageToken: Token for fetching specific pagesmaxPageSize: Maximum number of contracts per pageConfigure cache behavior with ACSCacheCollectionOptions:
const reader = new ACSReader(ledgerProvider, {
maxEventsBeforePrune: 1000, // Events before compaction
safeOffsetDeltaForPrune: 100, // Offset window to preserve
})
const reader = new ACSReader(ledgerProvider)
// Fetch all active contracts
const allContracts = await reader.read({})
// Filter by template ID
const tokenContracts = await reader.read({
templateIds: ['templateId'],
})
// Filter by multiple parties
const partyContracts = await reader.read({
parties: ['partyId', 'partyId2'],
filterByParty: true,
})
The readJsContracts method returns contract data in a more accessible format:
const jsContracts = await reader.readJsContracts({
templateIds: ['templateId'],
parties: ['partyId'],
})
// Each contract includes:
// - All fields from createdEvent
// - synchronizerId
jsContracts.forEach((contract) => {
console.log(contract.contractId, contract.templateId)
console.log(contract.createArgument)
})
For large datasets, use the paginated reader:
const reader = new ACSReader(ledgerProvider)
// Fetch first page
const firstPage = await reader.paginated.read({
templateIds: ['templateId'],
maxPageSize: 100,
})
// Fetch next page using token
const nextPage = await reader.paginated.read({
templateIds: ['templateId'],
pageToken: firstPage.nextPageToken,
maxPageSize: 100,
})
// Or fetch all pages at once
const allPages = await reader.paginated.read({
templateIds: ['templateId'],
continueUntilCompletion: true,
})
Access raw contract responses without caching:
const reader = new ACSReader(ledgerProvider)
// Standard raw access
const rawContracts = await reader.raw.read({
templateIds: ['templateId'],
})
// Paginated raw access
const rawPage = await reader.paginated.raw.read({
templateIds: ['templateId'],
maxPageSize: 100,
})
Fetch all available data in a single call:
const contracts = await reader.read({
templateIds: ['templateId'],
continueUntilCompletion: true,
limit: 200, // Batch size for each query
})
ACSReaderMain class for reading active contracts.
new ACSReader(
ledger: AbstractLedgerProvider,
cacheOptions?: ACSCacheCollectionOptions
)
interface ACSCacheCollectionOptions {
// Compact history after this many events
maxEventsBeforePrune?: number
// Preserve events within this offset window
safeOffsetDeltaForPrune?: number
}
maxEventsBeforePrune to 0 for immediate compaction (efficient for monotonically increasing offsets)safeOffsetDeltaForPrune to 0 to compact everything outside the current windowFAQs
Reader for active contract set (ACS) data from the Canton ledger, providing functions to retrieve and process active contract information for specified filters.
The npm package @canton-network/core-acs-reader receives a total of 82,825 weekly downloads. As such, @canton-network/core-acs-reader popularity was classified as popular.
We found that @canton-network/core-acs-reader demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
A compromised jscrambler npm release added a malicious preinstall hook that runs hidden native binaries on Linux, macOS, and Windows.

Research
/Security News
A malicious .NET package is typosquatting the Braintree SDK to steal live payment card data, merchant API keys, and host secrets from production apps.

Security News
/Research
Compromised Injective SDK npm version 1.20.21 exfiltrates wallet private keys and mnemonics through fake telemetry functionality.