Version: v1.0.1 Latest Latest

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




View Source
const (
	MagnetLinkTimeoutField        = "timeout_at"
	MagnetLinkMultiUseField       = "multi_use"
	MagnetLinkExpectedAmountField = "expected_amount"
	MagnetLinkFormat              = "iota://%s%s/?%s=%d&%s=%d&%s=%d"

Defines the names of the condition fields in a magnet link.


View Source
var ErrAddressInvalid = errors.New("invalid address")

ErrAddressInvalid is returned when an address is invalid when parsed from a serialized form.

View Source
var ErrInvalidDepositAddressOptions = errors.New("invalid address options are invalid")
View Source
var ErrMagnetLinkChecksumInvalid = errors.New("magnet-link checksum is invalid")


func ValidateConditions

func ValidateConditions(conds *Conditions) error

ValidateConditions validates the deposit conditions.


type CDA

type CDA struct {
	Address Hash `json:"address"`

CDA defines a conditional deposit address.

func ParseMagnetLink(cdaMagnetLink string) (*CDA, error)

ParseMagnetLink parses the given magnet link URL.

func (dc *CDA) AsMagnetLink() (string, error)

AsMagnetLink converts the conditions into a magnet link URL.

func (*CDA) AsTransfer

func (dc *CDA) AsTransfer() bundle.Transfer

AsTransfer converts the conditional deposit address into a transfer object.

func (*CDA) Checksum

func (dc *CDA) Checksum() (Trytes, error)

Checksum returns the checksum of the the CDA.

type Conditions

type Conditions struct {
	// The time after this deposit address becomes invalid.
	TimeoutAt *time.Time `json:"timeout_at,omitempty" bson:"timeout_at,omitempty"`
	// Whether to expect multiple deposits to this address in the given timeout.
	// If this flag is false, the deposit address is considered
	// in the input selection as soon as one deposit is available.
	// ExpectedAmount and MultiUse are mutually exclusive: MultiUse must be false if an ExpectedAmount over 0 is set.
	MultiUse bool `json:"multi_use,omitempty" bson:"multi_use,omitempty"`
	// The expected amount which gets deposited.
	// If the timeout is hit, the address is automatically
	// considered in the input selection.
	// ExpectedAmount and MultiUse are mutually exclusive: MultiUse must be false if an ExpectedAmount over 0 is set.
	ExpectedAmount *uint64 `json:"expected_amount,omitempty" bson:"expected_amount,omitempty"`

Conditions define conditions for a new deposit address generated by an account.

Source Files

Jump to

Keyboard shortcuts

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