token_group

package
v0.0.0-...-fac452d Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const ProgramName = "token_group"
View Source
const TOKEN_GROUP_MEMBER_SIZE = 68
View Source
const TOKEN_GROUP_SIZE = 72

Variables

View Source
var (
	Instruction_Initialize           = binary.TypeID([8]byte{121, 113, 108, 39, 54, 51, 0, 4})
	Instruction_UpdateGroupMaxSize   = binary.TypeID([8]byte{108, 37, 171, 143, 248, 30, 18, 110})
	Instruction_UpdateGroupAuthority = binary.TypeID([8]byte{161, 105, 88, 1, 237, 221, 216, 203})
	Instruction_InitializeMember     = binary.TypeID([8]byte{152, 32, 222, 176, 223, 237, 116, 134})
)
View Source
var InstructionImplDef = binary.NewVariantDefinition(binary.AnchorTypeIDEncoding, []binary.VariantType{
	{
		"initialize", (*Initialize)(nil),
	},
	{
		"update_group_max_size", (*UpdateGroupMaxSize)(nil),
	},
	{
		"update_group_authority", (*UpdateGroupAuthority)(nil),
	},
	{
		"initialize_member", (*InitializeMember)(nil),
	},
})
View Source
var ProgramID common.PublicKey = common.MustPublicKeyFromBase58("11111111111111111111111111111111")
View Source
var TokenGroupDiscriminator = [8]byte{214, 15, 63, 132, 49, 119, 209, 40}

TokenGroupDiscriminator DETERMINANT: spl_token_group_interface:group

View Source
var TokenGroupMemberDiscriminator = [8]byte{254, 50, 168, 134, 88, 126, 100, 186}

TokenGroupMemberDiscriminator DETERMINANT: spl_token_group_interface:member

Functions

func InstructionIDToName

func InstructionIDToName(id binary.TypeID) string

InstructionIDToName returns the name of the instruction given its ID.

func SetProgramID

func SetProgramID(pubkey common.PublicKey)

Types

type ImmutableGroupError

type ImmutableGroupError struct{}

ImmutableGroupError Error: 2 `Group is immutable`

func (ImmutableGroupError) Code

func (e ImmutableGroupError) Code() int

func (ImmutableGroupError) Error

func (e ImmutableGroupError) Error() string

type IncorrectMintAuthorityError

type IncorrectMintAuthorityError struct{}

IncorrectMintAuthorityError Error: 3 `Incorrect mint authority has signed the instruction`

func (IncorrectMintAuthorityError) Code

func (IncorrectMintAuthorityError) Error

type IncorrectUpdateAuthorityError

type IncorrectUpdateAuthorityError struct{}

IncorrectUpdateAuthorityError Error: 4 `Incorrect update authority has signed the instruction`

func (IncorrectUpdateAuthorityError) Code

func (IncorrectUpdateAuthorityError) Error

type Initialize

type Initialize struct {
	// Update authority for the group
	UpdateAuthority *common.PublicKey
	// The maximum number of group members
	MaxSize *uint32
	// [0] = [WRITE] group “
	// [1] = [] mint “
	// [2] = [SIGNER] mintAuthority “
	common.AccountMetaSlice `bin:"-"`
	// contains filtered or unexported fields
}

Initialize Instruction

func NewInitializeInstruction

func NewInitializeInstruction(
	updateAuthority common.PublicKey,
	maxSize uint32,
	group common.PublicKey,
	mint common.PublicKey,
	mintAuthority common.PublicKey,
) *Initialize

NewInitializeInstruction

Parameters:

updateAuthority: Update authority for the group
maxSize: The maximum number of group members
group:
mint:
mintAuthority:

func NewInitializeInstructionBuilder

func NewInitializeInstructionBuilder() *Initialize

NewInitializeInstructionBuilder creates a new `Initialize` instruction builder.

func (*Initialize) Build

func (obj *Initialize) Build() *Instruction

func (*Initialize) EncodeToTree

func (obj *Initialize) EncodeToTree(parent treeout.Branches)

func (*Initialize) GetGroupAccount

func (obj *Initialize) GetGroupAccount() *common.AccountMeta

GetGroupAccount gets the "group" parameter.

func (*Initialize) GetMintAccount

func (obj *Initialize) GetMintAccount() *common.AccountMeta

GetMintAccount gets the "mint" parameter.

func (*Initialize) GetMintAuthorityAccount

func (obj *Initialize) GetMintAuthorityAccount() *common.AccountMeta

GetMintAuthorityAccount gets the "mintAuthority" parameter.

func (*Initialize) MarshalWithEncoder

func (obj *Initialize) MarshalWithEncoder(encoder *binary.Encoder) (err error)

func (*Initialize) SetGroupAccount

func (obj *Initialize) SetGroupAccount(group common.PublicKey) *Initialize

SetGroupAccount sets the "group" parameter.

func (*Initialize) SetMaxSize

func (obj *Initialize) SetMaxSize(maxSize uint32) *Initialize

SetMaxSize sets the "maxSize" parameter.

func (*Initialize) SetMintAccount

func (obj *Initialize) SetMintAccount(mint common.PublicKey) *Initialize

SetMintAccount sets the "mint" parameter.

func (*Initialize) SetMintAuthorityAccount

func (obj *Initialize) SetMintAuthorityAccount(mintAuthority common.PublicKey, multiSigners ...common.PublicKey) *Initialize

SetMintAuthorityAccount sets the "mintAuthority" parameter.

func (*Initialize) SetProgramId

func (obj *Initialize) SetProgramId(programId *common.PublicKey) *Initialize

func (*Initialize) SetUpdateAuthority

func (obj *Initialize) SetUpdateAuthority(updateAuthority common.PublicKey) *Initialize

SetUpdateAuthority sets the "updateAuthority" parameter.

func (*Initialize) UnmarshalWithDecoder

func (obj *Initialize) UnmarshalWithDecoder(decoder *binary.Decoder) (err error)

func (*Initialize) Validate

func (obj *Initialize) Validate() error

func (*Initialize) ValidateAndBuild

func (obj *Initialize) 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 InitializeMember

type InitializeMember struct {
	// [0] = [WRITE] member `Group`
	// [1] = [] memberMint `Member mint`
	// [2] = [SIGNER] memberMintAuthority `Member mint authority`
	// [3] = [WRITE] group `Group`
	// [4] = [SIGNER] groupUpdateAuthority `Group update authority`
	common.AccountMetaSlice `bin:"-"`
	// contains filtered or unexported fields
}

InitializeMember Instruction

func NewInitializeMemberInstruction

func NewInitializeMemberInstruction(
	member common.PublicKey,
	memberMint common.PublicKey,
	memberMintAuthority common.PublicKey,
	group common.PublicKey,
	groupUpdateAuthority common.PublicKey,
) *InitializeMember

NewInitializeMemberInstruction

Parameters:

member: Group
memberMint: Member mint
memberMintAuthority: Member mint authority
group: Group
groupUpdateAuthority: Group update authority

func NewInitializeMemberInstructionBuilder

func NewInitializeMemberInstructionBuilder() *InitializeMember

NewInitializeMemberInstructionBuilder creates a new `InitializeMember` instruction builder.

func (*InitializeMember) Build

func (obj *InitializeMember) Build() *Instruction

func (*InitializeMember) EncodeToTree

func (obj *InitializeMember) EncodeToTree(parent treeout.Branches)

func (*InitializeMember) GetGroupAccount

func (obj *InitializeMember) GetGroupAccount() *common.AccountMeta

GetGroupAccount gets the "group" parameter. Group

func (*InitializeMember) GetGroupUpdateAuthorityAccount

func (obj *InitializeMember) GetGroupUpdateAuthorityAccount() *common.AccountMeta

GetGroupUpdateAuthorityAccount gets the "groupUpdateAuthority" parameter. Group update authority

func (*InitializeMember) GetMemberAccount

func (obj *InitializeMember) GetMemberAccount() *common.AccountMeta

GetMemberAccount gets the "member" parameter. Group

func (*InitializeMember) GetMemberMintAccount

func (obj *InitializeMember) GetMemberMintAccount() *common.AccountMeta

GetMemberMintAccount gets the "memberMint" parameter. Member mint

func (*InitializeMember) GetMemberMintAuthorityAccount

func (obj *InitializeMember) GetMemberMintAuthorityAccount() *common.AccountMeta

GetMemberMintAuthorityAccount gets the "memberMintAuthority" parameter. Member mint authority

func (*InitializeMember) MarshalWithEncoder

func (obj *InitializeMember) MarshalWithEncoder(encoder *binary.Encoder) (err error)

func (*InitializeMember) SetGroupAccount

func (obj *InitializeMember) SetGroupAccount(group common.PublicKey) *InitializeMember

SetGroupAccount sets the "group" parameter. Group

func (*InitializeMember) SetGroupUpdateAuthorityAccount

func (obj *InitializeMember) SetGroupUpdateAuthorityAccount(groupUpdateAuthority common.PublicKey, multiSigners ...common.PublicKey) *InitializeMember

SetGroupUpdateAuthorityAccount sets the "groupUpdateAuthority" parameter. Group update authority

func (*InitializeMember) SetMemberAccount

func (obj *InitializeMember) SetMemberAccount(member common.PublicKey) *InitializeMember

SetMemberAccount sets the "member" parameter. Group

func (*InitializeMember) SetMemberMintAccount

func (obj *InitializeMember) SetMemberMintAccount(memberMint common.PublicKey) *InitializeMember

SetMemberMintAccount sets the "memberMint" parameter. Member mint

func (*InitializeMember) SetMemberMintAuthorityAccount

func (obj *InitializeMember) SetMemberMintAuthorityAccount(memberMintAuthority common.PublicKey) *InitializeMember

SetMemberMintAuthorityAccount sets the "memberMintAuthority" parameter. Member mint authority

func (*InitializeMember) SetProgramId

func (obj *InitializeMember) SetProgramId(programId *common.PublicKey) *InitializeMember

func (*InitializeMember) UnmarshalWithDecoder

func (obj *InitializeMember) UnmarshalWithDecoder(decoder *binary.Decoder) (err error)

func (*InitializeMember) Validate

func (obj *InitializeMember) Validate() error

func (*InitializeMember) ValidateAndBuild

func (obj *InitializeMember) 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 (obj *Instruction) TextEncode(encoder *text.Encoder, option *text.Option) error

func (*Instruction) UnmarshalWithDecoder

func (obj *Instruction) UnmarshalWithDecoder(decoder *binary.Decoder) error

type MemberAccountIsGroupAccountError

type MemberAccountIsGroupAccountError struct{}

MemberAccountIsGroupAccountError Error: 5 `Member account should not be the same as the group account`

func (MemberAccountIsGroupAccountError) Code

func (MemberAccountIsGroupAccountError) Error

type ProgramError

type ProgramError interface {
	Code() int
	Error() string
}

func GetTokenGroupErrorFromCode

func GetTokenGroupErrorFromCode(code int) ProgramError

func GetTokenGroupErrorFromName

func GetTokenGroupErrorFromName(name string) ProgramError

type SizeExceedsMaxSizeError

type SizeExceedsMaxSizeError struct{}

SizeExceedsMaxSizeError Error: 1 `Size is greater than max size`

func (SizeExceedsMaxSizeError) Code

func (e SizeExceedsMaxSizeError) Code() int

func (SizeExceedsMaxSizeError) Error

func (e SizeExceedsMaxSizeError) Error() string

type SizeExceedsNewMaxSizeError

type SizeExceedsNewMaxSizeError struct{}

SizeExceedsNewMaxSizeError Error: 0 `Size is greater than proposed max size`

func (SizeExceedsNewMaxSizeError) Code

func (SizeExceedsNewMaxSizeError) Error

type TokenGroup

type TokenGroup struct {
	// The authority that can sign to update the group
	UpdateAuthority common.PublicKey
	// The associated mint, used to counter spoofing to be sure that group
	// belongs to a particular mint
	Mint common.PublicKey
	// The current number of group members
	Size uint32
	// The maximum number of group members
	MaxSize uint32
}

