Documentation ¶
Index ¶
- Constants
- Variables
- func FindAssociatedTokenAddress(walletAddress web3.PublicKey, mint web3.PublicKey, programId web3.PublicKey) (web3.PublicKey, error)
- func FindAssociatedTokenAddressAndBumpSeed(walletAddress web3.PublicKey, mint web3.PublicKey, programId web3.PublicKey) (web3.PublicKey, uint8, error)
- func FindAssociatedTokenAddressAndBumpSeed2(walletAddress web3.PublicKey, mint web3.PublicKey, programId web3.PublicKey, ...) (web3.PublicKey, uint8, error)
- func InstructionIDToName(id uint8) string
- func SetProgramID(pubkey common.PublicKey)
- type Create
- func (obj *Create) Build() *Instruction
- func (obj *Create) EncodeToTree(parent treeout.Branches)
- func (obj *Create) GetAccountAccount() *common.AccountMeta
- func (obj *Create) GetAssociatedAccountAccount() *common.AccountMeta
- func (obj *Create) GetMintAccount() *common.AccountMeta
- func (obj *Create) GetSplTokenProgramAccount() *common.AccountMeta
- func (obj *Create) GetSystemAccount() *common.AccountMeta
- func (obj *Create) GetWalletAddressAccount() *common.AccountMeta
- func (obj *Create) MarshalWithEncoder(encoder *binary.Encoder) (err error)
- func (obj *Create) SetAccountAccount(account common.PublicKey) *Create
- func (obj *Create) SetAssociatedAccountAccount(associatedAccount common.PublicKey) *Create
- func (obj *Create) SetMintAccount(mint common.PublicKey) *Create
- func (obj *Create) SetProgramId(programId *common.PublicKey) *Create
- func (obj *Create) SetSplTokenProgramAccount(splTokenProgram common.PublicKey, multiSigners ...common.PublicKey) *Create
- func (obj *Create) SetSystemAccount(system common.PublicKey) *Create
- func (obj *Create) SetWalletAddressAccount(walletAddress common.PublicKey) *Create
- func (obj *Create) UnmarshalWithDecoder(decoder *binary.Decoder) (err error)
- func (obj *Create) Validate() error
- func (obj *Create) ValidateAndBuild() (*Instruction, error)
- type CreateIdempotent
- func (obj *CreateIdempotent) Build() *Instruction
- func (obj *CreateIdempotent) EncodeToTree(parent treeout.Branches)
- func (obj *CreateIdempotent) GetAccountAccount() *common.AccountMeta
- func (obj *CreateIdempotent) GetAssociatedAccountAccount() *common.AccountMeta
- func (obj *CreateIdempotent) GetMintAccount() *common.AccountMeta
- func (obj *CreateIdempotent) GetSplTokenProgramAccount() *common.AccountMeta
- func (obj *CreateIdempotent) GetSystemAccount() *common.AccountMeta
- func (obj *CreateIdempotent) GetWalletAddressAccount() *common.AccountMeta
- func (obj *CreateIdempotent) MarshalWithEncoder(encoder *binary.Encoder) (err error)
- func (obj *CreateIdempotent) SetAccountAccount(account common.PublicKey) *CreateIdempotent
- func (obj *CreateIdempotent) SetAssociatedAccountAccount(associatedAccount common.PublicKey) *CreateIdempotent
- func (obj *CreateIdempotent) SetMintAccount(mint common.PublicKey) *CreateIdempotent
- func (obj *CreateIdempotent) SetProgramId(programId *common.PublicKey) *CreateIdempotent
- func (obj *CreateIdempotent) SetSplTokenProgramAccount(splTokenProgram common.PublicKey, multiSigners ...common.PublicKey) *CreateIdempotent
- func (obj *CreateIdempotent) SetSystemAccount(system common.PublicKey) *CreateIdempotent
- func (obj *CreateIdempotent) SetWalletAddressAccount(walletAddress common.PublicKey) *CreateIdempotent
- func (obj *CreateIdempotent) UnmarshalWithDecoder(decoder *binary.Decoder) (err error)
- func (obj *CreateIdempotent) Validate() error
- func (obj *CreateIdempotent) ValidateAndBuild() (*Instruction, error)
- type Instruction
- func (obj *Instruction) Accounts() (out []*common.AccountMeta)
- func (obj *Instruction) Data() ([]byte, error)
- func (obj *Instruction) EncodeToTree(parent treeout.Branches)
- func (obj *Instruction) MarshalWithEncoder(encoder *binary.Encoder) error
- func (obj *Instruction) ProgramID() common.PublicKey
- func (obj *Instruction) TextEncode(encoder *text.Encoder, option *text.Option) error
- func (obj *Instruction) UnmarshalWithDecoder(decoder *binary.Decoder) error
- type InvalidOwnerError
- type ProgramError
- type RecoverNested
- func (obj *RecoverNested) Build() *Instruction
- func (obj *RecoverNested) EncodeToTree(parent treeout.Branches)
- func (obj *RecoverNested) GetMintNataAccount() *common.AccountMeta
- func (obj *RecoverNested) GetMintOataAccount() *common.AccountMeta
- func (obj *RecoverNested) GetNestedAssociatedAccountAccount() *common.AccountMeta
- func (obj *RecoverNested) GetNestedAssociatedAccountOwnerAccount() *common.AccountMeta
- func (obj *RecoverNested) GetSplTokenProgramAccount() *common.AccountMeta
- func (obj *RecoverNested) GetWalletAccount() *common.AccountMeta
- func (obj *RecoverNested) GetWalletAssociatedAccountAccount() *common.AccountMeta
- func (obj *RecoverNested) MarshalWithEncoder(encoder *binary.Encoder) (err error)
- func (obj *RecoverNested) SetMintNataAccount(mintNata common.PublicKey) *RecoverNested
- func (obj *RecoverNested) SetMintOataAccount(mintOata common.PublicKey) *RecoverNested
- func (obj *RecoverNested) SetNestedAssociatedAccountAccount(nestedAssociatedAccount common.PublicKey) *RecoverNested
- func (obj *RecoverNested) SetNestedAssociatedAccountOwnerAccount(nestedAssociatedAccountOwner common.PublicKey) *RecoverNested
- func (obj *RecoverNested) SetProgramId(programId *common.PublicKey) *RecoverNested
- func (obj *RecoverNested) SetSplTokenProgramAccount(splTokenProgram common.PublicKey, multiSigners ...common.PublicKey) *RecoverNested
- func (obj *RecoverNested) SetWalletAccount(wallet common.PublicKey) *RecoverNested
- func (obj *RecoverNested) SetWalletAssociatedAccountAccount(walletAssociatedAccount common.PublicKey) *RecoverNested
- func (obj *RecoverNested) UnmarshalWithDecoder(decoder *binary.Decoder) (err error)
- func (obj *RecoverNested) Validate() error
- func (obj *RecoverNested) ValidateAndBuild() (*Instruction, error)
Constants ¶
const ProgramName = "associated_token_account"
Variables ¶
var ( Instruction_Create uint8 = 0 Instruction_CreateIdempotent uint8 = 1 Instruction_RecoverNested uint8 = 2 )
var InstructionImplDef = binary.NewVariantDefinition(binary.Uint8TypeIDEncoding, []binary.VariantType{ { "create", (*Create)(nil), }, { "create_idempotent", (*CreateIdempotent)(nil), }, { "recover_nested", (*RecoverNested)(nil), }, })
var ProgramID common.PublicKey = common.MustPublicKeyFromBase58("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL")
Functions ¶
func InstructionIDToName ¶
InstructionIDToName returns the name of the instruction given its ID.
func SetProgramID ¶
Types ¶
type Create ¶
type Create struct { // [0] = [WRITE, SIGNER] account `Funding account (must be a system account)` // [1] = [WRITE] associatedAccount `Associated token account address to be created` // [2] = [] walletAddress `Wallet address for the new associated token account` // [3] = [] mint `The token mint for the new associated token account` // [4] = [] system `System program` // [5] = [] splTokenProgram `SPL Token program` common.AccountMetaSlice `bin:"-"` // contains filtered or unexported fields }
Create Instruction
func NewCreateInstruction ¶
func NewCreateInstruction( account common.PublicKey, associatedAccount common.PublicKey, walletAddress common.PublicKey, mint common.PublicKey, system common.PublicKey, splTokenProgram common.PublicKey, ) *Create
NewCreateInstruction
Parameters:
account: Funding account (must be a system account) associatedAccount: Associated token account address to be created walletAddress: Wallet address for the new associated token account mint: The token mint for the new associated token account system: System program splTokenProgram: SPL Token program
func NewCreateInstructionBuilder ¶
func NewCreateInstructionBuilder() *Create
NewCreateInstructionBuilder creates a new `Create` instruction builder.
func (*Create) Build ¶
func (obj *Create) Build() *Instruction
func (*Create) EncodeToTree ¶
func (*Create) GetAccountAccount ¶
func (obj *Create) GetAccountAccount() *common.AccountMeta
GetAccountAccount gets the "account" parameter. Funding account (must be a system account)
func (*Create) GetAssociatedAccountAccount ¶
func (obj *Create) GetAssociatedAccountAccount() *common.AccountMeta
GetAssociatedAccountAccount gets the "associatedAccount" parameter. Associated token account address to be created
func (*Create) GetMintAccount ¶
func (obj *Create) GetMintAccount() *common.AccountMeta
GetMintAccount gets the "mint" parameter. The token mint for the new associated token account
func (*Create) GetSplTokenProgramAccount ¶
func (obj *Create) GetSplTokenProgramAccount() *common.AccountMeta
GetSplTokenProgramAccount gets the "splTokenProgram" parameter. SPL Token program
func (*Create) GetSystemAccount ¶
func (obj *Create) GetSystemAccount() *common.AccountMeta
GetSystemAccount gets the "system" parameter. System program
func (*Create) GetWalletAddressAccount ¶
func (obj *Create) GetWalletAddressAccount() *common.AccountMeta
GetWalletAddressAccount gets the "walletAddress" parameter. Wallet address for the new associated token account
func (*Create) MarshalWithEncoder ¶
func (*Create) SetAccountAccount ¶
SetAccountAccount sets the "account" parameter. Funding account (must be a system account)
func (*Create) SetAssociatedAccountAccount ¶
SetAssociatedAccountAccount sets the "associatedAccount" parameter. Associated token account address to be created
func (*Create) SetMintAccount ¶
SetMintAccount sets the "mint" parameter. The token mint for the new associated token account
func (*Create) SetSplTokenProgramAccount ¶
func (obj *Create) SetSplTokenProgramAccount(splTokenProgram common.PublicKey, multiSigners ...common.PublicKey) *Create
SetSplTokenProgramAccount sets the "splTokenProgram" parameter. SPL Token program
func (*Create) SetSystemAccount ¶
SetSystemAccount sets the "system" parameter. System program
func (*Create) SetWalletAddressAccount ¶
SetWalletAddressAccount sets the "walletAddress" parameter. Wallet address for the new associated token account
func (*Create) UnmarshalWithDecoder ¶
func (*Create) ValidateAndBuild ¶
func (obj *Create) 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 CreateIdempotent ¶
type CreateIdempotent struct { // [0] = [WRITE, SIGNER] account `Funding account (must be a system account)` // [1] = [WRITE] associatedAccount `Associated token account address to be created` // [2] = [] walletAddress `Wallet address for the new associated token account` // [3] = [] mint `The token mint for the new associated token account` // [4] = [] system `System program` // [5] = [] splTokenProgram `SPL Token program` common.AccountMetaSlice `bin:"-"` // contains filtered or unexported fields }
CreateIdempotent Instruction
func NewCreateIdempotentInstruction ¶
func NewCreateIdempotentInstruction( account common.PublicKey, associatedAccount common.PublicKey, walletAddress common.PublicKey, mint common.PublicKey, system common.PublicKey, splTokenProgram common.PublicKey, ) *CreateIdempotent
NewCreateIdempotentInstruction
Parameters:
account: Funding account (must be a system account) associatedAccount: Associated token account address to be created walletAddress: Wallet address for the new associated token account mint: The token mint for the new associated token account system: System program splTokenProgram: SPL Token program
func NewCreateIdempotentInstructionBuilder ¶
func NewCreateIdempotentInstructionBuilder() *CreateIdempotent
NewCreateIdempotentInstructionBuilder creates a new `CreateIdempotent` instruction builder.
func (*CreateIdempotent) Build ¶
func (obj *CreateIdempotent) Build() *Instruction
func (*CreateIdempotent) EncodeToTree ¶
func (obj *CreateIdempotent) EncodeToTree(parent treeout.Branches)
func (*CreateIdempotent) GetAccountAccount ¶
func (obj *CreateIdempotent) GetAccountAccount() *common.AccountMeta
GetAccountAccount gets the "account" parameter. Funding account (must be a system account)
func (*CreateIdempotent) GetAssociatedAccountAccount ¶
func (obj *CreateIdempotent) GetAssociatedAccountAccount() *common.AccountMeta
GetAssociatedAccountAccount gets the "associatedAccount" parameter. Associated token account address to be created
func (*CreateIdempotent) GetMintAccount ¶
func (obj *CreateIdempotent) GetMintAccount() *common.AccountMeta
GetMintAccount gets the "mint" parameter. The token mint for the new associated token account
func (*CreateIdempotent) GetSplTokenProgramAccount ¶
func (obj *CreateIdempotent) GetSplTokenProgramAccount() *common.AccountMeta
GetSplTokenProgramAccount gets the "splTokenProgram" parameter. SPL Token program
func (*CreateIdempotent) GetSystemAccount ¶
func (obj *CreateIdempotent) GetSystemAccount() *common.AccountMeta
GetSystemAccount gets the "system" parameter. System program
func (*CreateIdempotent) GetWalletAddressAccount ¶
func (obj *CreateIdempotent) GetWalletAddressAccount() *common.AccountMeta
GetWalletAddressAccount gets the "walletAddress" parameter. Wallet address for the new associated token account
func (*CreateIdempotent) MarshalWithEncoder ¶
func (obj *CreateIdempotent) MarshalWithEncoder(encoder *binary.Encoder) (err error)
func (*CreateIdempotent) SetAccountAccount ¶
func (obj *CreateIdempotent) SetAccountAccount(account common.PublicKey) *CreateIdempotent
SetAccountAccount sets the "account" parameter. Funding account (must be a system account)
func (*CreateIdempotent) SetAssociatedAccountAccount ¶
func (obj *CreateIdempotent) SetAssociatedAccountAccount(associatedAccount common.PublicKey) *CreateIdempotent
SetAssociatedAccountAccount sets the "associatedAccount" parameter. Associated token account address to be created
func (*CreateIdempotent) SetMintAccount ¶
func (obj *CreateIdempotent) SetMintAccount(mint common.PublicKey) *CreateIdempotent
SetMintAccount sets the "mint" parameter. The token mint for the new associated token account
func (*CreateIdempotent) SetProgramId ¶
func (obj *CreateIdempotent) SetProgramId(programId *common.PublicKey) *CreateIdempotent
func (*CreateIdempotent) SetSplTokenProgramAccount ¶
func (obj *CreateIdempotent) SetSplTokenProgramAccount(splTokenProgram common.PublicKey, multiSigners ...common.PublicKey) *CreateIdempotent
SetSplTokenProgramAccount sets the "splTokenProgram" parameter. SPL Token program
func (*CreateIdempotent) SetSystemAccount ¶
func (obj *CreateIdempotent) SetSystemAccount(system common.PublicKey) *CreateIdempotent
SetSystemAccount sets the "system" parameter. System program
func (*CreateIdempotent) SetWalletAddressAccount ¶
func (obj *CreateIdempotent) SetWalletAddressAccount(walletAddress common.PublicKey) *CreateIdempotent
SetWalletAddressAccount sets the "walletAddress" parameter. Wallet address for the new associated token account
func (*CreateIdempotent) UnmarshalWithDecoder ¶
func (obj *CreateIdempotent) UnmarshalWithDecoder(decoder *binary.Decoder) (err error)
func (*CreateIdempotent) Validate ¶
func (obj *CreateIdempotent) Validate() error
func (*CreateIdempotent) ValidateAndBuild ¶
func (obj *CreateIdempotent) 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 { binary.BaseVariant // contains filtered or unexported fields }
func DecodeInstruction ¶
func DecodeInstruction(accounts []*common.AccountMeta, data []byte) (*Instruction, error)
func (*Instruction) Accounts ¶
func (obj *Instruction) Accounts() (out []*common.AccountMeta)
func (*Instruction) Data ¶
func (obj *Instruction) Data() ([]byte, error)
func (*Instruction) EncodeToTree ¶
func (obj *Instruction) EncodeToTree(parent treeout.Branches)
func (*Instruction) MarshalWithEncoder ¶
func (obj *Instruction) MarshalWithEncoder(encoder *binary.Encoder) error
func (*Instruction) ProgramID ¶
func (obj *Instruction) ProgramID() common.PublicKey
func (*Instruction) TextEncode ¶
func (*Instruction) UnmarshalWithDecoder ¶
func (obj *Instruction) UnmarshalWithDecoder(decoder *binary.Decoder) error
type InvalidOwnerError ¶
type InvalidOwnerError struct{}
InvalidOwnerError Error: 0 `Associated token account owner does not match address derivation`
func (InvalidOwnerError) Code ¶
func (e InvalidOwnerError) Code() int
func (InvalidOwnerError) Error ¶
func (e InvalidOwnerError) Error() string
type ProgramError ¶
func GetAssociatedTokenAccountErrorFromCode ¶
func GetAssociatedTokenAccountErrorFromCode(code int) ProgramError
func GetAssociatedTokenAccountErrorFromName ¶
func GetAssociatedTokenAccountErrorFromName(name string) ProgramError
type RecoverNested ¶
type RecoverNested struct { // [0] = [WRITE] nestedAssociatedAccount `0. Nested associated token account, must be owned by `3“ // [1] = [] mintNata `Token mint for the nested associated token account` // [2] = [WRITE] walletAssociatedAccount `Wallet's associated token account` // [3] = [] nestedAssociatedAccountOwner `Owner associated token account address, must be owned by `5“ // [4] = [] mintOata `Token mint for the owner associated token account` // [5] = [WRITE, SIGNER] wallet `Wallet address for the owner associated token` // [6] = [] splTokenProgram `SPL Token program` common.AccountMetaSlice `bin:"-"` // contains filtered or unexported fields }
RecoverNested Instruction
func NewRecoverNestedInstruction ¶
func NewRecoverNestedInstruction( nestedAssociatedAccount common.PublicKey, mintNata common.PublicKey, walletAssociatedAccount common.PublicKey, nestedAssociatedAccountOwner common.PublicKey, mintOata common.PublicKey, wallet common.PublicKey, splTokenProgram common.PublicKey, ) *RecoverNested
NewRecoverNestedInstruction
Parameters:
nestedAssociatedAccount: 0. Nested associated token account, must be owned by `3` mintNata: Token mint for the nested associated token account walletAssociatedAccount: Wallet's associated token account nestedAssociatedAccountOwner: Owner associated token account address, must be owned by `5` mintOata: Token mint for the owner associated token account wallet: Wallet address for the owner associated token splTokenProgram: SPL Token program
func NewRecoverNestedInstructionBuilder ¶
func NewRecoverNestedInstructionBuilder() *RecoverNested
NewRecoverNestedInstructionBuilder creates a new `RecoverNested` instruction builder.
func (*RecoverNested) Build ¶
func (obj *RecoverNested) Build() *Instruction
func (*RecoverNested) EncodeToTree ¶
func (obj *RecoverNested) EncodeToTree(parent treeout.Branches)
func (*RecoverNested) GetMintNataAccount ¶
func (obj *RecoverNested) GetMintNataAccount() *common.AccountMeta
GetMintNataAccount gets the "mintNata" parameter. Token mint for the nested associated token account
func (*RecoverNested) GetMintOataAccount ¶
func (obj *RecoverNested) GetMintOataAccount() *common.AccountMeta
GetMintOataAccount gets the "mintOata" parameter. Token mint for the owner associated token account
func (*RecoverNested) GetNestedAssociatedAccountAccount ¶
func (obj *RecoverNested) GetNestedAssociatedAccountAccount() *common.AccountMeta
GetNestedAssociatedAccountAccount gets the "nestedAssociatedAccount" parameter. 0. Nested associated token account, must be owned by `3`
func (*RecoverNested) GetNestedAssociatedAccountOwnerAccount ¶
func (obj *RecoverNested) GetNestedAssociatedAccountOwnerAccount() *common.AccountMeta
GetNestedAssociatedAccountOwnerAccount gets the "nestedAssociatedAccountOwner" parameter. Owner associated token account address, must be owned by `5`
func (*RecoverNested) GetSplTokenProgramAccount ¶
func (obj *RecoverNested) GetSplTokenProgramAccount() *common.AccountMeta
GetSplTokenProgramAccount gets the "splTokenProgram" parameter. SPL Token program
func (*RecoverNested) GetWalletAccount ¶
func (obj *RecoverNested) GetWalletAccount() *common.AccountMeta
GetWalletAccount gets the "wallet" parameter. Wallet address for the owner associated token
func (*RecoverNested) GetWalletAssociatedAccountAccount ¶
func (obj *RecoverNested) GetWalletAssociatedAccountAccount() *common.AccountMeta
GetWalletAssociatedAccountAccount gets the "walletAssociatedAccount" parameter. Wallet's associated token account
func (*RecoverNested) MarshalWithEncoder ¶
func (obj *RecoverNested) MarshalWithEncoder(encoder *binary.Encoder) (err error)
func (*RecoverNested) SetMintNataAccount ¶
func (obj *RecoverNested) SetMintNataAccount(mintNata common.PublicKey) *RecoverNested
SetMintNataAccount sets the "mintNata" parameter. Token mint for the nested associated token account
func (*RecoverNested) SetMintOataAccount ¶
func (obj *RecoverNested) SetMintOataAccount(mintOata common.PublicKey) *RecoverNested
SetMintOataAccount sets the "mintOata" parameter. Token mint for the owner associated token account
func (*RecoverNested) SetNestedAssociatedAccountAccount ¶
func (obj *RecoverNested) SetNestedAssociatedAccountAccount(nestedAssociatedAccount common.PublicKey) *RecoverNested
SetNestedAssociatedAccountAccount sets the "nestedAssociatedAccount" parameter. 0. Nested associated token account, must be owned by `3`
func (*RecoverNested) SetNestedAssociatedAccountOwnerAccount ¶
func (obj *RecoverNested) SetNestedAssociatedAccountOwnerAccount(nestedAssociatedAccountOwner common.PublicKey) *RecoverNested
SetNestedAssociatedAccountOwnerAccount sets the "nestedAssociatedAccountOwner" parameter. Owner associated token account address, must be owned by `5`
func (*RecoverNested) SetProgramId ¶
func (obj *RecoverNested) SetProgramId(programId *common.PublicKey) *RecoverNested
func (*RecoverNested) SetSplTokenProgramAccount ¶
func (obj *RecoverNested) SetSplTokenProgramAccount(splTokenProgram common.PublicKey, multiSigners ...common.PublicKey) *RecoverNested
SetSplTokenProgramAccount sets the "splTokenProgram" parameter. SPL Token program
func (*RecoverNested) SetWalletAccount ¶
func (obj *RecoverNested) SetWalletAccount(wallet common.PublicKey) *RecoverNested
SetWalletAccount sets the "wallet" parameter. Wallet address for the owner associated token
func (*RecoverNested) SetWalletAssociatedAccountAccount ¶
func (obj *RecoverNested) SetWalletAssociatedAccountAccount(walletAssociatedAccount common.PublicKey) *RecoverNested
SetWalletAssociatedAccountAccount sets the "walletAssociatedAccount" parameter. Wallet's associated token account
func (*RecoverNested) UnmarshalWithDecoder ¶
func (obj *RecoverNested) UnmarshalWithDecoder(decoder *binary.Decoder) (err error)
func (*RecoverNested) Validate ¶
func (obj *RecoverNested) Validate() error
func (*RecoverNested) ValidateAndBuild ¶
func (obj *RecoverNested) 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.