system

package
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package system provides typed instruction builders for the Solana System program. Each builder returns a solana.Instruction with the program id, account metas, and encoded data already filled in, so callers can assemble a transaction by simply collecting the instructions they want and passing them to solana.NewMessage.

Index

Constants

This section is empty.

Variables

View Source
var ProgramID = solana.PublicKey{}

ProgramID is the canonical address of the Solana System program. Its on-chain pubkey is 32 zero bytes, encoded as the base58 string "11111111111111111111111111111111".

Functions

func NewAdvanceNonceAccount

func NewAdvanceNonceAccount(nonce, authority solana.PublicKey) solana.Instruction

NewAdvanceNonceAccount builds a System.AdvanceNonceAccount instruction that consumes the nonce and advances it to a new value. The nonce authority must sign the transaction.

func NewAllocate

func NewAllocate(account solana.PublicKey, space uint64) solana.Instruction

NewAllocate builds a System.Allocate instruction that allocates space bytes for an account's data. The account must sign the transaction and must currently be a System-owned account with zero-length data.

func NewAssign

func NewAssign(account, owner solana.PublicKey) solana.Instruction

NewAssign builds a System.Assign instruction that changes the owner program of an existing account. The account must currently be owned by the System program and must sign the transaction.

func NewAuthorizeNonceAccount

func NewAuthorizeNonceAccount(nonce, authority, newAuthority solana.PublicKey) solana.Instruction

NewAuthorizeNonceAccount builds a System.AuthorizeNonceAccount instruction that changes the authority of a nonce account to newAuthority. The current authority must sign the transaction.

func NewCreateAccount

func NewCreateAccount(from, newAccount solana.PublicKey, lamports, space uint64, owner solana.PublicKey) solana.Instruction

NewCreateAccount builds a System.CreateAccount instruction that funds newAccount with the given lamports, allocates space bytes for its data, and assigns its owner program. Both from and newAccount must sign the transaction.

func NewCreateAccountWithSeed

func NewCreateAccountWithSeed(from, newAccount, base solana.PublicKey, seed string, lamports, space uint64, owner solana.PublicKey) solana.Instruction

NewCreateAccountWithSeed builds a System.CreateAccountWithSeed instruction that creates newAccount at the address derived from base, seed, and the owner program. Unlike CreateAccount, only the funding account (and base, when distinct) needs to sign — newAccount is derived and does not need its own keypair.

newAccount must equal CreateWithSeed(base, seed, owner) as computed by the Solana runtime.

func NewInitializeNonceAccount

func NewInitializeNonceAccount(nonce, authority solana.PublicKey) solana.Instruction

NewInitializeNonceAccount builds a System.InitializeNonceAccount instruction that initializes a new nonce account with the given authority. The nonce account must already be funded and allocated by System.CreateAccount before calling this instruction.

func NewTransfer

func NewTransfer(from, to solana.PublicKey, lamports uint64) solana.Instruction

NewTransfer builds a System.Transfer instruction that moves lamports from one account to another. The from account must sign the transaction. Both accounts are marked writable because their lamport balances change.

func NewTransferWithSeed

func NewTransferWithSeed(from, base, to solana.PublicKey, lamports uint64, seed string, programID solana.PublicKey) solana.Instruction

NewTransferWithSeed builds a System.TransferWithSeed instruction that moves lamports from a seed-derived address to a destination. The base account must sign; no separate keypair for the from account is needed.

from must equal CreateWithSeed(base, seed, programID).

func NewWithdrawNonceAccount

func NewWithdrawNonceAccount(nonce, authority, to solana.PublicKey, lamports uint64) solana.Instruction

NewWithdrawNonceAccount builds a System.WithdrawNonceAccount instruction that withdraws lamports from a nonce account to a destination. lamports must leave the nonce account with enough for rent-exemption, or withdraw all lamports to close it. The authority must sign the transaction.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL