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 10*maximum boxes) 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.
- Alphabetic
- By Inheritance
- ReplaceCompactCollectBoxSelector
- BoxSelector
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
-
new
ReplaceCompactCollectBoxSelector(maxInputs: Int, optimalInputs: Int)
- 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
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
val
ScanDepthFactor: Int
Factor which is showing how many input selector is going through to optimize inputs.
Factor which is showing how many input selector is going through to optimize inputs. Bigger factor is slowing down inputs selection but minimizing chance of transaction failure.
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
calcChange[T <: ErgoBoxAssets](boxes: Seq[T], targetBalance: Long, targetAssets: TokensMap): Either[BoxSelectionError, Seq[ErgoBoxAssets]]
- Attributes
- protected[boxes]
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
def
collectDust[T <: ErgoBoxAssets](bsr: BoxSelectionResult[T], tail: Seq[T], targetBalance: Long, targetAssets: TokensMap): Either[BoxSelectionError, BoxSelectionResult[T]]
- Attributes
- protected[boxes]
-
def
compress[T <: ErgoBoxAssets](bsr: BoxSelectionResult[T], targetBalance: Long, targetAssets: TokensMap): Either[BoxSelectionError, BoxSelectionResult[T]]
- Attributes
- protected[boxes]
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
def
replace[T <: ErgoBoxAssets](bsr: BoxSelectionResult[T], tail: Seq[T], targetBalance: Long, targetAssets: TokensMap): Either[BoxSelectionError, BoxSelectionResult[T]]
- Attributes
- protected[boxes]
-
def
select[T <: ErgoBoxAssets](inputBoxes: Iterator[T], filterFn: (T) ⇒ Boolean, targetBalance: Long, targetAssets: TokensMap): Either[BoxSelectionError, BoxSelectionResult[T]]
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
Left(error) if select() is failing to pick appropriate boxes, otherwise Right(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
- ReplaceCompactCollectBoxSelector → BoxSelector
-
def
select[T <: ErgoBoxAssets](inputBoxes: Iterator[T], targetBalance: Long, targetAssets: TokensMap): Either[BoxSelectionError, BoxSelectionResult[T]]
- Definition Classes
- BoxSelector
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()