token

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2022 License: Apache-2.0 Imports: 13 Imported by: 106

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
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 added in v0.4.4

func InstructionIDToName(id uint8) string

InstructionIDToName returns the name of the instruction given its ID.

func SetProgramID added in v0.4.4

func SetProgramID(pubkey ag_solanago.PublicKey)

Types

type Account

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

	// The owner of this account.
	Owner ag_solanago.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 *ag_solanago.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 *ag_solanago.PublicKey `bin:"optional"`
}

type AccountState added in v0.4.4

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 added in v0.4.4

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 added in v0.4.4

func NewApproveInstructionBuilder() *Approve

NewApproveInstructionBuilder creates a new `Approve` instruction builder.

func (Approve) Build added in v0.4.4

func (inst Approve) Build() *Instruction

func (*Approve) EncodeToTree added in v0.4.4

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

func (Approve) GetAccounts added in v0.4.4

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

func (*Approve) GetDelegateAccount added in v0.4.4

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

GetDelegateAccount gets the "delegate" account. The delegate.

func (*Approve) GetOwnerAccount added in v0.4.4

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

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

func (*Approve) GetSourceAccount added in v0.4.4

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

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

func (Approve) MarshalWithEncoder added in v0.4.4

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

func (*Approve) SetAccounts added in v0.4.4

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

func (*Approve) SetAmount added in v0.4.4

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

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

SetDelegateAccount sets the "delegate" account. The delegate.

func (*Approve) SetOwnerAccount added in v0.4.4

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 added in v0.4.4

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

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

func (*Approve) UnmarshalWithDecoder added in v0.4.4

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

func (*Approve) Validate added in v0.4.4

func (inst *Approve) Validate() error

func (Approve) ValidateAndBuild added in v0.4.4

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 added in v0.4.4

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 added in v0.4.4

func NewApproveCheckedInstructionBuilder() *ApproveChecked

NewApproveCheckedInstructionBuilder creates a new `ApproveChecked` instruction builder.

func (ApproveChecked) Build added in v0.4.4

func (inst ApproveChecked) Build() *Instruction

func (*ApproveChecked) EncodeToTree added in v0.4.4

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

func (ApproveChecked) GetAccounts added in v0.4.4

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

func (*ApproveChecked) GetDelegateAccount added in v0.4.4

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

GetDelegateAccount gets the "delegate" account. The delegate.

func (*ApproveChecked) GetMintAccount added in v0.4.4

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

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

func (*ApproveChecked) GetOwnerAccount added in v0.4.4

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

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

func (*ApproveChecked) GetSourceAccount added in v0.4.4

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

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

func (ApproveChecked) MarshalWithEncoder added in v0.4.4

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

func (*ApproveChecked) SetAccounts added in v0.4.4

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

func (*ApproveChecked) SetAmount added in v0.4.4

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

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 added in v0.4.4

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

SetDelegateAccount sets the "delegate" account. The delegate.

func (*ApproveChecked) SetMintAccount added in v0.4.4

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

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

func (*ApproveChecked) SetOwnerAccount added in v0.4.4

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 added in v0.4.4

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

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

func (*ApproveChecked) UnmarshalWithDecoder added in v0.4.4

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

func (*ApproveChecked) Validate added in v0.4.4

func (inst *ApproveChecked) Validate() error

func (ApproveChecked) ValidateAndBuild added in v0.4.4

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 added in v0.4.4

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 added in v0.4.4

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 added in v0.4.4

func NewBurnInstructionBuilder() *Burn

NewBurnInstructionBuilder creates a new `Burn` instruction builder.

func (Burn) Build added in v0.4.4

func (inst Burn) Build() *Instruction

func (*Burn) EncodeToTree added in v0.4.4

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

func (Burn) GetAccounts added in v0.4.4

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

func (*Burn) GetMintAccount added in v0.4.4

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

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

func (*Burn) GetOwnerAccount added in v0.4.4

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

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

