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

@stakefish/sdk-sui

v0.0.1-rc.3

Published

stake.fish SUI staking SDK

Readme

@stakefish/sdk-sui

The @stakefish/sdk-sui is a JavaScript/TypeScript library that provides a unified interface for staking operations on the Sui blockchain with stake.fish validators. It allows developers to easily delegate stakes, undelegate, sign transactions, and broadcast them to the network.

Table of Contents

Installation

To use this SDK in your project, install it via npm or yarn:

npm install @stakefish/sdk-sui
yarn add @stakefish/sdk-sui

API Reference

Constructor

interface SuiConfig {
  rpcUrl?: string;
}

export class Sui {
  constructor(config?: SuiConfig)
...
  • rpcUrl (optional): Custom Sui RPC endpoint URL (default: 'https://fullnode.mainnet.sui.io')

Delegation

delegate(delegatorAddress: string, amount: string): Promise<SuiUnsignedTransaction>

Creates an unsigned transaction for delegating a specified amount of SUI tokens (in MIST, the smallest unit) from the delegator's address to the stake.fish validator.

Parameters:

  • delegatorAddress: The Sui address of the delegator (e.g., '0x123...')
  • amount: The amount to delegate in MIST (1 SUI = 1,000,000,000 MIST)

Undelegation

undelegate(delegatorAddress: string, stakeId: string): Promise<SuiUnsignedTransaction>

Creates an unsigned transaction for undelegating from a specific stake position identified by stakeId. The entire stake is withdrawn.

Parameters:

  • delegatorAddress: The Sui address of the delegator
  • stakeId: The unique identifier (object ID) of the stake position to undelegate. You can find this on Suiscan or by querying your stake positions.

Signing

sign(privateKey: string, unsignedTx: SuiUnsignedTransaction): Promise<SuiSignedTransaction>

Signs the unsigned transaction using the provided private key. This operation works completely offline and does not require network connectivity.

Parameters:

  • privateKey: The private key in one of the following formats:
    • Bech32 encoded (e.g., suiprivkey1...) - Standard Sui wallet export format
    • Hex with 0x prefix (e.g., 0x1234...)
    • Raw hex without prefix (e.g., 1234...)
  • unsignedTx: The unsigned transaction object from delegate() or undelegate()

Broadcasting

broadcast(signedTransaction: SuiSignedTransaction, checkInclusion?: boolean, timeoutMs?: number, pollIntervalMs?: number): Promise<SuiTransactionBroadcastResult>

Broadcasts the signed transaction to the Sui network and optionally waits for inclusion confirmation.

Parameters:

  • signedTransaction: The signed transaction object from sign()
  • checkInclusion (optional): Whether to wait for transaction inclusion (default: true)
  • timeoutMs (optional): Maximum time to wait for inclusion in milliseconds (default: 60000)
  • pollIntervalMs (optional): Interval between inclusion checks in milliseconds (default: 2000)

Returns: SuiTransactionBroadcastResult object containing:

  • txId: The transaction digest/hash
  • success: Boolean indicating if the transaction was successful
  • error: Error message if the transaction failed (optional)

Examples

Full delegation example

import { Sui } from '@stakefish/sdk-sui';
// or: const { Sui } = require('@stakefish/sdk-sui');

const delegator = process.env.SUI_ADDRESS;
const privateKey = process.env.SUI_PRIVATE_KEY;

async function main() {
  const sui = new Sui();

  // Delegation (1 SUI = 1,000,000,000 MIST)
  const tx = await sui.delegate(delegatorAddress, '1000000000');

  // Sign
  const signedTx = await sui.sign(privateKey, tx);

  // Broadcast
  const result = await sui.broadcast(signedTx);
  console.log('Broadcast result:', JSON.stringify(result));
}

void main().catch(console.error);

Undelegation

const tx = await sui.undelegate(delegatorAddress, stakeId);

Configuration

The SDK uses default RPC endpoints for Sui mainnet. You can configure custom endpoints and options during instantiation:

const sui = new Sui({
  rpcUrl: 'https://custom-rpc.sui.io',
});

Notes

  • All amounts in the SDK are specified in MIST, the smallest unit of SUI (1 SUI = 1,000,000,000 MIST)
  • The SDK automatically handles gas estimation and payment for transactions
  • Private keys should be kept secure and never committed to version control