pub struct ExtOutput<D, K> {
    pub value: u64,
    pub assets: BTreeMap<K, u64>,
    pub data: Option<D>,
}
Expand description

Output with native assets (e.g. Cardano, Ergo)

The algorithm of selection picks the closest.

  1. Computes wanted - unwanted assets in the outputs, the larger the better. Returns 0 if there are more unwanted assets.
  2. If the values of #1 are equal, the more wanted assets the better.
  3. If the values of #2 are equal, the fewer unwanted assets the better.
  4. If the values of #3 are equal, the larger value the better.

The value of asset should not be 0.

Fields

value: u64

Coin value.

assets: BTreeMap<K, u64>

Native assets.

data: Option<D>

Optional data such as transaction hash, index and any other data needed later. The output should be able to make a transaction input after selection.

Implementations

Insert asset value, skip if the value is zero.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Creates zero value of the UTxO type.

Computes self + rhs, returning None if overflow occurred.

Computes self - rhs, returning None if overflow occurred.

Computes self - rhs, saturating at the lowest bound if overflow occurred.

Compares two UTxOs to see which is better for the output, the less the better. A good strategy of UTxO selection should: Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.