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

kit-squared

v0.0.1

Published

Solana Kit functionality with SvelteKit

Readme

Kit² ( Kit Squared )

A library that brings Solana Kit functionality to SvelteKit.

Kit² provides wallet connection, transaction functionality (including helpers) and features such as account management as well as program helpers (interfaces) for Anchor programs. It uses @wallet-standard for dealing with wallets.

This library is in development, in a pre-release state. If you stumble across it and find any issues, please let me know via GitHub.

Skip to Contents

Initialising

To initialise the library, you must initialise it with your RPC urls and specify the network type:

init(http, ws, networkType)

Where http and ws are the respective RPC urls, and networkType is either "mainnet","devnet" or "testnet".

Full details available in the Initialisation section of the docs.

Wallet Connection

The Kit² library watches for injected wallets (ie, Phantom, Metamask, etc.).

To connect a specific wallet:

selectWallet(name)

Where name is a string with the name of the injected wallet. The names of all available injected wallets are provided by an array availableWallets.

The library manages the lifecycle of the connection/disconnection process, and allows you to register callbacks for when those processes complete:

onConnect(()=>{
    //do some stuff when the wallet connects
});
onDisconnect(()=>{
    //do some stuff when the wallet disconnects
});

Full details available in the Wallet section of the docs.

Programs

To create an interface/helper for a program, both its IDL and Codama-generated program client must be provided. A signer object (provided by wallet connection) may also be provided, but if it is absent this helper can not be used to send transactions.

createProgram(programClient, idl, signer)

This program helper has methods that make it easy to

  • Send transactions
  • Create Instructions
  • Subscribe to Events
  • Get PDA addesses, and
  • Read Accounts

example:

//Create the helper
const myProgram = createProgram(yourProgramClient, yourIdl, signerFromConnectedWallet);

// Send a myFunction tx
await myProgram.tx.myFunction(somePara, someOtherParam);

// Build a myFunction ix for sending later
const ix = await myProgram.ix.myFunction(somePara, someOtherParam);


// Subscribe to an event called someEvent
myProgram.on('someEvent', (eventData, slotNumber, signature) => {
    const {someParam, someOtherParam} = eventData;

    //do some stuff with someParam and someOtherParam
})


// Get the address of a PDA
const someAccountAddress = await myProgram.pda(["seeds","for","PDA"]);


// Read the value of an account the program owns
//    You can either pass the address if you already know it
const accountData = await myProgram.account.myAccountType(address);

//    or you can pass the seeds like in the PDA function
const accountData = await myProgram.account.myAccountType(["seeds","for","another","PDA"]);

Full details available in the Program section of the docs.

Transactions

Kit² provides functions for sending transactions, both as #methods of program helpers and generic ones for sending any instructions.

It also tracks the transaction state, and fires events when the tx state changes.

Sending Transactions

Send a transaction with any instructions using

transact(ixs, names);

Where ixs is an array of @solana/kit Instructions, and names is an optional array of ix names that will be fired with each tx lifecycle event.

Transaction Lifecycle

Kit² only expects one tx to be in progress at any given time. While it doesn't prevent multiple simultaneous txs, the tx-lifecycle management is simplified for only one.

transactionState

The library provides a store with the current transaction state, $transactionState, which can take the following values:

  • "INITIAL" - No transaction currently in progress
  • "REQUESTED" - Transaction has been requested by library but not submitted by user
  • "PENDING" - Transaction has been submitted by user and is awaiting confirmation or failure.

Note, when a tx is confirmed or fails, it will revert to "INITIAL" state.

Lifecycle Events

The library fires events every time the tx changes state. You may register callbacks for any of these, with the following format:

callback = (names: string[])={
    //do some stuff 
}

The lifecycle events are:

  • onTransaction.request(callback) - A tx was requested
  • onTransaction.submit(callback) - A tx was submitted by user (they clicked send tx on the wallet)
  • onTransaction.confirm(callback) - A tx was confirmed on-chain
  • onTransaction.cancel(callback) - A tx was cancelled by the user
  • onTransaction.fail(callback) - A tx failed

Full details available in the Transaction section of the docs

Accounts

Kit² allows you to easily manage accounts included in a program tx. Where possible, program function and IX invocations will infer account addresses from the IDL/client. But in cases where it isn't possible, or if you want to overwrite the inferred account addresses, you can provide them with addAccounts.

addAccounts({
    accountName: accountAddress,
    otherAccountName: otherAccountAddress,
})

These will be included with any program ix or tx until they are overwritten, or removed with

clearAddedAccounts()

Full details available in the Accounts section of the docs.

Integer types and PDAs

Kit² uses BigInts for dealing with integers, and will be accepted for all integer function params, and be used in all returned integer values.

However, since PDAs pack data in a very specific way when deriving the address, when adding integers as seeds for PDAs, use the following format:

[value, size_in_bits]

so a u16 with the value of 1234 would be passed as

[1234n,16n]

example

// Your PDA seeds are "user" and then the index of the user as a u32, 
//  and you want to get user 67
const address = await myProgram.pda(["user",[67n, 32n]]);

Full details available in the PDA section of the docs.

Contents

Initialisation

Full details on initialising.

Wallet

Managing wallet connections, connect-state lifecycles, and other functionality relating to injected wallets.

Programs

Create Anchor program helpers for easily interacting with deployed programs.

Transactions

Sending transactions and how the library handles transaction lifecycles.

Accounts

Managing accounts included in instructions and transactions.

Utils

Various utilities, some relating specific to Solana, others that are more broadly used by this library.

Example

TODO: example repo showing basic usage of the Kit² library.