Skip to content

Commit

Permalink
Update bitmap indexer tests to use context object
Browse files Browse the repository at this point in the history
  • Loading branch information
darunrs committed Jul 26, 2024
1 parent 65ef821 commit 6565d01
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 4 additions & 1 deletion core-indexers/receiver-blocks/unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ describe('Receiver Blocks Indexer Tests', () => {

test('Try executing on a block', async () => {
const localIndexer = new LocalIndexer(indexerConfig);
await localIndexer.executeOnBlock(123621232);
const context = localIndexer.getContext();

await localIndexer.executeOnBlock(100000000);
const receivers = context.db.Receivers.select({})
});
});
6 changes: 5 additions & 1 deletion runner/src/local-indexer/local-indexer.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import ContextBuilder from '../context-builder';
import ContextBuilder, { type ContextObject } from '../context-builder';
import InMemoryDmlHandler from '../dml-handler/in-memory-dml-handler';
import IndexerConfig from '../indexer-config';
import { type LocalIndexerConfig } from '../indexer-config/indexer-config';
Expand Down Expand Up @@ -27,6 +27,10 @@ export default class LocalIndexer {
this.lakeClient = new LakeClient();
}

getContext (): ContextObject {
return this.indexer.deps.contextBuilder.buildContext(0, []);
}

async executeOnBlock (blockHeight: number): Promise<void> {
// TODO: Cache Block data locally
const block = await this.lakeClient.fetchBlock(blockHeight);
Expand Down

0 comments on commit 6565d01

Please sign in to comment.