Documentation ¶
Overview ¶
Package zetacore provides the client to interact with zetacore node via GRPC.
Index ¶
- Constants
- func GasPriceMultiplier(chain chains.Chain) float64
- func GetInboundVoteMessage(sender string, senderChain int64, txOrigin string, receiver string, ...) *types.MsgVoteInbound
- func HandleBroadcastError(err error, nonce, toChain, outboundHash string) (bool, bool)
- func WrapMessageWithAuthz(msg sdk.Msg) (sdk.Msg, clientauthz.Signer, error)
- type Client
- func (c *Client) Broadcast(ctx context.Context, gasLimit uint64, authzWrappedMsg sdktypes.Msg, ...) (string, error)
- func (c *Client) Chain() chains.Chain
- func (c *Client) GetAccountNumberAndSequenceNumber(_ authz.KeyType) (uint64, uint64, error)
- func (c *Client) GetAllOutboundTrackerByChain(ctx context.Context, chainID int64, order interfaces.Order) ([]types.OutboundTracker, error)
- func (c *Client) GetGenesisSupply(ctx context.Context) (sdkmath.Int, error)
- func (c *Client) GetKeys() keyinterfaces.ObserverKeys
- func (c *Client) GetLogger() *zerolog.Logger
- func (c *Client) GetZetaHotKeyBalance(ctx context.Context) (sdkmath.Int, error)
- func (c *Client) MonitorVoteInboundResult(ctx context.Context, zetaTxHash string, retryGasLimit uint64, ...) error
- func (c *Client) MonitorVoteOutboundResult(ctx context.Context, zetaTxHash string, retryGasLimit uint64, ...) error
- func (c *Client) PostOutboundTracker(ctx context.Context, chainID int64, nonce uint64, txHash string) (string, error)
- func (c *Client) PostVoteBlameData(ctx context.Context, blame *blame.Blame, chainID int64, index string) (string, error)
- func (c *Client) PostVoteGasPrice(ctx context.Context, chain chains.Chain, gasPrice uint64, ...) (string, error)
- func (c *Client) PostVoteInbound(ctx context.Context, gasLimit, retryGasLimit uint64, msg *types.MsgVoteInbound) (string, string, error)
- func (c *Client) PostVoteOutbound(ctx context.Context, gasLimit, retryGasLimit uint64, ...) (string, string, error)
- func (c *Client) PostVoteTSS(ctx context.Context, tssPubKey string, keyGenZetaHeight int64, ...) (string, error)
- func (c *Client) QueryTxResult(hash string) (*sdktypes.TxResponse, error)
- func (c *Client) SetAccountNumber(keyType authz.KeyType) error
- func (c *Client) SignTx(txf clienttx.Factory, name string, txBuilder client.TxBuilder, ...) error
- func (c *Client) UpdateChainID(chainID string) error
- type Opt
Constants ¶
const ( // DefaultBaseGasPrice is the default base gas price DefaultBaseGasPrice = 1_000_000 // DefaultGasLimit is the default gas limit used for broadcasting txs DefaultGasLimit = 200_000 // PostGasPriceGasLimit is the gas limit for voting new gas price PostGasPriceGasLimit = 1_500_000 // PostVoteInboundGasLimit is the gas limit for voting on observed inbound tx (for zetachain itself) PostVoteInboundGasLimit = 500_000 // PostTSSGasLimit is the gas limit for voting on TSS keygen PostTSSGasLimit = 500_000 // PostVoteInboundExecutionGasLimit is the gas limit for voting on observed inbound tx and executing it PostVoteInboundExecutionGasLimit = 7_000_000 // PostVoteInboundMessagePassingExecutionGasLimit is the gas limit for voting on, and executing ,observed inbound tx related to message passing (coin_type == zeta) PostVoteInboundMessagePassingExecutionGasLimit = 4_000_000 // PostVoteInboundCallOptionsGasLimit is the gas limit for inbound call options PostVoteInboundCallOptionsGasLimit uint64 = 1_500_000 // AddOutboundTrackerGasLimit is the gas limit for adding tx hash to out tx tracker AddOutboundTrackerGasLimit = 200_000 // PostBlameDataGasLimit is the gas limit for voting on blames PostBlameDataGasLimit = 200_000 // PostVoteOutboundGasLimit is the gas limit for voting on observed outbound tx (for zetachain itself) PostVoteOutboundGasLimit = 500_000 // PostVoteOutboundRevertGasLimit is the gas limit for voting on observed outbound tx for revert (when outbound fails) // The value is set to 7M because in case of onRevert call, it might consume lot of gas PostVoteOutboundRevertGasLimit = 7_000_000 )
Variables ¶
This section is empty.
Functions ¶
func GasPriceMultiplier ¶
GasPriceMultiplier returns the gas price multiplier for the given chain
func GetInboundVoteMessage ¶
func GetInboundVoteMessage( sender string, senderChain int64, txOrigin string, receiver string, receiverChain int64, amount math.Uint, message string, inboundHash string, inBlockHeight uint64, gasLimit uint64, coinType coin.CoinType, asset string, signerAddress string, eventIndex uint, ) *types.MsgVoteInbound
GetInboundVoteMessage returns a new MsgVoteInbound TODO(revamp): move to a different file
func HandleBroadcastError ¶
HandleBroadcastError returns whether to retry in a few seconds, and whether to report via AddOutboundTracker returns (bool retry, bool report)
func WrapMessageWithAuthz ¶
WrapMessageWithAuthz wraps a message with an authz message used since a hotkey is used to broadcast the transactions, instead of the operator
Types ¶
type Client ¶
type Client struct { zetacore_rpc.Clients // contains filtered or unexported fields }
Client is the client to send tx to zetacore
func NewClient ¶
func NewClient( keys keyinterfaces.ObserverKeys, chainIP string, signerName string, chainID string, logger zerolog.Logger, opts ...Opt, ) (*Client, error)
NewClient create a new instance of Client
func (*Client) Broadcast ¶
func (c *Client) Broadcast( ctx context.Context, gasLimit uint64, authzWrappedMsg sdktypes.Msg, authzSigner authz.Signer, ) (string, error)
Broadcast Broadcasts tx to ZetaChain. Returns txHash and error
func (*Client) GetAccountNumberAndSequenceNumber ¶
GetAccountNumberAndSequenceNumber We do not use multiple KeyType for now , but this can be optionally used in the future to seprate TSS signer from Zetaclient GRantee
func (*Client) GetAllOutboundTrackerByChain ¶
func (c *Client) GetAllOutboundTrackerByChain( ctx context.Context, chainID int64, order interfaces.Order, ) ([]types.OutboundTracker, error)
GetAllOutboundTrackerByChain returns all outbound trackers for a chain
func (*Client) GetGenesisSupply ¶
GetGenesisSupply returns the genesis supply. NOTE that this method is brittle as it uses STATEFUL connection
func (*Client) GetKeys ¶
func (c *Client) GetKeys() keyinterfaces.ObserverKeys
func (*Client) GetZetaHotKeyBalance ¶
GetZetaHotKeyBalance returns the zeta hot key balance
func (*Client) MonitorVoteInboundResult ¶
func (c *Client) MonitorVoteInboundResult( ctx context.Context, zetaTxHash string, retryGasLimit uint64, msg *types.MsgVoteInbound, ) error
MonitorVoteInboundResult monitors the result of a vote inbound tx retryGasLimit is the gas limit used to resend the tx if it fails because of insufficient gas if retryGasLimit is 0, the tx is not resent
func (*Client) MonitorVoteOutboundResult ¶
func (c *Client) MonitorVoteOutboundResult( ctx context.Context, zetaTxHash string, retryGasLimit uint64, msg *types.MsgVoteOutbound, ) error
MonitorVoteOutboundResult monitors the result of a vote outbound tx retryGasLimit is the gas limit used to resend the tx if it fails because of insufficient gas if retryGasLimit is 0, the tx is not resent
func (*Client) PostOutboundTracker ¶
func (c *Client) PostOutboundTracker(ctx context.Context, chainID int64, nonce uint64, txHash string) (string, error)
PostOutboundTracker adds an outbound tracker
func (*Client) PostVoteBlameData ¶
func (c *Client) PostVoteBlameData( ctx context.Context, blame *blame.Blame, chainID int64, index string, ) (string, error)
PostVoteBlameData posts blame data message to zetacore. Returns txHash and error.
func (*Client) PostVoteGasPrice ¶
func (c *Client) PostVoteGasPrice( ctx context.Context, chain chains.Chain, gasPrice uint64, priorityFee, blockNum uint64, ) (string, error)
PostVoteGasPrice posts a gas price vote. Returns txHash and error.
func (*Client) PostVoteInbound ¶
func (c *Client) PostVoteInbound( ctx context.Context, gasLimit, retryGasLimit uint64, msg *types.MsgVoteInbound, ) (string, string, error)
PostVoteInbound posts a vote on an observed inbound tx retryGasLimit is the gas limit used to resend the tx if it fails because of insufficient gas it is used when the ballot is finalized and the inbound tx needs to be processed
func (*Client) PostVoteOutbound ¶
func (c *Client) PostVoteOutbound( ctx context.Context, gasLimit, retryGasLimit uint64, msg *types.MsgVoteOutbound, ) (string, string, error)
PostVoteOutbound posts a vote on an observed outbound tx from a MsgVoteOutbound. Returns tx hash, ballotIndex, and error.
func (*Client) PostVoteTSS ¶
func (c *Client) PostVoteTSS( ctx context.Context, tssPubKey string, keyGenZetaHeight int64, status chains.ReceiveStatus, ) (string, error)
PostVoteTSS sends message to vote TSS. Returns txHash and error.
func (*Client) QueryTxResult ¶
func (c *Client) QueryTxResult(hash string) (*sdktypes.TxResponse, error)
QueryTxResult query the result of a tx
func (*Client) SetAccountNumber ¶
SetAccountNumber sets the account number and sequence number for the given keyType todo remove method and make it part of the client constructor.
func (*Client) SignTx ¶
func (c *Client) SignTx( txf clienttx.Factory, name string, txBuilder client.TxBuilder, overwriteSig bool, ) error
SignTx signs a tx with the given name
func (*Client) UpdateChainID ¶
type Opt ¶
type Opt func(cfg *constructOpts)
func WithCustomAccountRetriever ¶
func WithCustomAccountRetriever(ac cosmosclient.AccountRetriever) Opt
WithCustomAccountRetriever sets custom tendermint client
func WithTendermintClient ¶
func WithTendermintClient(client cosmosclient.TendermintRPC) Opt
WithTendermintClient sets custom tendermint client