token

package
v0.8.1 Latest Latest
Warning

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

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

Documentation

Overview

Code generated by rice embed-go; DO NOT EDIT.

Index

Constants

View Source
const ACCOUNT_SIZE = 165
View Source
const MINT_SIZE = 82

Variables

View Source
var InstructionDefVariant = bin.NewVariantDefinition(bin.Uint8TypeIDEncoding, []bin.VariantType{
	{"initialize_mint", (*InitializeMint)(nil)},
	{"initialize_account", (*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)},
})
View Source
var PROGRAM_ID = solana.MustPublicKeyFromBase58("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA")

Functions

func DoCloseAccount

func DoCloseAccount(ctx context.Context, rpcCli *rpc.Client, wsCli *ws.Client, account, destination, owner solana.PublicKey, sender *solana.Account) (string, error)

func TransferToken

func TransferToken(ctx context.Context, rpcCli *rpc.Client, wsCli *ws.Client, amount uint64, senderSPLTokenAccount, mint, recipient solana.PublicKey, sender *solana.Account) (solana.PublicKey, string, error)

Types

type Account

type Account struct {
	Key             solana.PublicKey `bin:"-"`
	Mint            solana.PublicKey
	Owner           solana.PublicKey
	Amount          bin.Uint64
	IsDelegateSet   uint32
	Delegate        solana.PublicKey
	IsInitialized   bool
	IsNative        bool
	Padding         [2]byte `json:"-"`
	DelegatedAmount bin.Uint64
}

func FetchAccountHolders

func FetchAccountHolders(ctx context.Context, rpcCli *rpc.Client, mint solana.PublicKey) (out []*Account, err error)

func FetchAccountsForOwner

func FetchAccountsForOwner(ctx context.Context, rpcCli *rpc.Client, owner solana.PublicKey) (out []*Account, err error)

func (*Account) Decode

func (a *Account) Decode(key solana.PublicKey, in []byte) error

type Approve

type Approve struct {
	Accounts *ApproveAccounts
}

type ApproveAccounts

type ApproveAccounts struct {
}

type ApproveChecked

type ApproveChecked struct {
	Accounts *ApproveCheckedAccounts
}

type ApproveCheckedAccounts

type ApproveCheckedAccounts struct {
}

type AuthorityType

type AuthorityType byte
const (
	MintTokensAuthorityType AuthorityType = iota
	FreezeAccountAuthorityType
	AccountOwnerAuthorityType
	CloseAccountAuthorityType
)

type Burn

type Burn struct {
	Accounts *BurnAccounts
}

type BurnAccounts

type BurnAccounts struct {
}

type BurnChecked

type BurnChecked struct {
	Accounts *BurnCheckedAccounts
}

type BurnCheckedAccounts

type BurnCheckedAccounts struct {
}

type CloseAccount

type CloseAccount struct {
	Accounts *CloseAccountAccounts
}

type CloseAccountAccounts

type CloseAccountAccounts struct {
	Account     *solana.AccountMeta
	Destination *solana.AccountMeta
	Owner       *solana.AccountMeta
}

type FreezeAccount

type FreezeAccount struct {
	Accounts *FreezeAccountAccounts
}

type FreezeAccountAccounts

type FreezeAccountAccounts struct {
}

type InitializeAccount

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

func (*InitializeAccount) SetAccounts

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

type InitializeAccountAccounts

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

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

func (*InitializeMint) SetAccounts

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

type InitializeMintAccounts

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

type InitializeMultisig

type InitializeMultisig struct {
	Accounts *InitializeMultisigAccounts
}

type InitializeMultisigAccounts

type InitializeMultisigAccounts struct {
}

type Instruction

type Instruction struct {
	bin.BaseVariant
}

func DecodeInstruction

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

func NewCloseAccount

func NewCloseAccount(
	account solana.PublicKey,
	destination solana.PublicKey,
	owner solana.PublicKey,
) *Instruction

func NewInitializeMintInstruction

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

func NewMintTo

func NewMintTo(
	Amount uint64,
	Mint solana.PublicKey,
	Account solana.PublicKey,
	MintAuthority solana.PublicKey,
) *Instruction

func NewSetAuthorityInstruction

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

func NewTransferInstruction

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

func (*Instruction) Accounts

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

func (*Instruction) Data

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

func (*Instruction) MarshalBinary

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

func (*Instruction) ProgramID

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

func (*Instruction) TextEncode

func (i *Instruction) TextEncode(encoder *text.Encoder, option *text.Option) error

func (*Instruction) UnmarshalBinary

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

type Mint

type Mint struct {
	MintAuthorityOption   uint32
	MintAuthority         solana.PublicKey
	Supply                bin.Uint64
	Decimals              uint8
	IsInitialized         bool
	FreezeAuthorityOption uint32
	FreezeAuthority       solana.PublicKey
}

func FetchMints

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

func (*Mint) Decode

func (m *Mint) Decode(in []byte) error

type MintMeta

type MintMeta struct {
	TokenSymbol string
	MintAddress solana.PublicKey
	TokenName   string
	IconURL     string `json:"icon"`
}

type MintTo

type MintTo struct {
	Amount   uint64
	Accounts *MintToAccounts `bin:"-"`
}

type MintToAccounts

type MintToAccounts struct {
	Mint          *solana.AccountMeta
	Account       *solana.AccountMeta
	MintAuthority *solana.AccountMeta
}

type MintToChecked

type MintToChecked struct {
	Accounts *MintToCheckedAccounts
}

type MintToCheckedAccounts

type MintToCheckedAccounts struct {
}

type Multisig

type Multisig struct {
	M             byte
	N             byte
	IsInitialized bool
	Signers       [11]solana.PublicKey
}

type Revoke

type Revoke struct {
	Accounts *RevokeAccounts
}

type RevokeAccounts

type RevokeAccounts struct {
}

type SetAuthority

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

type SetAuthorityAccounts

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

type ThawAccount

type ThawAccount struct {
	Accounts *ThawAccountAccounts
}

type ThawAccountAccounts

type ThawAccountAccounts struct {
}

type Token

type Token struct {
	ProgramID string
	Mint      string
}

func New

func New(programID string, mint string) *Token

type Transfer

type Transfer struct {
	Amount   uint64
	Accounts *TransferAccounts
}

type TransferAccounts

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

type TransferChecked

type TransferChecked struct {
	Accounts *TransferCheckedAccounts
}

type TransferCheckedAccounts

type TransferCheckedAccounts struct {
}

Jump to

Keyboard shortcuts

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