broadcast

package
v0.35.8 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Broadcast

func Broadcast(ctx sdkClient.Context, txBytes []byte, options ...BroadcasterOption) (*sdk.TxResponse, error)

Broadcast sends the given tx to the blockchain and blocks until it is added to a block (or timeout).

func PrepareTx

func PrepareTx(ctx sdkClient.Context, txf tx.Factory, msgs ...sdk.Msg) ([]byte, error)

PrepareTx returns a marshalled tx that can be broadcast to the blockchain

Types

type Broadcaster

type Broadcaster interface {
	Broadcast(ctx context.Context, msgs ...sdk.Msg) (*sdk.TxResponse, error)
}

Broadcaster broadcasts msgs to the blockchain

func Batched

func Batched(broadcaster Broadcaster, batchThreshold, batchSizeLimit int) Broadcaster

Batched returns a broadcaster that batches msgs together if there is high traffic to increase throughput

func SuppressExecutionErrs

func SuppressExecutionErrs(broadcaster Broadcaster) Broadcaster

SuppressExecutionErrs logs errors when msg executions fail and then suppresses them

func WithRefund

func WithRefund(b Broadcaster) Broadcaster

WithRefund wraps a broadcaster into a refundableBroadcaster

func WithRetry

func WithRetry(broadcaster Broadcaster, maxRetries int, minSleep time.Duration) Broadcaster

WithRetry returns a broadcaster that retries the broadcast up to the given number of times if the broadcast fails

func WithStateManager

func WithStateManager(clientCtx sdkClient.Context, txf tx.Factory, options ...BroadcasterOption) Broadcaster

WithStateManager tracks sequence numbers, so it can be used to broadcast consecutive txs

type BroadcasterOption

type BroadcasterOption func(broadcaster broadcastParams) broadcastParams

BroadcasterOption modifies broadcaster behaviour

func WithPollingInterval

func WithPollingInterval(interval time.Duration) BroadcasterOption

WithPollingInterval modifies how often the broadcaster checks the blockchain for tx responses

func WithResponseTimeout

func WithResponseTimeout(timeout time.Duration) BroadcasterOption

WithResponseTimeout sets the time to wait for a tx response

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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