client

package
v1.0.1-alpha Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChainHeight

type ChainHeight struct {
	Logger zerolog.Logger
	// contains filtered or unexported fields
}

ChainHeight is used to cache the chain height of the current node which is being updated each time the node sends an event of EventNewBlockHeader. It starts a goroutine to subscribe to blockchain new block event and update the cached height.

func (*ChainHeight) GetChainHeight

func (ch *ChainHeight) GetChainHeight() (int64, error)

GetChainHeight returns the last chain height available.

type OracleClient

type OracleClient struct {
	Logger              zerolog.Logger
	ChainID             string
	TMRPC               string
	RPCTimeout          time.Duration
	OracleAddr          sdk.AccAddress
	OracleAddrString    string
	Keyring             cosmkeyring.Keyring
	ValidatorAddrString string
	Encoding            params.EncodingConfig
	GasPrices           string
	GasAdjustment       float64
	GRPCEndpoint        string
	ChainHeight         *ChainHeight
	Fees                string
}

OracleClient defines a structure that interfaces with the persistence node.

func NewOracleClient

func NewOracleClient(
	ctx context.Context,
	logger zerolog.Logger,
	chainID string,
	keyringBackend string,
	keyringDir string,
	keyringPass string,
	keyPrivHex string,
	keyMnemonic string,
	tmRPC string,
	rpcTimeout time.Duration,
	oracleAddrString string,
	validatorAddrString string,
	grpcEndpoint string,
	gasAdjustment float64,
	fees string,
) (OracleClient, error)

func (OracleClient) BroadcastTx

func (oc OracleClient) BroadcastTx(ctx context.Context, nextBlockHeight, timeoutHeight int64, msgs ...sdk.Msg) error

BroadcastTx attempts to broadcast a signed transaction. If it fails, a few re-attempts will be made until the transaction succeeds or ultimately times out or fails.

Jump to

Keyboard shortcuts

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