Documentation
¶
Index ¶
- Constants
- func FetchVaultAddress(ctx context.Context, rpcClient *RPCClient, gatewayAddress ethcommon.Address) (ethcommon.Address, error)
- func ParseEvent(log *types.Log, eventType string, chainID string, logger zerolog.Logger) *store.Event
- type ChainMetaOracle
- type Client
- type EventConfirmer
- type EventListener
- type RPCClient
- func (rc *RPCClient) BroadcastTransaction(ctx context.Context, tx *types.Transaction) (string, error)
- func (rc *RPCClient) CallContract(ctx context.Context, contractAddr ethcommon.Address, data []byte, ...) ([]byte, error)
- func (rc *RPCClient) CallContractWithFrom(ctx context.Context, from, contractAddr ethcommon.Address, data []byte, ...) ([]byte, error)
- func (rc *RPCClient) Close()
- func (rc *RPCClient) FilterLogs(ctx context.Context, query ethereum.FilterQuery) ([]types.Log, error)
- func (rc *RPCClient) GetFinalizedNonce(ctx context.Context, address ethcommon.Address, blockNum *big.Int) (uint64, error)
- func (rc *RPCClient) GetGasPrice(ctx context.Context) (*big.Int, error)
- func (rc *RPCClient) GetLatestBlock(ctx context.Context) (uint64, error)
- func (rc *RPCClient) GetPendingNonce(ctx context.Context, address ethcommon.Address) (uint64, error)
- func (rc *RPCClient) GetTransactionByHash(ctx context.Context, txHash ethcommon.Hash) (*types.Transaction, bool, error)
- func (rc *RPCClient) GetTransactionReceipt(ctx context.Context, txHash ethcommon.Hash) (*types.Receipt, error)
- func (rc *RPCClient) IsHealthy(ctx context.Context) bool
- type RevertInstructions
- type TxBuilder
- func (tb *TxBuilder) BroadcastOutboundSigningRequest(ctx context.Context, req *common.UnSignedOutboundTxReq, ...) (string, error)
- func (tb *TxBuilder) GetGasFeeUsed(ctx context.Context, txHash string) (string, error)
- func (tb *TxBuilder) GetNextNonce(ctx context.Context, signerAddress string, useFinalized bool) (uint64, error)
- func (tb *TxBuilder) GetOutboundSigningRequest(ctx context.Context, data *uetypes.OutboundCreatedEvent, nonce uint64) (*common.UnSignedOutboundTxReq, error)
- func (tb *TxBuilder) IsAlreadyExecuted(ctx context.Context, txID string) (bool, error)
- func (tb *TxBuilder) VerifyBroadcastedTx(ctx context.Context, txHash string) (found bool, blockHeight uint64, confirmations uint64, status uint8, err error)
Constants ¶
const ( EventTypeSendFunds = "sendFunds" EventTypeExecuteUniversalTx = "executeUniversalTx" EventTypeRevertUniversalTx = "revertUniversalTx" )
Event type constants matching gateway method names in chain config.
const (
EventTypeFinalizeUniversalTx = "finalizeUniversalTx"
)
Vault event type constants matching vault method names in chain config.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ChainMetaOracle ¶ added in v0.0.19
type ChainMetaOracle struct {
// contains filtered or unexported fields
}
ChainMetaOracle handles fetching and reporting gas prices
func NewChainMetaOracle ¶ added in v0.0.19
func NewChainMetaOracle( rpcClient *RPCClient, pushSigner *pushsigner.Signer, chainID string, gasPriceIntervalSeconds int, logger zerolog.Logger, ) *ChainMetaOracle
NewChainMetaOracle creates a new gas oracle
func (*ChainMetaOracle) Start ¶ added in v0.0.19
func (g *ChainMetaOracle) Start(ctx context.Context) error
Start begins fetching and voting on gas prices
func (*ChainMetaOracle) Stop ¶ added in v0.0.19
func (g *ChainMetaOracle) Stop()
Stop stops the gas oracle
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client implements the ChainClient interface for EVM chains
func NewClient ¶
func NewClient( config *uregistrytypes.ChainConfig, database *db.DB, chainConfig *config.ChainSpecificConfig, pushSigner *pushsigner.Signer, logger zerolog.Logger, ) (*Client, error)
NewClient creates a new EVM chain client
func (*Client) GetConfig ¶ added in v0.0.13
func (c *Client) GetConfig() *uregistrytypes.ChainConfig
GetConfig returns the registry chain config
func (*Client) GetTxBuilder ¶ added in v0.0.13
func (c *Client) GetTxBuilder() (common.OutboundTxBuilder, error)
GetTxBuilder returns the OutboundTxBuilder for this chain
type EventConfirmer ¶ added in v0.0.13
type EventConfirmer struct {
// contains filtered or unexported fields
}
EventConfirmer periodically checks pending events and marks them as CONFIRMED once their transactions are confirmed on-chain.
func NewEventConfirmer ¶ added in v0.0.13
func NewEventConfirmer( rpcClient *RPCClient, database *db.DB, chainID string, pollIntervalSeconds int, fastConfirmations uint64, standardConfirmations uint64, logger zerolog.Logger, ) *EventConfirmer
NewEventConfirmer creates a new event confirmer
func (*EventConfirmer) Start ¶ added in v0.0.13
func (ec *EventConfirmer) Start(ctx context.Context) error
Start begins checking and confirming events
func (*EventConfirmer) Stop ¶ added in v0.0.13
func (ec *EventConfirmer) Stop()
Stop stops the event confirmer
type EventListener ¶ added in v0.0.13
type EventListener struct {
// contains filtered or unexported fields
}
EventListener listens for gateway and vault events on EVM chains and stores them in the database
func NewEventListener ¶ added in v0.0.13
func NewEventListener( rpcClient *RPCClient, gatewayAddress string, vaultAddress string, chainID string, gatewayMethods []*uregistrytypes.GatewayMethods, vaultMethods []*uregistrytypes.VaultMethods, database *db.DB, eventPollingSeconds int, eventStartFrom *int64, logger zerolog.Logger, ) (*EventListener, error)
NewEventListener creates a new EVM event listener
func (*EventListener) IsRunning ¶ added in v0.0.13
func (el *EventListener) IsRunning() bool
IsRunning returns whether the listener is currently running
func (*EventListener) Start ¶ added in v0.0.13
func (el *EventListener) Start(ctx context.Context) error
Start begins listening for gateway events
func (*EventListener) Stop ¶ added in v0.0.13
func (el *EventListener) Stop() error
Stop gracefully stops the event listener
type RPCClient ¶ added in v0.0.13
type RPCClient struct {
// contains filtered or unexported fields
}
RPCClient provides EVM-specific RPC operations
func NewRPCClient ¶ added in v0.0.13
func NewRPCClient(rpcURLs []string, expectedChainID int64, logger zerolog.Logger) (*RPCClient, error)
NewRPCClient creates a new EVM RPC client from RPC URLs and validates chain ID
func (*RPCClient) BroadcastTransaction ¶ added in v0.0.13
func (rc *RPCClient) BroadcastTransaction(ctx context.Context, tx *types.Transaction) (string, error)
BroadcastTransaction broadcasts a signed transaction and returns the transaction hash
func (*RPCClient) CallContract ¶ added in v0.0.13
func (rc *RPCClient) CallContract(ctx context.Context, contractAddr ethcommon.Address, data []byte, blockNumber *big.Int) ([]byte, error)
CallContract calls a contract method and returns the result
func (*RPCClient) CallContractWithFrom ¶ added in v0.0.16
func (rc *RPCClient) CallContractWithFrom(ctx context.Context, from, contractAddr ethcommon.Address, data []byte, value *big.Int, blockNumber *big.Int) ([]byte, error)
CallContractWithFrom simulates a contract call as if from the given address (eth_call). No private key needed - use for simulation to check if a tx would pass or fail.
func (*RPCClient) Close ¶ added in v0.0.13
func (rc *RPCClient) Close()
Close closes all RPC connections
func (*RPCClient) FilterLogs ¶ added in v0.0.13
func (rc *RPCClient) FilterLogs(ctx context.Context, query ethereum.FilterQuery) ([]types.Log, error)
FilterLogs fetches logs matching the filter query
func (*RPCClient) GetFinalizedNonce ¶ added in v0.0.16
func (rc *RPCClient) GetFinalizedNonce(ctx context.Context, address ethcommon.Address, blockNum *big.Int) (uint64, error)
GetFinalizedNonce returns the finalized nonce at a block.
func (*RPCClient) GetGasPrice ¶ added in v0.0.13
GetGasPrice fetches the current gas price
func (*RPCClient) GetLatestBlock ¶ added in v0.0.13
GetLatestBlock returns the latest block number
func (*RPCClient) GetPendingNonce ¶ added in v0.0.16
func (rc *RPCClient) GetPendingNonce(ctx context.Context, address ethcommon.Address) (uint64, error)
GetPendingNonce returns the pending nonce (next nonce the chain will accept for this account).
func (*RPCClient) GetTransactionByHash ¶ added in v0.0.19
func (rc *RPCClient) GetTransactionByHash(ctx context.Context, txHash ethcommon.Hash) (*types.Transaction, bool, error)
GetTransactionByHash returns a transaction by its hash.
type RevertInstructions ¶ added in v0.0.13
RevertInstructions represents the struct for revert instruction in contracts Matches: struct RevertInstructions { address revertRecipient; bytes revertMsg; }
type TxBuilder ¶ added in v0.0.13
type TxBuilder struct {
// contains filtered or unexported fields
}
TxBuilder implements OutboundTxBuilder for EVM chains using the Vault contract.
func NewTxBuilder ¶ added in v0.0.13
func NewTxBuilder( rpcClient *RPCClient, chainID string, chainIDInt int64, gatewayAddress string, vaultAddress ethcommon.Address, logger zerolog.Logger, ) (*TxBuilder, error)
NewTxBuilder creates a new EVM transaction builder for Vault + Gateway. The vault address is provided by the caller (fetched from the gateway by the client).
func (*TxBuilder) BroadcastOutboundSigningRequest ¶ added in v0.0.13
func (tb *TxBuilder) BroadcastOutboundSigningRequest( ctx context.Context, req *common.UnSignedOutboundTxReq, data *uetypes.OutboundCreatedEvent, signature []byte, ) (string, error)
BroadcastOutboundSigningRequest assembles and broadcasts a signed transaction
func (*TxBuilder) GetGasFeeUsed ¶ added in v0.0.19
GetGasFeeUsed returns the gas fee used by a transaction on the EVM chain. Fetches the receipt for gasUsed and the transaction for gasPrice, then returns gasUsed * gasPrice as a decimal string. Returns "0" if not found.
func (*TxBuilder) GetNextNonce ¶ added in v0.0.16
func (tb *TxBuilder) GetNextNonce(ctx context.Context, signerAddress string, useFinalized bool) (uint64, error)
GetNextNonce returns the next nonce for the signer.
func (*TxBuilder) GetOutboundSigningRequest ¶ added in v0.0.13
func (tb *TxBuilder) GetOutboundSigningRequest( ctx context.Context, data *uetypes.OutboundCreatedEvent, nonce uint64, ) (*common.UnSignedOutboundTxReq, error)
GetOutboundSigningRequest creates a signing request from outbound event data
func (*TxBuilder) IsAlreadyExecuted ¶ added in v0.0.17
IsAlreadyExecuted returns false for EVM. EVM uses nonce-based replay protection, checked via GetNextNonce in the broadcaster.