func (*Burn) GetSourceAccount added in v0.4.4

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

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

func (Burn) MarshalWithEncoder added in v0.4.4

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

func (*Burn) SetAccounts added in v0.4.4

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

func (*Burn) SetAmount added in v0.4.4

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

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

func (*Burn) SetMintAccount added in v0.4.4

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

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

func (*Burn) SetOwnerAccount added in v0.4.4

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 added in v0.4.4

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

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

func (*Burn) UnmarshalWithDecoder added in v0.4.4

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

func (*Burn) Validate added in v0.4.4

func (inst *Burn) Validate() error

func (Burn) ValidateAndBuild added in v0.4.4

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 added in v0.4.4

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 added in v0.4.4

func NewBurnCheckedInstructionBuilder() *BurnChecked

NewBurnCheckedInstructionBuilder creates a new `BurnChecked` instruction builder.

func (BurnChecked) Build added in v0.4.4

func (inst BurnChecked) Build() *Instruction

func (*BurnChecked) EncodeToTree added in v0.4.4

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

func (BurnChecked) GetAccounts added in v0.4.4

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

func (*BurnChecked) GetMintAccount added in v0.4.4

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

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

func (*BurnChecked) GetOwnerAccount added in v0.4.4

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

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

func (*BurnChecked) GetSourceAccount added in v0.4.4

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

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

func (BurnChecked) MarshalWithEncoder added in v0.4.4

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

func (*BurnChecked) SetAccounts added in v0.4.4

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

func (*BurnChecked) SetAmount added in v0.4.4

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

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

func (*BurnChecked) SetDecimals added in v0.4.4

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 added in v0.4.4

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

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

func (*BurnChecked) SetOwnerAccount added in v0.4.4

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 added in v0.4.4

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

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

func (*BurnChecked) UnmarshalWithDecoder added in v0.4.4

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

func (*BurnChecked) Validate added in v0.4.4

func (inst *BurnChecked) Validate() error

func (BurnChecked) ValidateAndBuild added in v0.4.4

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 added in v0.4.4

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 added in v0.4.4

func NewCloseAccountInstructionBuilder() *CloseAccount

NewCloseAccountInstructionBuilder creates a new `CloseAccount` instruction builder.

func (CloseAccount) Build added in v0.4.4

func (inst CloseAccount) Build() *Instruction

func (*CloseAccount) EncodeToTree added in v0.4.4

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

func (*CloseAccount) GetAccount added in v0.4.4

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

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

func (CloseAccount) GetAccounts added in v0.4.4

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

func (*CloseAccount) GetDestinationAccount added in v0.4.4

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

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

func (*CloseAccount) GetOwnerAccount added in v0.4.4

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

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

func (CloseAccount) MarshalWithEncoder added in v0.4.4

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

func (*CloseAccount) SetAccount added in v0.4.4

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

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

func (*CloseAccount) SetAccounts added in v0.4.4

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

func (*CloseAccount) SetDestinationAccount added in v0.4.4

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

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

func (*CloseAccount) SetOwnerAccount added in v0.4.4

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 added in v0.4.4

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

func (*CloseAccount) Validate added in v0.4.4

func (inst *CloseAccount) Validate() error

func (CloseAccount) ValidateAndBuild added in v0.4.4

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 added in v0.4.4

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 added in v0.4.4

func NewFreezeAccountInstructionBuilder() *FreezeAccount

NewFreezeAccountInstructionBuilder creates a new `FreezeAccount` instruction builder.

func (FreezeAccount) Build added in v0.4.4

func (inst FreezeAccount) Build() *Instruction

func (*FreezeAccount) EncodeToTree added in v0.4.4

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

func (*FreezeAccount) GetAccount added in v0.4.4

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

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

func (FreezeAccount) GetAccounts added in v0.4.4

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

func (*FreezeAccount) GetAuthorityAccount added in v0.4.4

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

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

func (*FreezeAccount) GetMintAccount added in v0.4.4

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

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

func (FreezeAccount) MarshalWithEncoder added in v0.4.4

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

func (*FreezeAccount) SetAccount added in v0.4.4

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

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

func (*FreezeAccount) SetAccounts added in v0.4.4

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

func (*FreezeAccount) SetAuthorityAccount added in v0.4.4

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 added in v0.4.4

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

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

func (*FreezeAccount) UnmarshalWithDecoder added in v0.4.4

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

func (*FreezeAccount) Validate added in v0.4.4

func (inst *FreezeAccount) Validate() error

func (FreezeAccount) ValidateAndBuild added in v0.4.4

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 added in v0.4.4

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 added in v0.4.4

func NewInitializeAccountInstructionBuilder() *InitializeAccount

NewInitializeAccountInstructionBuilder creates a new `InitializeAccount` instruction builder.

func (InitializeAccount) Build added in v0.4.4

func (inst InitializeAccount) Build() *Instruction

func (*InitializeAccount) EncodeToTree added in v0.4.4

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

func (*InitializeAccount) GetAccount added in v0.4.4

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

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

func (*InitializeAccount) GetMintAccount added in v0.4.4

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

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

func (*InitializeAccount) GetOwnerAccount added in v0.4.4

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

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

func (*InitializeAccount) GetSysVarRentPubkeyAccount added in v0.4.4

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

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

func (InitializeAccount) MarshalWithEncoder added in v0.4.4

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

func (*InitializeAccount) SetAccount added in v0.4.4

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

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

func (*InitializeAccount) SetMintAccount added in v0.4.4

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 added in v0.4.4

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

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

func (*InitializeAccount) SetSysVarRentPubkeyAccount added in v0.4.4

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

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

func (*InitializeAccount) UnmarshalWithDecoder added in v0.4.4

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

func (*InitializeAccount) Validate added in v0.4.4

func (inst *InitializeAccount) Validate() error

func (InitializeAccount) ValidateAndBuild added in v0.4.4

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 added in v0.4.4

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 added in v0.4.4

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 added in v0.4.4

func NewInitializeAccount2InstructionBuilder() *InitializeAccount2

NewInitializeAccount2InstructionBuilder creates a new `InitializeAccount2` instruction builder.

func (InitializeAccount2) Build added in v0.4.4

func (inst InitializeAccount2) Build() *Instruction

func (*InitializeAccount2) EncodeToTree added in v0.4.4

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

func (*InitializeAccount2) GetAccount added in v0.4.4

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

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

func (*InitializeAccount2) GetMintAccount added in v0.4.4

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

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

func (*InitializeAccount2) GetSysVarRentPubkeyAccount added in v0.4.4

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

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

func (InitializeAccount2) MarshalWithEncoder added in v0.4.4

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

func (*InitializeAccount2) SetAccount added in v0.4.4

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

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

func (*InitializeAccount2) SetMintAccount added in v0.4.4

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 added in v0.4.4

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

func (*InitializeAccount2) SetSysVarRentPubkeyAccount added in v0.4.4

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

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

func (*InitializeAccount2) UnmarshalWithDecoder added in v0.4.4

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

func (*InitializeAccount2) Validate added in v0.4.4

func (inst *InitializeAccount2) Validate() error

func (InitializeAccount2) ValidateAndBuild added in v0.4.4

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 added in v0.4.4

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 added in v0.4.4

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 added in v0.4.4

func NewInitializeAccount3InstructionBuilder() *InitializeAccount3

NewInitializeAccount3InstructionBuilder creates a new `InitializeAccount3` instruction builder.

func (InitializeAccount3) Build added in v0.4.4

func (inst InitializeAccount3) Build() *Instruction

func (*InitializeAccount3) EncodeToTree added in v0.4.4

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

func (*InitializeAccount3) GetAccount added in v0.4.4

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

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

func (*InitializeAccount3) GetMintAccount added in v0.4.4

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

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

func (InitializeAccount3) MarshalWithEncoder added in v0.4.4

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

