diff --git a/lib/exceptions/address/address_exception.dart b/lib/exceptions/address/address_exception.dart new file mode 100644 index 000000000..3331bef99 --- /dev/null +++ b/lib/exceptions/address/address_exception.dart @@ -0,0 +1,5 @@ +import 'package:stackwallet/exceptions/sw_exception.dart'; + +class AddressException extends SWException { + AddressException(super.message); +} diff --git a/lib/exceptions/sw_exception.dart b/lib/exceptions/sw_exception.dart new file mode 100644 index 000000000..34ab664f2 --- /dev/null +++ b/lib/exceptions/sw_exception.dart @@ -0,0 +1,11 @@ +// generic stack wallet exception which all other custom exceptions should +// extend from + +class SWException with Exception { + SWException(this.message); + + final String message; + + @override + toString() => message; +} diff --git a/lib/exceptions/wallet/insufficient_balance_exception.dart b/lib/exceptions/wallet/insufficient_balance_exception.dart new file mode 100644 index 000000000..219ef6a76 --- /dev/null +++ b/lib/exceptions/wallet/insufficient_balance_exception.dart @@ -0,0 +1,5 @@ +import 'package:stackwallet/exceptions/sw_exception.dart'; + +class InsufficientBalanceException extends SWException { + InsufficientBalanceException(super.message); +} diff --git a/lib/exceptions/wallet/paynym_send_exception.dart b/lib/exceptions/wallet/paynym_send_exception.dart new file mode 100644 index 000000000..9980e6790 --- /dev/null +++ b/lib/exceptions/wallet/paynym_send_exception.dart @@ -0,0 +1,5 @@ +import 'package:stackwallet/exceptions/sw_exception.dart'; + +class PaynymSendException extends SWException { + PaynymSendException(super.message); +} diff --git a/lib/models/isar/models/address/address.dart b/lib/models/isar/models/address/address.dart index df6d06fa7..c3e885f3e 100644 --- a/lib/models/isar/models/address/address.dart +++ b/lib/models/isar/models/address/address.dart @@ -1,14 +1,10 @@ import 'package:isar/isar.dart'; +import 'package:stackwallet/exceptions/address/address_exception.dart'; import 'package:stackwallet/models/isar/models/address/crypto_currency_address.dart'; import 'package:stackwallet/models/isar/models/blockchain_data/transaction.dart'; -import 'package:stackwallet/services/coins/coin_paynym_extension.dart'; part 'address.g.dart'; -class AddressException extends SWException { - AddressException(super.message); -} - @Collection(accessor: "addresses") class Address extends CryptoCurrencyAddress { Address({ diff --git a/lib/pages/paynym/dialogs/paynym_details_popup.dart b/lib/pages/paynym/dialogs/paynym_details_popup.dart index 72c4a2f46..350b02ead 100644 --- a/lib/pages/paynym/dialogs/paynym_details_popup.dart +++ b/lib/pages/paynym/dialogs/paynym_details_popup.dart @@ -5,6 +5,7 @@ import 'package:flutter/services.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; import 'package:qr_flutter/qr_flutter.dart'; +import 'package:stackwallet/exceptions/wallet/insufficient_balance_exception.dart'; import 'package:stackwallet/models/paynym/paynym_account_lite.dart'; import 'package:stackwallet/notifications/show_flush_bar.dart'; import 'package:stackwallet/pages/paynym/dialogs/confirm_paynym_connect_dialog.dart'; diff --git a/lib/pages/paynym/subwidgets/desktop_paynym_details.dart b/lib/pages/paynym/subwidgets/desktop_paynym_details.dart index d51a0fecd..ee4996a9d 100644 --- a/lib/pages/paynym/subwidgets/desktop_paynym_details.dart +++ b/lib/pages/paynym/subwidgets/desktop_paynym_details.dart @@ -5,6 +5,7 @@ import 'package:flutter/services.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; import 'package:qr_flutter/qr_flutter.dart'; +import 'package:stackwallet/exceptions/wallet/insufficient_balance_exception.dart'; import 'package:stackwallet/models/paynym/paynym_account_lite.dart'; import 'package:stackwallet/notifications/show_flush_bar.dart'; import 'package:stackwallet/pages/paynym/dialogs/confirm_paynym_connect_dialog.dart'; diff --git a/lib/services/coins/coin_paynym_extension.dart b/lib/services/coins/coin_paynym_extension.dart index 7cebca9ca..d8f5c535e 100644 --- a/lib/services/coins/coin_paynym_extension.dart +++ b/lib/services/coins/coin_paynym_extension.dart @@ -8,6 +8,8 @@ import 'package:bitcoindart/src/utils/constants/op.dart' as op; import 'package:bitcoindart/src/utils/script.dart' as bscript; import 'package:isar/isar.dart'; import 'package:pointycastle/digests/sha256.dart'; +import 'package:stackwallet/exceptions/wallet/insufficient_balance_exception.dart'; +import 'package:stackwallet/exceptions/wallet/paynym_send_exception.dart'; import 'package:stackwallet/hive/db.dart'; import 'package:stackwallet/models/isar/models/isar_models.dart'; import 'package:stackwallet/services/coins/dogecoin/dogecoin_wallet.dart'; @@ -16,23 +18,6 @@ import 'package:stackwallet/utilities/format.dart'; import 'package:stackwallet/utilities/logger.dart'; import 'package:tuple/tuple.dart'; -class SWException with Exception { - SWException(this.message); - - final String message; - - @override - toString() => message; -} - -class InsufficientBalanceException extends SWException { - InsufficientBalanceException(super.message); -} - -class PaynymSendException extends SWException { - PaynymSendException(super.message); -} - extension PayNym on DogecoinWallet { // fetch or generate this wallet's bip47 payment code Future getPaymentCode() async {