native

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Create a new account
	Instruction_CreateAccount uint32 = iota

	// Assign account to a program
	Instruction_Assign

	// Transfer lamports
	Instruction_Transfer

	// Create a new account at an address derived from a base pubkey and a seed
	Instruction_CreateAccountWithSeed

	// Consumes a stored nonce, replacing it with a successor
	Instruction_AdvanceNonceAccount

	// Withdraw funds from a nonce account
	Instruction_WithdrawNonceAccount

	// Drive state of Uninitalized nonce account to Initialized, setting the nonce value
	Instruction_InitializeNonceAccount

	// Change the entity authorized to execute nonce instructions on the account
	Instruction_AuthorizeNonceAccount

	// Allocate space in a (possibly new) account without funding
	Instruction_Allocate

	// Allocate space for and assign an account at an address derived from a base public key and a seed
	Instruction_AllocateWithSeed

	// Assign account to a program based on a seed
	Instruction_AssignWithSeed

	// Transfer lamports from a derived address
	Instruction_TransferWithSeed
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateAccount added in v0.1.0

type CreateAccount struct {
	// Number of lamports to transfer to the new account
	Lamports *uint64

	// Number of bytes of memory to allocate
	Space *uint64

	// Address of program that will own the new account
	Owner *common.Address

	// [0] = [WRITE, SIGNER] FundingAccount
	// ··········· Funding account
	//
	// [1] = [WRITE, SIGNER] NewAccount
	// ··········· New account
	base.AccountMetaSlice `bin:"-" borsh_skip:"true"`
}

CreateAccount Create a new account

func NewCreateAccountInstruction added in v0.1.0

func NewCreateAccountInstruction(

	lamports uint64,
	space uint64,
	owner common.Address,

	fundingAccount common.Address,
	newAccount common.Address) *CreateAccount

NewCreateAccountInstruction declares a new CreateAccount instruction with the provided parameters and accounts.

func NewCreateAccountInstructionBuilder added in v0.1.0

func NewCreateAccountInstructionBuilder() *CreateAccount

NewCreateAccountInstructionBuilder creates a new `CreateAccount` instruction builder.

func (CreateAccount) Build added in v0.1.0

func (cAcc CreateAccount) Build() *Instruction

func (*CreateAccount) GetFundingAccount added in v0.1.0

func (cAcc *CreateAccount) GetFundingAccount() *base.AccountMeta

func (*CreateAccount) GetNewAccount added in v0.1.0

func (cAcc *CreateAccount) GetNewAccount() *base.AccountMeta

func (CreateAccount) MarshalWithEncoder added in v0.1.0

func (cAcc CreateAccount) MarshalWithEncoder(encoder *encodbin.Encoder) error

func (*CreateAccount) SetFundingAccount added in v0.1.0

func (cAcc *CreateAccount) SetFundingAccount(fundingAccount common.Address) *CreateAccount

Funding account

func (*CreateAccount) SetLamports added in v0.1.0

func (cAcc *CreateAccount) SetLamports(lamports uint64) *CreateAccount

Number of lamports to transfer to the new account

func (*CreateAccount) SetNewAccount added in v0.1.0

func (cAcc *CreateAccount) SetNewAccount(newAccount common.Address) *CreateAccount

New account

func (*CreateAccount) SetOwner added in v0.1.0

func (cAcc *CreateAccount) SetOwner(owner common.Address) *CreateAccount

Address of program that will own the new account

func (*CreateAccount) SetSpace added in v0.1.0

func (cAcc *CreateAccount) SetSpace(space uint64) *CreateAccount

Number of bytes of memory to allocate

type CreateAccountWithSeed added in v0.1.0

type CreateAccountWithSeed struct {
	// Base public key
	Base *common.Address

	// String of ASCII chars, no longer than Pubkey::MAX_SEED_LEN
	Seed *string

	// Number of lamports to transfer to the new account
	Lamports *uint64

	// Number of bytes of memory to allocate
	Space *uint64

	// Owner program account address
	Owner *common.Address

	// [0] = [WRITE, SIGNER] FundingAccount
	// ··········· Funding account
	//
	// [1] = [WRITE] CreatedAccount
	// ··········· Created account
	//
	// [2] = [SIGNER] BaseAccount
	// ··········· Base account
	base.AccountMetaSlice `bin:"-" borsh_skip:"true"`
}

CreateAccountWithSeed Create a new account at an address derived from a base pubkey and a seed

func NewCreateAccountWithSeedInstruction added in v0.1.0

func NewCreateAccountWithSeedInstruction(

	base common.Address,
	seed string,
	lamports uint64,
	space uint64,
	owner common.Address,

	fundingAccount common.Address,
	createdAccount common.Address,
	baseAccount common.Address) *CreateAccountWithSeed

NewCreateAccountWithSeedInstruction declares a new CreateAccountWithSeed instruction with the provided parameters and accounts.

func NewCreateAccountWithSeedInstructionBuilder added in v0.1.0

