@@ -886,6 +886,8 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
886886 if (unspent.vout == 0 ) {
887887 unspent.isChange = true ;
888888 }
889+
890+ // printV("unspent: $unspent ${unspent.vout} ${utxo.value}");
889891 mwebUnspentCoins.add (unspent);
890892 });
891893
@@ -1140,13 +1142,27 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
11401142 @override
11411143 Future <PendingTransaction > createTransaction (Object credentials) async {
11421144 try {
1143- var tx = await super .createTransaction (credentials) as PendingBitcoinTransaction ;
1145+ var creds;
1146+ if (! mwebEnabled) {
1147+ BitcoinTransactionCredentials btcCreds = (credentials as BitcoinTransactionCredentials );
1148+ // sets unspent coin type to nonMweb:
1149+ creds = BitcoinTransactionCredentials (
1150+ btcCreds.outputs,
1151+ priority: btcCreds.priority,
1152+ feeRate: btcCreds.feeRate,
1153+ coinTypeToSpendFrom: UnspentCoinType .nonMweb,
1154+ );
1155+ } else {
1156+ creds = credentials;
1157+ }
1158+ var tx = await super .createTransaction (creds as Object ) as PendingBitcoinTransaction ;
11441159 tx.isMweb = mwebEnabled;
11451160
11461161 if (! mwebEnabled) {
11471162 tx.changeAddressOverride = (await (walletAddresses as LitecoinWalletAddresses )
11481163 .getChangeAddress (coinTypeToSpendFrom: UnspentCoinType .nonMweb))
11491164 .address;
1165+
11501166 if (tx.shouldCommitUR ()) {
11511167 tx.unsignedPsbt = await buildPsbt (tx, false );
11521168 }
@@ -1165,17 +1181,17 @@ abstract class LitecoinWalletBase extends ElectrumWallet with Store {
11651181 final address = output.address.toLowerCase ();
11661182 final extractedAddress = output.extractedAddress? .toLowerCase ();
11671183
1168- if (address.contains ( "mweb " )) {
1184+ if (address.startsWith ( "ltcmweb " )) {
11691185 hasMwebOutput = true ;
11701186 }
1171- if (! address.contains ( "mweb " )) {
1187+ if (! address.startsWith ( "ltcmweb " )) {
11721188 hasRegularOutput = true ;
11731189 }
11741190 if (extractedAddress != null && extractedAddress.isNotEmpty) {
1175- if (extractedAddress.contains ( "mweb " )) {
1191+ if (extractedAddress.startsWith ( "ltcmweb " )) {
11761192 hasMwebOutput = true ;
11771193 }
1178- if (! extractedAddress.contains ( "mweb " )) {
1194+ if (! extractedAddress.startsWith ( "ltcmweb " )) {
11791195 hasRegularOutput = true ;
11801196 }
11811197 }
0 commit comments