go_coin_sol

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 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/itherunder/go-coin-sol

Document

doc

Security Vulnerabilities

If you discover a security vulnerability, please send an e-mail to itherunder@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

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

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

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

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

func (*Wallet) DestroyTokenAccounts

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

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

func (*Wallet) GetTokenData

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

func (*Wallet) IDLAddress

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

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

func (*Wallet) NewAddress

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

func (*Wallet) NewSeed

func (t *Wallet) NewSeed() string

func (*Wallet) NewWSClient

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

func (*Wallet) RPCClient

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

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

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

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

func (*Wallet) TransferSOL

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

func (*Wallet) WSClient

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

Jump to

Keyboard shortcuts

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