Skip to content

Commit 474c507

Browse files
committed
Update dict tests and endpoint
1 parent f2a05b1 commit 474c507

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

packages/node/src/indexer/dictionary/v2/solanaDictionaryV2.spec.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// SPDX-License-Identifier: GPL-3.0
33

44
import { EventEmitter2 } from '@nestjs/event-emitter';
5-
import { BlockHeightMap, NodeConfig } from '@subql/node-core';
5+
import { BlockHeightMap, IBlock, NodeConfig } from '@subql/node-core';
66
import {
77
SolanaDatasourceKind,
88
SolanaHandlerKind,
@@ -16,7 +16,7 @@ import { SolanaDictionaryV2 } from './solanaDictionaryV2';
1616
const HTTP_ENDPOINT =
1717
process.env.HTTP_ENDPOINT ?? 'https://solana.api.onfinality.io/public';
1818

19-
const DEFAULT_DICTIONARY = 'http://localhost:8080';
19+
const DEFAULT_DICTIONARY = 'https://dict-sol-tyk.subquery.network';
2020

2121
const nodeConfig = new NodeConfig({
2222
subquery: 'solana-starter',
@@ -205,7 +205,7 @@ describe('solana dictionary v2', () => {
205205
// }, 100000);
206206

207207
it('returns a lastBufferedHeight if there are no block results', async () => {
208-
const blockHeight = 317_617_480;
208+
const blockHeight = 332_557_468;
209209
const ds: SubqlRuntimeDatasource = {
210210
kind: SolanaDatasourceKind.Runtime,
211211
startBlock: blockHeight,
@@ -216,7 +216,7 @@ describe('solana dictionary v2', () => {
216216
handler: 'handleInstruction',
217217
kind: SolanaHandlerKind.Instruction,
218218
filter: {
219-
programId: '8A2ap8YTUmCYbQztNZQnebE333PBuWQxztYNpvQ8RXKX',
219+
programId: 'BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY',
220220
},
221221
},
222222
],
@@ -228,7 +228,8 @@ describe('solana dictionary v2', () => {
228228

229229
const res = await solanaDictionaryV2.getData(blockHeight, blockHeight, 100);
230230

231-
expect(res?.batchBlocks.length).toEqual(0);
231+
expect(res?.batchBlocks.length).toEqual(1);
232+
expect((res?.batchBlocks[0] as IBlock).block.transactions.length).toBe(7);
232233
expect(res?.lastBufferedHeight).toEqual(blockHeight);
233234
});
234235
});

packages/node/src/indexer/dictionary/v2/solanaDictionaryV2.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,9 @@ export class SolanaDictionaryV2 extends DictionaryV2<
349349
}
350350
return {
351351
batchBlocks: blocks,
352-
lastBufferedHeight: Number(blocks[blocks.length - 1].block.blockHeight),
352+
lastBufferedHeight: Number(
353+
blocks[blocks.length - 1].getHeader().blockHeight,
354+
),
353355
};
354356
} catch (e: any) {
355357
logger.error(e, `Failed to handle block response`);

packages/node/src/solana/block.solana.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,6 @@ export function formatBlockUtil<B extends SolanaBlock = SolanaBlock>(
263263
}
264264

265265
export function solanaBlockToHeader(block: BaseSolanaBlock): Header {
266-
console.log('BASE BLOCK', block.blockTime);
267266
return {
268267
blockHeight: Number(block.parentSlot) + 1, // The blocks don't include the slot because they assume you know that when making the request
269268
blockHash: block.blockhash,

0 commit comments

Comments
 (0)