token

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 (
	// Initializes a new mint and optionally deposits all the newly minted
	// tokens in an account.
	//
	// The `InitializeMint` instruction requires no signers and MUST be
	// included within the same Transaction as the system program's
	// `CreateAccount` instruction that creates the account being initialized.
	// Otherwise another party can acquire ownership of the uninitialized
	// account.
	Instruction_InitializeMint uint8 = iota

	// Initializes a new account to hold tokens.  If this account is associated
	// with the native mint then the token balance of the initialized account
	// will be equal to the amount of SOL in the account. If this account is
	// associated with another mint, that mint must be initialized before this
	// command can succeed.
	//
	// The `InitializeAccount` instruction requires no signers and MUST be
	// included within the same Transaction as the system program's
	// `CreateAccount` instruction that creates the account being initialized.
	// Otherwise another party can acquire ownership of the uninitialized
	// account.
	Instruction_InitializeAccount

	// Initializes a multisignature account with N provided signers.
	//
	// Multisignature accounts can used in place of any single owner/delegate
	// accounts in any token instruction that require an owner/delegate to be
	// present.  The variant field represents the number of signers (M)
	// required to validate this multisignature account.
	//
	// The `InitializeMultisig` instruction requires no signers and MUST be
	// included within the same Transaction as the system program's
	// `CreateAccount` instruction that creates the account being initialized.
	// Otherwise another party can acquire ownership of the uninitialized
	// account.
	Instruction_InitializeMultisig

	// Transfers tokens from one account to another either directly or via a
	// delegate.  If this account is associated with the native mint then equal
	// amounts of SOL and Tokens will be transferred to the destination
	// account.
	Instruction_Transfer

	// Approves a delegate.  A delegate is given the authority over tokens on
	// behalf of the source account's owner.
	Instruction_Approve

	// Revokes the delegate's authority.
	Instruction_Revoke

	// Sets a new authority of a mint or account.
	Instruction_SetAuthority

	// Mints new tokens to an account.  The native mint does not support
	// minting.
	Instruction_MintTo

	// Burns tokens by removing them from an account.  `Burn` does not support
	// accounts associated with the native mint, use `CloseAccount` instead.
	Instruction_Burn

	// Close an account by transferring all its SOL to the destination account.
	// Non-native accounts may only be closed if its token amount is zero.
	Instruction_CloseAccount

	// Freeze an Initialized account using the Mint's freeze_authority (if set).
	Instruction_FreezeAccount

	// Thaw a Frozen account using the Mint's freeze_authority (if set).
	Instruction_ThawAccount

	// Transfers tokens from one account to another either directly or via a
	// delegate.  If this account is associated with the native mint then equal
	// amounts of SOL and Tokens will be transferred to the destination
	// account.
	//
	// This instruction differs from Transfer in that the token mint and
	// decimals value is checked by the caller.  This may be useful when
	// creating transactions offline or within a hardware wallet.
	Instruction_TransferChecked

	// Approves a delegate.  A delegate is given the authority over tokens on
	// behalf of the source account's owner.
	//
	// This instruction differs from Approve in that the token mint and
	// decimals value is checked by the caller.  This may be useful when
	// creating transactions offline or within a hardware wallet.
	Instruction_ApproveChecked

	// Mints new tokens to an account.  The native mint does not support minting.
	//
	// This instruction differs from MintTo in that the decimals value is
	// checked by the caller.  This may be useful when creating transactions
	// offline or within a hardware wallet.
	Instruction_MintToChecked

	// Burns tokens by removing them from an account.  `BurnChecked` does not
	// support accounts associated with the native mint, use `CloseAccount`
	// instead.
	//
	// This instruction differs from Burn in that the decimals value is checked
	// by the caller. This may be useful when creating transactions offline or
	// within a hardware wallet.
	Instruction_BurnChecked

	// Like InitializeAccount, but the owner pubkey is passed via instruction data
	// rather than the accounts list. This variant may be preferable when using
	// Cross Program Invocation from an instruction that does not need the owner's
	// `AccountInfo` otherwise.
	Instruction_InitializeAccount2

	// Given a wrapped / native token account (a token account containing SOL)
	// updates its amount field based on the account's underlying `lamports`.
	// This is useful if a non-wrapped SOL account uses `system_instruction::transfer`
	// to move lamports to a wrapped token account, and needs to have its token
	// `amount` field updated.
	Instruction_SyncNative

	// Like InitializeAccount2, but does not require the Rent sysvar to be provided.
	Instruction_InitializeAccount3

	// Like InitializeMultisig, but does not require the Rent sysvar to be provided.
	Instruction_InitializeMultisig2

	// Like InitializeMint, but does not require the Rent sysvar to be provided.
	Instruction_InitializeMint2
)
View Source
const MAX_SIGNERS = 11

Maximum number of multisignature signers (max N)

View Source
const MINT_SIZE = 82

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountState added in v0.1.0

type AccountState uint8
const (
	// Account is not yet initialized
	Uninitialized AccountState = iota

	// Account is initialized; the account owner and/or delegate may perform permitted operations
	// on this account
	Initialized

	// Account has been frozen by the mint freeze authority. Neither the account owner nor
	// the delegate are able to perform operations on this account.
	Frozen
)

type Approve added in v0.1.0

type Approve struct {
	// The amount of tokens the delegate is approved for.
	Amount *uint64

	// [0] = [WRITE] source
	// ··········· The source account.
	//
	// [1] = [] delegate
	// ··········· The delegate.
	//
	// [2] = [] owner
	// ··········· The source account owner.
	//
	// [3...] = [SIGNER] signers
	// ··········· M signer accounts.
	Accounts []*base.AccountMeta `bin:"-" borsh_skip:"true"`
	Signers  []*base.AccountMeta `bin:"-" borsh_skip:"true"`
}

Approve A delegate is given the authority over tokens on behalf of the source account's owner.

func NewApproveInstruction added in v0.1.0

func NewApproveInstruction(

	amount uint64,

	source common.Address,
	delegate common.Address,
	owner common.Address,
	multisigSigners []common.Address,
) *Approve

NewApproveInstruction declares a new Approve instruction with the provided parameters and accounts.

func NewApproveInstructionBuilder added in v0.1.0

func NewApproveInstructionBuilder() *Approve

NewApproveInstructionBuilder creates a new `Approve` instruction builder.

func (Approve) Build added in v0.1.0

func (appr Approve) Build() *Instruction

func (Approve) GetAccounts added in v0.1.0

func (appr Approve) GetAccounts() (accounts []*base.AccountMeta)

func (*Approve) GetDelegateAccount added in v0.1.0

func (appr *Approve) GetDelegateAccount() *base.AccountMeta

GetDelegateAccount gets the "delegate" account. The delegate.

func (*Approve) GetOwnerAccount added in v0.1.0

func (appr *Approve) GetOwnerAccount() *base.AccountMeta

GetOwnerAccount gets the "owner" account. The source account owner.

func (*Approve) GetSourceAccount added in v0.1.0

func (appr *Approve) GetSourceAccount() *base.AccountMeta

GetSourceAccount gets the "source" account. The source account.

func (Approve) MarshalWithEncoder added in v0.1.0

func (appr Approve) MarshalWithEncoder(encoder *encodbin.Encoder) (err error)

func (*Approve) SetAccounts added in v0.1.0

func (appr *Approve) SetAccounts(accounts []*base.AccountMeta) error

func (*Approve) SetAmount added in v0.1.0

func (appr *Approve) SetAmount(amount uint64) *Approve

SetAmount sets the "amount" parameter. The amount of tokens the delegate is approved for.

func (*Approve) SetDelegateAccount added in v0.1.0

func (appr *Approve) SetDelegateAccount(delegate common.Address) *Approve

SetDelegateAccount sets the "delegate" account. The delegate.

func (*Approve) SetOwnerAccount added in v0.1.0

func (appr *Approve) SetOwnerAccount(owner common.Address, multisigSigners ...common.Address) *Approve

SetOwnerAccount sets the "owner" account. The source account owner.

func (*Approve) SetSourceAccount added in v0.1.0

func (appr *Approve) SetSourceAccount(source common.Address) *Approve

SetSourceAccount sets the "source" account. The source account.

func (*Approve) Validate added in v0.1.0

func (appr *Approve) Validate() error

func (Approve) ValidateAndBuild added in v0.1.0

func (appr Approve) 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 ApproveChecked added in v0.1.0

type ApproveChecked struct {
	// The amount of tokens the delegate is approved for.
	Amount *uint64

	// Expected number of base 10 digits to the right of the decimal place.
	Decimals *uint8

	// [0] = [WRITE] source
	// ··········· The source account.
	//
	// [1] = [] mint
	// ··········· The token mint.
	//
	// [2] = [] delegate
	// ··········· The delegate.
	//
	// [3] = [] owner
	// ··········· The source account owner.
	//
	// [4...] = [SIGNER] signers
	// ··········· M signer accounts.
	Accounts []*base.AccountMeta `bin:"-" borsh_skip:"true"`
	Signers  []*base.AccountMeta `bin:"-" borsh_skip:"true"`
}

