client

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: 8 Imported by: 1

Documentation

Index

Constants

View Source
const (
	BroadcastWaitAsync  = BroadcastWait(txpb.BroadcastSync_async)
	BroadcastWaitSync   = BroadcastWait(txpb.BroadcastSync_sync)
	BroadcastWaitCommit = BroadcastWait(txpb.BroadcastSync_commit)
)

Variables

View Source
var (
	ErrInvalidSignature = errors.New("invalid signature")
	// ErrUnauthorized is returned when the client is not authenticated
	// It is the equivalent of http status code 401
	ErrUnauthorized = errors.New("unauthorized")
	ErrNotFound     = errors.New("not found")
)

The following errors may be detected by consumers using errors.Is.

Functions

func ConvertGRPCErr

func ConvertGRPCErr(err error) error

ConvertGRPCErr will convert the error to a known type, if possible. It is expected that the error is from a gRPC call.

func DefaultGRPCOpts

func DefaultGRPCOpts() []grpc.DialOption

DefaultGRPCOpts returns the default grpc options for the client.

Types

type ActionCallOption

type ActionCallOption func(*ActionCallOpts)

func WithAuthCookie

func WithAuthCookie(cookie *http.Cookie) ActionCallOption

type ActionCallOpts

type ActionCallOpts struct {
	// authn cookie, for provider that supports cookie authn, now only for KGW
	// Call action(view action) is read oriented; for data privacy, a network needs
	// extra infra to protect the data. KGW is such infra using cookie authn.
	// NOTE: setting cookie this way means the cookie policy is not applied.
	// AuthCookies is a general way to use cookie in SDK when calling action.
	AuthCookies []*http.Cookie
}

ActionCallOpts is the options for action call. Currently only HTTP RPCClient supports this option.

type BroadcastWait

type BroadcastWait uint8

BroadcastWait is an argument type that indicates how long to wait when broadcasting a transaction. The levels are async (do not wait for mempool acceptance), sync (wait for mempool acceptance), and commit (wait for it to be included in a block).

type RPCError

type RPCError struct {
	Msg  string
	Code int32
}

RPCError is a common error type used by any RPC client implementation to provide a detectable error to consumers using errors.As. We may define our own codes. Instances of RPCError may also be combined with other error types defined above using errors.Join.

func (RPCError) Error

func (err RPCError) Error() string

Directories

Path Synopsis
package admin specifies the interface for the admin service client.
package admin specifies the interface for the admin service client.
grpc
package grpc implements a grpc client for the Kwil admin client.
package grpc implements a grpc client for the Kwil admin client.
package function specifies the client interface for Kwil's function service.
package function specifies the client interface for Kwil's function service.
package user defines the interface for a user client transport.
package user defines the interface for a user client transport.
grpc
package grpc implements a gRPC client for the Kwil txsvc client.
package grpc implements a gRPC client for the Kwil txsvc client.
http
package http implements an http transport for the Kwil txsvc client.
package http implements an http transport for the Kwil txsvc client.

Jump to

Keyboard shortcuts

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