Merge branch 'main' of https://github.com/cake-tech/cake_wallet into mweb-bg-sync-2

This commit is contained in:
Matthew Fosse 2024-12-20 11:36:18 -05:00
commit 187dc980d7
6 changed files with 26 additions and 15 deletions

View file

@ -27,7 +27,7 @@ class TransactionCommitFailed implements Exception {
@override @override
String toString() { String toString() {
return errorMessage??"unknown error"; return errorMessage ?? "unknown error";
} }
} }
@ -44,3 +44,11 @@ class TransactionCommitFailedBIP68Final implements Exception {}
class TransactionCommitFailedLessThanMin implements Exception {} class TransactionCommitFailedLessThanMin implements Exception {}
class TransactionInputNotSupported implements Exception {} class TransactionInputNotSupported implements Exception {}
class SignNativeTokenTransactionRentException implements Exception {}
class CreateAssociatedTokenAccountException implements Exception {}
class SignSPLTokenTransactionRentException implements Exception {}
class NoAssociatedTokenAccountException implements Exception {}

View file

@ -1,4 +1,5 @@
import 'package:cw_core/crypto_currency.dart'; import 'package:cw_core/crypto_currency.dart';
import 'package:cw_core/exceptions.dart';
class SolanaTransactionCreationException implements Exception { class SolanaTransactionCreationException implements Exception {
final String exceptionMessage; final String exceptionMessage;
@ -20,18 +21,19 @@ class SolanaTransactionWrongBalanceException implements Exception {
String toString() => exceptionMessage; String toString() => exceptionMessage;
} }
class SolanaSignNativeTokenTransactionRentException implements Exception {} class SolanaSignNativeTokenTransactionRentException
extends SignNativeTokenTransactionRentException {}
class SolanaCreateAssociatedTokenAccountException implements Exception {
final String exceptionMessage;
class SolanaCreateAssociatedTokenAccountException extends CreateAssociatedTokenAccountException {
SolanaCreateAssociatedTokenAccountException(this.exceptionMessage); SolanaCreateAssociatedTokenAccountException(this.exceptionMessage);
final String exceptionMessage;
} }
class SolanaSignSPLTokenTransactionRentException implements Exception {} class SolanaSignSPLTokenTransactionRentException extends SignSPLTokenTransactionRentException {}
class SolanaNoAssociatedTokenAccountException implements Exception { class SolanaNoAssociatedTokenAccountException extends NoAssociatedTokenAccountException {
const SolanaNoAssociatedTokenAccountException(this.account, this.mint); SolanaNoAssociatedTokenAccountException(this.account, this.mint);
final String account; final String account;
final String mint; final String mint;

View file

@ -134,6 +134,7 @@ class AddressResolver {
Future<ParsedAddress> resolve(BuildContext context, String text, CryptoCurrency currency) async { Future<ParsedAddress> resolve(BuildContext context, String text, CryptoCurrency currency) async {
final ticker = currency.title; final ticker = currency.title;
try { try {
// twitter handle example: @username
if (text.startsWith('@') && !text.substring(1).contains('@')) { if (text.startsWith('@') && !text.substring(1).contains('@')) {
if (settingsStore.lookupsTwitter) { if (settingsStore.lookupsTwitter) {
final formattedName = text.substring(1); final formattedName = text.substring(1);
@ -165,6 +166,7 @@ class AddressResolver {
} }
} }
// Mastodon example: @username@hostname.xxx
if (text.startsWith('@') && text.contains('@', 1) && text.contains('.', 1)) { if (text.startsWith('@') && text.contains('@', 1) && text.contains('.', 1)) {
if (settingsStore.lookupsMastodon) { if (settingsStore.lookupsMastodon) {
final subText = text.substring(1); final subText = text.substring(1);

View file

@ -71,7 +71,7 @@ class SeedVerificationStepView extends StatelessWidget {
return GestureDetector( return GestureDetector(
onTap: () async { onTap: () async {
final isCorrectWord = walletSeedViewModel.isChosenWordCorrect(option); final isCorrectWord = walletSeedViewModel.isChosenWordCorrect(option);
final isSecondWrongEntry = walletSeedViewModel.wrongEntries == 2; final isSecondWrongEntry = walletSeedViewModel.wrongEntries >= 2;
if (!isCorrectWord) { if (!isCorrectWord) {
await showBar<void>( await showBar<void>(
context, context,

View file

@ -221,7 +221,7 @@ class ExceptionHandler {
// just ignoring until we find a solution to this issue or migrate from flutter secure storage // just ignoring until we find a solution to this issue or migrate from flutter secure storage
"core/auth_service.dart:63", "core/auth_service.dart:63",
"core/key_service.dart:14", "core/key_service.dart:14",
"core/wallet_loading_service.dart:132", "core/wallet_loading_service.dart:133",
]; ];
static Future<void> _addDeviceInfo(File file) async { static Future<void> _addDeviceInfo(File file) async {

View file

@ -26,7 +26,6 @@ import 'package:cw_core/transaction_priority.dart';
import 'package:cw_core/unspent_coin_type.dart'; import 'package:cw_core/unspent_coin_type.dart';
import 'package:cake_wallet/view_model/send/output.dart'; import 'package:cake_wallet/view_model/send/output.dart';
import 'package:cake_wallet/view_model/send/send_template_view_model.dart'; import 'package:cake_wallet/view_model/send/send_template_view_model.dart';
import 'package:cw_solana/solana_exceptions.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hive/hive.dart'; import 'package:hive/hive.dart';
import 'package:mobx/mobx.dart'; import 'package:mobx/mobx.dart';
@ -676,19 +675,19 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor
} }
} }
if (error is SolanaSignNativeTokenTransactionRentException) { if (error is SignNativeTokenTransactionRentException) {
return S.current.solana_sign_native_transaction_rent_exception; return S.current.solana_sign_native_transaction_rent_exception;
} }
if (error is SolanaCreateAssociatedTokenAccountException) { if (error is CreateAssociatedTokenAccountException) {
return S.current.solana_create_associated_token_account_exception; return S.current.solana_create_associated_token_account_exception;
} }
if (error is SolanaSignSPLTokenTransactionRentException) { if (error is SignSPLTokenTransactionRentException) {
return S.current.solana_sign_spl_token_transaction_rent_exception; return S.current.solana_sign_spl_token_transaction_rent_exception;
} }
if (error is SolanaNoAssociatedTokenAccountException) { if (error is NoAssociatedTokenAccountException) {
return S.current.solana_no_associated_token_account_exception; return S.current.solana_no_associated_token_account_exception;
} }