client

package
v0.0.0-...-78810ce Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2025 License: Apache-2.0, MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	SolClient *rpc.Client
	Asset     xc.ITask
}

Client for Solana

func NewClient

func NewClient(cfgI xc.ITask) (*Client, error)

NewClient returns a new JSON-RPC Client to the Solana node

func (*Client) FetchBalance

func (client *Client) FetchBalance(ctx context.Context, address xc.Address) (xc.AmountBlockchain, error)

FetchBalance fetches token balance for a Solana address

func (*Client) FetchBalanceForAsset

func (client *Client) FetchBalanceForAsset(ctx context.Context, address xc.Address, assetCfg xc.ITask) (xc.AmountBlockchain, error)

FetchBalanceForAsset fetches a specific token balance which may not be the asset configured for the client

func (*Client) FetchBaseInput

func (client *Client) FetchBaseInput(ctx context.Context, fromAddr xc.Address) (*tx_input.TxInput, error)

func (*Client) FetchDecimals

func (client *Client) FetchDecimals(ctx context.Context, contract xc.ContractAddress) (int, error)

func (*Client) FetchLegacyTxInfo

func (client *Client) FetchLegacyTxInfo(ctx context.Context, txHash xc.TxHash) (xc.LegacyTxInfo, error)

FetchLegacyTxInfo returns tx info for a Solana tx

func (*Client) FetchLegacyTxInput

func (client *Client) FetchLegacyTxInput(ctx context.Context, from xc.Address, to xc.Address) (xc.TxInput, error)

func (*Client) FetchNativeBalance

func (client *Client) FetchNativeBalance(ctx context.Context, address xc.Address) (xc.AmountBlockchain, error)

FetchNativeBalance fetches account balance for a Solana address

func (*Client) FetchStakeBalance

func (client *Client) FetchStakeBalance(ctx context.Context, args xclient.StakedBalanceArgs) ([]*xclient.StakedBalance, error)

func (*Client) FetchStakingInput

func (client *Client) FetchStakingInput(ctx context.Context, args xcbuilder.StakeArgs) (xc.StakeTxInput, error)

func (*Client) FetchTransferInput

func (client *Client) FetchTransferInput(ctx context.Context, args xcbuilder.TransferArgs) (xc.TxInput, error)

FetchLegacyTxInput returns tx input for a Solana tx, namely a RecentBlockHash

func (*Client) FetchTxInfo

func (client *Client) FetchTxInfo(ctx context.Context, txHashStr xc.TxHash) (xclient.TxInfo, error)

func (*Client) FetchUnstakingInput

func (client *Client) FetchUnstakingInput(ctx context.Context, args xcbuilder.StakeArgs) (xc.UnstakeTxInput, error)

func (*Client) FetchWithdrawInput

func (client *Client) FetchWithdrawInput(ctx context.Context, args xcbuilder.StakeArgs) (xc.WithdrawTxInput, error)

func (*Client) GetStakeAccounts

func (client *Client) GetStakeAccounts(ctx context.Context, address xc.Address) ([]*parsedStakeAccount, error)

func (*Client) GetTokenAccountsByOwner

func (client *Client) GetTokenAccountsByOwner(ctx context.Context, addr string, contract string) ([]*TokenAccountWithInfo, error)

Get all token accounts for a given token that are owned by an address.

func (*Client) LookupStakeAccount

func (client *Client) LookupStakeAccount(ctx context.Context, stakeAccount solana.PublicKey) (types.StakeAccount, error)

func (*Client) LookupTokenAccount

func (client *Client) LookupTokenAccount(ctx context.Context, tokenAccount solana.PublicKey) (types.TokenAccountInfo, error)

func (*Client) LookupTokenMint

func (client *Client) LookupTokenMint(ctx context.Context, tokenContract solana.PublicKey) (types.MintAccountInfo, error)

func (*Client) SubmitTx

func (client *Client) SubmitTx(ctx context.Context, txInput xc.Tx) error

type TokenAccountWithInfo

type TokenAccountWithInfo struct {
	// We need to manually parse TokenAccountInfo
	Info *types.TokenAccountInfo
	// Account is what's returned by solana client
	Account *rpc.TokenAccount
}

Jump to

Keyboard shortcuts

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