client

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountInfo added in v1.4.0

type AccountInfo struct {
	Lamports  uint64
	Owner     string
	Excutable bool
	RentEpoch uint64
	Data      []byte
}

type Client

type Client struct {
	rpc.RpcClient
}

func NewClient

func NewClient(endpoint string) *Client

func (*Client) GetAccountInfo added in v1.4.0

func (c *Client) GetAccountInfo(ctx context.Context, base58Addr string) (AccountInfo, error)

GetAccountInfo return account's info

func (*Client) GetBalance

func (c *Client) GetBalance(ctx context.Context, base58Addr string) (uint64, error)

GetBalance fetch users lamports(SOL) balance

func (*Client) GetBalanceWithCfg

func (c *Client) GetBalanceWithCfg(ctx context.Context, base58Addr string, cfg rpc.GetBalanceConfig) (uint64, error)

GetBalance fetch users lamports(SOL) balance with specific commitment

func (*Client) GetRecentBlockhash added in v1.4.0

func (c *Client) GetRecentBlockhash(ctx context.Context) (rpc.GetRecentBlockHashResultValue, error)

GetRecentBlockhash return recent blockhash information

func (*Client) GetSlot added in v1.6.0

func (c *Client) GetSlot(ctx context.Context) (uint64, error)

GetSlot get current slot (finalized)

func (*Client) GetSlotWithCfg added in v1.6.0

func (c *Client) GetSlotWithCfg(ctx context.Context, cfg rpc.GetSlotConfig) (uint64, error)

GetSlotWithCfg get slot by commitment

func (*Client) GetTokenAccountBalance added in v1.8.0

func (c *Client) GetTokenAccountBalance(ctx context.Context, base58Addr string) (uint64, uint8, error)

GetTokenAccountBalance returns the token balance of an SPL Token account

func (*Client) GetTokenAccountBalanceWithCfg added in v1.8.0

func (c *Client) GetTokenAccountBalanceWithCfg(ctx context.Context, base58Addr string, cfg rpc.GetTokenAccountBalanceConfig) (uint64, uint8, error)

GetTokenAccountBalance returns the token balance of an SPL Token account

func (*Client) SendRawTransaction added in v1.4.0

func (c *Client) SendRawTransaction(ctx context.Context, tx []byte) (string, error)

SendRawTransaction will send your raw tx

func (*Client) SendTransaction added in v1.4.0

func (c *Client) SendTransaction(ctx context.Context, param SendTransactionParam) (string, error)

SendTransaction is a quick way to send tx

func (*Client) SendTransaction2 added in v1.7.0

func (c *Client) SendTransaction2(ctx context.Context, tx types.Transaction) (string, error)

SendTransaction2 send transaction struct directly

type SendTransactionParam added in v1.4.0

type SendTransactionParam struct {
	Instructions []types.Instruction
	Signers      []types.Account
	FeePayer     common.PublicKey
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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