Skip to content

In surfpool data not present then it throws error('Invalid account discriminator') #378

@starkit7k

Description

@starkit7k

Mainnet connnection code :

import {
  Connection,
  Keypair,
  PublicKey,
  Transaction,
  sendAndConfirmTransaction,
} from '@solana/web3.js';
import DLMM from '@meteora-ag/dlmm';
import { BN } from '@coral-xyz/anchor';
import * as fs from 'fs';

// Connections for both mainnet and local Surfpool
const mainnetConnection = new Connection('https://api.mainnet-beta.solana.com', 'confirmed');
const localConnection = new Connection('http://localhost:8899', 'confirmed');

console.log("🌐 Connections initialized");

// Load wallet
const wallet = Keypair.fromSecretKey(
  Uint8Array.from(JSON.parse(fs.readFileSync("wallet-keypair.json", "utf-8")))
);
console.log("✅ Wallet loaded:", wallet.publicKey.toString());

async function fetchPoolData() {
  console.log("🔍 Fetching pool data from mainnet...");
  const POOL_ID = '7LLrF1cVVmE1oBAqTezHPByu3JD5t9X7qcv9jSv6FMzv';

  console.log("staring the pool fetch from mainnet");
  const dlmmPool = await DLMM.create(mainnetConnection, new PublicKey(POOL_ID));
  console.log("✅ Successfully fetched pool data");

}



// Run the example
fetchPoolData();

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