sdk

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2020 License: Apache-2.0 Imports: 19 Imported by: 0

README

go-kratos

golang support for kratos

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Codec *codec.Codec
)

Functions

func HoldToClose

func HoldToClose(waitFunc func())

func MustMarshalJSON

func MustMarshalJSON(o interface{}) []byte

func NewLoggerByZap

func NewLoggerByZap(isTrace bool, logLevelStr string) tmlog.Logger

func NewScanner

func NewScanner(ctx Context, fromHeight int64) *scanner

func NewWatcher

func NewWatcher(ctx Context, fromHeight int64) *watcher

func SetupCloseHandler

func SetupCloseHandler(waitFunc func())

func UnmarshalJSON

func UnmarshalJSON(bz []byte, ptr interface{}) error

Types

type BlockHandler

type BlockHandler func(logger tmlog.Logger, height int64, block *types.FullBlock) error

type Client

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

func NewClient

func NewClient(ctx Context) *Client

func (Client) Cdc

func (c Client) Cdc() *codec.Codec

func (*Client) QueryBlockByNum

func (c *Client) QueryBlockByNum(num int64) (block.DecodeResultBlock, error)

func (*Client) QueryBlockResultsByHeight

func (c *Client) QueryBlockResultsByHeight(height int64) (types.ResultBlockResults, error)

func (*Client) QueryFullBlock

func (c *Client) QueryFullBlock(num int64) (types.FullBlock, error)

func (*Client) QueryLatestBlock

func (c *Client) QueryLatestBlock() (block.DecodeResultBlock, error)

func (*Client) QueryTxByHash

func (c *Client) QueryTxByHash(hash string) (sdk.TxResponse, error)

func (*Client) SetLogger

func (c *Client) SetLogger(l tmlog.Logger)

type Context

type Context struct {
	context.Context
	// contains filtered or unexported fields
}

func NewCtx

func NewCtx(ctx context.Context) Context

func (Context) Clone

func (c Context) Clone(ctx context.Context) Context

func (Context) LcdURL

func (c Context) LcdURL() string

func (Context) Logger

func (c Context) Logger() log.Logger

func (Context) RpcURL

func (c Context) RpcURL() string

func (Context) WithLogger

func (c Context) WithLogger(logger log.Logger) Context

func (Context) WithUrls

func (c Context) WithUrls(lcdURL string, rpcURL string) Context

type WSClient

type WSClient struct {
	// contains filtered or unexported fields
}

func NewWSClient

func NewWSClient(logger log.Logger, addr string) (*WSClient, error)

func (*WSClient) AddHandler

func (w *WSClient) AddHandler(handler WsHandler)

func (*WSClient) SetLogger

func (w *WSClient) SetLogger(l log.Logger)

func (*WSClient) Start

func (w *WSClient) Start() error

func (*WSClient) Stop

func (w *WSClient) Stop() error

func (*WSClient) Subscribe

func (w *WSClient) Subscribe(ctx context.Context, query string, handler WsHandler) error

func (*WSClient) SubscribeBlocks

func (w *WSClient) SubscribeBlocks(ctx context.Context, handler func(evtBlock *types.EventNewBlock) error) error

func (*WSClient) Wait

func (w *WSClient) Wait()

type WsHandler

type WsHandler func(typ string, val json.RawMessage) error

Directories

Path Synopsis
cmds
examples

Jump to

Keyboard shortcuts

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