JSPM

@tum123-x/raydium-sdk-v2-extended

0.2.7-alpha
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 15
  • Score
    100M100P100Q55614F
  • License GPL-3.0

An SDK for building applications on top of Raydium. Extended with createLaunchpadWithInstructions functionality.

Package Exports

  • @tum123-x/raydium-sdk-v2-extended
  • @tum123-x/raydium-sdk-v2-extended/lib/index.js
  • @tum123-x/raydium-sdk-v2-extended/lib/index.mjs

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@tum123-x/raydium-sdk-v2-extended) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Raydium SDK Extended

npm

An extended SDK for building applications on top of Raydium with additional functionality.

🆕 Extended Features

This fork adds the following functionality to the original Raydium SDK:

createLaunchpadWithInstructions

A new method that provides the same functionality as createLaunchpad but returns raw instructions instead of compiled transactions, giving you more flexibility for custom transaction building.

Usage:

const result = await raydium.launchpad.createLaunchpadWithInstructions({
  // ... same parameters as createLaunchpad, except txVersion, computeBudgetConfig, txTipConfig
});

// Returns:
// {
//   instructions: TransactionInstruction[],
//   signers: Signer[],
//   address: LaunchpadPoolInfo & { poolId: PublicKey },
//   swapInfo: SwapInfoReturnExt
// }

This is useful when you need to:

  • Combine launchpad creation with other instructions in a single transaction
  • Handle transaction building and signing manually
  • Optimize transaction size and fees
  • Build complex multi-step operations

Usage Guide

Installation

$ yarn add @tum123-x/raydium-sdk-v2-extended

Or with npm:

$ npm install @tum123-x/raydium-sdk-v2-extended

SDK method Demo

SDK V2 Demo Repo

SDK local test

$ yarn dev {directory}

e.g. yarn dev test/init.ts

Features

Initialization

import { Raydium } from "@raydium-io/raydium-sdk";
const raydium = await Raydium.load({
  connection,
  owner, // key pair or publicKey, if you run a node process, provide keyPair
  signAllTransactions, // optional - provide sign functions provided by @solana/wallet-adapter-react
  tokenAccounts, // optional, if dapp handle it by self can provide to sdk
  tokenAccountRowInfos, // optional, if dapp handle it by self can provide to sdk
  disableLoadToken: false, // default is false, if you don't need token info, set to true
});

how to transform token account data

import { parseTokenAccountResp } from "@raydium-io/raydium-sdk";

const solAccountResp = await connection.getAccountInfo(owner.publicKey);
const tokenAccountResp = await connection.getTokenAccountsByOwner(owner.publicKey, { programId: TOKEN_PROGRAM_ID });
const token2022Req = await connection.getTokenAccountsByOwner(owner.publicKey, { programId: TOKEN_2022_PROGRAM_ID });
const tokenAccountData = parseTokenAccountResp({
  owner: owner.publicKey,
  solAccountResp,
  tokenAccountResp: {
    context: tokenAccountResp.context,
    value: [...tokenAccountResp.value, ...token2022Req.value],
  },
});

data after initialization

# token
raydium.token.tokenList
raydium.token.tokenMap
raydium.token.mintGroup


# token account
raydium.account.tokenAccounts
raydium.account.tokenAccountRawInfos

Api methods (https://github.com/raydium-io/raydium-sdk-V2/blob/master/src/api/api.ts)

  • fetch raydium default mint list (mainnet only)
const data = await raydium.api.getTokenList();
  • fetch mints recognizable by raydium
const data = await raydium.api.getTokenInfo([
  "So11111111111111111111111111111111111111112",
  "4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R",
]);
const data = await raydium.api.getPoolList({});
  • fetch poolInfo by id (mainnet only)
// ids: join pool ids by comma(,)
const data = await raydium.api.fetchPoolById({
  ids: "AVs9TA4nWDzfPJE9gGVNJMVhcQy3V9PGazuz33BfG2RA,8sLbNZoA1cfnvMJLPfp98ZLAnFSYCFApfJKMbiXNLwxj",
});
  • fetch pool list by mints (mainnet only)
const data = await raydium.api.fetchPoolByMints({
  mint1: "So11111111111111111111111111111111111111112",
  mint2: "4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R", // optional,
  // extra params: https://github.com/raydium-io/raydium-sdk-V2/blob/master/src/api/type.ts#L249
});
  • fetch farmInfo by id (mainnet only)
// ids: join farm ids by comma(,)
const data = await raydium.api.fetchFarmInfoById({
  ids: "4EwbZo8BZXP5313z5A2H11MRBP15M5n6YxfmkjXESKAW,HUDr9BDaAGqi37xbQHzxCyXvfMCKPTPNF8g9c9bPu1Fu",
});