Skip to main content
added 1 character in body
Source Link

Im using this repo: https://github.com/rckprtr/pumpdotfun-sdk

import bs58 from "bs58";
import idl from "../../clientsrc/IDL/pump-fun.json";
import {
  BorshCoder,
} from "@coral-xyz/anchor";
import { base64 } from "@coral-xyz/anchor/dist/cjs/utils/bytes";

const main = async () => {
  let base58Data =
    "2K7nL28PxCW8ejnyCeuMpbWSTLdurgKFpsogNMAfkxaivrGSbx5pnrFeWkZY5EUDZL26WSoMa5kTRAuZiW7s3HifSXN9sWnRp1XnD71rTSxG3GNXxguzpgsXeDQfJx7A5TCPx9t7r5B3KcWsvbxXAivnaY6i82epDwEiCiZ7T2oLg3QsrcZqFjun6QF1";

  let buffer = Buffer.from(bs58.decode(base58Data));
  //remove first 8 bytes for the event cpi
  buffer = buffer.slice(8);
  
  let coder = new BorshCoder(idl as any);
  let args = coder.events.decode(base64.encode(buffer));
  console.log(args);
};

main();

Results:

{
  data: {
    mint: PublicKey [PublicKey(6Y6uxUWa2AtijqprubRwx2amJnZkXiK2FM7kJ6E6pump)] {
      _bn: <BN: 52422028108045a3dfbc44fb5428a6cee7ea2f55bdd87164929a93663d3145ff>
    },
    solAmount: <BN: 291a3b2>,
    tokenAmount: <BN: 11bf0975831>,
    isBuy: true,
    user: PublicKey [PublicKey(Bzen1deTMBZXh7etJheznKZtDF9KWfgacGSwWV6DPPZ2)] {
      _bn: <BN: a359b05b86c4036aafbfaa3bda65369edf96fd8630852ee5d38e7fe79199b429>
    },
    timestamp: <BN: 666af53c>,
    virtualSolReserves: <BN: 7dbae0e65>,
    virtualTokenReserves: <BN: 36372238c25ff>,
    realSolReserves: <BN: df8a6265>,
    realTokenReserves: <BN: 264e0d7798dff>
  },
  name: 'TradeEvent'
}

Im using this repo: https://github.com/rckprtr/pumpdotfun-sdk

import bs58 from "bs58";
import idl from "../../client/pump-fun.json";
import {
  BorshCoder,
} from "@coral-xyz/anchor";
import { base64 } from "@coral-xyz/anchor/dist/cjs/utils/bytes";

const main = async () => {
  let base58Data =
    "2K7nL28PxCW8ejnyCeuMpbWSTLdurgKFpsogNMAfkxaivrGSbx5pnrFeWkZY5EUDZL26WSoMa5kTRAuZiW7s3HifSXN9sWnRp1XnD71rTSxG3GNXxguzpgsXeDQfJx7A5TCPx9t7r5B3KcWsvbxXAivnaY6i82epDwEiCiZ7T2oLg3QsrcZqFjun6QF1";

  let buffer = Buffer.from(bs58.decode(base58Data));
  //remove first 8 bytes for the event cpi
  buffer = buffer.slice(8);
  
  let coder = new BorshCoder(idl as any);
  let args = coder.events.decode(base64.encode(buffer));
  console.log(args);
};

main();

Results:

{
  data: {
    mint: PublicKey [PublicKey(6Y6uxUWa2AtijqprubRwx2amJnZkXiK2FM7kJ6E6pump)] {
      _bn: <BN: 52422028108045a3dfbc44fb5428a6cee7ea2f55bdd87164929a93663d3145ff>
    },
    solAmount: <BN: 291a3b2>,
    tokenAmount: <BN: 11bf0975831>,
    isBuy: true,
    user: PublicKey [PublicKey(Bzen1deTMBZXh7etJheznKZtDF9KWfgacGSwWV6DPPZ2)] {
      _bn: <BN: a359b05b86c4036aafbfaa3bda65369edf96fd8630852ee5d38e7fe79199b429>
    },
    timestamp: <BN: 666af53c>,
    virtualSolReserves: <BN: 7dbae0e65>,
    virtualTokenReserves: <BN: 36372238c25ff>,
    realSolReserves: <BN: df8a6265>,
    realTokenReserves: <BN: 264e0d7798dff>
  },
  name: 'TradeEvent'
}

