From 5570206533a86eef0ea3280b29cf596c32cc21fd Mon Sep 17 00:00:00 2001 From: Michiel Post Date: Fri, 30 Aug 2024 12:09:15 +0200 Subject: [PATCH] Hide invalid tokens and atomic assets --- src/aoWebWallet/Pages/TransactionDetail.razor | 15 ++++++++++++++- src/aoWebWallet/Services/TokenDataService.cs | 11 ++++++----- .../Shared/Components/TransactionComponent.razor | 15 +++++++++++++-- src/aoWebWallet/aoWebWallet.csproj | 4 ++-- src/aoww.ProcesModels/aoww.ProcesModels.csproj | 2 +- 5 files changed, 36 insertions(+), 11 deletions(-) diff --git a/src/aoWebWallet/Pages/TransactionDetail.razor b/src/aoWebWallet/Pages/TransactionDetail.razor index 68a9906..a20a6ed 100644 --- a/src/aoWebWallet/Pages/TransactionDetail.razor +++ b/src/aoWebWallet/Pages/TransactionDetail.razor @@ -29,7 +29,14 @@ - + @if (!string.IsNullOrWhiteSpace(tokenData?.Logo)) + { + + } + else if (tokenData?.TokenType == ArweaveAO.Models.Token.TokenType.AtomicAsset) + { + AA + } @if (transfer.BlockHeight.HasValue) @@ -41,6 +48,12 @@ unconfirmed } + @if (string.IsNullOrWhiteSpace(tokenData?.Logo)) + { +
+ Process: @transfer?.TokenId + } + @if (tokenData != null) { diff --git a/src/aoWebWallet/Services/TokenDataService.cs b/src/aoWebWallet/Services/TokenDataService.cs index 1cb5dea..b82c417 100644 --- a/src/aoWebWallet/Services/TokenDataService.cs +++ b/src/aoWebWallet/Services/TokenDataService.cs @@ -1,6 +1,7 @@  using aoWebWallet.Models; using aoWebWallet.Pages; +using aoww.Services.Models; using ArweaveAO; using ArweaveAO.Models.Token; using System.Collections.ObjectModel; @@ -42,16 +43,18 @@ public async Task TryAddTokenIds(List allTokenIds) return data; }, async data => { - if (data != null) + if (data != null && data.IsValidToken()) { await storageService.AddToken(tokenId, data, isUserAdded: false, null); await LoadTokenList(force: true); } + }); } + } public async Task LoadTokenAsync(string tokenId) @@ -75,9 +78,8 @@ public async Task LoadTokenAsync(string tokenId) return data; }); - if (data != null) + if (data != null && data.IsValidToken()) { - token.TokenData = data; var existing = TokenList.Where(x => x.TokenId.Equals(tokenId, StringComparison.OrdinalIgnoreCase)).Any(); @@ -86,7 +88,6 @@ public async Task LoadTokenAsync(string tokenId) await storageService.AddToken(tokenId, data, false, null); } - } return token; @@ -128,7 +129,7 @@ private async IAsyncEnumerable LoadTokenDataAsync() catch { } } - if (token.TokenData != null) + if (token.TokenData != null && token.TokenData.IsValidToken()) yield return token; } diff --git a/src/aoWebWallet/Shared/Components/TransactionComponent.razor b/src/aoWebWallet/Shared/Components/TransactionComponent.razor index 766be9b..5743d85 100644 --- a/src/aoWebWallet/Shared/Components/TransactionComponent.razor +++ b/src/aoWebWallet/Shared/Components/TransactionComponent.razor @@ -11,7 +11,14 @@ string txUrl = $"transaction/{transfer.Id}"; - + @if (!string.IsNullOrWhiteSpace(tokenData?.Logo)) + { + + } + else if(tokenData?.TokenType == ArweaveAO.Models.Token.TokenType.AtomicAsset) + { + AA + } @if (transfer.BlockHeight.HasValue) @@ -22,7 +29,11 @@ { unconfirmed } - @*@tokenData.Name*@ + @if (string.IsNullOrWhiteSpace(tokenData?.Logo)) + { +
+ Process: @transfer?.TokenId + } @tokenData?.Ticker txId: diff --git a/src/aoWebWallet/aoWebWallet.csproj b/src/aoWebWallet/aoWebWallet.csproj index cfb1d74..a9645d8 100644 --- a/src/aoWebWallet/aoWebWallet.csproj +++ b/src/aoWebWallet/aoWebWallet.csproj @@ -12,7 +12,7 @@ - + @@ -23,7 +23,7 @@ - + diff --git a/src/aoww.ProcesModels/aoww.ProcesModels.csproj b/src/aoww.ProcesModels/aoww.ProcesModels.csproj index 8405626..e5ca49a 100644 --- a/src/aoww.ProcesModels/aoww.ProcesModels.csproj +++ b/src/aoww.ProcesModels/aoww.ProcesModels.csproj @@ -8,7 +8,7 @@ - +