Sui.

Post

Share your knowledge.

0xduckmove.
May 01, 2025
Expert Q&A

Where can I find docs for native staking through TypeScript SDK?

Directly to a validator or through a pool - at least something

  • Sui
1
1
Share
Comments
.

Answers

1
HaGiang.
May 1 2025, 02:56

The Sui blockchain provides a system Move module with a function request_add_stake that facilitates staking. You can invoke this function using the TypeScript SDK as follows:

import { SuiClient, TransactionBlock } from '@mysten/sui';

// Initialize the Sui client
const client = new SuiClient({ network: 'mainnet' }); // or 'testnet', 'devnet', etc.

async function stakeSUI(validatorAddress: string, amount: number) {
  const tx = new TransactionBlock();

  // Construct the staking transaction
  tx.moveCall({
    target: '0x2::sui_system::request_add_stake',
    arguments: [validatorAddress, amount.toString()],
  });

  // Sign and execute the transaction
  const response = await client.signAndExecuteTransaction(tx);
  console.log('Stake Transaction Response:', response);
}

This code initializes a transaction to stake a specified amount of SUI tokens to a given validator address. Ensure that the validatorAddress is accurate and that your wallet has sufficient funds for staking and gas fees.

For more comprehensive details on the SDK, visit the official documentation. https://sdk.mystenlabs.com/typedoc/index.html

2
Comments
.

Do you know the answer?

Please log in and share it.

Sui is a Layer 1 protocol blockchain designed as the first internet-scale programmable blockchain platform.

317Posts457Answers
Sui.X.Peera.

Earn Your Share of 1000 Sui

Gain Reputation Points & Get Rewards for Helping the Sui Community Grow.

Reward CampaignJune
We use cookies to ensure you get the best experience on our website.
More info