eth

package
v0.0.0-...-1a1e56d Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2021 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Empty = "0x0000000000000000000000000000000000000000"
	Wei   = 1000000000000000000
)

Variables

View Source
var DefaultAddress = "0x1005388e1649240036d199b6ad71eafc0164edad"
View Source
var DefaultPrivateKey = "b45c2d049b489a5d7f5a1b5212a0c262472a28b241e73e3e465d3133036a1c2f"

Functions

func DecodePrivateKey

func DecodePrivateKey(privateKey string) *ecdsa.PrivateKey

func EncodePrivateKey

func EncodePrivateKey(priv *ecdsa.PrivateKey) string

func GetKeystore

func GetKeystore(backupFile string, keystoreDir string, passwordFile string) (string, string, string)

Get privateKey from keystore and create it if neeeded

func LoadContracts

func LoadContracts(abi string, config string) (map[string]*Contract, error)

Types

type Contract

type Contract struct {
	Name    string
	Address string
	// contains filtered or unexported fields
}

func LoadContract

func LoadContract(solcPath string, name string) (*Contract, error)

func NewContract

func NewContract(name string, address string, buf []byte) (*Contract, error)

func (*Contract) Call

func (contract *Contract) Call(web3 *Web3, contractAddress string, method string, params ...interface{}) (interface{}, error)

func (*Contract) Deploy

func (contract *Contract) Deploy(web3 *Web3, bin []byte, private string, val int64, params ...interface{}) (string, error)

func (*Contract) Get

func (contract *Contract) Get() abi.ABI

func (*Contract) ParseData

func (contract *Contract) ParseData(data []byte) (map[string]interface{}, error)

func (*Contract) ParseLogs

func (contract *Contract) ParseLogs(logs []*types.Log) []map[string]interface{}

func (*Contract) Transact

func (contract *Contract) Transact(web3 *Web3, private string, val int64, contractAddress string, method string, params ...interface{}) (*types.Transaction, *types.Receipt, error)

type Web3

type Web3 struct {
	Url    string
	Client *ethclient.Client
}

func NewWeb3

func NewWeb3(url string) *Web3

func (*Web3) Connect

func (web3 *Web3) Connect() *ethclient.Client

func (*Web3) GetBalance

func (web3 *Web3) GetBalance(receiver string) (string, error)

func (*Web3) LoadContracts

func (web3 *Web3) LoadContracts(name string) (map[string]*Contract, error)

func (*Web3) Transact

func (web3 *Web3) Transact(private string, receiver string, val int64) (*types.Transaction, *types.Receipt, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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