Skip to content

Commit b8c8989

Browse files
committed
fix(firo): clear stale op return send state
1 parent 2d5f173 commit b8c8989

3 files changed

Lines changed: 13 additions & 1 deletion

File tree

lib/pages/send_view/send_view.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ class _SendViewState extends ConsumerState<SendView> {
257257
paymentData.coin?.uriScheme == coin.uriScheme) {
258258
_applyUri(paymentData);
259259
} else {
260+
_setOpReturnData(null);
260261
if (coin is Epiccash) {
261262
content = AddressUtils().formatEpicCashAddress(content);
262263
}
@@ -270,6 +271,7 @@ class _SendViewState extends ConsumerState<SendView> {
270271
});
271272
}
272273
} catch (e) {
274+
_setOpReturnData(null);
273275
// strip http:// and https:// if content contains @
274276
if (coin is Epiccash) {
275277
content = AddressUtils().formatEpicCashAddress(content);
@@ -323,6 +325,7 @@ class _SendViewState extends ConsumerState<SendView> {
323325
paymentData.coin?.uriScheme == coin.uriScheme) {
324326
_applyUri(paymentData);
325327
} else {
328+
_setOpReturnData(null);
326329
_address = qrResult.rawContent!.split("\n").first.trim();
327330
sendToController.text = _address ?? "";
328331

@@ -1281,6 +1284,7 @@ class _SendViewState extends ConsumerState<SendView> {
12811284
if (parsed != null) {
12821285
_applyUri(parsed);
12831286
} else {
1287+
_setOpReturnData(null);
12841288
sendToController.text = content;
12851289
_address = content;
12861290

@@ -1812,6 +1816,7 @@ class _SendViewState extends ConsumerState<SendView> {
18121816
);
18131817
}
18141818
} else {
1819+
_setOpReturnData(null);
18151820
await _checkSparkNameAndOrSetAddress(
18161821
newValue,
18171822
setController: false,

lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_send.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1783,6 +1783,7 @@ class _DesktopSendState extends ConsumerState<DesktopSend> {
17831783
await _checkSparkNameAndOrSetAddress(newValue);
17841784
}
17851785
} else {
1786+
_setOpReturnData(null);
17861787
await _checkSparkNameAndOrSetAddress(
17871788
newValue,
17881789
setController: false,
@@ -1896,6 +1897,7 @@ class _DesktopSendState extends ConsumerState<DesktopSend> {
18961897
);
18971898

18981899
if (entry != null) {
1900+
_setOpReturnData(null);
18991901
sendToController.text =
19001902
entry.other ?? entry.label;
19011903

lib/providers/ui/preview_tx_button_state_provider.dart

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ final pIsSlatepack = Provider.family<bool, String>((ref, walletId) {
5252
final pPreviewTxButtonEnabled = Provider.autoDispose.family<bool, CryptoCurrency>(
5353
(ref, coin) {
5454
final amount = ref.watch(pSendAmount) ?? Amount.zero;
55+
final opReturnData = ref.watch(pOpReturnData);
56+
57+
if (coin is! Firo && opReturnData != null && opReturnData.isNotEmpty) {
58+
return false;
59+
}
5560

5661
// For MWC slatepack transactions, address validation is not required.
5762
if (coin is Mimblewimblecoin) {
@@ -76,7 +81,7 @@ final pPreviewTxButtonEnabled = Provider.autoDispose.family<bool, CryptoCurrency
7681
return (ref.watch(pValidSendToAddress) ||
7782
ref.watch(pValidSparkSendToAddress)) &&
7883
!ref.watch(pIsExchangeAddress) &&
79-
ref.watch(pOpReturnData) == null &&
84+
opReturnData == null &&
8085
amount > Amount.zero;
8186

8287
case BalanceType.public:

0 commit comments

Comments
 (0)