Skip to content

Using solana-dex-parser with mappings #2899

@mogupta

Description

@mogupta

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions