LargeFirstCoinSelector

class cometa.transaction_builder.coin_selection.large_first_coin_selector.LargeFirstCoinSelector(ptr)[source]

Bases: CCoinSelectorWrapper

Coin selector using the “large first” strategy.

In this strategy, UTXOs (Unspent Transaction Outputs) with larger amounts of assets are selected first to satisfy the target amount. This strategy can be more efficient for reducing the number of UTXOs involved in transactions, but may result in lower UTXO fragmentation.

This is a C-based implementation wrapped for Python use.

Example

>>> from cometa.transaction_builder.coin_selection import LargeFirstCoinSelector
>>> selector = LargeFirstCoinSelector.new()
>>> selected, remaining = selector.select(None, available_utxos, target_value)
>>> print(f"Selected {len(selected)} UTXOs using largest-first strategy")
__init__(ptr)[source]

Create a LargeFirstCoinSelector from a C pointer.

Parameters:

ptr – A cardano_coin_selector_t* pointer.

Return type:

None

Note

Use LargeFirstCoinSelector.new() to create a new instance.

classmethod new()[source]

Create a new coin selector using the “large first” strategy.

Returns:

A new LargeFirstCoinSelector instance.

Raises:

CardanoError – If creation fails.

Return type:

LargeFirstCoinSelector

Example

>>> selector = LargeFirstCoinSelector.new()