Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@solana/client

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@solana/client - npm Package Compare versions

Comparing version
1.4.0
to
1.4.1
+116
-1
dist/types/features/sol.d.ts
import { type Address, type Blockhash, type Commitment, type Slot, signature, signTransactionMessageWithSigners, type TransactionPlan, type TransactionSigner, type TransactionVersion } from '@solana/kit';
import type { SolanaClientRuntime } from '../rpc/types';
import type { WalletSession } from '../wallet/types';
/**
* Blockhash and last valid block height for transaction lifetime.
* Used to ensure transactions expire after a certain block height.
*/
type BlockhashLifetime = Readonly<{

@@ -8,36 +12,147 @@ blockhash: Blockhash;

}>;
/**
* Amount of SOL to transfer. Can be specified as:
* - `bigint`: Raw lamports (1 SOL = 1_000_000_000 lamports)
* - `number`: SOL amount as decimal (e.g., 1.5 for 1.5 SOL)
* - `string`: SOL amount as string (e.g., "1.5" for 1.5 SOL)
*/
type SolTransferAmount = bigint | number | string;
/**
* Authority that signs the SOL transfer transaction.
* Can be either a connected wallet session or a raw transaction signer.
*/
type SolTransferAuthority = TransactionSigner<string> | WalletSession;
type SignableSolTransactionMessage = Parameters<typeof signTransactionMessageWithSigners>[0];
/**
* Configuration for preparing a SOL transfer transaction.
*
* @example
* ```ts
* const config: SolTransferPrepareConfig = {
* amount: 1_000_000_000n, // 1 SOL in lamports
* authority: walletSession,
* destination: 'RecipientAddress...',
* commitment: 'confirmed',
* };
* ```
*/
export type SolTransferPrepareConfig = Readonly<{
/** Amount of SOL to transfer in lamports, decimal SOL, or string SOL. */
amount: SolTransferAmount;
/** Authority that signs the transaction. Can be a WalletSession or raw TransactionSigner. */
authority: SolTransferAuthority;
/** Commitment level for fetching blockhash and sending transaction. Defaults to client commitment. */
commitment?: Commitment;
/** Destination wallet address to receive the SOL. */
destination: Address | string;
/** Optional pre-fetched blockhash lifetime. If not provided, one will be fetched. */
lifetime?: BlockhashLifetime;
/** Transaction version. Defaults to 0 (legacy). */
transactionVersion?: TransactionVersion;
}>;
/**
* Options for sending a SOL transfer transaction.
*
* @example
* ```ts
* const options: SolTransferSendOptions = {
* commitment: 'confirmed',
* maxRetries: 3,
* skipPreflight: false,
* };
* ```
*/
export type SolTransferSendOptions = Readonly<{
/** AbortSignal to cancel the transaction. */
abortSignal?: AbortSignal;
/** Commitment level for transaction confirmation. */
commitment?: Commitment;
/** Maximum number of times to retry sending the transaction. */
maxRetries?: bigint | number;
/** Minimum slot that the request can be evaluated at. */
minContextSlot?: Slot;
/** If true, skip the preflight transaction checks. */
skipPreflight?: boolean;
}>;
/**
* A prepared SOL transfer transaction ready to be signed and sent.
* Contains the transaction message, signer, and metadata needed for submission.
*/
type PreparedSolTransfer = Readonly<{
/** Commitment level used for this transaction. */
commitment?: Commitment;
/** Blockhash lifetime for transaction expiration. */
lifetime: BlockhashLifetime;
/** The unsigned transaction message. */
message: SignableSolTransactionMessage;
/** Signing mode: 'send' for wallets that sign+send, 'partial' for separate signing. */
mode: 'partial' | 'send';
/** The transaction signer. */
signer: TransactionSigner;
/** Transaction plan for execution. */
plan?: TransactionPlan;
}>;
/**
* Helper interface for native SOL transfers using the System Program.
* Provides methods to prepare, sign, and send SOL transfer transactions.
*
* @example
* ```ts
* import { createSolTransferHelper } from '@solana/client';
*
* const helper = createSolTransferHelper(runtime);
*
* // Simple transfer
* const signature = await helper.sendTransfer({
* amount: 1_000_000_000n, // 1 SOL
* authority: walletSession,
* destination: 'RecipientAddress...',
* });
*
* // Or prepare and send separately
* const prepared = await helper.prepareTransfer({ ... });
* const signature = await helper.sendPreparedTransfer(prepared);
* ```
*/
export type SolTransferHelper = Readonly<{
/**
* Prepares a SOL transfer transaction without sending it.
* Use this when you need to inspect or modify the transaction before sending.
*/
prepareTransfer(config: SolTransferPrepareConfig): Promise<PreparedSolTransfer>;
/**
* Sends a previously prepared SOL transfer transaction.
* Use this after prepareTransfer() to submit the transaction.
*/
sendPreparedTransfer(prepared: PreparedSolTransfer, options?: SolTransferSendOptions): Promise<ReturnType<typeof signature>>;
/**
* Prepares and sends a SOL transfer in one call.
* This is the simplest way to transfer SOL.
*/
sendTransfer(config: SolTransferPrepareConfig, options?: SolTransferSendOptions): Promise<ReturnType<typeof signature>>;
}>;
/** Creates documented helpers that build and submit System Program SOL transfers. */
/**
* Creates helpers for building and submitting native SOL transfers via the System Program.
*
* @param runtime - The Solana client runtime with RPC connection.
* @returns A SolTransferHelper with methods to prepare and send SOL transfers.
*
* @example
* ```ts
* import { createClient } from '@solana/client';
*
* const client = createClient({ cluster: 'devnet' });
* const helper = client.helpers.sol;
*
* // Transfer 0.5 SOL
* const sig = await helper.sendTransfer({
* amount: 0.5, // Can use decimal SOL
* authority: session,
* destination: 'RecipientAddress...',
* });
* console.log('Transfer signature:', sig);
* ```
*/
export declare function createSolTransferHelper(runtime: SolanaClientRuntime): SolTransferHelper;
export {};
//# sourceMappingURL=sol.d.ts.map
+1
-1

