Skip to content

ChainAdapter

Defined in: packages/store-kit/src/adapters/ChainAdapter.ts:24

Built-in RemoteAdapter that anchors the store on the Algorand blockchain.

Watches algod.statusAfterBlock for new rounds, scans each block for application calls targeting the store’s appId, and — when at least one non-self-submitted call is observed — fetches the canonical box state via fromBoxesRaw and funnels it through store.applyRemote.

Self-issued transactions are filtered using store.isSelfSubmittedGroup so the adapter never races with an in-flight save() to clear deltas.

Example

import { Store, ChainAdapter } from "@awesome-algorand/store-kit";
const store = new Store({ count: 0 });
store.addAdapter(new ChainAdapter());
await store.setAlgorand(algorand).init("counter");

Implements

Constructors

new ChainAdapter()

new ChainAdapter(): ChainAdapter

Returns

ChainAdapter

Properties

name

readonly name: "chain" = "chain"

Defined in: packages/store-kit/src/adapters/ChainAdapter.ts:25

Short human-readable identifier used in logs and meta.

Implementation of

RemoteAdapter.name

Methods

start()

start(store): Promise<void>

Defined in: packages/store-kit/src/adapters/ChainAdapter.ts:29

Begin observing. Called by Store.init() and on addAdapter post-init.

Parameters

store

Store

Returns

Promise<void>

Implementation of

RemoteAdapter.start


stop()

stop(): Promise<void>

Defined in: packages/store-kit/src/adapters/ChainAdapter.ts:36

Stop observing and release resources. Called by Store.dispose().

Returns

Promise<void>

Implementation of

RemoteAdapter.stop