mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-17 05:41:29 +02:00
transaction description key id address (#1755)
* transaction description key id+address * minor fix[skip ci] * fix backward compatibility * add monero primary address
This commit is contained in:
@@ -23,7 +23,7 @@ abstract class WalletAddresses {
|
||||
return _localAddress ?? address;
|
||||
}
|
||||
|
||||
String? get primaryAddress => null;
|
||||
String get primaryAddress;
|
||||
|
||||
String? _localAddress;
|
||||
|
||||
|
||||
@@ -17,6 +17,9 @@ abstract class EVMChainWalletAddressesBase extends WalletAddresses with Store {
|
||||
@observable
|
||||
String address;
|
||||
|
||||
@override
|
||||
String get primaryAddress => address;
|
||||
|
||||
@override
|
||||
Future<void> init() async {
|
||||
address = walletInfo.address;
|
||||
|
||||
@@ -29,6 +29,9 @@ abstract class MoneroWalletAddressesBase extends WalletAddresses with Store {
|
||||
@observable
|
||||
String address;
|
||||
|
||||
@override
|
||||
String get primaryAddress => getAddress(accountIndex: account?.id ?? 0, addressIndex: 0);
|
||||
|
||||
@override
|
||||
String get latestAddress {
|
||||
var addressIndex = subaddress_list.numSubaddresses(account?.id??0) - 1;
|
||||
|
||||
@@ -18,6 +18,9 @@ abstract class NanoWalletAddressesBase extends WalletAddresses with Store {
|
||||
@observable
|
||||
String address;
|
||||
|
||||
@override
|
||||
String get primaryAddress => address;
|
||||
|
||||
@observable
|
||||
NanoAccount? account;
|
||||
|
||||
|
||||
@@ -14,6 +14,9 @@ abstract class SolanaWalletAddressesBase extends WalletAddresses with Store {
|
||||
@override
|
||||
String address;
|
||||
|
||||
@override
|
||||
String get primaryAddress => address;
|
||||
|
||||
@override
|
||||
Future<void> init() async {
|
||||
address = walletInfo.address;
|
||||
|
||||
@@ -17,6 +17,9 @@ abstract class TronWalletAddressesBase extends WalletAddresses with Store {
|
||||
@observable
|
||||
String address;
|
||||
|
||||
@override
|
||||
String get primaryAddress => address;
|
||||
|
||||
@override
|
||||
Future<void> init() async {
|
||||
address = walletInfo.address;
|
||||
|
||||
@@ -29,6 +29,9 @@ abstract class WowneroWalletAddressesBase extends WalletAddresses with Store {
|
||||
@observable
|
||||
String address;
|
||||
|
||||
@override
|
||||
String get primaryAddress => getAddress(accountIndex: account?.id ?? 0, addressIndex: 0);
|
||||
|
||||
@override
|
||||
String get latestAddress {
|
||||
var addressIndex = subaddress_list.numSubaddresses(account?.id??0) - 1;
|
||||
|
||||
@@ -482,12 +482,18 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor
|
||||
nano!.updateTransactions(wallet);
|
||||
}
|
||||
|
||||
|
||||
if (pendingTransaction!.id.isNotEmpty) {
|
||||
|
||||
final descriptionKey = '${pendingTransaction!.id}_${wallet.walletAddresses.primaryAddress}';
|
||||
_settingsStore.shouldSaveRecipientAddress
|
||||
? await transactionDescriptionBox.add(TransactionDescription(
|
||||
id: pendingTransaction!.id, recipientAddress: address, transactionNote: note))
|
||||
: await transactionDescriptionBox
|
||||
.add(TransactionDescription(id: pendingTransaction!.id, transactionNote: note));
|
||||
id: descriptionKey,
|
||||
recipientAddress: address,
|
||||
transactionNote: note))
|
||||
: await transactionDescriptionBox.add(TransactionDescription(
|
||||
id: descriptionKey,
|
||||
transactionNote: note));
|
||||
}
|
||||
|
||||
state = TransactionCommitted();
|
||||
|
||||
@@ -110,9 +110,11 @@ abstract class TransactionDetailsViewModelBase with Store {
|
||||
} catch (e) {}
|
||||
}));
|
||||
|
||||
final descriptionKey = '${transactionInfo.txHash}_${wallet.walletAddresses.primaryAddress}';
|
||||
|
||||
final description = transactionDescriptionBox.values.firstWhere(
|
||||
(val) => val.id == transactionInfo.txHash,
|
||||
orElse: () => TransactionDescription(id: transactionInfo.txHash));
|
||||
(val) => val.id == descriptionKey || val.id == transactionInfo.txHash,
|
||||
orElse: () => TransactionDescription(id: descriptionKey));
|
||||
|
||||
items.add(TextFieldListItem(
|
||||
title: S.current.note_tap_to_change,
|
||||
|
||||
Reference in New Issue
Block a user