@@ -1,1 +0,1 @@

{"version":3,"file":"sol.d.ts","sourceRoot":"","sources":["../../../src/features/sol.ts"],"names":[],"mappings":"AACA,OAAO,EACN,KAAK,OAAO,EAGZ,KAAK,SAAS,EACd,KAAK,UAAU,EAMf,KAAK,IAAI,EAIT,SAAS,EACT,iCAAiC,EAEjC,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,MAAM,aAAa,CAAC;AAIrB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAExD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,KAAK,iBAAiB,GAAG,QAAQ,CAAC;IACjC,SAAS,EAAE,SAAS,CAAC;IACrB,oBAAoB,EAAE,MAAM,CAAC;CAC7B,CAAC,CAAC;AAEH,KAAK,iBAAiB,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAElD,KAAK,oBAAoB,GAAG,i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,MAAM,EAAE,wBAAwB,EAChC,OAAO,CAAC,EAAE,sBAAsB,GAC9B,OAAO,CAAC,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC;CACzC,CAAC,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,mBAAmB,GAAG,iBAAiB,CAyFvF"}

@@ -5,2 +5,6 @@ import { type Address, type Blockhash, type Commitment, signature, signTransactionMessageWithSigners, type TransactionPlan, type TransactionSigner, type TransactionVersion } from '@solana/kit';

