go_coin_sol

package module
v1.5.9 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2025 License: BSD-3-Clause Imports: 28 Imported by: 0

README

go-coin-sol

view examples

go-coin-sol1

Quick start1

go get github.com/pefish/go-coin-sol

Document

doc

Security Vulnerabilities

If you discover a security vulnerability, please send an e-mail to pefish@qq.com. All security vulnerabilities will be promptly addressed.

License

This project is licensed under the Apache License.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JitoTipInfo added in v0.5.5

type JitoTipInfo struct {
	Time                        string  `json:"time"`
	LandedTips25thPercentile    float64 `json:"landed_tips_25th_percentile"`
	LandedTips50thPercentile    float64 `json:"landed_tips_50th_percentile"`
	LandedTips75thPercentile    float64 `json:"landed_tips_75th_percentile"`
	LandedTips95thPercentile    float64 `json:"landed_tips_95th_percentile"`
	LandedTips99thPercentile    float64 `json:"landed_tips_99th_percentile"`
	EMALandedTips50thPercentile float64 `json:"ema_landed_tips_50th_percentile"`
}

type TokenDataType added in v0.7.2

type TokenDataType struct {
	Parsed struct {
		Info struct {
			Decimals        uint64 `json:"decimals"`
			FreezeAuthority string `json:"freezeAuthority"`
			IsInitialized   bool   `json:"isInitialized"`
			MintAuthority   string `json:"mintAuthority"`
			Supply          string `json:"supply"`
		} `json:"info"`
		Type string `json:"type"`
	} `json:"parsed"`
	Program string `json:"program"`
	Space   uint64 `json:"space"`
}

type Wallet

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

func New

func New(
	logger i_logger.ILogger,
	httpsUrl string,
	wssUrl string,
) *Wallet

func (*Wallet) Balance added in v1.1.9

func (t *Wallet) Balance(address solana.PublicKey) (uint64, error)

func (*Wallet) BuildTx

func (t *Wallet) BuildTx(
	privObj solana.PrivateKey,
	signers map[solana.PublicKey]*solana.PrivateKey,
	latestBlockhash *solana.Hash,
	instructions []solana.Instruction,
	unitPrice uint64,
	unitLimit uint64,
) (*solana.Transaction, error)

func (*Wallet) DeriveAddress added in v1.5.0

func (t *Wallet) DeriveAddress(seedStr string, index uint64) (
	priv_ solana.PrivateKey,
	err_ error,
)

func (*Wallet) DestroyTokenAccounts added in v1.1.9

func (t *Wallet) DestroyTokenAccounts(
	userAddress solana.PublicKey,
	isForce bool,
	excludeTokenAddresses []solana.PublicKey,
) (
	instructions_ []solana.Instruction,
	closedTokenAccounts_ []solana.PublicKey,
	remainTokenAccounts_ []solana.PublicKey,
	err_ error,
)

func (*Wallet) GetJitoTipInfo added in v0.5.5

func (t *Wallet) GetJitoTipInfo() (*JitoTipInfo, error)

func (*Wallet) GetTokenData added in v0.7.2

func (t *Wallet) GetTokenData(
	tokenAddress solana.PublicKey,
) (*TokenDataType, error)

func (*Wallet) IDLAddress added in v1.4.9

func (t *Wallet) IDLAddress(programID solana.PublicKey) (solana.PublicKey, error)

获取使用 anchor idl init 将 idl 内容上传到链上的地址

func (*Wallet) NewAddress added in v0.0.4

func (t *Wallet) NewAddress() solana.PrivateKey

func (*Wallet) NewSeed added in v1.5.0

func (t *Wallet) NewSeed() string

func (*Wallet) NewWSClient added in v0.5.3

func (t *Wallet) NewWSClient(ctx context.Context, opt *ws.Options) *ws.Client

func (*Wallet) RPCClient added in v0.0.4

func (t *Wallet) RPCClient() *rpc.Client

func (*Wallet) SendAndConfirmTransaction

func (t *Wallet) SendAndConfirmTransaction(
	ctx context.Context,
	tx *solana.Transaction,
	skipPreflight bool,
	urls []string,
) (*rpc.GetParsedTransactionResult, error)

func (*Wallet) SendTx

func (t *Wallet) SendTx(
	ctx context.Context,
	privObj solana.PrivateKey,
	signers map[solana.PublicKey]*solana.PrivateKey,
	latestBlockhash *solana.Hash,
	instructions []solana.Instruction,
	unitPrice uint64,
	unitLimit uint64,
	skipPreflight bool,
	urls []string,
) (*rpc.GetParsedTransactionResult, error)

func (*Wallet) SendTxByJito added in v0.5.4

func (t *Wallet) SendTxByJito(
	ctx context.Context,
	privObj solana.PrivateKey,
	signers map[solana.PublicKey]*solana.PrivateKey,
	latestBlockhash *solana.Hash,
	instructions []solana.Instruction,
	unitPrice uint64,
	unitLimit uint64,
	jitoUrls []string,
	jitoTipAmountWithDecimals uint64,
	jitoAccount solana.PublicKey,
	checkInterval time.Duration,
) (*rpc.GetParsedTransactionResult, error)

func (*Wallet) SendTxByJitoBundle added in v0.7.6

func (t *Wallet) SendTxByJitoBundle(
	ctx context.Context,
	payFeePrivObj solana.PrivateKey,
	latestBlockhash *solana.Hash,
	txs []*solana.Transaction,
	jitoUrl string,
	jitoTipAmountWithDecimals uint64,
	jitoAccount solana.PublicKey,
) (
	timestamp_ uint64,
	err_ error,
)

每个 bundle 最大 5 笔交易,排除 transfer fee 的交易后,真正最大只有 4 笔交易

func (*Wallet) TokenBalance added in v0.5.9

func (t *Wallet) TokenBalance(
	address solana.PublicKey,
	tokenAddress solana.PublicKey,
) (*type_.TokenAmountInfo, error)

func (*Wallet) TransferSOL added in v1.1.9

func (t *Wallet) TransferSOL(
	from solana.PublicKey,
	to solana.PublicKey,
	amountWithDecimals uint64,
) ([]solana.Instruction, error)

func (*Wallet) WSClient added in v0.0.4

func (t *Wallet) WSClient() *ws.Client

Jump to

Keyboard shortcuts

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