Documentation
¶
Index ¶
- type Client
- func (c *Client) Broadcast(ctx context.Context, txBytes []byte, mode txtypes.BroadcastMode) (string, error)
- func (c *Client) BuildAndSignTx(ctx context.Context, msg sdk.Msg, memo string) ([]byte, error)
- func (c *Client) BuildAndSignTxWithGasAdjustment(ctx context.Context, msg sdk.Msg, memo string, gasAdjustment float64) ([]byte, error)
- func (c *Client) Close() error
- func (c *Client) ExtractEventAttribute(tx *txtypes.GetTxResponse, eventType, attrKey string) (string, error)
- func (c *Client) GRPCConn() *grpc.ClientConn
- func (c *Client) GetTx(ctx context.Context, hash string) (*txtypes.GetTxResponse, error)
- func (c *Client) GetTxsByEvents(ctx context.Context, events []string, page, limit uint64) (*txtypes.GetTxsEventResponse, error)
- func (c *Client) Simulate(ctx context.Context, txBytes []byte) (uint64, error)
- func (c *Client) WaitForTxInclusion(ctx context.Context, txHash string) (*txtypes.GetTxResponse, error)
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides common Cosmos SDK gRPC and tx helpers.
func (*Client) Broadcast ¶
func (c *Client) Broadcast(ctx context.Context, txBytes []byte, mode txtypes.BroadcastMode) (string, error)
Broadcast broadcasts a signed transaction with a chosen broadcast mode.
func (*Client) BuildAndSignTx ¶
BuildAndSignTx builds a transaction with one message, simulates gas, then signs it.
func (*Client) BuildAndSignTxWithGasAdjustment ¶
func (c *Client) BuildAndSignTxWithGasAdjustment(ctx context.Context, msg sdk.Msg, memo string, gasAdjustment float64) ([]byte, error)
BuildAndSignTxWithGasAdjustment builds a transaction with one message, simulates gas, applies a custom adjustment factor, then signs it.
func (*Client) ExtractEventAttribute ¶
func (c *Client) ExtractEventAttribute(tx *txtypes.GetTxResponse, eventType, attrKey string) (string, error)
ExtractEventAttribute extracts an attribute value from transaction events. It searches through TxResponse.Events for the first event matching eventType, then returns the value of the first attribute matching attrKey. Returns an error if the transaction, events, or matching event/attribute are not found.
func (*Client) GRPCConn ¶
func (c *Client) GRPCConn() *grpc.ClientConn
GRPCConn exposes the underlying gRPC connection for specialized queries.
func (*Client) GetTxsByEvents ¶
func (c *Client) GetTxsByEvents(ctx context.Context, events []string, page, limit uint64) (*txtypes.GetTxsEventResponse, error)
GetTxsByEvents searches for transactions matching event filters.
func (*Client) WaitForTxInclusion ¶
func (c *Client) WaitForTxInclusion(ctx context.Context, txHash string) (*txtypes.GetTxResponse, error)
WaitForTxInclusion waits for a transaction to reach a final state using a websocket subscriber when possible and falling back to periodic gRPC polling. A new waiter (and therefore a new websocket subscription) is created for each invocation, so sequential callers should expect a new CometBFT RPC client per call. Timeouts are driven entirely by the caller-provided context (the waiter timeout argument remains zero intentionally). It respects the context for cancellation or deadlines.
type Config ¶
type Config struct {
ChainID string
GRPCAddr string
RPCEndpoint string
AccountHRP string
FeeDenom string
GasPrice sdkmath.LegacyDec
Timeout time.Duration
MaxRecvMsgSize int
MaxSendMsgSize int
InsecureGRPC bool
WaitTx clientconfig.WaitTxConfig
}
Config captures shared Cosmos SDK chain settings for gRPC + tx workflows.