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

starknet-tokenbound-sdk-test

v0.1.1

Published

SDK for starknet tokenbound accounts

Downloads

7

Readme

Tokenbound SDKs

Tokenbound SDK

This repo houses the Tokenbound SDK, a front-end library for interacting with ERC-6551 accounts on Starknet. The SDK provides an interface for interacting with tokenbound accounts, enabling operations like account creation, transaction execution, token transfers (including ERC-721, ERC-1155, and ERC-20 tokens), and message signing. Any onchain action you can perform with your EOA wallet can be done with your NFT's Tokenbound account.

Packages src - SDK client for all projects, signing enabled via Starknet.js.

Examples

  • examples/sdk-starknetjs - An example app using the tokenbound SDK in a react project with starknetjs
  • examples/sdk-starknetjs-starknetkit-starknet-react - An example app using the tokenbound SDK in a react project with starknetjs, starknetkit and starknet-react

Development Clone repository and install dependencies:

clone the repo

git clone <repo>

install dependencies

npm install

build packages

npm run build

NOTE: Any local changes to SDK methods in TokenboundClient.ts require a rebuild to be useable in the example apps in /example

API Reference

TokenboundClient

The TokenboundClient class provides an interface for interacting with tokenbound accounts, enabling operations like account creation, transaction execution, token transfers (including ERC-721, ERC-1155, and ERC-20 tokens), and message signing.

The client is instantiated with an object containing two parameters:

Parameter

One of account <AccountInterface> or walletClient <WalletClient> is mandatory.

Standard configuration with WalletClient

To configure tokenbound using walletClient:

import { TokenboundClient, WalletClient } from 'starknet-tokenbound-sdk';

const walletClient: WalletClient = {
  address: "0x0617D13Db952a2965580ebAc9DF602debFa12d0eAFB7c1a79D9dA03321169286",
  privateKey: process.env.REACT_APP_PRIVATE_KEY!,
}

const options = {
  walletClient: walletClient,
  registryAddress: registryAddress,
  implementationAddress: implementationAddress,
  jsonRPC: `https://starknet-mainnet.g.alchemy.com/v2/${process.env.REACT_APP_ALCHEMY_API_KEY}`

}

const tokenbound = new TokenboundClient(options)

Standard configuration with Account signer

Refer to the starknet-react documentation, for notes on configuring your StarknetProvider.

import { useAccount, useConnect } from "@starknet-react/core";

const options = {
  account: account,
  registryAddress: registryAddress,
  implementationAddress: implementationAddress,
  jsonRPC: `https://starknet-mainnet.g.alchemy.com/v2/${process.env.REACT_APP_ALCHEMY_API_KEY}`,
};

const tokenbound = new TokenboundClient(options);

For easy reference, we've prepared code examples for a few simple SDK interactions.

TokenboundClient SDK Methods

The TokenboundClient enables creation of and interaction with Tokenbound accounts:

createAccount

Creates a tokenbound account for an NFT. createAccount adds the account to the registry and initializes it for use. Prior to account creation, the address can already receive assets. Deploying the account allows the NFT's owner to interact with the account.

const deployAccount = async () => {
  try {
    await tokenbound.createAccount({
      tokenContract: tokenContract,
      tokenId: tokenId,
      salt: "3000000000",
    });
  } catch (error) {
    console.log(error);
  }
};

Parameter Description Type

  • tokenContract: The address of the token contract. string
  • tokenId: The token ID. string
  • salt: The salt used to create a unique account address (optional) number

getAccount

Gets the tokenbound account address for an NFT.

Returns the tokenbound account address for a given token contract and token ID.

const getAccount = async () => {
  const account = await tokenbound.getAccount({
    tokenContract: tokenContract,
    tokenId: tokenId,
    salt: "3000000000",
  });
};

Parameter Description Type

  • tokenContract: The address of the token contract. string
  • tokenId: The token ID. string
  • salt: The salt used when the account was created (optional) number

checkAccountDeployment

Check if the tokenbound account address has been activated using createAccount.

Returns a boolean and classHash indicating if a tokenbound account has been deployed (created) at the accountAddress

const getDeploymentStatus = async () => {
  const status = await tokenbound.checkAccountDeployment({
    tokenContract,
    tokenId,
    salt: "3000000000",
  });
  setDeployStatus(status?.deployed);
  setAccountClassHash(status?.classHash);
};

Parameter Description Type

  • tokenContract: The token contract address
  • tokenId: The token ID
  • salt