client

package
v0.0.0-...-1cd7654 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultFastHTTPCaller = &FastHTTPCaller{
	Client: &fasthttp.Client{},
	debug:  true,
}

Functions

This section is empty.

Types

type Caller

type Caller interface {
	Call(context.Context, string, *types.JRPCRequest, interface{}) error
	WithDebug()
}

type Client

type Client struct {
	Endpoint string
	// contains filtered or unexported fields
}

func New

func New(endpoint string) *Client

func (*Client) FindPairs

func (c *Client) FindPairs(ctx context.Context, params types.FindPairsParams) ([]*types.Pair, error)

func (*Client) FindTokens

func (c *Client) FindTokens(ctx context.Context, params types.FindTokensParams) ([]*types.Token, error)

func (*Client) GetBlockAtTimestamp

func (c *Client) GetBlockAtTimestamp(ctx context.Context, params types.GetBlockAtTimestampParams) (*types.BlockTimestamp, error)

func (*Client) GetBlockNumber

func (c *Client) GetBlockNumber(ctx context.Context) (map[int64]int64, error)

func (*Client) GetBlockTimestamps

func (c *Client) GetBlockTimestamps(ctx context.Context, params types.GetBlockTimestampsParams) ([]*types.BlockTimestamp, error)

func (*Client) GetChains

func (c *Client) GetChains(ctx context.Context) ([]types.Chain, error)

func (*Client) GetHeight

func (c *Client) GetHeight(ctx context.Context, chainID int64) (*types.Heights, error)

func (*Client) GetPairCount

func (c *Client) GetPairCount(ctx context.Context, chainID int64) (int64, error)

func (*Client) GetTokenCount

func (c *Client) GetTokenCount(ctx context.Context, chainID int64) (int64, error)

func (*Client) WithAPIKey

func (c *Client) WithAPIKey(key string) *Client

func (*Client) WithDebug

func (c *Client) WithDebug() *Client

print debug info

func (*Client) WithEndpoint

func (c *Client) WithEndpoint(endpoint string) *Client

update endpoint

func (*Client) WithTimeout

func (c *Client) WithTimeout(timeout time.Duration) *Client

timeout for requests

type FastHTTPCaller

type FastHTTPCaller struct {
	Client *fasthttp.Client
	// contains filtered or unexported fields
}

func (FastHTTPCaller) Call

func (a FastHTTPCaller) Call(ctx context.Context, url string, jreq *types.JRPCRequest, jres interface{}) error

func (*FastHTTPCaller) WithDebug

func (a *FastHTTPCaller) WithDebug()

Jump to

Keyboard shortcuts

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