mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-22 11:39:22 +00: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:
parent
6c9de67599
commit
5c2735be42
9 changed files with 32 additions and 6 deletions
|
@ -23,7 +23,7 @@ abstract class WalletAddresses {
|
||||||
return _localAddress ?? address;
|
return _localAddress ?? address;
|
||||||
}
|
}
|
||||||
|
|
||||||
String? get primaryAddress => null;
|
String get primaryAddress;
|
||||||
|
|
||||||
String? _localAddress;
|
String? _localAddress;
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,9 @@ abstract class EVMChainWalletAddressesBase extends WalletAddresses with Store {
|
||||||
@observable
|
@observable
|
||||||
String address;
|
String address;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get primaryAddress => address;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> init() async {
|
Future<void> init() async {
|
||||||
address = walletInfo.address;
|
address = walletInfo.address;
|
||||||
|
|
|
@ -29,6 +29,9 @@ abstract class MoneroWalletAddressesBase extends WalletAddresses with Store {
|
||||||
@observable
|
@observable
|
||||||
String address;
|
String address;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get primaryAddress => getAddress(accountIndex: account?.id ?? 0, addressIndex: 0);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get latestAddress {
|
String get latestAddress {
|
||||||
var addressIndex = subaddress_list.numSubaddresses(account?.id??0) - 1;
|
var addressIndex = subaddress_list.numSubaddresses(account?.id??0) - 1;
|
||||||
|
|
|
@ -18,6 +18,9 @@ abstract class NanoWalletAddressesBase extends WalletAddresses with Store {
|
||||||
@observable
|
@observable
|
||||||
String address;
|
String address;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get primaryAddress => address;
|
||||||
|
|
||||||
@observable
|
@observable
|
||||||
NanoAccount? account;
|
NanoAccount? account;
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,9 @@ abstract class SolanaWalletAddressesBase extends WalletAddresses with Store {
|
||||||
@override
|
@override
|
||||||
String address;
|
String address;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get primaryAddress => address;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> init() async {
|
Future<void> init() async {
|
||||||
address = walletInfo.address;
|
address = walletInfo.address;
|
||||||
|
|
|
@ -17,6 +17,9 @@ abstract class TronWalletAddressesBase extends WalletAddresses with Store {
|
||||||
@observable
|
@observable
|
||||||
String address;
|
String address;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get primaryAddress => address;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> init() async {
|
Future<void> init() async {
|
||||||
address = walletInfo.address;
|
address = walletInfo.address;
|
||||||
|
|
|
@ -29,6 +29,9 @@ abstract class WowneroWalletAddressesBase extends WalletAddresses with Store {
|
||||||
@observable
|
@observable
|
||||||
String address;
|
String address;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get primaryAddress => getAddress(accountIndex: account?.id ?? 0, addressIndex: 0);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get latestAddress {
|
String get latestAddress {
|
||||||
var addressIndex = subaddress_list.numSubaddresses(account?.id??0) - 1;
|
var addressIndex = subaddress_list.numSubaddresses(account?.id??0) - 1;
|
||||||
|
|
|
@ -482,12 +482,18 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor
|
||||||
nano!.updateTransactions(wallet);
|
nano!.updateTransactions(wallet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (pendingTransaction!.id.isNotEmpty) {
|
if (pendingTransaction!.id.isNotEmpty) {
|
||||||
|
|
||||||
|
final descriptionKey = '${pendingTransaction!.id}_${wallet.walletAddresses.primaryAddress}';
|
||||||
_settingsStore.shouldSaveRecipientAddress
|
_settingsStore.shouldSaveRecipientAddress
|
||||||
? await transactionDescriptionBox.add(TransactionDescription(
|
? await transactionDescriptionBox.add(TransactionDescription(
|
||||||
id: pendingTransaction!.id, recipientAddress: address, transactionNote: note))
|
id: descriptionKey,
|
||||||
: await transactionDescriptionBox
|
recipientAddress: address,
|
||||||
.add(TransactionDescription(id: pendingTransaction!.id, transactionNote: note));
|
transactionNote: note))
|
||||||
|
: await transactionDescriptionBox.add(TransactionDescription(
|
||||||
|
id: descriptionKey,
|
||||||
|
transactionNote: note));
|
||||||
}
|
}
|
||||||
|
|
||||||
state = TransactionCommitted();
|
state = TransactionCommitted();
|
||||||
|
|
|
@ -110,9 +110,11 @@ abstract class TransactionDetailsViewModelBase with Store {
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
final descriptionKey = '${transactionInfo.txHash}_${wallet.walletAddresses.primaryAddress}';
|
||||||
|
|
||||||
final description = transactionDescriptionBox.values.firstWhere(
|
final description = transactionDescriptionBox.values.firstWhere(
|
||||||
(val) => val.id == transactionInfo.txHash,
|
(val) => val.id == descriptionKey || val.id == transactionInfo.txHash,
|
||||||
orElse: () => TransactionDescription(id: transactionInfo.txHash));
|
orElse: () => TransactionDescription(id: descriptionKey));
|
||||||
|
|
||||||
items.add(TextFieldListItem(
|
items.add(TextFieldListItem(
|
||||||
title: S.current.note_tap_to_change,
|
title: S.current.note_tap_to_change,
|
||||||
|
|
Loading…
Reference in a new issue