context

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2022 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RequireProof

func RequireProof(subpath string) bool

RequireProof returns whether proof is required for the subpath.

func RunGRPCQuery

func RunGRPCQuery(ctx Context, grpcCtx gocontext.Context, method string, req interface{}, md metadata.MD) (abci.ResponseQuery, metadata.MD, error)

RunGRPCQuery runs a gRPC query from the clientCtx, given all necessary arguments for the gRPC method, and returns the ABCI response. It is used to factorize code between client (Invoke) and server (RegisterGRPCServer) gRPC handlers.

Types

type Context

type Context struct {
	HomeDir           string
	NodeURI           string
	ChainID           string
	FromAddr          sdk.AccAddress
	Blocked           bool
	Client            rpclient.Client
	Verbose           bool
	Height            int64
	Cdc               *codec.Codec
	InterfaceRegistry codectypes.InterfaceRegistry
	Code              int64
	Simulate          bool
	Broadcast         bool
	PrivateKey        string
	Nonce             uint64
	Gas               uint64
}

func (*Context) BroadcastSignedData

func (ctx *Context) BroadcastSignedData(data []byte) (sdk.TxResponse, error)

消息确认 同步

func (*Context) BroadcastSignedDataAsync

func (ctx *Context) BroadcastSignedDataAsync(data []byte) (sdk.TxResponse, error)

内部调用 BroadcastTxSync,同步等待checktx 消息,消息确认还是异步的

func (*Context) BroadcastSignedTx

func (ctx *Context) BroadcastSignedTx(data []byte) (sdk.TxResponse, error)

broadcastTx

func (*Context) CalculateGas added in v1.5.28

func (ctx *Context) CalculateGas(txByte []byte) (sdk.TxResponse, error)

func (*Context) Context

func (ctx *Context) Context() context.Context

func (*Context) GetBalanceByAddress

func (ctx *Context) GetBalanceByAddress(addr sdk.AccAddress, isProve bool, height string) (sdk.Coins, *merkle.Proof, error)

func (*Context) GetBlocked

func (ctx *Context) GetBlocked() bool

func (*Context) GetFromAddresses

func (ctx *Context) GetFromAddresses() sdk.AccAddress

func (*Context) GetNode

func (ctx *Context) GetNode() (rpclient.Client, error)

func (*Context) GetNonceByAddress

func (ctx *Context) GetNonceByAddress(addr sdk.AccAddress, isProve bool) (uint64, *merkle.Proof, error)

func (Context) Invoke

func (ctx Context) Invoke(grpcCtx gocontext.Context, method string, req, reply interface{}, opts ...grpc.CallOption) (err error)

Invoke implements the grpc ClientConn.Invoke method

func (Context) NewStream

NewStream implements the grpc ClientConn.NewStream method

func (Context) PrintOutput

func (ctx Context) PrintOutput(toPrint fmt.Stringer) (err error)

PrintOutput prints output while respecting output and indent flags NOTE: pass in marshalled structs that have been unmarshaled because this function will panic on marshaling errors

func (Context) Query

func (ctx Context) Query(path string, key bytes.HexBytes, isProve bool) ([]byte, int64, *merkle.Proof, error)

func (Context) QueryABCI

func (ctx Context) QueryABCI(req abci.RequestQuery) (abci.ResponseQuery, error)

QueryABCI performs a query to a Tendermint node with the provide RequestQuery. It returns the ResultQuery obtained from the query.

func (Context) WithBlocked

func (ctx Context) WithBlocked(blocked bool) Context

func (Context) WithBroadcast added in v1.5.28

func (ctx Context) WithBroadcast(broadcast bool) Context

func (Context) WithChainID

func (ctx Context) WithChainID(chainID string) Context

func (Context) WithClient

func (ctx Context) WithClient(client rpclient.Client) Context

func (Context) WithCode

func (ctx Context) WithCode(code int64) Context

func (Context) WithCodec

func (ctx Context) WithCodec(cdc *codec.Codec) Context

func (Context) WithFrom

func (ctx Context) WithFrom(from sdk.AccAddress) Context

func (Context) WithGas added in v1.5.28

func (ctx Context) WithGas(gas uint64) Context

func (Context) WithHeight

func (ctx Context) WithHeight(height int64) Context

func (Context) WithInterfaceRegistry

func (ctx Context) WithInterfaceRegistry(interfaceRegistry codectypes.InterfaceRegistry) Context

WithInterfaceRegistry returns the context with an updated InterfaceRegistry

func (Context) WithNonce added in v1.5.28

func (ctx Context) WithNonce(nonce uint64) Context

func (Context) WithPrivateKey added in v1.5.28

func (ctx Context) WithPrivateKey(privateKey string) Context

func (Context) WithSimulation added in v1.5.28

func (ctx Context) WithSimulation(simulate bool) Context

WithSimulation returns a copy of the context with updated Simulate value

Jump to

Keyboard shortcuts

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