TokenGroup Struct Data struct for a `TokenGroup` DETERMINANT: spl_token_group_interface:group

func (*TokenGroup) MarshalWithEncoder

func (obj *TokenGroup) MarshalWithEncoder(encoder *binary.Encoder) (err error)

func (*TokenGroup) UnmarshalWithDecoder

func (obj *TokenGroup) UnmarshalWithDecoder(decoder *binary.Decoder) (err error)

type TokenGroupMember

type TokenGroupMember struct {
	// The associated mint, used to counter spoofing to be sure that member
	// belongs to a particular mint
	Mint common.PublicKey
	// The pubkey of the `TokenGroup`
	Group common.PublicKey
	// The member number
	MemberNumber uint32
}

TokenGroupMember Struct Data struct for a `TokenGroupMember` DETERMINANT: spl_token_group_interface:member

func (*TokenGroupMember) MarshalWithEncoder

func (obj *TokenGroupMember) MarshalWithEncoder(encoder *binary.Encoder) (err error)

func (*TokenGroupMember) UnmarshalWithDecoder

func (obj *TokenGroupMember) UnmarshalWithDecoder(decoder *binary.Decoder) (err error)

type UpdateGroupAuthority

type UpdateGroupAuthority struct {
	// New authority for the group, or unset if `None`
	NewAuthority *common.PublicKey
	// [0] = [WRITE] group `Group`
	// [1] = [SIGNER] updateAuthority `Current update authority`
	common.AccountMetaSlice `bin:"-"`
	// contains filtered or unexported fields
}

UpdateGroupAuthority Instruction

func NewUpdateGroupAuthorityInstruction

func NewUpdateGroupAuthorityInstruction(
	newAuthority common.PublicKey,
	group common.PublicKey,
	updateAuthority common.PublicKey,
) *UpdateGroupAuthority

NewUpdateGroupAuthorityInstruction

Parameters:

newAuthority: New authority for the group, or unset if `None`
group: Group
updateAuthority: Current update authority

func NewUpdateGroupAuthorityInstructionBuilder

func NewUpdateGroupAuthorityInstructionBuilder() *UpdateGroupAuthority

NewUpdateGroupAuthorityInstructionBuilder creates a new `UpdateGroupAuthority` instruction builder.

func (*UpdateGroupAuthority) Build

func (obj *UpdateGroupAuthority) Build() *Instruction

func (*UpdateGroupAuthority) EncodeToTree

func (obj *UpdateGroupAuthority) EncodeToTree(parent treeout.Branches)

func (*UpdateGroupAuthority) GetGroupAccount

func (obj *UpdateGroupAuthority) GetGroupAccount() *common.AccountMeta

GetGroupAccount gets the "group" parameter. Group

func (*UpdateGroupAuthority) GetUpdateAuthorityAccount

func (obj *UpdateGroupAuthority) GetUpdateAuthorityAccount() *common.AccountMeta

GetUpdateAuthorityAccount gets the "updateAuthority" parameter. Current update authority

func (*UpdateGroupAuthority) MarshalWithEncoder

func (obj *UpdateGroupAuthority) MarshalWithEncoder(encoder *binary.Encoder) (err error)

func (*UpdateGroupAuthority) SetGroupAccount

func (obj *UpdateGroupAuthority) SetGroupAccount(group common.PublicKey) *UpdateGroupAuthority

SetGroupAccount sets the "group" parameter. Group

func (*UpdateGroupAuthority) SetNewAuthority

func (obj *UpdateGroupAuthority) SetNewAuthority(newAuthority common.PublicKey) *UpdateGroupAuthority

SetNewAuthority sets the "newAuthority" parameter.

func (*UpdateGroupAuthority) SetProgramId

func (obj *UpdateGroupAuthority) SetProgramId(programId *common.PublicKey) *UpdateGroupAuthority

func (*UpdateGroupAuthority) SetUpdateAuthorityAccount

