System Program
- ID: Final[Pubkey] = Pubkey( 11111111111111111111111111111111, )
Pubkey that identifies the System program.
- transfer_many(from_pubkey, to_lamports)
Create new Transfer instructions to many destinations.
- Parameters:
- Returns:
The Transfer instructions.
- Return type:
list[Instruction]
- create_nonce_account(from_pubkey, nonce_pubkey, authority, lamports)
Generate instructions to create and initialize a nonce account.
- Parameters:
from_pubkey (Pubkey) – The account that will transfer lamports to the created nonce account.
nonce_pubkey (Pubkey) – Nonce account which will be created and initialized.
authority (Pubkey) – Pubkey to set as authority of the initialized nonce account.
lamports (int) – Amount of lamports to transfer to the created account.
- Returns:
The CreateAccount instruction and the InitializeNonceAccount instruction.
- Return type:
tuple[Instruction, Instruction]
- create_nonce_account_with_seed(from_pubkey, nonce_pubkey, base, seed, authority, lamports)
Generate instructions to create a nonce account with seed.
- Parameters:
from_pubkey (Pubkey) – The account that will transfer lamports to the created nonce account.
nonce_pubkey (Pubkey) – Nonce account which will be created and initialized. Must be pre-calculated with
create_with_seed()
base (Pubkey) – Base public key to use to derive the address of the created account. Must be the same as the base key used to create
nonce_pubkey
.seed (str) – Seed to use to derive the address of the created account. Must be the same as the seed used to create
nonce_pubkey
.authority (Pubkey) – Pubkey to set as authority of the initialized nonce account.
lamports (int) – Amount of lamports to transfer to the created account.
- Returns:
The CreateAccountWithSeed instruction and the InitializeNonceAccount instruction.
- Return type:
tuple[Instruction, Instruction]
- class CreateAccountParams
Create account system transaction params.
- lamports: int
Amount of lamports to transfer to the created account.
- space: int
Amount of space in bytes to allocate to the created account.
- create_account(params: CreateAccountParams) Instruction
Generate an instruction that creates a new account.
- Parameters:
params – The CreateAccount params.
Example
>>> from solders.pubkey import Pubkey >>> from solders.system_program import create_account, CreateAccountParams >>> from_account = Pubkey.new_unique() >>> new_account = Pubkey.new_unique() >>> program_id = Pubkey.new_unique() >>> instruction = create_account( ... CreateAccountParams( ... from_pubkey=from_account, to_pubkey=new_account, ... lamports=1, space=1, owner=program_id) ... ) >>> type(instruction) <class 'solders.instruction.Instruction'>
- Returns:
The instruction to create the account.
- Return type:
- decode_create_account(instruction: Instruction) CreateAccountParams
Decode a create account instruction and retrieve the instruction params.
- Parameters:
instruction (Instruction) – The CreateAccount instruction.
- Returns:
The params used to create the instruction.
- Return type:
- class CreateAccountWithSeedParams
Create account with seed system transaction params.
- to_pubkey: Pubkey
Pubkey of the created account. Must be pre-calculated with
create_with_seed()
.
- base: Pubkey
Base public key to use to derive the address of the created account. Must be the same as the base key used to create
to_pubkey
.
- seed: str
Seed to use to derive the address of the created account. Must be the same as the seed used to create
to_pubkey
.
- lamports: int
Amount of lamports to transfer to the created account.
- space: int
Amount of space in bytes to allocate to the created account.
- create_account_with_seed(params: CreateAccountWithSeedParams) Instruction
Generate an instruction that creates a new account at an address generated with
from
, a seed, and program_id.- Parameters:
params (CreateAccountWithSeedParams) – The CreateAccountWithSeed params.
- Returns:
The instruction to create the account.
- Return type:
- decode_create_account_with_seed(instruction: Instruction) CreateAccountWithSeedParams
Decode create account with seed instruction and retrieve the instruction params.
- Parameters:
instruction (Instruction) – The CreateAccountWithSeed instruction.
- Returns:
The params used to create the instruction.
- Return type:
- class AssignParams
Assign system transaction params.
- assign(params: AssignParams) Instruction
Generate an instruction that assigns an account to a program.
- Parameters:
params (AssignParams) – The assign params.
- Returns:
The generated instruction.
- Return type:
Example
>>> from solders.pubkey import Pubkey >>> from solders.system_program import assign, AssignParams >>> account, program_id = Pubkey.default(), Pubkey.default() >>> instruction = assign( ... AssignParams(pubkey=account, owner=program_id) ... ) >>> type(instruction) <class 'solders.instruction.Instruction'>
- decode_assign(instruction: Instruction) AssignParams
Decode an assign instruction and retrieve the instruction params.
- Parameters:
instruction (Instruction) – The Assign instruction.
- Returns:
The params used to create the instruction.
- Return type:
- class AssignWithSeedParams
Assign account with seed system transaction params.
- seed: str
Seed to use to derive the address of the assigned account.
- assign_with_seed(params: AssignWithSeedParams) Instruction
Generate an instruction that assigns an account to a program.
- Parameters:
params (AssignWithSeedParams) – The AssignWithSeed params.
- Returns:
The generated instruction.
- Return type:
- decode_assign_with_seed(instruction: Instruction) AssignWithSeedParams
Decode an assign with seed instruction and retrieve the instruction params.
- Parameters:
instruction (Instruction) – The AssignWithSeed instruction.
- Returns:
The params used to create the instruction.
- Return type:
- class TransferParams
Transfer system transaction params.
- lamports: int
Amount of lamports to transfer.
- transfer(params: TransferParams) Instruction
Generate an instruction that transfers lamports from one account to another.
- Parameters:
params – The transfer params.
Example
>>> from solders.pubkey import Pubkey >>> from solders.system_program import transfer, TransferParams >>> sender, receiver = Pubkey.default(), Pubkey.default() >>> instruction = transfer( ... TransferParams(from_pubkey=sender, to_pubkey=receiver, lamports=1000) ... ) >>> type(instruction) <class 'solders.instruction.Instruction'>
- Returns:
The transfer instruction.
- Return type:
- decode_transfer(instruction: Instruction) TransferParams
Decode a transfer instruction and retrieve the instruction params.
- Parameters:
instruction (Instruction) – The Transfer instruction.
- Returns:
The params used to create the instruction.
- Return type:
- class TransferWithSeedParams
Transfer with seed system transaction params.
- from_seed: str
Seed to use to derive the funding account address.
- lamports: int
Amount of lamports to transfer.
- transfer_with_seed(params: TransferWithSeedParams) Instruction
Generate an instruction that transfers lamports from one account to another.
- Parameters:
params (TransferWithSeedParams) – The TransferWithSeed params.
- Returns:
The TransferWithSeed instruction.
- Return type:
- decode_transfer_with_seed(instruction: Instruction) TransferWithSeedParams
Decode a transfer with seed instruction and retrieve the instruction params.
- Parameters:
instruction (Instruction) – The TransferWithSeed instruction.
- Returns:
The params used to create the instruction.
- Return type:
- class AllocateParams
Allocate account system transaction params.
- space: int
Amount of space in bytes to allocate.
- allocate(params: AllocateParams) Instruction
Generate an instruction that allocates space in an account without funding.
- Parameters:
params (AllocateParams) – The allocate params.
- Returns:
The allocate instruction.
- Return type:
Example
>>> from solders.pubkey import Pubkey >>> from solders.system_program import allocate, AllocateParams >>> allocator = Pubkey.default() >>> instruction = allocate( ... AllocateParams(pubkey=allocator, space=65537) ... ) >>> type(instruction) <class 'solders.instruction.Instruction'>
- decode_allocate(instruction: Instruction) AllocateParams
Decode an allocate instruction and retrieve the instruction params.
- Parameters:
instruction (Instruction) – The Allocate instruction.
- Returns:
The params used to create the instruction.
- Return type:
- class AllocateWithSeedParams
Allocate account with seed system transaction params.
- seed: str
Seed to use to derive the address of the allocated account.
- space: int
Amount of space in bytes to allocate.
- allocate_with_seed(params: AllocateWithSeedParams) Instruction
Generate an instruction that allocates space in an account without funding.
- Parameters:
params (AllocateWithSeedParams) – The AllocateWithSeed params.
- Returns:
The AllocateWithSeed instruction.
- Return type:
- decode_allocate_with_seed(instruction: Instruction) AllocateWithSeedParams
Decode an allocate with seed instruction and retrieve the instruction params.
- Parameters:
instruction (Instruction) – The AllocateWithSeed instruction.
- Returns:
The params used to create the instruction.
- Return type:
- class InitializeNonceAccountParams
Initialize nonce account system instruction params.
- initialize_nonce_account(params: InitializeNonceAccountParams) Instruction
Generate an instruction to initialize a Nonce account.
- Parameters:
params (InitializeNonceAccountParams) – The InitializeNonceAccount params.
- Returns:
The InitializeNonceAccount instruction.
- Return type:
- decode_initialize_nonce_account(instruction: Instruction) InitializeNonceAccountParams
Decode initialize nonce account instruction and retrieve the instruction params.
- Parameters:
instruction (Instruction) – The InitializeNonceAccount instruction.
- Returns:
The params used to create the instruction.
- Return type:
- class AdvanceNonceAccountParams
Advance nonce account system instruction params.
- advance_nonce_account(params: AdvanceNonceAccountParams) Instruction
Generate an instruction to advance the nonce in a Nonce account.
- Parameters:
params (AdvanceNonceAccountParams) – The AdvanceNonceAccount params.
- Returns:
The AdvanceNonceAccount instruction.
- Return type:
- decode_advance_nonce_account(instruction: Instruction) AdvanceNonceAccountParams
Decode an advance nonce account instruction and retrieve the instruction params.
- Parameters:
instruction (Instruction) – The AdvanceNonceAccount instruction.
- Returns:
The params used to create the instruction.
- Return type:
- class WithdrawNonceAccountParams
Withdraw nonce account system transaction params.
- lamports: int
Amount of lamports to withdraw from the nonce account.
- withdraw_nonce_account(params: WithdrawNonceAccountParams) Instruction
Generate an instruction that withdraws lamports from a Nonce account.
- Parameters:
params (WithdrawNonceAccountParams) – The WithdrawNonceAccount params.
- Returns:
The WithdrawNonceAccount instruction.
- Return type:
- decode_withdraw_nonce_account(instruction: Instruction) WithdrawNonceAccountParams
Decode a withdraw nonce account instruction and retrieve the instruction params.
- Parameters:
instruction (Instruction) – The WithdrawNonceAccount instruction.
- Returns:
The params used to create the instruction.
- Return type:
- class AuthorizeNonceAccountParams
Authorize nonce account system transaction params.
- authorize_nonce_account(params: AuthorizeNonceAccountParams) Instruction
Generate an instruction that authorizes a new Pubkey as the nonce authority.
- Parameters:
params (AuthorizeNonceAccountParams) – The AuthorizeNonceAccount params.
- Returns:
The AuthorizeNonceAccount instruction.
- Return type:
- decode_authorize_nonce_account(instruction: Instruction) AuthorizeNonceAccountParams
Decode authorize nonce account instruction and retrieve the instruction params.
- Parameters:
instruction (Instruction) – The AuthorizeNonceAccount instruction.
- Returns:
The params used to create the instruction.
- Return type:
- class CloseLookupTableParams
Close lookup table system transaction params.
- close_lookup_table(params: CloseLookupTableParams) Instruction
Returns an instruction that closes an address lookup table account.
The account will be deallocated and the lamports will be drained to the recipient address.
- Parameters:
params (CloseLookupTableParams) – The CloseLookupTable params.
- Returns:
The CloseLookupTable instruction.
- Return type:
- create_lookup_table(params: CreateLookupTableParams) Tuple[Instruction, Pubkey]
Constructs an instruction to create a table account.
Returns the instruction and the table account`s derived address.
- Parameters:
params (CreateLookupTableParams) – The CreateLookupTable params.
- Returns:
The CreateLookupTable instruction and the table account`s derived address
- Return type:
Tuple[Instruction, PubKey]
- class CreateLookupTableSignedParams
Create lookup table signed system transaction params.
- recent_slot: int
- create_lookup_table_signed(params: CreateLookupTableSignedParams) Tuple[Instruction, Pubkey]
Constructs an instruction to create a table account.
Returns the instruction and the table account`s derived address.
- Parameters:
params (CreateLookupTableSignedParams) – The CreateLookupTableSigned params.
- Returns:
The CreateLookupTableSigned instruction and the table account’s derived address
- Return type:
Tuple[Instruction, PubKey]
- class DeactivateLookupTableParams
Deactivate lookup table system transaction params.
- deactivate_lookup_table(params: DeactivateLookupTableParams) Instruction
Constructs an instruction that deactivates an address lookup table.
So that it cannot be extended again and will be unusable and eligible for closure after a short amount of time.
- Parameters:
params (DeactivateLookupTableParams) – The DeactivateLookupTable params.
- Returns:
The DeactivateLookupTable instruction.
- Return type:
- class ExtendLookupTableParams
Extend lookup table system transaction params.
- extend_lookup_table(params: ExtendLookupTableParams) Instruction
Constructs an instruction which extends an ATL account with new addresses.
- Parameters:
params (ExtendLookupTableParams) – the ExtendLookupTable params.
- Returns:
The ExtendLookupTable instruction.
- Return type:
- class FreezeLookupTableParams
Freeze lookup table system transaction params.
- freeze_lookup_table(params: FreezeLookupTableParams) Instruction
Constructs an instruction that freezes an address lookup table.
So that it can never be closed or extended again. Empty lookup tables cannot be frozen.
- Parameters:
params (FreezeLookupTableParams) – The FreezeLookupTable params.
- Returns:
The FreezeLookupTable instruction.
- Return type: