Building off of #1024, break up the activeContracts function as queryActiveContracts and subscribeToActiveContracts and expose as separate functions in the wallet-sdk.
Background:
Today activeContracts service 2 distinct use cases
- One off queries against /v2/state/active-contracts
- Long-lived subscriptions/cached reads backed by the ACS cache
These use cases have very different semantics where queries bounded, snapshot-based, and respect a limit. Subscriptions are unbounded, backed by the cache and shouldn't limit as this will cause issues with the cache (in terms of updating cache and will have an incorrect view of the cache if we use the limit as is. Perhaps we might want to redesign the cache)
Additionally, we're introducing an async api client that uses websockets.
subscribeToActiveContracts will use the AcsCache and represents all active contracts matching a partyId + templateId/interfaceId at X offset. This is long-lived and has incremental updates and will also align with the async api websocket streaming subscriptions.
queryActiveContracts will essentially just use the /v2/state/active-contracts http endpoint and does not use the cache.
Building off of #1024, break up the activeContracts function as queryActiveContracts and subscribeToActiveContracts and expose as separate functions in the wallet-sdk.
Background:
Today activeContracts service 2 distinct use cases
These use cases have very different semantics where queries bounded, snapshot-based, and respect a limit. Subscriptions are unbounded, backed by the cache and shouldn't limit as this will cause issues with the cache (in terms of updating cache and will have an incorrect view of the cache if we use the limit as is. Perhaps we might want to redesign the cache)
Additionally, we're introducing an async api client that uses websockets.
subscribeToActiveContracts will use the AcsCache and represents all active contracts matching a partyId + templateId/interfaceId at X offset. This is long-lived and has incremental updates and will also align with the async api websocket streaming subscriptions.
queryActiveContracts will essentially just use the /v2/state/active-contracts http endpoint and does not use the cache.