@@ -47,6 +47,7 @@ import '../../wallets/wallet/impl/epiccash_wallet.dart';
4747import '../../wallets/wallet/impl/firo_wallet.dart' ;
4848import '../../wallets/wallet/impl/mimblewimblecoin_wallet.dart' ;
4949import '../../wallets/wallet/impl/solana_wallet.dart' ;
50+ import '../../wallets/wallet/wallet_mixin_interfaces/ordinals_interface.dart' ;
5051import '../../wallets/wallet/wallet_mixin_interfaces/paynym_interface.dart' ;
5152import '../../widgets/background.dart' ;
5253import '../../widgets/conditional_parent.dart' ;
@@ -110,6 +111,36 @@ class _ConfirmTransactionViewState
110111 late final FocusNode _onChainNoteFocusNode;
111112 late final TextEditingController onChainNoteController;
112113
114+ bool _spendsOrdinal = false ;
115+
116+ Future <void > _checkForOrdinalSpend () async {
117+ final wallet = ref.read (pWallets).getWallet (walletId);
118+ if (wallet is ! OrdinalsInterface ) return ;
119+
120+ final usedUtxos = widget.txData.usedUTXOs;
121+ if (usedUtxos == null || usedUtxos.isEmpty) return ;
122+
123+ final db = ref.read (mainDBProvider);
124+ for (final input in usedUtxos) {
125+ if (input is ! StandardInput ) continue ;
126+ final ordinal = await db.isar.ordinals
127+ .where ()
128+ .filter ()
129+ .walletIdEqualTo (walletId)
130+ .and ()
131+ .utxoTXIDEqualTo (input.utxo.txid)
132+ .and ()
133+ .utxoVOUTEqualTo (input.utxo.vout)
134+ .findFirst ();
135+ if (ordinal != null ) {
136+ if (mounted) {
137+ setState (() => _spendsOrdinal = true );
138+ }
139+ return ;
140+ }
141+ }
142+ }
143+
113144 /// Handle MWC slatepack creation for manual exchange.
114145 Future <void > _handleMwcSlatepackCreation (
115146 BuildContext context,
@@ -537,6 +568,8 @@ class _ConfirmTransactionViewState
537568 onChainNoteController.text = widget.txData.noteOnChain ?? "" ;
538569
539570 super .initState ();
571+
572+ _checkForOrdinalSpend ();
540573 }
541574
542575 @override
@@ -1421,71 +1454,40 @@ class _ConfirmTransactionViewState
14211454 ),
14221455 ),
14231456 ),
1424- // Ordinal UTXO spend warning
1425- Builder (
1426- builder: (context) {
1427- final usedUtxos = widget.txData.usedUTXOs;
1428- if (usedUtxos == null || usedUtxos.isEmpty) {
1429- return const SizedBox .shrink ();
1430- }
1431-
1432- final db = ref.read (mainDBProvider);
1433- bool hasOrdinal = false ;
1434- for (final input in usedUtxos) {
1435- if (input is StandardInput ) {
1436- final ordinal = db.isar.ordinals
1437- .where ()
1438- .filter ()
1439- .walletIdEqualTo (walletId)
1440- .and ()
1441- .utxoTXIDEqualTo (input.utxo.txid)
1442- .and ()
1443- .utxoVOUTEqualTo (input.utxo.vout)
1444- .findFirstSync ();
1445- if (ordinal != null ) {
1446- hasOrdinal = true ;
1447- break ;
1448- }
1449- }
1450- }
1451-
1452- if (! hasOrdinal) return const SizedBox .shrink ();
1453-
1454- return Padding (
1455- padding: isDesktop
1456- ? const EdgeInsets .symmetric (horizontal: 32 , vertical: 8 )
1457- : const EdgeInsets .symmetric (vertical: 8 ),
1458- child: RoundedContainer (
1459- color: Theme .of (
1460- context,
1461- ).extension < StackColors > ()! .warningBackground,
1462- child: Row (
1463- children: [
1464- Icon (
1465- Icons .warning_amber_rounded,
1466- color: Theme .of (
1467- context,
1468- ).extension < StackColors > ()! .warningForeground,
1469- size: 20 ,
1470- ),
1471- const SizedBox (width: 8 ),
1472- Expanded (
1473- child: Text (
1474- "This transaction spends a UTXO containing "
1475- "an ordinal inscription." ,
1476- style: STextStyles .smallMed12 (context).copyWith (
1477- color: Theme .of (
1478- context,
1479- ).extension < StackColors > ()! .warningForeground,
1480- ),
1457+ if (_spendsOrdinal)
1458+ Padding (
1459+ padding: isDesktop
1460+ ? const EdgeInsets .symmetric (horizontal: 32 , vertical: 8 )
1461+ : const EdgeInsets .symmetric (vertical: 8 ),
1462+ child: RoundedContainer (
1463+ color: Theme .of (
1464+ context,
1465+ ).extension < StackColors > ()! .warningBackground,
1466+ child: Row (
1467+ children: [
1468+ Icon (
1469+ Icons .warning_amber_rounded,
1470+ color: Theme .of (
1471+ context,
1472+ ).extension < StackColors > ()! .warningForeground,
1473+ size: 20 ,
1474+ ),
1475+ const SizedBox (width: 8 ),
1476+ Expanded (
1477+ child: Text (
1478+ "This transaction spends a UTXO containing "
1479+ "an ordinal inscription." ,
1480+ style: STextStyles .smallMed12 (context).copyWith (
1481+ color: Theme .of (
1482+ context,
1483+ ).extension < StackColors > ()! .warningForeground,
14811484 ),
14821485 ),
1483- ] ,
1484- ) ,
1486+ ) ,
1487+ ] ,
14851488 ),
1486- );
1487- },
1488- ),
1489+ ),
1490+ ),
14891491 SizedBox (height: isDesktop ? 28 : 16 ),
14901492 Padding (
14911493 padding: isDesktop
0 commit comments