From b2b9accee121f85a5ebed93a6cf3ed6cc710a1d0 Mon Sep 17 00:00:00 2001 From: julian Date: Fri, 24 Mar 2023 15:31:05 -0600 Subject: [PATCH] add serialized amount string to transaction --- .../models/blockchain_data/transaction.dart | 16 ++++++++ .../coins/bitcoin/bitcoin_wallet.dart | 5 +++ .../coins/bitcoincash/bitcoincash_wallet.dart | 9 ++++ .../coins/dogecoin/dogecoin_wallet.dart | 5 +++ .../coins/epiccash/epiccash_wallet.dart | 5 +++ .../coins/ethereum/ethereum_wallet.dart | 5 +++ lib/services/coins/firo/firo_wallet.dart | 41 +++++++++++++++---- .../coins/litecoin/litecoin_wallet.dart | 5 +++ lib/services/coins/monero/monero_wallet.dart | 5 +++ .../coins/namecoin/namecoin_wallet.dart | 5 +++ .../coins/particl/particl_wallet.dart | 10 +++++ .../coins/wownero/wownero_wallet.dart | 8 +++- .../ethereum/ethereum_token_service.dart | 5 +++ lib/services/mixins/electrum_x_parsing.dart | 5 +++ lib/utilities/db_version_migration.dart | 5 +++ 15 files changed, 124 insertions(+), 10 deletions(-) diff --git a/lib/models/isar/models/blockchain_data/transaction.dart b/lib/models/isar/models/blockchain_data/transaction.dart index 538504748..bf6faac8c 100644 --- a/lib/models/isar/models/blockchain_data/transaction.dart +++ b/lib/models/isar/models/blockchain_data/transaction.dart @@ -5,6 +5,7 @@ import 'package:isar/isar.dart'; import 'package:stackwallet/models/isar/models/blockchain_data/address.dart'; import 'package:stackwallet/models/isar/models/blockchain_data/input.dart'; import 'package:stackwallet/models/isar/models/blockchain_data/output.dart'; +import 'package:stackwallet/utilities/amount.dart'; import 'package:tuple/tuple.dart'; part 'transaction.g.dart'; @@ -18,6 +19,7 @@ class Transaction { required this.type, required this.subType, required this.amount, + required this.amountString, required this.fee, required this.height, required this.isCancelled, @@ -35,6 +37,7 @@ class Transaction { TransactionType? type, TransactionSubType? subType, int? amount, + String? amountString, int? fee, int? height, bool? isCancelled, @@ -54,6 +57,7 @@ class Transaction { type: type ?? this.type, subType: subType ?? this.subType, amount: amount ?? this.amount, + amountString: amountString ?? this.amountString, fee: fee ?? this.fee, height: height ?? this.height, isCancelled: isCancelled ?? this.isCancelled, @@ -86,6 +90,8 @@ class Transaction { late final int amount; + late String? amountString; + late final int fee; late final int? height; @@ -105,6 +111,13 @@ class Transaction { @Backlink(to: "transactions") final address = IsarLink
(); + @ignore + Amount? _cachedAmount; + + @ignore + Amount get realAmount => + _cachedAmount ??= Amount.fromSerializedJsonString(amountString!); + int getConfirmations(int currentChainHeight) { if (height == null || height! <= 0) return 0; return max(0, currentChainHeight - (height! - 1)); @@ -124,6 +137,7 @@ class Transaction { "type: ${type.name}, " "subType: ${subType.name}, " "amount: $amount, " + "amountString: $amountString, " "fee: $fee, " "height: $height, " "isCancelled: $isCancelled, " @@ -143,6 +157,7 @@ class Transaction { "type": type.name, "subType": subType.name, "amount": amount, + "amountString": amountString, "fee": fee, "height": height, "isCancelled": isCancelled, @@ -168,6 +183,7 @@ class Transaction { type: TransactionType.values.byName(json["type"] as String), subType: TransactionSubType.values.byName(json["subType"] as String), amount: json["amount"] as int, + amountString: json["amountString"] as String, fee: json["fee"] as int, height: json["height"] as int?, isCancelled: json["isCancelled"] as bool, diff --git a/lib/services/coins/bitcoin/bitcoin_wallet.dart b/lib/services/coins/bitcoin/bitcoin_wallet.dart index ed969bf5d..c622479fb 100644 --- a/lib/services/coins/bitcoin/bitcoin_wallet.dart +++ b/lib/services/coins/bitcoin/bitcoin_wallet.dart @@ -34,6 +34,7 @@ import 'package:stackwallet/services/node_service.dart'; import 'package:stackwallet/services/notifications_api.dart'; import 'package:stackwallet/services/transaction_notification_tracker.dart'; import 'package:stackwallet/utilities/address_utils.dart'; +import 'package:stackwallet/utilities/amount.dart'; import 'package:stackwallet/utilities/assets.dart'; import 'package:stackwallet/utilities/bip32_utils.dart'; import 'package:stackwallet/utilities/constants.dart'; @@ -1335,6 +1336,10 @@ class BitcoinWallet extends CoinServiceAPI type: isar_models.TransactionType.outgoing, subType: isar_models.TransactionSubType.none, amount: txData["recipientAmt"] as int, + amountString: Amount( + rawValue: BigInt.from(txData["recipientAmt"] as int), + fractionDigits: coin.decimals, + ).toJsonString(), fee: txData["fee"] as int, height: null, isCancelled: false, diff --git a/lib/services/coins/bitcoincash/bitcoincash_wallet.dart b/lib/services/coins/bitcoincash/bitcoincash_wallet.dart index bd934552f..d954371d7 100644 --- a/lib/services/coins/bitcoincash/bitcoincash_wallet.dart +++ b/lib/services/coins/bitcoincash/bitcoincash_wallet.dart @@ -31,6 +31,7 @@ import 'package:stackwallet/services/node_service.dart'; import 'package:stackwallet/services/notifications_api.dart'; import 'package:stackwallet/services/transaction_notification_tracker.dart'; import 'package:stackwallet/utilities/address_utils.dart'; +import 'package:stackwallet/utilities/amount.dart'; import 'package:stackwallet/utilities/assets.dart'; import 'package:stackwallet/utilities/bip32_utils.dart'; import 'package:stackwallet/utilities/constants.dart'; @@ -1250,6 +1251,10 @@ class BitcoinCashWallet extends CoinServiceAPI type: isar_models.TransactionType.outgoing, subType: isar_models.TransactionSubType.none, amount: txData["recipientAmt"] as int, + amountString: Amount( + rawValue: BigInt.from(txData["recipientAmt"] as int), + fractionDigits: coin.decimals, + ).toJsonString(), fee: txData["fee"] as int, height: null, isCancelled: false, @@ -2309,6 +2314,10 @@ class BitcoinCashWallet extends CoinServiceAPI type: type, subType: isar_models.TransactionSubType.none, amount: amount, + amountString: Amount( + rawValue: BigInt.from(amount), + fractionDigits: coin.decimals, + ).toJsonString(), fee: fee, height: txData["height"] as int?, isCancelled: false, diff --git a/lib/services/coins/dogecoin/dogecoin_wallet.dart b/lib/services/coins/dogecoin/dogecoin_wallet.dart index 1c21407c8..232b47889 100644 --- a/lib/services/coins/dogecoin/dogecoin_wallet.dart +++ b/lib/services/coins/dogecoin/dogecoin_wallet.dart @@ -33,6 +33,7 @@ import 'package:stackwallet/services/node_service.dart'; import 'package:stackwallet/services/notifications_api.dart'; import 'package:stackwallet/services/transaction_notification_tracker.dart'; import 'package:stackwallet/utilities/address_utils.dart'; +import 'package:stackwallet/utilities/amount.dart'; import 'package:stackwallet/utilities/assets.dart'; import 'package:stackwallet/utilities/bip32_utils.dart'; import 'package:stackwallet/utilities/constants.dart'; @@ -1117,6 +1118,10 @@ class DogecoinWallet extends CoinServiceAPI type: isar_models.TransactionType.outgoing, subType: isar_models.TransactionSubType.none, amount: txData["recipientAmt"] as int, + amountString: Amount( + rawValue: BigInt.from(txData["recipientAmt"] as int), + fractionDigits: coin.decimals, + ).toJsonString(), fee: txData["fee"] as int, height: null, isCancelled: false, diff --git a/lib/services/coins/epiccash/epiccash_wallet.dart b/lib/services/coins/epiccash/epiccash_wallet.dart index d23c349d4..a2f8a8713 100644 --- a/lib/services/coins/epiccash/epiccash_wallet.dart +++ b/lib/services/coins/epiccash/epiccash_wallet.dart @@ -27,6 +27,7 @@ import 'package:stackwallet/services/mixins/epic_cash_hive.dart'; import 'package:stackwallet/services/mixins/wallet_cache.dart'; import 'package:stackwallet/services/mixins/wallet_db.dart'; import 'package:stackwallet/services/node_service.dart'; +import 'package:stackwallet/utilities/amount.dart'; import 'package:stackwallet/utilities/constants.dart'; import 'package:stackwallet/utilities/default_epicboxes.dart'; import 'package:stackwallet/utilities/default_nodes.dart'; @@ -1688,6 +1689,10 @@ class EpicCashWallet extends CoinServiceAPI : isar_models.TransactionType.outgoing, subType: isar_models.TransactionSubType.none, amount: amt, + amountString: Amount( + rawValue: BigInt.from(amt), + fractionDigits: coin.decimals, + ).toJsonString(), fee: (tx["fee"] == null) ? 0 : int.parse(tx["fee"] as String), height: height, isCancelled: tx["tx_type"] == "TxSentCancelled" || diff --git a/lib/services/coins/ethereum/ethereum_wallet.dart b/lib/services/coins/ethereum/ethereum_wallet.dart index 636c12c9c..5fffad83c 100644 --- a/lib/services/coins/ethereum/ethereum_wallet.dart +++ b/lib/services/coins/ethereum/ethereum_wallet.dart @@ -22,6 +22,7 @@ import 'package:stackwallet/services/mixins/wallet_db.dart'; import 'package:stackwallet/services/node_service.dart'; import 'package:stackwallet/services/notifications_api.dart'; import 'package:stackwallet/services/transaction_notification_tracker.dart'; +import 'package:stackwallet/utilities/amount.dart'; import 'package:stackwallet/utilities/assets.dart'; import 'package:stackwallet/utilities/constants.dart'; import 'package:stackwallet/utilities/default_nodes.dart'; @@ -881,6 +882,10 @@ class EthereumWallet extends CoinServiceAPI with WalletCache, WalletDB { isIncoming ? TransactionType.incoming : TransactionType.outgoing, subType: TransactionSubType.none, amount: transactionAmount, + amountString: Amount( + rawValue: BigInt.from(transactionAmount), + fractionDigits: coin.decimals, + ).toJsonString(), fee: txFee, height: height, isCancelled: txFailed, diff --git a/lib/services/coins/firo/firo_wallet.dart b/lib/services/coins/firo/firo_wallet.dart index 83d718fb0..6a65d9f18 100644 --- a/lib/services/coins/firo/firo_wallet.dart +++ b/lib/services/coins/firo/firo_wallet.dart @@ -32,6 +32,7 @@ import 'package:stackwallet/services/node_service.dart'; import 'package:stackwallet/services/notifications_api.dart'; import 'package:stackwallet/services/transaction_notification_tracker.dart'; import 'package:stackwallet/utilities/address_utils.dart'; +import 'package:stackwallet/utilities/amount.dart'; import 'package:stackwallet/utilities/assets.dart'; import 'package:stackwallet/utilities/bip32_utils.dart'; import 'package:stackwallet/utilities/constants.dart'; @@ -472,6 +473,10 @@ Future> staticProcessRestore( type: element.type, subType: isar_models.TransactionSubType.mint, amount: element.amount, + amountString: Amount( + rawValue: BigInt.from(element.amount), + fractionDigits: Coin.firo.decimals, + ).toJsonString(), fee: sharedFee, height: element.height, isCancelled: false, @@ -899,6 +904,10 @@ class FiroWallet extends CoinServiceAPI with WalletCache, WalletDB, FiroHive { type: isar_models.TransactionType.outgoing, subType: isar_models.TransactionSubType.none, amount: txData["recipientAmt"] as int, + amountString: Amount( + rawValue: BigInt.from(txData["recipientAmt"] as int), + fractionDigits: Coin.firo.decimals, + ).toJsonString(), fee: txData["fee"] as int, height: null, isCancelled: false, @@ -3072,6 +3081,11 @@ class FiroWallet extends CoinServiceAPI with WalletCache, WalletDB, FiroHive { } await firoUpdateLelantusCoins(coins); + final amount = Format.decimalAmountToSatoshis( + Decimal.parse(transactionInfo["amount"].toString()), + coin, + ); + // add the send transaction final transaction = isar_models.Transaction( walletId: walletId, @@ -3086,10 +3100,11 @@ class FiroWallet extends CoinServiceAPI with WalletCache, WalletDB, FiroHive { : transactionInfo["subType"] == "join" ? isar_models.TransactionSubType.join : isar_models.TransactionSubType.none, - amount: Format.decimalAmountToSatoshis( - Decimal.parse(transactionInfo["amount"].toString()), - coin, - ), + amount: amount, + amountString: Amount( + rawValue: BigInt.from(amount), + fractionDigits: Coin.firo.decimals, + ).toJsonString(), fee: Format.decimalAmountToSatoshis( Decimal.parse(transactionInfo["fees"].toString()), coin, @@ -3649,6 +3664,10 @@ class FiroWallet extends CoinServiceAPI with WalletCache, WalletDB, FiroHive { type: type, subType: subType, amount: amount, + amountString: Amount( + rawValue: BigInt.from(amount), + fractionDigits: Coin.firo.decimals, + ).toJsonString(), fee: fees, height: txObject["height"] as int? ?? 0, isCancelled: false, @@ -4969,6 +4988,11 @@ class FiroWallet extends CoinServiceAPI with WalletCache, WalletDB, FiroHive { tx["address"] = tx["vout"][sendIndex]["scriptPubKey"]["addresses"][0]; tx["fees"] = tx["vin"][0]["nFees"]; + final amount = Format.decimalAmountToSatoshis( + Decimal.parse(tx["amount"].toString()), + coin, + ); + final txn = isar_models.Transaction( walletId: walletId, txid: tx["txid"] as String, @@ -4976,10 +5000,11 @@ class FiroWallet extends CoinServiceAPI with WalletCache, WalletDB, FiroHive { (DateTime.now().millisecondsSinceEpoch ~/ 1000), type: isar_models.TransactionType.outgoing, subType: isar_models.TransactionSubType.join, - amount: Format.decimalAmountToSatoshis( - Decimal.parse(tx["amount"].toString()), - coin, - ), + amount: amount, + amountString: Amount( + rawValue: BigInt.from(amount), + fractionDigits: Coin.firo.decimals, + ).toJsonString(), fee: Format.decimalAmountToSatoshis( Decimal.parse(tx["fees"].toString()), coin, diff --git a/lib/services/coins/litecoin/litecoin_wallet.dart b/lib/services/coins/litecoin/litecoin_wallet.dart index 542c88b60..e5207b562 100644 --- a/lib/services/coins/litecoin/litecoin_wallet.dart +++ b/lib/services/coins/litecoin/litecoin_wallet.dart @@ -31,6 +31,7 @@ import 'package:stackwallet/services/mixins/wallet_db.dart'; import 'package:stackwallet/services/node_service.dart'; import 'package:stackwallet/services/notifications_api.dart'; import 'package:stackwallet/services/transaction_notification_tracker.dart'; +import 'package:stackwallet/utilities/amount.dart'; import 'package:stackwallet/utilities/assets.dart'; import 'package:stackwallet/utilities/bip32_utils.dart'; import 'package:stackwallet/utilities/constants.dart'; @@ -1242,6 +1243,10 @@ class LitecoinWallet extends CoinServiceAPI type: isar_models.TransactionType.outgoing, subType: isar_models.TransactionSubType.none, amount: txData["recipientAmt"] as int, + amountString: Amount( + rawValue: BigInt.from(txData["recipientAmt"] as int), + fractionDigits: coin.decimals, + ).toJsonString(), fee: txData["fee"] as int, height: null, isCancelled: false, diff --git a/lib/services/coins/monero/monero_wallet.dart b/lib/services/coins/monero/monero_wallet.dart index 11a0aacd2..c8362426c 100644 --- a/lib/services/coins/monero/monero_wallet.dart +++ b/lib/services/coins/monero/monero_wallet.dart @@ -38,6 +38,7 @@ import 'package:stackwallet/services/event_bus/global_event_bus.dart'; import 'package:stackwallet/services/mixins/wallet_cache.dart'; import 'package:stackwallet/services/mixins/wallet_db.dart'; import 'package:stackwallet/services/node_service.dart'; +import 'package:stackwallet/utilities/amount.dart'; import 'package:stackwallet/utilities/constants.dart'; import 'package:stackwallet/utilities/default_nodes.dart'; import 'package:stackwallet/utilities/enums/coin_enum.dart'; @@ -926,6 +927,10 @@ class MoneroWallet extends CoinServiceAPI with WalletCache, WalletDB { type: type, subType: isar_models.TransactionSubType.none, amount: tx.value.amount ?? 0, + amountString: Amount( + rawValue: BigInt.from(tx.value.amount ?? 0), + fractionDigits: coin.decimals, + ).toJsonString(), fee: tx.value.fee ?? 0, height: tx.value.height, isCancelled: false, diff --git a/lib/services/coins/namecoin/namecoin_wallet.dart b/lib/services/coins/namecoin/namecoin_wallet.dart index 400726329..17007da2c 100644 --- a/lib/services/coins/namecoin/namecoin_wallet.dart +++ b/lib/services/coins/namecoin/namecoin_wallet.dart @@ -31,6 +31,7 @@ import 'package:stackwallet/services/mixins/wallet_db.dart'; import 'package:stackwallet/services/node_service.dart'; import 'package:stackwallet/services/notifications_api.dart'; import 'package:stackwallet/services/transaction_notification_tracker.dart'; +import 'package:stackwallet/utilities/amount.dart'; import 'package:stackwallet/utilities/assets.dart'; import 'package:stackwallet/utilities/bip32_utils.dart'; import 'package:stackwallet/utilities/constants.dart'; @@ -1232,6 +1233,10 @@ class NamecoinWallet extends CoinServiceAPI type: isar_models.TransactionType.outgoing, subType: isar_models.TransactionSubType.none, amount: txData["recipientAmt"] as int, + amountString: Amount( + rawValue: BigInt.from(txData["recipientAmt"] as int), + fractionDigits: coin.decimals, + ).toJsonString(), fee: txData["fee"] as int, height: null, isCancelled: false, diff --git a/lib/services/coins/particl/particl_wallet.dart b/lib/services/coins/particl/particl_wallet.dart index 692ad7e62..4a467d119 100644 --- a/lib/services/coins/particl/particl_wallet.dart +++ b/lib/services/coins/particl/particl_wallet.dart @@ -44,6 +44,8 @@ import 'package:stackwallet/utilities/prefs.dart'; import 'package:tuple/tuple.dart'; import 'package:uuid/uuid.dart'; +import '../../../utilities/amount.dart'; + const int MINIMUM_CONFIRMATIONS = 1; const int DUST_LIMIT = 294; @@ -1160,6 +1162,10 @@ class ParticlWallet extends CoinServiceAPI type: isar_models.TransactionType.outgoing, subType: isar_models.TransactionSubType.none, amount: txData["recipientAmt"] as int, + amountString: Amount( + rawValue: BigInt.from(txData["recipientAmt"] as int), + fractionDigits: coin.decimals, + ).toJsonString(), fee: txData["fee"] as int, height: null, isCancelled: false, @@ -2351,6 +2357,10 @@ class ParticlWallet extends CoinServiceAPI type: type, subType: isar_models.TransactionSubType.none, amount: amount, + amountString: Amount( + rawValue: BigInt.from(amount), + fractionDigits: coin.decimals, + ).toJsonString(), fee: fee, height: txObject["height"] as int, inputs: inputs, diff --git a/lib/services/coins/wownero/wownero_wallet.dart b/lib/services/coins/wownero/wownero_wallet.dart index 7dec040e1..7eb5ee8b1 100644 --- a/lib/services/coins/wownero/wownero_wallet.dart +++ b/lib/services/coins/wownero/wownero_wallet.dart @@ -40,6 +40,7 @@ import 'package:stackwallet/services/event_bus/global_event_bus.dart'; import 'package:stackwallet/services/mixins/wallet_cache.dart'; import 'package:stackwallet/services/mixins/wallet_db.dart'; import 'package:stackwallet/services/node_service.dart'; +import 'package:stackwallet/utilities/amount.dart'; import 'package:stackwallet/utilities/constants.dart'; import 'package:stackwallet/utilities/default_nodes.dart'; import 'package:stackwallet/utilities/enums/coin_enum.dart'; @@ -204,8 +205,7 @@ class WowneroWallet extends CoinServiceAPI with WalletCache, WalletDB { try { aprox = (await prepareSend( // This address is only used for getting an approximate fee, never for sending - address: - "WW3iVcnoAY6K9zNdU4qmdvZELefx6xZz4PMpTwUifRkvMQckyadhSPYMVPJhBdYE8P9c27fg9RPmVaWNFx1cDaj61HnetqBiy", + address: "WW3iVcnoAY6K9zNdU4qmdvZELefx6xZz4PMpTwUifRkvMQckyadhSPYMVPJhBdYE8P9c27fg9RPmVaWNFx1cDaj61HnetqBiy", satoshiAmount: satoshiAmount, args: {"feeRate": feeRateType}))['fee']; await Future.delayed(const Duration(milliseconds: 500)); @@ -1006,6 +1006,10 @@ class WowneroWallet extends CoinServiceAPI with WalletCache, WalletDB { type: type, subType: isar_models.TransactionSubType.none, amount: tx.value.amount ?? 0, + amountString: Amount( + rawValue: BigInt.from(tx.value.amount ?? 0), + fractionDigits: coin.decimals, + ).toJsonString(), fee: tx.value.fee ?? 0, height: tx.value.height, isCancelled: false, diff --git a/lib/services/ethereum/ethereum_token_service.dart b/lib/services/ethereum/ethereum_token_service.dart index ad4f511ae..b2caa6cc6 100644 --- a/lib/services/ethereum/ethereum_token_service.dart +++ b/lib/services/ethereum/ethereum_token_service.dart @@ -21,6 +21,7 @@ import 'package:stackwallet/services/event_bus/global_event_bus.dart'; import 'package:stackwallet/services/mixins/eth_token_cache.dart'; import 'package:stackwallet/services/node_service.dart'; import 'package:stackwallet/services/transaction_notification_tracker.dart'; +import 'package:stackwallet/utilities/amount.dart'; import 'package:stackwallet/utilities/default_nodes.dart'; import 'package:stackwallet/utilities/enums/coin_enum.dart'; import 'package:stackwallet/utilities/enums/fee_rate_type_enum.dart'; @@ -436,6 +437,10 @@ class EthTokenWallet extends ChangeNotifier with EthTokenCache { type: isIncoming ? TransactionType.incoming : TransactionType.outgoing, subType: TransactionSubType.ethToken, amount: amount, + amountString: Amount( + rawValue: BigInt.from(amount), + fractionDigits: tokenContract.decimals, + ).toJsonString(), fee: tuple.item2.gasUsed * tuple.item2.gasPrice.toInt(), height: tuple.item1.blockNumber, isCancelled: false, diff --git a/lib/services/mixins/electrum_x_parsing.dart b/lib/services/mixins/electrum_x_parsing.dart index 440a1981a..5432ea496 100644 --- a/lib/services/mixins/electrum_x_parsing.dart +++ b/lib/services/mixins/electrum_x_parsing.dart @@ -4,6 +4,7 @@ import 'package:bip47/src/util.dart'; import 'package:decimal/decimal.dart'; import 'package:stackwallet/models/isar/models/isar_models.dart'; import 'package:stackwallet/services/mixins/paynym_wallet_interface.dart'; +import 'package:stackwallet/utilities/amount.dart'; import 'package:stackwallet/utilities/enums/coin_enum.dart'; import 'package:stackwallet/utilities/format.dart'; import 'package:tuple/tuple.dart'; @@ -220,6 +221,10 @@ mixin ElectrumXParsing { type: type, subType: txSubType, amount: amount, + amountString: Amount( + rawValue: BigInt.from(amount), + fractionDigits: coin.decimals, + ).toJsonString(), fee: fee, height: txData["height"] as int?, isCancelled: false, diff --git a/lib/utilities/db_version_migration.dart b/lib/utilities/db_version_migration.dart index 220525f73..569083205 100644 --- a/lib/utilities/db_version_migration.dart +++ b/lib/utilities/db_version_migration.dart @@ -12,6 +12,7 @@ import 'package:stackwallet/models/node_model.dart'; import 'package:stackwallet/services/mixins/wallet_db.dart'; import 'package:stackwallet/services/node_service.dart'; import 'package:stackwallet/services/wallets_service.dart'; +import 'package:stackwallet/utilities/amount.dart'; import 'package:stackwallet/utilities/constants.dart'; import 'package:stackwallet/utilities/default_nodes.dart'; import 'package:stackwallet/utilities/enums/coin_enum.dart'; @@ -327,6 +328,10 @@ class DbVersionMigrator with WalletDB { : isar_models.TransactionType.outgoing, subType: isar_models.TransactionSubType.none, amount: tx.amount, + amountString: Amount( + rawValue: BigInt.from(tx.amount), + fractionDigits: info.coin.decimals, + ).toJsonString(), fee: tx.fees, height: tx.height, isCancelled: tx.isCancelled,