fix: convert decoded JSON list instead of casting in solana_signAllTransactions (#3671)
What changed, and why it matters
This commit fixes a bug in Cake Wallet's Solana WalletConnect feature. When a user approved signing multiple Solana transactions, the app incorrectly tried to force the incoming transaction list into a specific Dart type (List<String>), but the data arrived as a generic decoded JSON list (List<dynamic>). This caused a TypeError every time, which the app then reported to the connected dApp as 'MALFORMED_REQUEST_PARAMS' even though the user had already approved. The fix safely converts the list to the expected string type instead of hard-casting it, restoring normal functionality for multi-transaction signing requests.
Treat as a functional bug fix with minor security relevance. Review whether other WalletConnect chain service handlers use similar unsafe casts on decoded JSON params and apply the same List<T>.from / Map<T>.from conversion pattern. Verify that user-approval flows do not occur before robust parameter validation for transaction requests.
Security signals we found
Type confusion / unsafe cast in request handler
Error-handling path maps implementation TypeError to MALFORMED_REQUEST_PARAMS
User approval occurs before parameter validation/casting failure
Fixes a reported issue (#3659) causing legitimate multi-transaction signing to fail
No input sanitization change: invalid (non-string) elements still throw and are rejected
Evidence from the diff
In solana_chain_service.dart, the handler for solana_signAllTransactions previously used params['transactions'] as List<String>. Because WalletConnect params arrive as decoded JSON, the runtime type is List<dynamic>, so the cast always threw a TypeError. The handler caught this and returned a MALFORMED_REQUEST_PARAMS error after user approval. The patch changes the line to List<String>.from(params['transactions'] as List<dynamic>), which creates a new List
Changed components
lib/src/screens/wallet_connect/services/chain_service/solana/solana_chain_service.dartsolana_signAllTransactions WalletConnect handlerInspect captured patch +2 / −1
### lib/src/screens/wallet_connect/services/chain_service/solana/solana_chain_service.dart
@@ -213,7 +213,8 @@ class SolanaChainService {
if (isApproved) {
if (params.containsKey('transactions')) {
- final transactions = params['transactions'] as List<String>;
+ final transactions =
+ List<String>.from(params['transactions'] as List<dynamic>);
List<String> signedTransactions = [];
for (var transaction in transactions) {Why this scored 37/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.