func (*InitializeAccount3) SetAccount added in v0.4.4

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

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

func (*InitializeAccount3) SetMintAccount added in v0.4.4

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 added in v0.4.4

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

func (*InitializeAccount3) UnmarshalWithDecoder added in v0.4.4

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

func (*InitializeAccount3) Validate added in v0.4.4

func (inst *InitializeAccount3) Validate() error

func (InitializeAccount3) ValidateAndBuild added in v0.4.4

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 added in v0.4.4

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 added in v0.4.4

func NewInitializeMintInstructionBuilder() *InitializeMint

NewInitializeMintInstructionBuilder creates a new `InitializeMint` instruction builder.

func (InitializeMint) Build added in v0.4.4

func (inst InitializeMint) Build() *Instruction

func (*InitializeMint) EncodeToTree added in v0.4.4

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

func (*InitializeMint) GetMintAccount added in v0.4.4

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

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

func (*InitializeMint) GetSysVarRentPubkeyAccount added in v0.4.4

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

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

func (InitializeMint) MarshalWithEncoder added in v0.4.4

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

func (*InitializeMint) SetDecimals added in v0.4.4

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 added in v0.4.4

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 added in v0.4.4

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

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

func (*InitializeMint) SetMintAuthority added in v0.4.4

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 added in v0.4.4

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

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

func (*InitializeMint) UnmarshalWithDecoder added in v0.4.4

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

func (*InitializeMint) Validate added in v0.4.4

func (inst *InitializeMint) Validate() error

func (InitializeMint) ValidateAndBuild added in v0.4.4

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 added in v0.4.4

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 added in v0.4.4

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 added in v0.4.4

func NewInitializeMint2InstructionBuilder() *InitializeMint2

NewInitializeMint2InstructionBuilder creates a new `InitializeMint2` instruction builder.

func (InitializeMint2) Build added in v0.4.4

func (inst InitializeMint2) Build() *Instruction

func (*InitializeMint2) EncodeToTree added in v0.4.4

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

func (*InitializeMint2) GetMintAccount added in v0.4.4

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

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

func (InitializeMint2) MarshalWithEncoder added in v0.4.4

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

func (*InitializeMint2) SetDecimals added in v0.4.4

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 added in v0.4.4

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 added in v0.4.4

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

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

func (*InitializeMint2) SetMintAuthority added in v0.4.4

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 added in v0.4.4

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

func (*InitializeMint2) Validate added in v0.4.4

func (inst *InitializeMint2) Validate() error

func (InitializeMint2) ValidateAndBuild added in v0.4.4

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 added in v0.4.4

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 added in v0.4.4

func NewInitializeMultisigInstructionBuilder() *InitializeMultisig

NewInitializeMultisigInstructionBuilder creates a new `InitializeMultisig` instruction builder.

func (*InitializeMultisig) AddSigners added in v0.4.4

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 added in v0.4.4

func (inst InitializeMultisig) Build() *Instruction

func (*InitializeMultisig) EncodeToTree added in v0.4.4

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

func (*InitializeMultisig) GetAccount added in v0.4.4

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

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

func (InitializeMultisig) GetAccounts added in v0.4.4

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

func (*InitializeMultisig) GetSysVarRentPubkeyAccount added in v0.4.4

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

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

func (InitializeMultisig) MarshalWithEncoder added in v0.4.4

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

func (*InitializeMultisig) SetAccount added in v0.4.4

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

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

func (*InitializeMultisig) SetAccounts added in v0.4.4

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

func (*InitializeMultisig) SetM added in v0.4.4

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

func (*InitializeMultisig) SetSysVarRentPubkeyAccount added in v0.4.4

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

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

func (*InitializeMultisig) UnmarshalWithDecoder added in v0.4.4

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

func (*InitializeMultisig) Validate added in v0.4.4

func (inst *InitializeMultisig) Validate() error

func (InitializeMultisig) ValidateAndBuild added in v0.4.4

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 added in v0.4.4

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 added in v0.4.4

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 added in v0.4.4

func NewInitializeMultisig2InstructionBuilder() *InitializeMultisig2

NewInitializeMultisig2InstructionBuilder creates a new `InitializeMultisig2` instruction builder.

func (*InitializeMultisig2) AddSigners added in v0.4.4

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 added in v0.4.4

func (inst InitializeMultisig2) Build() *Instruction

func (*InitializeMultisig2) EncodeToTree added in v0.4.4

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

func (*InitializeMultisig2) GetAccount added in v0.4.4

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

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

func (InitializeMultisig2) GetAccounts added in v0.4.4

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

func (InitializeMultisig2) MarshalWithEncoder added in v0.4.4

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

func (*InitializeMultisig2) SetAccount added in v0.4.4

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

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

func (*InitializeMultisig2) SetAccounts added in v0.4.4

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

func (*InitializeMultisig2) SetM added in v0.4.4

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

func (*InitializeMultisig2) UnmarshalWithDecoder added in v0.4.4

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

func (*InitializeMultisig2) Validate added in v0.4.4

func (inst *InitializeMultisig2) Validate() error

func (InitializeMultisig2) ValidateAndBuild added in v0.4.4

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 added in v0.4.4

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

func (*Instruction) Data added in v0.4.4

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

func (*Instruction) EncodeToTree added in v0.4.4

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

func (*Instruction) MarshalWithEncoder added in v0.4.0

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

func (*Instruction) ProgramID added in v0.4.4

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 added in v0.4.0

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 *ag_solanago.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 *ag_solanago.PublicKey `bin:"optional"`
}

func FetchMints

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

func (*Mint) Decode

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

func (Mint) MarshalWithEncoder added in v1.0.3

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

func (*Mint) UnmarshalWithDecoder added in v1.0.3

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 added in v0.4.4

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 added in v0.4.4

func NewMintToInstructionBuilder() *MintTo

NewMintToInstructionBuilder creates a new `MintTo` instruction builder.

func (MintTo) Build added in v0.4.4

func (inst MintTo) Build() *Instruction

func (*MintTo) EncodeToTree added in v0.4.4

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

func (MintTo) GetAccounts added in v0.4.4

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

func (*MintTo) GetAuthorityAccount added in v0.4.4

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

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

func (*MintTo) GetDestinationAccount added in v0.4.4

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

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

func (*MintTo) GetMintAccount added in v0.4.4

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

GetMintAccount gets the "mint" account. The mint.

func (MintTo) MarshalWithEncoder added in v0.4.4

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

func (*MintTo) SetAccounts added in v0.4.4

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

func (*MintTo) SetAmount added in v0.4.4

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

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

func (*MintTo) SetAuthorityAccount added in v0.4.4

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 added in v0.4.4

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

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

func (*MintTo) SetMintAccount added in v0.4.4

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

SetMintAccount sets the "mint" account. The mint.

func (*MintTo) UnmarshalWithDecoder added in v0.4.4

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

func (*MintTo) Validate added in v0.4.4

func (inst *MintTo) Validate() error

func (MintTo) ValidateAndBuild added in v0.4.4

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 added in v0.4.4

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 added in v0.4.4

func NewMintToCheckedInstructionBuilder() *MintToChecked

NewMintToCheckedInstructionBuilder creates a new `MintToChecked` instruction builder.

func (MintToChecked) Build added in v0.4.4

func (inst MintToChecked) Build() *Instruction

func (*MintToChecked) EncodeToTree added in v0.4.4

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

func (MintToChecked) GetAccounts added in v0.4.4

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

func (*MintToChecked) GetAuthorityAccount added in v0.4.4

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

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

func (*MintToChecked) GetDestinationAccount added in v0.4.4

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

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

func (*MintToChecked) GetMintAccount added in v0.4.4

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

GetMintAccount gets the "mint" account. The mint.

