Skip to content

Commit

Permalink
fix: 🐛 Fix navigation to home page
Browse files Browse the repository at this point in the history
  • Loading branch information
redDwarf03 committed Jul 11, 2024
1 parent 39bcb8f commit f55440a
Showing 1 changed file with 39 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,39 +99,47 @@ class _TransferConfirmSheetState extends ConsumerState<TransferConfirmSheet>
duration: const Duration(milliseconds: 5000),
icon: Symbols.info,
);
final transfer = ref.read(TransferFormProvider.transferForm);
if (transfer.transferType == TransferType.nft) {
final transactionMap = await sl
.get<ApiService>()
.getLastTransaction([event.transactionAddress!]);
final transaction = transactionMap[event.transactionAddress!];
final tokenMap = await sl.get<AppService>().getToken(
[
transaction!.data!.ledger!.token!.transfers[0].tokenAddress!,
],
);

final selectedAccount = await ref.read(
AccountProviders.selectedAccount.future,
);

await selectedAccount!.removeftInfosOffChain(
tokenMap[transaction.data!.ledger!.token!.transfers[0].tokenAddress!]!
.id,
); // TODO(reddwarf03): we should not interact directly with data source. Use Providers instead. (3)

await ref.read(AccountProviders.selectedAccount.notifier).refreshNFTs();
}
try {
final transfer = ref.read(TransferFormProvider.transferForm);
if (transfer.transferType == TransferType.nft) {
final transactionMap = await sl
.get<ApiService>()
.getLastTransaction([event.transactionAddress!]);
final transaction = transactionMap[event.transactionAddress!];
final tokenMap = await sl.get<AppService>().getToken(
[
transaction!.data!.ledger!.token!.transfers[0].tokenAddress!,
],
);

final selectedAccount = await ref.read(
AccountProviders.selectedAccount.future,
);

await selectedAccount!.removeftInfosOffChain(
tokenMap[transaction.data!.ledger!.token!.transfers[0].tokenAddress!]!
.id,
); // TODO(reddwarf03): we should not interact directly with data source. Use Providers instead. (3)

unawaited(
ref.read(AccountProviders.selectedAccount.notifier).refreshNFTs(),
);
}

await ref
.read(AccountProviders.selectedAccount.notifier)
.refreshRecentTransactions();
if (transfer.transferType == TransferType.token) {
await ref
.read(AccountProviders.selectedAccount.notifier)
.refreshFungibleTokens();
}
if (mounted) {
unawaited(
ref
.read(AccountProviders.selectedAccount.notifier)
.refreshRecentTransactions(),
);
if (transfer.transferType == TransferType.token) {
unawaited(
ref
.read(AccountProviders.selectedAccount.notifier)
.refreshFungibleTokens(),
);
}
} finally {
context.go(HomePage.routerPage);
}
}
Expand Down

0 comments on commit f55440a

Please sign in to comment.