import type { SolTransferSendOptions } from './sol';
/**
* Blockhash and last valid block height for transaction lifetime.
* Used to ensure transactions expire after a certain block height.
*/
type BlockhashLifetime = Readonly<{

@@ -10,53 +14,211 @@ blockhash: Blockhash;

}>;
/**
* Authority that signs SPL token transfer transactions.
* Can be either a connected wallet session or a raw transaction signer.
*/
type SplTokenAuthority = TransactionSigner<string> | WalletSession;
type SignableSplTransactionMessage = Parameters<typeof signTransactionMessageWithSigners>[0];
/**
* Configuration for creating an SPL token helper.
* Each helper instance is bound to a specific token mint.
*
* @example
* ```ts
* const config: SplTokenHelperConfig = {
* mint: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', // USDC
* decimals: 6, // Optional: provide to skip on-chain lookup
* commitment: 'confirmed',
* };
* ```
*/
export type SplTokenHelperConfig = Readonly<{
/** Associated Token Program address. Defaults to standard ATA program. */
associatedTokenProgram?: Address | string;
/** Commitment level for RPC calls. */
commitment?: Commitment;
/** Token decimals. If not provided, will be fetched from the mint account. */
decimals?: number;
/** The SPL token mint address. */
mint: Address | string;
/** Token Program address. Defaults to standard Token Program. */
tokenProgram?: Address | string;
}>;
/**
* SPL token balance information for an owner's Associated Token Account.
*
* @example
* ```ts
* const balance: SplTokenBalance = {
* amount: 1000000n, // Raw token amount in base units
* ataAddress: 'TokenAccountAddress...',
* decimals: 6,
* exists: true,
* uiAmount: '1.0', // Human-readable amount
* };
* ```
*/
export type SplTokenBalance = Readonly<{
/** Token amount in base units (smallest denomination). */
amount: bigint;
/** The Associated Token Account address. */
ataAddress: Address;
/** Number of decimals for this token. */
decimals: number;
/** Whether the token account exists on-chain. */
exists: boolean;
/** Human-readable token amount as a string. */
uiAmount: string;
}>;
/**
* Configuration for preparing an SPL token transfer transaction.
*
* @example
* ```ts
* const config: SplTransferPrepareConfig = {
* amount: '10.5', // Transfer 10.5 tokens
* authority: walletSession,
* destinationOwner: 'RecipientWalletAddress...',
* ensureDestinationAta: true, // Create ATA if needed
* };
* ```
*/
export type SplTransferPrepareConfig = Readonly<{
/** Amount to transfer. Interpreted based on amountInBaseUnits flag. */
amount: bigint | number | string;
/** If true, amount is in base units (raw). If false (default), amount is in decimal tokens. */
amountInBaseUnits?: boolean;
/** Authority that signs the transaction. Can be a WalletSession or raw TransactionSigner. */
authority: SplTokenAuthority;
/** Commitment level for RPC calls. */
commitment?: Commitment;
/** Wallet address of the recipient (not their token account). */
destinationOwner: Address | string;
/** Optional: explicit destination token account. If not provided, ATA is derived. */
destinationToken?: Address | string;
/** If true (default), creates the destination ATA if it doesn't exist. */
ensureDestinationAta?: boolean;
/** Optional pre-fetched blockhash lifetime. */
lifetime?: BlockhashLifetime;
/** Source wallet owner. Defaults to authority address. */
sourceOwner?: Address | string;
/** Optional: explicit source token account. If not provided, ATA is derived. */
sourceToken?: Address | string;
/** Transaction version. Defaults to 0 (legacy). */
transactionVersion?: TransactionVersion;
}>;
/**
* A prepared SPL token transfer transaction ready to be signed and sent.
* Contains all the information needed to submit the transaction.
*/
type PreparedSplTransfer = Readonly<{
/** Token amount in base units. */
amount: bigint;
/** Commitment level used. */
commitment?: Commitment;
/** Token decimals. */
decimals: number;
/** Destination Associated Token Account address. */
destinationAta: Address;
/** Blockhash lifetime for transaction expiration. */
lifetime: BlockhashLifetime;
/** The unsigned transaction message. */
message: SignableSplTransactionMessage;
/** Signing mode: 'send' for wallets that sign+send, 'partial' for separate signing. */
mode: 'partial' | 'send';
/** The transaction signer. */
signer: TransactionSigner;
/** Source Associated Token Account address. */
sourceAta: Address;
/** Transaction plan for execution. */
plan?: TransactionPlan;
}>;
/**
* Helper interface for SPL token operations including balance queries and transfers.
* Each helper instance is bound to a specific token mint.
*
* @example
* ```ts
* import { createSplTokenHelper } from '@solana/client';
*
* // Create helper for USDC
* const usdc = createSplTokenHelper(runtime, {
* mint: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
* decimals: 6,
* });
*
* // Check balance
* const balance = await usdc.fetchBalance(walletAddress);
* console.log(`Balance: ${balance.uiAmount} USDC`);
*
* // Transfer tokens
* const sig = await usdc.sendTransfer({
* amount: 10, // 10 USDC
* authority: walletSession,
* destinationOwner: recipientAddress,
* });
* ```
*/
export type SplTokenHelper = Readonly<{
/**
* Derives the Associated Token Account (ATA) address for an owner.
* The ATA is a deterministic address based on the owner and mint.
*/
deriveAssociatedTokenAddress(owner: Address | string): Promise<Address>;
/**
* Fetches the token balance for an owner's Associated Token Account.
* Returns balance info including whether the account exists.
*/
fetchBalance(owner: Address | string, commitment?: Commitment): Promise<SplTokenBalance>;
/**
* Prepares a token transfer transaction without sending it.
* Use this when you need to inspect or modify the transaction before sending.
*/
prepareTransfer(config: SplTransferPrepareConfig): Promise<PreparedSplTransfer>;
/**
* Sends a previously prepared token transfer transaction.
* Use this after prepareTransfer() to submit the transaction.
*/
sendPreparedTransfer(prepared: PreparedSplTransfer, options?: SolTransferSendOptions): Promise<ReturnType<typeof signature>>;
/**
* Prepares and sends a token transfer in one call.
* Automatically creates the destination ATA if it doesn't exist (configurable).
*/
sendTransfer(config: SplTransferPrepareConfig, options?: SolTransferSendOptions): Promise<ReturnType<typeof signature>>;
}>;
/** Creates helpers dedicated to SPL token account discovery, balances, and transfers. */
/**
* Creates helpers for SPL token operations bound to a specific token mint.
* Supports balance queries, ATA derivation, and token transfers.
*
* @param runtime - The Solana client runtime with RPC connection.
* @param config - Configuration specifying the token mint and optional settings.
* @returns An SplTokenHelper with methods for token operations.
*
* @example
* ```ts
* import { createClient } from '@solana/client';
*
* const client = createClient({ cluster: 'mainnet-beta' });
*
* // Create a helper for USDC
* const usdc = client.helpers.spl({
* mint: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
* decimals: 6, // Skip on-chain lookup
* });
*
* // Get token balance
* const balance = await usdc.fetchBalance(myWallet);
* if (balance.exists) {
* console.log(`USDC balance: ${balance.uiAmount}`);
* }
*
* // Transfer tokens
* const sig = await usdc.sendTransfer({
* amount: '25.50', // Can use string decimals
* authority: session,
* destinationOwner: recipientWallet,
* });
* ```
*/
export declare function createSplTokenHelper(runtime: SolanaClientRuntime, config: SplTokenHelperConfig): SplTokenHelper;
export {};
//# sourceMappingURL=spl.d.ts.map

@@ -1,1 +0,1 @@

