Class

org.ergoplatform.wallet.boxes

ReplaceCompactCollectBoxSelector

Related Doc: package boxes

Permalink

class ReplaceCompactCollectBoxSelector extends BoxSelector

A box selector which is parameterized by maximum number of inputs a transaction can have, and optimal number of inputs.

Say, the selector is given boxes denoted by their values (1,2,3,4,...10). Then the selector is working as follows:

1) the selector first picking up boxes in given order (1,2,3,4,...) by using DefaultBoxSelector 2) if number of inputs exceeds the limit, the selector is sorting remaining boxes(actually, only 4*maximum inputs of them) by value in descending order and replaces small-value boxes in the inputs by big-value from the tail (1,2,3,4 => 10) 3) if the number of inputs still exceeds the limit, the selector is trying to throw away the dust if possible. E.g. if inputs are (100, 200, 1, 2, 1000), target value is 1300 and maximum number of inputs is 3, the selector kicks out (1, 2) 4) if number of inputs after the previous steps is below optimal, the selector is trying to append the dust, by sorting remaining boxes in ascending order and appending them till optimal number of inputs.

Linear Supertypes
BoxSelector, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ReplaceCompactCollectBoxSelector
  2. BoxSelector
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new ReplaceCompactCollectBoxSelector(maxInputs: Int, optimalInputs: Int)

    Permalink

    maxInputs

    - maximum number of inputs a transaction can have

    optimalInputs

    - optimal number of inputs, when transaction is still not expensive. The box selector is trying to add dust if a transaction has less inputs than this.

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. val ScanDepthFactor: Int

    Permalink
  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. def calcChange(boxes: Seq[ErgoBox], targetBalance: Long, targetAssets: Map[ModifierId, Long]): Option[BoxSelectionResult]

    Permalink
    Attributes
    protected
    Definition Classes
    BoxSelector
  7. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate() @throws( ... )
  8. def collectDust(bsr: BoxSelectionResult, tail: Seq[TrackedBox], targetBalance: Long, targetAssets: Map[ModifierId, Long]): Option[BoxSelectionResult]

    Permalink
    Attributes
    protected[org.ergoplatform.wallet.boxes]
  9. def compress(bsr: BoxSelectionResult, targetBalance: Long, targetAssets: Map[ModifierId, Long]): Option[BoxSelectionResult]

    Permalink
    Attributes
    protected[org.ergoplatform.wallet.boxes]
  10. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  11. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  12. def formChangeBoxes(changeBalance: Long, changeBoxesAssets: Seq[Map[ModifierId, Long]]): Option[Seq[(Long, Map[ModifierId, Long])]]

    Permalink
    Attributes
    protected
    Definition Classes
    BoxSelector
  13. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
    Annotations
    @HotSpotIntrinsicCandidate()
  14. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
    Annotations
    @HotSpotIntrinsicCandidate()
  15. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  16. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  17. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate()
  18. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate()
  19. def replace(bsr: BoxSelectionResult, tail: Seq[TrackedBox], targetBalance: Long, targetAssets: Map[ModifierId, Long]): Option[BoxSelectionResult]

    Permalink
    Attributes
    protected[org.ergoplatform.wallet.boxes]
  20. def select(inputBoxes: Iterator[TrackedBox], filterFn: (TrackedBox) ⇒ Boolean, targetBalance: Long, targetAssets: Map[ModifierId, Long]): Option[BoxSelectionResult]

    Permalink

    A method which is selecting boxes to spend in order to collect needed amounts of ergo tokens and assets.

    A method which is selecting boxes to spend in order to collect needed amounts of ergo tokens and assets.

    inputBoxes

    - unspent boxes to choose from.

    filterFn

    - user-provided filter function for boxes. From inputBoxes, only ones to be chosen for which filterFn(box) returns true

    targetBalance

    - ergo balance to be met

    targetAssets

    - assets balances to be met

    returns

    None if select() is failing to pick appropriate boxes, otherwise Some(res), where res contains boxes to spend as well as monetary values and assets for boxes containing change (wrapped in a special BoxSelectionResult class).

    Definition Classes
    ReplaceCompactCollectBoxSelectorBoxSelector
  21. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  22. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  23. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  24. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  25. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Deprecated Value Members

  1. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @Deprecated @deprecated @throws( classOf[java.lang.Throwable] )
    Deprecated

    (Since version ) see corresponding Javadoc for more information.

Inherited from BoxSelector

Inherited from AnyRef

Inherited from Any

Ungrouped