ApproveChecked A delegate is given the authority over tokens on behalf of the source account's owner.

This instruction differs from Approve in that the token mint and decimals value is checked by the caller. This may be useful when creating transactions offline or within a hardware wallet.

func NewApproveCheckedInstruction added in v0.1.0

func NewApproveCheckedInstruction(

	amount uint64,
	decimals uint8,

	source common.Address,
	mint common.Address,
	delegate common.Address,
	owner common.Address,
	multisigSigners []common.Address,
) *ApproveChecked

NewApproveCheckedInstruction declares a new ApproveChecked instruction with the provided parameters and accounts.

func NewApproveCheckedInstructionBuilder added in v0.1.0

func NewApproveCheckedInstructionBuilder() *ApproveChecked

NewApproveCheckedInstructionBuilder creates a new `ApproveChecked` instruction builder.

func (ApproveChecked) Build added in v0.1.0

func (apprCkd ApproveChecked) Build() *Instruction

func (ApproveChecked) GetAccounts added in v0.1.0

func (apprCkd ApproveChecked) GetAccounts() (accounts []*base.AccountMeta)

func (*ApproveChecked) GetDelegateAccount added in v0.1.0

func (apprCkd *ApproveChecked) GetDelegateAccount() *base.AccountMeta

GetDelegateAccount gets the "delegate" account. The delegate.

func (*ApproveChecked) GetMintAccount added in v0.1.0

func (apprCkd *ApproveChecked) GetMintAccount() *base.AccountMeta

GetMintAccount gets the "mint" account. The token mint.

func (*ApproveChecked) GetOwnerAccount added in v0.1.0

func (apprCkd *ApproveChecked) GetOwnerAccount() *base.AccountMeta

GetOwnerAccount gets the "owner" account. The source account owner.

func (*ApproveChecked) GetSourceAccount added in v0.1.0

func (apprCkd *ApproveChecked) GetSourceAccount() *base.AccountMeta

GetSourceAccount gets the "source" account. The source account.

func (ApproveChecked) MarshalWithEncoder added in v0.1.0

func (apprCkd ApproveChecked) MarshalWithEncoder(encoder *encodbin.Encoder) (err error)

func (*ApproveChecked) SetAccounts added in v0.1.0

func (apprCkd *ApproveChecked) SetAccounts(accounts []*base.AccountMeta) error

func (*ApproveChecked) SetAmount added in v0.1.0

func (apprCkd *ApproveChecked) SetAmount(amount uint64) *ApproveChecked

SetAmount sets the "amount" parameter. The amount of tokens the delegate is approved for.

func (*ApproveChecked) SetDecimals added in v0.1.0

func (apprCkd *ApproveChecked) SetDecimals(decimals uint8) *ApproveChecked

SetDecimals sets the "decimals" parameter. Expected number of base 10 digits to the right of the decimal place.

func (*ApproveChecked) SetDelegateAccount added in v0.1.0

func (apprCkd *ApproveChecked) SetDelegateAccount(delegate common.Address) *ApproveChecked

SetDelegateAccount sets the "delegate" account. The delegate.

func (*ApproveChecked) SetMintAccount added in v0.1.0

func (apprCkd *ApproveChecked) SetMintAccount(mint common.Address) *ApproveChecked

SetMintAccount sets the "mint" account. The token mint.

func (*ApproveChecked) SetOwnerAccount added in v0.1.0

func (apprCkd *ApproveChecked) SetOwnerAccount(owner common.Address, multisigSigners ...common.Address) *ApproveChecked

SetOwnerAccount sets the "owner" account. The source account owner.

func (*ApproveChecked) SetSourceAccount added in v0.1.0

func (apprCkd *ApproveChecked) SetSourceAccount(source common.Address) *ApproveChecked

SetSourceAccount sets the "source" account. The source account.

func (*ApproveChecked) Validate added in v0.1.0

func (apprCkd *ApproveChecked) Validate() error

func (ApproveChecked) ValidateAndBuild added in v0.1.0

func (apprCkd ApproveChecked) 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 AuthorityType added in v0.1.0

type AuthorityType uint8
const (
	// Authority to mint new tokens
	AuthorityMintTokens AuthorityType = iota

	// Authority to freeze any account associated with the Mint
	AuthorityFreezeAccount

	// Owner of a given token account
	AuthorityAccountOwner

	// Authority to close a token account
	AuthorityCloseAccount
)

type Burn added in v0.1.0

type Burn struct {
	// The amount of tokens to burn.
	Amount *uint64

	// [0] = [WRITE] source
	// ··········· The account to burn from.
	//
	// [1] = [WRITE] mint
	// ··········· The token mint.
	//
	// [2] = [] owner
	// ··········· The account's owner/delegate.
	//
	// [3...] = [SIGNER] signers
	// ··········· M signer accounts.
	Accounts []*base.AccountMeta `bin:"-" borsh_skip:"true"`
	Signers  []*base.AccountMeta `bin:"-" borsh_skip:"true"`
}

Burn tokens by removing them from an account. `Burn` does not support accounts associated with the native mint, use `CloseAccount` instead.

func NewBurnInstruction added in v0.1.0

func NewBurnInstruction(

	amount uint64,

	source common.Address,
	mint common.Address,
	owner common.Address,
	multisigSigners []common.Address,
) *Burn

NewBurnInstruction declares a new Burn instruction with the provided parameters and accounts.

func NewBurnInstructionBuilder added in v0.1.0

func NewBurnInstructionBuilder() *Burn

NewBurnInstructionBuilder creates a new `Burn` instruction builder.

func (Burn) Build added in v0.1.0

func (br Burn) Build() *Instruction

func (Burn) GetAccounts added in v0.1.0

func (br Burn) GetAccounts() (accounts []*base.AccountMeta)

func (*Burn) GetMintAccount added in v0.1.0

func (br *Burn) GetMintAccount() *base.AccountMeta

GetMintAccount gets the "mint" account. The token mint.

func (*Burn) GetOwnerAccount added in v0.1.0

func (br *Burn) GetOwnerAccount() *base.AccountMeta

GetOwnerAccount gets the "owner" account. The account's owner/delegate.

func (*Burn) GetSourceAccount added in v0.1.0

func (br *Burn) GetSourceAccount() *base.AccountMeta

GetSourceAccount gets the "source" account. The account to burn from.

func (Burn) MarshalWithEncoder added in v0.1.0

func (br Burn) MarshalWithEncoder(encoder *encodbin.Encoder) (err error)

func (*Burn) SetAccounts added in v0.1.0

func (br *Burn) SetAccounts(accounts []*base.AccountMeta) error

func (*Burn) SetAmount added in v0.1.0

func (br *Burn) SetAmount(amount uint64) *Burn

SetAmount sets the "amount" parameter. The amount of tokens to burn.

func (*Burn) SetMintAccount added in v0.1.0

func (br *Burn) SetMintAccount(mint common.Address) *Burn

SetMintAccount sets the "mint" account. The token mint.

func (*Burn) SetOwnerAccount added in v0.1.0

func (br *Burn) SetOwnerAccount(owner common.Address, multisigSigners ...common.Address) *Burn

SetOwnerAccount sets the "owner" account. The account's owner/delegate.

func (*Burn) SetSourceAccount added in v0.1.0

func (br *Burn) SetSourceAccount(source common.Address) *Burn

SetSourceAccount sets the "source" account. The account to burn from.

func (*Burn) Validate added in v0.1.0

func (br *Burn) Validate() error

func (Burn) ValidateAndBuild added in v0.1.0

func (br Burn) 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 BurnChecked added in v0.1.0

type BurnChecked struct {
	// The amount of tokens to burn.
	Amount *uint64

	// Expected number of base 10 digits to the right of the decimal place.
	Decimals *uint8

	// [0] = [WRITE] source
	// ··········· The account to burn from.
	//
	// [1] = [WRITE] mint
	// ··········· The token mint.
	//
	// [2] = [] owner
	// ··········· The account's owner/delegate.
	//
	// [3...] = [SIGNER] signers
	// ··········· M signer accounts.
	Accounts []*base.AccountMeta `bin:"-" borsh_skip:"true"`
	Signers  []*base.AccountMeta `bin:"-" borsh_skip:"true"`
}

BurnChecked Burns tokens by removing them from an account. `BurnChecked` does not support accounts associated with the native mint, use `CloseAccount` instead.

This instruction differs from Burn in that the decimals value is checked by the caller. This may be useful when creating transactions offline or within a hardware wallet.

func NewBurnCheckedInstruction added in v0.1.0

func NewBurnCheckedInstruction(

	amount uint64,
	decimals uint8,

	source common.Address,
	mint common.Address,
	owner common.Address,
	multisigSigners []common.Address,
) *BurnChecked

NewBurnCheckedInstruction declares a new BurnChecked instruction with the provided parameters and accounts.

func NewBurnCheckedInstructionBuilder added in v0.1.0

func NewBurnCheckedInstructionBuilder() *BurnChecked

NewBurnCheckedInstructionBuilder creates a new `BurnChecked` instruction builder.

func (BurnChecked) Build added in v0.1.0

func (brCkd BurnChecked) Build() *Instruction

func (BurnChecked) GetAccounts added in v0.1.0

func (brCkd BurnChecked) GetAccounts() (accounts []*base.AccountMeta)

func (*BurnChecked) GetMintAccount added in v0.1.0

func (brCkd *BurnChecked) GetMintAccount() *base.AccountMeta

GetMintAccount gets the "mint" account. The token mint.

func (*BurnChecked) GetOwnerAccount added in v0.1.0

func (brCkd *BurnChecked) GetOwnerAccount() *base.AccountMeta

GetOwnerAccount gets the "owner" account. The account's owner/delegate.

func (*BurnChecked) GetSourceAccount added in v0.1.0

func (brCkd *BurnChecked) GetSourceAccount() *base.AccountMeta

GetSourceAccount gets the "source" account. The account to burn from.

func (BurnChecked) MarshalWithEncoder added in v0.1.0

func (brCkd BurnChecked) MarshalWithEncoder(encoder *encodbin.Encoder) (err error)

func (*BurnChecked) SetAccounts added in v0.1.0

func (brCkd *BurnChecked) SetAccounts(accounts []*base.AccountMeta) error

func (*BurnChecked) SetAmount added in v0.1.0

func (brCkd *BurnChecked) SetAmount(amount uint64) *BurnChecked

SetAmount sets the "amount" parameter. The amount of tokens to burn.

func (*BurnChecked) SetDecimals added in v0.1.0

func (brCkd *BurnChecked) SetDecimals(decimals uint8) *BurnChecked

SetDecimals sets the "decimals" parameter. Expected number of base 10 digits to the right of the decimal place.

func (*BurnChecked) SetMintAccount added in v0.1.0

func (brCkd *BurnChecked) SetMintAccount(mint common.Address) *BurnChecked

SetMintAccount sets the "mint" account. The token mint.

func (*BurnChecked) SetOwnerAccount added in v0.1.0

func (brCkd *BurnChecked) SetOwnerAccount(owner common.Address, multisigSigners ...common.Address) *BurnChecked

SetOwnerAccount sets the "owner" account. The account's owner/delegate.

func (*BurnChecked) SetSourceAccount added in v0.1.0

func (brCkd *BurnChecked) SetSourceAccount(source common.Address) *BurnChecked

SetSourceAccount sets the "source" account. The account to burn from.

func (*BurnChecked) Validate added in v0.1.0

func (brCkd *BurnChecked) Validate() error

func (BurnChecked) ValidateAndBuild added in v0.1.0

func (brCkd BurnChecked) 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 CloseAccount added in v0.1.0

type CloseAccount struct {

	// [0] = [WRITE] account
	// ··········· The account to close.
	//
	// [1] = [WRITE] destination
	// ··········· The destination account.
	//
	// [2] = [] owner
	// ··········· The account's owner.
	//
	// [3...] = [SIGNER] signers
	// ··········· M signer accounts.
	Accounts []*base.AccountMeta `bin:"-" borsh_skip:"true"`
	Signers  []*base.AccountMeta `bin:"-" borsh_skip:"true"`
}

CloseAccount Close an account by transferring all its SOL to the destination account. Non-native accounts may only be closed if its token amount is zero.

func NewCloseAccountInstruction added in v0.1.0

func NewCloseAccountInstruction(

	account common.Address,
	destination common.Address,
	owner common.Address,
	multisigSigners []common.Address,
) *CloseAccount

NewCloseAccountInstruction declares a new CloseAccount instruction with the provided parameters and accounts.

func NewCloseAccountInstructionBuilder added in v0.1.0

func NewCloseAccountInstructionBuilder() *CloseAccount

NewCloseAccountInstructionBuilder creates a new `CloseAccount` instruction builder.

func (CloseAccount) Build added in v0.1.0

func (cloAcc CloseAccount) Build() *Instruction

func (*CloseAccount) GetAccount added in v0.1.0

func (cloAcc *CloseAccount) GetAccount() *base.AccountMeta

GetAccount gets the "account" account. The account to close.

func (CloseAccount) GetAccounts added in v0.1.0

func (cloAcc CloseAccount) GetAccounts() (accounts []*base.AccountMeta)

func (*CloseAccount) GetDestinationAccount added in v0.1.0

func (cloAcc *CloseAccount) GetDestinationAccount() *base.AccountMeta

GetDestinationAccount gets the "destination" account. The destination account.

func (*CloseAccount) GetOwnerAccount added in v0.1.0

func (cloAcc *CloseAccount) GetOwnerAccount() *base.AccountMeta

GetOwnerAccount gets the "owner" account. The account's owner.

func (CloseAccount) MarshalWithEncoder added in v0.1.0

func (cloAcc CloseAccount) MarshalWithEncoder(encoder *encodbin.Encoder) (err error)

func (*CloseAccount) SetAccount added in v0.1.0

func (cloAcc *CloseAccount) SetAccount(account common.Address) *CloseAccount

SetAccount sets the "account" account. The account to close.

func (*CloseAccount) SetAccounts added in v0.1.0

func (cloAcc *CloseAccount) SetAccounts(accounts []*base.AccountMeta) error

func (*CloseAccount) SetDestinationAccount added in v0.1.0

func (cloAcc *CloseAccount) SetDestinationAccount(destination common.Address) *CloseAccount

SetDestinationAccount sets the "destination" account. The destination account.

func (*CloseAccount) SetOwnerAccount added in v0.1.0

func (cloAcc *CloseAccount) SetOwnerAccount(owner common.Address, multisigSigners ...common.Address) *CloseAccount

SetOwnerAccount sets the "owner" account. The account's owner.

func (*CloseAccount) Validate added in v0.1.0

func (cloAcc *CloseAccount) Validate() error

func (CloseAccount) ValidateAndBuild added in v0.1.0

func (cloAcc CloseAccount) 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 InitializeAccount added in v0.1.0

type InitializeAccount struct {

	// [0] = [WRITE] account
	// ··········· The account to initialize.
	//
	// [1] = [] mint
	// ··········· The mint this account will be associated with.
	//
	// [2] = [] owner
	// ··········· The new account's owner/multisignature.
	//
	// [3] = [] $(SysVarRentPubkey)
	// ··········· Rent sysvar.
	base.AccountMetaSlice `bin:"-" borsh_skip:"true"`
}

InitializeAccount Initializes a new account to hold tokens. If this account is associated with the native mint then the token balance of the initialized account will be equal to the amount of SOL in the account. If this account is associated with another mint, that mint must be initialized before this command can succeed.

The `InitializeAccount` instruction requires no signers and MUST be included within the same Transaction as the system program's `CreateAccount` instruction that creates the account being initialized. Otherwise another party can acquire ownership of the uninitialized account.

func NewInitializeAccountInstruction added in v0.1.0

func NewInitializeAccountInstruction(

	account common.Address,
	mint common.Address,
	owner common.Address) *InitializeAccount

NewInitializeAccountInstruction declares a new InitializeAccount instruction with the provided parameters and accounts.

func NewInitializeAccountInstructionBuilder added in v0.1.0

func NewInitializeAccountInstructionBuilder() *InitializeAccount

NewInitializeAccountInstructionBuilder creates a new `InitializeAccount` instruction builder.

func (InitializeAccount) Build added in v0.1.0

func (initAcc InitializeAccount) Build() *Instruction

func (*InitializeAccount) GetAccount added in v0.1.0

func (initAcc *InitializeAccount) GetAccount() *base.AccountMeta

GetAccount gets the "account" account. The account to initialize.

func (*InitializeAccount) GetMintAccount added in v0.1.0

func (initAcc *InitializeAccount) GetMintAccount() *base.AccountMeta

GetMintAccount gets the "mint" account. The mint this account will be associated with.

func (*InitializeAccount) GetOwnerAccount added in v0.1.0

func (initAcc *InitializeAccount) GetOwnerAccount() *base.AccountMeta

GetOwnerAccount gets the "owner" account. The new account's owner/multisignature.

func (*InitializeAccount) GetSysVarRentPubkeyAccount added in v0.1.0

func (initAcc *InitializeAccount) GetSysVarRentPubkeyAccount() *base.AccountMeta

GetSysVarRentPubkeyAccount gets the "$(SysVarRentPubkey)" account. Rent sysvar.

func (InitializeAccount) MarshalWithEncoder added in v0.1.0

