mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-17 05:41:29 +02:00
New versions (#1355)
* New versions * Check for Taproot inputs when exchanging with ThorChain * Properly handle taproot case with thorchain * fix missing import
This commit is contained in:
@@ -239,4 +239,9 @@ class CWBitcoin extends Bitcoin {
|
||||
return SegwitAddresType.p2wpkh;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
bool hasTaprootInput(PendingTransaction pendingTransaction) {
|
||||
return (pendingTransaction as PendingBitcoinTransaction).hasTaprootInputs;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -308,13 +308,19 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor
|
||||
pendingTransaction = await wallet.createTransaction(_credentials());
|
||||
if (provider is ThorChainExchangeProvider) {
|
||||
final outputCount = pendingTransaction?.outputCount ?? 0;
|
||||
if (outputCount > 10) throw Exception("ThorChain does not support more than 10 outputs");
|
||||
if (outputCount > 10) {
|
||||
throw Exception("ThorChain does not support more than 10 outputs");
|
||||
}
|
||||
if (_hasTaprootInput(pendingTransaction)) {
|
||||
throw Exception("ThorChain does not support Taproot addresses");
|
||||
}
|
||||
}
|
||||
state = ExecutedSuccessfullyState();
|
||||
return pendingTransaction;
|
||||
} catch (e) {
|
||||
state = FailureState(translateErrorMessage(e, wallet.type, wallet.currency));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@action
|
||||
@@ -512,4 +518,12 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor
|
||||
|
||||
return errorMessage;
|
||||
}
|
||||
|
||||
bool _hasTaprootInput(PendingTransaction? pendingTransaction) {
|
||||
if (walletType == WalletType.bitcoin && pendingTransaction != null) {
|
||||
return bitcoin!.hasTaprootInput(pendingTransaction);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user