builder

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

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

Builder wraps a Settings object and provides a builder pattern around it.

func NewBuilder

func NewBuilder() *Builder

NewBuilder creates a new Builder which uses the default settings provided by DefaultSettings().

func (*Builder) Build

func (b *Builder) Build(plugins ...account.Plugin) (account.Account, error)

Build adds the given plugins and creates the account.

func (*Builder) Settings

func (b *Builder) Settings() *account.Settings

Settings returns the currently built settings.

func (*Builder) WithAPI

func (b *Builder) WithAPI(api *api.API) *Builder

API sets the underlying API to use.

func (*Builder) WithAddrGenFunc

func (b *Builder) WithAddrGenFunc(f account.AddrGenFunc) *Builder

WithAddrGenFunc sets the address generation function to use.

func (*Builder) WithDefaultPlugins

func (b *Builder) WithDefaultPlugins() *Builder

WithDefaultPlugins adds a transfer poller and promoter-reattacher plugin with following settings:

poll incoming/outgoing transfers every 30 seconds (filter by tail tx hash). promote/reattach each pending transfer every 30 seconds.

This function must only be called after following settings are initialized: API, Store, MWM, Depth, SeedProvider or AddrGen+PrepareTransfers, TimeSource and EventMachine.

func (*Builder) WithDepth

func (b *Builder) WithDepth(depth uint64) *Builder

Depth sets the depth used when searching for transactions to approve.

func (*Builder) WithEvents

func (b *Builder) WithEvents(em event.EventMachine) *Builder

WithEvents instructs the account to emit events using the given EventMachine.

func (*Builder) WithInputSelectionStrategy

func (b *Builder) WithInputSelectionStrategy(strat account.InputSelectionFunc) *Builder

InputSelectionFunc sets the strategy to determine inputs and usable balance.

func (*Builder) WithMWM

func (b *Builder) WithMWM(mwm uint64) *Builder

MWM sets the minimum weight magnitude used to send transactions.

func (*Builder) WithPrepareTransfersFunc

func (b *Builder) WithPrepareTransfersFunc(f account.PrepareTransfersFunc) *Builder

WithPrepareTransfersFunc sets the prepare transfers function to use.

func (*Builder) WithSecurityLevel

func (b *Builder) WithSecurityLevel(level consts.SecurityLevel) *Builder

The overall security level used by the account.

func (*Builder) WithSeed

func (b *Builder) WithSeed(seed Trytes) *Builder

Seed sets the underlying seed to use.

func (*Builder) WithSeedProvider

func (b *Builder) WithSeedProvider(seedProv account.SeedProvider) *Builder

SeedProvider sets the underlying SeedProvider to use.

func (*Builder) WithStore

func (b *Builder) WithStore(store store.Store) *Builder

Store sets the underlying store to use.

func (*Builder) WithTimeSource

func (b *Builder) WithTimeSource(timesource timesrc.TimeSource) *Builder

TimeSource sets the TimeSource to use to get the current time.

Jump to

Keyboard shortcuts

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