Post
Share your knowledge.
Where can I find docs for native staking through TypeScript SDK?
Directly to a validator or through a pool - at least something
- Sui
Answers
3The 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
Sui's native staking is direct delegation to a validator you choose. There isn't a 'pool' in the traditional sense for native staking. However, you can use liquid staking protocols built on Sui if you want a pooled experience and liquidity for your staked SUI.
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.
- How to Maximize Profit Holding SUI: Sui Staking vs Liquid Staking616
- Why does BCS require exact field order for deserialization when Move structs have named fields?65
- Multiple Source Verification Errors" in Sui Move Module Publications - Automated Error Resolution55
- Sui Move Error - Unable to process transaction No valid gas coins found for the transaction419
- Sui Transaction Failing: Objects Reserved for Another Transaction410