Skip to content

Instantly share code, notes, and snippets.

@farukterzioglu
Last active October 19, 2019 21:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save farukterzioglu/0e2278de53cd9ad8ca5acef67b3b06ae to your computer and use it in GitHub Desktop.
Save farukterzioglu/0e2278de53cd9ad8ca5acef67b3b06ae to your computer and use it in GitHub Desktop.
var inputList = new List<UnspentCoin>();
var unspentResponse = await client.ListUnspentAsync();
var unspentList = unspentResponse.OrderByDescending( x => x.Amount).ToList();
var inputBtcSum = new Money(0, MoneyUnit.BTC);
foreach (var unspent in unspentList) {
if( inputBtcSum >= totalPaymentAmountBtc) break;
inputBtcSum += unspent.Amount;
inputList.Add(unspent);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment