grpc

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: MIT Imports: 19 Imported by: 2

Documentation

Overview

package grpc implements a gRPC client for the Kwil txsvc client.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateCertOption

func CreateCertOption(certFile string) (grpc.DialOption, error)

CreateCertOption returns a grpc.DialOption that can be used to create a secure connection to the given certFile. If certFile is empty, the connection will be insecure.

Types

type Client

type Client struct {
	TxClient txpb.TxServiceClient
	// contains filtered or unexported fields
}

func New

func New(ctx context.Context, target string, opts ...Option) (*Client, error)

func WrapConn

func WrapConn(conn *grpc.ClientConn) *Client

WrapConn wraps an existing grpc.ClientConn with the TxServiceClient.

func (*Client) Broadcast

func (c *Client) Broadcast(ctx context.Context, tx *transactions.Transaction, sync rpcClient.BroadcastWait) ([]byte, error)

func (*Client) Call

func (*Client) ChainInfo

func (c *Client) ChainInfo(ctx context.Context) (*types.ChainInfo, error)

ChainInfo gets information on the blockchain of the remote host.

func (*Client) Close

func (c *Client) Close() error

func (*Client) EstimateCost

func (c *Client) EstimateCost(ctx context.Context, tx *transactions.Transaction) (*big.Int, error)

func (*Client) GetAccount

func (c *Client) GetAccount(ctx context.Context, identifier []byte, status types.AccountStatus) (*types.Account, error)

func (*Client) GetConfig

func (c *Client) GetConfig(ctx context.Context) (*SvcConfig, error)

func (*Client) GetSchema

func (c *Client) GetSchema(ctx context.Context, dbid string) (*transactions.Schema, error)

func (*Client) GetTarget

func (c *Client) GetTarget() string

func (*Client) ListDatabases

func (c *Client) ListDatabases(ctx context.Context, ownerIdentifier []byte) ([]*types.DatasetIdentifier, error)

func (*Client) Ping

func (c *Client) Ping(ctx context.Context) (string, error)

func (*Client) Query

func (c *Client) Query(ctx context.Context, dbid string, query string) ([]map[string]any, error)

func (*Client) TxQuery

func (c *Client) TxQuery(ctx context.Context, txHash []byte) (*transactions.TcTxQueryResponse, error)

type Option

type Option func(*Client) error

func WithDialOptions

func WithDialOptions(opts ...grpc.DialOption) Option

func WithTlsCert

func WithTlsCert(certFile string) Option

type SvcConfig

type SvcConfig struct {
	ChainCode       int64
	PoolAddress     string
	ProviderAddress string
}

Jump to

Keyboard shortcuts

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