Documentation
¶
Index ¶
- func BroadcastShortTermOrder(ctx context.Context, l *zap.Logger, cosmosClient *cosmosclient.Client, ...) error
- func BroadcastWithRetry(ctx context.Context, l *zap.Logger, cosmosClient *cosmosclient.Client, ...) error
- func BroadcastWithRetryAndResponse(ctx context.Context, l *zap.Logger, cosmosClient *cosmosclient.Client, ...) (*cosmosclient.Response, error)
- func GetBlockHeight(ctx context.Context, l *zap.Logger, rpcServerAddress, prefix string) (*int64, error)
- func GetGranteeAccount(c *cosmosclient.Client, signer, prefix string) (cosmosaccount.Account, error)
- func GetGranteeAddress(c *cosmosclient.Client, signer, prefix string) (string, error)
- func GetSignerAccountAndAddress(c *cosmosclient.Client, signer, prefix string) (*cosmosaccount.Account, string, error)
- func GetTendermintClient(l *zap.Logger, rpchttp *http.HTTP) cometbft.CometRPC
- func InitCosmosClient(ctx context.Context, l *zap.Logger, chain *types.Chain, key *types.SigningKey) (*cosmosclient.Client, error)
- func InitCosmosQueryClient(ctx context.Context, l *zap.Logger, serverAddress, addressPrefix string) (*cosmosclient.Client, error)
- func InitFeeClient(ctx context.Context, l *zap.Logger, chain *types.Chain, key *types.SigningKey) (*cosmosclient.Client, error)
- func InitRPCClient(logger *zap.Logger, serverAddress, websocketPath string) (*rpchttp.HTTP, cometbft.CometRPC, error)
- func SendMessages(ctx context.Context, l *zap.Logger, clientRegistry *ClientRegistry, ...) (*cosmosclient.Response, error)
- type ChainMessage
- type ClientEntry
- type ClientInstance
- type ClientRegistry
- func (r *ClientRegistry) Close()
- func (r *ClientRegistry) GetBalance(ctx context.Context, chainID, signerAccount, denom string) (*sdkmath.Int, error)
- func (r *ClientRegistry) GetClient(chainID string, isFeeClient bool) (*ClientInstance, error)
- func (r *ClientRegistry) GetHeight(ctx context.Context, chainID string) (*int64, error)
- func (r *ClientRegistry) GetSignerAccountAndAddress(signerAccount, chainID string) (*cosmosaccount.Account, string, error)
- func (r *ClientRegistry) HasClient(chainID string) bool
- func (r *ClientRegistry) RegisterClient(chain *types.Chain, key *types.SigningKey) error
- type DefaultMessageSender
- func (*DefaultMessageSender) SendAuthzMessages(ctx context.Context, l *zap.Logger, c *cosmosclient.Client, cfg *types.Config, ...) error
- func (*DefaultMessageSender) SendAuthzMessagesWithResponse(ctx context.Context, l *zap.Logger, c *cosmosclient.Client, cfg *types.Config, ...) (*cosmosclient.Response, error)
- func (*DefaultMessageSender) SendMessages(ctx context.Context, l *zap.Logger, c *cosmosclient.Client, cfg *types.Config, ...) error
- func (*DefaultMessageSender) SendMessagesWithResponse(ctx context.Context, l *zap.Logger, c *cosmosclient.Client, cfg *types.Config, ...) (*cosmosclient.Response, error)
- func (*DefaultMessageSender) SendShortTermMessage(ctx context.Context, l *zap.Logger, c *cosmosclient.Client, cfg *types.Config, ...) error
- type MessageSender
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BroadcastShortTermOrder ¶
func BroadcastShortTermOrder(ctx context.Context, l *zap.Logger, cosmosClient *cosmosclient.Client, account cosmosaccount.Account, msgs ...sdk.Msg) error
BroadcastShortTermOrder broadcasts a transaction and checks for immediate errors, specifically designed for dYdX short-term orders which don't get included in blocks
func BroadcastWithRetry ¶
func BroadcastWithRetryAndResponse ¶
func BroadcastWithRetryAndResponse(ctx context.Context, l *zap.Logger, cosmosClient *cosmosclient.Client, account cosmosaccount.Account, cfg *types.Config, msgs ...sdk.Msg) (*cosmosclient.Response, error)
func GetBlockHeight ¶
func GetGranteeAccount ¶
func GetGranteeAccount(c *cosmosclient.Client, signer, prefix string) (cosmosaccount.Account, error)
func GetGranteeAddress ¶
func GetGranteeAddress(c *cosmosclient.Client, signer, prefix string) (string, error)
func GetSignerAccountAndAddress ¶
func GetSignerAccountAndAddress(c *cosmosclient.Client, signer, prefix string) (*cosmosaccount.Account, string, error)
Define a function to get the signer account and address
func GetTendermintClient ¶
func InitCosmosClient ¶
func InitCosmosClient(ctx context.Context, l *zap.Logger, chain *types.Chain, key *types.SigningKey) (*cosmosclient.Client, error)
InitCosmosClient initializes a Cosmos client with retry logic
func InitCosmosQueryClient ¶
func InitCosmosQueryClient(ctx context.Context, l *zap.Logger, serverAddress, addressPrefix string) (*cosmosclient.Client, error)
InitCosmosQueryClient initialises a cosmosclient for querying which is lightweight and can be disposed of after use.
func InitFeeClient ¶
func InitFeeClient(ctx context.Context, l *zap.Logger, chain *types.Chain, key *types.SigningKey) (*cosmosclient.Client, error)
InitFeeClient initialises a cosmosclient for executing transactions.
func InitRPCClient ¶
func InitRPCClient(logger *zap.Logger, serverAddress, websocketPath string) (*rpchttp.HTTP, cometbft.CometRPC, error)
InitRPCClient initialises a RPC client.
func SendMessages ¶
func SendMessages( ctx context.Context, l *zap.Logger, clientRegistry *ClientRegistry, chainMsg ChainMessage, messageSender MessageSender, cfg *types.Config, isDryRun, isFeeClient, wrapAuthz bool, ) (*cosmosclient.Response, error)
Types ¶
type ChainMessage ¶
type ChainMessage struct {
ChainID string // Chain ID where this message should be executed
Messages []sdk.Msg // Messages to be executed on the source chain
IsFeeClient bool // Whether to use the fee client
WrapAuthz bool // Whether to wrap the messages in an Authz MsgExec
}
ChainMessage wraps a message with its source chain information for proper routing
func NewAuthzChainMsg ¶
func NewAuthzChainMsg(chainID string, msgs []sdk.Msg) ChainMessage
NewAuthzChainMsg creates a new ChainMessage with WrapAuthz set to true
func NewChainMsg ¶
func NewChainMsg(chainID string, msgs []sdk.Msg) ChainMessage
NewChainMsg creates a new ChainMessage with WrapAuthz set to false
type ClientEntry ¶
type ClientEntry struct {
Chain *types.Chain
Key *types.SigningKey
}
ClientEntry represents a registered chain with its client and configuration
type ClientInstance ¶
type ClientInstance struct {
Client *cosmosclient.Client
Chain *types.Chain
Key *types.SigningKey
}
ClientInstance represents a registered chain with its client and configuration
type ClientRegistry ¶
type ClientRegistry struct {
// contains filtered or unexported fields
}
ClientRegistry manages connections to multiple chains
func NewClientRegistry ¶
func NewClientRegistry(logger *zap.Logger, signerAccount string) *ClientRegistry
NewClientRegistry creates a new chain registry
func (*ClientRegistry) GetBalance ¶
func (r *ClientRegistry) GetBalance(ctx context.Context, chainID, signerAccount, denom string) (*sdkmath.Int, error)
GetBalance retrieves the balance of an account on a chain by its ID
func (*ClientRegistry) GetClient ¶
func (r *ClientRegistry) GetClient(chainID string, isFeeClient bool) (*ClientInstance, error)
GetClient retrieves a chain client entry by its ID
func (*ClientRegistry) GetSignerAccountAndAddress ¶
func (r *ClientRegistry) GetSignerAccountAndAddress(signerAccount, chainID string) (*cosmosaccount.Account, string, error)
GetSignerAccountAndAddress retrieves the account and address for a specific chain
func (*ClientRegistry) HasClient ¶
func (r *ClientRegistry) HasClient(chainID string) bool
HasClient checks if a client is registered
func (*ClientRegistry) RegisterClient ¶
func (r *ClientRegistry) RegisterClient(chain *types.Chain, key *types.SigningKey) error
RegisterClient adds a new chain client to the registry
type DefaultMessageSender ¶
type DefaultMessageSender struct{}
DefaultMessageSender is a default implementation of the MessageSender interface
func (*DefaultMessageSender) SendAuthzMessages ¶
func (*DefaultMessageSender) SendAuthzMessages(ctx context.Context, l *zap.Logger, c *cosmosclient.Client, cfg *types.Config, msgs ...sdk.Msg) error
SendAuthzMessages sends the given messages using the cosmos client and grantee information. It returns an error if any step fails.
func (*DefaultMessageSender) SendAuthzMessagesWithResponse ¶
func (*DefaultMessageSender) SendAuthzMessagesWithResponse(ctx context.Context, l *zap.Logger, c *cosmosclient.Client, cfg *types.Config, msgs ...sdk.Msg) (*cosmosclient.Response, error)
SendAuthzMessagesWithResponse sends the given messages using the cosmos client and grantee information. It returns an error if any step fails.
func (*DefaultMessageSender) SendMessages ¶
func (*DefaultMessageSender) SendMessages(ctx context.Context, l *zap.Logger, c *cosmosclient.Client, cfg *types.Config, msgs ...sdk.Msg) error
SendMessages sends the given messages using the cosmos client and grantee information. It returns an error if any step fails.
func (*DefaultMessageSender) SendMessagesWithResponse ¶
func (*DefaultMessageSender) SendMessagesWithResponse(ctx context.Context, l *zap.Logger, c *cosmosclient.Client, cfg *types.Config, msgs ...sdk.Msg) (*cosmosclient.Response, error)
SendMessages sends the given messages using the cosmos client and grantee information. It returns an error if any step fails.
func (*DefaultMessageSender) SendShortTermMessage ¶
func (*DefaultMessageSender) SendShortTermMessage(ctx context.Context, l *zap.Logger, c *cosmosclient.Client, cfg *types.Config, msgs ...sdk.Msg) error
SendMessages sends the given messages using the cosmos client and grantee information. It returns an error if any step fails.
type MessageSender ¶
type MessageSender interface {
SendAuthzMessages(ctx context.Context, l *zap.Logger, c *cosmosclient.Client, cfg *types.Config, msgs ...sdk.Msg) error
SendAuthzMessagesWithResponse(ctx context.Context, l *zap.Logger, c *cosmosclient.Client, cfg *types.Config, msgs ...sdk.Msg) (*cosmosclient.Response, error)
SendMessages(ctx context.Context, l *zap.Logger, c *cosmosclient.Client, cfg *types.Config, msgs ...sdk.Msg) error
SendMessagesWithResponse(ctx context.Context, l *zap.Logger, c *cosmosclient.Client, cfg *types.Config, msgs ...sdk.Msg) (*cosmosclient.Response, error)
}
MessageSender defines an interface for sending messages using the cosmos client