Skip to content

Commit 337a24f

Browse files
committed
fix(solana): fix Solana token tx parsing to handle plain "transfer" type
1 parent 170bec8 commit 337a24f

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

lib/wallets/wallet/impl/sub_wallets/solana_token_wallet.dart

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,8 @@ class SolanaTokenWallet extends Wallet {
510510
(e) =>
511511
e.containsKey("parsed") &&
512512
e["program"] == "spl-token" &&
513-
e["parsed"]["type"] == "transferChecked",
513+
(e["parsed"]["type"] == "transferChecked" ||
514+
e["parsed"]["type"] == "transfer"),
514515
);
515516

516517
if (splTransfers.length != 1) {
@@ -522,9 +523,17 @@ class SolanaTokenWallet extends Wallet {
522523
continue;
523524
}
524525
final transfer = splTransfers.first;
525-
final lamports = BigInt.parse(
526-
transfer["parsed"]["info"]["tokenAmount"]["amount"].toString(),
527-
);
526+
final transferType = transfer["parsed"]["type"] as String;
527+
final BigInt lamports;
528+
if (transferType == "transferChecked") {
529+
lamports = BigInt.parse(
530+
transfer["parsed"]["info"]["tokenAmount"]["amount"].toString(),
531+
);
532+
} else {
533+
lamports = BigInt.parse(
534+
transfer["parsed"]["info"]["amount"].toString(),
535+
);
536+
}
528537
final senderAddress = transfer["parsed"]["info"]["source"] as String;
529538
final receiverAddress =
530539
transfer["parsed"]["info"]["destination"] as String;

0 commit comments

Comments
 (0)