Documentation
¶
Index ¶
- Constants
- func CreateWalletAccount() (privateKeyBase58, address string, err error)
- func WalletAddressFromPrivateKey(privateKeyBase58 string) (address string, err error)
- type ParsedInstruction
- type ParsedInstructionAccount
- type ParsedTx
- type TxParser
- type TxPriorityFee
- type WalletClient
- func (wc *WalletClient) GetSOLBalance(ctx context.Context) (balance uint64, err error)
- func (wc *WalletClient) GetSOLBalanceByAddress(ctx context.Context, address string) (balance uint64, err error)
- func (wc *WalletClient) GetSPLTokenBalance(ctx context.Context, tokenAddress string) (balance string, decimals uint8, err error)
- func (wc *WalletClient) GetSPLTokenBalanceByAddress(ctx context.Context, tokenAddress, walletAddress string) (balance string, decimals uint8, err error)
- func (wc *WalletClient) SimulateTxTransferSOL(ctx context.Context, toAddress string, amount uint64, ...) (unitsConsumed uint64, err error)
- func (wc *WalletClient) SimulateTxTransferSPLToken(ctx context.Context, tokenAddress, toAddress string, amount uint64, ...) (unitsConsumed uint64, err error)
- func (wc *WalletClient) TransferSOL(ctx context.Context, toAddress string, amount uint64, ...) (signature string, err error)
- func (wc *WalletClient) TransferSPLToken(ctx context.Context, tokenAddress, toAddress string, amount uint64, ...) (signature string, err error)
Constants ¶
View Source
const ( LamportsPerSOL uint64 = 1000000000 // 1 SOL = 1,000,000,000 Lamports MicroLamportsPerLamport uint64 = 1000000 // 1 Lamport = 1,000,000 MicroLamports MicroLamportsPerSOL uint64 = MicroLamportsPerLamport * LamportsPerSOL // 1 SOL = 1,000,000,000,000 MicroLamports SOLDecimals uint8 = 9 )
Variables ¶
This section is empty.
Functions ¶
func CreateWalletAccount ¶
Types ¶
type ParsedInstruction ¶
type ParsedInstruction struct {
ProgramID string
TypeID uint32 // instruction type id
Name string // instruction name
Accounts []ParsedInstructionAccount // instruction input accounts
Data any // instruction input data
InnerInstructions []ParsedInstruction
}
type ParsedTx ¶
type ParsedTx struct {
Block uint64 // block height // slot
Timestamp int64 // block timestamp // milliseconds
TxHash string // transaction hash
Status string // transaction status // success or fail
Signer []string // signer addresses
Instructions []ParsedInstruction
Fee uint64 // transaction fee // = base fee + priority fee // lamports
PriorityFee uint64 // transaction priority fee // = (compute unit price * compute unit limit) / microLamportsPerLamport // lamports
ComputeUnitsConsumed uint64 // compute units consumed
TxVersion int // transaction version // -1: legacy
}
ParsedTx parsed transaction
type TxParser ¶
type TxParser struct {
// contains filtered or unexported fields
}
func NewDevnetTxParser ¶
func NewDevnetTxParser() *TxParser
func NewTestnetTxParser ¶
func NewTestnetTxParser() *TxParser
func NewTxParser ¶
func (*TxParser) ParseBlock ¶
type TxPriorityFee ¶
type TxPriorityFee struct {
ComputeUnitLimit uint32
ComputeUnitPrice uint64 // microLamports // 1,000,000 micro-lamports = 1 lamport
}
TxPriorityFee Transaction Priority Fee The prioritization fee is an optional fee paid to increase the chance that the current leader processes your transaction. https://solana.com/docs/core/fees#prioritization-fee
type WalletClient ¶
type WalletClient struct {
// contains filtered or unexported fields
}
func NewDevnetWalletClient ¶
func NewDevnetWalletClient(privateKeyBase58 string) (*WalletClient, error)
func NewTestnetWalletClient ¶
func NewTestnetWalletClient(privateKeyBase58 string) (*WalletClient, error)
func NewWalletClient ¶
func NewWalletClient(endpoint, privateKeyBase58 string) (*WalletClient, error)
func (*WalletClient) GetSOLBalance ¶
func (wc *WalletClient) GetSOLBalance(ctx context.Context) (balance uint64, err error)
func (*WalletClient) GetSOLBalanceByAddress ¶
func (*WalletClient) GetSPLTokenBalance ¶
func (*WalletClient) GetSPLTokenBalanceByAddress ¶
func (*WalletClient) SimulateTxTransferSOL ¶
func (wc *WalletClient) SimulateTxTransferSOL(ctx context.Context, toAddress string, amount uint64, priorityFeeOption ...TxPriorityFee) (unitsConsumed uint64, err error)
func (*WalletClient) SimulateTxTransferSPLToken ¶
func (wc *WalletClient) SimulateTxTransferSPLToken(ctx context.Context, tokenAddress, toAddress string, amount uint64, priorityFeeOption ...TxPriorityFee) (unitsConsumed uint64, err error)
func (*WalletClient) TransferSOL ¶
func (wc *WalletClient) TransferSOL(ctx context.Context, toAddress string, amount uint64, priorityFeeOption ...TxPriorityFee) (signature string, err error)
func (*WalletClient) TransferSPLToken ¶
func (wc *WalletClient) TransferSPLToken(ctx context.Context, tokenAddress, toAddress string, amount uint64, priorityFeeOption ...TxPriorityFee) (signature string, err error)
Click to show internal directories.
Click to hide internal directories.