ganache

package
v0.0.85 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package ganache provides a ganache backend

Index

Constants

View Source
const GanacheBackendName = "Ganache"

GanacheBackendName is the name of the geth backend.

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	Secretkey struct {
		Type string `json:"type"`
		Data []int  `json:"data"`
	} `json:"secretKey"`
	Publickey struct {
		Type string `json:"type"`
		Data []int  `json:"data"`
	} `json:"publicKey"`
	Address string `json:"address"`
	Account struct {
		Nonce     string `json:"nonce"`
		Balance   string `json:"balance"`
		Stateroot string `json:"stateRoot"`
		Codehash  string `json:"codeHash"`
	} `json:"account"`
}

Address is an object exported by --account_keys_path in ganache. these are used to authenticate with a test chain.

type Addresses

type Addresses struct {
	Addresses   map[string]Address `json:"addresses"`
	PrivateKeys map[string]string  `json:"private_keys"`
}

Addresses is a list of ganache addresses.

func ParseAddresses

func ParseAddresses(path string) (addresses *Addresses, err error)

ParseAddresses parses the addresses out of a path and returns an object.

type Backend

type Backend struct {
	*base.Backend
	// contains filtered or unexported fields
}

Backend is the ganache backend.

func NewGanacheBackend

func NewGanacheBackend(ctx context.Context, t *testing.T, chainConfig *params.ChainConfig, rpcURL, chainName, keyPath string) *Backend

NewGanacheBackend creates a new ganache backend. Deprecated: this will be removed in a future version in favor of anvil.

func (*Backend) BackendName

func (b *Backend) BackendName() string

BackendName gets the backend name.

func (*Backend) FundAccount

func (b *Backend) FundAccount(ctx context.Context, address common.Address, amount big.Int)

FundAccount funds an account with an amount.

func (*Backend) GetFundedAccount

func (b *Backend) GetFundedAccount(ctx context.Context, requestBalance *big.Int) *keystore.Key

GetFundedAccount gets a funded account.

func (*Backend) GetTxContext

func (b *Backend) GetTxContext(ctx context.Context, address *common.Address) (auth backends.AuthType)

GetTxContext gets the transaction context.

func (*Backend) Signer

func (b *Backend) Signer() types.Signer

Signer gets the signer for the chain.

Jump to

Keyboard shortcuts

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