eth_chain

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BigIntFromHex

func BigIntFromHex(h string) *big.Int

func EstimateGas

func EstimateGas(ctx context.Context, client *ethclient.Client, from common.Address, to *common.Address, value *big.Int, input []byte) (fee *big.Int, limit uint64, err error)

获取 fee ,limit

func HexFormat

func HexFormat(s string) string

func HexToUint64

func HexToUint64(hex string) (uint64, error)

func NewTransaction

func NewTransaction(ctx context.Context, client *ethclient.Client, rpcAddr, private, to string, amount *big.Int, data []byte) (trx *types.Transaction, err error)

func PendingNonceAt

func PendingNonceAt(rpc, address string) (uint64, error)

获取 nonce

func SignByPrivateKey

func SignByPrivateKey(hexKey, msg string) ([]byte, error)

func VerifySign

func VerifySign(hexAddr, msg string, sig []byte) (bool, error)

Types

type BaseResp

type BaseResp struct {
	JsonRpc string      `json:"jsonrpc"`
	Id      int32       `json:"id"`
	Result  interface{} `json:"result"`
	Error   Error       `json:"error"`
}

func (*BaseResp) Request

func (b *BaseResp) Request(url, method string) error

type Error

type Error struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

Jump to

Keyboard shortcuts

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