Skip to content
Snippets Groups Projects
Commit e960571c authored by vjrj's avatar vjrj
Browse files

Allow get txs from other non public keys

parent 57a0ea06
No related branches found
No related tags found
No related merge requests found
......@@ -116,17 +116,23 @@ class MultiWalletTransactionCubit
_emitState(key, newState);
}
List<Transaction> get transactions => currentWalletState().transactions;
List<Transaction> transactions(String? pubKey) =>
currentWalletState(pubKey).transactions;
TransactionState currentWalletState() => _getStateOfWallet(_defKey(null));
TransactionState currentWalletState(String? pubKey) =>
_getStateOfWallet(_defKey(pubKey));
double get balance => currentWalletState().balance;
double balance([String? pubKey]) => currentWalletState(pubKey).balance;
DateTime get lastChecked => currentWalletState().lastChecked;
// DateTime get lastChecked => currentWalletState().lastChecked;
Future<List<Transaction>> fetchTransactions(
NodeListCubit cubit, AppCubit appCubit,
{int retries = 5, int? pageSize, String? cursor, String? pubKey}) async {
{int retries = 5,
int? pageSize,
String? cursor,
String? pubKey,
bool isExternal = false}) async {
final bool isCurrentWallet = pubKey != null &&
(extractPublicKey(pubKey) ==
extractPublicKey(SharedPreferencesHelper().getPubKey()));
......@@ -180,6 +186,11 @@ class MultiWalletTransactionCubit
resetCurrentGvaNode(newState, cubit);
}
// Is external, forget notifications
if (isExternal) {
return currentModifiedState.transactions;
}
logger(
'Last received notification: ${currentModifiedState.latestReceivedNotification.toIso8601String()})}');
logger(
......@@ -427,4 +438,13 @@ class MultiWalletTransactionCubit
}
}
}
// Clear state of a pubkey (used after visiting a contact page profile)
void removeStateForKey(String pubKey) {
if (state.map.containsKey(pubKey)) {
state.map.remove(pubKey);
emit(MultiWalletTransactionState(
Map<String, TransactionState>.of(state.map)));
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment