Solana.SystemProgram (Solana v0.1.0)

View Source

Functions for interacting with Solana's System Program

Summary

Functions

Generates instructions to allocate space to an account.

Generates instructions to assign account ownership to a program.

Generates instructions to create a new account.

The System Program's program ID.

Generates instructions to transfer lamports from one account to another.

Functions

allocate(opts)

Generates instructions to allocate space to an account.

Accepts an account address generated via Solana.Key.with_seed/3, as long as the base key, program_id, and seed used to generate that address are provided.

Options

  • :account - Required. Public key for the account to allocate

  • :space (non_neg_integer/0) - Required. Amount of space in bytes to allocate

  • :program_id - Program ID to assign as the owner of the allocated account

  • :base - Base public key to use to derive the allocated account address

  • :seed (String.t/0) - Seed to use to derive the allocated account address

assign(opts)

Generates instructions to assign account ownership to a program.

Accepts an account address generated via Solana.Key.with_seed/3, as long as the base key and seed used to generate that address are provided.

Options

  • :account - Required. Public key for the account which will receive a new owner

  • :program_id - Required. Program ID to assign as the owner

  • :base - Base public key to use to derive the assigned account address

  • :seed (String.t/0) - Seed to use to derive the assigned account address

create_account(opts)

Generates instructions to create a new account.

Accepts a new address generated via Solana.Key.with_seed/3, as long as the base key and seed used to generate that address are provided.

Options

  • :lamports (pos_integer/0) - Required. Amount of lamports to transfer to the created account

  • :space (non_neg_integer/0) - Required. Amount of space in bytes to allocate to the created account

  • :from - Required. The account that will transfer lamports to the created account

  • :new - Required. Public key of the created account

  • :program_id - Required. Public key of the program which will own the created account

  • :base - Base public key to use to derive the created account's address

  • :seed (String.t/0) - Seed to use to derive the created account's address

id()

The System Program's program ID.

transfer(opts)

Generates instructions to transfer lamports from one account to another.

Accepts a from address generated via Solana.Key.with_seed/3, as long as the base key, program_id, and seed used to generate that address are provided.

Options

  • :lamports (pos_integer/0) - Required. Amount of lamports to transfer

  • :from - Required. Account that will transfer lamports

  • :to - Required. Account that will receive the transferred lamports

  • :base - Base public key to use to derive the funding account address

  • :seed (String.t/0) - Seed to use to derive the funding account address

  • :program_id - Program ID to use to derive the funding account address