add serialized amount string to transaction

This commit is contained in:
julian 2023-03-24 15:31:05 -06:00
parent 3ab605c065
commit b2b9accee1
15 changed files with 124 additions and 10 deletions

View file

@ -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/address.dart';
import 'package:stackwallet/models/isar/models/blockchain_data/input.dart'; import 'package:stackwallet/models/isar/models/blockchain_data/input.dart';
import 'package:stackwallet/models/isar/models/blockchain_data/output.dart'; import 'package:stackwallet/models/isar/models/blockchain_data/output.dart';
import 'package:stackwallet/utilities/amount.dart';
import 'package:tuple/tuple.dart'; import 'package:tuple/tuple.dart';
part 'transaction.g.dart'; part 'transaction.g.dart';
@ -18,6 +19,7 @@ class Transaction {
required this.type, required this.type,
required this.subType, required this.subType,
required this.amount, required this.amount,
required this.amountString,
required this.fee, required this.fee,
required this.height, required this.height,
required this.isCancelled, required this.isCancelled,
@ -35,6 +37,7 @@ class Transaction {
TransactionType? type, TransactionType? type,
TransactionSubType? subType, TransactionSubType? subType,
int? amount, int? amount,
String? amountString,
int? fee, int? fee,
int? height, int? height,
bool? isCancelled, bool? isCancelled,
@ -54,6 +57,7 @@ class Transaction {
type: type ?? this.type, type: type ?? this.type,
subType: subType ?? this.subType, subType: subType ?? this.subType,
amount: amount ?? this.amount, amount: amount ?? this.amount,
amountString: amountString ?? this.amountString,
fee: fee ?? this.fee, fee: fee ?? this.fee,
height: height ?? this.height, height: height ?? this.height,
isCancelled: isCancelled ?? this.isCancelled, isCancelled: isCancelled ?? this.isCancelled,
@ -86,6 +90,8 @@ class Transaction {
late final int amount; late final int amount;
late String? amountString;
late final int fee; late final int fee;
late final int? height; late final int? height;
@ -105,6 +111,13 @@ class Transaction {
@Backlink(to: "transactions") @Backlink(to: "transactions")
final address = IsarLink<Address>(); final address = IsarLink<Address>();
@ignore
Amount? _cachedAmount;
@ignore
Amount get realAmount =>
_cachedAmount ??= Amount.fromSerializedJsonString(amountString!);
int getConfirmations(int currentChainHeight) { int getConfirmations(int currentChainHeight) {
if (height == null || height! <= 0) return 0; if (height == null || height! <= 0) return 0;
return max(0, currentChainHeight - (height! - 1)); return max(0, currentChainHeight - (height! - 1));
@ -124,6 +137,7 @@ class Transaction {
"type: ${type.name}, " "type: ${type.name}, "
"subType: ${subType.name}, " "subType: ${subType.name}, "
"amount: $amount, " "amount: $amount, "
"amountString: $amountString, "
"fee: $fee, " "fee: $fee, "
"height: $height, " "height: $height, "
"isCancelled: $isCancelled, " "isCancelled: $isCancelled, "
@ -143,6 +157,7 @@ class Transaction {
"type": type.name, "type": type.name,
"subType": subType.name, "subType": subType.name,
"amount": amount, "amount": amount,
"amountString": amountString,
"fee": fee, "fee": fee,
"height": height, "height": height,
"isCancelled": isCancelled, "isCancelled": isCancelled,
@ -168,6 +183,7 @@ class Transaction {
type: TransactionType.values.byName(json["type"] as String), type: TransactionType.values.byName(json["type"] as String),
subType: TransactionSubType.values.byName(json["subType"] as String), subType: TransactionSubType.values.byName(json["subType"] as String),
amount: json["amount"] as int, amount: json["amount"] as int,
amountString: json["amountString"] as String,
fee: json["fee"] as int, fee: json["fee"] as int,
height: json["height"] as int?, height: json["height"] as int?,
isCancelled: json["isCancelled"] as bool, isCancelled: json["isCancelled"] as bool,

View file

@ -34,6 +34,7 @@ import 'package:stackwallet/services/node_service.dart';
import 'package:stackwallet/services/notifications_api.dart'; import 'package:stackwallet/services/notifications_api.dart';
import 'package:stackwallet/services/transaction_notification_tracker.dart'; import 'package:stackwallet/services/transaction_notification_tracker.dart';
import 'package:stackwallet/utilities/address_utils.dart'; import 'package:stackwallet/utilities/address_utils.dart';
import 'package:stackwallet/utilities/amount.dart';
import 'package:stackwallet/utilities/assets.dart'; import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/bip32_utils.dart'; import 'package:stackwallet/utilities/bip32_utils.dart';
import 'package:stackwallet/utilities/constants.dart'; import 'package:stackwallet/utilities/constants.dart';
@ -1335,6 +1336,10 @@ class BitcoinWallet extends CoinServiceAPI
type: isar_models.TransactionType.outgoing, type: isar_models.TransactionType.outgoing,
subType: isar_models.TransactionSubType.none, subType: isar_models.TransactionSubType.none,
amount: txData["recipientAmt"] as int, amount: txData["recipientAmt"] as int,
amountString: Amount(
rawValue: BigInt.from(txData["recipientAmt"] as int),
fractionDigits: coin.decimals,
).toJsonString(),
fee: txData["fee"] as int, fee: txData["fee"] as int,
height: null, height: null,
isCancelled: false, isCancelled: false,

View file

@ -31,6 +31,7 @@ import 'package:stackwallet/services/node_service.dart';
import 'package:stackwallet/services/notifications_api.dart'; import 'package:stackwallet/services/notifications_api.dart';
import 'package:stackwallet/services/transaction_notification_tracker.dart'; import 'package:stackwallet/services/transaction_notification_tracker.dart';
import 'package:stackwallet/utilities/address_utils.dart'; import 'package:stackwallet/utilities/address_utils.dart';
import 'package:stackwallet/utilities/amount.dart';
import 'package:stackwallet/utilities/assets.dart'; import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/bip32_utils.dart'; import 'package:stackwallet/utilities/bip32_utils.dart';
import 'package:stackwallet/utilities/constants.dart'; import 'package:stackwallet/utilities/constants.dart';
@ -1250,6 +1251,10 @@ class BitcoinCashWallet extends CoinServiceAPI
type: isar_models.TransactionType.outgoing, type: isar_models.TransactionType.outgoing,
subType: isar_models.TransactionSubType.none, subType: isar_models.TransactionSubType.none,
amount: txData["recipientAmt"] as int, amount: txData["recipientAmt"] as int,
amountString: Amount(
rawValue: BigInt.from(txData["recipientAmt"] as int),
fractionDigits: coin.decimals,
).toJsonString(),
fee: txData["fee"] as int, fee: txData["fee"] as int,
height: null, height: null,
isCancelled: false, isCancelled: false,
@ -2309,6 +2314,10 @@ class BitcoinCashWallet extends CoinServiceAPI
type: type, type: type,
subType: isar_models.TransactionSubType.none, subType: isar_models.TransactionSubType.none,
amount: amount, amount: amount,
amountString: Amount(
rawValue: BigInt.from(amount),
fractionDigits: coin.decimals,
).toJsonString(),
fee: fee, fee: fee,
height: txData["height"] as int?, height: txData["height"] as int?,
isCancelled: false, isCancelled: false,

View file

@ -33,6 +33,7 @@ import 'package:stackwallet/services/node_service.dart';
import 'package:stackwallet/services/notifications_api.dart'; import 'package:stackwallet/services/notifications_api.dart';
import 'package:stackwallet/services/transaction_notification_tracker.dart'; import 'package:stackwallet/services/transaction_notification_tracker.dart';
import 'package:stackwallet/utilities/address_utils.dart'; import 'package:stackwallet/utilities/address_utils.dart';
import 'package:stackwallet/utilities/amount.dart';
import 'package:stackwallet/utilities/assets.dart'; import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/bip32_utils.dart'; import 'package:stackwallet/utilities/bip32_utils.dart';
import 'package:stackwallet/utilities/constants.dart'; import 'package:stackwallet/utilities/constants.dart';
@ -1117,6 +1118,10 @@ class DogecoinWallet extends CoinServiceAPI
type: isar_models.TransactionType.outgoing, type: isar_models.TransactionType.outgoing,
subType: isar_models.TransactionSubType.none, subType: isar_models.TransactionSubType.none,
amount: txData["recipientAmt"] as int, amount: txData["recipientAmt"] as int,
amountString: Amount(
rawValue: BigInt.from(txData["recipientAmt"] as int),
fractionDigits: coin.decimals,
).toJsonString(),
fee: txData["fee"] as int, fee: txData["fee"] as int,
height: null, height: null,
isCancelled: false, isCancelled: false,

View file

@ -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_cache.dart';
import 'package:stackwallet/services/mixins/wallet_db.dart'; import 'package:stackwallet/services/mixins/wallet_db.dart';
import 'package:stackwallet/services/node_service.dart'; import 'package:stackwallet/services/node_service.dart';
import 'package:stackwallet/utilities/amount.dart';
import 'package:stackwallet/utilities/constants.dart'; import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/default_epicboxes.dart'; import 'package:stackwallet/utilities/default_epicboxes.dart';
import 'package:stackwallet/utilities/default_nodes.dart'; import 'package:stackwallet/utilities/default_nodes.dart';
@ -1688,6 +1689,10 @@ class EpicCashWallet extends CoinServiceAPI
: isar_models.TransactionType.outgoing, : isar_models.TransactionType.outgoing,
subType: isar_models.TransactionSubType.none, subType: isar_models.TransactionSubType.none,
amount: amt, amount: amt,
amountString: Amount(
rawValue: BigInt.from(amt),
fractionDigits: coin.decimals,
).toJsonString(),
fee: (tx["fee"] == null) ? 0 : int.parse(tx["fee"] as String), fee: (tx["fee"] == null) ? 0 : int.parse(tx["fee"] as String),
height: height, height: height,
isCancelled: tx["tx_type"] == "TxSentCancelled" || isCancelled: tx["tx_type"] == "TxSentCancelled" ||

View file

@ -22,6 +22,7 @@ import 'package:stackwallet/services/mixins/wallet_db.dart';
import 'package:stackwallet/services/node_service.dart'; import 'package:stackwallet/services/node_service.dart';
import 'package:stackwallet/services/notifications_api.dart'; import 'package:stackwallet/services/notifications_api.dart';
import 'package:stackwallet/services/transaction_notification_tracker.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/assets.dart';
import 'package:stackwallet/utilities/constants.dart'; import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/default_nodes.dart'; import 'package:stackwallet/utilities/default_nodes.dart';
@ -881,6 +882,10 @@ class EthereumWallet extends CoinServiceAPI with WalletCache, WalletDB {
isIncoming ? TransactionType.incoming : TransactionType.outgoing, isIncoming ? TransactionType.incoming : TransactionType.outgoing,
subType: TransactionSubType.none, subType: TransactionSubType.none,
amount: transactionAmount, amount: transactionAmount,
amountString: Amount(
rawValue: BigInt.from(transactionAmount),
fractionDigits: coin.decimals,
).toJsonString(),
fee: txFee, fee: txFee,
height: height, height: height,
isCancelled: txFailed, isCancelled: txFailed,

View file

@ -32,6 +32,7 @@ import 'package:stackwallet/services/node_service.dart';
import 'package:stackwallet/services/notifications_api.dart'; import 'package:stackwallet/services/notifications_api.dart';
import 'package:stackwallet/services/transaction_notification_tracker.dart'; import 'package:stackwallet/services/transaction_notification_tracker.dart';
import 'package:stackwallet/utilities/address_utils.dart'; import 'package:stackwallet/utilities/address_utils.dart';
import 'package:stackwallet/utilities/amount.dart';
import 'package:stackwallet/utilities/assets.dart'; import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/bip32_utils.dart'; import 'package:stackwallet/utilities/bip32_utils.dart';
import 'package:stackwallet/utilities/constants.dart'; import 'package:stackwallet/utilities/constants.dart';
@ -472,6 +473,10 @@ Future<Map<dynamic, dynamic>> staticProcessRestore(
type: element.type, type: element.type,
subType: isar_models.TransactionSubType.mint, subType: isar_models.TransactionSubType.mint,
amount: element.amount, amount: element.amount,
amountString: Amount(
rawValue: BigInt.from(element.amount),
fractionDigits: Coin.firo.decimals,
).toJsonString(),
fee: sharedFee, fee: sharedFee,
height: element.height, height: element.height,
isCancelled: false, isCancelled: false,
@ -899,6 +904,10 @@ class FiroWallet extends CoinServiceAPI with WalletCache, WalletDB, FiroHive {
type: isar_models.TransactionType.outgoing, type: isar_models.TransactionType.outgoing,
subType: isar_models.TransactionSubType.none, subType: isar_models.TransactionSubType.none,
amount: txData["recipientAmt"] as int, amount: txData["recipientAmt"] as int,
amountString: Amount(
rawValue: BigInt.from(txData["recipientAmt"] as int),
fractionDigits: Coin.firo.decimals,
).toJsonString(),
fee: txData["fee"] as int, fee: txData["fee"] as int,
height: null, height: null,
isCancelled: false, isCancelled: false,
@ -3072,6 +3081,11 @@ class FiroWallet extends CoinServiceAPI with WalletCache, WalletDB, FiroHive {
} }
await firoUpdateLelantusCoins(coins); await firoUpdateLelantusCoins(coins);
final amount = Format.decimalAmountToSatoshis(
Decimal.parse(transactionInfo["amount"].toString()),
coin,
);
// add the send transaction // add the send transaction
final transaction = isar_models.Transaction( final transaction = isar_models.Transaction(
walletId: walletId, walletId: walletId,
@ -3086,10 +3100,11 @@ class FiroWallet extends CoinServiceAPI with WalletCache, WalletDB, FiroHive {
: transactionInfo["subType"] == "join" : transactionInfo["subType"] == "join"
? isar_models.TransactionSubType.join ? isar_models.TransactionSubType.join
: isar_models.TransactionSubType.none, : isar_models.TransactionSubType.none,
amount: Format.decimalAmountToSatoshis( amount: amount,
Decimal.parse(transactionInfo["amount"].toString()), amountString: Amount(
coin, rawValue: BigInt.from(amount),
), fractionDigits: Coin.firo.decimals,
).toJsonString(),
fee: Format.decimalAmountToSatoshis( fee: Format.decimalAmountToSatoshis(
Decimal.parse(transactionInfo["fees"].toString()), Decimal.parse(transactionInfo["fees"].toString()),
coin, coin,
@ -3649,6 +3664,10 @@ class FiroWallet extends CoinServiceAPI with WalletCache, WalletDB, FiroHive {
type: type, type: type,
subType: subType, subType: subType,
amount: amount, amount: amount,
amountString: Amount(
rawValue: BigInt.from(amount),
fractionDigits: Coin.firo.decimals,
).toJsonString(),
fee: fees, fee: fees,
height: txObject["height"] as int? ?? 0, height: txObject["height"] as int? ?? 0,
isCancelled: false, isCancelled: false,
@ -4969,6 +4988,11 @@ class FiroWallet extends CoinServiceAPI with WalletCache, WalletDB, FiroHive {
tx["address"] = tx["vout"][sendIndex]["scriptPubKey"]["addresses"][0]; tx["address"] = tx["vout"][sendIndex]["scriptPubKey"]["addresses"][0];
tx["fees"] = tx["vin"][0]["nFees"]; tx["fees"] = tx["vin"][0]["nFees"];
final amount = Format.decimalAmountToSatoshis(
Decimal.parse(tx["amount"].toString()),
coin,
);
final txn = isar_models.Transaction( final txn = isar_models.Transaction(
walletId: walletId, walletId: walletId,
txid: tx["txid"] as String, txid: tx["txid"] as String,
@ -4976,10 +5000,11 @@ class FiroWallet extends CoinServiceAPI with WalletCache, WalletDB, FiroHive {
(DateTime.now().millisecondsSinceEpoch ~/ 1000), (DateTime.now().millisecondsSinceEpoch ~/ 1000),
type: isar_models.TransactionType.outgoing, type: isar_models.TransactionType.outgoing,
subType: isar_models.TransactionSubType.join, subType: isar_models.TransactionSubType.join,
amount: Format.decimalAmountToSatoshis( amount: amount,
Decimal.parse(tx["amount"].toString()), amountString: Amount(
coin, rawValue: BigInt.from(amount),
), fractionDigits: Coin.firo.decimals,
).toJsonString(),
fee: Format.decimalAmountToSatoshis( fee: Format.decimalAmountToSatoshis(
Decimal.parse(tx["fees"].toString()), Decimal.parse(tx["fees"].toString()),
coin, coin,

View file

@ -31,6 +31,7 @@ import 'package:stackwallet/services/mixins/wallet_db.dart';
import 'package:stackwallet/services/node_service.dart'; import 'package:stackwallet/services/node_service.dart';
import 'package:stackwallet/services/notifications_api.dart'; import 'package:stackwallet/services/notifications_api.dart';
import 'package:stackwallet/services/transaction_notification_tracker.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/assets.dart';
import 'package:stackwallet/utilities/bip32_utils.dart'; import 'package:stackwallet/utilities/bip32_utils.dart';
import 'package:stackwallet/utilities/constants.dart'; import 'package:stackwallet/utilities/constants.dart';
@ -1242,6 +1243,10 @@ class LitecoinWallet extends CoinServiceAPI
type: isar_models.TransactionType.outgoing, type: isar_models.TransactionType.outgoing,
subType: isar_models.TransactionSubType.none, subType: isar_models.TransactionSubType.none,
amount: txData["recipientAmt"] as int, amount: txData["recipientAmt"] as int,
amountString: Amount(
rawValue: BigInt.from(txData["recipientAmt"] as int),
fractionDigits: coin.decimals,
).toJsonString(),
fee: txData["fee"] as int, fee: txData["fee"] as int,
height: null, height: null,
isCancelled: false, isCancelled: false,

View file

@ -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_cache.dart';
import 'package:stackwallet/services/mixins/wallet_db.dart'; import 'package:stackwallet/services/mixins/wallet_db.dart';
import 'package:stackwallet/services/node_service.dart'; import 'package:stackwallet/services/node_service.dart';
import 'package:stackwallet/utilities/amount.dart';
import 'package:stackwallet/utilities/constants.dart'; import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/default_nodes.dart'; import 'package:stackwallet/utilities/default_nodes.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart'; import 'package:stackwallet/utilities/enums/coin_enum.dart';
@ -926,6 +927,10 @@ class MoneroWallet extends CoinServiceAPI with WalletCache, WalletDB {
type: type, type: type,
subType: isar_models.TransactionSubType.none, subType: isar_models.TransactionSubType.none,
amount: tx.value.amount ?? 0, amount: tx.value.amount ?? 0,
amountString: Amount(
rawValue: BigInt.from(tx.value.amount ?? 0),
fractionDigits: coin.decimals,
).toJsonString(),
fee: tx.value.fee ?? 0, fee: tx.value.fee ?? 0,
height: tx.value.height, height: tx.value.height,
isCancelled: false, isCancelled: false,

View file

@ -31,6 +31,7 @@ import 'package:stackwallet/services/mixins/wallet_db.dart';
import 'package:stackwallet/services/node_service.dart'; import 'package:stackwallet/services/node_service.dart';
import 'package:stackwallet/services/notifications_api.dart'; import 'package:stackwallet/services/notifications_api.dart';
import 'package:stackwallet/services/transaction_notification_tracker.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/assets.dart';
import 'package:stackwallet/utilities/bip32_utils.dart'; import 'package:stackwallet/utilities/bip32_utils.dart';
import 'package:stackwallet/utilities/constants.dart'; import 'package:stackwallet/utilities/constants.dart';
@ -1232,6 +1233,10 @@ class NamecoinWallet extends CoinServiceAPI
type: isar_models.TransactionType.outgoing, type: isar_models.TransactionType.outgoing,
subType: isar_models.TransactionSubType.none, subType: isar_models.TransactionSubType.none,
amount: txData["recipientAmt"] as int, amount: txData["recipientAmt"] as int,
amountString: Amount(
rawValue: BigInt.from(txData["recipientAmt"] as int),
fractionDigits: coin.decimals,
).toJsonString(),
fee: txData["fee"] as int, fee: txData["fee"] as int,
height: null, height: null,
isCancelled: false, isCancelled: false,

View file

@ -44,6 +44,8 @@ import 'package:stackwallet/utilities/prefs.dart';
import 'package:tuple/tuple.dart'; import 'package:tuple/tuple.dart';
import 'package:uuid/uuid.dart'; import 'package:uuid/uuid.dart';
import '../../../utilities/amount.dart';
const int MINIMUM_CONFIRMATIONS = 1; const int MINIMUM_CONFIRMATIONS = 1;
const int DUST_LIMIT = 294; const int DUST_LIMIT = 294;
@ -1160,6 +1162,10 @@ class ParticlWallet extends CoinServiceAPI
type: isar_models.TransactionType.outgoing, type: isar_models.TransactionType.outgoing,
subType: isar_models.TransactionSubType.none, subType: isar_models.TransactionSubType.none,
amount: txData["recipientAmt"] as int, amount: txData["recipientAmt"] as int,
amountString: Amount(
rawValue: BigInt.from(txData["recipientAmt"] as int),
fractionDigits: coin.decimals,
).toJsonString(),
fee: txData["fee"] as int, fee: txData["fee"] as int,
height: null, height: null,
isCancelled: false, isCancelled: false,
@ -2351,6 +2357,10 @@ class ParticlWallet extends CoinServiceAPI
type: type, type: type,
subType: isar_models.TransactionSubType.none, subType: isar_models.TransactionSubType.none,
amount: amount, amount: amount,
amountString: Amount(
rawValue: BigInt.from(amount),
fractionDigits: coin.decimals,
).toJsonString(),
fee: fee, fee: fee,
height: txObject["height"] as int, height: txObject["height"] as int,
inputs: inputs, inputs: inputs,

View file

@ -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_cache.dart';
import 'package:stackwallet/services/mixins/wallet_db.dart'; import 'package:stackwallet/services/mixins/wallet_db.dart';
import 'package:stackwallet/services/node_service.dart'; import 'package:stackwallet/services/node_service.dart';
import 'package:stackwallet/utilities/amount.dart';
import 'package:stackwallet/utilities/constants.dart'; import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/default_nodes.dart'; import 'package:stackwallet/utilities/default_nodes.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart'; import 'package:stackwallet/utilities/enums/coin_enum.dart';
@ -204,8 +205,7 @@ class WowneroWallet extends CoinServiceAPI with WalletCache, WalletDB {
try { try {
aprox = (await prepareSend( aprox = (await prepareSend(
// This address is only used for getting an approximate fee, never for sending // This address is only used for getting an approximate fee, never for sending
address: address: "WW3iVcnoAY6K9zNdU4qmdvZELefx6xZz4PMpTwUifRkvMQckyadhSPYMVPJhBdYE8P9c27fg9RPmVaWNFx1cDaj61HnetqBiy",
"WW3iVcnoAY6K9zNdU4qmdvZELefx6xZz4PMpTwUifRkvMQckyadhSPYMVPJhBdYE8P9c27fg9RPmVaWNFx1cDaj61HnetqBiy",
satoshiAmount: satoshiAmount, satoshiAmount: satoshiAmount,
args: {"feeRate": feeRateType}))['fee']; args: {"feeRate": feeRateType}))['fee'];
await Future.delayed(const Duration(milliseconds: 500)); await Future.delayed(const Duration(milliseconds: 500));
@ -1006,6 +1006,10 @@ class WowneroWallet extends CoinServiceAPI with WalletCache, WalletDB {
type: type, type: type,
subType: isar_models.TransactionSubType.none, subType: isar_models.TransactionSubType.none,
amount: tx.value.amount ?? 0, amount: tx.value.amount ?? 0,
amountString: Amount(
rawValue: BigInt.from(tx.value.amount ?? 0),
fractionDigits: coin.decimals,
).toJsonString(),
fee: tx.value.fee ?? 0, fee: tx.value.fee ?? 0,
height: tx.value.height, height: tx.value.height,
isCancelled: false, isCancelled: false,

View file

@ -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/mixins/eth_token_cache.dart';
import 'package:stackwallet/services/node_service.dart'; import 'package:stackwallet/services/node_service.dart';
import 'package:stackwallet/services/transaction_notification_tracker.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/default_nodes.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart'; import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/enums/fee_rate_type_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, type: isIncoming ? TransactionType.incoming : TransactionType.outgoing,
subType: TransactionSubType.ethToken, subType: TransactionSubType.ethToken,
amount: amount, amount: amount,
amountString: Amount(
rawValue: BigInt.from(amount),
fractionDigits: tokenContract.decimals,
).toJsonString(),
fee: tuple.item2.gasUsed * tuple.item2.gasPrice.toInt(), fee: tuple.item2.gasUsed * tuple.item2.gasPrice.toInt(),
height: tuple.item1.blockNumber, height: tuple.item1.blockNumber,
isCancelled: false, isCancelled: false,

View file

@ -4,6 +4,7 @@ import 'package:bip47/src/util.dart';
import 'package:decimal/decimal.dart'; import 'package:decimal/decimal.dart';
import 'package:stackwallet/models/isar/models/isar_models.dart'; import 'package:stackwallet/models/isar/models/isar_models.dart';
import 'package:stackwallet/services/mixins/paynym_wallet_interface.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/enums/coin_enum.dart';
import 'package:stackwallet/utilities/format.dart'; import 'package:stackwallet/utilities/format.dart';
import 'package:tuple/tuple.dart'; import 'package:tuple/tuple.dart';
@ -220,6 +221,10 @@ mixin ElectrumXParsing {
type: type, type: type,
subType: txSubType, subType: txSubType,
amount: amount, amount: amount,
amountString: Amount(
rawValue: BigInt.from(amount),
fractionDigits: coin.decimals,
).toJsonString(),
fee: fee, fee: fee,
height: txData["height"] as int?, height: txData["height"] as int?,
isCancelled: false, isCancelled: false,

View file

@ -12,6 +12,7 @@ import 'package:stackwallet/models/node_model.dart';
import 'package:stackwallet/services/mixins/wallet_db.dart'; import 'package:stackwallet/services/mixins/wallet_db.dart';
import 'package:stackwallet/services/node_service.dart'; import 'package:stackwallet/services/node_service.dart';
import 'package:stackwallet/services/wallets_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/constants.dart';
import 'package:stackwallet/utilities/default_nodes.dart'; import 'package:stackwallet/utilities/default_nodes.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart'; import 'package:stackwallet/utilities/enums/coin_enum.dart';
@ -327,6 +328,10 @@ class DbVersionMigrator with WalletDB {
: isar_models.TransactionType.outgoing, : isar_models.TransactionType.outgoing,
subType: isar_models.TransactionSubType.none, subType: isar_models.TransactionSubType.none,
amount: tx.amount, amount: tx.amount,
amountString: Amount(
rawValue: BigInt.from(tx.amount),
fractionDigits: info.coin.decimals,
).toJsonString(),
fee: tx.fees, fee: tx.fees,
height: tx.height, height: tx.height,
isCancelled: tx.isCancelled, isCancelled: tx.isCancelled,