txclient

package
v0.31.2-mocha Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2026 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultGasPrice specifies the default gas price value to be used when the user
	// wants to use the global minimal gas price, which is fetched from the celestia-app.
	DefaultGasPrice float64 = -1.0

	DefaultMaxGasPrice = appconsts.DefaultMinGasPrice * 100
)
View Source
const (
	TxPriorityLow = iota + 1
	TxPriorityMedium
	TxPriorityHigh
)

Variables

View Source
var ErrGasPriceExceedsLimit = errors.New("state: estimated gas price exceeds max gas price in tx config")

Functions

func ParseAccAddressFromString

func ParseAccAddressFromString(addrStr string) (types.AccAddress, error)

func ParseAccountKey

func ParseAccountKey(kr keyring.Keyring, accountKey string) (sdktypes.AccAddress, error)

Types

type ConfigOption

type ConfigOption func(cfg *TxConfig)

ConfigOption is the functional option that is applied to the TxConfig instance to configure parameters.

func WithFeeGranterAddress

func WithFeeGranterAddress(granter string) ConfigOption

WithFeeGranterAddress is an option that allows you to specify a GranterAddress to pay the fees.

func WithGas

func WithGas(gas uint64) ConfigOption

WithGas is an option that allows to specify Gas. Gas will be calculated in case it wasn't specified.

func WithGasPrice

func WithGasPrice(gasPrice float64) ConfigOption

WithGasPrice is an option that allows to specify a GasPrice, which is needed to calculate the fee. In case GasPrice is not specified, the global GasPrice fetched from celestia-app will be used.

func WithKeyName

func WithKeyName(key string) ConfigOption

WithKeyName is an option that allows you to specify an KeyName, which is needed to sign the transaction. This key should be associated with the address and stored locally in the key store. Default Account will be used in case it wasn't specified.

func WithMaxGasPrice

func WithMaxGasPrice(gasPrice float64) ConfigOption

WithMaxGasPrice is an option that allows you to specify a `maxGasPrice` field.

func WithSignerAddress

func WithSignerAddress(address string) ConfigOption

WithSignerAddress is an option that allows you to specify an address, that will sign the transaction. This address must be stored locally in the key store. Default signerAddress will be used in case it wasn't specified.

func WithTxPriority

func WithTxPriority(priority int) ConfigOption

WithTxPriority is an option that allows you to specify a priority of the tx.

type Option

type Option func(c *TxClient)

func WithAdditionalCoreEndpoints

func WithAdditionalCoreEndpoints(conns []*grpc.ClientConn) Option

func WithEstimatorService

func WithEstimatorService(address string) Option

WithEstimatorService indicates to the CoreAccessor to pass the given address for the estimator service to the TxClient to use for all gas price and usage estimation queries.

func WithEstimatorServiceTLS

func WithEstimatorServiceTLS() Option

WithEstimatorServiceTLS indicates to the CoreAccessor to use TLS for the estimator service connection.

func WithTxWorkerAccounts

func WithTxWorkerAccounts(workerAccounts int) Option

WithTxWorkerAccounts configures the CoreAccessor to manage the provided number of worker accounts via the TxClient.

  • Value of 0 submits transactions immediately (without a submission queue).
  • Value of 1 uses synchronous submission (submission queue with default signer as author of transactions).
  • Value of > 1 uses parallel submission (submission queue with several accounts submitting blobs). Parallel submission is not guaranteed to include blobs in the same order as they were submitted.

type TxClient

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

func BuildClient

func BuildClient(t *testing.T, chainID string, accounts []string, opts ...Option) *TxClient

func NewTxClient

func NewTxClient(
	kr keyring.Keyring,
	defaultSignerAccount string,
	coreConn *grpc.ClientConn,
	opts ...Option,
) (*TxClient, error)

func (*TxClient) Start

func (c *TxClient) Start(context.Context) error

func (*TxClient) Stop

func (c *TxClient) Stop(context.Context) error

func (*TxClient) SubmitMessage

func (c *TxClient) SubmitMessage(
	ctx context.Context,
	msg types.Msg,
	cfg *TxConfig,
) (*user.TxResponse, error)

func (*TxClient) SubmitPayForBlob

func (c *TxClient) SubmitPayForBlob(
	ctx context.Context,
	libBlobs []*libshare.Blob,
	author types.AccAddress,
	cfg *TxConfig,
) (_ *user.TxResponse, err error)

func (*TxClient) WithMetrics

func (c *TxClient) WithMetrics() error

type TxConfig

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

TxConfig specifies additional options that will be applied to the Tx.

func NewTxConfig

func NewTxConfig(opts ...ConfigOption) *TxConfig

NewTxConfig constructs a new TxConfig with the provided options. It starts with a DefaultGasPrice and then applies any additional options provided through the variadic parameter.

func (*TxConfig) FeeGranterAddress

func (cfg *TxConfig) FeeGranterAddress() string

func (*TxConfig) GasLimit

func (cfg *TxConfig) GasLimit() uint64

func (*TxConfig) GasPrice

func (cfg *TxConfig) GasPrice() float64

func (*TxConfig) IsGasPriceSet

func (cfg *TxConfig) IsGasPriceSet() bool

func (*TxConfig) KeyName

func (cfg *TxConfig) KeyName() string

func (*TxConfig) MarshalJSON

func (cfg *TxConfig) MarshalJSON() ([]byte, error)

func (*TxConfig) MaxGasPrice

func (cfg *TxConfig) MaxGasPrice() float64

MaxGasPrice will return the max gas price that the user set in the TxConfig. If no value was set, it will return the default value.

func (*TxConfig) SignerAddress

func (cfg *TxConfig) SignerAddress() string

func (*TxConfig) TxPriority

func (cfg *TxConfig) TxPriority() TxPriority

func (*TxConfig) UnmarshalJSON

func (cfg *TxConfig) UnmarshalJSON(data []byte) error

type TxPriority

type TxPriority int

func (TxPriority) ToApp

Jump to

Keyboard shortcuts

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