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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@sanctumso/inf1

v0.0.1-dev-9

Published

Typescript + WASM SDK for Sanctum Infinity program V1.

Downloads

36

Readme

@sanctumso/inf1

Typescript + WASM SDK for Sanctum Infinity program V1.

Example Usage

import {
  assertAccountsExist,
  createSolanaRpc,
  fetchEncodedAccounts,
  type Address,
  type IInstruction,
  type Rpc,
  type SolanaRpcApi,
} from "@solana/kit";
import {
  accountsToUpdateForTrade,
  init,
  initPks,
  quoteTradeExactIn,
  tradeExactInIx,
  updateForTrade,
  type AccountMap,
  type SplPoolAccounts,
} from "@sanctumso/inf1";
import initSdk from "@sanctumso/inf1";

// The SDK needs to be initialized once globally before it can be used (idempotent).
// For nodejs environments, use
// `import { initSyncEmbed } from "@sanctumso/inf1"; initSyncEmbed();`
// instead
await initSdk();

const LAINESOL = "LAinEtNLgpmCP9Rvsf5Hn8W6EhNiKLZQti1xfWMLy6X";
const WSOL = "So11111111111111111111111111111111111111112";
const SPL_POOL_ACCOUNTS: SplPoolAccounts = new Map(Object.entries({
  [LAINESOL]: "2qyEeSAWKfU18AFthrF7JA8z8ZCi1yt76Tqs917vwQTV",
  // ...populate rest of `spl lst mint: stake pool addr` data
  // for every spl lst mints in the INF pool (all 3 spl program deploys).
  // To support SPL LSTs that are added later on, the `appendSplLsts` fn
  // can be used to add data
}));

// If out === INF mint, then below code will work the same,
// but the quote and instruction will be for AddLiquidity instead of SwapExactIn.
//
// If inp === INF mint, then below code will work the same,
// but the quote and instruction will be for RemoveLiquidity instead of SwapExactIn.
const SWAP_MINTS = { inp: LAINESOL, out: WSOL };

async function fetchAccountMap(
  rpc: Rpc<SolanaRpcApi>,
  accounts: string[]
): Promise<AccountMap> {
  const fetched = await fetchEncodedAccounts(rpc, accounts);
  assertAccountsExist(fetched);
  return new Map(
    fetched.map(({ address, data, programAddress }) => [
      address,
      { data, owner: programAddress },
    ])
  );
}

const rpc = createSolanaRpc("https://api.mainnet-beta.solana.com");

// init
const ipks = initPks();
const initAccs = await fetchAccountMap(rpc, ipks);
const inf = init(
  initAccs,
  SPL_POOL_ACCOUNTS
);

// update
const updateAccs = await fetchAccountMap(
  rpc,
  accountsToUpdateForTrade(inf, SWAP_MINTS)
);
updateForTrade(inf, SWAP_MINTS, updateAccs);

// quote
const amt = 1_000_000_000n;
const quote = quoteTradeExactIn(inf, {
  amt,
  mints: SWAP_MINTS,
});

// create transaction instruction

// user-provided pubkeys
const signer = ...;
const inpTokenAcc = ...;
const outTokenAcc = ...;

const ixUncasted = tradeExactInIx(inf, {
  amt,
  limit: quote.out,
  mints: SWAP_MINTS,
  signer,
  tokenAccs: {
    inp: inpTokenAcc,
    out: outTokenAcc,
  },
});
// return type is compatible with kit,
// but needs to be casted explicitly
const ix = ixUncasted as unknown as IInstruction;

Build

Prerequisites

  • wasm-pack
  • make (optional, you can just run the wasm-pack commands manually)