tokenprog

package
Version: v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2022 License: MIT Imports: 6 Imported by: 2

Documentation

Index

Constants

View Source
const MaxSigners = 11
View Source
const MintAccountSize = 82
View Source
const MultisigAccountSize = 355
View Source
const TokenAccountSize = 165

Variables

View Source
var (
	Some = []byte{1, 0, 0, 0}
	None = []byte{0, 0, 0, 0}
)

Functions

func Approve

func Approve(param ApproveParam) types.Instruction

func ApproveChecked

func ApproveChecked(param ApproveCheckedParam) types.Instruction

func Burn

func Burn(param BurnParam) types.Instruction

func BurnChecked

func BurnChecked(param BurnCheckedParam) types.Instruction

func CloseAccount

func CloseAccount(param CloseAccountParam) types.Instruction

Close an account and transfer its all SOL to dest, only account's token balance is zero can be closed.

func FreezeAccount

func FreezeAccount(param FreezeAccountParam) types.Instruction

func InitializeAccount

func InitializeAccount(param InitializeAccountParam) types.Instruction

InitializeAccount init a token account which can receive token

func InitializeAccount2

func InitializeAccount2(param InitializeAccount2Param) types.Instruction

func InitializeAccount3 added in v1.3.0

func InitializeAccount3(param InitializeAccount3Param) types.Instruction

func InitializeMint

func InitializeMint(param InitializeMintParam) types.Instruction

InitializeMint init a mint, if you don't need to freeze, pass the empty pubKey common.PublicKey{}

func InitializeMint2 added in v1.3.0

func InitializeMint2(param InitializeMint2Param) types.Instruction

func InitializeMultisig

func InitializeMultisig(param InitializeMultisigParam) types.Instruction

func InitializeMultisig2 added in v1.3.0

func InitializeMultisig2(param InitializeMultisig2Param) types.Instruction

func MintTo

func MintTo(param MintToParam) types.Instruction

func MintToChecked

func MintToChecked(param MintToCheckedParam) types.Instruction

func Revoke

func Revoke(param RevokeParam) types.Instruction

func SetAuthority

func SetAuthority(param SetAuthorityParam) types.Instruction

func SyncNative

func SyncNative(param SyncNativeParam) types.Instruction

SyncNative will update your wrapped SOL balance

func ThawAccount

func ThawAccount(param ThawAccountParam) types.Instruction

func Transfer

func Transfer(param TransferParam) types.Instruction

func TransferChecked

func TransferChecked(param TransferCheckedParam) types.Instruction

Types

type ApproveCheckedParam added in v1.9.0

type ApproveCheckedParam struct {
	From     common.PublicKey
	Mint     common.PublicKey
	To       common.PublicKey
	Auth     common.PublicKey
	Signers  []common.PublicKey
	Amount   uint64
	Decimals uint8
}

type ApproveParam added in v1.9.0

type ApproveParam struct {
	From    common.PublicKey
	To      common.PublicKey
	Auth    common.PublicKey
	Signers []common.PublicKey
	Amount  uint64
}

type AuthorityType

type AuthorityType uint8
const (
	AuthorityTypeMintTokens AuthorityType = iota
	AuthorityTypeFreezeAccount
	AuthorityTypeAccountOwner
	AuthorityTypeCloseAccount
)

type BurnCheckedParam added in v1.9.0

type BurnCheckedParam struct {
	Account  common.PublicKey
	Auth     common.PublicKey
	Signers  []common.PublicKey
	Mint     common.PublicKey
	Amount   uint64
	Decimals uint8
}

type BurnParam added in v1.9.0

type BurnParam struct {
	Account common.PublicKey
	Mint    common.PublicKey
	Auth    common.PublicKey
	Signers []common.PublicKey
	Amount  uint64
}

type CloseAccountParam added in v1.9.0

type CloseAccountParam struct {
	Account common.PublicKey
	Auth    common.PublicKey
	Signers []common.PublicKey
	To      common.PublicKey
}

type FreezeAccountParam added in v1.9.0

type FreezeAccountParam struct {
	Account common.PublicKey
	Mint    common.PublicKey
	Auth    common.PublicKey
	Signers []common.PublicKey
}

type InitializeAccount2Param added in v1.9.0

type InitializeAccount2Param struct {
	Account common.PublicKey
	Mint    common.PublicKey
	Owner   common.PublicKey
}

type InitializeAccount3Param added in v1.9.0

type InitializeAccount3Param struct {
	Account common.PublicKey
	Mint    common.PublicKey
	Owner   common.PublicKey
}

type InitializeAccountParam added in v1.9.0

type InitializeAccountParam struct {
	Account common.PublicKey
	Mint    common.PublicKey
	Owner   common.PublicKey
}

type InitializeMint2Param added in v1.9.0

type InitializeMint2Param struct {
	Decimals   uint8
	Mint       common.PublicKey
	MintAuth   common.PublicKey
	FreezeAuth *common.PublicKey
}

type InitializeMintParam added in v1.9.0

type InitializeMintParam struct {
	Decimals   uint8
	Mint       common.PublicKey
	MintAuth   common.PublicKey
	FreezeAuth *common.PublicKey
}

type InitializeMultisig2Param added in v1.9.0

type InitializeMultisig2Param struct {
	Account     common.PublicKey
	Signers     []common.PublicKey
	MinRequired uint8
}

type InitializeMultisigParam added in v1.9.0

type InitializeMultisigParam struct {
	Account     common.PublicKey
	Signers     []common.PublicKey
	MinRequired uint8
}

type Instruction

type Instruction uint8
const (
	InstructionInitializeMint Instruction = iota
	InstructionInitializeAccount
	InstructionInitializeMultisig
	InstructionTransfer
	InstructionApprove
	InstructionRevoke
	InstructionSetAuthority
	InstructionMintTo
	InstructionBurn
	InstructionCloseAccount
	InstructionFreezeAccount
	InstructionThawAccount
	InstructionTransferChecked
	InstructionApproveChecked
	InstructionMintToChecked
	InstructionBurnChecked
	InstructionInitializeAccount2
	InstructionSyncNative
	InstructionInitializeAccount3
	InstructionInitializeMultisig2
	InstructionInitializeMint2
)

type MintAccount

type MintAccount struct {
	MintAuthority   *common.PublicKey
	Supply          uint64
	Decimals        uint8
	IsInitialized   bool
	FreezeAuthority *common.PublicKey
}

func MintAccountFromData added in v1.9.0

func MintAccountFromData(data []byte) (MintAccount, error)

type MintToCheckedParam added in v1.9.0

type MintToCheckedParam struct {
	Mint     common.PublicKey
	Auth     common.PublicKey
	Signers  []common.PublicKey
	To       common.PublicKey
	Amount   uint64
	Decimals uint8
}

type MintToParam added in v1.9.0

type MintToParam struct {
	Mint    common.PublicKey
	To      common.PublicKey
	Auth    common.PublicKey
	Signers []common.PublicKey
	Amount  uint64
}

type MultisigAccount added in v1.9.0

type MultisigAccount struct {
	M             uint8 // Number of signers required
	N             uint8 // Number of valid signers
	IsInitialized bool
	Signers       []common.PublicKey
}

func MultisigAccountFromData added in v1.9.0

func MultisigAccountFromData(data []byte) (MultisigAccount, error)

type RevokeParam added in v1.9.0

type RevokeParam struct {
	From    common.PublicKey
	Auth    common.PublicKey
	Signers []common.PublicKey
}

type SetAuthorityParam added in v1.9.0

type SetAuthorityParam struct {
	Account  common.PublicKey
	NewAuth  *common.PublicKey
	AuthType AuthorityType
	Auth     common.PublicKey
	Signers  []common.PublicKey
}

type SyncNativeParam added in v1.9.0

type SyncNativeParam struct {
	Account common.PublicKey
}

type ThawAccountParam added in v1.9.0

type ThawAccountParam struct {
	Account common.PublicKey
	Mint    common.PublicKey
	Auth    common.PublicKey
	Signers []common.PublicKey
}

type TokenAccount

type TokenAccount struct {
	Mint     common.PublicKey
	Owner    common.PublicKey
	Amount   uint64
	Delegate *common.PublicKey
	State    TokenAccountState
	// if is wrapped SOL, IsNative is the rent-exempt value
	IsNative        *uint64
	DelegatedAmount uint64
	CloseAuthority  *common.PublicKey
}

TokenAccount is token program account

func TokenAccountFromData

func TokenAccountFromData(data []byte) (TokenAccount, error)

type TokenAccountState

type TokenAccountState uint8
const (
	TokenAccountStateUninitialized TokenAccountState = iota
	TokenAccountStateInitialized
	TokenAccountFrozen
)

type TransferCheckedParam added in v1.9.0

type TransferCheckedParam struct {
	From     common.PublicKey
	To       common.PublicKey
	Mint     common.PublicKey
	Auth     common.PublicKey
	Signers  []common.PublicKey
	Amount   uint64
	Decimals uint8
}

type TransferParam added in v1.9.0

type TransferParam struct {
	From    common.PublicKey
	To      common.PublicKey
	Auth    common.PublicKey
	Signers []common.PublicKey
	Amount  uint64
}

Jump to

Keyboard shortcuts

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