{"version":3,"file":"spl.d.ts","sourceRoot":"","sources":["../../../src/features/spl.ts"],"names":[],"mappings":"AACA,OAAO,EACN,KAAK,OAAO,EAGZ,KAAK,SAAS,EACd,KAAK,UAAU,EAWf,SAAS,EACT,iCAAiC,EAEjC,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,MAAM,aAAa,CAAC;AAUrB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAExD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,OAAO,CAAC;AAEpD,KAAK,iBAAiB,GAAG,QAAQ,CAAC;IACjC,SAAS,EAAE,SAAS,CAAC;IACrB,oBAAoB,EAAE,MAAM,CAAC;CAC7B,CAAC,CAAC;AAEH,KAAK,iBAAiB,GAAG,iBAAiB,CAAC,MAAM,CAAC,GAAG,aAAa,CAAC;AAEnE,KAAK,6BAA6B,GAAG,UAAU,CAAC,OAAO,iCAAiC,CAAC,CAAC,CAAC,CAAC,CAAC;AAE7F,MAAM,MAAM,oBAAoB,GAAG,Q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,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACxE;;;OAGG;IACH,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,UAAU,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IACzF;;;OAGG;IACH,eAAe,CAAC,MAAM,EAAE,wBAAwB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAChF;;;OAGG;IACH,oBAAoB,CACnB,QAAQ,EAAE,mBAAmB,EAC7B,OAAO,CAAC,EAAE,sBAAsB,GAC9B,OAAO,CAAC,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC;IACzC;;;OAGG;IACH,YAAY,CACX,MAAM,EAAE,wBAAwB,EAChC,OAAO,CAAC,EAAE,sBAAsB,GAC9B,OAAO,CAAC,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC;CACzC,CAAC,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,oBAAoB,GAAG,cAAc,CA8M/G"}
import { type Address, type Blockhash, type Commitment, type Slot, signature, signTransactionMessageWithSigners, type TransactionPlan, type TransactionSigner, type TransactionVersion } from '@solana/kit';
import type { SolanaClientRuntime } from '../rpc/types';
import type { WalletSession } from '../wallet/types';
/**
* Blockhash and last valid block height for transaction lifetime.
* Used to ensure transactions expire after a certain block height.
*/
type BlockhashLifetime = Readonly<{

@@ -8,5 +12,29 @@ blockhash: Blockhash;

}>;
/**
* Amount of SOL to stake. Can be specified as:
* - `bigint`: Raw lamports (1 SOL = 1_000_000_000 lamports)
* - `number`: SOL amount as decimal (e.g., 1.5 for 1.5 SOL)
* - `string`: SOL amount as string (e.g., "1.5" for 1.5 SOL)
*/
type StakeAmount = bigint | number | string;
/**
* Authority that signs staking transactions.
* Can be either a connected wallet session or a raw transaction signer.
*/
type StakeAuthority = TransactionSigner<string> | WalletSession;
/**
* Represents a stake account with its delegation and metadata.
* Returned by getStakeAccounts() when querying stake positions.
*
* @example
* ```ts
* const accounts = await stakeHelper.getStakeAccounts(walletAddress);
* for (const acc of accounts) {
* const delegation = acc.account.data.parsed.info.stake?.delegation;
* console.log(`Staked ${acc.account.lamports} to validator ${delegation?.voter}`);
* }
* ```
*/
export type StakeAccount = {
/** The stake account's public key address. */
pubkey: Address;

@@ -19,5 +47,9 @@ account: {

delegation?: {
/** The validator vote account receiving the stake. */
voter: string;
/** Amount of lamports delegated. */
stake: string;
/** Epoch when stake became active. */
activationEpoch: string;
/** Epoch when stake will deactivate (max value if active). */
deactivationEpoch: string;

@@ -27,10 +59,16 @@ };

meta?: {
/** Rent-exempt reserve in lamports. */
rentExemptReserve: string;
authorized: {
/** Address authorized to delegate/undelegate. */
staker: string;
/** Address authorized to withdraw. */
withdrawer: string;
};
lockup: {
/** Unix timestamp when lockup expires (0 if none). */
unixTimestamp: number;
/** Epoch when lockup expires (0 if none). */
epoch: number;
/** Custodian who can modify lockup (system program if none). */
custodian: string;

@@ -42,2 +80,3 @@ };

};
/** Total lamports in the stake account. */
lamports: bigint;

@@ -47,34 +86,109 @@ };

type SignableStakeTransactionMessage = Parameters<typeof signTransactionMessageWithSigners>[0];
/**
* Configuration for preparing a stake delegation transaction.
* Creates a new stake account and delegates it to a validator.
*
* @example
* ```ts
* const config: StakePrepareConfig = {
* amount: 10, // Stake 10 SOL
* authority: walletSession,
* validatorId: 'ValidatorVoteAccountAddress...',
* };
* ```
*/
export type StakePrepareConfig = Readonly<{
/** Amount of SOL to stake in lamports, decimal SOL, or string SOL. */
amount: StakeAmount;
/** Authority that signs the transaction. Will be set as staker and withdrawer. */
authority: StakeAuthority;
/** Commitment level for RPC calls. */
commitment?: Commitment;
/** Optional pre-fetched blockhash lifetime. */
lifetime?: BlockhashLifetime;
/** Transaction version. Defaults to 0 (legacy). */
transactionVersion?: TransactionVersion;
/** The validator's vote account address to delegate stake to. */
validatorId: Address | string;
}>;
/**
* Options for sending stake-related transactions.
*
* @example
* ```ts
* const options: StakeSendOptions = {
* commitment: 'confirmed',
* maxRetries: 3,
* };
* ```
*/
export type StakeSendOptions = Readonly<{
/** AbortSignal to cancel the transaction. */
abortSignal?: AbortSignal;
/** Commitment level for transaction confirmation. */
commitment?: Commitment;
/** Maximum number of times to retry sending the transaction. */
maxRetries?: bigint | number;
/** Minimum slot that the request can be evaluated at. */
minContextSlot?: Slot;
/** If true, skip the preflight transaction checks. */
skipPreflight?: boolean;
}>;
/**
* Configuration for preparing an unstake (deactivate) transaction.
* Deactivating stake begins the cooldown period before withdrawal is possible.
*
* @example
* ```ts
* const config: UnstakePrepareConfig = {
* authority: walletSession,
* stakeAccount: 'StakeAccountAddress...',
* };
* ```
*/
export type UnstakePrepareConfig = Readonly<{
/** Authority that signed the original stake (must be the staker). */
authority: StakeAuthority;
/** Commitment level for RPC calls. */
commitment?: Commitment;
/** Optional pre-fetched blockhash lifetime. */
lifetime?: BlockhashLifetime;
/** The stake account address to deactivate. */
stakeAccount: Address | string;
/** Transaction version. Defaults to 0 (legacy). */
transactionVersion?: TransactionVersion;
}>;
/** Options for sending unstake transactions. Same as StakeSendOptions. */
export type UnstakeSendOptions = StakeSendOptions;
/**
* Configuration for preparing a stake withdrawal transaction.
* Withdraws SOL from a deactivated stake account.
*
* @example
* ```ts
* const config: WithdrawPrepareConfig = {
* amount: 10, // Withdraw 10 SOL
* authority: walletSession,
* destination: walletAddress,
* stakeAccount: 'StakeAccountAddress...',
* };
* ```
*/
export type WithdrawPrepareConfig = Readonly<{
/** Amount of SOL to withdraw in lamports, decimal SOL, or string SOL. */
amount: StakeAmount;
/** Authority that signed the original stake (must be the withdrawer). */
authority: StakeAuthority;
/** Commitment level for RPC calls. */
commitment?: Commitment;
/** Destination address to receive the withdrawn SOL. */
destination: Address | string;
/** Optional pre-fetched blockhash lifetime. */
lifetime?: BlockhashLifetime;
/** The stake account address to withdraw from. */
stakeAccount: Address | string;
/** Transaction version. Defaults to 0 (legacy). */
transactionVersion?: TransactionVersion;
}>;
/** Options for sending withdrawal transactions. Same as StakeSendOptions. */
export type WithdrawSendOptions = StakeSendOptions;

@@ -106,17 +220,108 @@ type PreparedUnstake = Readonly<{

}>;
/**
* Helper interface for native SOL staking operations.
* Supports staking to validators, unstaking (deactivating), and withdrawing.
*
* @example
* ```ts
* import { createStakeHelper } from '@solana/client';
*
* const stakeHelper = createStakeHelper(runtime);
*
* // Stake SOL to a validator
* const stakeSig = await stakeHelper.sendStake({
* amount: 10, // 10 SOL
* authority: walletSession,
* validatorId: 'ValidatorVoteAccount...',
* });
*
* // Query stake accounts
* const accounts = await stakeHelper.getStakeAccounts(walletAddress);
*
* // Deactivate stake (begin cooldown)
* const unstakeSig = await stakeHelper.sendUnstake({
* authority: walletSession,
* stakeAccount: accounts[0].pubkey,
* });
*
* // Withdraw after cooldown (~2-3 days on mainnet)
* const withdrawSig = await stakeHelper.sendWithdraw({
* amount: 10,
* authority: walletSession,
* destination: walletAddress,
* stakeAccount: accounts[0].pubkey,
* });
* ```
*/
export type StakeHelper = Readonly<{
/**
* Queries all stake accounts owned by a wallet.
* Optionally filter by validator to see stakes to a specific validator.
*/
getStakeAccounts(wallet: Address | string, validatorId?: Address | string): Promise<StakeAccount[]>;
/**
* Prepares a stake transaction without sending it.
* Creates a new stake account and delegates it to the specified validator.
*/
prepareStake(config: StakePrepareConfig): Promise<PreparedStake>;
/**
* Prepares an unstake (deactivate) transaction without sending it.
* Deactivating begins the cooldown period before funds can be withdrawn.
*/
prepareUnstake(config: UnstakePrepareConfig): Promise<PreparedUnstake>;
/**
* Prepares a withdrawal transaction without sending it.
* Can only withdraw from deactivated stake accounts after cooldown.
*/
prepareWithdraw(config: WithdrawPrepareConfig): Promise<PreparedWithdraw>;
/** Sends a previously prepared stake transaction. */
sendPreparedStake(prepared: PreparedStake, options?: StakeSendOptions): Promise<ReturnType<typeof signature>>;
/** Sends a previously prepared unstake transaction. */
sendPreparedUnstake(prepared: PreparedUnstake, options?: UnstakeSendOptions): Promise<ReturnType<typeof signature>>;
/** Sends a previously prepared withdrawal transaction. */
sendPreparedWithdraw(prepared: PreparedWithdraw, options?: WithdrawSendOptions): Promise<ReturnType<typeof signature>>;
/**
* Prepares and sends a stake transaction in one call.
* Creates a new stake account and delegates to the validator.
*/
sendStake(config: StakePrepareConfig, options?: StakeSendOptions): Promise<ReturnType<typeof signature>>;
/**
* Prepares and sends an unstake transaction in one call.
* Begins the cooldown period for the stake account.
*/
sendUnstake(config: UnstakePrepareConfig, options?: UnstakeSendOptions): Promise<ReturnType<typeof signature>>;
/**
* Prepares and sends a withdrawal transaction in one call.
* Withdraws SOL from a deactivated stake account.
*/
sendWithdraw(config: WithdrawPrepareConfig, options?: WithdrawSendOptions): Promise<ReturnType<typeof signature>>;
}>;
/** Creates helpers that build and submit native SOL staking transactions. */
/**
* Creates helpers for native SOL staking operations via the Stake Program.
* Supports full staking lifecycle: delegate, deactivate, and withdraw.
*
* @param runtime - The Solana client runtime with RPC connection.
* @returns A StakeHelper with methods for staking operations.
*
* @example
* ```ts
* import { createClient } from '@solana/client';
*
* const client = createClient({ cluster: 'mainnet-beta' });
* const stake = client.helpers.stake;
*
* // Delegate 100 SOL to a validator
* const sig = await stake.sendStake({
* amount: 100,
* authority: session,
* validatorId: 'ValidatorVoteAccount...',
* });
*
* // Check stake accounts
* const accounts = await stake.getStakeAccounts(myWallet);
* console.log(`Found ${accounts.length} stake accounts`);
* ```
*/
export declare function createStakeHelper(runtime: SolanaClientRuntime): StakeHelper;
export {};
//# sourceMappingURL=stake.d.ts.map

@@ -1,1 +0,1 @@

{"version":3,"file":"stake.d.ts","sourceRoot":"","sources":["../../../src/features/stake.ts"],"names":[],"mappings":"AACA,OAAO,EACN,KAAK,OAAO,EAIZ,KAAK,SAAS,EACd,KAAK,UAAU,EAOf,KAAK,IAAI,EAIT,SAAS,EACT,iCAAiC,EAEjC,KAAK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CAAC;IACzC;;;OAGG;IACH,SAAS,CAAC,MAAM,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC;IACzG;;;OAGG;IACH,WAAW,CAAC,MAAM,EAAE,oBAAoB,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC;IAC/G;;;OAGG;IACH,YAAY,CAAC,MAAM,EAAE,qBAAqB,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC;CAClH,CAAC,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,mBAAmB,GAAG,WAAW,CAiV3E"}

@@ -5,4 +5,20 @@ import { type Address, type Blockhash, type Commitment, signature, signTransactionMessageWithSigners, type TransactionPlan, type TransactionSigner, type TransactionVersion } from '@solana/kit';

import type { SolTransferSendOptions } from './sol';
/** Wrapped SOL mint address (same on all clusters). */
/**
* The Wrapped SOL (wSOL) mint address.
* This is the same address on all Solana clusters (mainnet, devnet, testnet).
* wSOL is an SPL token representation of native SOL, useful for DeFi protocols
* that require all assets to be SPL tokens.
*
* @example
* ```ts
* import { WRAPPED_SOL_MINT } from '@solana/client';
*
* console.log(WRAPPED_SOL_MINT); // 'So11111111111111111111111111111111111111112'
* ```
*/
export declare const WRAPPED_SOL_MINT: Address<"So11111111111111111111111111111111111111112">;
/**
* Blockhash and last valid block height for transaction lifetime.
* Used to ensure transactions expire after a certain block height.
*/
type BlockhashLifetime = Readonly<{

@@ -12,77 +28,229 @@ blockhash: Blockhash;

}>;
/**
* Authority that signs wSOL wrap/unwrap transactions.
* Can be either a connected wallet session or a raw transaction signer.
*/
type WsolAuthority = TransactionSigner<string> | WalletSession;
type SignableWsolTransactionMessage = Parameters<typeof signTransactionMessageWithSigners>[0];
/**
* Configuration for preparing a wrap SOL to wSOL transaction.
* Wrapping creates a wSOL token account and deposits native SOL into it.
*
* @example
* ```ts
* const config: WsolWrapPrepareConfig = {
* amount: 1, // Wrap 1 SOL
* authority: walletSession,
* commitment: 'confirmed',
* };
* ```
*/
export type WsolWrapPrepareConfig = Readonly<{
/** Amount of SOL to wrap (in lamports, SOL string, or number). */
/** Amount of SOL to wrap. Can be lamports (bigint), decimal SOL (number), or string SOL. */
amount: bigint | number | string;
/** Authority that signs the transaction (wallet session or raw signer). */
/** Authority that signs the transaction. Can be a WalletSession or raw TransactionSigner. */
authority: WsolAuthority;
/** Commitment level for the transaction. */
/** Commitment level for RPC calls. */
commitment?: Commitment;
/** Optional existing blockhash lifetime to reuse. */
/** Optional pre-fetched blockhash lifetime. If not provided, one will be fetched. */
lifetime?: BlockhashLifetime;
/** Owner of the wSOL account. Defaults to authority address. */
/** Owner of the wSOL account. Defaults to the authority's address. */
owner?: Address | string;
/** Transaction version (defaults to 0). */
/** Transaction version. Defaults to 0 (legacy). */
transactionVersion?: TransactionVersion;
}>;
/**
* Configuration for preparing an unwrap wSOL to SOL transaction.
* Unwrapping closes the wSOL token account and returns all SOL to the owner.
*
* @example
* ```ts
* const config: WsolUnwrapPrepareConfig = {
* authority: walletSession,
* commitment: 'confirmed',
* };
* ```
*/
export type WsolUnwrapPrepareConfig = Readonly<{
/** Authority that signs the transaction (wallet session or raw signer). */
/** Authority that signs the transaction. Must be the owner of the wSOL account. */
authority: WsolAuthority;
/** Commitment level for the transaction. */
/** Commitment level for RPC calls. */
commitment?: Commitment;
/** Optional existing blockhash lifetime to reuse. */
/** Optional pre-fetched blockhash lifetime. If not provided, one will be fetched. */
lifetime?: BlockhashLifetime;
/** Owner of the wSOL account. Defaults to authority address. */
/** Owner of the wSOL account. Defaults to the authority's address. */
owner?: Address | string;
/** Transaction version (defaults to 0). */
/** Transaction version. Defaults to 0 (legacy). */
transactionVersion?: TransactionVersion;
}>;
/**
* A prepared wrap transaction ready to be signed and sent.
* Contains the transaction message and metadata needed for submission.
*/
type PreparedWsolWrap = Readonly<{
/** Amount being wrapped in lamports. */
amount: bigint;
/** The wSOL Associated Token Account address. */
ataAddress: Address;
/** Commitment level used. */
commitment?: Commitment;
/** Blockhash lifetime for transaction expiration. */
lifetime: BlockhashLifetime;
/** The unsigned transaction message. */
message: SignableWsolTransactionMessage;
/** Signing mode: 'send' for wallets that sign+send, 'partial' for separate signing. */
mode: 'partial' | 'send';
/** Owner of the wSOL account. */
owner: Address;
/** Transaction plan for execution. */
plan?: TransactionPlan;
/** The transaction signer. */
signer: TransactionSigner;
}>;
/**
* A prepared unwrap transaction ready to be signed and sent.
* Contains the transaction message and metadata needed for submission.
*/
type PreparedWsolUnwrap = Readonly<{
/** The wSOL Associated Token Account address being closed. */
ataAddress: Address;
/** Commitment level used. */
commitment?: Commitment;
/** Blockhash lifetime for transaction expiration. */
lifetime: BlockhashLifetime;
/** The unsigned transaction message. */
message: SignableWsolTransactionMessage;
/** Signing mode: 'send' for wallets that sign+send, 'partial' for separate signing. */
mode: 'partial' | 'send';
/** Owner receiving the unwrapped SOL. */
owner: Address;
/** Transaction plan for execution. */
plan?: TransactionPlan;
/** The transaction signer. */
signer: TransactionSigner;
}>;
/**
* Helper interface for wrapping and unwrapping SOL to/from wSOL.
* wSOL (Wrapped SOL) is an SPL token representation of native SOL.
*
* @example
* ```ts
* import { createWsolHelper } from '@solana/client';
*
* const wsol = createWsolHelper(runtime);
*
* // Check wSOL balance
* const balance = await wsol.fetchWsolBalance(walletAddress);
* console.log(`wSOL balance: ${balance.amount} lamports`);
*
* // Wrap 1 SOL to wSOL
* const wrapSig = await wsol.sendWrap({
* amount: 1, // 1 SOL
* authority: walletSession,
* });
*
* // Unwrap all wSOL back to SOL
* const unwrapSig = await wsol.sendUnwrap({
* authority: walletSession,
* });
* ```
*/
export type WsolHelper = Readonly<{
/** Derive the wSOL Associated Token Address for an owner. */
/**
* Derives the wSOL Associated Token Account (ATA) address for an owner.
* The ATA is a deterministic address based on the owner and wSOL mint.
*/
deriveWsolAddress(owner: Address | string): Promise<Address>;
/** Fetch the wSOL balance for an owner. */
/**
* Fetches the wSOL balance for an owner.
* Returns balance info including whether the wSOL account exists.
*/
fetchWsolBalance(owner: Address | string, commitment?: Commitment): Promise<WsolBalance>;
/** Prepare a wrap transaction without sending. */
/**
* Prepares a wrap transaction without sending it.
* Use this when you need to inspect or modify the transaction before sending.
*/
prepareWrap(config: WsolWrapPrepareConfig): Promise<PreparedWsolWrap>;
/** Prepare an unwrap transaction without sending. */
/**
* Prepares an unwrap transaction without sending it.
* Use this when you need to inspect or modify the transaction before sending.
*/
prepareUnwrap(config: WsolUnwrapPrepareConfig): Promise<PreparedWsolUnwrap>;
/** Send a previously prepared wrap transaction. */
/**
* Sends a previously prepared wrap transaction.
* Use this after prepareWrap() to submit the transaction.
*/
sendPreparedWrap(prepared: PreparedWsolWrap, options?: SolTransferSendOptions): Promise<ReturnType<typeof signature>>;
/** Send a previously prepared unwrap transaction. */
/**
* Sends a previously prepared unwrap transaction.
* Use this after prepareUnwrap() to submit the transaction.
*/
sendPreparedUnwrap(prepared: PreparedWsolUnwrap, options?: SolTransferSendOptions): Promise<ReturnType<typeof signature>>;
/** Wrap SOL to wSOL in one call. */
/**
* Wraps native SOL to wSOL in one call.
* Creates the wSOL token account if it doesn't exist.
*/
sendWrap(config: WsolWrapPrepareConfig, options?: SolTransferSendOptions): Promise<ReturnType<typeof signature>>;
/** Unwrap wSOL to SOL in one call (closes the wSOL account). */
/**
* Unwraps all wSOL back to native SOL in one call.
* Closes the wSOL token account and returns all lamports to the owner.
*/
sendUnwrap(config: WsolUnwrapPrepareConfig, options?: SolTransferSendOptions): Promise<ReturnType<typeof signature>>;
}>;
/**
* wSOL balance information for an owner's Associated Token Account.
*
* @example
* ```ts
* const balance = await wsolHelper.fetchWsolBalance(walletAddress);
* if (balance.exists) {
* console.log(`wSOL balance: ${balance.amount} lamports`);
* console.log(`Token account: ${balance.ataAddress}`);
* } else {
* console.log('No wSOL account exists');
* }
* ```
*/
export type WsolBalance = Readonly<{
/** wSOL amount in lamports. */
amount: bigint;
/** The wSOL Associated Token Account address. */
ataAddress: Address;
/** Whether the wSOL token account exists on-chain. */
exists: boolean;
}>;
/** Creates helpers for wrapping native SOL to wSOL and unwrapping back. */
/**
* Creates helpers for wrapping native SOL to wSOL and unwrapping back.
* wSOL is useful for DeFi protocols that require all assets to be SPL tokens.
*
* @param runtime - The Solana client runtime with RPC connection.
* @returns A WsolHelper with methods for wrap/unwrap operations.
*
* @example
* ```ts
* import { createClient } from '@solana/client';
*
* const client = createClient({ cluster: 'devnet' });
* const wsol = client.helpers.wsol;
*
* // Wrap 0.5 SOL
* const wrapSig = await wsol.sendWrap({
* amount: 0.5,
* authority: session,
* });
* console.log('Wrapped SOL, signature:', wrapSig);
*
* // Check balance
* const balance = await wsol.fetchWsolBalance(myWallet);
* console.log(`wSOL: ${Number(balance.amount) / 1e9} SOL`);
*
* // Unwrap all wSOL back to native SOL
* const unwrapSig = await wsol.sendUnwrap({
* authority: session,
* });
* console.log('Unwrapped wSOL, signature:', unwrapSig);
* ```
*/
export declare function createWsolHelper(runtime: SolanaClientRuntime): WsolHelper;
export {};
//# sourceMappingURL=wsol.d.ts.map

@@ -1,1 +0,1 @@

{"version":3,"file":"wsol.d.ts","sourceRoot":"","sources":["../../../src/features/wsol.ts"],"names":[],"mappings":"AACA,OAAO,EACN,KAAK,OAAO,EAIZ,KAAK,SAAS,EACd,KAAK,UAAU,EAWf,SAAS,EACT,iCAAiC,EAEjC,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,MAAM,aAAa,CAAC;AAWrB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAExD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAAE,sBAAsB,EAAE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gBAAgB,CACf,QAAQ,EAAE,gBAAgB,EAC1B,OAAO,CAAC,EAAE,sBAAsB,GAC9B,OAAO,CAAC,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC;IACzC;;;OAGG;IACH,kBAAkB,CACjB,QAAQ,EAAE,kBAAkB,EAC5B,OAAO,CAAC,EAAE,sBAAsB,GAC9B,OAAO,CAAC,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC;IACzC;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,qBAAqB,EAAE,OAAO,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC;IACjH;;;OAGG;IACH,UAAU,CACT,MAAM,EAAE,uBAAuB,EAC/B,OAAO,CAAC,EAAE,sBAAsB,GAC9B,OAAO,CAAC,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC;CACzC,CAAC,CAAC;AAEH;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC;IAClC,+BAA+B;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,iDAAiD;IACjD,UAAU,EAAE,OAAO,CAAC;IACpB,sDAAsD;IACtD,MAAM,EAAE,OAAO,CAAC;CAChB,CAAC,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,mBAAmB,GAAG,UAAU,CAyNzE"}
{
"name": "@solana/client",
"version": "1.4.0",
"version": "1.4.1",
"description": "Framework-agnostic Solana client orchestration layer powering higher-level experiences",

@@ -71,3 +71,5 @@ "exports": {

"devDependencies": {
"@types/node": "^24"
"@types/node": "^24",
"typedoc": "^0.28.0",
"typedoc-plugin-markdown": "^4.4.0"
},

@@ -84,2 +86,4 @@ "peerDependencies": {

"compile:typedefs": "tsc -p ./tsconfig.declarations.json",
"docs": "typedoc",
"docs:json": "typedoc --json ./docs/api.json",
"format": "biome check --write src",

@@ -86,0 +90,0 @@ "lint": "biome check src",