web3kit

package
v0.0.0-...-3968f94 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ACCOUNT_TYPE_SIZE = 1
View Source
var InvalidAccountSizeErr = errors.New("InvalidAccountSizeErr")
View Source
var MULTISIG_SIZE = 355
View Source
var MetaPlex = metaPlex{}

MetaPlex Metaplex https://www.metaplex.com/

View Source
var Token = tokenKit{}
View Source
var Token2022 = tokenKit2022{}
View Source
var TokenAccountNotFoundErr = errors.New("TokenAccountNotFoundErr")
View Source
var TokenInvalidAccountOwnerErr = errors.New("TokenInvalidAccountOwnerErr")
View Source
var TokenInvalidMintErr = errors.New("TokenInvalidMintErr")
View Source
var TokenMeta = &tokenMeta{}

Functions

func BuildAssociatedAccountCreationInstructions

func BuildAssociatedAccountCreationInstructions(
	ctx context.Context,
	connection *web3.Connection,
	payer web3.Signer,
	mint web3.PublicKey,
	owners []web3.PublicKey,
	tokenProgramId, associatedTokenProgramId web3.PublicKey,
	commitment web3.Commitment,
) ([]web3.Instruction, error)

func DeDupBy

func DeDupBy[T comparable, K comparable, TS ~[]T](input TS, selector func(T) K) []T

func GetBytes

func GetBytes(input binary.BinaryMarshaler) []byte

func GetSize

func GetSize(input binary.BinaryMarshaler) int

func Map

func Map[T any, O any, TS ~[]T](input TS, mapper func(int, T) O) []O

func Must

func Must(err error)

func Must1

func Must1[T any](arg T, err error) T

func Must2

func Must2[T any, T2 any](arg T, arg2 T2, err error) (T, T2)

func Must3

func Must3[T any, T2 any, T3 any](arg T, arg2 T2, arg3 T3, err error) (T, T2, T3)

func Recover

func Recover(err *error)

Types

type BasicMetadata

type BasicMetadata struct {
	Image       []byte
	Name        string
	Symbol      string
	Description string
	Additional  map[string]string
}

type CreateTokenArgs

type CreateTokenArgs struct {
	BasicMetadata
	Decimals      uint8
	InitialSupply *uint64
}

type CreateTokenArgs2022

type CreateTokenArgs2022 struct {
	BasicMetadata
	Decimals            uint8
	InitialSupply       *uint64
	EnableWhitelist     bool
	EnableBlacklist     bool
	EnableForceTransfer bool
	Fee                 *uint16 // max: 100_00(100%)
	MaximumFee          uint64
}

type FileProvider

type FileProvider interface {
	MetadataURI(ctx context.Context, connection *web3.Connection, payer web3.Signer, basic BasicMetadata) (url string, err error)
}

type GetProgramAccountsOption

type GetProgramAccountsOption struct {
	Mint            *web3.PublicKey
	Owner           *web3.PublicKey
	Amount          *uint64
	Delegate        *web3.PublicKey
	State           *spl_token_2022.AccountState
	IsNative        *uint64
	DelegatedAmount *uint64
	CloseAuthority  *web3.PublicKey
}

GetProgramAccountsOption represents options for filtering program accounts. When a field is not nil, it indicates that the corresponding condition is enabled. Setting multiple fields to non-nil values represents an AND relationship, meaning accounts must meet all specified conditions to be included in the results.

type MetadataProvider

type MetadataProvider int
const (
	MetadataPlex MetadataProvider = iota
	SplToken2022
)

type MintInfo

type MintInfo struct {
	Mint
	Address web3.PublicKey // address of the mint
	TlvData []byte         // Additional data for extension
}

type ProgramAccount

type ProgramAccount struct {
	TokenAccount web3.PublicKey
	Info         web3.AccountInfoD
	Owner        web3.PublicKey
}

type TokenAccount

type TokenAccount struct {
	Account
	Address web3.PublicKey // address of the token
	TlvData []byte         // Additional data for extension
}

type TransactionBuilder

type TransactionBuilder struct {
	// contains filtered or unexported fields
}

func NewTransactionBuilder

func NewTransactionBuilder() *TransactionBuilder

func (*TransactionBuilder) AddInsBuilder

func (b *TransactionBuilder) AddInsBuilder(builder interface {
	Validate() error
}) *TransactionBuilder

func (*TransactionBuilder) AddInstructions

func (b *TransactionBuilder) AddInstructions(ins ...any) *TransactionBuilder

AddInstructions Support web3.Instruction and solana.Instruction

func (*TransactionBuilder) AddInstructions2

func (b *TransactionBuilder) AddInstructions2(ins any, err error) *TransactionBuilder

func (*TransactionBuilder) Build

func (b *TransactionBuilder) Build() (*web3.Transaction, error)

func (*TransactionBuilder) SetFeePayer

func (b *TransactionBuilder) SetFeePayer(feePayer web3.PublicKey) *TransactionBuilder

func (*TransactionBuilder) SetRecentBlockHash

func (b *TransactionBuilder) SetRecentBlockHash(connection *web3.Connection, commitment web3.Commitment) *TransactionBuilder

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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