Documentation
¶
Index ¶
- Variables
- type Events
- type Faucet
- type FaucetEnqueueResponse
- type FaucetInfoResponse
- type Option
- func WithAmount(amount uint64) Option
- func WithBatchTimeout(timeout time.Duration) Option
- func WithHRPNetworkPrefix(networkPrefix iotago.NetworkPrefix) Option
- func WithIndexationMessage(indexationMessage string) Option
- func WithLogger(logger *logger.Logger) Option
- func WithMaxAddressBalance(maxAddressBalance uint64) Option
- func WithMaxOutputCount(maxOutputCount int) Option
- func WithPowWorkerCount(powWorkerCount int) Option
- func WithSmallAmount(smallAmount uint64) Option
- type Options
- type SendMessageFunc
- type TipselFunc
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNoTipsGiven is returned when no tips were given to issue a message. ErrNoTipsGiven = errors.New("no tips given") )
Functions ¶
This section is empty.
Types ¶
type Events ¶
type Events struct { // Fired when a faucet message is issued. IssuedMessage *events.Event // SoftError is triggered when a soft error is encountered. SoftError *events.Event }
Events are the events issued by the faucet.
type Faucet ¶
type Faucet struct { syncutils.Mutex // events of the faucet. Events *Events // contains filtered or unexported fields }
Faucet is used to issue transaction to users that requested funds via a REST endpoint.
func New ¶
func New( storage *storage.Storage, networkID uint64, belowMaxDepth int, utxoManager *utxo.Manager, address *iotago.Ed25519Address, addressSigner iotago.AddressSigner, tipselFunc TipselFunc, powHandler *pow.Handler, sendMessageFunc SendMessageFunc, opts ...Option) *Faucet
New creates a new faucet instance.
func (*Faucet) Enqueue ¶
func (f *Faucet) Enqueue(bech32 string, ed25519Addr *iotago.Ed25519Address) (*FaucetEnqueueResponse, error)
Enqueue adds a new faucet request to the queue.
func (*Faucet) Info ¶
func (f *Faucet) Info() (*FaucetInfoResponse, error)
Info returns the used faucet address and remaining balance.
func (*Faucet) NetworkPrefix ¶
func (f *Faucet) NetworkPrefix() iotago.NetworkPrefix
NetworkPrefix returns the used network prefix.
func (*Faucet) RunFaucetLoop ¶
RunFaucetLoop collects unspent outputs on the faucet address and batches the requests from the queue.
type FaucetEnqueueResponse ¶
type FaucetEnqueueResponse struct { // The bech32 address. Address string `json:"address"` // The number of waiting requests in the queue. WaitingRequests int `json:"waitingRequests"` }
FaucetEnqueueResponse defines the response of a POST RouteFaucetEnqueue REST API call.
type FaucetInfoResponse ¶
type FaucetInfoResponse struct { // The bech32 address of the faucet. Address string `json:"address"` // The remaining balance of faucet. Balance uint64 `json:"balance"` }
FaucetInfoResponse defines the response of a GET RouteFaucetInfo REST API call.
type Option ¶
type Option func(opts *Options)
Option is a function setting a faucet option.
func WithAmount ¶
WithAmount defines the amount of funds the requester receives.
func WithBatchTimeout ¶
WithBatchTimeout sets the maximum duration for collecting faucet batches.
func WithHRPNetworkPrefix ¶
func WithHRPNetworkPrefix(networkPrefix iotago.NetworkPrefix) Option
WithHRPNetworkPrefix sets the bech32 HRP network prefix.
func WithIndexationMessage ¶
WithIndexationMessage defines the faucet transaction indexation payload.
func WithLogger ¶
WithLogger enables logging within the faucet.
func WithMaxAddressBalance ¶
WithMaxAddressBalance defines the maximum allowed amount of funds on the target address. If there are more funds already, the faucet request is rejected.
func WithMaxOutputCount ¶
WithMaxOutputCount defines the maximum output count per faucet message.
func WithPowWorkerCount ¶
WithPowWorkerCount defines the amount of workers used for calculating PoW when issuing faucet messages.
func WithSmallAmount ¶
WithSmallAmount defines the amount of funds the requester receives if the target address has more funds than the faucet amount and less than maximum.
type Options ¶
type Options struct {
// contains filtered or unexported fields
}
Options define options for the faucet.
type SendMessageFunc ¶
SendMessageFunc is a function which sends a message to the network.
type TipselFunc ¶
type TipselFunc = func() (tips hornet.MessageIDs, err error)
TipselFunc selects tips for the faucet.