Module box_selector

Source
Expand description

Box selection for transaction inputs

Structs§

BoxSelection
Selected boxes (by BoxSelector)
CheckPreservationError
Error on checking if inputs are preserved
ErgoBoxAssetsData
Simple struct to hold ErgoBoxAssets values
NotEnoughCoinsForChangeBox
Not enough coins for change box(es)
SimpleBoxSelector
Simple box selector, collects inputs(sorted by targeted assets) until target balance is reached

Enums§

BoxSelectorError
Errors of BoxSelector

Traits§

BoxSelector
Box selector
ErgoBoxAssets
Assets that ErgoBox holds
ErgoBoxId
id of the ergo box

Functions§

subtract_tokens
Subtract tokens2 from tokens1 subtracting amounts of the same token or removing the token if amount is the same Returns an error if trying to subtract more tokens than there are in tokens1
sum_tokens
Returns the total token amounts (all tokens combined)
sum_tokens_from_boxes
Returns the total token amounts (all tokens combined) of the given boxes
sum_tokens_from_hashmaps
Sums two hashmaps of tokens (summing amounts of the same token)
sum_value
Returns the total value of the given boxes

Type Aliases§

SelectedBoxes
Bounded vec with minimum 1 element and max i16::MAX elements