core

package
v0.0.0-...-f76e20d Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2020 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = Config{
	Networks: map[string]Network{"default": DefaultNetwork},
}
View Source
var DefaultNetwork = Network{
	Name:     "default",
	Url:      "http://localhost:8545",
	From:     "0xADDRESS",
	Keystore: "./keystore",
	Password: "",
	Gas:      100000000,
	GasPrice: 4700000,
	Id:       "",
}

Functions

func BinToSol

func BinToSol(contracts []string) []string

func Bindings

func Bindings() error

func Compile

func Compile() ([]string, error)

func Contract

func Contract(contract string) (*abi.ABI, error)

param: name of the contract (without extension)

func ContractAddress

func ContractAddress(contract string, network string) (common.Address, error)

func ContractFromPath

func ContractFromPath(pathStr string) (*abi.ABI, error)

func ContractNameFromPath

func ContractNameFromPath(path string) string

func Deploy

func Deploy(client *ethclient.Client, network Network, contracts []string, keys *keystore.KeyStore) error

func DeployTestRPC

func DeployTestRPC(network Network, contracts []string) error

func Dial

func Dial(url string) (*ethclient.Client, error)

func Exists

func Exists(path string) (bool, error)

func GetAccounts

func GetAccounts(url string) ([]string, error)

this function gets the accounts in the client by calling "eth_accounts"

func GetBlockNumber

func GetBlockNumber(url string) (*big.Int, error)

this function gets the current block number by calling "eth_blockNumber"

func GetContractBIN

func GetContractBIN(contract string) string

func GetContractCleanName

func GetContractCleanName(fullFilename string) string

func GetContractName

func GetContractName(contract string) string

func GetContractNames

func GetContractNames(contracts []string) []string

func Migrate

func Migrate(network string, contract string) error

func NewConnection

func NewConnection(network string) (*ethclient.Client, error)

func NewKeyStore

func NewKeyStore(path string) *keystore.KeyStore

func PrintAccounts

func PrintAccounts(accounts []string)

func PrintKeystoreAccounts

func PrintKeystoreAccounts(accounts []accounts.Account)

func ReadConfig

func ReadConfig() ([]byte, error)

func SearchDirectory

func SearchDirectory(dir string) ([]string, error)

func SearchDirectoryForAbi

func SearchDirectoryForAbi(dir string) ([]string, error)

func SendTransaction

func SendTransaction(txData string, url string) (string, error)
params: [{
  "from": "0xb60e8dd61c5d32be8058bb8eb970870f07233155",
  "to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567", //not needed for new contract
  "gas": "0x76c0", // 30400
  "gasPrice": "0x9184e72a000", // 10000000000000
  "value": "0x9184e72a", // 2441406250
  "data": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"
}]

func WatchAllEvents

func WatchAllEvents(conn *ethclient.Client, contract common.Address, fromBlock *big.Int, logsChan chan []types.Log) error

Types

type AccountResponse

type AccountResponse struct {
	Result []string `json:"result"`
}

type Config

type Config struct {
	Networks map[string]Network `json:"networks"`
}

func UnmarshalConfig

func UnmarshalConfig(file []byte) (*Config, error)

type Network

type Network struct {
	Name     string `json:"name,omitempty"`
	Url      string `json:"url,omitempty"`
	From     string `json:"from,omitempty"`
	Keystore string `json:"keystore,1omitempty"`
	Password string `json:"password,omitempty"`
	Gas      int64  `json:"gas,omitempty"`
	GasPrice int64  `json:"gasPrice,omitempty"`
	Id       string `json:"id,omitempty"`
}

func PrepNetwork

func PrepNetwork(network string) Network

type Receipt

type Receipt struct {
	TransactionHash   string   `json:"transactionHash"`
	TransactionIndex  string   `json:"transactionIndex"`
	BlockNumber       string   `json:"blockNumber"`
	BlockHash         string   `json:"blockHash"`
	CumulativeGasUsed string   `json:"cumulativeGasUsed"`
	GasUsed           string   `json:"gasUsed"`
	ContractAddress   string   `json:"contractAddress"`
	Logs              []string `json:"logs"`
	LogsBloom         string   `json:"logsBloom"`
	Status            string   `json:"status"`
}

func GetTransactionReceipt

func GetTransactionReceipt(txHash string, url string) (Receipt, error)

type ReceiptResponse

type ReceiptResponse struct {
	Result Receipt `json:"result"`
}

type Response

type Response struct {
	Result string `json:"result"`
}

type Transaction

type Transaction struct {
	From     string `json:"from"`
	To       string `json:"to,omitempty"`
	Gas      string `json:"gas,omitempty"`
	GasPrice string `json:"gasPrice,omitempty"`
	Value    string `json:"value,omitempty"`
	Data     string `json:"data,omitempty"`
}

Jump to

Keyboard shortcuts

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