func (initAcc InitializeAccount) MarshalWithEncoder(encoder *encodbin.Encoder) (err error)

func (*InitializeAccount) SetAccount added in v0.1.0

func (initAcc *InitializeAccount) SetAccount(account common.Address) *InitializeAccount

SetAccount sets the "account" account. The account to initialize.

func (*InitializeAccount) SetMintAccount added in v0.1.0

func (initAcc *InitializeAccount) SetMintAccount(mint common.Address) *InitializeAccount

SetMintAccount sets the "mint" account. The mint this account will be associated with.

func (*InitializeAccount) SetOwnerAccount added in v0.1.0

func (initAcc *InitializeAccount) SetOwnerAccount(owner common.Address) *InitializeAccount

SetOwnerAccount sets the "owner" account. The new account's owner/multisignature.

func (*InitializeAccount) SetSysVarRentPubkeyAccount added in v0.1.0

func (initAcc *InitializeAccount) SetSysVarRentPubkeyAccount(SysVarRentPubkey common.Address) *InitializeAccount

SetSysVarRentPubkeyAccount sets the "$(SysVarRentPubkey)" account. Rent sysvar.

func (*InitializeAccount) Validate added in v0.1.0

func (initAcc *InitializeAccount) Validate() error

func (InitializeAccount) ValidateAndBuild added in v0.1.0

func (initAcc InitializeAccount) 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 InitializeAccount2 added in v0.1.0

type InitializeAccount2 struct {
	// The new account's owner/multisignature.
	Owner *common.Address

	// [0] = [WRITE] account
	// ··········· The account to initialize.
	//
	// [1] = [] mint
	// ··········· The mint this account will be associated with.
	//
	// [2] = [] $(SysVarRentPubkey)
	// ··········· Rent sysvar.
	base.AccountMetaSlice `bin:"-" borsh_skip:"true"`
}

InitializeAccount2 Like InitializeAccount, but the owner pubkey is passed via instruction data rather than the accounts list. This variant may be preferable when using Cross Program Invocation from an instruction that does not need the owner's `AccountInfo` otherwise.

func NewInitializeAccount2Instruction added in v0.1.0

func NewInitializeAccount2Instruction(

	owner common.Address,

	account common.Address,
	mint common.Address) *InitializeAccount2

NewInitializeAccount2Instruction declares a new InitializeAccount2 instruction with the provided parameters and accounts.

func NewInitializeAccount2InstructionBuilder added in v0.1.0

func NewInitializeAccount2InstructionBuilder() *InitializeAccount2

NewInitializeAccount2InstructionBuilder creates a new `InitializeAccount2` instruction builder.

func (InitializeAccount2) Build added in v0.1.0

func (initAcc2 InitializeAccount2) Build() *Instruction

func (*InitializeAccount2) GetAccount added in v0.1.0

func (initAcc2 *InitializeAccount2) GetAccount() *base.AccountMeta

GetAccount gets the "account" account. The account to initialize.

func (*InitializeAccount2) GetMintAccount added in v0.1.0

func (initAcc2 *InitializeAccount2) GetMintAccount() *base.AccountMeta

GetMintAccount gets the "mint" account. The mint this account will be associated with.

func (*InitializeAccount2) GetSysVarRentPubkeyAccount added in v0.1.0

func (initAcc2 *InitializeAccount2) GetSysVarRentPubkeyAccount() *base.AccountMeta

GetSysVarRentPubkeyAccount gets the "$(SysVarRentPubkey)" account. Rent sysvar.

func (InitializeAccount2) MarshalWithEncoder added in v0.1.0

func (initAcc2 InitializeAccount2) MarshalWithEncoder(encoder *encodbin.Encoder) (err error)

func (*InitializeAccount2) SetAccount added in v0.1.0

func (initAcc2 *InitializeAccount2) SetAccount(account common.Address) *InitializeAccount2

SetAccount sets the "account" account. The account to initialize.

func (*InitializeAccount2) SetMintAccount added in v0.1.0

func (initAcc2 *InitializeAccount2) SetMintAccount(mint common.Address) *InitializeAccount2

SetMintAccount sets the "mint" account. The mint this account will be associated with.

func (*InitializeAccount2) SetOwner added in v0.1.0

func (initAcc2 *InitializeAccount2) SetOwner(owner common.Address) *InitializeAccount2

SetOwner sets the "owner" parameter. The new account's owner/multisignature.

func (*InitializeAccount2) SetSysVarRentPubkeyAccount added in v0.1.0

func (initAcc2 *InitializeAccount2) SetSysVarRentPubkeyAccount(SysVarRentPubkey common.Address) *InitializeAccount2

SetSysVarRentPubkeyAccount sets the "$(SysVarRentPubkey)" account. Rent sysvar.

func (*InitializeAccount2) Validate added in v0.1.0

func (initAcc2 *InitializeAccount2) Validate() error

func (InitializeAccount2) ValidateAndBuild added in v0.1.0

func (initAcc2 InitializeAccount2) 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 InitializeAccount3 added in v0.1.0

type InitializeAccount3 struct {
	// The new account's owner/multisignature.
	Owner *common.Address

	// [0] = [WRITE] account
	// ··········· The account to initialize.
	//
	// [1] = [] mint
	// ··········· The mint this account will be associated with.
	base.AccountMetaSlice `bin:"-" borsh_skip:"true"`
}

InitializeAccount3 Like InitializeAccount2, but does not require the Rent sysvar to be provided.

func NewInitializeAccount3Instruction added in v0.1.0

func NewInitializeAccount3Instruction(

	owner common.Address,

	account common.Address,
	mint common.Address) *InitializeAccount3

NewInitializeAccount3Instruction declares a new InitializeAccount3 instruction with the provided parameters and accounts.

func NewInitializeAccount3InstructionBuilder added in v0.1.0

func NewInitializeAccount3InstructionBuilder() *InitializeAccount3

NewInitializeAccount3InstructionBuilder creates a new `InitializeAccount3` instruction builder.

func (InitializeAccount3) Build added in v0.1.0

func (initAcc3 InitializeAccount3) Build() *Instruction

func (*InitializeAccount3) GetAccount added in v0.1.0

func (initAcc3 *InitializeAccount3) GetAccount() *base.AccountMeta

GetAccount gets the "account" account. The account to initialize.

func (*InitializeAccount3) GetMintAccount added in v0.1.0

func (initAcc3 *InitializeAccount3) GetMintAccount() *base.AccountMeta

GetMintAccount gets the "mint" account. The mint this account will be associated with.

func (InitializeAccount3) MarshalWithEncoder added in v0.1.0

func (initAcc3 InitializeAccount3) MarshalWithEncoder(encoder *encodbin.Encoder) (err error)

func (*InitializeAccount3) SetAccount added in v0.1.0

func (initAcc3 *InitializeAccount3) SetAccount(account common.Address) *InitializeAccount3

SetAccount sets the "account" account. The account to initialize.

func (*InitializeAccount3) SetMintAccount added in v0.1.0

func (initAcc3 *InitializeAccount3) SetMintAccount(mint common.Address) *InitializeAccount3

SetMintAccount sets the "mint" account. The mint this account will be associated with.

func (*InitializeAccount3) SetOwner added in v0.1.0

func (initAcc3 *InitializeAccount3) SetOwner(owner common.Address) *InitializeAccount3

SetOwner sets the "owner" parameter. The new account's owner/multisignature.

func (*InitializeAccount3) Validate added in v0.1.0

func (initAcc3 *InitializeAccount3) Validate() error

func (InitializeAccount3) ValidateAndBuild added in v0.1.0

func (initAcc3 InitializeAccount3) 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 InitializeMint added in v0.1.0

type InitializeMint struct {
	// Number of base 10 digits to the right of the decimal place.
	Decimals *uint8

	// The authority/multisignature to mint tokens.
	MintAuthority *common.Address

	// The freeze authority/multisignature of the mint.
	FreezeAuthority *common.Address `bin:"optional"`

	// [0] = [WRITE] mint
	// ··········· The mint to initialize.
	//
	// [1] = [] $(SysVarRentPubkey)
	// ··········· Rent sysvar.
	base.AccountMetaSlice `bin:"-" borsh_skip:"true"`
}

InitializeMint Initializes a new mint and optionally deposits all the newly minted tokens in an account.

The `InitializeMint` instruction requires no signers and MUST be included within the same Transaction as the system program's `CreateAccount` instruction that creates the account being initialized. Otherwise another party can acquire ownership of the uninitialized account.

func NewInitializeMintInstruction added in v0.1.0

func NewInitializeMintInstruction(

	decimals uint8,
	mint_authority common.Address,
	freeze_authority common.Address,

	mint common.Address) *InitializeMint

NewInitializeMintInstruction declares a new InitializeMint instruction with the provided parameters and accounts.

func NewInitializeMintInstructionBuilder added in v0.1.0

func NewInitializeMintInstructionBuilder() *InitializeMint

NewInitializeMintInstructionBuilder creates a new `InitializeMint` instruction builder.

func (InitializeMint) Build added in v0.1.0

func (initMint InitializeMint) Build() *Instruction

func (*InitializeMint) GetMintAccount added in v0.1.0

func (initMint *InitializeMint) GetMintAccount() *base.AccountMeta

GetMintAccount gets the "mint" account. The mint to initialize.

func (*InitializeMint) GetSysVarRentPubkeyAccount added in v0.1.0

func (initMint *InitializeMint) GetSysVarRentPubkeyAccount() *base.AccountMeta

GetSysVarRentPubkeyAccount gets the "$(SysVarRentPubkey)" account. Rent sysvar.

func (InitializeMint) MarshalWithEncoder added in v0.1.0

func (initMint InitializeMint) MarshalWithEncoder(encoder *encodbin.Encoder) (err error)

func (*InitializeMint) SetDecimals added in v0.1.0

func (initMint *InitializeMint) SetDecimals(decimals uint8) *InitializeMint

SetDecimals sets the "decimals" parameter. Number of base 10 digits to the right of the decimal place.

func (*InitializeMint) SetFreezeAuthority added in v0.1.0

func (initMint *InitializeMint) SetFreezeAuthority(freeze_authority common.Address) *InitializeMint

SetFreezeAuthority sets the "freeze_authority" parameter. The freeze authority/multisignature of the mint.

func (*InitializeMint) SetMintAccount added in v0.1.0

func (initMint *InitializeMint) SetMintAccount(mint common.Address) *InitializeMint

SetMintAccount sets the "mint" account. The mint to initialize.

func (*InitializeMint) SetMintAuthority added in v0.1.0

func (initMint *InitializeMint) SetMintAuthority(mint_authority common.Address) *InitializeMint

SetMintAuthority sets the "mint_authority" parameter. The authority/multisignature to mint tokens.

func (*InitializeMint) SetSysVarRentPubkeyAccount added in v0.1.0

func (initMint *InitializeMint) SetSysVarRentPubkeyAccount(SysVarRentPubkey common.Address) *InitializeMint

SetSysVarRentPubkeyAccount sets the "$(SysVarRentPubkey)" account. Rent sysvar.

func (*InitializeMint) Validate added in v0.1.0

func (initMint *InitializeMint) Validate() error

func (InitializeMint) ValidateAndBuild added in v0.1.0

func (initMint InitializeMint) 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 InitializeMint2 added in v0.1.0

type InitializeMint2 struct {
	// Number of base 10 digits to the right of the decimal place.
	Decimals *uint8

	// The authority/multisignature to mint tokens.
	MintAuthority *common.Address

	// The freeze authority/multisignature of the mint.
	FreezeAuthority *common.Address `bin:"optional"`

	// [0] = [WRITE] mint
	// ··········· The mint to initialize.
	base.AccountMetaSlice `bin:"-" borsh_skip:"true"`
}

InitializeMint2 Like InitializeMint, but does not require the Rent sysvar to be provided.

func NewInitializeMint2Instruction added in v0.1.0

func NewInitializeMint2Instruction(

	decimals uint8,
	mint_authority common.Address,
	freeze_authority common.Address,

	mint common.Address) *InitializeMint2

NewInitializeMint2Instruction declares a new InitializeMint2 instruction with the provided parameters and accounts.

func NewInitializeMint2InstructionBuilder added in v0.1.0

func NewInitializeMint2InstructionBuilder() *InitializeMint2

NewInitializeMint2InstructionBuilder creates a new `InitializeMint2` instruction builder.

func (InitializeMint2) Build added in v0.1.0

func (initMint InitializeMint2) Build() *Instruction

func (*InitializeMint2) GetMintAccount added in v0.1.0

func (initMint *InitializeMint2) GetMintAccount() *base.AccountMeta

GetMintAccount gets the "mint" account. The mint to initialize.

func (InitializeMint2) MarshalWithEncoder added in v0.1.0

func (initMint InitializeMint2) MarshalWithEncoder(encoder *encodbin.Encoder) (err error)

func (*InitializeMint2) SetDecimals added in v0.1.0

func (initMint *InitializeMint2) SetDecimals(decimals uint8) *InitializeMint2

SetDecimals sets the "decimals" parameter. Number of base 10 digits to the right of the decimal place.

func (*InitializeMint2) SetFreezeAuthority added in v0.1.0

func (initMint *InitializeMint2) SetFreezeAuthority(freeze_authority common.Address) *InitializeMint2

SetFreezeAuthority sets the "freeze_authority" parameter. The freeze authority/multisignature of the mint.

func (*InitializeMint2) SetMintAccount added in v0.1.0

func (initMint *InitializeMint2) SetMintAccount(mint common.Address) *InitializeMint2

SetMintAccount sets the "mint" account. The mint to initialize.

func (*InitializeMint2) SetMintAuthority added in v0.1.0

func (initMint *InitializeMint2) SetMintAuthority(mint_authority common.Address) *InitializeMint2

SetMintAuthority sets the "mint_authority" parameter. The authority/multisignature to mint tokens.

func (*InitializeMint2) Validate added in v0.1.0

func (initMint *InitializeMint2) Validate() error

func (InitializeMint2) ValidateAndBuild added in v0.1.0

func (initMint InitializeMint2) 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 InitializeMultisig added in v0.1.0

type InitializeMultisig struct {
	// The number of signers (M) required to validate this multisignature
	// account.
	M *uint8

	// [0] = [WRITE] account
	// ··········· The multisignature account to initialize.
	//
	// [1] = [] $(SysVarRentPubkey)
	// ··········· Rent sysvar.
	//
	// [2...] = [SIGNER] signers
	// ··········· ..2+N The signer accounts, must equal to N where 1 <= N <=11
	Accounts []*base.AccountMeta `bin:"-" borsh_skip:"true"`
	Signers  []*base.AccountMeta `bin:"-" borsh_skip:"true"`
}

InitializeMultisig Initializes a multisignature account with N provided signers.

Multisignature accounts can used in place of any single owner/delegate accounts in any token instruction that require an owner/delegate to be present. The variant field represents the number of signers (M) required to validate this multisignature account.

The `InitializeMultisig` instruction requires no signers and MUST be included within the same Transaction as the system program's `CreateAccount` instruction that creates the account being initialized. Otherwise another party can acquire ownership of the uninitialized account.

func NewInitializeMultisigInstruction added in v0.1.0

func NewInitializeMultisigInstruction(

	m uint8,

	account common.Address,
	SysVarRentPubkey common.Address,
	signers []common.Address,
) *InitializeMultisig

NewInitializeMultisigInstruction declares a new InitializeMultisig instruction with the provided parameters and accounts.

func NewInitializeMultisigInstructionBuilder added in v0.1.0

func NewInitializeMultisigInstructionBuilder() *InitializeMultisig

NewInitializeMultisigInstructionBuilder creates a new `InitializeMultisig` instruction builder.

func (*InitializeMultisig) AddSigners added in v0.1.0

func (initMs *InitializeMultisig) AddSigners(signers ...common.Address) *InitializeMultisig

AddSigners adds the "signers" accounts. ..2+N The signer accounts, must equal to N where 1 <= N <=11

func (InitializeMultisig) Build added in v0.1.0

func (initMs InitializeMultisig) Build() *Instruction

func (*InitializeMultisig) GetAccount added in v0.1.0

func (initMs *InitializeMultisig) GetAccount() *base.AccountMeta

GetAccount gets the "account" account. The multisignature account to initialize.

func (InitializeMultisig) GetAccounts added in v0.1.0

func (initMs InitializeMultisig) GetAccounts() (accounts []*base.AccountMeta)

func (*InitializeMultisig) GetSysVarRentPubkeyAccount added in v0.1.0

func (initMs *InitializeMultisig) GetSysVarRentPubkeyAccount() *base.AccountMeta

GetSysVarRentPubkeyAccount gets the "$(SysVarRentPubkey)" account. Rent sysvar.

func (InitializeMultisig) MarshalWithEncoder added in v0.1.0

func (initMs InitializeMultisig) MarshalWithEncoder(encoder *encodbin.Encoder) (err error)

func (*InitializeMultisig) SetAccount added in v0.1.0

func (initMs *InitializeMultisig) SetAccount(account common.Address) *InitializeMultisig

SetAccount sets the "account" account. The multisignature account to initialize.

func (*InitializeMultisig) SetAccounts added in v0.1.0

func (initMs *InitializeMultisig) SetAccounts(accounts []*base.AccountMeta) error

func (*InitializeMultisig) SetM added in v0.1.0

func (initMs *InitializeMultisig) SetM(m uint8) *InitializeMultisig

SetM sets the "m" parameter. The number of signers (M) required to validate this multisignature account.

func (*InitializeMultisig) SetSysVarRentPubkeyAccount added in v0.1.0

