user

package
v1.0.0-rc58 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2023 License: Apache-2.0 Imports: 20 Imported by: 7

Documentation

Index

Constants

View Source
const DefaultPollTime = 3 * time.Second

Variables

This section is empty.

Functions

func QueryAccount

func QueryAccount(ctx context.Context, conn *grpc.ClientConn, encCfg encoding.Config, address string) (accNum uint64, seqNum uint64, err error)

QueryAccount fetches the account number and sequence number from the celestia-app node.

Types

type Signer

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

Signer is an abstraction for building, signing, and broadcasting Celestia transactions

func NewSigner

func NewSigner(
	keys keyring.Keyring,
	conn *grpc.ClientConn,
	address sdktypes.AccAddress,
	enc client.TxConfig,
	chainID string,
	accountNumber uint64,
	sequence uint64,
) (*Signer, error)

NewSigner returns a new signer using the provided keyring

func SetupSigner

func SetupSigner(
	ctx context.Context,
	keys keyring.Keyring,
	conn *grpc.ClientConn,
	address sdktypes.AccAddress,
	encCfg encoding.Config,
) (*Signer, error)

SetupSigner uses the underlying grpc connection to populate the chainID, accountNumber and sequence number of the account.

func SetupSingleSigner

func SetupSingleSigner(ctx context.Context, keys keyring.Keyring, conn *grpc.ClientConn, encCfg encoding.Config) (*Signer, error)

SetupSingleSigner sets up a signer based on the provided keyring. The keyring must contain exactly one key. It extracts the address from the key and uses the grpc connection to populate the chainID, account number, and sequence number.

func (*Signer) AccountNumber

func (s *Signer) AccountNumber() uint64

AccountNumber returns the account number of the signer.

func (*Signer) Address

func (s *Signer) Address() sdktypes.AccAddress

Address returns the address of the signer.

func (*Signer) BroadcastTx

func (s *Signer) BroadcastTx(ctx context.Context, txBytes []byte) (*sdktypes.TxResponse, error)

BroadcastTx submits the provided transaction bytes to the chain and returns the response.

func (*Signer) ChainID

func (s *Signer) ChainID() string

ChainID returns the chain ID of the signer.

func (*Signer) ConfirmTx

func (s *Signer) ConfirmTx(ctx context.Context, txHash string) (*sdktypes.TxResponse, error)

ConfirmTx periodically pings the provided node for the commitment of a transaction by its hash. It will continually loop until the context is cancelled, the tx is found or an error is encountered.

func (*Signer) CreatePayForBlob

func (s *Signer) CreatePayForBlob(blobs []*blob.Blob, opts ...TxOption) ([]byte, error)

func (*Signer) CreateTx

func (s *Signer) CreateTx(msgs []sdktypes.Msg, opts ...TxOption) ([]byte, error)

CreateTx forms a transaction from the provided messages and signs it. TxOptions may be optionally used to set the gas limit and fee.

func (*Signer) ForceSetSequence

func (s *Signer) ForceSetSequence(seq uint64)

ForceSetSequence manually overrides the current sequence number. Be careful when invoking this as it may cause the transactions to reject the sequence if it doesn't match the one in state

func (*Signer) GetSequence

func (s *Signer) GetSequence() uint64

GetSequencer gets the lastest signed sequnce and increments the local sequence number

func (*Signer) PubKey

func (s *Signer) PubKey() cryptotypes.PubKey

PubKey returns the public key of the signer

func (*Signer) SetPollTime

func (s *Signer) SetPollTime(pollTime time.Duration)

SetPollTime sets how often the signer should poll for the confirmation of the transaction

func (*Signer) SubmitPayForBlob

func (s *Signer) SubmitPayForBlob(ctx context.Context, blobs []*blob.Blob, opts ...TxOption) (*sdktypes.TxResponse, error)

SubmitPayForBlob forms a transaction from the provided blobs, signs it, and submits it to the chain. TxOptions may be provided to set the fee and gas limit.

func (*Signer) SubmitTx

func (s *Signer) SubmitTx(ctx context.Context, msgs []sdktypes.Msg, opts ...TxOption) (*sdktypes.TxResponse, error)

SubmitTx forms a transaction from the provided messages, signs it, and submits it to the chain. TxOptions may be provided to set the fee and gas limit.

type TxOption

type TxOption func(builder sdkclient.TxBuilder) sdkclient.TxBuilder

func SetFee

func SetFee(fees uint64) TxOption

func SetFeeAmount

func SetFeeAmount(fees sdk.Coins) TxOption

func SetFeeGranter

func SetFeeGranter(feeGranter sdk.AccAddress) TxOption

func SetFeePayer

func SetFeePayer(feePayer sdk.AccAddress) TxOption

func SetGasLimit

func SetGasLimit(limit uint64) TxOption

func SetGasLimitAndFee

func SetGasLimitAndFee(gasLimit uint64, gasPrice float64) TxOption

SetGasLimitAndFee sets the gas limit and fee using the provided gas price and gas limit. Note that this could overwrite or be overwritten by other conflicting TxOptions.

func SetMemo

func SetMemo(memo string) TxOption

func SetTimeoutHeight

func SetTimeoutHeight(height uint64) TxOption

func SetTip

func SetTip(tip *tx.Tip) TxOption

Jump to

Keyboard shortcuts

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