eth

package
v0.0.0-...-3fff15a Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2018 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MIMEApplicationJSON            = "application/json"
	MIMEApplicationJSONCharsetUTF8 = MIMEApplicationJSON + "; " + charsetUTF8
)

Variables

View Source
var (
	Module = module.Module{
		{Constructor: NewDefaultConfig},
		{Constructor: NewClient},
	}

	ErrBlockNotFound = errors.New("block not found")
)

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(cfg *Config, log *zap.SugaredLogger) (*Client, error)

func (*Client) GetBlockByNumber

func (c *Client) GetBlockByNumber(ctx context.Context, num int64) (*store.Block, error)

GetBlockByNumber - fetch block and transactions from ethereum blockchain

func (*Client) GetLastBlock

func (c *Client) GetLastBlock(ctx context.Context) (int64, error)

func (*Client) SendTransaction

func (c *Client) SendTransaction(ctx context.Context, params SendParams) (string, error)

type Config

type Config struct {
	Address                string
	Debug                  bool
	BlockTimeout           time.Duration
	SendTransactionTimeout time.Duration
}

func NewDefaultConfig

func NewDefaultConfig(v *viper.Viper) (*Config, error)

type SendParams

type SendParams struct {
	From  string
	To    string
	Value float64
}

Jump to

Keyboard shortcuts

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