Im using this repo: https://github.com/rckprtr/pumpdotfun-sdk

import bs58 from "bs58";
import idl from "../../src/IDL/pump-fun.json";
import {
  BorshCoder,
} from "@coral-xyz/anchor";
import { base64 } from "@coral-xyz/anchor/dist/cjs/utils/bytes";

const main = async () => {
  let base58Data =
    "2K7nL28PxCW8ejnyCeuMpbWSTLdurgKFpsogNMAfkxaivrGSbx5pnrFeWkZY5EUDZL26WSoMa5kTRAuZiW7s3HifSXN9sWnRp1XnD71rTSxG3GNXxguzpgsXeDQfJx7A5TCPx9t7r5B3KcWsvbxXAivnaY6i82epDwEiCiZ7T2oLg3QsrcZqFjun6QF1";

  let buffer = Buffer.from(bs58.decode(base58Data));
  //remove first 8 bytes for the event cpi
  buffer = buffer.slice(8);
  
  let coder = new BorshCoder(idl as any);
  let args = coder.events.decode(base64.encode(buffer));
  console.log(args);
};

main();

Results:

{
  data: {
    mint: PublicKey [PublicKey(6Y6uxUWa2AtijqprubRwx2amJnZkXiK2FM7kJ6E6pump)] {
      _bn: <BN: 52422028108045a3dfbc44fb5428a6cee7ea2f55bdd87164929a93663d3145ff>
    },
    solAmount: <BN: 291a3b2>,
    tokenAmount: <BN: 11bf0975831>,
    isBuy: true,
    user: PublicKey [PublicKey(Bzen1deTMBZXh7etJheznKZtDF9KWfgacGSwWV6DPPZ2)] {
      _bn: <BN: a359b05b86c4036aafbfaa3bda65369edf96fd8630852ee5d38e7fe79199b429>
    },
    timestamp: <BN: 666af53c>,
    virtualSolReserves: <BN: 7dbae0e65>,
    virtualTokenReserves: <BN: 36372238c25ff>,
    realSolReserves: <BN: df8a6265>,
    realTokenReserves: <BN: 264e0d7798dff>
  },
  name: 'TradeEvent'
}
Source Link

Im using this repo: https://github.com/rckprtr/pumpdotfun-sdk

import bs58 from "bs58";
import idl from "../../client/pump-fun.json";
import {
  BorshCoder,
} from "@coral-xyz/anchor";
import { base64 } from "@coral-xyz/anchor/dist/cjs/utils/bytes";

const main = async () => {
  let base58Data =
    "2K7nL28PxCW8ejnyCeuMpbWSTLdurgKFpsogNMAfkxaivrGSbx5pnrFeWkZY5EUDZL26WSoMa5kTRAuZiW7s3HifSXN9sWnRp1XnD71rTSxG3GNXxguzpgsXeDQfJx7A5TCPx9t7r5B3KcWsvbxXAivnaY6i82epDwEiCiZ7T2oLg3QsrcZqFjun6QF1";

  let buffer = Buffer.from(bs58.decode(base58Data));
  //remove first 8 bytes for the event cpi
  buffer = buffer.slice(8);
  
  let coder = new BorshCoder(idl as any);
  let args = coder.events.decode(base64.encode(buffer));
  console.log(args);
};

main();

Results:

{
  data: {
    mint: PublicKey [PublicKey(6Y6uxUWa2AtijqprubRwx2amJnZkXiK2FM7kJ6E6pump)] {
      _bn: <BN: 52422028108045a3dfbc44fb5428a6cee7ea2f55bdd87164929a93663d3145ff>
    },
    solAmount: <BN: 291a3b2>,
    tokenAmount: <BN: 11bf0975831>,
    isBuy: true,
    user: PublicKey [PublicKey(Bzen1deTMBZXh7etJheznKZtDF9KWfgacGSwWV6DPPZ2)] {
      _bn: <BN: a359b05b86c4036aafbfaa3bda65369edf96fd8630852ee5d38e7fe79199b429>
    },
    timestamp: <BN: 666af53c>,
    virtualSolReserves: <BN: 7dbae0e65>,
    virtualTokenReserves: <BN: 36372238c25ff>,
    realSolReserves: <BN: df8a6265>,
    realTokenReserves: <BN: 264e0d7798dff>
  },
  name: 'TradeEvent'
}