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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@degenfrends/solana-rugchecker

v0.0.16

Published

Rug check for solana tokens. Checks if the token is a rug or not.

Downloads

33

Readme

Solana Rugchecker

Static Badge GitHub Actions Workflow Status NPM License NPM Version NPM Downloads GitHub Repo stars

This project is under development. Results might fail or give false results. Please evaluate your current version yourself, until this notice disappears. But things are getting more stable since v0.0.14! Join the discord if you are looking for fellow degen developers!

SPLRugchecker is a TypeScript class that checks if a Solana token is a potential rug pull. It analyzes the blockchain to check the token's metadata, top holders and liquidity, and provides methods to calculate a rug score and determine if the token is a potential rug pull.

Installation

Just install it with npm or yarn or whatever.

npm install "@degenfrends/solana-rugchecker"

Configuration

To create an instance of SPLRugchecker, you need to provide a RugCheckConfig object with the solanaRpcEndpoint and optional poolFilePath or poolAddress property. But if you want to use environment variables for the configuration, that's possible too. You need to download the pool file from https://api.raydium.io/v2/sdk/liquidity/mainnet.json and set the path of the file in the poolFilePath property.

1. Configuration without environment variables

const rugCheckConfig = {
    solanaRpcEndpoint: 'https://api.devnet.solana.com'
    poolFilePath: './mainnet.json' //optional
    poolAddress: '12345pooladdress' //optional, can't be set with environment variable, since it most likely changes on every check
    heliusApiKey: 'your-api-key' //optional
};
const rugChecker = new SPLRugchecker(rugCheckConfig);

2. Configuration with environment variables

If you want to configure the rug checker with environment variables, you need to define a SOLANA_RPC_ENDPOINT variable and pass an empty object {} in the constructor. BE AWARE THAT YOU NEED AN RPC ENDPOINT THAT ALLOWS THE getTokenLargestAccounts CALL! HELIUS.DEV IS WORKING WITH THE FREE TIER FOR EXAMPLE!

SOLANA_RPC_ENDPOINT="https://api.devnet.solana.com"
const rugChecker = new SPLRugchecker({});

Usage

Checking a token

To check a token, call the check method with the token's address. This method returns a Promise that resolves to a RugCheckResult object. With this result you can do your own calculations whether a token is a rug pull or not.

const result = await rugChecker.check('tokenAddress');

Calculating the rug score

If you don't want to implement your own logic to determine the likelyness of a rug pull, you can calculate the rug score with the rugScore method.

const score = rugChecker.rugScore(result);

Determining if a token is a potential rug pull

To determine if a RugCheckResult indicates a potential rug pull, call the isRug method. This is only necessary if you don't want to determine yourself, if the token is a rug or not based on the RugCheckResult object or the rugScoremethod.

Full example

const SPLRugchecker = require('@degenfrends/solana-rugchecker').default;

const rugCheckConfig = {
    solanaRpcEndpoint: 'https://api.devnet.solana.com',
    // If you set this option, you need to provide a downloaded version of this file: https://api.raydium.io/v2/sdk/liquidity/mainnet.json, otherwise the API from geckoterminal.com is used.
    poolFilePath: './mainnet.json',
    // If you set this option, you need to provide the pool address for the token yourself. This might be useful when you build a sniper that is listening on raydium pool creation.
    poolAddress: '97oWtQfbZMdDbn1jdNciDHm2vnPBR8VT3Ns7vSS7i9cm',
    // If you set this option, the metadata checker will try to get the Website and Social Media via Helius if the Metaplex request doesn't return any urls for Twitter, Telegram or the Website.
    heliusApiKey: 'your-helius-key'
};
const rugChecker = new SPLRugchecker(rugCheckConfig);
const result = await rugChecker.check('tokenAddress');
// you can access the detailed results of each check. Log the result to see all information that is returned.
const score = rugChecker.rugScore(result);
const isRug = rugChecker.isRug(result);

You can use the checkers indivudually like this, in this example I use the website checker, which is not included in the actual rugchecking logic. But the whois information can give you additional insights about a website and its owner:

const MetadataChecker = require('@degenfrends/solana-rugchecker').MetadataChecker;
const WebsiteChecker = require('@degenfrends/solana-rugchecker').WebsiteChecker;

// get the token metadata first
const metadataChecker = new MetadataChecker({
    solanaRpcEndpoint: 'https://api.devnet.solana.com',
    heliusApiKey: 'your-api-key'
});
const metadataCheckResult = await metadataChecker.check('1234tokenaddress');

// and then get the whois information for further processing
const websiteChecker = new WebsiteChecker();
const websiteCheckResult = await websiteChecker.check(result.metadata.website);

If you have any questions or suggestions, join the discord!