Bitshala-Incubator / rust-coinselect

A blockchain-agnostic coinselection library built in rust.
MIT License
9 stars 17 forks source link

Example for BTC coin selection #37

Open jkciw opened 3 months ago

jkciw commented 3 months ago

The example aims to emulate a call from the coinswap (BTC) crate.

  1. Created a function to create sample coins, which are of type Vec<ListUnspentResultEntry, UTXOSpendInfo>
  2. Created a function to parse Vec<ListUnspentResultEntry, UTXOSpendInfo> into tuple of Vec, CoinSelectOpt
  3. Created a wrapper for SelectionOutput and SelectionError to implement Display trait
  4. Called the select_coin() function to perform coin selection