Documentation ¶
Index ¶
- Constants
- Variables
- type BnOptions
- type Client
- func (cl *Client) CallContract(ctx context.Context, msg ethereum.CallMsg, blockNumber *big.Int) ([]byte, error)
- func (c *Client) ClaimFee(opts *bind.TransactOpts) (*ethTypes.Transaction, error)
- func (c *Client) EstimateGas(ctx context.Context, msg ethereum.CallMsg) (uint64, error)
- func (c *Client) ExecuteCall(opts *bind.TransactOpts, reqID *big.Int, data []byte) (*ethTypes.Transaction, error)
- func (c *Client) ExecuteRollback(opts *bind.TransactOpts, sn *big.Int) (*ethTypes.Transaction, error)
- func (cl *Client) FilterLogs(ctx context.Context, q ethereum.FilterQuery) ([]ethTypes.Log, error)
- func (cl *Client) GetBalance(ctx context.Context, hexAddr string) (*big.Int, error)
- func (cl *Client) GetBlockNumber(ctx context.Context) (uint64, error)
- func (c *Client) GetChainID() *big.Int
- func (c *Client) GetEthClient() *ethclient.Client
- func (c *Client) GetFee(opts *bind.CallOpts, networkID string) (*big.Int, error)
- func (cl *Client) GetHeaderByHeight(ctx context.Context, height *big.Int) (*ethTypes.Header, error)
- func (c *Client) Log() *zap.Logger
- func (c *Client) MessageReceived(opts *bind.CallOpts, srcNetwork string, _connSn *big.Int) (bool, error)
- func (cl *Client) ParseConnectionMessage(log ethTypes.Log) (*bridgeContract.ConnectionMessage, error)
- func (c *Client) ParseXcallMessage(log ethTypes.Log) (*bridgeContract.XcallCallMessage, error)
- func (c *Client) PendingNonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error)
- func (c *Client) ReceiveMessage(opts *bind.TransactOpts, srcNID string, sn *big.Int, msg []byte) (*ethTypes.Transaction, error)
- func (c *Client) RevertMessage(opts *bind.TransactOpts, sn *big.Int) (*ethTypes.Transaction, error)
- func (c *Client) SendMessage(opts *bind.TransactOpts, _to string, _svc string, _sn *big.Int, _msg []byte) (*ethTypes.Transaction, error)
- func (c *Client) SendTransaction(ctx context.Context, tx *ethTypes.Transaction) error
- func (c *Client) SetAdmin(opts *bind.TransactOpts, newAdmin common.Address) (*ethTypes.Transaction, error)
- func (c *Client) SetFee(opts *bind.TransactOpts, src string, msg, res *big.Int) (*ethTypes.Transaction, error)
- func (c *Client) Subscribe(ctx context.Context, q ethereum.FilterQuery, ch chan<- ethTypes.Log) (ethereum.Subscription, error)
- func (cl *Client) SuggestGasPrice(ctx context.Context) (*big.Int, error)
- func (cl *Client) SuggestGasTip(ctx context.Context) (*big.Int, error)
- func (cl *Client) TransactionReceipt(ctx context.Context, txHash common.Hash) (*ethTypes.Receipt, error)
- type Config
- func (c *Config) Enabled() bool
- func (p *Config) GetMonitorEventFilters() ethereum.FilterQuery
- func (p *Config) GetWallet() string
- func (p *Config) NewProvider(ctx context.Context, log *zap.Logger, homepath string, debug bool, ...) (provider.ChainProvider, error)
- func (p *Config) SetWallet(addr string)
- func (p *Config) Validate() error
- type IClient
- type Provider
- func (p *Provider) ClaimFee(ctx context.Context) error
- func (p *Provider) Config() provider.Config
- func (p *Provider) EstimateGas(ctx context.Context, message *providerTypes.Message) (uint64, error)
- func (p *Provider) ExecuteRollback(ctx context.Context, sn *big.Int) error
- func (p *Provider) FinalityBlock(ctx context.Context) uint64
- func (p *Provider) FindMessages(ctx context.Context, lbn *types.BlockNotification) ([]*relayertypes.Message, error)
- func (p *Provider) GenerateMessages(ctx context.Context, key *types.MessageKeyWithMessageHeight) ([]*types.Message, error)
- func (p *Provider) GetAddressByEventType(eventType string) *common.Address
- func (p *Provider) GetConcurrency(ctx context.Context, startHeight, currentHeight uint64) int
- func (p *Provider) GetEventName(sig string) string
- func (p *Provider) GetFee(ctx context.Context, networkID string, responseFee bool) (uint64, error)
- func (p *Provider) GetLastSavedBlockHeight() uint64
- func (p *Provider) GetTransationOpts(ctx context.Context) (*bind.TransactOpts, error)
- func (p *Provider) ImportKeystore(ctx context.Context, keyPath, passphrase string) (string, error)
- func (p *Provider) Init(ctx context.Context, homePath string, kms kms.KMS) error
- func (p *Provider) Listener(ctx context.Context, lastSavedHeight uint64, ...) error
- func (p *Provider) LogFailedTx(messageKey *providerTypes.MessageKey, result *types.Receipt, err error)
- func (p *Provider) LogSuccessTx(message *providerTypes.MessageKey, receipt *types.Receipt)
- func (p *Provider) MessageReceived(ctx context.Context, messageKey *types.MessageKey) (bool, error)
- func (p *Provider) NID() string
- func (p *Provider) Name() string
- func (p *Provider) NewKeystore(password string) (string, error)
- func (p *Provider) QueryBalance(ctx context.Context, addr string) (*types.Coin, error)
- func (p *Provider) QueryLatestHeight(ctx context.Context) (uint64, error)
- func (p *Provider) QueryTransactionReceipt(ctx context.Context, txHash string) (*types.Receipt, error)
- func (p *Provider) RestoreKeystore(ctx context.Context) error
- func (p *Provider) RevertMessage(ctx context.Context, sn *big.Int) error
- func (p *Provider) Route(ctx context.Context, message *providerTypes.Message, ...) error
- func (p *Provider) SendTransaction(ctx context.Context, opts *bind.TransactOpts, message *providerTypes.Message) (*types.Transaction, error)
- func (p *Provider) SetAdmin(ctx context.Context, admin string) error
- func (p *Provider) SetFee(ctx context.Context, networkID string, msgFee, resFee *big.Int) error
- func (p *Provider) SetLastSavedHeightFunc(f func() uint64)
- func (p *Provider) ShouldReceiveMessage(ctx context.Context, messagekey *types.Message) (bool, error)
- func (p *Provider) ShouldSendMessage(ctx context.Context, messageKey *types.Message) (bool, error)
- func (p *Provider) Subscribe(ctx context.Context, blockInfoChan chan *relayertypes.BlockInfo, ...) error
- func (p *Provider) Type() string
- func (p *Provider) WaitForResults(ctx context.Context, tx *ethTypes.Transaction) (*coreTypes.Receipt, error)
- func (p *Provider) WaitForTxResult(ctx context.Context, tx *types.Transaction, m *providerTypes.MessageKey, ...) error
- func (p *Provider) Wallet() (*keystore.Key, error)
Constants ¶
View Source
const ( DefaultPollingInterval = time.Second * 30 MaximumPollTry = 15 )
View Source
const ( ErrorLessGas = "transaction underpriced" ErrorLimitLessThanGas = "max fee per gas less than block base fee" ErrUnKnown = "unknown" ErrNonceTooLow = "nonce too low" ErrNonceTooHigh = "nonce too high" )
View Source
const (
DefaultFinalityBlock = 10
)
Variables ¶
View Source
var ( EmitMessage = "Message(string,uint256,bytes)" CallMessage = "CallMessage(string,string,uint256,uint256,bytes)" EmitMessageHash = crypto.Keccak256Hash([]byte(EmitMessage)) CallMessageHash = crypto.Keccak256Hash([]byte(CallMessage)) )
All the events
View Source
var ( // Connection contract MethodRecvMessage = "recvMessage" MethodSetAdmin = "setAdmin" MethodRevertMessage = "revertMessage" MethodClaimFees = "claimFees" MethodSetFee = "setFee" MethodGetFee = "getFee" // Xcall contract MethodExecuteCall = "executeCall" )
Functions ¶
This section is empty.
Types ¶
type Client ¶
grouped rpc api clients
func (*Client) CallContract ¶
func (*Client) ClaimFee ¶ added in v1.1.0
func (c *Client) ClaimFee(opts *bind.TransactOpts) (*ethTypes.Transaction, error)
ClaimFee
func (*Client) EstimateGas ¶ added in v1.1.0
func (*Client) ExecuteCall ¶ added in v1.1.0
func (c *Client) ExecuteCall(opts *bind.TransactOpts, reqID *big.Int, data []byte) (*ethTypes.Transaction, error)
func (*Client) ExecuteRollback ¶ added in v1.1.0
func (c *Client) ExecuteRollback(opts *bind.TransactOpts, sn *big.Int) (*ethTypes.Transaction, error)
ExecuteRollback
func (*Client) FilterLogs ¶
func (*Client) GetBalance ¶
func (*Client) GetBlockNumber ¶
func (*Client) GetChainID ¶
func (*Client) GetEthClient ¶
func (*Client) GetHeaderByHeight ¶
func (*Client) MessageReceived ¶
func (*Client) ParseConnectionMessage ¶ added in v1.1.0
func (cl *Client) ParseConnectionMessage(log ethTypes.Log) (*bridgeContract.ConnectionMessage, error)
func (*Client) ParseXcallMessage ¶ added in v1.1.0
func (c *Client) ParseXcallMessage(log ethTypes.Log) (*bridgeContract.XcallCallMessage, error)
func (*Client) PendingNonceAt ¶ added in v1.2.9
func (*Client) ReceiveMessage ¶
func (c *Client) ReceiveMessage(opts *bind.TransactOpts, srcNID string, sn *big.Int, msg []byte) (*ethTypes.Transaction, error)
func (*Client) RevertMessage ¶
func (c *Client) RevertMessage(opts *bind.TransactOpts, sn *big.Int) (*ethTypes.Transaction, error)
func (*Client) SendMessage ¶
func (*Client) SendTransaction ¶
func (*Client) SetAdmin ¶
func (c *Client) SetAdmin(opts *bind.TransactOpts, newAdmin common.Address) (*ethTypes.Transaction, error)
func (*Client) SetFee ¶ added in v1.1.0
func (c *Client) SetFee(opts *bind.TransactOpts, src string, msg, res *big.Int) (*ethTypes.Transaction, error)
SetFee
func (*Client) Subscribe ¶ added in v1.1.2
func (c *Client) Subscribe(ctx context.Context, q ethereum.FilterQuery, ch chan<- ethTypes.Log) (ethereum.Subscription, error)
Subscribe
func (*Client) SuggestGasPrice ¶
func (*Client) SuggestGasTip ¶ added in v1.2.9
type Config ¶ added in v1.1.0
type Config struct { provider.CommonConfig `json:",inline" yaml:",inline"` WebsocketUrl string `json:"websocket-url" yaml:"websocket-url"` GasMin uint64 `json:"gas-min" yaml:"gas-min"` GasLimit uint64 `json:"gas-limit" yaml:"gas-limit"` GasAdjustment uint64 `json:"gas-adjustment" yaml:"gas-adjustment"` BlockBatchSize uint64 `json:"block-batch-size" yaml:"block-batch-size"` }
func (*Config) GetMonitorEventFilters ¶ added in v1.1.0
func (p *Config) GetMonitorEventFilters() ethereum.FilterQuery
func (*Config) NewProvider ¶ added in v1.1.0
type IClient ¶
type IClient interface { Log() *zap.Logger GetBalance(ctx context.Context, hexAddr string) (*big.Int, error) GetBlockNumber(context.Context) (uint64, error) GetHeaderByHeight(ctx context.Context, height *big.Int) (*ethTypes.Header, error) GetChainID() *big.Int // ethClient FilterLogs(ctx context.Context, q ethereum.FilterQuery) ([]ethTypes.Log, error) SuggestGasPrice(ctx context.Context) (*big.Int, error) SuggestGasTip(ctx context.Context) (*big.Int, error) PendingNonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error) CallContract(ctx context.Context, msg ethereum.CallMsg, blockNumber *big.Int) ([]byte, error) TransactionReceipt(ctx context.Context, txHash common.Hash) (*ethTypes.Receipt, error) EstimateGas(ctx context.Context, msg ethereum.CallMsg) (uint64, error) SendTransaction(ctx context.Context, tx *ethTypes.Transaction) error Subscribe(ctx context.Context, q ethereum.FilterQuery, ch chan<- ethTypes.Log) (ethereum.Subscription, error) // abiContract for connection ParseConnectionMessage(log ethTypes.Log) (*bridgeContract.ConnectionMessage, error) SendMessage(opts *bind.TransactOpts, _to string, _svc string, _sn *big.Int, _msg []byte) (*ethTypes.Transaction, error) ReceiveMessage(opts *bind.TransactOpts, srcNID string, sn *big.Int, msg []byte) (*ethTypes.Transaction, error) MessageReceived(opts *bind.CallOpts, srcNetwork string, _connSn *big.Int) (bool, error) SetAdmin(opts *bind.TransactOpts, newAdmin common.Address) (*ethTypes.Transaction, error) RevertMessage(opts *bind.TransactOpts, sn *big.Int) (*ethTypes.Transaction, error) GetFee(opts *bind.CallOpts, networkID string) (*big.Int, error) SetFee(opts *bind.TransactOpts, src string, msg, res *big.Int) (*ethTypes.Transaction, error) ClaimFee(opts *bind.TransactOpts) (*ethTypes.Transaction, error) // abiContract for xcall ParseXcallMessage(log ethTypes.Log) (*bridgeContract.XcallCallMessage, error) ExecuteCall(opts *bind.TransactOpts, reqID *big.Int, data []byte) (*ethTypes.Transaction, error) ExecuteRollback(opts *bind.TransactOpts, sn *big.Int) (*ethTypes.Transaction, error) }
type Provider ¶ added in v1.1.0
type Provider struct { StartHeight uint64 NonceTracker types.NonceTrackerI LastSavedHeightFunc func() uint64 // contains filtered or unexported fields }
func (*Provider) EstimateGas ¶ added in v1.1.0
EstimateGas
func (*Provider) ExecuteRollback ¶ added in v1.1.0
ExecuteRollback
func (*Provider) FinalityBlock ¶ added in v1.1.0
func (*Provider) FindMessages ¶ added in v1.1.0
func (p *Provider) FindMessages(ctx context.Context, lbn *types.BlockNotification) ([]*relayertypes.Message, error)
func (*Provider) GenerateMessages ¶ added in v1.1.0
func (p *Provider) GenerateMessages(ctx context.Context, key *types.MessageKeyWithMessageHeight) ([]*types.Message, error)
TODO: may not be need anytime soon so its ok to implement later on
func (*Provider) GetAddressByEventType ¶ added in v1.1.0
func (*Provider) GetConcurrency ¶ added in v1.1.0
func (*Provider) GetEventName ¶ added in v1.1.0
func (*Provider) GetLastSavedBlockHeight ¶ added in v1.2.6
GetLastSavedBlockHeight returns the last saved block height
func (*Provider) GetTransationOpts ¶ added in v1.1.0
func (*Provider) ImportKeystore ¶ added in v1.1.0
ImportKeystore imports a keystore from a file
func (*Provider) LogFailedTx ¶ added in v1.1.0
func (p *Provider) LogFailedTx(messageKey *providerTypes.MessageKey, result *types.Receipt, err error)
func (*Provider) LogSuccessTx ¶ added in v1.1.0
func (p *Provider) LogSuccessTx(message *providerTypes.MessageKey, receipt *types.Receipt)
func (*Provider) MessageReceived ¶ added in v1.1.0
func (*Provider) NewKeystore ¶ added in v1.1.0
func (*Provider) QueryBalance ¶ added in v1.1.0
func (*Provider) QueryLatestHeight ¶ added in v1.1.0
func (*Provider) QueryTransactionReceipt ¶ added in v1.1.0
func (*Provider) RestoreKeystore ¶ added in v1.1.0
func (*Provider) RevertMessage ¶ added in v1.1.0
RevertMessage
func (*Provider) Route ¶ added in v1.1.0
func (p *Provider) Route(ctx context.Context, message *providerTypes.Message, callback providerTypes.TxResponseFunc) error
this will be executed in go route
func (*Provider) SendTransaction ¶ added in v1.1.0
func (p *Provider) SendTransaction(ctx context.Context, opts *bind.TransactOpts, message *providerTypes.Message) (*types.Transaction, error)
func (*Provider) SetLastSavedHeightFunc ¶ added in v1.2.6
SetLastSavedBlockHeightFunc sets the function to save the last saved block height
func (*Provider) ShouldReceiveMessage ¶ added in v1.1.0
func (*Provider) ShouldSendMessage ¶ added in v1.1.0
func (*Provider) Subscribe ¶ added in v1.1.2
func (p *Provider) Subscribe(ctx context.Context, blockInfoChan chan *relayertypes.BlockInfo, resetFunc func()) error
Subscribe listens to new blocks and sends them to the channel
func (*Provider) WaitForResults ¶ added in v1.1.0
func (*Provider) WaitForTxResult ¶ added in v1.1.0
func (p *Provider) WaitForTxResult(ctx context.Context, tx *types.Transaction, m *providerTypes.MessageKey, callback providerTypes.TxResponseFunc) error
Source Files ¶
Click to show internal directories.
Click to hide internal directories.