faucet

package
v0.9.8 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2022 License: Apache-2.0, BSD-2-Clause Imports: 30 Imported by: 1

Documentation

Index

Constants

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

Variables

View Source
var (
	// ErrNotEnoughFundingOutputs if there are not enough funding outputs in the faucet.
	ErrNotEnoughFundingOutputs = errors.New("not enough funding outputs to complete the request")
	// ErrMissingRemainderOutput is returned if the remainder output can not be found.
	ErrMissingRemainderOutput = errors.New("can't find faucet remainder output")
	// ErrNotEnoughFunds is returned when not enough funds are left in the faucet.
	ErrNotEnoughFunds = errors.New("not enough funds in the faucet")
	// ErrConfirmationTimeoutExpired is returned when a faucet transaction was not confirmed in expected time.
	ErrConfirmationTimeoutExpired = errors.New("tx confirmation time expired")
	// ErrFundingCanceled is returned when a faucet funding is canceled.
	ErrFundingCanceled = errors.New("tx funding canceled")
	// ErrSupplyPreparationFailed is returned when a supply transaction preparation failed.
	ErrSupplyPreparationFailed = errors.New("supply transaction preparation failed")
	// ErrSplittingFundsFailed is returned when none of funding outputs has been confirmed during funds preparation.
	ErrSplittingFundsFailed = errors.New("none of funding outputs has been confirmed during funds preparation")
	// ErrNotEnoughSupplyOutputs if there are not enough supply outputs in the faucet.
	ErrNotEnoughSupplyOutputs = errors.New("not enough supply outputs to prepare more funds in the faucet")
)
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 added in v0.9.1

func OnWebAPIRequest(fundingRequest *faucet.Payload) error

Types

type Faucet

type Faucet struct {
	*wallet.Wallet
}

func NewFaucet added in v0.9.5

func NewFaucet(faucetSeed *seed.Seed) (f *Faucet)

NewFaucet creates a new Faucet instance.

func (*Faucet) Start added in v0.9.5

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

Start starts the faucet to fulfill faucet requests.

type FaucetConnector added in v0.9.5

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

func NewConnector added in v0.9.5

func NewConnector(t *tangleold.Tangle, indexer *indexer.Indexer) *FaucetConnector

func (*FaucetConnector) GetAllowedPledgeIDs added in v0.9.5

func (f *FaucetConnector) GetAllowedPledgeIDs() (pledgeIDMap map[mana.Type][]string, err error)

func (*FaucetConnector) GetTransactionConfirmationState added in v0.9.5

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

func (*FaucetConnector) GetUnspentAliasOutput added in v0.9.5

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

func (*FaucetConnector) RequestFaucetFunds added in v0.9.5

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

func (*FaucetConnector) SendTransaction added in v0.9.5

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

func (*FaucetConnector) UnspentOutputs added in v0.9.5

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

type ParametersDefinition added in v0.7.4

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