npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@okxweb3/coin-solana

v2.4.8

Published

A solana SDK for building Web3 wallets and applications.

Downloads

1,430

Readme

@okxweb3/coin-solana

Solana SDK is used to interact with the Solana Chain, it contains the main functions you need when interact with Solana Ecosystem.

Getting Started

Installing Solana SDK

npm install @okxweb3/coin-solana

What Can Solana SDK Do

- getRandomPrivateKey
- getNewAddress
- validAddress
- caclTxHash
- signTransaction
- signMessage
- validSignedTransaction

Using Solana SDK

Get Private Key

random private key

import {SolWallet} from "@okxweb3/coin-solana";

let wallet = new SolWallet()
let privateKey = await wallet.getRandomPrivateKey();

derived private key

import {SolWallet} from "@okxweb3/coin-solana";

let wallet = new SolWallet()
let param = {
    mnemonic: 'stool trumpet fame umbrella bench provide battle toward story fruit lock view',
    hdPath: "m/44'/501'/0'/0'"
};
let privateKey = await wallet.getDerivedPrivateKey(param);

Get Address / Validate Address

import {SolWallet} from "@okxweb3/coin-solana";

let wallet = new SolWallet()
let params = {
    privateKey: "548yT115QRHH7Mpchg9JJ8YPX9RTKuan7oeB9ruMULDGhdqBmG18RBSv54Fpv2BvrC1yVpGdjzAPKHNYUwPBePKc"
};
let addr = await wallet.getNewAddress(params);
// validate
let addrParam{
    address: addr
};
let valid = await wallet.validAddress(addrParam);

Transaction

signTransaction parameter definitions are as follows

  • type transaction type, support "transfer" | "tokenTransfer" | "mplTransfer"
    • transfer represents SOL token transfer
    • tokenTransfer represents SPL token transfer, similar to ERC20 protocol tokens
    • mplTransfer represents NFT token transfer
  • payer address, represents the address that pays transaction fees
  • blockHash, 32-byte array representing the recent block hash
  • from address, represents the SOL token sender address
  • to address, represents the SOL token recipient address
  • amount number, represents the amount of SOL tokens to transfer, SOL token precision is 8
  • mint address, represents the token address
  • createAssociatedAddress boolean, indicates whether to create ATA address
  • version number, transaction version
  • tokenStandard TokenStandard, represents the transaction standard, with the following five values
    • NonFungible,
    • FungibleAsset,
    • Fungible,
    • NonFungibleEdition,
    • ProgrammableNonFungible,
  • token2022 boolean, true represents token2022 standard SPL tokens, false represents SPL token standard tokens
  • decimal number, represents the precision of token2022 standard SPL tokens, this field is required when transferring tokens of this standard.
  • computeUnitLimit represents the number of compute units each instruction can consume in the transaction
  • computeUnitPrice represents the price per compute unit
  • needPriorityFee boolean, used together with computeUnitLimit and computeUnitPrice to manually set transaction fee parameters.

transfer

import {SolWallet} from "@okxweb3/coin-solana";

let wallet = new SolWallet()
let params = {
    privateKey: '548yT115QRHH7Mpchg9JJ8YPX9RTKuan7oeB9ruMULDGhdqBmG18RBSv54Fpv2BvrC1yVpGdjzAPKHNYUwPBePKc',
    data: {
        type: "transfer",
        payer: "FZNZLT5diWHooSBjcng9qitykwcL9v3RiNrpC3fp9PU1",
        blockHash: "6t1qEvLH5uC9NMmMTPhaE9tAaWdk1qvBjqsKsKNPB7sX",
        from: "FZNZLT5diWHooSBjcng9qitykwcL9v3RiNrpC3fp9PU1",
        to: "7NRmECq1R4tCtXNvmvDAuXmii3vN1J9DRZWhMCuuUnkM",
        amount: 100000000,
        computeUnitLimit: 140000,
        computeUnitPrice: 10
    }
}
let tx = await wallet.signTransaction(params);

// validate signature
const checkParam = {
    tx: tx,
}
const ok = await wallet.validSignedTransaction(checkParam);

token transfer

import {SolWallet} from "@okxweb3/coin-solana";

let wallet = new SolWallet()
let param = {
    privateKey: '548yT115QRHH7Mpchg9JJ8YPX9RTKuan7oeB9ruMULDGhdqBmG18RBSv54Fpv2BvrC1yVpGdjzAPKHNYUwPBePKc',
    data: {
        type: "tokenTransfer",
        payer: "FZNZLT5diWHooSBjcng9qitykwcL9v3RiNrpC3fp9PU1",
        blockHash: "HwN3QorABLpYftu9FeE1FGrwrBK1aAhhz3cirEVrN3Fn",
        from: "FZNZLT5diWHooSBjcng9qitykwcL9v3RiNrpC3fp9PU1",
        to: "7NRmECq1R4tCtXNvmvDAuXmii3vN1J9DRZWhMCuuUnkM",
        amount: 100000,
        mint: "4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU",
        createAssociatedAddress: false,
        token2022: false,
        decimal: 9,
        computeUnitLimit: 140000,
        computeUnitPrice: 10
    }
}
let tx = await wallet.signTransaction(param);

const checkParam = {
    tx: tx,
}
const v = await wallet.validSignedTransaction(checkParam);

pNft transfer

import {SolWallet} from "@okxweb3/coin-solana";

let wallet = new SolWallet()
let param = {
    privateKey: '548yT115QRHH7Mpchg9JJ8YPX9RTKuan7oeB9ruMULDGhdqBmG18RBSv54Fpv2BvrC1yVpGdjzAPKHNYUwPBePKc', 
    data: {
        type: "mplTransfer",
        payer: "CS8ifB68oddKXdW87RAyrxFSoz1DMMcX9WsWeAgbYDCC",
        blockHash: "8MnQifmv14ELwdkK5NJso9cofN8iNpHy6n6Nnxy7pn8v",
        from: "CS8ifB68oddKXdW87RAyrxFSoz1DMMcX9WsWeAgbYDCC",
        to: "9qinWp4oc3TvBocbwAvYZAZWfSswub2qM49Pn6rkCQ9q",
        mint: "DberpiNB1sttkWdd66amQV5hrnMGacBeDeMbcEFMVBiR",
        computeUnitLimit: 140000,
        computeUnitPrice: 10
    }
}
let tx = await wallet.signTransaction(param);

sign message

import {SolWallet} from "@okxweb3/coin-solana";

let wallet = new SolWallet()
let param = {
    privateKey: "548yT115QRHH7Mpchg9JJ8YPX9RTKuan7oeB9ruMULDGhdqBmG18RBSv54Fpv2BvrC1yVpGdjzAPKHNYUwPBePKc", 
    data: 'your message to sign'
}
let tx = await wallet.signMessage(param);

deserialize message

import {SolWallet} from "@okxweb3/coin-solana";

let wallet = new SolWallet()
let param = {
    //privateKey: "548yT115QRHH7Mpchg9JJ8YPX9RTKuan7oeB9ruMULDGhdqBmG18RBSv54Fpv2BvrC1yVpGdjzAPKHNYUwPBePKc", 
    data: ['your message to deserialize']
}
let res = await wallet.deserializeMessages(param);

calculate tx hash

import {SolWallet} from "@okxweb3/coin-solana";

let wallet = new SolWallet()
let param = {
    data: "your data to sign",
};
const tx = await wallet.calcTxHash(param);

License: MIT