Documentation ¶
Index ¶
- Constants
- func QueryAccount(ctx context.Context, conn *grpc.ClientConn, ...) (accNum uint64, seqNum uint64, err error)
- func QueryMinimumGasPrice(ctx context.Context, grpcConn *grpc.ClientConn) (float64, error)
- func QueryNetworkMinGasPrice(ctx context.Context, grpcConn *grpc.ClientConn) (float64, error)
- type Account
- type BroadcastTxError
- type ExecutionError
- type Option
- type Signer
- func (s *Signer) Account(name string) *Account
- func (s *Signer) AccountByAddress(address sdktypes.AccAddress) *Account
- func (s *Signer) Accounts() []*Account
- func (s *Signer) AddAccount(acc *Account) error
- func (s *Signer) ChainID() string
- func (s *Signer) CreatePayForBlobs(accountName string, blobs []*blob.Blob, opts ...TxOption) ([]byte, uint64, error)
- func (s *Signer) CreateTx(msgs []sdktypes.Msg, opts ...TxOption) ([]byte, error)
- func (s *Signer) DecodeTx(txBytes []byte) (authsigning.Tx, error)
- func (s *Signer) EncodeTx(tx sdktypes.Tx) ([]byte, error)
- func (s *Signer) IncrementSequence(accountName string) error
- func (s *Signer) Keyring() keyring.Keyring
- func (s *Signer) SetSequence(accountName string, seq uint64) error
- func (s *Signer) SignTx(msgs []sdktypes.Msg, opts ...TxOption) (authsigning.Tx, string, uint64, error)
- type TxClient
- func (client *TxClient) Account(name string) *Account
- func (client *TxClient) AccountByAddress(address sdktypes.AccAddress) *Account
- func (client *TxClient) BroadcastPayForBlob(ctx context.Context, blobs []*blob.Blob, opts ...TxOption) (*sdktypes.TxResponse, error)
- func (client *TxClient) BroadcastPayForBlobWithAccount(ctx context.Context, account string, blobs []*blob.Blob, opts ...TxOption) (*sdktypes.TxResponse, error)
- func (client *TxClient) BroadcastTx(ctx context.Context, msgs []sdktypes.Msg, opts ...TxOption) (*sdktypes.TxResponse, error)
- func (client *TxClient) ConfirmTx(ctx context.Context, txHash string) (*TxResponse, error)
- func (client *TxClient) DefaultAccountName() string
- func (client *TxClient) DefaultAddress() sdktypes.AccAddress
- func (client *TxClient) EstimateGas(ctx context.Context, msgs []sdktypes.Msg, opts ...TxOption) (uint64, error)
- func (client *TxClient) SetDefaultGasPrice(price float64)
- func (client *TxClient) SetGasMultiplier(multiplier float64)
- func (client *TxClient) Signer() *Signer
- func (client *TxClient) SubmitPayForBlob(ctx context.Context, blobs []*blob.Blob, opts ...TxOption) (*TxResponse, error)
- func (client *TxClient) SubmitPayForBlobWithAccount(ctx context.Context, account string, blobs []*blob.Blob, opts ...TxOption) (*TxResponse, error)
- func (client *TxClient) SubmitTx(ctx context.Context, msgs []sdktypes.Msg, opts ...TxOption) (*TxResponse, error)
- type TxOption
- func SetFee(fees uint64) TxOption
- func SetFeeGranter(feeGranter sdk.AccAddress) TxOption
- func SetFeePayer(feePayer sdk.AccAddress) TxOption
- func SetGasLimit(limit uint64) TxOption
- func SetGasLimitAndGasPrice(gasLimit uint64, gasPrice float64) TxOption
- func SetMemo(memo string) TxOption
- func SetTimeoutHeight(height uint64) TxOption
- func SetTip(tip *tx.Tip) TxOption
- type TxResponse
Constants ¶
const ( DefaultPollTime = 3 * time.Second DefaultGasMultiplier float64 = 1.1 )
Variables ¶
This section is empty.
Functions ¶
func QueryAccount ¶
func QueryAccount(ctx context.Context, conn *grpc.ClientConn, registry codectypes.InterfaceRegistry, address types.AccAddress) (accNum uint64, seqNum uint64, err error)
QueryAccount fetches the account number and sequence number from the celestia-app node.
func QueryMinimumGasPrice ¶
QueryMinimumGasPrice queries both the nodes local and network wide minimum gas prices, returning the maximum of the two.
func QueryNetworkMinGasPrice ¶
Types ¶
type Account ¶
type Account struct {
// contains filtered or unexported fields
}
func NewAccount ¶
func (Account) Address ¶
func (a Account) Address() types.AccAddress
func (Account) PubKey ¶
func (a Account) PubKey() cryptotypes.PubKey
type BroadcastTxError ¶ added in v2.1.0
type BroadcastTxError struct { TxHash string Code uint32 // ErrorLog is the error output of the app's logger ErrorLog string }
BroadcastTxError is an error that occurs when broadcasting a transaction.
func (*BroadcastTxError) Error ¶ added in v2.1.0
func (e *BroadcastTxError) Error() string
type ExecutionError ¶ added in v2.1.0
type ExecutionError struct { TxHash string Code uint32 // ErrorLog is the error output of the app's logger ErrorLog string }
ExecutionError is an error that occurs when a transaction gets executed.
func (*ExecutionError) Error ¶ added in v2.1.0
func (e *ExecutionError) Error() string
type Option ¶
type Option func(client *TxClient)
func WithDefaultAccount ¶
func WithDefaultAddress ¶
func WithDefaultAddress(address sdktypes.AccAddress) Option
func WithDefaultGasPrice ¶
WithDefaultGasPrice sets the gas price.
func WithGasMultiplier ¶
WithGasMultiplier is a functional option allows to configure the gas multiplier.
func WithPollTime ¶
type Signer ¶
type Signer struct {
// contains filtered or unexported fields
}
Signer is struct for building and signing Celestia transactions It supports multiple accounts wrapping a Keyring. NOTE: All transactions may only have a single signer Signer is not thread-safe.
func NewSigner ¶
func NewSigner( keys keyring.Keyring, encCfg client.TxConfig, chainID string, appVersion uint64, accounts ...*Account, ) (*Signer, error)
NewSigner returns a new signer using the provided keyring There must be at least one account in the keyring The first account provided will be set as the default
func (*Signer) AccountByAddress ¶
func (s *Signer) AccountByAddress(address sdktypes.AccAddress) *Account
AccountByAddress returns the account associated with the given address
func (*Signer) AddAccount ¶
func (*Signer) CreatePayForBlobs ¶
func (*Signer) CreateTx ¶
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) IncrementSequence ¶
type TxClient ¶
type TxClient struct {
// contains filtered or unexported fields
}
TxClient is an abstraction for building, signing, and broadcasting Celestia transactions It supports multiple accounts. If none is specified, it will try use the default account. TxClient is thread-safe.
func NewTxClient ¶
func NewTxClient( signer *Signer, conn *grpc.ClientConn, registry codectypes.InterfaceRegistry, options ...Option, ) (*TxClient, error)
NewTxClient returns a new signer using the provided keyring
func SetupTxClient ¶
func SetupTxClient( ctx context.Context, keys keyring.Keyring, conn *grpc.ClientConn, encCfg encoding.Config, options ...Option, ) (*TxClient, error)
SetupTxClient uses the underlying grpc connection to populate the chainID, accountNumber and sequence number of all the accounts in the keyring.
func (*TxClient) Account ¶
Account returns an account of the signer from the key name. Also returns a bool if the account exists. Thread-safe
func (*TxClient) AccountByAddress ¶
func (client *TxClient) AccountByAddress(address sdktypes.AccAddress) *Account
func (*TxClient) BroadcastPayForBlob ¶
func (client *TxClient) BroadcastPayForBlob(ctx context.Context, blobs []*blob.Blob, opts ...TxOption) (*sdktypes.TxResponse, error)
BroadcastPayForBlob signs and broadcasts a transaction to pay for blobs. It does not confirm that the transaction has been committed on chain. If no gas or gas price is set, it will estimate the gas and use the max effective gas price: max(localMinGasPrice, networkMinGasPrice).
func (*TxClient) BroadcastPayForBlobWithAccount ¶
func (*TxClient) BroadcastTx ¶
func (*TxClient) ConfirmTx ¶
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 (*TxClient) DefaultAccountName ¶
func (*TxClient) DefaultAddress ¶
func (client *TxClient) DefaultAddress() sdktypes.AccAddress
func (*TxClient) EstimateGas ¶
func (client *TxClient) EstimateGas(ctx context.Context, msgs []sdktypes.Msg, opts ...TxOption) (uint64, error)
EstimateGas simulates the transaction, calculating the amount of gas that was consumed during execution. The final result will be multiplied by gasMultiplier(that is set in TxClient)
func (*TxClient) SetDefaultGasPrice ¶
func (*TxClient) SetGasMultiplier ¶
func (*TxClient) SubmitPayForBlob ¶
func (client *TxClient) SubmitPayForBlob(ctx context.Context, blobs []*blob.Blob, opts ...TxOption) (*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 (*TxClient) SubmitPayForBlobWithAccount ¶
func (client *TxClient) SubmitPayForBlobWithAccount(ctx context.Context, account string, blobs []*blob.Blob, opts ...TxOption) (*TxResponse, error)
SubmitPayForBlobWithAccount forms a transaction from the provided blobs, signs it with the provided account, and submits it to the chain. TxOptions may be provided to set the fee and gas limit.
type TxOption ¶
func SetFeeGranter ¶
func SetFeeGranter(feeGranter sdk.AccAddress) TxOption
func SetFeePayer ¶
func SetFeePayer(feePayer sdk.AccAddress) TxOption
func SetGasLimit ¶
func SetGasLimitAndGasPrice ¶
SetGasLimitAndGasPrice 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 SetTimeoutHeight ¶
type TxResponse ¶ added in v2.1.0
type TxResponse struct { // Height is the block height at which the transaction was included on-chain. Height int64 TxHash string Code uint32 }
TxResponse is a response from the chain after a transaction has been submitted.