token

package
v3.6.2 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2023 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InitializeMintTypeID uint32 = iota
	TransferTypeID              = 3 // 3
	SetAuthorityTypeID          = 6 // 6
	MintToTypeID                = 7 // 7
	BurnTypeID                  = 8 // 8
	CloseAccountTypeID          = 9 // 9
)

typeID constants

Variables

View Source
var InstructionDefVariant = bin.NewVariantDefinition(bin.Uint8TypeIDEncoding, []bin.VariantType{
	{Name: "initialize_mint", Type: (*InitializeMint)(nil)},
	{Name: "initialize_account", Type: (*InitializeAccount)(nil)},
	{Name: "InitializeMultisig", Type: (*InitializeMultisig)(nil)},
	{Name: "Transfer", Type: (*Transfer)(nil)},
	{Name: "Approve", Type: (*Approve)(nil)},
	{Name: "Revoke", Type: (*Revoke)(nil)},
	{Name: "SetAuthority", Type: (*SetAuthority)(nil)},
	{Name: "MintTo", Type: (*MintTo)(nil)},
	{Name: "Burn", Type: (*Burn)(nil)},
	{Name: "CloseAccount", Type: (*CloseAccount)(nil)},
	{Name: "FreezeAccount", Type: (*FreezeAccount)(nil)},
	{Name: "ThawAccount", Type: (*ThawAccount)(nil)},
	{Name: "TransferChecked", Type: (*TransferChecked)(nil)},
	{Name: "ApproveChecked", Type: (*ApproveChecked)(nil)},
	{Name: "MintToChecked", Type: (*MintToChecked)(nil)},
	{Name: "BurnChecked", Type: (*BurnChecked)(nil)},
})

InstructionDefVariant default variant

View Source
var (
	TokenProgramID = types.MustPublicKeyFromBase58("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA")
)

programID contants

Functions

This section is empty.

Types

type Approve

type Approve struct {
	Accounts *ApproveAccounts
}

Approve type

type ApproveAccounts

type ApproveAccounts struct {
}

ApproveAccounts type

type ApproveChecked

type ApproveChecked struct {
	Accounts *ApproveCheckedAccounts
}

ApproveChecked type

type ApproveCheckedAccounts

type ApproveCheckedAccounts struct {
}

ApproveCheckedAccounts type

type AuthorityType

type AuthorityType byte

AuthorityType type

const (
	MintTokensAuthorityType AuthorityType = iota
	FreezeAccountAuthorityType
	AccountOwnerAuthorityType
	CloseAccountAuthorityType
)

AuthorityType constants

type Burn

type Burn struct {
	Amount   uint64
	Accounts *BurnAccounts
}

Burn type

type BurnAccounts

type BurnAccounts struct {
	Account *types.AccountMeta
	Mint    *types.AccountMeta
	Owner   *types.AccountMeta
}

BurnAccounts type

type BurnChecked

type BurnChecked struct {
	Accounts *BurnCheckedAccounts
}

BurnChecked type

type BurnCheckedAccounts

type BurnCheckedAccounts struct {
}

BurnCheckedAccounts type

type CloseAccount

type CloseAccount struct {
	Accounts *CloseAccountAccounts
}

CloseAccount type

type CloseAccountAccounts

type CloseAccountAccounts struct {
	Account    *types.AccountMeta
	Desination *types.AccountMeta
	Owner      *types.AccountMeta
}

CloseAccountAccounts type

type FreezeAccount

type FreezeAccount struct {
	Accounts *FreezeAccountAccounts
}

FreezeAccount type

type FreezeAccountAccounts

type FreezeAccountAccounts struct {
}

FreezeAccountAccounts type

type InitializeAccount

type InitializeAccount struct {
	Accounts *InitializeAccountAccounts `bin:"-"`
}

InitializeAccount type

func (*InitializeAccount) SetAccounts

func (i *InitializeAccount) SetAccounts(accounts []*types.AccountMeta) error

SetAccounts set accounts

type InitializeAccountAccounts

type InitializeAccountAccounts struct {
	Account    *types.AccountMeta `text:"linear,notype"`
	Mint       *types.AccountMeta `text:"linear,notype"`
	Owner      *types.AccountMeta `text:"linear,notype"`
	RentSysvar *types.AccountMeta `text:"linear,notype"`
}

InitializeAccountAccounts type

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 types.PublicKey
	Option        uint8
	/// The freeze authority/multisignature of the mint.
	FreezeAuthority *types.PublicKey
	Accounts        *InitializeMintAccounts `bin:"-"`
}

InitializeMint type

func (*InitializeMint) SetAccounts

func (i *InitializeMint) SetAccounts(accounts []*types.AccountMeta) error

SetAccounts set accounts

type InitializeMintAccounts

type InitializeMintAccounts struct {
	Mint        *types.AccountMeta
	RentProgram *types.AccountMeta
}

InitializeMintAccounts type

type InitializeMultisig

type InitializeMultisig struct {
	Accounts *InitializeMultisigAccounts
}

InitializeMultisig type

type InitializeMultisigAccounts

type InitializeMultisigAccounts struct {
}

InitializeMultisigAccounts type

type Instruction

type Instruction struct {
	bin.BaseVariant
}

Instruction type

func DecodeInstruction

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

DecodeInstruction decode instruction

func NewBurnToInstruction

func NewBurnToInstruction(
	amount uint64,
	account types.PublicKey,
	mint types.PublicKey,
	owner types.PublicKey,
) *Instruction

NewBurnToInstruction new MintTo instruction

func NewCloseAccountInstruction

func NewCloseAccountInstruction(
	account types.PublicKey,
	destination types.PublicKey,
	owner types.PublicKey,
) *Instruction

NewCloseAccountInstruction new CloseAccount instruction

func NewInitializeMintInstruction

func NewInitializeMintInstruction(
	decimals uint8,
	mint types.PublicKey,
	mintAuthority types.PublicKey,
	freezeAuthority *types.PublicKey,
	rentProgram types.PublicKey,
) *Instruction

NewInitializeMintInstruction new InitializeMint instruction

func NewMintToInstruction

func NewMintToInstruction(
	amount uint64,
	mint types.PublicKey,
	account types.PublicKey,
	minter types.PublicKey,
) *Instruction

NewMintToInstruction new MintTo instruction

func NewSetAuthorityInstruction

func NewSetAuthorityInstruction(
	account types.PublicKey,
	newAuthority types.PublicKey,
	authorityType AuthorityType,
	currentAuthority types.PublicKey,
) *Instruction

NewSetAuthorityInstruction new SetAuthority instruction

func NewTransferInstruction

func NewTransferInstruction(
	amount uint64,
	source types.PublicKey,
	destination types.PublicKey,
	from types.PublicKey,
) *Instruction

NewTransferInstruction new Transfer instruction

func (*Instruction) Accounts

func (i *Instruction) Accounts() (out []*types.AccountMeta)

Accounts get accounts

func (*Instruction) Data

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

Data get data

func (*Instruction) MarshalBinary

func (i *Instruction) MarshalBinary(encoder *bin.Encoder) error

MarshalBinary marshal binary

func (*Instruction) ProgramID

func (i *Instruction) ProgramID() types.PublicKey

ProgramID get proram ID

func (*Instruction) UnmarshalBinary

func (i *Instruction) UnmarshalBinary(decoder *bin.Decoder) (err error)

UnmarshalBinary unmarshal binary

type MintTo

type MintTo struct {
	Amount   uint64
	Accounts *MintToAccounts
}

MintTo type

type MintToAccounts

type MintToAccounts struct {
	Mint    *types.AccountMeta
	Account *types.AccountMeta
	Minter  *types.AccountMeta
}

MintToAccounts type

type MintToChecked

type MintToChecked struct {
	Accounts *MintToCheckedAccounts
}

MintToChecked type

type MintToCheckedAccounts

type MintToCheckedAccounts struct {
}

MintToCheckedAccounts type

type Revoke

type Revoke struct {
	Accounts *RevokeAccounts
}

Revoke type

type RevokeAccounts

type RevokeAccounts struct {
}

RevokeAccounts type

type SetAuthority

type SetAuthority struct {
	AuthorityType   AuthorityType
	NewAuthorityKey types.PublicKey       `bin:"optional"`
	Accounts        *SetAuthorityAccounts `bin:"-"`
}

SetAuthority type

type SetAuthorityAccounts

type SetAuthorityAccounts struct {
	Account          *types.AccountMeta
	CurrentAuthority *types.AccountMeta
}

SetAuthorityAccounts type

type ThawAccount

type ThawAccount struct {
	Accounts *ThawAccountAccounts
}

ThawAccount type

type ThawAccountAccounts

type ThawAccountAccounts struct {
}

ThawAccountAccounts type

type Transfer

type Transfer struct {
	Amount   uint64
	Accounts *TransferAccounts
}

Transfer transfer type

type TransferAccounts

type TransferAccounts struct {
	Source      *types.AccountMeta
	Destination *types.AccountMeta
	From        *types.AccountMeta
}

TransferAccounts type

type TransferChecked

type TransferChecked struct {
	Accounts *TransferCheckedAccounts
}

TransferChecked type

type TransferCheckedAccounts

type TransferCheckedAccounts struct {
}

TransferCheckedAccounts type

Jump to

Keyboard shortcuts

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