func (initMs *InitializeMultisig) SetSysVarRentPubkeyAccount(SysVarRentPubkey common.Address) *InitializeMultisig

SetSysVarRentPubkeyAccount sets the "$(SysVarRentPubkey)" account. Rent sysvar.

func (*InitializeMultisig) Validate added in v0.1.0

func (initMs *InitializeMultisig) Validate() error

func (InitializeMultisig) ValidateAndBuild added in v0.1.0

func (initMs InitializeMultisig) 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 InitializeMultisig2 added in v0.1.0

type InitializeMultisig2 struct {
	// The number of signers (M) required to validate this multisignature account.
	M *uint8

	// [0] = [WRITE] account
	// ··········· The multisignature account to initialize.
	//
	// [1] = [SIGNER] signers
	// ··········· The signer accounts, must equal to N where 1 <= N <= 11.
	Accounts []*base.AccountMeta `bin:"-" borsh_skip:"true"`
	Signers  []*base.AccountMeta `bin:"-" borsh_skip:"true"`
}

InitializeMultisig2 Like InitializeMultisig, but does not require the Rent sysvar to be provided.

func NewInitializeMultisig2Instruction added in v0.1.0

func NewInitializeMultisig2Instruction(

	m uint8,

	account common.Address,
	signers []common.Address,
) *InitializeMultisig2

NewInitializeMultisig2Instruction declares a new InitializeMultisig2 instruction with the provided parameters and accounts.

func NewInitializeMultisig2InstructionBuilder added in v0.1.0

func NewInitializeMultisig2InstructionBuilder() *InitializeMultisig2

NewInitializeMultisig2InstructionBuilder creates a new `InitializeMultisig2` instruction builder.

func (*InitializeMultisig2) AddSigners added in v0.1.0

func (initMs *InitializeMultisig2) AddSigners(signers ...common.Address) *InitializeMultisig2

AddSigners adds the "signers" accounts. The signer accounts, must equal to N where 1 <= N <= 11.

func (InitializeMultisig2) Build added in v0.1.0

func (initMs InitializeMultisig2) Build() *Instruction

func (*InitializeMultisig2) GetAccount added in v0.1.0

func (initMs *InitializeMultisig2) GetAccount() *base.AccountMeta

GetAccount gets the "account" account. The multisignature account to initialize.

func (InitializeMultisig2) GetAccounts added in v0.1.0

func (initMs InitializeMultisig2) GetAccounts() (accounts []*base.AccountMeta)

func (InitializeMultisig2) MarshalWithEncoder added in v0.1.0

func (initMs InitializeMultisig2) MarshalWithEncoder(encoder *encodbin.Encoder) (err error)

func (*InitializeMultisig2) SetAccount added in v0.1.0

func (initMs *InitializeMultisig2) SetAccount(account common.Address) *InitializeMultisig2

SetAccount sets the "account" account. The multisignature account to initialize.

func (*InitializeMultisig2) SetAccounts added in v0.1.0

func (initMs *InitializeMultisig2) SetAccounts(accounts []*base.AccountMeta) error

func (*InitializeMultisig2) SetM added in v0.1.0

SetM sets the "m" parameter. The number of signers (M) required to validate this multisignature account.

func (*InitializeMultisig2) Validate added in v0.1.0

func (initMs *InitializeMultisig2) Validate() error

func (InitializeMultisig2) ValidateAndBuild added in v0.1.0

func (initMs InitializeMultisig2) 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
	TokenProgramID common.Address
}

func (*Instruction) Accounts added in v0.0.7

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

func (*Instruction) Data added in v0.0.7

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

func (*Instruction) MarshalWithEncoder added in v0.0.7

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

func (*Instruction) ProgramID added in v0.0.7

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

func (*Instruction) SetProgramID added in v0.0.8

func (inst *Instruction) SetProgramID(tokenProgramID common.Address)

type MintTo added in v0.1.0

type MintTo struct {
	// The amount of new tokens to mint.
	Amount *uint64

	// [0] = [WRITE] mint
	// ··········· The mint.
	//
	// [1] = [WRITE] destination
	// ··········· The account to mint tokens to.
	//
	// [2] = [] authority
	// ··········· The mint's minting authority.
	//
	// [3...] = [SIGNER] signers
	// ··········· M signer accounts.
	Accounts []*base.AccountMeta `bin:"-" borsh_skip:"true"`
	Signers  []*base.AccountMeta `bin:"-" borsh_skip:"true"`
}

MintTo Mints new tokens to an account. The native mint does not support minting.

func NewMintToInstruction added in v0.1.0

func NewMintToInstruction(

	amount uint64,

	mint common.Address,
	destination common.Address,
	authority common.Address,
	multisigSigners []common.Address,
) *MintTo

NewMintToInstruction declares a new MintTo instruction with the provided parameters and accounts.

func NewMintToInstructionBuilder added in v0.1.0

func NewMintToInstructionBuilder() *MintTo

NewMintToInstructionBuilder creates a new `MintTo` instruction builder.

func (MintTo) Build added in v0.1.0

func (mto MintTo) Build() *Instruction

func (MintTo) GetAccounts added in v0.1.0

func (mto MintTo) GetAccounts() (accounts []*base.AccountMeta)

func (*MintTo) GetAuthorityAccount added in v0.1.0

func (mto *MintTo) GetAuthorityAccount() *base.AccountMeta

GetAuthorityAccount gets the "authority" account. The mint's minting authority.

func (*MintTo) GetDestinationAccount added in v0.1.0

func (mto *MintTo) GetDestinationAccount() *base.AccountMeta

GetDestinationAccount gets the "destination" account. The account to mint tokens to.

func (*MintTo) GetMintAccount added in v0.1.0

func (mto *MintTo) GetMintAccount() *base.AccountMeta

GetMintAccount gets the "mint" account. The mint.

func (MintTo) MarshalWithEncoder added in v0.1.0

func (mto MintTo) MarshalWithEncoder(encoder *encodbin.Encoder) (err error)

func (*MintTo) SetAccounts added in v0.1.0

func (mto *MintTo) SetAccounts(accounts []*base.AccountMeta) error

func (*MintTo) SetAmount added in v0.1.0

func (mto *MintTo) SetAmount(amount uint64) *MintTo

SetAmount sets the "amount" parameter. The amount of new tokens to mint.

func (*MintTo) SetAuthorityAccount added in v0.1.0

func (mto *MintTo) SetAuthorityAccount(authority common.Address, multisigSigners ...common.Address) *MintTo

SetAuthorityAccount sets the "authority" account. The mint's minting authority.

func (*MintTo) SetDestinationAccount added in v0.1.0

func (mto *MintTo) SetDestinationAccount(destination common.Address) *MintTo

SetDestinationAccount sets the "destination" account. The account to mint tokens to.

func (*MintTo) SetMintAccount added in v0.1.0

func (mto *MintTo) SetMintAccount(mint common.Address) *MintTo

SetMintAccount sets the "mint" account. The mint.

func (*MintTo) Validate added in v0.1.0

func (mto *MintTo) Validate() error

func (MintTo) ValidateAndBuild added in v0.1.0

func (mto MintTo) 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 MintToChecked added in v0.1.0

type MintToChecked struct {
	// The amount of new tokens to mint.
	Amount *uint64

	// Expected number of base 10 digits to the right of the decimal place.
	Decimals *uint8

	// [0] = [WRITE] mint
	// ··········· The mint.
	//
	// [1] = [WRITE] destination
	// ··········· The account to mint tokens to.
	//
	// [2] = [] authority
	// ··········· The mint's minting authority.
	//
	// [3...] = [SIGNER] signers
	// ··········· M signer accounts.
	Accounts []*base.AccountMeta `bin:"-" borsh_skip:"true"`
	Signers  []*base.AccountMeta `bin:"-" borsh_skip:"true"`
}

MintToChecked Mints new tokens to an account. The native mint does not support minting.

This instruction differs from MintTo in that the decimals value is checked by the caller. This may be useful when creating transactions offline or within a hardware wallet.

func NewMintToCheckedInstruction added in v0.1.0

func NewMintToCheckedInstruction(

	amount uint64,
	decimals uint8,

	mint common.Address,
	destination common.Address,
	authority common.Address,
	multisigSigners []common.Address,
) *MintToChecked

NewMintToCheckedInstruction declares a new MintToChecked instruction with the provided parameters and accounts.

func NewMintToCheckedInstructionBuilder added in v0.1.0

func NewMintToCheckedInstructionBuilder() *MintToChecked

NewMintToCheckedInstructionBuilder creates a new `MintToChecked` instruction builder.

func (MintToChecked) Build added in v0.1.0

func (mCkd MintToChecked) Build() *Instruction

func (MintToChecked) GetAccounts added in v0.1.0

func (mCkd MintToChecked) GetAccounts() (accounts []*base.AccountMeta)

