common

package
Version: v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2021 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PublicKeyLength = 32
	MaxSeedLength   = 32
	MaxSeed         = 16
)

Variables

View Source
var (
	SystemProgramID                    = PublicKeyFromString("11111111111111111111111111111111")
	ConfigProgramID                    = PublicKeyFromString("Config1111111111111111111111111111111111111")
	StakeProgramID                     = PublicKeyFromString("Stake11111111111111111111111111111111111111")
	VoteProgramID                      = PublicKeyFromString("Vote111111111111111111111111111111111111111")
	BPFLoaderProgramID                 = PublicKeyFromString("BPFLoader1111111111111111111111111111111111")
	Secp256k1ProgramID                 = PublicKeyFromString("KeccakSecp256k11111111111111111111111111111")
	TokenProgramID                     = PublicKeyFromString("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA")
	SPLAssociatedTokenAccountProgramID = PublicKeyFromString("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL")
)
View Source
var (
	SysVarClockPubkey            = PublicKeyFromString("SysvarC1ock11111111111111111111111111111111")
	SysVarRecentBlockhashsPubkey = PublicKeyFromString("SysvarRecentB1ockHashes11111111111111111111")
	SysVarRentPubkey             = PublicKeyFromString("SysvarRent111111111111111111111111111111111")
	SysVarRewardsPubkey          = PublicKeyFromString("SysvarRewards111111111111111111111111111111")
	SysVarStakeHistoryPubkey     = PublicKeyFromString("SysvarStakeHistory1111111111111111111111111")
	SysVarInstructionsPubkey     = PublicKeyFromString("Sysvar1nstructions1111111111111111111111111")
	StakeConfigPubkey            = PublicKeyFromString("StakeConfig11111111111111111111111111111111")
)

Functions

func SerializeData

func SerializeData(data interface{}) ([]byte, error)

func UintToVarLenBytes

func UintToVarLenBytes(l uint64) []byte

Types

type PublicKey

type PublicKey [PublicKeyLength]byte

func CreateProgramAddress

func CreateProgramAddress(seeds [][]byte, programId PublicKey) (PublicKey, error)

func CreateWithSeed

func CreateWithSeed(from PublicKey, seed string, programID PublicKey) PublicKey

func FindAssociatedTokenAddress

func FindAssociatedTokenAddress(walletAddress, tokenMintAddress PublicKey) (PublicKey, int, error)

func FindProgramAddress

func FindProgramAddress(seed [][]byte, programID PublicKey) (PublicKey, int, error)

func PublicKeyFromBytes

func PublicKeyFromBytes(b []byte) PublicKey

func PublicKeyFromString

func PublicKeyFromString(s string) PublicKey

func (PublicKey) Bytes

func (p PublicKey) Bytes() []byte

func (*PublicKey) MarshalJSON

func (p *PublicKey) MarshalJSON() ([]byte, error)

func (PublicKey) ToBase58

func (p PublicKey) ToBase58() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL