@@ -145,6 +145,7 @@ class _SendViewState extends ConsumerState<SendView> {
145145
146146 Amount ? _cachedAmountToSend;
147147 String ? _address;
148+ String ? _opReturnData;
148149
149150 bool _addressToggleFlag = false ;
150151
@@ -179,6 +180,16 @@ class _SendViewState extends ConsumerState<SendView> {
179180 ref.read (pSendAmount.notifier).state = amount;
180181 }
181182
183+ // Extract OP_RETURN data if present (for Rosen Bridge and other protocols)
184+ if (paymentData.additionalParams.containsKey ('op_return' )) {
185+ _opReturnData = paymentData.additionalParams['op_return' ];
186+ Logging .instance.i (
187+ "Extracted OP_RETURN data from URI, length: ${_opReturnData !.length ~/ 2 } bytes" ,
188+ );
189+ } else {
190+ _opReturnData = null ;
191+ }
192+
182193 _setValidAddressProviders (_address);
183194 setState (() {
184195 _addressToggleFlag = sendToController.text.isNotEmpty;
@@ -919,6 +930,7 @@ class _SendViewState extends ConsumerState<SendView> {
919930 selectedUTXOs.isNotEmpty)
920931 ? selectedUTXOs
921932 : null ,
933+ opReturnData: _opReturnData,
922934 ),
923935 );
924936 } else if (wallet is FiroWallet ) {
@@ -960,6 +972,7 @@ class _SendViewState extends ConsumerState<SendView> {
960972 utxos: (coinControlEnabled && selectedUTXOs.isNotEmpty)
961973 ? selectedUTXOs
962974 : null ,
975+ opReturnData: _opReturnData,
963976 ),
964977 );
965978 }
@@ -1041,6 +1054,7 @@ class _SendViewState extends ConsumerState<SendView> {
10411054 selectedUTXOs.isNotEmpty)
10421055 ? selectedUTXOs
10431056 : null ,
1057+ opReturnData: _opReturnData,
10441058 ),
10451059 );
10461060 }
@@ -1131,6 +1145,7 @@ class _SendViewState extends ConsumerState<SendView> {
11311145 memoController.text = "" ;
11321146 _address = "" ;
11331147 _addressToggleFlag = false ;
1148+ _opReturnData = null ;
11341149 if (mounted) {
11351150 setState (() {});
11361151 }
@@ -1943,6 +1958,36 @@ class _SendViewState extends ConsumerState<SendView> {
19431958 ),
19441959 ),
19451960 ),
1961+ if (_opReturnData != null &&
1962+ _opReturnData! .isNotEmpty &&
1963+ _address != null &&
1964+ _address! .isNotEmpty &&
1965+ (ref.watch (pValidSendToAddress) ||
1966+ ref.watch (pValidSparkSendToAddress)))
1967+ Align (
1968+ alignment: Alignment .topLeft,
1969+ child: Padding (
1970+ padding: const EdgeInsets .only (
1971+ left: 12.0 ,
1972+ top: 4.0 ,
1973+ ),
1974+ child: Tooltip (
1975+ message: _opReturnData,
1976+ child: Text (
1977+ "Transaction metadata "
1978+ "(${_opReturnData !.length ~/ 2 } bytes) "
1979+ "\u 2014 tap for details" ,
1980+ textAlign: TextAlign .left,
1981+ style: STextStyles .label (context)
1982+ .copyWith (
1983+ color: Theme .of (context)
1984+ .extension < StackColors > ()!
1985+ .accentColorBlue,
1986+ ),
1987+ ),
1988+ ),
1989+ ),
1990+ ),
19461991 Builder (
19471992 builder: (_) {
19481993 final String ? error;
@@ -2660,16 +2705,42 @@ class _SendViewState extends ConsumerState<SendView> {
26602705 ),
26612706 const Spacer (),
26622707 const SizedBox (height: 12 ),
2708+ if (_opReturnData != null &&
2709+ balType == BalanceType .private)
2710+ Padding (
2711+ padding: const EdgeInsets .only (
2712+ left: 12.0 ,
2713+ right: 12.0 ,
2714+ bottom: 12.0 ,
2715+ ),
2716+ child: Text (
2717+ "Bridge data detected but Spark (private) "
2718+ "transactions cannot carry OP_RETURN data. "
2719+ "Switch to public balance to complete the "
2720+ "bridge transaction." ,
2721+ textAlign: TextAlign .left,
2722+ style: STextStyles .label (context).copyWith (
2723+ color: Theme .of (
2724+ context,
2725+ ).extension < StackColors > ()! .textError,
2726+ ),
2727+ ),
2728+ ),
26632729 TextButton (
26642730 onPressed:
2665- ref.watch (pPreviewTxButtonEnabled (coin))
2731+ ref.watch (pPreviewTxButtonEnabled (coin)) &&
2732+ (_opReturnData == null ||
2733+ balType != BalanceType .private)
26662734 ? isMwcSlatepack
26672735 ? _createSlatepack
26682736 : isEpicSlatepack
26692737 ? _createEpicSlatepack
26702738 : _previewTransaction
26712739 : null ,
2672- style: ref.watch (pPreviewTxButtonEnabled (coin))
2740+ style:
2741+ ref.watch (pPreviewTxButtonEnabled (coin)) &&
2742+ (_opReturnData == null ||
2743+ balType != BalanceType .private)
26732744 ? Theme .of (context)
26742745 .extension < StackColors > ()!
26752746 .getPrimaryEnabledButtonStyle (context)
0 commit comments