eth

package
v0.0.0-...-31acdf0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoKey = errors.New("wallet doesn't have requested key")
)
View Source
var KeypairHook = figure.Hooks{
	"eth.Keypair": func(raw interface{}) (reflect.Value, error) {
		switch value := raw.(type) {
		case string:
			kp, err := NewKeypair(value)
			if err != nil {
				return reflect.Value{}, errors.Wrap(err, "failed to init keypair")
			}
			return reflect.ValueOf(*kp), nil
		default:
			return reflect.Value{}, fmt.Errorf("cant init keypair from type: %T", value)
		}
	},
}

Functions

func EnsureHashMined

func EnsureHashMined(ctx context.Context, log *logan.Entry, getter ByHasher, hash common.Hash)

func FromGwei

func FromGwei(amount *big.Int) *big.Int

func SignTXWithPrivate

func SignTXWithPrivate(key *ecdsa.PrivateKey, tx *types.Transaction, chainID *big.Int,
) (*types.Transaction, error)

func ToGwei

func ToGwei(amount *big.Int) *big.Int

Types

type ByHasher

type ByHasher interface {
	TransactionByHash(context.Context, common.Hash) (*types.Transaction, bool, error)
}

type ETHDeriver

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

func NewETHDeriver

func NewETHDeriver(src string) (*ETHDeriver, error)

func (*ETHDeriver) ChildAddress

func (s *ETHDeriver) ChildAddress(i uint64) (string, error)

func (*ETHDeriver) ChildPrivate

func (s *ETHDeriver) ChildPrivate(i uint32) (string, error)

type Keypair

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

Keypair helper struct to simplify Wallet usage where only one signer is needed

func NewKeypair

func NewKeypair(hex string) (*Keypair, error)

func (*Keypair) Address

func (kp *Keypair) Address() common.Address

func (*Keypair) SignTX

func (kp *Keypair) SignTX(tx *types.Transaction, chainID *big.Int,
) (*types.Transaction, error)

type Wallet

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

func NewHDWallet

func NewHDWallet(hdprivate string, n uint64) (*Wallet, error)

func NewWallet

func NewWallet() *Wallet

func (*Wallet) Addresses

func (wallet *Wallet) Addresses(ctx context.Context) (result []common.Address)

func (*Wallet) HasAddress

func (wallet *Wallet) HasAddress(address common.Address) bool

func (*Wallet) Import

func (wallet *Wallet) Import(raw []byte) (common.Address, error)

func (*Wallet) ImportHEX

func (wallet *Wallet) ImportHEX(data string) (common.Address, error)

func (*Wallet) SignTX

func (wallet *Wallet) SignTX(address common.Address, tx *types.Transaction, chainID *big.Int,
) (*types.Transaction, error)

Jump to

Keyboard shortcuts

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