func (*MintToChecked) GetAuthorityAccount added in v0.1.0

func (mCkd *MintToChecked) GetAuthorityAccount() *base.AccountMeta

GetAuthorityAccount gets the "authority" account. The mint's minting authority.

func (*MintToChecked) GetDestinationAccount added in v0.1.0

func (mCkd *MintToChecked) GetDestinationAccount() *base.AccountMeta

GetDestinationAccount gets the "destination" account. The account to mint tokens to.

func (*MintToChecked) GetMintAccount added in v0.1.0

func (mCkd *MintToChecked) GetMintAccount() *base.AccountMeta

GetMintAccount gets the "mint" account. The mint.

func (MintToChecked) MarshalWithEncoder added in v0.1.0

func (mCkd MintToChecked) MarshalWithEncoder(encoder *encodbin.Encoder) (err error)

func (*MintToChecked) SetAccounts added in v0.1.0

func (mCkd *MintToChecked) SetAccounts(accounts []*base.AccountMeta) error

func (*MintToChecked) SetAmount added in v0.1.0

func (mCkd *MintToChecked) SetAmount(amount uint64) *MintToChecked

SetAmount sets the "amount" parameter. The amount of new tokens to mint.

func (*MintToChecked) SetAuthorityAccount added in v0.1.0

func (mCkd *MintToChecked) SetAuthorityAccount(authority common.Address, multisigSigners ...common.Address) *MintToChecked

SetAuthorityAccount sets the "authority" account. The mint's minting authority.

func (*MintToChecked) SetDecimals added in v0.1.0

func (mCkd *MintToChecked) SetDecimals(decimals uint8) *MintToChecked

SetDecimals sets the "decimals" parameter. Expected number of base 10 digits to the right of the decimal place.

func (*MintToChecked) SetDestinationAccount added in v0.1.0

func (mCkd *MintToChecked) SetDestinationAccount(destination common.Address) *MintToChecked

SetDestinationAccount sets the "destination" account. The account to mint tokens to.

func (*MintToChecked) SetMintAccount added in v0.1.0

func (mCkd *MintToChecked) SetMintAccount(mint common.Address) *MintToChecked

SetMintAccount sets the "mint" account. The mint.

func (*MintToChecked) Validate added in v0.1.0

func (mCkd *MintToChecked) Validate() error

func (MintToChecked) ValidateAndBuild added in v0.1.0

func (mCkd MintToChecked) 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 Revoke added in v0.1.0

type Revoke struct {

	// [0] = [WRITE] source
	// ··········· The source account.
	//
	// [1] = [] owner
	// ··········· The source account's owner.
	//
	// [2...] = [SIGNER] signers
	// ··········· M signer accounts.
	Accounts []*base.AccountMeta `bin:"-" borsh_skip:"true"`
	Signers  []*base.AccountMeta `bin:"-" borsh_skip:"true"`
}

Revoke the delegate's authority.

func NewRevokeInstruction added in v0.1.0

func NewRevokeInstruction(

	source common.Address,
	owner common.Address,
	multisigSigners []common.Address,
) *Revoke

NewRevokeInstruction declares a new Revoke instruction with the provided parameters and accounts.

func NewRevokeInstructionBuilder added in v0.1.0

func NewRevokeInstructionBuilder() *Revoke

NewRevokeInstructionBuilder creates a new `Revoke` instruction builder.

func (Revoke) Build added in v0.1.0

func (rvk Revoke) Build() *Instruction

func (Revoke) GetAccounts added in v0.1.0

func (rvk Revoke) GetAccounts() (accounts []*base.AccountMeta)

func (*Revoke) GetOwnerAccount added in v0.1.0

func (rvk *Revoke) GetOwnerAccount() *base.AccountMeta

GetOwnerAccount gets the "owner" account. The source account's owner.

func (*Revoke) GetSourceAccount added in v0.1.0

func (rvk *Revoke) GetSourceAccount() *base.AccountMeta

GetSourceAccount gets the "source" account. The source account.

func (Revoke) MarshalWithEncoder added in v0.1.0

func (rvk Revoke) MarshalWithEncoder(encoder *encodbin.Encoder) (err error)

func (*Revoke) SetAccounts added in v0.1.0

func (rvk *Revoke) SetAccounts(accounts []*base.AccountMeta) error

func (*Revoke) SetOwnerAccount added in v0.1.0

func (rvk *Revoke) SetOwnerAccount(owner common.Address, multisigSigners ...common.Address) *Revoke

SetOwnerAccount sets the "owner" account. The source account's owner.

func (*Revoke) SetSourceAccount added in v0.1.0

func (rvk *Revoke) SetSourceAccount(source common.Address) *Revoke

SetSourceAccount sets the "source" account. The source account.

func (*Revoke) Validate added in v0.1.0

func (rvk *Revoke) Validate() error

func (Revoke) ValidateAndBuild added in v0.1.0

func (rvk Revoke) 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 SetAuthority added in v0.1.0

type SetAuthority struct {
	// The type of authority to update.
	AuthorityType *AuthorityType

	// The new authority.
	NewAuthority *common.Address `bin:"optional"`

	// [0] = [WRITE] subject
	// ··········· The mint or account to change the authority of.
	//
	// [1] = [] authority
	// ··········· The current authority of the mint or account.
	//
	// [2...] = [SIGNER] signers
	// ··········· M signer accounts.
	Accounts []*base.AccountMeta `bin:"-" borsh_skip:"true"`
	Signers  []*base.AccountMeta `bin:"-" borsh_skip:"true"`
}

SetAuthority Sets a new authority of a mint or account.

func NewSetAuthorityInstruction added in v0.1.0

func NewSetAuthorityInstruction(

	authority_type AuthorityType,
	new_authority common.Address,

	subject common.Address,
	authority common.Address,
	multisigSigners []common.Address,
) *SetAuthority

NewSetAuthorityInstruction declares a new SetAuthority instruction with the provided parameters and accounts.

func NewSetAuthorityInstructionBuilder added in v0.1.0

func NewSetAuthorityInstructionBuilder() *SetAuthority

NewSetAuthorityInstructionBuilder creates a new `SetAuthority` instruction builder.

func (SetAuthority) Build added in v0.1.0

func (sAut SetAuthority) Build() *Instruction

func (SetAuthority) GetAccounts added in v0.1.0

func (sAut SetAuthority) GetAccounts() (accounts []*base.AccountMeta)

func (*SetAuthority) GetAuthorityAccount added in v0.1.0

func (sAut *SetAuthority) GetAuthorityAccount() *base.AccountMeta

GetAuthorityAccount gets the "authority" account. The current authority of the mint or account.

func (*SetAuthority) GetSubjectAccount added in v0.1.0

func (sAut *SetAuthority) GetSubjectAccount() *base.AccountMeta

GetSubjectAccount gets the "subject" account. The mint or account to change the authority of.

func (SetAuthority) MarshalWithEncoder added in v0.1.0

func (sAut SetAuthority) MarshalWithEncoder(encoder *encodbin.Encoder) (err error)

func (*SetAuthority) SetAccounts added in v0.1.0

func (sAut *SetAuthority) SetAccounts(accounts []*base.AccountMeta) error

func (*SetAuthority) SetAuthorityAccount added in v0.1.0

func (sAut *SetAuthority) SetAuthorityAccount(authority common.Address, multisigSigners ...common.Address) *SetAuthority

SetAuthorityAccount sets the "authority" account. The current authority of the mint or account.

func (*SetAuthority) SetAuthorityType added in v0.1.0

func (sAut *SetAuthority) SetAuthorityType(authority_type AuthorityType) *SetAuthority

SetAuthorityType sets the "authority_type" parameter. The type of authority to update.

func (*SetAuthority) SetNewAuthority added in v0.1.0

func (sAut *SetAuthority) SetNewAuthority(new_authority common.Address) *SetAuthority

SetNewAuthority sets the "new_authority" parameter. The new authority.

func (*SetAuthority) SetSubjectAccount added in v0.1.0

func (sAut *SetAuthority) SetSubjectAccount(subject common.Address) *SetAuthority

SetSubjectAccount sets the "subject" account. The mint or account to change the authority of.

func (*SetAuthority) Validate added in v0.1.0

func (sAut *SetAuthority) Validate() error

func (SetAuthority) ValidateAndBuild added in v0.1.0

func (sAut SetAuthority) 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 SyncNative added in v0.1.0

type SyncNative struct {

	// [0] = [WRITE] tokenAccount
	// ··········· The native token account to sync with its underlying lamports.
	base.AccountMetaSlice `bin:"-" borsh_skip:"true"`
}

SyncNative Given a wrapped / native token account (a token account containing SOL) updates its amount field based on the account's underlying `lamports`. This is useful if a non-wrapped SOL account uses `system_instruction::transfer` to move lamports to a wrapped token account, and needs to have its token `amount` field updated.

