handle more ledger cases [skip ci]

This commit is contained in:
OmarHatem
2025-08-04 03:47:52 +03:00
parent 155b9ab32c
commit 1312bd00de
5 changed files with 15 additions and 20 deletions
@@ -173,7 +173,14 @@ abstract class LedgerViewModelBase with Store {
}
}
String? interpretErrorCode(String errorCode) {
String? interpretErrorCode(String error) {
if (error.contains("Make sure no other program is communicating with the Ledger")) {
return error;
}
var errorRegex = RegExp(r'0x\S*?(?= )').firstMatch(error.toString());
String errorCode = errorRegex?.group(0).toString().replaceAll("0x", "") ?? "";
if (errorCode.contains("6985")) {
return S.current.ledger_error_tx_rejected_by_user;
} else if (errorCode.contains("5515")) {