feat(spl): add Solana token (SPL) state mgmt providers
What changed, and why it matters
This commit adds two new Dart files that manage UI state for Solana token wallets. One tracks which token wallet is currently active, and the other returns a hard-coded mock balance of 1000.00 for development purposes. There is no security-sensitive code, no cryptographic handling, no network calls, and no user data processing. It is a routine feature addition with no apparent security relevance.
No security action required. Treat as normal feature code. When the TODO is addressed, review the real balance-fetching implementation for proper input validation, RPC endpoint trust assumptions, and balance parsing correctness.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit introduces Riverpod state providers for Solana SPL tokens. current_sol_token_wallet_provider.dart defines a nullable StateProvider<SolanaTokenWallet?> and a read-only derived provider. sol_token_balance_provider.dart defines a Provider.family<Balance, ({String walletId, String tokenMint})> that currently returns mocked Balance objects with fixed 1000.00 total/spendable amounts and zero pending/blocked amounts. The code is explicitly labeled as mock data for UI development with a TODO to integrate a real API later. No secrets, network requests, validation logic, or security controls are present.
Changed components
lib/wallets/isar/providers/solana/current_sol_token_wallet_provider.dartlib/wallets/isar/providers/solana/sol_token_balance_provider.dartInspect captured patch +47 / −0
diff --git a/lib/wallets/isar/providers/solana/current_sol_token_wallet_provider.dart b/lib/wallets/isar/providers/solana/current_sol_token_wallet_provider.dart
new file mode 100644
index 0000000..ab17451
--- /dev/null
+++ b/lib/wallets/isar/providers/solana/current_sol_token_wallet_provider.dart
@@ -0,0 +1,15 @@
+import 'package:flutter_riverpod/flutter_riverpod.dart';
+
+import '../../../wallet/impl/sub_wallets/solana_token_wallet.dart';
+
+/// State provider for the currently active Solana token wallet.
+///
+/// This allows global tracking of which token wallet is being viewed/interacted-with.
+final solanaTokenServiceStateProvider =
+ StateProvider<SolanaTokenWallet?>((ref) => null);
+
+/// Public provider to read the current active Solana token wallet.
+///
+/// Use this in UI widgets to get the active token wallet.
+final pCurrentSolanaTokenWallet =
+ Provider<SolanaTokenWallet?>((ref) => ref.watch(solanaTokenServiceStateProvider));
diff --git a/lib/wallets/isar/providers/solana/sol_token_balance_provider.dart b/lib/wallets/isar/providers/solana/sol_token_balance_provider.dart
new file mode 100644
index 0000000..30b0691
--- /dev/null
+++ b/lib/wallets/isar/providers/solana/sol_token_balance_provider.dart
@@ -0,0 +1,32 @@
+import 'package:decimal/decimal.dart';
+import 'package:flutter_riverpod/flutter_riverpod.dart';
+
+import '../../../../models/balance.dart';
+import '../../../../utilities/amount/amount.dart';
+
+/// Provider family for Solana token balance.
+///
+/// Currently returns mock data while API is a WIP.
+///
+/// Example usage in UI:
+/// final balance = ref.watch(
+/// pSolanaTokenBalance((walletId: 'wallet1', tokenMint: 'EPjFWaJUwYUoRwzwkH4H8gNB7zHW9tLT6NCKB8S4yh6h'))
+/// );
+final pSolanaTokenBalance = Provider.family<
+ Balance,
+ ({String walletId, String tokenMint})>((ref, params) {
+ // Mock data for UI development.
+ // TODO: when API is ready, this should fetch real balance from SolanaAPI.
+ return Balance(
+ total: Amount.fromDecimal(
+ Decimal.parse("1000.00"),
+ fractionDigits: 6,
+ ),
+ spendable: Amount.fromDecimal(
+ Decimal.parse("1000.00"),
+ fractionDigits: 6,
+ ),
+ blockedTotal: Amount.zeroWith(fractionDigits: 6),
+ pendingSpendable: Amount.zeroWith(fractionDigits: 6),
+ );
+});
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.