buildInputs function

(BigInt, Map<ElectrumOutput, Input>) buildInputs(
  1. Map<ElectrumOutput, UTXOTransaction> utxos,
  2. UTXONetworkType networkType
)

Implementation

(BigInt, Map<ElectrumOutput, Input>) buildInputs(
  Map<ElectrumOutput, UTXOTransaction> utxos,
  UTXONetworkType networkType,
) {
  final usedUTXO = <String>{};
  final inputs = <ElectrumOutput, Input>{};
  var totalInputValue = BigInt.zero;

  for (final uTXOEntry in utxos.entries) {
    final uTXO = uTXOEntry.key;
    final uTXOTx = uTXOEntry.value;

    final hash = uTXOTx.id;

    inputs[uTXO] = buildInput(
      txidHex: hash,
      usedUTXO: usedUTXO,
      utxo: uTXO,
      networkType: networkType,
    );

    totalInputValue += uTXO.value;
  }

  return (totalInputValue, inputs);
}