func (MintToChecked) MarshalWithEncoder added in v0.4.4

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

func (*MintToChecked) SetAccounts added in v0.4.4

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

func (*MintToChecked) SetAmount added in v0.4.4

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

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

func (*MintToChecked) SetAuthorityAccount added in v0.4.4

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 added in v0.4.4

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 added in v0.4.4

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

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

func (*MintToChecked) SetMintAccount added in v0.4.4

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

SetMintAccount sets the "mint" account. The mint.

func (*MintToChecked) UnmarshalWithDecoder added in v0.4.4

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

func (*MintToChecked) Validate added in v0.4.4

func (inst *MintToChecked) Validate() error

func (MintToChecked) ValidateAndBuild added in v0.4.4

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 [11]ag_solanago.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 added in v0.4.4

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 added in v0.4.4

func NewRevokeInstructionBuilder() *Revoke

NewRevokeInstructionBuilder creates a new `Revoke` instruction builder.

func (Revoke) Build added in v0.4.4

func (inst Revoke) Build() *Instruction

func (*Revoke) EncodeToTree added in v0.4.4

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

func (Revoke) GetAccounts added in v0.4.4

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

func (*Revoke) GetOwnerAccount added in v0.4.4

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

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

func (*Revoke) GetSourceAccount added in v0.4.4

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

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

func (Revoke) MarshalWithEncoder added in v0.4.4

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

func (*Revoke) SetAccounts added in v0.4.4

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

func (*Revoke) SetOwnerAccount added in v0.4.4

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 added in v0.4.4

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

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

func (*Revoke) UnmarshalWithDecoder added in v0.4.4

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

func (*Revoke) Validate added in v0.4.4

func (inst *Revoke) Validate() error

func (Revoke) ValidateAndBuild added in v0.4.4

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 added in v0.4.4

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 added in v0.4.4

func NewSetAuthorityInstructionBuilder() *SetAuthority

NewSetAuthorityInstructionBuilder creates a new `SetAuthority` instruction builder.

func (SetAuthority) Build added in v0.4.4

func (inst SetAuthority) Build() *Instruction

func (*SetAuthority) EncodeToTree added in v0.4.4

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

func (SetAuthority) GetAccounts added in v0.4.4

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

func (*SetAuthority) GetAuthorityAccount added in v0.4.4

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

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

func (*SetAuthority) GetSubjectAccount added in v0.4.4

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

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

func (SetAuthority) MarshalWithEncoder added in v0.4.4

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

func (*SetAuthority) SetAccounts added in v0.4.4

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

func (*SetAuthority) SetAuthorityAccount added in v0.4.4

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 added in v0.4.4

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

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

func (*SetAuthority) SetNewAuthority added in v0.4.4

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

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

func (*SetAuthority) SetSubjectAccount added in v0.4.4

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 added in v0.4.4

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

func (*SetAuthority) Validate added in v0.4.4

func (inst *SetAuthority) Validate() error

func (SetAuthority) ValidateAndBuild added in v0.4.4

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 added in v0.4.4

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 added in v0.4.4

func NewSyncNativeInstruction(

	tokenAccount ag_solanago.PublicKey) *SyncNative

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

func NewSyncNativeInstructionBuilder added in v0.4.4

func NewSyncNativeInstructionBuilder() *SyncNative

NewSyncNativeInstructionBuilder creates a new `SyncNative` instruction builder.

func (SyncNative) Build added in v0.4.4

func (inst SyncNative) Build() *Instruction

func (*SyncNative) EncodeToTree added in v0.4.4

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

func (*SyncNative) GetTokenAccount added in v0.4.4

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 added in v0.4.4

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

func (*SyncNative) SetTokenAccount added in v0.4.4

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 added in v0.4.4

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

func (*SyncNative) Validate added in v0.4.4

func (inst *SyncNative) Validate() error

func (SyncNative) ValidateAndBuild added in v0.4.4

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 added in v0.4.4

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 added in v0.4.4

func NewThawAccountInstructionBuilder() *ThawAccount

NewThawAccountInstructionBuilder creates a new `ThawAccount` instruction builder.

func (ThawAccount) Build added in v0.4.4

func (inst ThawAccount) Build() *Instruction

func (*ThawAccount) EncodeToTree added in v0.4.4

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

func (*ThawAccount) GetAccount added in v0.4.4

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

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

func (ThawAccount) GetAccounts added in v0.4.4

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

func (*ThawAccount) GetAuthorityAccount added in v0.4.4

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

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

func (*ThawAccount) GetMintAccount added in v0.4.4

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

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

func (ThawAccount) MarshalWithEncoder added in v0.4.4

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

func (*ThawAccount) SetAccount added in v0.4.4

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

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

func (*ThawAccount) SetAccounts added in v0.4.4

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

func (*ThawAccount) SetAuthorityAccount added in v0.4.4

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 added in v0.4.4

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

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

func (*ThawAccount) UnmarshalWithDecoder added in v0.4.4

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

func (*ThawAccount) Validate added in v0.4.4

func (inst *ThawAccount) Validate() error

func (ThawAccount) ValidateAndBuild added in v0.4.4

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 added in v0.4.4

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 added in v0.4.4

func NewTransferInstructionBuilder() *Transfer

NewTransferInstructionBuilder creates a new `Transfer` instruction builder.

func (Transfer) Build added in v0.4.4

func (inst Transfer) Build() *Instruction

func (*Transfer) EncodeToTree added in v0.4.4

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

func (Transfer) GetAccounts added in v0.4.4

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

func (*Transfer) GetDestinationAccount added in v0.4.4

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

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

func (*Transfer) GetOwnerAccount added in v0.4.4

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

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

func (*Transfer) GetSourceAccount added in v0.4.4

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

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

func (Transfer) MarshalWithEncoder added in v0.4.4

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

func (*Transfer) SetAccounts added in v0.4.4

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

func (*Transfer) SetAmount added in v0.4.4

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

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

func (*Transfer) SetDestinationAccount added in v0.4.4

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

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

func (*Transfer) SetOwnerAccount added in v0.4.4

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 added in v0.4.4

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

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

func (*Transfer) UnmarshalWithDecoder added in v0.4.4

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

func (*Transfer) Validate added in v0.4.4

func (inst *Transfer) Validate() error

func (Transfer) ValidateAndBuild added in v0.4.4

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 added in v0.4.4

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 added in v0.4.4

func NewTransferCheckedInstructionBuilder() *TransferChecked

NewTransferCheckedInstructionBuilder creates a new `TransferChecked` instruction builder.

func (TransferChecked) Build added in v0.4.4

func (inst TransferChecked) Build() *Instruction

func (*TransferChecked) EncodeToTree added in v0.4.4

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

func (TransferChecked) GetAccounts added in v0.4.4

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

func (*TransferChecked) GetDestinationAccount added in v0.4.4

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

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

func (*TransferChecked) GetMintAccount added in v0.4.4

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

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

func (*TransferChecked) GetOwnerAccount added in v0.4.4

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

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

func (*TransferChecked) GetSourceAccount added in v0.4.4

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

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

func (TransferChecked) MarshalWithEncoder added in v0.4.4

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

func (*TransferChecked) SetAccounts added in v0.4.4

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

func (*TransferChecked) SetAmount added in v0.4.4

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

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

func (*TransferChecked) SetDecimals added in v0.4.4

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 added in v0.4.4

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

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

func (*TransferChecked) SetMintAccount added in v0.4.4

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

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

func (*TransferChecked) SetOwnerAccount added in v0.4.4

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 added in v0.4.4

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

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

func (*TransferChecked) UnmarshalWithDecoder added in v0.4.4

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

func (*TransferChecked) Validate added in v0.4.4

func (inst *TransferChecked) Validate() error

func (TransferChecked) ValidateAndBuild added in v0.4.4

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