Documentation ¶
Index ¶
- Constants
- func InheritTxConfig(builder sdkclient.TxBuilder, tx authsigning.Tx) sdkclient.TxBuilder
- func QueryAccount(ctx context.Context, conn *grpc.ClientConn, encCfg encoding.Config, ...) (accNum uint64, seqNum uint64, err error)
- func QueryAccountInfo(ctx context.Context, conn *grpc.ClientConn, ...) (accNum uint64, seqNum uint64, err error)
- type Account
- type Option
- type Signer
- func NewSigner(keys keyring.Keyring, conn *grpc.ClientConn, address sdktypes.AccAddress, ...) (*Signer, error)
- func SetupSigner(ctx context.Context, keys keyring.Keyring, conn *grpc.ClientConn, ...) (*Signer, error)
- func SetupSingleSigner(ctx context.Context, keys keyring.Keyring, conn *grpc.ClientConn, ...) (*Signer, error)
- func (s *Signer) AccountNumber() uint64
- func (s *Signer) Address() sdktypes.AccAddress
- func (s *Signer) BroadcastTx(ctx context.Context, tx authsigning.Tx) (*sdktypes.TxResponse, error)
- func (s *Signer) ChainID() string
- func (s *Signer) ConfirmTx(ctx context.Context, txHash string) (*sdktypes.TxResponse, error)
- func (s *Signer) CreatePayForBlob(blobs []*tmproto.Blob, opts ...TxOption) ([]byte, error)
- func (s *Signer) CreateTx(msgs []sdktypes.Msg, opts ...TxOption) (authsigning.Tx, error)
- func (s *Signer) DecodeTx(txBytes []byte) (authsigning.Tx, error)
- func (s *Signer) EncodeTx(tx sdktypes.Tx) ([]byte, error)
- func (s *Signer) EstimateGas(ctx context.Context, msgs []sdktypes.Msg, opts ...TxOption) (uint64, error)
- func (s *Signer) ForceSetSequence(seq uint64)
- func (s *Signer) GetSequence() uint64
- func (s *Signer) Keyring() keyring.Keyring
- func (s *Signer) LocalSequence() uint64
- func (s *Signer) NetworkSequence() uint64
- func (s *Signer) PubKey() cryptotypes.PubKey
- func (s *Signer) SetPollTime(pollTime time.Duration)
- func (s *Signer) SubmitPayForBlob(ctx context.Context, blobs []*tmproto.Blob, opts ...TxOption) (*sdktypes.TxResponse, error)
- func (s *Signer) SubmitTx(ctx context.Context, msgs []sdktypes.Msg, opts ...TxOption) (*sdktypes.TxResponse, error)
- type TxClient
- func (s *TxClient) Account(name string) (*Account, bool)
- func (s *TxClient) AccountByAddress(address sdktypes.AccAddress) *Account
- func (s *TxClient) BroadcastPayForBlob(ctx context.Context, blobs []*tmproto.Blob, opts ...TxOption) (*sdktypes.TxResponse, error)
- func (s *TxClient) BroadcastPayForBlobWithAccount(ctx context.Context, account string, blobs []*tmproto.Blob, opts ...TxOption) (*sdktypes.TxResponse, error)
- func (s *TxClient) BroadcastTx(ctx context.Context, msgs []sdktypes.Msg, opts ...TxOption) (*sdktypes.TxResponse, error)
- func (s *TxClient) ConfirmTx(ctx context.Context, txHash string) (*sdktypes.TxResponse, error)
- func (s *TxClient) DefaultAccountName() string
- func (s *TxClient) DefaultAddress() sdktypes.AccAddress
- func (s *TxClient) EstimateGas(ctx context.Context, msgs []sdktypes.Msg, opts ...TxOption) (uint64, error)
- func (s *TxClient) Signer() *TxSigner
- func (s *TxClient) SubmitPayForBlob(ctx context.Context, blobs []*tmproto.Blob, opts ...TxOption) (*sdktypes.TxResponse, error)
- func (s *TxClient) SubmitPayForBlobsWithAccount(ctx context.Context, account string, blobs []*tmproto.Blob, opts ...TxOption) (*sdktypes.TxResponse, error)
- func (s *TxClient) SubmitTx(ctx context.Context, msgs []sdktypes.Msg, opts ...TxOption) (*sdktypes.TxResponse, error)
- type TxOption
- func SetFee(fees uint64) TxOption
- func SetFeeAmount(fees sdk.Coins) TxOption
- func SetFeeGranter(feeGranter sdk.AccAddress) TxOption
- func SetFeePayer(feePayer sdk.AccAddress) TxOption
- func SetGasLimit(limit uint64) TxOption
- func SetGasLimitAndFee(gasLimit uint64, gasPrice float64) TxOption
- func SetMemo(memo string) TxOption
- func SetTimeoutHeight(height uint64) TxOption
- func SetTip(tip *tx.Tip) TxOption
- type TxSigner
- func (s *TxSigner) Account(name string) *Account
- func (s *TxSigner) AccountByAddress(address sdktypes.AccAddress) *Account
- func (s *TxSigner) Accounts() []*Account
- func (s *TxSigner) AddAccount(acc *Account) error
- func (s *TxSigner) ChainID() string
- func (s *TxSigner) CreatePayForBlobs(accountName string, blobs []*tmproto.Blob, opts ...TxOption) ([]byte, uint64, error)
- func (s *TxSigner) CreateTx(msgs []sdktypes.Msg, opts ...TxOption) ([]byte, error)
- func (s *TxSigner) DecodeTx(txBytes []byte) (authsigning.Tx, error)
- func (s *TxSigner) EncodeTx(tx sdktypes.Tx) ([]byte, error)
- func (s *TxSigner) IncrementSequence(accountName string) error
- func (s *TxSigner) Keyring() keyring.Keyring
- func (s *TxSigner) SetSequence(accountName string, seq uint64) error
- func (s *TxSigner) SignTx(msgs []sdktypes.Msg, opts ...TxOption) (authsigning.Tx, string, uint64, error)
Constants ¶
const ( DefaultPollTime = 3 * time.Second DefaultGasMultiplier float64 = 1.1 )
Variables ¶
This section is empty.
Functions ¶
func InheritTxConfig ¶
InheritTxConfig sets all of the accessible configurations from a given tx into a given client.TxBuilder
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.
func QueryAccountInfo ¶ added in v1.11.0
func QueryAccountInfo(ctx context.Context, conn *grpc.ClientConn, registry codectypes.InterfaceRegistry, address types.AccAddress) (accNum uint64, seqNum uint64, err error)
QueryAccountInfo fetches the account number and sequence number from the celestia-app node.
Types ¶
type Account ¶ added in v1.11.0
type Account struct {
// contains filtered or unexported fields
}
func NewAccount ¶ added in v1.11.0
func (Account) Address ¶ added in v1.11.0
func (a Account) Address() types.AccAddress
func (Account) PubKey ¶ added in v1.11.0
func (a Account) PubKey() cryptotypes.PubKey
type Option ¶ added in v1.11.0
type Option func(s *TxClient)
func WithDefaultAccount ¶ added in v1.11.0
func WithDefaultAddress ¶ added in v1.11.0
func WithDefaultAddress(address sdktypes.AccAddress) Option
func WithGasMultiplier ¶ added in v1.11.0
WithGasMultiplier is a functional option allows to configure the gas multiplier.
func WithPollTime ¶ added in v1.11.0
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 ¶
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, tx authsigning.Tx) (*sdktypes.TxResponse, error)
BroadcastTx submits the provided transaction bytes to the chain and returns the response.
func (*Signer) 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 (*Signer) CreatePayForBlob ¶
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) DecodeTx ¶ added in v1.8.0
func (s *Signer) DecodeTx(txBytes []byte) (authsigning.Tx, error)
func (*Signer) EstimateGas ¶ added in v1.8.0
func (*Signer) ForceSetSequence ¶
ForceSetSequence manually overrides the current local and network level 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) LocalSequence ¶ added in v1.8.0
LocalSequence returns the next sequence number of the signers locally saved
func (*Signer) NetworkSequence ¶ added in v1.8.0
func (*Signer) PubKey ¶
func (s *Signer) PubKey() cryptotypes.PubKey
PubKey returns the public key of the signer
func (*Signer) SetPollTime ¶
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 []*tmproto.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.
type TxClient ¶ added in v1.11.0
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 ¶ added in v1.11.0
func NewTxClient( signer *TxSigner, conn *grpc.ClientConn, registry codectypes.InterfaceRegistry, options ...Option, ) (*TxClient, error)
NewTxClient returns a new signer using the provided keyring
func SetupTxClient ¶ added in v1.11.0
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 ¶ added in v1.11.0
Account returns an account of the signer from the key name. Also returns a bool if the account exists. Thread-safe
func (*TxClient) AccountByAddress ¶ added in v1.11.0
func (s *TxClient) AccountByAddress(address sdktypes.AccAddress) *Account
func (*TxClient) BroadcastPayForBlob ¶ added in v1.11.0
func (s *TxClient) BroadcastPayForBlob(ctx context.Context, blobs []*tmproto.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.
func (*TxClient) BroadcastPayForBlobWithAccount ¶ added in v1.11.0
func (*TxClient) BroadcastTx ¶ added in v1.11.0
func (*TxClient) ConfirmTx ¶ added in v1.11.0
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 ¶ added in v1.11.0
func (*TxClient) DefaultAddress ¶ added in v1.11.0
func (s *TxClient) DefaultAddress() sdktypes.AccAddress
func (*TxClient) EstimateGas ¶ added in v1.11.0
func (*TxClient) SubmitPayForBlob ¶ added in v1.11.0
func (s *TxClient) SubmitPayForBlob(ctx context.Context, blobs []*tmproto.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 (*TxClient) SubmitPayForBlobsWithAccount ¶ added in v1.11.0
func (*TxClient) SubmitTx ¶ added in v1.11.0
func (s *TxClient) 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 ¶
func SetFeeAmount ¶
func SetFeeGranter ¶
func SetFeeGranter(feeGranter sdk.AccAddress) TxOption
func SetFeePayer ¶
func SetFeePayer(feePayer sdk.AccAddress) TxOption
func SetGasLimit ¶
func SetGasLimitAndFee ¶
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 SetTimeoutHeight ¶
type TxSigner ¶ added in v1.11.0
type TxSigner struct {
// contains filtered or unexported fields
}
TxSigner is struct for building and signing Celestia transactions It supports multiple accounts wrapping a Keyring. NOTE: All transactions may only have a single signer TxSigner is not thread-safe.
func NewTxSigner ¶ added in v1.11.0
func NewTxSigner( keys keyring.Keyring, encCfg client.TxConfig, chainID string, appVersion uint64, accounts ...*Account, ) (*TxSigner, error)
NewTxSigner 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 (*TxSigner) Account ¶ added in v1.11.0
Account returns an account of the signer from the key name
func (*TxSigner) AccountByAddress ¶ added in v1.11.0
func (s *TxSigner) AccountByAddress(address sdktypes.AccAddress) *Account
AccountByAddress returns the account associated with the given address
func (*TxSigner) AddAccount ¶ added in v1.11.0
func (*TxSigner) CreatePayForBlobs ¶ added in v1.11.0
func (*TxSigner) CreateTx ¶ added in v1.11.0
CreateTx forms a transaction from the provided messages and signs it. TxOptions may be optionally used to set the gas limit and fee.
func (*TxSigner) DecodeTx ¶ added in v1.11.0
func (s *TxSigner) DecodeTx(txBytes []byte) (authsigning.Tx, error)