Repository navigation
Open
Description
added the following to mapping
import { DexParser, SolanaTransaction } from 'solana-dex-parser';
const parser = new DexParser();
Test
import { subqlTest } from "@subql/testing";
import { Transfer } from "../types/models";
// Example test for Transfer entity
subqlTest(
"handleTransfer test",
362963837, // block height to process
[],
[
// Expected output entities
{
id: "test-signature-123-0",
from: "source-account-address",
to: "destination-account-address",
amount: BigInt(100),
blockNumber: BigInt(362963837),
transactionHash: "test-signature-123",
date: new Date("2025-08-28T09:32:21.000Z")
}
],
"handleTransfer" // handler name
);
Error on test run
2025-08-29T01:13:29.164Z <SolanaDecoder> INFO Loaded IDL for TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA
2025-08-29T01:13:29.172Z <UnfinalizedBlocks> INFO Unfinalized blocks is disabled
2025-08-29T01:13:46.914Z <SolanaBlock> WARN Unable to parse log message: Transfer: insufficient lamports 1026178, need 1844400
2025-08-29T01:13:47.302Z <test-runner> WARN Test: handleTransfer test field due to runtime error
2025-08-29T01:13:47.302Z <test-runner> WARN Test handleTransfer test failed to run ReferenceError: TextEncoder is not defined
2025-08-29T01:13:47.349Z <StoreCache> WARN Error: SequelizeDatabaseError: relation "test-solana-token-program-starter._metadata" does not exist, Name: SequelizeDatabaseError, Parent: error: relation "test-solana-token-program-starter._metadata" does not exist, Original: error: relation "test-solana-token-program-starter._metadata" does not exist
2025-08-29T01:13:47.349Z <StoreCache> ERROR Database transaction failed, rolling back DatabaseError: relation "test-solana-token-program-starter._metadata" does not exist
2025-08-29T01:13:47.352Z <Testing> ERROR undefined Error: Testing failed
Cause: DatabaseError: relation "test-solana-token-program-starter._metadata" does not exist
Waiting for the debugger to disconnect...
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Waiting for the debugger to disconnect...
Metadata
Metadata
Assignees
Labels
No labels
Activity
mogupta commentedon Aug 29, 2025
Enabling TextEncoder
Error
mogupta commentedon Aug 29, 2025
Adding
to index.ts fixed it , also I had to use --unsafe
mogupta commentedon Aug 29, 2025
Another issue popped up. while using solana-dex-parser, it throws error because it expects a plain object but vm2 wrapper object is being sent. please advise
mogupta commentedon Aug 29, 2025
subql is basically converting discriminator of type Uint8Array into object with index as key
e.g. {"0":228,"1":69,"2":165,"3":46,"4":81,"5":203,"6":154,"7":29,"8":177,"9":49,"10":12,"11":210,"12":160,"13":118,"14":167,"15":116};
mogupta commentedon Aug 30, 2025
@stwiname please advise
stwiname commentedon Aug 31, 2025
@mogupta, the SubQuery project handlers are running in a sandbox which has some differences from a normal nodejs environment.
You can find more differences here. https://subquery.network/doc/indexer/build/mapping/sandbox.html
The issue you're facing now is that the data passed to the handers is proxy objects so
instanceofchecks fail. To fix this you could either re-parse the relevant data in the transaction to not be proxied objects. Or you could modify solana-dex-parserstwiname commentedon Sep 3, 2025
Hey, @mogupta, we'd like to have a more direct line of communication. If you're interested can you reach out to me on telegram. https://t.me/skottnz