@@ -352,8 +352,10 @@ class ParticlWallet<T extends ElectrumXCurrencyInterface>
352352 @override
353353 Future <TxData > buildTransaction ({
354354 required TxData txData,
355- required covariant List <StandardInput > inputsWithKeys,
355+ required List <BaseInput > inputsWithKeys,
356356 }) async {
357+ final insAndKeys = inputsWithKeys.cast <StandardInput >();
358+
357359 Logging .instance.d ("Starting Particl buildTransaction ----------" );
358360
359361 // TODO: use coinlib (For this we need coinlib to support particl)
@@ -371,8 +373,8 @@ class ParticlWallet<T extends ElectrumXCurrencyInterface>
371373 );
372374
373375 final List <({Uint8List ? output, Uint8List ? redeem})> extraData = [];
374- for (int i = 0 ; i < inputsWithKeys .length; i++ ) {
375- final sd = inputsWithKeys [i];
376+ for (int i = 0 ; i < insAndKeys .length; i++ ) {
377+ final sd = insAndKeys [i];
376378
377379 final pubKey = sd.key! .publicKey.data;
378380 final bitcoindart.PaymentData ? data;
@@ -448,11 +450,11 @@ class ParticlWallet<T extends ElectrumXCurrencyInterface>
448450 final List <OutputV2 > tempOutputs = [];
449451
450452 // Add inputs.
451- for (var i = 0 ; i < inputsWithKeys .length; i++ ) {
452- final txid = inputsWithKeys [i].utxo.txid;
453+ for (var i = 0 ; i < insAndKeys .length; i++ ) {
454+ final txid = insAndKeys [i].utxo.txid;
453455 txb.addInput (
454456 txid,
455- inputsWithKeys [i].utxo.vout,
457+ insAndKeys [i].utxo.vout,
456458 null ,
457459 extraData[i].output! ,
458460 cryptoCurrency.networkParams.bech32Hrp,
@@ -464,14 +466,14 @@ class ParticlWallet<T extends ElectrumXCurrencyInterface>
464466 scriptSigAsm: null ,
465467 sequence: 0xffffffff - 1 ,
466468 outpoint: OutpointV2 .isarCantDoRequiredInDefaultConstructor (
467- txid: inputsWithKeys [i].utxo.txid,
468- vout: inputsWithKeys [i].utxo.vout,
469+ txid: insAndKeys [i].utxo.txid,
470+ vout: insAndKeys [i].utxo.vout,
469471 ),
470472 addresses:
471- inputsWithKeys [i].utxo.address == null
473+ insAndKeys [i].utxo.address == null
472474 ? []
473- : [inputsWithKeys [i].utxo.address! ],
474- valueStringSats: inputsWithKeys [i].utxo.value.toString (),
475+ : [insAndKeys [i].utxo.address! ],
476+ valueStringSats: insAndKeys [i].utxo.value.toString (),
475477 witness: null ,
476478 innerRedeemScriptAsm: null ,
477479 coinbase: null ,
@@ -508,15 +510,15 @@ class ParticlWallet<T extends ElectrumXCurrencyInterface>
508510
509511 // Sign.
510512 try {
511- for (var i = 0 ; i < inputsWithKeys .length; i++ ) {
513+ for (var i = 0 ; i < insAndKeys .length; i++ ) {
512514 txb.sign (
513515 vin: i,
514516 keyPair: bitcoindart.ECPair .fromPrivateKey (
515- inputsWithKeys [i].key! .privateKey! .data,
517+ insAndKeys [i].key! .privateKey! .data,
516518 network: convertedNetwork,
517- compressed: inputsWithKeys [i].key! .privateKey! .compressed,
519+ compressed: insAndKeys [i].key! .privateKey! .compressed,
518520 ),
519- witnessValue: inputsWithKeys [i].utxo.value,
521+ witnessValue: insAndKeys [i].utxo.value,
520522 redeemScript: extraData[i].redeem,
521523 overridePrefix: cryptoCurrency.networkParams.bech32Hrp,
522524 );
0 commit comments