func NewCreateAccountWithSeedInstructionBuilder() *CreateAccountWithSeed

NewCreateAccountWithSeedInstructionBuilder creates a new `CreateAccountWithSeed` instruction builder.

func (CreateAccountWithSeed) Build added in v0.1.0

func (cAcc CreateAccountWithSeed) Build() *Instruction

func (*CreateAccountWithSeed) GetBaseAccount added in v0.1.0

func (cAcc *CreateAccountWithSeed) GetBaseAccount() *base.AccountMeta

func (*CreateAccountWithSeed) GetCreatedAccount added in v0.1.0

func (cAcc *CreateAccountWithSeed) GetCreatedAccount() *base.AccountMeta

func (*CreateAccountWithSeed) GetFundingAccount added in v0.1.0

func (cAcc *CreateAccountWithSeed) GetFundingAccount() *base.AccountMeta

func (CreateAccountWithSeed) MarshalWithEncoder added in v0.1.0

func (cAcc CreateAccountWithSeed) MarshalWithEncoder(encoder *encodbin.Encoder) error

func (*CreateAccountWithSeed) SetBase added in v0.1.0

Base public key

func (*CreateAccountWithSeed) SetBaseAccount added in v0.1.0

func (cAcc *CreateAccountWithSeed) SetBaseAccount(baseAccount common.Address) *CreateAccountWithSeed

Base account

func (*CreateAccountWithSeed) SetCreatedAccount added in v0.1.0

func (cAcc *CreateAccountWithSeed) SetCreatedAccount(createdAccount common.Address) *CreateAccountWithSeed

Created account

func (*CreateAccountWithSeed) SetFundingAccount added in v0.1.0

func (cAcc *CreateAccountWithSeed) SetFundingAccount(fundingAccount common.Address) *CreateAccountWithSeed

Funding account

func (*CreateAccountWithSeed) SetLamports added in v0.1.0

func (cAcc *CreateAccountWithSeed) SetLamports(lamports uint64) *CreateAccountWithSeed

Number of lamports to transfer to the new account

func (*CreateAccountWithSeed) SetOwner added in v0.1.0

Owner program account address

func (*CreateAccountWithSeed) SetSeed added in v0.1.0

func (cAcc *CreateAccountWithSeed) SetSeed(seed string) *CreateAccountWithSeed

String of ASCII chars, no longer than Pubkey::MAX_SEED_LEN

func (*CreateAccountWithSeed) SetSpace added in v0.1.0

func (cAcc *CreateAccountWithSeed) SetSpace(space uint64) *CreateAccountWithSeed

Number of bytes of memory to allocate

func (*CreateAccountWithSeed) Validate added in v0.1.0

func (cAcc *CreateAccountWithSeed) Validate() error

func (CreateAccountWithSeed) ValidateAndBuild added in v0.1.0

func (cAcc CreateAccountWithSeed) ValidateAndBuild() (*Instruction, error)

ValidateAndBuild validates the instruction parameters and accounts; if there is a validation error, it returns the error. Otherwise, it builds and returns the instruction.

type Instruction

type Instruction struct {
	encodbin.BaseVariant
}

func (*Instruction) Accounts

func (inst *Instruction) Accounts() (out []*base.AccountMeta)

func (*Instruction) Data

func (inst *Instruction) Data() ([]byte, error)

func (*Instruction) MarshalWithEncoder

func (inst *Instruction) MarshalWithEncoder(encoder *encodbin.Encoder) error

func (*Instruction) ProgramID

func (inst *Instruction) ProgramID() common.Address

type Transfer

type Transfer struct {
	// Number of lamports to transfer to the new account
	Lamports *uint64

	// [0] = [WRITE, SIGNER] FundingAccount
	// ··········· Funding account
	//
	// [1] = [WRITE] RecipientAccount
	// ··········· Recipient account
	base.AccountMetaSlice `bin:"-" borsh_skip:"true"`
	Signers               []*base.AccountMeta `bin:"-" borsh_skip:"true"`
}

func NewTransferInstruction

func NewTransferInstruction(

	fundingAccount common.Address,
	recipientAccount common.Address,
	lamports uint64) *Transfer

func NewTransferInstructionBuilder

func NewTransferInstructionBuilder() *Transfer

func (Transfer) Build

func (trans Transfer) Build() *Instruction

func (Transfer) GetAccounts

func (trans Transfer) GetAccounts() (accounts []*base.AccountMeta)

func (Transfer) MarshalWithEncoder

func (trans Transfer) MarshalWithEncoder(encoder encodbin.Encoder) error

func (*Transfer) SetFundingAccount

func (trans *Transfer) SetFundingAccount(fundingAccount common.Address) *Transfer

Funding account

func (*Transfer) SetLamports

func (trans *Transfer) SetLamports(lamports uint64) *Transfer

func (*Transfer) SetRecipientAccount

func (trans *Transfer) SetRecipientAccount(recipientAccount common.Address) *Transfer

Recipient account

Jump to

Keyboard shortcuts

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