fix: add OpenCryptoPay request handling to SendViewModel (#3105)

This commit is contained in:
Konstantin Ullrich
2026-03-18 14:55:46 +01:00
committed by GitHub
parent ac3cca2e5e
commit 183e2bed94
2 changed files with 30 additions and 2 deletions
+27
View File
@@ -529,6 +529,33 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor
}
}
@action
Future<PaymentRequest?> getOpenCryptoPayRequest(String uri) async {
try {
final originalOCPRequest = await _ocpService.getOpenCryptoPayInvoice(uri.toString());
final paymentUri = await _ocpService.getOpenCryptoPayAddress(
originalOCPRequest,
selectedCryptoCurrency,
);
ocpRequest = originalOCPRequest;
clearOutputs();
return PaymentRequest.fromUri(paymentUri);
} on OpenCryptoPayNotSupportedException catch (e) {
printV(e.message);
if (walletType == WalletType.bitcoin) {
state = InitialExecutionState();
} else {
state = FailureState(translateErrorMessage(e, walletType, currency));
}
} catch (e) {
printV(e);
state = FailureState(translateErrorMessage(e, walletType, currency));
}
return null;
}
@action
Future<PendingTransaction?> createOpenCryptoPayTransaction(String uri) async {
state = IsExecutingState();