Documentation ¶
Index ¶
- Variables
- type Devnet
- func (e *Devnet) GenesisCar() string
- func (e *Devnet) GenesisMiner() (*GenesisMiner, error)
- func (e *Devnet) GetFunds(ctx context.Context, p *fast.Filecoin) error
- func (e *Devnet) Log() logging.EventLogger
- func (e *Devnet) NewProcess(ctx context.Context, processType string, options map[string]string, ...) (*fast.Filecoin, error)
- func (e *Devnet) Processes() []*fast.Filecoin
- func (e *Devnet) Teardown(ctx context.Context) error
- func (e *Devnet) TeardownProcess(ctx context.Context, p *fast.Filecoin) error
- type DevnetConfig
- type Environment
- type GenesisMiner
- type MemoryGenesis
- func (e *MemoryGenesis) GenesisCar() string
- func (e *MemoryGenesis) GenesisMiner() (*GenesisMiner, error)
- func (e *MemoryGenesis) GetFunds(ctx context.Context, p *fast.Filecoin) error
- func (e *MemoryGenesis) Log() logging.EventLogger
- func (e *MemoryGenesis) NewProcess(ctx context.Context, processType string, options map[string]string, ...) (*fast.Filecoin, error)
- func (e *MemoryGenesis) Processes() []*fast.Filecoin
- func (e *MemoryGenesis) Teardown(ctx context.Context) error
- func (e *MemoryGenesis) TeardownProcess(ctx context.Context, p *fast.Filecoin) error
Constants ¶
This section is empty.
Variables ¶
var ErrNoGenesisMiner = errors.New("GenesisMiner not supported")
ErrNoGenesisMiner is returned by GenesisMiner if the environment does not support providing a genesis miner.
Functions ¶
This section is empty.
Types ¶
type Devnet ¶
type Devnet struct {
// contains filtered or unexported fields
}
Devnet is a FAST lib environment that is meant to be used when working with kittyhawk devnets run by the Filecoin development team.
func (*Devnet) GenesisCar ¶
GenesisCar provides a url where the genesis file can be fetched from
func (*Devnet) GenesisMiner ¶
func (e *Devnet) GenesisMiner() (*GenesisMiner, error)
GenesisMiner returns a ErrNoGenesisMiner for this environment
func (*Devnet) GetFunds ¶
GetFunds retrieves a fixed amount of tokens from the environment to the Filecoin processes default wallet address. GetFunds will send a request to the Faucet, the amount of tokens returned and number of requests permitted is determined by the Faucet configuration.
func (*Devnet) Log ¶
func (e *Devnet) Log() logging.EventLogger
Log returns the logger for the environment.
func (*Devnet) NewProcess ¶
func (e *Devnet) NewProcess(ctx context.Context, processType string, options map[string]string, eo fast.FilecoinOpts) (*fast.Filecoin, error)
NewProcess builds a iptb process of the given type and options passed. The process is tracked by the environment and returned.
type DevnetConfig ¶
type DevnetConfig struct { // Name is the string value which can be used to configure bootstrap peers during init Name string // GenesisLocation provides where the genesis.car for the network can be fetched from GenesisLocation string // FaucetTap is the URL which can be used to request funds to a wallet FaucetTap string }
DevnetConfig describes the dynamic resources of a network
func FindDevnetConfigByName ¶
func FindDevnetConfigByName(name string) (DevnetConfig, error)
FindDevnetConfigByName returns a devnet configuration by looking it up by name
type Environment ¶
type Environment interface { // GenesisCar returns a location to the genesis.car file. This can be // either an absolute path to a file on disk, or more commonly an http(s) // url. GenesisCar() string // GenesisMiner returns a structure which contains all the required // information to load the existing miner that is defined in the // genesis block. An ErrNoGenesisMiner may be returned if the environment // does not support providing genesis miner information. GenesisMiner() (*GenesisMiner, error) // Log returns a logger for the environment Log() logging.EventLogger // NewProcess makes a new process for the environment. This doesn't // always mean a new filecoin node though, NewProcess for some // environments may create a Filecoin process that interacts with // an already running filecoin node, and supplied the API multiaddr // as options. NewProcess(ctx context.Context, processType string, options map[string]string, eo fast.FilecoinOpts) (*fast.Filecoin, error) // Processes returns a slice of all processes the environment knows // about. Processes() []*fast.Filecoin // Teardown runs anything that the environment may need to do to // be nice to the the execution area of this code. Teardown(context.Context) error // TeardownProcess runs anything that the environment may need to do // to remove a process from the environment in a clean way. TeardownProcess(context.Context, *fast.Filecoin) error // GetFunds retrieves a fixed amount of tokens from the environment to the // Filecoin processes default wallet address. GetFunds(context.Context, *fast.Filecoin) error }
Environment defines the interface common among all environments that the FAST lib can work across. It helps smooth out the differences by providing a common ground to work from
func NewDevnet ¶
func NewDevnet(config DevnetConfig, location string) (Environment, error)
NewDevnet builds an environment that uses deployed infrastructure to the kittyhawk devnets.
func NewMemoryGenesis ¶
func NewMemoryGenesis(funds *big.Int, location string) (Environment, error)
NewMemoryGenesis builds an environment with a local genesis that can be used to initialize nodes and create a genesis node. The genesis file is provided by an http server.
type GenesisMiner ¶
type GenesisMiner struct { // Address is the address of the miner on chain Address address.Address // Owner is the private key of the wallet which is assoiated with the miner Owner io.Reader }
GenesisMiner contains the required information to setup a node as a genesis node.
type MemoryGenesis ¶
type MemoryGenesis struct {
// contains filtered or unexported fields
}
MemoryGenesis is a FAST lib environment that is meant to be used when working locally, on the same network / machine. It's great for writing functional tests!
func (*MemoryGenesis) GenesisCar ¶
func (e *MemoryGenesis) GenesisCar() string
GenesisCar provides a url where the genesis file can be fetched from
func (*MemoryGenesis) GenesisMiner ¶
func (e *MemoryGenesis) GenesisMiner() (*GenesisMiner, error)
GenesisMiner provides required information to create a genesis node and load the wallet.
func (*MemoryGenesis) GetFunds ¶
GetFunds retrieves a fixed amount of tokens from the environment to the Filecoin processes default wallet address. GetFunds will cause the genesis node to send 1000 filecoin to process `p`.
func (*MemoryGenesis) Log ¶
func (e *MemoryGenesis) Log() logging.EventLogger
Log returns the logger for the environment.
func (*MemoryGenesis) NewProcess ¶
func (e *MemoryGenesis) NewProcess(ctx context.Context, processType string, options map[string]string, eo fast.FilecoinOpts) (*fast.Filecoin, error)
NewProcess builds a iptb process of the given type and options passed. The process is tracked by the environment and returned.
func (*MemoryGenesis) Processes ¶
func (e *MemoryGenesis) Processes() []*fast.Filecoin
Processes returns all processes the environment knows about.
func (*MemoryGenesis) Teardown ¶
func (e *MemoryGenesis) Teardown(ctx context.Context) error
Teardown stops all of the nodes and cleans up the environment.
func (*MemoryGenesis) TeardownProcess ¶
TeardownProcess stops the running process and removes it from the environment.