eth1

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 21, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MAINNET = "mainnet"
	GOERLI  = "goerli"
	PRATER  = "prater"
	SEPOLIA = "sepolia"
)
View Source
const ZERO_HASH_STR = "0x0000000000000000000000000000000000000000000000000000000000000000"

Variables

View Source
var ZERO_HASH = [32]byte{}

Functions

func AddressFromPrivateKey

func AddressFromPrivateKey(pri string) (common.Address, error)

AddressFromPrivateKey Push out the address from the private key

func CreateEth1Key

func CreateEth1Key() (string, string, error)

CreateEth1Key Create ETH1 private key and pubkey

func ETH32

func ETH32() decimal.Decimal

func GWEIToWEI

func GWEIToWEI(value *big.Int) *big.Int

func IsSameNetwork

func IsSameNetwork(network string, chainID int) bool

func KeyTransactOpts

func KeyTransactOpts(chainID *big.Int, privateKeyStr string) (*bind.TransactOpts, error)

func NewSimulatedClient

func NewSimulatedClient(walletBalance *big.Int, gasLimit uint64, privateKeyStr string) (*backends.SimulatedBackend, error)

NewSimulatedClient ETH client of constructing simulation transactions

func SignHexStr

func SignHexStr(str, priv string) (string, error)

SignHexStr ETH private key signature

Types

type EthClient

type EthClient struct {
	Client *ethclient.Client
}

func NewEthClient

func NewEthClient(ctx context.Context, rpcHost string) (*EthClient, error)

func (*EthClient) BalanceAt

func (e *EthClient) BalanceAt(ctx context.Context, address string, blockNumber *big.Int) (*big.Int, error)

type Tx

type Tx struct {
	From    string `json:"from,omitempty"`
	To      string `json:"to"`
	Value   string `json:"value"`
	Data    string `json:"data"`
	ChainId int    `json:"chain_id"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL