Documentation
¶
Index ¶
- type Client
- func (c *Client) Broadcast(ctx context.Context, txBytes []byte, mode txtypes.BroadcastMode) (string, error)
- func (c *Client) BroadcastAndWait(ctx context.Context, txBytes []byte, mode txtypes.BroadcastMode) (string, *txtypes.GetTxResponse, 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) BuildAndSignTxWithOptions(ctx context.Context, opts TxBuildOptions) ([]byte, error)
- func (c *Client) Cfg() Config
- 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) KeyName() string
- func (c *Client) Keyring() keyring.Keyring
- func (c *Client) PrepareTx(ctx context.Context, opts TxBuildOptions) (client.TxConfig, client.TxBuilder, TxSignerInfo, error)
- func (c *Client) SignPreparedTx(ctx context.Context, txCfg client.TxConfig, builder client.TxBuilder, ...) ([]byte, 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
- type TxBuildOptions
- type TxSignerInfo
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) BroadcastAndWait ¶ added in v1.2.0
func (c *Client) BroadcastAndWait(ctx context.Context, txBytes []byte, mode txtypes.BroadcastMode) (string, *txtypes.GetTxResponse, error)
BroadcastAndWait broadcasts signed tx bytes, then waits for final inclusion.
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) BuildAndSignTxWithOptions ¶ added in v1.2.0
func (c *Client) BuildAndSignTxWithOptions(ctx context.Context, opts TxBuildOptions) ([]byte, error)
BuildAndSignTxWithOptions builds and signs a transaction using explicit options.
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) PrepareTx ¶ added in v1.2.0
func (c *Client) PrepareTx(ctx context.Context, opts TxBuildOptions) (client.TxConfig, client.TxBuilder, TxSignerInfo, error)
PrepareTx builds an unsigned tx builder and resolves the signer metadata.
func (*Client) SignPreparedTx ¶ added in v1.2.0
func (c *Client) SignPreparedTx(ctx context.Context, txCfg client.TxConfig, builder client.TxBuilder, signerInfo TxSignerInfo) ([]byte, error)
SignPreparedTx signs a prepared tx builder using explicit signer info.
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
// EVMChainID is the EIP-155 chain ID for Ethereum-format transactions.
// Distinct from the Cosmos ChainID. Nil disables EVM-tx helpers.
EVMChainID *big.Int
// EVMNativeDenom is the cosmos/evm `evm_denom` parameter — the bank denom
// fees are deducted in (Lumera: "ulume"). Used by
// MsgEthereumTx.BuildTxWithEvmParams when constructing the cosmos fee coin
// from the inner Ethereum tx.
EVMNativeDenom string
// EVMExtendedDenom is the 18-decimal precisebank denom (Lumera: "alume").
// Ethereum tx value, fee caps, balances, and receipts use this denom's
// integer "wei-like" representation.
EVMExtendedDenom string
// EVMGasTipCap and EVMGasFeeCap are optional defaults (in the extended
// denom's integer unit) for EIP-1559 gas pricing. Nil means "fetch from
// chain state".
EVMGasTipCap *big.Int
EVMGasFeeCap *big.Int
}
Config captures shared Cosmos SDK chain settings for gRPC + tx workflows.
type TxBuildOptions ¶ added in v1.2.0
type TxBuildOptions struct {
Messages []sdk.Msg
Memo string
GasAdjustment float64
GasLimit uint64
SkipSimulation bool
AccountNumber *uint64
Sequence *uint64
FeeAmount sdk.Coins
ZeroFee bool
}
TxBuildOptions controls how a transaction is assembled and signed.
type TxSignerInfo ¶ added in v1.2.0
TxSignerInfo contains the signer account metadata used for signing.