func NewSyncNativeInstruction added in v0.1.0

func NewSyncNativeInstruction(

	tokenAccount common.Address) *SyncNative

NewSyncNativeInstruction declares a new SyncNative instruction with the provided parameters and accounts.

func NewSyncNativeInstructionBuilder added in v0.1.0

func NewSyncNativeInstructionBuilder() *SyncNative

NewSyncNativeInstructionBuilder creates a new `SyncNative` instruction builder.

func (SyncNative) Build added in v0.1.0

func (sNative SyncNative) Build() *Instruction

func (SyncNative) GetAccounts added in v0.1.0

func (sync SyncNative) GetAccounts() (accounts []*base.AccountMeta)

func (*SyncNative) GetTokenAccount added in v0.1.0

func (sNative *SyncNative) GetTokenAccount() *base.AccountMeta

GetTokenAccount gets the "tokenAccount" account. The native token account to sync with its underlying lamports.

func (SyncNative) MarshalWithEncoder added in v0.1.0

func (sNative SyncNative) MarshalWithEncoder(encoder *encodbin.Encoder) (err error)

func (*SyncNative) SetTokenAccount added in v0.1.0

func (sNative *SyncNative) SetTokenAccount(tokenAccount common.Address) *SyncNative

SetTokenAccount sets the "tokenAccount" account. The native token account to sync with its underlying lamports.

func (*SyncNative) Validate added in v0.1.0

func (sNative *SyncNative) Validate() error

func (SyncNative) ValidateAndBuild added in v0.1.0

func (sNative SyncNative) 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 ThawAccount added in v0.1.0

type ThawAccount struct {

	// [0] = [WRITE] account
	// ··········· The account to thaw.
	//
	// [1] = [] mint
	// ··········· The token mint.
	//
	// [2] = [] authority
	// ··········· The mint freeze authority.
	//
	// [3...] = [SIGNER] signers
	// ··········· M signer accounts.
	Accounts []*base.AccountMeta `bin:"-" borsh_skip:"true"`
	Signers  []*base.AccountMeta `bin:"-" borsh_skip:"true"`
}

ThawAccount Thaw a Frozen account using the Mint's freeze_authority (if set).

func NewThawAccountInstruction added in v0.1.0

func NewThawAccountInstruction(

	account common.Address,
	mint common.Address,
	authority common.Address,
	multisigSigners []common.Address,
) *ThawAccount

NewThawAccountInstruction declares a new ThawAccount instruction with the provided parameters and accounts.

func NewThawAccountInstructionBuilder added in v0.1.0

func NewThawAccountInstructionBuilder() *ThawAccount

NewThawAccountInstructionBuilder creates a new `ThawAccount` instruction builder.

func (ThawAccount) Build added in v0.1.0

func (tAcc ThawAccount) Build() *Instruction

func (*ThawAccount) GetAccount added in v0.1.0

func (tAcc *ThawAccount) GetAccount() *base.AccountMeta

GetAccount gets the "account" account. The account to thaw.

func (ThawAccount) GetAccounts added in v0.1.0

func (tAcc ThawAccount) GetAccounts() (accounts []*base.AccountMeta)

func (*ThawAccount) GetAuthorityAccount added in v0.1.0

func (tAcc *ThawAccount) GetAuthorityAccount() *base.AccountMeta

GetAuthorityAccount gets the "authority" account. The mint freeze authority.

func (*ThawAccount) GetMintAccount added in v0.1.0

func (tAcc *ThawAccount) GetMintAccount() *base.AccountMeta

GetMintAccount gets the "mint" account. The token mint.

func (ThawAccount) MarshalWithEncoder added in v0.1.0

func (tAcc ThawAccount) MarshalWithEncoder(encoder *encodbin.Encoder) (err error)

func (*ThawAccount) SetAccount added in v0.1.0

func (tAcc *ThawAccount) SetAccount(account common.Address) *ThawAccount

SetAccount sets the "account" account. The account to thaw.

func (*ThawAccount) SetAccounts added in v0.1.0

func (tAcc *ThawAccount) SetAccounts(accounts []*base.AccountMeta) error

func (*ThawAccount) SetAuthorityAccount added in v0.1.0

func (tAcc *ThawAccount) SetAuthorityAccount(authority common.Address, multisigSigners ...common.Address) *ThawAccount

SetAuthorityAccount sets the "authority" account. The mint freeze authority.

func (*ThawAccount) SetMintAccount added in v0.1.0

func (tAcc *ThawAccount) SetMintAccount(mint common.Address) *ThawAccount

SetMintAccount sets the "mint" account. The token mint.

func (*ThawAccount) Validate added in v0.1.0

func (tAcc *ThawAccount) Validate() error

func (ThawAccount) ValidateAndBuild added in v0.1.0

func (tAcc ThawAccount) 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 TransferChecked

type TransferChecked struct {
	// The amount of tokens to transfer.
	Amount *uint64

	// Expected number of base 10 digits to the right of the decimal place.
	Decimals *uint8

	// [0] = [WRITE] source
	// ··········· The source account.
	//
	// [1] = [] mint
	// ··········· The token mint.
	//
	// [2] = [WRITE] destination
	// ··········· The destination account.
	//
	// [3] = [] owner
	// ··········· The source account's owner/delegate.
	//
	// [4...] = [SIGNER] signers
	// ··········· M signer accounts.
	Accounts []*base.AccountMeta `bin:"-" borsh_skip:"true"`
	Signers  []*base.AccountMeta `bin:"-" borsh_skip:"true"`
}

func NewTransferCheckedInstruction added in v0.0.8

func NewTransferCheckedInstruction(

	amount uint64,
	decimals uint8,

	source common.Address,
	mint common.Address,
	destination common.Address,
	owner common.Address,
	multisigSigners []common.Address,
) *TransferChecked

NewTransferCheckedInstruction declares a new TransferChecked instruction with the provided parameters and accounts.

func NewTransferCheckedInstructionBuilder added in v0.0.8

func NewTransferCheckedInstructionBuilder() *TransferChecked

NewTransferCheckedInstructionBuilder creates a new `TransferChecked` instruction builder.

func (TransferChecked) Build added in v0.0.8

func (tc TransferChecked) Build() *Instruction

func (TransferChecked) GetAccounts added in v0.0.8

func (tc TransferChecked) GetAccounts() (accounts []*base.AccountMeta)

func (*TransferChecked) GetDestinationAccount added in v0.0.8

func (tc *TransferChecked) GetDestinationAccount() *base.AccountMeta

GetDestinationAccount gets the "destination" account. The destination account.

func (*TransferChecked) GetMintAccount added in v0.0.8

func (tc *TransferChecked) GetMintAccount() *base.AccountMeta

GetMintAccount gets the "mint" account. The token mint.

func (*TransferChecked) GetOwnerAccount added in v0.0.8

func (tc *TransferChecked) GetOwnerAccount() *base.AccountMeta

GetOwnerAccount gets the "owner" account. The source account's owner/delegate.

func (*TransferChecked) GetSourceAccount added in v0.0.8

func (tc *TransferChecked) GetSourceAccount() *base.AccountMeta

GetSourceAccount gets the "source" account. The source account.

func (TransferChecked) MarshalWithEncoder added in v0.0.8

func (tc TransferChecked) MarshalWithEncoder(encoder encodbin.Encoder) (err error)

func (*TransferChecked) SetAccounts added in v0.0.8

func (tc *TransferChecked) SetAccounts(accounts []*base.AccountMeta) error

func (*TransferChecked) SetAmount added in v0.0.8

func (tc *TransferChecked) SetAmount(amount uint64) *TransferChecked

SetAmount sets the "amount" parameter. The amount of tokens to transfer.

func (*TransferChecked) SetDecimals added in v0.0.8

func (tc *TransferChecked) SetDecimals(decimals uint8) *TransferChecked

SetDecimals sets the "decimals" parameter. Expected number of base 10 digits to the right of the decimal place.

func (*TransferChecked) SetDestinationAccount added in v0.0.8

func (tc *TransferChecked) SetDestinationAccount(destination common.Address) *TransferChecked

SetDestinationAccount sets the "destination" account. The destination account.

func (*TransferChecked) SetMintAccount added in v0.0.8

func (tc *TransferChecked) SetMintAccount(mint common.Address) *TransferChecked

SetMintAccount sets the "mint" account. The token mint.

func (*TransferChecked) SetOwnerAccount added in v0.0.8

func (tc *TransferChecked) SetOwnerAccount(owner common.Address, multisigSigners ...common.Address) *TransferChecked

SetOwnerAccount sets the "owner" account. The source account's owner/delegate.

func (*TransferChecked) SetSourceAccount added in v0.0.8

func (tc *TransferChecked) SetSourceAccount(source common.Address) *TransferChecked

SetSourceAccount sets the "source" account. The source account.

Jump to

Keyboard shortcuts

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