Documentation ¶
Index ¶
- Variables
- func ComputeGasFeeCap(eth layer1.Client, baseFee, tipCap *big.Int) (*big.Int, error)
- func GetValidators(eth layer1.Client, contracts layer1.EthereumContracts, logger *logrus.Logger, ...) ([]common.Address, error)
- func TransferEther(eth layer1.Client, logger *logrus.Entry, from, to common.Address, wei *big.Int) (*types.Transaction, error)
- type Client
- func (eth *Client) Close()
- func (eth *Client) CreateSecp256k1Signer() (*crypto.Secp256k1Signer, error)
- func (eth *Client) EndpointInSync(ctx context.Context) (bool, uint32, error)
- func (eth *Client) ExtractTransactionSender(tx *types.Transaction) (common.Address, error)
- func (eth *Client) GetAccount(addr common.Address) (accounts.Account, error)
- func (eth *Client) GetBalance(addr common.Address) (*big.Int, error)
- func (eth *Client) GetBlockBaseFeeAndSuggestedGasTip(ctx context.Context) (*big.Int, *big.Int, error)
- func (eth *Client) GetBlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error)
- func (eth *Client) GetCallOpts(ctx context.Context, account accounts.Account) (*bind.CallOpts, error)
- func (eth *Client) GetCallOptsLatestBlock(ctx context.Context, account accounts.Account) *bind.CallOpts
- func (eth *Client) GetChainID() *big.Int
- func (eth *Client) GetCurrentHeight(ctx context.Context) (uint64, error)
- func (eth *Client) GetDefaultAccount() accounts.Account
- func (eth *Client) GetEndpoint() string
- func (eth *Client) GetEvents(ctx context.Context, firstBlock, lastBlock uint64, addresses []common.Address) ([]types.Log, error)
- func (eth *Client) GetFinalityDelay() uint64
- func (eth *Client) GetFinalizedHeight(ctx context.Context) (uint64, error)
- func (eth *Client) GetHeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error)
- func (eth *Client) GetKnownAccounts() []accounts.Account
- func (eth *Client) GetPeerCount(ctx context.Context) (uint64, error)
- func (eth *Client) GetPendingNonce(ctx context.Context, account common.Address) (uint64, error)
- func (eth *Client) GetTimeoutContext() (context.Context, context.CancelFunc)
- func (eth *Client) GetTransactionByHash(ctx context.Context, txHash common.Hash) (tx *types.Transaction, isPending bool, err error)
- func (eth *Client) GetTransactionOpts(ctx context.Context, account accounts.Account) (*bind.TransactOpts, error)
- func (eth *Client) GetTransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
- func (eth *Client) GetTxMaxGasFeeAllowed() *big.Int
- func (eth *Client) GetTxMaxStaleBlocks() uint64
- func (eth *Client) GetTxNotFoundMaxBlocks() uint64
- func (eth *Client) IsAccessible() bool
- func (eth *Client) RetryTransaction(ctx context.Context, tx *types.Transaction, baseFee, gasTipCap *big.Int) (*types.Transaction, error)
- func (eth *Client) SendTransaction(ctx context.Context, tx *types.Transaction) error
- func (eth *Client) SignTransaction(tx types.TxData, signerAddress common.Address) (*types.Transaction, error)
- type Contracts
- func (c *Contracts) ALCA() bindings.IALCA
- func (c *Contracts) ALCAAddress() common.Address
- func (c *Contracts) ALCB() bindings.IALCB
- func (c *Contracts) ALCBAddress() common.Address
- func (c *Contracts) ContractFactory() bindings.IAliceNetFactory
- func (c *Contracts) ContractFactoryAddress() common.Address
- func (c *Contracts) Dynamics() bindings.IDynamics
- func (c *Contracts) DynamicsAddress() common.Address
- func (c *Contracts) Ethdkg() bindings.IETHDKG
- func (c *Contracts) EthdkgAddress() common.Address
- func (c *Contracts) GetAllAddresses() []common.Address
- func (c *Contracts) Governance() bindings.IGovernance
- func (c *Contracts) GovernanceAddress() common.Address
- func (c *Contracts) PublicStaking() bindings.IPublicStaking
- func (c *Contracts) PublicStakingAddress() common.Address
- func (c *Contracts) Snapshots() bindings.ISnapshots
- func (c *Contracts) SnapshotsAddress() common.Address
- func (c *Contracts) ValidatorPool() bindings.IValidatorPool
- func (c *Contracts) ValidatorPoolAddress() common.Address
- func (c *Contracts) ValidatorStaking() bindings.IValidatorStaking
- func (c *Contracts) ValidatorStakingAddress() common.Address
- type ErrTxTooExpensive
- type JsonRPCMessage
Constants ¶
This section is empty.
Variables ¶
var ( ErrAccountNotFound = errors.New("could not find specified account") ErrKeysNotFound = errors.New("account either not found or not unlocked") ErrPassCodeNotFound = errors.New("could not find specified passCode") )
Ethereum specific errors.
var ETH_MAX_PRIORITY_FEE_PER_GAS_NOT_FOUND string = "Method eth_maxPriorityFeePerGas not found"
Functions ¶
func ComputeGasFeeCap ¶
Function to compute the gas fee that will be valid for the next 8 full blocks before we are priced out.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient( endpoint string, pathKeystore string, pathPassCodes string, defaultAccount string, unlockAdditionalAccounts bool, finalityDelay uint64, txMaxGasFeeAllowedInGwei uint64, endpointMinimumPeers uint64, ) (*Client, error)
NewClient creates a new Ethereum abstraction.
func (*Client) CreateSecp256k1Signer ¶
func (eth *Client) CreateSecp256k1Signer() (*crypto.Secp256k1Signer, error)
create a new signer for ETH accounts.
func (*Client) EndpointInSync ¶
EndpointInSync Checks if our endpoint is good to use -- This function is different. Because we need to be aware of errors, State is always updated.
func (*Client) ExtractTransactionSender ¶
Extracts the sender of a transaction.
func (*Client) GetAccount ¶
GetAccount returns the account specified.
func (*Client) GetBalance ¶
GetBalance returns the ETHER balance of account specified.
func (*Client) GetBlockBaseFeeAndSuggestedGasTip ¶
func (eth *Client) GetBlockBaseFeeAndSuggestedGasTip(ctx context.Context) (*big.Int, *big.Int, error)
Get the base fee and suggestedGasTip for the latest ethereum block.
func (*Client) GetBlockByNumber ¶
wrapper around ethclient.BlockByNumber.
func (*Client) GetCallOpts ¶
func (eth *Client) GetCallOpts(ctx context.Context, account accounts.Account) (*bind.CallOpts, error)
Safe function to call the smart contract state at the finalized block (block that we judge safe).
func (*Client) GetCallOptsLatestBlock ¶
func (eth *Client) GetCallOptsLatestBlock(ctx context.Context, account accounts.Account) *bind.CallOpts
Function to call the smart contract state at the latest block seen by the ethereum node. USE THIS FUNCTION CAREFULLY, THE LATEST BLOCK IS SUSCEPTIBLE TO CHAIN RE-ORGS AND SHOULD NEVER BE USED AS TEST IF SOMETHING WAS COMMITTED TO OUR CONTRACTS. IDEALLY, ONLY USE THIS FUNCTION FOR MONITORING FUNCTIONS THAT DEPENDS ON THE LATEST BLOCK. Otherwise use GetCallOpts!!!
func (*Client) GetChainID ¶
ChainID returns the ID used to build ethereum client.
func (*Client) GetCurrentHeight ¶
GetCurrentHeight gets the height of the endpoints chain.
func (*Client) GetDefaultAccount ¶
GetDefaultAccount returns the default account.
func (*Client) GetEndpoint ¶
Get ip address where are connected to the ethereum node.
func (*Client) GetEvents ¶
func (eth *Client) GetEvents(ctx context.Context, firstBlock, lastBlock uint64, addresses []common.Address) ([]types.Log, error)
Get ethereum events from a block range.
func (*Client) GetFinalizedHeight ¶
GetFinalizedHeight gets the height of the endpoints chain at which is is considered finalized.
func (*Client) GetHeaderByNumber ¶
wrapper around ethclient.HeaderByNumber.
func (*Client) GetKnownAccounts ¶
Get all ethereum accounts that we have access in the keystore.
func (*Client) GetPendingNonce ¶
wrapper around ethclient.PendingNonceAt.
func (*Client) GetTimeoutContext ¶
func (eth *Client) GetTimeoutContext() (context.Context, context.CancelFunc)
Get timeout context.
func (*Client) GetTransactionByHash ¶
func (eth *Client) GetTransactionByHash(ctx context.Context, txHash common.Hash) (tx *types.Transaction, isPending bool, err error)
wrapper around ethclient.TransactionByHash.
func (*Client) GetTransactionOpts ¶
func (eth *Client) GetTransactionOpts(ctx context.Context, account accounts.Account) (*bind.TransactOpts, error)
Get transaction options in order to do a transaction.
func (*Client) GetTransactionReceipt ¶
func (eth *Client) GetTransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
wrapper around ethclient.TransactionReceipt.
func (*Client) GetTxMaxGasFeeAllowed ¶
Get the max gas fee allowed to perform transactions in WEI.
func (*Client) GetTxMaxStaleBlocks ¶
Number of blocks to wait for a tx in the memory pool w/o returning to the caller asking for retry.
func (*Client) GetTxNotFoundMaxBlocks ¶
How many blocks we should wait for removing a tx in case we don't find it in the layer1 chain.
func (*Client) IsAccessible ¶
IsAccessible checks against endpoint to confirm server responds.
func (*Client) RetryTransaction ¶
func (eth *Client) RetryTransaction(ctx context.Context, tx *types.Transaction, baseFee, gasTipCap *big.Int) (*types.Transaction, error)
Retry a transaction done by any of the known ethereum accounts.
func (*Client) SendTransaction ¶
wrapper around ethclient.SendTransaction.
func (*Client) SignTransaction ¶
func (eth *Client) SignTransaction(tx types.TxData, signerAddress common.Address) (*types.Transaction, error)
Sign an ethereum transaction.
type Contracts ¶
type Contracts struct {
// contains filtered or unexported fields
}
Contracts contains bindings to smart contract system.
func NewContracts ¶
Set the contractFactoryAddress and looks up for all the contracts that we need that were deployed via the factory. It's only executed once. Other call to this functions are no-op.
func (*Contracts) ALCAAddress ¶ added in v0.0.8
func (*Contracts) ALCBAddress ¶ added in v0.0.8
func (*Contracts) ContractFactory ¶
func (c *Contracts) ContractFactory() bindings.IAliceNetFactory
func (*Contracts) ContractFactoryAddress ¶
func (*Contracts) DynamicsAddress ¶ added in v0.0.5
func (*Contracts) EthdkgAddress ¶
func (*Contracts) GetAllAddresses ¶
return all addresses from all contracts in the contract struct.
func (*Contracts) Governance ¶
func (c *Contracts) Governance() bindings.IGovernance
func (*Contracts) GovernanceAddress ¶
func (*Contracts) PublicStaking ¶
func (c *Contracts) PublicStaking() bindings.IPublicStaking
func (*Contracts) PublicStakingAddress ¶
func (*Contracts) Snapshots ¶
func (c *Contracts) Snapshots() bindings.ISnapshots
func (*Contracts) SnapshotsAddress ¶
func (*Contracts) ValidatorPool ¶
func (c *Contracts) ValidatorPool() bindings.IValidatorPool
func (*Contracts) ValidatorPoolAddress ¶
func (*Contracts) ValidatorStaking ¶
func (c *Contracts) ValidatorStaking() bindings.IValidatorStaking
func (*Contracts) ValidatorStakingAddress ¶
type ErrTxTooExpensive ¶
type ErrTxTooExpensive struct {
// contains filtered or unexported fields
}
func (*ErrTxTooExpensive) Error ¶
func (e *ErrTxTooExpensive) Error() string
type JsonRPCMessage ¶
type JsonRPCMessage struct { Version string `json:"jsonrpc,omitempty"` ID json.RawMessage `json:"id,omitempty"` Method string `json:"method,omitempty"` Params json.RawMessage `json:"params,omitempty"` Error *jsonError `json:"error,omitempty"` Result json.RawMessage `json:"result,omitempty"` }
A value of this type can a JSON-RPC request, notification, successful response or error response. Which one it is depends on the fields.