Search documentation of Cartouche

# Cartouche.Solana.SystemProgram (Cartouche v0.1.2)

Copy Markdown View Source

Instructions for the Solana System Program.

The System Program (address: `11111111111111111111111111111111`, 32 zero bytes) handles basic operations like SOL transfers and account creation.

## Summary

### Functions

create_account(arg1, arg2, lamports, space, arg3)

Build a create_account instruction.

program_id()

Returns the System Program pubkey (32 zero bytes).

transfer(arg1, arg2, lamports)

Build a transfer instruction (SOL transfer).

## Functions

# create_account(arg1, arg2, lamports, space, arg3)

    @spec create_account(
      <<_::256>>,
      <<_::256>>,
      non_neg_integer(),
      non_neg_integer(),
      <<_::256>>
    ) ::
      Cartouche.Solana.Transaction.Instruction.t()

Build a create_account instruction.

System Program instruction index 0.

## Examples

    iex> ix = Cartouche.Solana.SystemProgram.create_account(<<1::256>>, <<2::256>>, 1_000_000, 165, <<3::256>>)
    iex> ix.program_id
    <<0::256>>
    iex> byte_size(ix.data)
    52

# program_id()

    @spec program_id() :: <<_::256>>

Returns the System Program pubkey (32 zero bytes).

Delegates to `Cartouche.Solana.Programs.system_program/0`.

# transfer(arg1, arg2, lamports)

    @spec transfer(<<_::256>>, <<_::256>>, non_neg_integer()) ::
      Cartouche.Solana.Transaction.Instruction.t()

Build a transfer instruction (SOL transfer).

System Program instruction index 2.

## Examples

    iex> ix = Cartouche.Solana.SystemProgram.transfer(<<1::256>>, <<2::256>>, 1_000_000_000)
    iex> ix.program_id
    <<0::256>>
    iex> byte_size(ix.data)
    12