func (obj *UpdateGroupAuthority) SetUpdateAuthorityAccount(updateAuthority common.PublicKey, multiSigners ...common.PublicKey) *UpdateGroupAuthority

SetUpdateAuthorityAccount sets the "updateAuthority" parameter. Current update authority

func (*UpdateGroupAuthority) UnmarshalWithDecoder

func (obj *UpdateGroupAuthority) UnmarshalWithDecoder(decoder *binary.Decoder) (err error)

func (*UpdateGroupAuthority) Validate

func (obj *UpdateGroupAuthority) Validate() error

func (*UpdateGroupAuthority) ValidateAndBuild

func (obj *UpdateGroupAuthority) 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 UpdateGroupMaxSize

type UpdateGroupMaxSize struct {
	// New max size for the group
	MaxSize *uint32
	// [0] = [WRITE] group `Group`
	// [1] = [SIGNER] updateAuthority `Update authority`
	common.AccountMetaSlice `bin:"-"`
	// contains filtered or unexported fields
}

UpdateGroupMaxSize Instruction

func NewUpdateGroupMaxSizeInstruction

func NewUpdateGroupMaxSizeInstruction(
	maxSize uint32,
	group common.PublicKey,
	updateAuthority common.PublicKey,
) *UpdateGroupMaxSize

NewUpdateGroupMaxSizeInstruction

Parameters:

maxSize: New max size for the group
group: Group
updateAuthority: Update authority

func NewUpdateGroupMaxSizeInstructionBuilder

func NewUpdateGroupMaxSizeInstructionBuilder() *UpdateGroupMaxSize

NewUpdateGroupMaxSizeInstructionBuilder creates a new `UpdateGroupMaxSize` instruction builder.

func (*UpdateGroupMaxSize) Build

func (obj *UpdateGroupMaxSize) Build() *Instruction

func (*UpdateGroupMaxSize) EncodeToTree

func (obj *UpdateGroupMaxSize) EncodeToTree(parent treeout.Branches)

func (*UpdateGroupMaxSize) GetGroupAccount

func (obj *UpdateGroupMaxSize) GetGroupAccount() *common.AccountMeta

GetGroupAccount gets the "group" parameter. Group

func (*UpdateGroupMaxSize) GetUpdateAuthorityAccount

func (obj *UpdateGroupMaxSize) GetUpdateAuthorityAccount() *common.AccountMeta

GetUpdateAuthorityAccount gets the "updateAuthority" parameter. Update authority

func (*UpdateGroupMaxSize) MarshalWithEncoder

func (obj *UpdateGroupMaxSize) MarshalWithEncoder(encoder *binary.Encoder) (err error)

func (*UpdateGroupMaxSize) SetGroupAccount

func (obj *UpdateGroupMaxSize) SetGroupAccount(group common.PublicKey) *UpdateGroupMaxSize

SetGroupAccount sets the "group" parameter. Group

func (*UpdateGroupMaxSize) SetMaxSize

func (obj *UpdateGroupMaxSize) SetMaxSize(maxSize uint32) *UpdateGroupMaxSize

SetMaxSize sets the "maxSize" parameter.

func (*UpdateGroupMaxSize) SetProgramId

func (obj *UpdateGroupMaxSize) SetProgramId(programId *common.PublicKey) *UpdateGroupMaxSize

func (*UpdateGroupMaxSize) SetUpdateAuthorityAccount

func (obj *UpdateGroupMaxSize) SetUpdateAuthorityAccount(updateAuthority common.PublicKey, multiSigners ...common.PublicKey) *UpdateGroupMaxSize

SetUpdateAuthorityAccount sets the "updateAuthority" parameter. Update authority

func (*UpdateGroupMaxSize) UnmarshalWithDecoder

func (obj *UpdateGroupMaxSize) UnmarshalWithDecoder(decoder *binary.Decoder) (err error)

func (*UpdateGroupMaxSize) Validate

func (obj *UpdateGroupMaxSize) Validate() error

func (*UpdateGroupMaxSize) ValidateAndBuild

func (obj *UpdateGroupMaxSize) 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