faucet

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2023 License: Apache-2.0, BSD-2-Clause Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PluginName is the name of the faucet plugin.
	PluginName = "Faucet"
)

Variables

View Source
var Parameters = &ParametersDefinition{}

Parameters contains the configuration parameters of the faucet plugin.

View Source
var (
	// Plugin is the "plugin" instance of the faucet application.
	Plugin *node.Plugin
)

Functions

func OnWebAPIRequest

func OnWebAPIRequest(fundingRequest *faucet.Payload) error

Types

type Connector

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

func NewConnector

func NewConnector(p *protocol.Protocol, blockIssuer *blockissuer.BlockIssuer, indexer *indexer.Indexer) *Connector

func (*Connector) GetTransactionConfirmationState

func (f *Connector) GetTransactionConfirmationState(txID utxo.TransactionID) (confirmationState confirmation.State, err error)

func (*Connector) GetUnspentAliasOutput

func (f *Connector) GetUnspentAliasOutput(address *devnetvm.AliasAddress) (output *devnetvm.AliasOutput, err error)

func (*Connector) RequestFaucetFunds

func (f *Connector) RequestFaucetFunds(address address.Address, powTarget int) (err error)

func (*Connector) SendTransaction

func (f *Connector) SendTransaction(tx *devnetvm.Transaction) (err error)

func (*Connector) UnspentOutputs

func (f *Connector) UnspentOutputs(addresses ...address.Address) (unspentOutputs wallet.OutputsByAddressAndOutputID, err error)

type Faucet

type Faucet struct {
	*wallet.Wallet
}

func NewFaucet

func NewFaucet(faucetSeed *seed.Seed, p *protocol.Protocol, issuer *blockissuer.BlockIssuer, indexer *indexer.Indexer) (f *Faucet)

NewFaucet creates a new Faucet instance.

func (*Faucet) Start

func (f *Faucet) Start(ctx context.Context, requestChan <-chan *faucet.Payload)

Start starts the faucet to fulfill faucet requests.

type ParametersDefinition

type ParametersDefinition struct {
	// Seed defines the base58 encoded seed the faucet uses.
	Seed string `usage:"the base58 encoded seed of the faucet, must be defined if this faucet is enabled"`

	// TokensPerRequest defines the amount of tokens the faucet should send for each request.
	TokensPerRequest int `default:"1000000" usage:"the amount of tokens the faucet should send for each request"`

	// MaxTransactionBookedAwaitTime defines the time to await for the transaction fulfilling a funding request
	// to become booked in the value layer.
	MaxTransactionBookedAwaitTime time.Duration `default:"60s" usage:"the max amount of time for a funding transaction to become booked in the value layer"`

	// PowDifficulty defines the PoW difficulty for faucet payloads.
	PowDifficulty int `default:"22" usage:"defines the PoW difficulty for faucet payloads"`

	// MaxWaitAttempts defines the maximum time to wait for a transaction to be accepted.
	MaxAwait time.Duration `default:"60s" usage:"the maximum time to wait for a transaction to be accepted"`
}

ParametersDefinition contains the definition of configuration parameters used by the faucet plugin.

Jump to

Keyboard shortcuts

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