Documentation ¶
Overview ¶
Package util contains utilities for Ethereal.
Package util contains utilities for Ethereal
Index ¶
- func AccountSigner(chainID *big.Int, wallet *accounts.Wallet, account *accounts.Account, ...) bind.SignerFn
- func BlockHasMinerTransactions(block *types.Block, chainID *big.Int) bool
- func DNSDomainHash(domain string) [32]byte
- func DNSWireFormat(domain string) []byte
- func DNSWireFormatDomainHash(domain string) [32]byte
- func GasPriceForBlocks(client *ethclient.Client, blocks int64, gasRequired uint64, verbose bool) (*big.Int, error)
- func IncrementSerial(serial uint32) uint32
- func KeySigner(chainID *big.Int, key *ecdsa.PrivateKey) bind.SignerFn
- func MustDecodeHexString(input string) []byte
- func PrivateKeyForAccount(chainID *big.Int, address common.Address, passphrase string) (*ecdsa.PrivateKey, error)
- func StringToTokenValue(input string, decimals uint8) (*big.Int, error)
- func TokenValueToString(input *big.Int, decimals uint8, _ bool) string
- func WaitForTransaction(client *ethclient.Client, txHash common.Hash, limit time.Duration) bool
- type Contract
- type DepositInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AccountSigner ¶
func AccountSigner(chainID *big.Int, wallet *accounts.Wallet, account *accounts.Account, passphrase string) bind.SignerFn
AccountSigner generates a signer using an account.
func BlockHasMinerTransactions ¶
BlockHasMinerTransactions returns true if the block contains any transactions signed by the same account that mined the block.
func DNSWireFormat ¶
DNSWireFormat turns a domain name in to wire format.
func DNSWireFormatDomainHash ¶
DNSWireFormatDomainHash hashes a domain name in wire format.
func GasPriceForBlocks ¶
func GasPriceForBlocks(client *ethclient.Client, blocks int64, gasRequired uint64, verbose bool) (*big.Int, error)
GasPriceForBlocks attempts to calculate a suitable gas price for a transaction given the gas used and the number of blocks within which the transaction is desired to be included in. It does this by looking back over a number of blocks to calculate the gas price that would have been required. This generally assumes that miners are rational in their selection of transactions to include in blocks, specifically that they select the highest gas price transactions available to them. An obvious exception to this assumption is transactions generated by the miners themselves, for example by a mining pool to pay out their miners. Due to this, blocks that contain self-mined transactions are excluded. As with any algorithm that uses historic information to calculate future values there are no guarantees that the resultant value will provide the desired result; significant changes to gas price between transactions in prior blocks and those in the transaction pool can result in an over- or under-estimation of the required gas.
func IncrementSerial ¶
IncrementSerial increments a SOA serial number as per RFC 1912.
func MustDecodeHexString ¶
MustDecodeHexString runs hex.DecodeString() and panics on error.
func PrivateKeyForAccount ¶
func PrivateKeyForAccount(chainID *big.Int, address common.Address, passphrase string) (*ecdsa.PrivateKey, error)
PrivateKeyForAccount returns the private key for an account.
func StringToTokenValue ¶
StringToTokenValue converts a string to a number of tokens.
func TokenValueToString ¶
TokenValueToString converts a token value to a suitable string representation.
Types ¶
type DepositInfo ¶
type DepositInfo struct { Name string Account string PublicKey []byte WithdrawalCredentials []byte Signature []byte DepositDataRoot []byte DepositMessageRoot []byte ForkVersion []byte Amount uint64 Version uint64 }
DepositInfo is a generic deposit structure.
func DepositInfoFromJSON ¶
func DepositInfoFromJSON(input []byte) ([]*DepositInfo, error)
DepositInfoFromJSON obtains deposit info from any supported JSON format.