token

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: Apache-2.0 Imports: 12 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
View Source
const ProgramName = "Token"

Variables

View Source
var InstructionImplDef = ag_binary.NewVariantDefinition(
	ag_binary.Uint8TypeIDEncoding,
	[]ag_binary.VariantType{
		{
			"InitializeMint", (*InitializeMint)(nil),
		},
		{
			"InitializeAccount", (*InitializeAccount)(nil),
		},
		{
			"InitializeMultisig", (*InitializeMultisig)(nil),
		},
		{
			"Transfer", (*Transfer)(nil),
		},
		{
			"Approve", (*Approve)(nil),
		},
		{
			"Revoke", (*Revoke)(nil),
		},
		{
			"SetAuthority", (*SetAuthority)(nil),
		},
		{
			"MintTo", (*MintTo)(nil),
		},
		{
			"Burn", (*Burn)(nil),
		},
		{
			"CloseAccount", (*CloseAccount)(nil),
		},
		{
			"FreezeAccount", (*FreezeAccount)(nil),
		},
		{
			"ThawAccount", (*ThawAccount)(nil),
		},
		{
			"TransferChecked", (*TransferChecked)(nil),
		},
		{
			"ApproveChecked", (*ApproveChecked)(nil),
		},
		{
			"MintToChecked", (*MintToChecked)(nil),
		},
		{
			"BurnChecked", (*BurnChecked)(nil),
		},
		{
			"InitializeAccount2", (*InitializeAccount2)(nil),
		},
		{
			"SyncNative", (*SyncNative)(nil),
		},
		{
			"InitializeAccount3", (*InitializeAccount3)(nil),
		},
		{
			"InitializeMultisig2", (*InitializeMultisig2)(nil),
		},
		{
			"InitializeMint2", (*InitializeMint2)(nil),
		},
	},
)

Functions

func InstructionIDToName

func InstructionIDToName(id uint8) string

InstructionIDToName returns the name of the instruction given its ID.

func SetProgramID

func SetProgramID(pubkey ag_solanago.PublicKey)

Types

type Account

type Account struct {
	// The mint associated with this account
	Mint solana.PublicKey

	// The owner of this account.
	Owner solana.PublicKey

	// The amount of tokens this account holds.
	Amount uint64

	// If `delegate` is `Some` then `delegated_amount` represents
	// the amount authorized by the delegate
	Delegate *solana.PublicKey `bin:"optional"`

	// The account's state
	State AccountState

	// If is_some, this is a native token, and the value logs the rent-exempt reserve. An Account
	// is required to be rent-exempt, so the value is used by the Processor to ensure that wrapped
	// SOL accounts do not drop below this threshold.
	IsNative *uint64 `bin:"optional"`

	// The amount delegated
	DelegatedAmount uint64

	// Optional authority to close the account.
	CloseAuthority *solana.PublicKey `bin:"optional"`
}

func (Account) MarshalWithEncoder

func (mint Account) MarshalWithEncoder(encoder *bin.Encoder) (err error)

func (*Account) UnmarshalWithDecoder

func (mint *Account) UnmarshalWithDecoder(dec *bin.Decoder) (err error)

type AccountState

type AccountState ag_binary.BorshEnum
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

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 ag_solanago.AccountMetaSlice `bin:"-" borsh_skip:"true"`
	Signers  ag_solanago.AccountMetaSlice `bin:"-" borsh_skip:"true"`
}

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

func NewApproveInstruction

func NewApproveInstruction(

	amount uint64,

	source ag_solanago.PublicKey,
	delegate ag_solanago.PublicKey,
	owner ag_solanago.PublicKey,
	multisigSigners []ag_solanago.PublicKey,
) *Approve

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

func NewApproveInstructionBuilder

func NewApproveInstructionBuilder() *Approve

NewApproveInstructionBuilder creates a new `Approve` instruction builder.

func (Approve) Build

func (inst Approve) Build() *Instruction

func (*Approve) EncodeToTree

func (inst *Approve) EncodeToTree(parent ag_treeout.Branches)

func (Approve) GetAccounts

func (slice Approve) GetAccounts() (accounts []*ag_solanago.AccountMeta)

func (*Approve) GetDelegateAccount

func (inst *Approve) GetDelegateAccount() *ag_solanago.AccountMeta

GetDelegateAccount gets the "delegate" account. The delegate.

func (*Approve) GetOwnerAccount

func (inst *Approve) GetOwnerAccount() *ag_solanago.AccountMeta

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

func (*Approve) GetSourceAccount

func (inst *Approve) GetSourceAccount() *ag_solanago.AccountMeta

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

func (Approve) MarshalWithEncoder

func (obj Approve) MarshalWithEncoder(encoder *ag_binary.Encoder) (err error)

func (*Approve) SetAccounts

func (obj *Approve) SetAccounts(accounts []*ag_solanago.AccountMeta) error

func (*Approve) SetAmount

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

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

func (*Approve) SetDelegateAccount

func (inst *Approve) SetDelegateAccount(delegate ag_solanago.PublicKey) *Approve

SetDelegateAccount sets the "delegate" account. The delegate.

func (*Approve) SetOwnerAccount

func (inst *Approve) SetOwnerAccount(owner ag_solanago.PublicKey, multisigSigners ...ag_solanago.PublicKey) *Approve

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

func (*Approve) SetSourceAccount

func (inst *Approve) SetSourceAccount(source ag_solanago.PublicKey) *Approve

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

func (*Approve) UnmarshalWithDecoder

func (obj *Approve) UnmarshalWithDecoder(decoder *ag_binary.Decoder) (err error)

func (*Approve) Validate

func (inst *Approve) Validate() error

func (Approve) ValidateAndBuild

func (inst 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

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 ag_solanago.AccountMetaSlice `bin:"-" borsh_skip:"true"`
	Signers  ag_solanago.AccountMetaSlice `bin:"-" borsh_skip:"true"`
}

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.

func NewApproveCheckedInstruction

func NewApproveCheckedInstruction(

	amount uint64,
	decimals uint8,

	source ag_solanago.PublicKey,
	mint ag_solanago.PublicKey,
	delegate ag_solanago.PublicKey,
	owner ag_solanago.PublicKey,
	multisigSigners []ag_solanago.PublicKey,
) *ApproveChecked

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

func NewApproveCheckedInstructionBuilder

func NewApproveCheckedInstructionBuilder() *ApproveChecked

NewApproveCheckedInstructionBuilder creates a new `ApproveChecked` instruction builder.

func (ApproveChecked) Build

func (inst ApproveChecked) Build() *Instruction

func (*ApproveChecked) EncodeToTree

func (inst *ApproveChecked) EncodeToTree(parent ag_treeout.Branches)

func (ApproveChecked) GetAccounts

func (slice ApproveChecked) GetAccounts() (accounts []*ag_solanago.AccountMeta)

func (*ApproveChecked) GetDelegateAccount

func (inst *ApproveChecked) GetDelegateAccount() *ag_solanago.AccountMeta

GetDelegateAccount gets the "delegate" account. The delegate.

func (*ApproveChecked) GetMintAccount

func (inst *ApproveChecked) GetMintAccount() *ag_solanago.AccountMeta

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

func (*ApproveChecked) GetOwnerAccount

func (inst *ApproveChecked) GetOwnerAccount() *ag_solanago.AccountMeta

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

func (*ApproveChecked) GetSourceAccount

func (inst *ApproveChecked) GetSourceAccount() *ag_solanago.AccountMeta

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

func (ApproveChecked) MarshalWithEncoder

func (obj ApproveChecked) MarshalWithEncoder(encoder *ag_binary.Encoder) (err error)

func (*ApproveChecked) SetAccounts

func (obj *ApproveChecked) SetAccounts(accounts []*ag_solanago.AccountMeta) error

func (*ApproveChecked) SetAmount

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

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

func (*ApproveChecked) SetDecimals

func (inst *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

func (inst *ApproveChecked) SetDelegateAccount(delegate ag_solanago.PublicKey) *ApproveChecked

SetDelegateAccount sets the "delegate" account. The delegate.

func (*ApproveChecked) SetMintAccount

func (inst *ApproveChecked) SetMintAccount(mint ag_solanago.PublicKey) *ApproveChecked

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

func (*ApproveChecked) SetOwnerAccount

func (inst *ApproveChecked) SetOwnerAccount(owner ag_solanago.PublicKey, multisigSigners ...ag_solanago.PublicKey) *ApproveChecked

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

func (*ApproveChecked) SetSourceAccount

func (inst *ApproveChecked) SetSourceAccount(source ag_solanago.PublicKey) *ApproveChecked

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

func (*ApproveChecked) UnmarshalWithDecoder

func (obj *ApproveChecked) UnmarshalWithDecoder(decoder *ag_binary.Decoder) (err error)

func (*ApproveChecked) Validate

func (inst *ApproveChecked) Validate() error

func (ApproveChecked) ValidateAndBuild

func (inst 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

type AuthorityType ag_binary.BorshEnum
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

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 ag_solanago.AccountMetaSlice `bin:"-" borsh_skip:"true"`
	Signers  ag_solanago.AccountMetaSlice `bin:"-" borsh_skip:"true"`
}

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

func NewBurnInstruction

func NewBurnInstruction(

	amount uint64,

	source ag_solanago.PublicKey,
	mint ag_solanago.PublicKey,
	owner ag_solanago.PublicKey,
	multisigSigners []ag_solanago.PublicKey,
) *Burn

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

func NewBurnInstructionBuilder

func NewBurnInstructionBuilder() *Burn

NewBurnInstructionBuilder creates a new `Burn` instruction builder.

func (Burn) Build

func (inst Burn) Build() *Instruction

func (*Burn) EncodeToTree

func (inst *Burn) EncodeToTree(parent ag_treeout.Branches)

func (Burn) GetAccounts

func (slice Burn) GetAccounts() (accounts []*ag_solanago.AccountMeta)

func (*Burn) GetMintAccount

func (inst *Burn) GetMintAccount() *ag_solanago.AccountMeta

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

func (*Burn) GetOwnerAccount

func (inst *Burn) GetOwnerAccount() *ag_solanago.AccountMeta

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

func (*Burn) GetSourceAccount

func (inst *Burn) GetSourceAccount() *ag_solanago.AccountMeta

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

func (Burn) MarshalWithEncoder

func (obj Burn) MarshalWithEncoder(encoder *ag_binary.Encoder) (err error)

func (*Burn) SetAccounts

func (obj *Burn) SetAccounts(accounts []*ag_solanago.AccountMeta) error

func (*Burn) SetAmount

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

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

func (*Burn) SetMintAccount

func (inst *Burn) SetMintAccount(mint ag_solanago.PublicKey) *Burn

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

func (*Burn) SetOwnerAccount

func (inst *Burn) SetOwnerAccount(owner ag_solanago.PublicKey, multisigSigners ...ag_solanago.PublicKey) *Burn

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

func (*Burn) SetSourceAccount

func (inst *Burn) SetSourceAccount(source ag_solanago.PublicKey) *Burn

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

func (*Burn) UnmarshalWithDecoder

func (obj *Burn) UnmarshalWithDecoder(decoder *ag_binary.Decoder) (err error)

func (*Burn) Validate

func (inst *Burn) Validate() error

func (Burn) ValidateAndBuild

func (inst 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

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 ag_solanago.AccountMetaSlice `bin:"-" borsh_skip:"true"`
	Signers  ag_solanago.AccountMetaSlice `bin:"-" borsh_skip:"true"`
}

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

func NewBurnCheckedInstruction(

	amount uint64,
	decimals uint8,

	source ag_solanago.PublicKey,
	mint ag_solanago.PublicKey,
	owner ag_solanago.PublicKey,
	multisigSigners []ag_solanago.PublicKey,
) *BurnChecked

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

func NewBurnCheckedInstructionBuilder

func NewBurnCheckedInstructionBuilder() *BurnChecked

NewBurnCheckedInstructionBuilder creates a new `BurnChecked` instruction builder.

func (BurnChecked) Build

func (inst BurnChecked) Build() *Instruction

func (*BurnChecked) EncodeToTree

func (inst *BurnChecked) EncodeToTree(parent ag_treeout.Branches)

func (BurnChecked) GetAccounts

func (slice BurnChecked) GetAccounts() (accounts []*ag_solanago.AccountMeta)

func (*BurnChecked) GetMintAccount

func (inst *BurnChecked) GetMintAccount() *ag_solanago.AccountMeta

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

func (*BurnChecked) GetOwnerAccount

func (inst *BurnChecked) GetOwnerAccount() *ag_solanago.AccountMeta

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

func (*BurnChecked) GetSourceAccount

func (inst *BurnChecked) GetSourceAccount() *ag_solanago.AccountMeta

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

func (BurnChecked) MarshalWithEncoder

func (obj BurnChecked) MarshalWithEncoder(encoder *ag_binary.Encoder) (err error)

func (*BurnChecked) SetAccounts

func (obj *BurnChecked) SetAccounts(accounts []*ag_solanago.AccountMeta) error

func (*BurnChecked) SetAmount

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

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

func (*BurnChecked) SetDecimals

func (inst *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

func (inst *BurnChecked) SetMintAccount(mint ag_solanago.PublicKey) *BurnChecked

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

func (*BurnChecked) SetOwnerAccount

func (inst *BurnChecked) SetOwnerAccount(owner ag_solanago.PublicKey, multisigSigners ...ag_solanago.PublicKey) *BurnChecked

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

func (*BurnChecked) SetSourceAccount

func (inst *BurnChecked) SetSourceAccount(source ag_solanago.PublicKey) *BurnChecked

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

func (*BurnChecked) UnmarshalWithDecoder

func (obj *BurnChecked) UnmarshalWithDecoder(decoder *ag_binary.Decoder) (err error)

func (*BurnChecked) Validate

func (inst *BurnChecked) Validate() error

func (BurnChecked) ValidateAndBuild

func (inst 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

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 ag_solanago.AccountMetaSlice `bin:"-" borsh_skip:"true"`
	Signers  ag_solanago.AccountMetaSlice `bin:"-" borsh_skip:"true"`
}

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

func NewCloseAccountInstruction(

	account ag_solanago.PublicKey,
	destination ag_solanago.PublicKey,
	owner ag_solanago.PublicKey,
	multisigSigners []ag_solanago.PublicKey,
) *CloseAccount

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

func NewCloseAccountInstructionBuilder

func NewCloseAccountInstructionBuilder() *CloseAccount

NewCloseAccountInstructionBuilder creates a new `CloseAccount` instruction builder.

func (CloseAccount) Build

func (inst CloseAccount) Build() *Instruction

func (*CloseAccount) EncodeToTree

func (inst *CloseAccount) EncodeToTree(parent ag_treeout.Branches)

func (*CloseAccount) GetAccount

func (inst *CloseAccount) GetAccount() *ag_solanago.AccountMeta

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

func (CloseAccount) GetAccounts

func (slice CloseAccount) GetAccounts() (accounts []*ag_solanago.AccountMeta)

func (*CloseAccount) GetDestinationAccount

func (inst *CloseAccount) GetDestinationAccount() *ag_solanago.AccountMeta

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

func (*CloseAccount) GetOwnerAccount

func (inst *CloseAccount) GetOwnerAccount() *ag_solanago.AccountMeta

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

func (CloseAccount) MarshalWithEncoder

func (obj CloseAccount) MarshalWithEncoder(encoder *ag_binary.Encoder) (err error)

func (*CloseAccount) SetAccount

func (inst *CloseAccount) SetAccount(account ag_solanago.PublicKey) *CloseAccount

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

func (*CloseAccount) SetAccounts

func (obj *CloseAccount) SetAccounts(accounts []*ag_solanago.AccountMeta) error

func (*CloseAccount) SetDestinationAccount

func (inst *CloseAccount) SetDestinationAccount(destination ag_solanago.PublicKey) *CloseAccount

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

func (*CloseAccount) SetOwnerAccount

func (inst *CloseAccount) SetOwnerAccount(owner ag_solanago.PublicKey, multisigSigners ...ag_solanago.PublicKey) *CloseAccount

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

func (*CloseAccount) UnmarshalWithDecoder

func (obj *CloseAccount) UnmarshalWithDecoder(decoder *ag_binary.Decoder) (err error)

func (*CloseAccount) Validate

func (inst *CloseAccount) Validate() error

func (CloseAccount) ValidateAndBuild

func (inst 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 FreezeAccount

type FreezeAccount struct {

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

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

func NewFreezeAccountInstruction

func NewFreezeAccountInstruction(

	account ag_solanago.PublicKey,
	mint ag_solanago.PublicKey,
	authority ag_solanago.PublicKey,
	multisigSigners []ag_solanago.PublicKey,
) *FreezeAccount

NewFreezeAccountInstruction declares a new FreezeAccount instruction with the provided parameters and accounts.

func NewFreezeAccountInstructionBuilder

func NewFreezeAccountInstructionBuilder() *FreezeAccount

NewFreezeAccountInstructionBuilder creates a new `FreezeAccount` instruction builder.

func (FreezeAccount) Build

func (inst FreezeAccount) Build() *Instruction

func (*FreezeAccount) EncodeToTree

func (inst *FreezeAccount) EncodeToTree(parent ag_treeout.Branches)

func (*FreezeAccount) GetAccount

func (inst *FreezeAccount) GetAccount() *ag_solanago.AccountMeta

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

func (FreezeAccount) GetAccounts

func (slice FreezeAccount) GetAccounts() (accounts []*ag_solanago.AccountMeta)

func (*FreezeAccount) GetAuthorityAccount

func (inst *FreezeAccount) GetAuthorityAccount() *ag_solanago.AccountMeta

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

func (*FreezeAccount) GetMintAccount

func (inst *FreezeAccount) GetMintAccount() *ag_solanago.AccountMeta

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

func (FreezeAccount) MarshalWithEncoder

func (obj FreezeAccount) MarshalWithEncoder(encoder *ag_binary.Encoder) (err error)

func (*FreezeAccount) SetAccount

func (inst *FreezeAccount) SetAccount(account ag_solanago.PublicKey) *FreezeAccount

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

func (*FreezeAccount) SetAccounts

func (obj *FreezeAccount) SetAccounts(accounts []*ag_solanago.AccountMeta) error

func (*FreezeAccount) SetAuthorityAccount

func (inst *FreezeAccount) SetAuthorityAccount(authority ag_solanago.PublicKey, multisigSigners ...ag_solanago.PublicKey) *FreezeAccount

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

func (*FreezeAccount) SetMintAccount

func (inst *FreezeAccount) SetMintAccount(mint ag_solanago.PublicKey) *FreezeAccount

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

func (*FreezeAccount) UnmarshalWithDecoder

func (obj *FreezeAccount) UnmarshalWithDecoder(decoder *ag_binary.Decoder) (err error)

func (*FreezeAccount) Validate

func (inst *FreezeAccount) Validate() error

func (FreezeAccount) ValidateAndBuild

func (inst FreezeAccount) 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

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.
	ag_solanago.AccountMetaSlice `bin:"-" borsh_skip:"true"`
}

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

func NewInitializeAccountInstruction(

	account ag_solanago.PublicKey,
	mint ag_solanago.PublicKey,
	owner ag_solanago.PublicKey,
	SysVarRentPubkey ag_solanago.PublicKey) *InitializeAccount

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

func NewInitializeAccountInstructionBuilder

func NewInitializeAccountInstructionBuilder() *InitializeAccount

NewInitializeAccountInstructionBuilder creates a new `InitializeAccount` instruction builder.

func (InitializeAccount) Build

func (inst InitializeAccount) Build() *Instruction

func (*InitializeAccount) EncodeToTree

func (inst *InitializeAccount) EncodeToTree(parent ag_treeout.Branches)

func (*InitializeAccount) GetAccount

func (inst *InitializeAccount) GetAccount() *ag_solanago.AccountMeta

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

func (*InitializeAccount) GetMintAccount

func (inst *InitializeAccount) GetMintAccount() *ag_solanago.AccountMeta

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

func (*InitializeAccount) GetOwnerAccount

func (inst *InitializeAccount) GetOwnerAccount() *ag_solanago.AccountMeta

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

func (*InitializeAccount) GetSysVarRentPubkeyAccount

func (inst *InitializeAccount) GetSysVarRentPubkeyAccount() *ag_solanago.AccountMeta

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

func (InitializeAccount) MarshalWithEncoder

func (obj InitializeAccount) MarshalWithEncoder(encoder *ag_binary.Encoder) (err error)

func (*InitializeAccount) SetAccount

func (inst *InitializeAccount) SetAccount(account ag_solanago.PublicKey) *InitializeAccount

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

func (*InitializeAccount) SetMintAccount

func (inst *InitializeAccount) SetMintAccount(mint ag_solanago.PublicKey) *InitializeAccount

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

func (*InitializeAccount) SetOwnerAccount

func (inst *InitializeAccount) SetOwnerAccount(owner ag_solanago.PublicKey) *InitializeAccount

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

func (*InitializeAccount) SetSysVarRentPubkeyAccount

func (inst *InitializeAccount) SetSysVarRentPubkeyAccount(SysVarRentPubkey ag_solanago.PublicKey) *InitializeAccount

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

func (*InitializeAccount) UnmarshalWithDecoder

func (obj *InitializeAccount) UnmarshalWithDecoder(decoder *ag_binary.Decoder) (err error)

func (*InitializeAccount) Validate

func (inst *InitializeAccount) Validate() error

func (InitializeAccount) ValidateAndBuild

func (inst 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

type InitializeAccount2 struct {
	// The new account's owner/multisignature.
	Owner *ag_solanago.PublicKey

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

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

func NewInitializeAccount2Instruction(

	owner ag_solanago.PublicKey,

	account ag_solanago.PublicKey,
	mint ag_solanago.PublicKey,
	SysVarRentPubkey ag_solanago.PublicKey) *InitializeAccount2

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

func NewInitializeAccount2InstructionBuilder

func NewInitializeAccount2InstructionBuilder() *InitializeAccount2

NewInitializeAccount2InstructionBuilder creates a new `InitializeAccount2` instruction builder.

func (InitializeAccount2) Build

func (inst InitializeAccount2) Build() *Instruction

func (*InitializeAccount2) EncodeToTree

func (inst *InitializeAccount2) EncodeToTree(parent ag_treeout.Branches)

func (*InitializeAccount2) GetAccount

func (inst *InitializeAccount2) GetAccount() *ag_solanago.AccountMeta

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

func (*InitializeAccount2) GetMintAccount

func (inst *InitializeAccount2) GetMintAccount() *ag_solanago.AccountMeta

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

func (*InitializeAccount2) GetSysVarRentPubkeyAccount

func (inst *InitializeAccount2) GetSysVarRentPubkeyAccount() *ag_solanago.AccountMeta

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

func (InitializeAccount2) MarshalWithEncoder

func (obj InitializeAccount2) MarshalWithEncoder(encoder *ag_binary.Encoder) (err error)

func (*InitializeAccount2) SetAccount

func (inst *InitializeAccount2) SetAccount(account ag_solanago.PublicKey) *InitializeAccount2

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

func (*InitializeAccount2) SetMintAccount

func (inst *InitializeAccount2) SetMintAccount(mint ag_solanago.PublicKey) *InitializeAccount2

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

func (*InitializeAccount2) SetOwner

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

func (*InitializeAccount2) SetSysVarRentPubkeyAccount

func (inst *InitializeAccount2) SetSysVarRentPubkeyAccount(SysVarRentPubkey ag_solanago.PublicKey) *InitializeAccount2

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

func (*InitializeAccount2) UnmarshalWithDecoder

func (obj *InitializeAccount2) UnmarshalWithDecoder(decoder *ag_binary.Decoder) (err error)

func (*InitializeAccount2) Validate

func (inst *InitializeAccount2) Validate() error

func (InitializeAccount2) ValidateAndBuild

func (inst 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

type InitializeAccount3 struct {
	// The new account's owner/multisignature.
	Owner *ag_solanago.PublicKey

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

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

func NewInitializeAccount3Instruction

func NewInitializeAccount3Instruction(

	owner ag_solanago.PublicKey,

	account ag_solanago.PublicKey,
	mint ag_solanago.PublicKey) *InitializeAccount3

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

func NewInitializeAccount3InstructionBuilder

func NewInitializeAccount3InstructionBuilder() *InitializeAccount3

NewInitializeAccount3InstructionBuilder creates a new `InitializeAccount3` instruction builder.

func (InitializeAccount3) Build

func (inst InitializeAccount3) Build() *Instruction

func (*InitializeAccount3) EncodeToTree

func (inst *InitializeAccount3) EncodeToTree(parent ag_treeout.Branches)

func (*InitializeAccount3) GetAccount

func (inst *InitializeAccount3) GetAccount() *ag_solanago.AccountMeta

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

func (*InitializeAccount3) GetMintAccount

func (inst *InitializeAccount3) GetMintAccount() *ag_solanago.AccountMeta

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

func (InitializeAccount3) MarshalWithEncoder

func (obj InitializeAccount3) MarshalWithEncoder(encoder *ag_binary.Encoder) (err error)

func (*InitializeAccount3) SetAccount

func (inst *InitializeAccount3) SetAccount(account ag_solanago.PublicKey) *InitializeAccount3

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

func (*InitializeAccount3) SetMintAccount

func (inst *InitializeAccount3) SetMintAccount(mint ag_solanago.PublicKey) *InitializeAccount3

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

func (*InitializeAccount3) SetOwner

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

func (*InitializeAccount3) UnmarshalWithDecoder

func (obj *InitializeAccount3) UnmarshalWithDecoder(decoder *ag_binary.Decoder) (err error)

func (*InitializeAccount3) Validate

func (inst *InitializeAccount3) Validate() error

func (InitializeAccount3) ValidateAndBuild

func (inst 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

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

	// The authority/multisignature to mint tokens.
	MintAuthority *ag_solanago.PublicKey

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

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

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

func NewInitializeMintInstruction(

	decimals uint8,
	mint_authority ag_solanago.PublicKey,
	freeze_authority ag_solanago.PublicKey,

	mint ag_solanago.PublicKey,
	SysVarRentPubkey ag_solanago.PublicKey) *InitializeMint

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

func NewInitializeMintInstructionBuilder

func NewInitializeMintInstructionBuilder() *InitializeMint

NewInitializeMintInstructionBuilder creates a new `InitializeMint` instruction builder.

func (InitializeMint) Build

func (inst InitializeMint) Build() *Instruction

func (*InitializeMint) EncodeToTree

func (inst *InitializeMint) EncodeToTree(parent ag_treeout.Branches)

func (*InitializeMint) GetMintAccount

func (inst *InitializeMint) GetMintAccount() *ag_solanago.AccountMeta

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

func (*InitializeMint) GetSysVarRentPubkeyAccount

func (inst *InitializeMint) GetSysVarRentPubkeyAccount() *ag_solanago.AccountMeta

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

func (InitializeMint) MarshalWithEncoder

func (obj InitializeMint) MarshalWithEncoder(encoder *ag_binary.Encoder) (err error)

func (*InitializeMint) SetDecimals

func (inst *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

func (inst *InitializeMint) SetFreezeAuthority(freeze_authority ag_solanago.PublicKey) *InitializeMint

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

func (*InitializeMint) SetMintAccount

func (inst *InitializeMint) SetMintAccount(mint ag_solanago.PublicKey) *InitializeMint

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

func (*InitializeMint) SetMintAuthority

func (inst *InitializeMint) SetMintAuthority(mint_authority ag_solanago.PublicKey) *InitializeMint

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

func (*InitializeMint) SetSysVarRentPubkeyAccount

func (inst *InitializeMint) SetSysVarRentPubkeyAccount(SysVarRentPubkey ag_solanago.PublicKey) *InitializeMint

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

func (*InitializeMint) UnmarshalWithDecoder

func (obj *InitializeMint) UnmarshalWithDecoder(decoder *ag_binary.Decoder) (err error)

func (*InitializeMint) Validate

func (inst *InitializeMint) Validate() error

func (InitializeMint) ValidateAndBuild

func (inst 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

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

	// The authority/multisignature to mint tokens.
	MintAuthority *ag_solanago.PublicKey

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

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

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

func NewInitializeMint2Instruction

func NewInitializeMint2Instruction(

	decimals uint8,
	mint_authority ag_solanago.PublicKey,
	freeze_authority ag_solanago.PublicKey,

	mint ag_solanago.PublicKey) *InitializeMint2

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

func NewInitializeMint2InstructionBuilder

func NewInitializeMint2InstructionBuilder() *InitializeMint2

NewInitializeMint2InstructionBuilder creates a new `InitializeMint2` instruction builder.

func (InitializeMint2) Build

func (inst InitializeMint2) Build() *Instruction

func (*InitializeMint2) EncodeToTree

func (inst *InitializeMint2) EncodeToTree(parent ag_treeout.Branches)

func (*InitializeMint2) GetMintAccount

func (inst *InitializeMint2) GetMintAccount() *ag_solanago.AccountMeta

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

func (InitializeMint2) MarshalWithEncoder

func (obj InitializeMint2) MarshalWithEncoder(encoder *ag_binary.Encoder) (err error)

func (*InitializeMint2) SetDecimals

func (inst *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

func (inst *InitializeMint2) SetFreezeAuthority(freeze_authority ag_solanago.PublicKey) *InitializeMint2

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

func (*InitializeMint2) SetMintAccount

func (inst *InitializeMint2) SetMintAccount(mint ag_solanago.PublicKey) *InitializeMint2

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

func (*InitializeMint2) SetMintAuthority

func (inst *InitializeMint2) SetMintAuthority(mint_authority ag_solanago.PublicKey) *InitializeMint2

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

func (*InitializeMint2) UnmarshalWithDecoder

func (obj *InitializeMint2) UnmarshalWithDecoder(decoder *ag_binary.Decoder) (err error)

func (*InitializeMint2) Validate

func (inst *InitializeMint2) Validate() error

func (InitializeMint2) ValidateAndBuild

func (inst 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

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 ag_solanago.AccountMetaSlice `bin:"-" borsh_skip:"true"`
	Signers  ag_solanago.AccountMetaSlice `bin:"-" borsh_skip:"true"`
}

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

func NewInitializeMultisigInstruction(

	m uint8,

	account ag_solanago.PublicKey,
	SysVarRentPubkey ag_solanago.PublicKey,
	signers []ag_solanago.PublicKey,
) *InitializeMultisig

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

func NewInitializeMultisigInstructionBuilder

func NewInitializeMultisigInstructionBuilder() *InitializeMultisig

NewInitializeMultisigInstructionBuilder creates a new `InitializeMultisig` instruction builder.

func (*InitializeMultisig) AddSigners

func (inst *InitializeMultisig) AddSigners(signers ...ag_solanago.PublicKey) *InitializeMultisig

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

func (InitializeMultisig) Build

func (inst InitializeMultisig) Build() *Instruction

func (*InitializeMultisig) EncodeToTree

func (inst *InitializeMultisig) EncodeToTree(parent ag_treeout.Branches)

func (*InitializeMultisig) GetAccount

func (inst *InitializeMultisig) GetAccount() *ag_solanago.AccountMeta

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

func (InitializeMultisig) GetAccounts

func (slice InitializeMultisig) GetAccounts() (accounts []*ag_solanago.AccountMeta)

func (*InitializeMultisig) GetSysVarRentPubkeyAccount

func (inst *InitializeMultisig) GetSysVarRentPubkeyAccount() *ag_solanago.AccountMeta

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

func (InitializeMultisig) MarshalWithEncoder

func (obj InitializeMultisig) MarshalWithEncoder(encoder *ag_binary.Encoder) (err error)

func (*InitializeMultisig) SetAccount

func (inst *InitializeMultisig) SetAccount(account ag_solanago.PublicKey) *InitializeMultisig

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

func (*InitializeMultisig) SetAccounts

func (obj *InitializeMultisig) SetAccounts(accounts []*ag_solanago.AccountMeta) error

func (*InitializeMultisig) SetM

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

func (*InitializeMultisig) SetSysVarRentPubkeyAccount

func (inst *InitializeMultisig) SetSysVarRentPubkeyAccount(SysVarRentPubkey ag_solanago.PublicKey) *InitializeMultisig

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

func (*InitializeMultisig) UnmarshalWithDecoder

func (obj *InitializeMultisig) UnmarshalWithDecoder(decoder *ag_binary.Decoder) (err error)

func (*InitializeMultisig) Validate

func (inst *InitializeMultisig) Validate() error

func (InitializeMultisig) ValidateAndBuild

func (inst 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

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 ag_solanago.AccountMetaSlice `bin:"-" borsh_skip:"true"`
	Signers  ag_solanago.AccountMetaSlice `bin:"-" borsh_skip:"true"`
}

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

func NewInitializeMultisig2Instruction

func NewInitializeMultisig2Instruction(

	m uint8,

	account ag_solanago.PublicKey,
	signers []ag_solanago.PublicKey,
) *InitializeMultisig2

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

func NewInitializeMultisig2InstructionBuilder

func NewInitializeMultisig2InstructionBuilder() *InitializeMultisig2

NewInitializeMultisig2InstructionBuilder creates a new `InitializeMultisig2` instruction builder.

func (*InitializeMultisig2) AddSigners

func (inst *InitializeMultisig2) AddSigners(signers ...ag_solanago.PublicKey) *InitializeMultisig2

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

func (InitializeMultisig2) Build

func (inst InitializeMultisig2) Build() *Instruction

func (*InitializeMultisig2) EncodeToTree

func (inst *InitializeMultisig2) EncodeToTree(parent ag_treeout.Branches)

func (*InitializeMultisig2) GetAccount

func (inst *InitializeMultisig2) GetAccount() *ag_solanago.AccountMeta

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

func (InitializeMultisig2) GetAccounts

func (slice InitializeMultisig2) GetAccounts() (accounts []*ag_solanago.AccountMeta)

func (InitializeMultisig2) MarshalWithEncoder

func (obj InitializeMultisig2) MarshalWithEncoder(encoder *ag_binary.Encoder) (err error)

func (*InitializeMultisig2) SetAccount

func (inst *InitializeMultisig2) SetAccount(account ag_solanago.PublicKey) *InitializeMultisig2

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

func (*InitializeMultisig2) SetAccounts

func (obj *InitializeMultisig2) SetAccounts(accounts []*ag_solanago.AccountMeta) error

func (*InitializeMultisig2) SetM

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

func (*InitializeMultisig2) UnmarshalWithDecoder

func (obj *InitializeMultisig2) UnmarshalWithDecoder(decoder *ag_binary.Decoder) (err error)

func (*InitializeMultisig2) Validate

func (inst *InitializeMultisig2) Validate() error

func (InitializeMultisig2) ValidateAndBuild

func (inst 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 {
	ag_binary.BaseVariant
}

func DecodeInstruction

func DecodeInstruction(accounts []*ag_solanago.AccountMeta, data []byte) (*Instruction, error)

func (*Instruction) Accounts

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

func (*Instruction) Data

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

func (*Instruction) EncodeToTree

func (inst *Instruction) EncodeToTree(parent ag_treeout.Branches)

func (Instruction) MarshalWithEncoder

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

func (*Instruction) ProgramID

func (inst *Instruction) ProgramID() ag_solanago.PublicKey

func (*Instruction) TextEncode

func (inst *Instruction) TextEncode(encoder *ag_text.Encoder, option *ag_text.Option) error

func (*Instruction) UnmarshalWithDecoder

func (inst *Instruction) UnmarshalWithDecoder(decoder *ag_binary.Decoder) error

type Mint

type Mint struct {
	// Optional authority used to mint new tokens. The mint authority may only be provided during
	// mint creation. If no mint authority is present then the mint has a fixed supply and no
	// further tokens may be minted.
	MintAuthority *solana.PublicKey `bin:"optional"`

	// Total supply of tokens.
	Supply uint64

	// Number of base 10 digits to the right of the decimal place.
	Decimals uint8

	// Is `true` if this structure has been initialized
	IsInitialized bool

	// Optional authority to freeze token accounts.
	FreezeAuthority *solana.PublicKey `bin:"optional"`
}

func FetchMints

func FetchMints(rpcCli *rpc.Client) (out []*Mint, err error)

func (*Mint) Decode

func (mint *Mint) Decode(data []byte) error

func (Mint) MarshalWithEncoder

func (mint Mint) MarshalWithEncoder(encoder *bin.Encoder) (err error)

func (*Mint) UnmarshalWithDecoder

func (mint *Mint) UnmarshalWithDecoder(dec *bin.Decoder) (err error)

type MintTo

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 ag_solanago.AccountMetaSlice `bin:"-" borsh_skip:"true"`
	Signers  ag_solanago.AccountMetaSlice `bin:"-" borsh_skip:"true"`
}

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

func NewMintToInstruction

func NewMintToInstruction(

	amount uint64,

	mint ag_solanago.PublicKey,
	destination ag_solanago.PublicKey,
	authority ag_solanago.PublicKey,
	multisigSigners []ag_solanago.PublicKey,
) *MintTo

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

func NewMintToInstructionBuilder

func NewMintToInstructionBuilder() *MintTo

NewMintToInstructionBuilder creates a new `MintTo` instruction builder.

func (MintTo) Build

func (inst MintTo) Build() *Instruction

func (*MintTo) EncodeToTree

func (inst *MintTo) EncodeToTree(parent ag_treeout.Branches)

func (MintTo) GetAccounts

func (slice MintTo) GetAccounts() (accounts []*ag_solanago.AccountMeta)

func (*MintTo) GetAuthorityAccount

func (inst *MintTo) GetAuthorityAccount() *ag_solanago.AccountMeta

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

func (*MintTo) GetDestinationAccount

func (inst *MintTo) GetDestinationAccount() *ag_solanago.AccountMeta

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

func (*MintTo) GetMintAccount

func (inst *MintTo) GetMintAccount() *ag_solanago.AccountMeta

GetMintAccount gets the "mint" account. The mint.

func (MintTo) MarshalWithEncoder

func (obj MintTo) MarshalWithEncoder(encoder *ag_binary.Encoder) (err error)

func (*MintTo) SetAccounts

func (obj *MintTo) SetAccounts(accounts []*ag_solanago.AccountMeta) error

func (*MintTo) SetAmount

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

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

func (*MintTo) SetAuthorityAccount

func (inst *MintTo) SetAuthorityAccount(authority ag_solanago.PublicKey, multisigSigners ...ag_solanago.PublicKey) *MintTo

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

func (*MintTo) SetDestinationAccount

func (inst *MintTo) SetDestinationAccount(destination ag_solanago.PublicKey) *MintTo

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

func (*MintTo) SetMintAccount

func (inst *MintTo) SetMintAccount(mint ag_solanago.PublicKey) *MintTo

SetMintAccount sets the "mint" account. The mint.

func (*MintTo) UnmarshalWithDecoder

func (obj *MintTo) UnmarshalWithDecoder(decoder *ag_binary.Decoder) (err error)

func (*MintTo) Validate

func (inst *MintTo) Validate() error

func (MintTo) ValidateAndBuild

func (inst 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

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 ag_solanago.AccountMetaSlice `bin:"-" borsh_skip:"true"`
	Signers  ag_solanago.AccountMetaSlice `bin:"-" borsh_skip:"true"`
}

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

func NewMintToCheckedInstruction(

	amount uint64,
	decimals uint8,

	mint ag_solanago.PublicKey,
	destination ag_solanago.PublicKey,
	authority ag_solanago.PublicKey,
	multisigSigners []ag_solanago.PublicKey,
) *MintToChecked

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

func NewMintToCheckedInstructionBuilder

func NewMintToCheckedInstructionBuilder() *MintToChecked

NewMintToCheckedInstructionBuilder creates a new `MintToChecked` instruction builder.

func (MintToChecked) Build

func (inst MintToChecked) Build() *Instruction

func (*MintToChecked) EncodeToTree

func (inst *MintToChecked) EncodeToTree(parent ag_treeout.Branches)

func (MintToChecked) GetAccounts

func (slice MintToChecked) GetAccounts() (accounts []*ag_solanago.AccountMeta)

func (*MintToChecked) GetAuthorityAccount

func (inst *MintToChecked) GetAuthorityAccount() *ag_solanago.AccountMeta

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

func (*MintToChecked) GetDestinationAccount

func (inst *MintToChecked) GetDestinationAccount() *ag_solanago.AccountMeta

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

func (*MintToChecked) GetMintAccount

func (inst *MintToChecked) GetMintAccount() *ag_solanago.AccountMeta

GetMintAccount gets the "mint" account. The mint.

func (MintToChecked) MarshalWithEncoder

func (obj MintToChecked) MarshalWithEncoder(encoder *ag_binary.Encoder) (err error)

func (*MintToChecked) SetAccounts

func (obj *MintToChecked) SetAccounts(accounts []*ag_solanago.AccountMeta) error

func (*MintToChecked) SetAmount

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

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

func (*MintToChecked) SetAuthorityAccount

func (inst *MintToChecked) SetAuthorityAccount(authority ag_solanago.PublicKey, multisigSigners ...ag_solanago.PublicKey) *MintToChecked

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

func (*MintToChecked) SetDecimals

func (inst *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

func (inst *MintToChecked) SetDestinationAccount(destination ag_solanago.PublicKey) *MintToChecked

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

func (*MintToChecked) SetMintAccount

func (inst *MintToChecked) SetMintAccount(mint ag_solanago.PublicKey) *MintToChecked

SetMintAccount sets the "mint" account. The mint.

func (*MintToChecked) UnmarshalWithDecoder

func (obj *MintToChecked) UnmarshalWithDecoder(decoder *ag_binary.Decoder) (err error)

func (*MintToChecked) Validate

func (inst *MintToChecked) Validate() error

func (MintToChecked) ValidateAndBuild

func (inst 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 Multisig

type Multisig struct {
	// Number of signers required
	M uint8
	// Number of valid signers
	N uint8
	// Is `true` if this structure has been initialized
	IsInitialized bool
	// Signer public keys
	Signers [MAX_SIGNERS]solana.PublicKey
}

type Revoke

type Revoke struct {

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

Revokes the delegate's authority.

func NewRevokeInstruction

func NewRevokeInstruction(

	source ag_solanago.PublicKey,
	owner ag_solanago.PublicKey,
	multisigSigners []ag_solanago.PublicKey,
) *Revoke

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

func NewRevokeInstructionBuilder

func NewRevokeInstructionBuilder() *Revoke

NewRevokeInstructionBuilder creates a new `Revoke` instruction builder.

func (Revoke) Build

func (inst Revoke) Build() *Instruction

func (*Revoke) EncodeToTree

func (inst *Revoke) EncodeToTree(parent ag_treeout.Branches)

func (Revoke) GetAccounts

func (slice Revoke) GetAccounts() (accounts []*ag_solanago.AccountMeta)

func (*Revoke) GetOwnerAccount

func (inst *Revoke) GetOwnerAccount() *ag_solanago.AccountMeta

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

func (*Revoke) GetSourceAccount

func (inst *Revoke) GetSourceAccount() *ag_solanago.AccountMeta

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

func (Revoke) MarshalWithEncoder

func (obj Revoke) MarshalWithEncoder(encoder *ag_binary.Encoder) (err error)

func (*Revoke) SetAccounts

func (obj *Revoke) SetAccounts(accounts []*ag_solanago.AccountMeta) error

func (*Revoke) SetOwnerAccount

func (inst *Revoke) SetOwnerAccount(owner ag_solanago.PublicKey, multisigSigners ...ag_solanago.PublicKey) *Revoke

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

func (*Revoke) SetSourceAccount

func (inst *Revoke) SetSourceAccount(source ag_solanago.PublicKey) *Revoke

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

func (*Revoke) UnmarshalWithDecoder

func (obj *Revoke) UnmarshalWithDecoder(decoder *ag_binary.Decoder) (err error)

func (*Revoke) Validate

func (inst *Revoke) Validate() error

func (Revoke) ValidateAndBuild

func (inst 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

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

	// The new authority.
	NewAuthority *ag_solanago.PublicKey `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 ag_solanago.AccountMetaSlice `bin:"-" borsh_skip:"true"`
	Signers  ag_solanago.AccountMetaSlice `bin:"-" borsh_skip:"true"`
}

Sets a new authority of a mint or account.

func NewSetAuthorityInstruction

func NewSetAuthorityInstruction(

	authority_type AuthorityType,
	new_authority ag_solanago.PublicKey,

	subject ag_solanago.PublicKey,
	authority ag_solanago.PublicKey,
	multisigSigners []ag_solanago.PublicKey,
) *SetAuthority

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

func NewSetAuthorityInstructionBuilder

func NewSetAuthorityInstructionBuilder() *SetAuthority

NewSetAuthorityInstructionBuilder creates a new `SetAuthority` instruction builder.

func (SetAuthority) Build

func (inst SetAuthority) Build() *Instruction

func (*SetAuthority) EncodeToTree

func (inst *SetAuthority) EncodeToTree(parent ag_treeout.Branches)

func (SetAuthority) GetAccounts

func (slice SetAuthority) GetAccounts() (accounts []*ag_solanago.AccountMeta)

func (*SetAuthority) GetAuthorityAccount

func (inst *SetAuthority) GetAuthorityAccount() *ag_solanago.AccountMeta

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

func (*SetAuthority) GetSubjectAccount

func (inst *SetAuthority) GetSubjectAccount() *ag_solanago.AccountMeta

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

func (SetAuthority) MarshalWithEncoder

func (obj SetAuthority) MarshalWithEncoder(encoder *ag_binary.Encoder) (err error)

func (*SetAuthority) SetAccounts

func (obj *SetAuthority) SetAccounts(accounts []*ag_solanago.AccountMeta) error

func (*SetAuthority) SetAuthorityAccount

func (inst *SetAuthority) SetAuthorityAccount(authority ag_solanago.PublicKey, multisigSigners ...ag_solanago.PublicKey) *SetAuthority

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

func (*SetAuthority) SetAuthorityType

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

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

func (*SetAuthority) SetNewAuthority

func (inst *SetAuthority) SetNewAuthority(new_authority ag_solanago.PublicKey) *SetAuthority

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

func (*SetAuthority) SetSubjectAccount

func (inst *SetAuthority) SetSubjectAccount(subject ag_solanago.PublicKey) *SetAuthority

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

func (*SetAuthority) UnmarshalWithDecoder

func (obj *SetAuthority) UnmarshalWithDecoder(decoder *ag_binary.Decoder) (err error)

func (*SetAuthority) Validate

func (inst *SetAuthority) Validate() error

func (SetAuthority) ValidateAndBuild

func (inst 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

type SyncNative struct {

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

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

func NewSyncNativeInstruction(

	tokenAccount ag_solanago.PublicKey) *SyncNative

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

func NewSyncNativeInstructionBuilder

func NewSyncNativeInstructionBuilder() *SyncNative

NewSyncNativeInstructionBuilder creates a new `SyncNative` instruction builder.

func (SyncNative) Build

func (inst SyncNative) Build() *Instruction

func (*SyncNative) EncodeToTree

func (inst *SyncNative) EncodeToTree(parent ag_treeout.Branches)

func (*SyncNative) GetTokenAccount

func (inst *SyncNative) GetTokenAccount() *ag_solanago.AccountMeta

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

func (SyncNative) MarshalWithEncoder

func (obj SyncNative) MarshalWithEncoder(encoder *ag_binary.Encoder) (err error)

func (*SyncNative) SetTokenAccount

func (inst *SyncNative) SetTokenAccount(tokenAccount ag_solanago.PublicKey) *SyncNative

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

func (*SyncNative) UnmarshalWithDecoder

func (obj *SyncNative) UnmarshalWithDecoder(decoder *ag_binary.Decoder) (err error)

func (*SyncNative) Validate

func (inst *SyncNative) Validate() error

func (SyncNative) ValidateAndBuild

func (inst 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

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 ag_solanago.AccountMetaSlice `bin:"-" borsh_skip:"true"`
	Signers  ag_solanago.AccountMetaSlice `bin:"-" borsh_skip:"true"`
}

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

func NewThawAccountInstruction

func NewThawAccountInstruction(

	account ag_solanago.PublicKey,
	mint ag_solanago.PublicKey,
	authority ag_solanago.PublicKey,
	multisigSigners []ag_solanago.PublicKey,
) *ThawAccount

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

func NewThawAccountInstructionBuilder

func NewThawAccountInstructionBuilder() *ThawAccount

NewThawAccountInstructionBuilder creates a new `ThawAccount` instruction builder.

func (ThawAccount) Build

func (inst ThawAccount) Build() *Instruction

func (*ThawAccount) EncodeToTree

func (inst *ThawAccount) EncodeToTree(parent ag_treeout.Branches)

func (*ThawAccount) GetAccount

func (inst *ThawAccount) GetAccount() *ag_solanago.AccountMeta

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

func (ThawAccount) GetAccounts

func (slice ThawAccount) GetAccounts() (accounts []*ag_solanago.AccountMeta)

func (*ThawAccount) GetAuthorityAccount

func (inst *ThawAccount) GetAuthorityAccount() *ag_solanago.AccountMeta

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

func (*ThawAccount) GetMintAccount

func (inst *ThawAccount) GetMintAccount() *ag_solanago.AccountMeta

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

func (ThawAccount) MarshalWithEncoder

func (obj ThawAccount) MarshalWithEncoder(encoder *ag_binary.Encoder) (err error)

func (*ThawAccount) SetAccount

func (inst *ThawAccount) SetAccount(account ag_solanago.PublicKey) *ThawAccount

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

func (*ThawAccount) SetAccounts

func (obj *ThawAccount) SetAccounts(accounts []*ag_solanago.AccountMeta) error

func (*ThawAccount) SetAuthorityAccount

func (inst *ThawAccount) SetAuthorityAccount(authority ag_solanago.PublicKey, multisigSigners ...ag_solanago.PublicKey) *ThawAccount

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

func (*ThawAccount) SetMintAccount

func (inst *ThawAccount) SetMintAccount(mint ag_solanago.PublicKey) *ThawAccount

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

func (*ThawAccount) UnmarshalWithDecoder

func (obj *ThawAccount) UnmarshalWithDecoder(decoder *ag_binary.Decoder) (err error)

func (*ThawAccount) Validate

func (inst *ThawAccount) Validate() error

func (ThawAccount) ValidateAndBuild

func (inst 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 Transfer

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

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

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.

func NewTransferInstruction

func NewTransferInstruction(

	amount uint64,

	source ag_solanago.PublicKey,
	destination ag_solanago.PublicKey,
	owner ag_solanago.PublicKey,
	multisigSigners []ag_solanago.PublicKey) *Transfer

NewTransferInstruction declares a new Transfer instruction with the provided parameters and accounts.

func NewTransferInstructionBuilder

func NewTransferInstructionBuilder() *Transfer

NewTransferInstructionBuilder creates a new `Transfer` instruction builder.

func (Transfer) Build

func (inst Transfer) Build() *Instruction

func (*Transfer) EncodeToTree

func (inst *Transfer) EncodeToTree(parent ag_treeout.Branches)

func (Transfer) GetAccounts

func (slice Transfer) GetAccounts() (accounts []*ag_solanago.AccountMeta)

func (*Transfer) GetDestinationAccount

func (inst *Transfer) GetDestinationAccount() *ag_solanago.AccountMeta

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

func (*Transfer) GetOwnerAccount

func (inst *Transfer) GetOwnerAccount() *ag_solanago.AccountMeta

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

func (*Transfer) GetSourceAccount

func (inst *Transfer) GetSourceAccount() *ag_solanago.AccountMeta

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

func (Transfer) MarshalWithEncoder

func (obj Transfer) MarshalWithEncoder(encoder *ag_binary.Encoder) (err error)

func (*Transfer) SetAccounts

func (obj *Transfer) SetAccounts(accounts []*ag_solanago.AccountMeta) error

func (*Transfer) SetAmount

func (inst *Transfer) SetAmount(amount uint64) *Transfer

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

func (*Transfer) SetDestinationAccount

func (inst *Transfer) SetDestinationAccount(destination ag_solanago.PublicKey) *Transfer

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

func (*Transfer) SetOwnerAccount

func (inst *Transfer) SetOwnerAccount(owner ag_solanago.PublicKey, multisigSigners ...ag_solanago.PublicKey) *Transfer

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

func (*Transfer) SetSourceAccount

func (inst *Transfer) SetSourceAccount(source ag_solanago.PublicKey) *Transfer

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

func (*Transfer) UnmarshalWithDecoder

func (obj *Transfer) UnmarshalWithDecoder(decoder *ag_binary.Decoder) (err error)

func (*Transfer) Validate

func (inst *Transfer) Validate() error

func (Transfer) ValidateAndBuild

func (inst Transfer) 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 ag_solanago.AccountMetaSlice `bin:"-" borsh_skip:"true"`
	Signers  ag_solanago.AccountMetaSlice `bin:"-" borsh_skip:"true"`
}

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.

func NewTransferCheckedInstruction

func NewTransferCheckedInstruction(

	amount uint64,
	decimals uint8,

	source ag_solanago.PublicKey,
	mint ag_solanago.PublicKey,
	destination ag_solanago.PublicKey,
	owner ag_solanago.PublicKey,
	multisigSigners []ag_solanago.PublicKey,
) *TransferChecked

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

func NewTransferCheckedInstructionBuilder

func NewTransferCheckedInstructionBuilder() *TransferChecked

NewTransferCheckedInstructionBuilder creates a new `TransferChecked` instruction builder.

func (TransferChecked) Build

func (inst TransferChecked) Build() *Instruction

func (*TransferChecked) EncodeToTree

func (inst *TransferChecked) EncodeToTree(parent ag_treeout.Branches)

func (TransferChecked) GetAccounts

func (slice TransferChecked) GetAccounts() (accounts []*ag_solanago.AccountMeta)

func (*TransferChecked) GetDestinationAccount

func (inst *TransferChecked) GetDestinationAccount() *ag_solanago.AccountMeta

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

func (*TransferChecked) GetMintAccount

func (inst *TransferChecked) GetMintAccount() *ag_solanago.AccountMeta

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

func (*TransferChecked) GetOwnerAccount

func (inst *TransferChecked) GetOwnerAccount() *ag_solanago.AccountMeta

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

func (*TransferChecked) GetSourceAccount

func (inst *TransferChecked) GetSourceAccount() *ag_solanago.AccountMeta

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

func (TransferChecked) MarshalWithEncoder

func (obj TransferChecked) MarshalWithEncoder(encoder *ag_binary.Encoder) (err error)

func (*TransferChecked) SetAccounts

func (obj *TransferChecked) SetAccounts(accounts []*ag_solanago.AccountMeta) error

func (*TransferChecked) SetAmount

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

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

func (*TransferChecked) SetDecimals

func (inst *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

func (inst *TransferChecked) SetDestinationAccount(destination ag_solanago.PublicKey) *TransferChecked

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

func (*TransferChecked) SetMintAccount

func (inst *TransferChecked) SetMintAccount(mint ag_solanago.PublicKey) *TransferChecked

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

func (*TransferChecked) SetOwnerAccount

func (inst *TransferChecked) SetOwnerAccount(owner ag_solanago.PublicKey, multisigSigners ...ag_solanago.PublicKey) *TransferChecked

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

func (*TransferChecked) SetSourceAccount

func (inst *TransferChecked) SetSourceAccount(source ag_solanago.PublicKey) *TransferChecked

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

func (*TransferChecked) UnmarshalWithDecoder

func (obj *TransferChecked) UnmarshalWithDecoder(decoder *ag_binary.Decoder) (err error)

func (*TransferChecked) Validate

func (inst *TransferChecked) Validate() error

func (TransferChecked) ValidateAndBuild

func (inst TransferChecked) 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.

Jump to

Keyboard shortcuts

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