Skip to content

Commit

Permalink
Hide invalid tokens and atomic assets
Browse files Browse the repository at this point in the history
  • Loading branch information
michielpost committed Aug 30, 2024
1 parent 5012e01 commit 5570206
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 11 deletions.
15 changes: 14 additions & 1 deletion src/aoWebWallet/Pages/TransactionDetail.razor
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,14 @@
<MudTimeline TimelinePosition="TimelinePosition.Left">
<MudTimelineItem>
<ItemDot>
<MudAvatar Size="Size.Medium" title="@tokenData?.TokenId"><MudImage Src="@UrlHelper.GetArweaveUrl(tokenData?.Logo)" /></MudAvatar>
@if (!string.IsNullOrWhiteSpace(tokenData?.Logo))
{
<MudAvatar Size="Size.Medium" title="@tokenData?.TokenId"><MudImage Src="@UrlHelper.GetArweaveUrl(tokenData?.Logo)" /></MudAvatar>
}
else if (tokenData?.TokenType == ArweaveAO.Models.Token.TokenType.AtomicAsset)
{
<MudAvatar Size="Size.Medium" title="@tokenData?.TokenId" Color="Color.Info" Variant="Variant.Outlined">AA</MudAvatar>
}
</ItemDot>
<ItemContent>
@if (transfer.BlockHeight.HasValue)
Expand All @@ -41,6 +48,12 @@
<MudText Typo="Typo.caption">unconfirmed</MudText>
}

@if (string.IsNullOrWhiteSpace(tokenData?.Logo))
{
<br />
<MudText Typo="Typo.caption">Process: @transfer?.TokenId</MudText>
}

@if (tokenData != null)
{
<MudStack Justify="Justify.Center" Spacing="0">
Expand Down
11 changes: 6 additions & 5 deletions src/aoWebWallet/Services/TokenDataService.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

using aoWebWallet.Models;
using aoWebWallet.Pages;
using aoww.Services.Models;
using ArweaveAO;
using ArweaveAO.Models.Token;
using System.Collections.ObjectModel;
Expand Down Expand Up @@ -42,16 +43,18 @@ public async Task TryAddTokenIds(List<string> 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<Token> LoadTokenAsync(string tokenId)
Expand All @@ -75,9 +78,8 @@ public async Task<Token> 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();
Expand All @@ -86,7 +88,6 @@ public async Task<Token> LoadTokenAsync(string tokenId)

await storageService.AddToken(tokenId, data, false, null);
}

}

return token;
Expand Down Expand Up @@ -128,7 +129,7 @@ private async IAsyncEnumerable<Token> LoadTokenDataAsync()
catch { }
}

if (token.TokenData != null)
if (token.TokenData != null && token.TokenData.IsValidToken())
yield return token;
}

Expand Down
15 changes: 13 additions & 2 deletions src/aoWebWallet/Shared/Components/TransactionComponent.razor
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,14 @@
string txUrl = $"transaction/{transfer.Id}";
<MudTimelineItem>
<ItemDot>
<MudAvatar Size="Size.Medium" title="@tokenData?.TokenId"><MudImage Src="@UrlHelper.GetArweaveUrl(tokenData?.Logo)" /></MudAvatar>
@if (!string.IsNullOrWhiteSpace(tokenData?.Logo))
{
<MudAvatar Size="Size.Medium" title="@tokenData?.TokenId"><MudImage Src="@UrlHelper.GetArweaveUrl(tokenData?.Logo)" /></MudAvatar>
}
else if(tokenData?.TokenType == ArweaveAO.Models.Token.TokenType.AtomicAsset)
{
<MudAvatar Size="Size.Medium" title="@tokenData?.TokenId" Color="Color.Info" Variant="Variant.Outlined">AA</MudAvatar>
}
</ItemDot>
<ItemContent>
@if (transfer.BlockHeight.HasValue)
Expand All @@ -22,7 +29,11 @@
{
<MudText Typo="Typo.caption">unconfirmed</MudText>
}
@*<MudText Typo="Typo.body1">@tokenData.Name</MudText>*@
@if (string.IsNullOrWhiteSpace(tokenData?.Logo))
{
<br />
<MudText Typo="Typo.caption">Process: @transfer?.TokenId</MudText>
}
<MudText style="font-weight:500;" Typo="Typo.body2">@tokenData?.Ticker</MudText>
<MudStack Row=true>
<MudText>txId: </MudText>
Expand Down
4 changes: 2 additions & 2 deletions src/aoWebWallet/aoWebWallet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="ArweaveAO" Version="0.0.7" />
<PackageReference Include="ArweaveAO" Version="0.0.8" />
<PackageReference Include="ArweaveBlazor" Version="0.0.10" />
<PackageReference Include="ClipLazor" Version="2.1.1" />
<PackageReference Include="CodeBeam.MudBlazor.Extensions" Version="7.0.1" />
Expand All @@ -23,7 +23,7 @@
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.8" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.8" PrivateAssets="all" />
<PackageReference Include="ReactorBlazorQRCodeScanner" Version="1.0.7" />
<PackageReference Include="Soenneker.Blazor.Utils.Navigation" Version="2.1.295" />
<PackageReference Include="Soenneker.Blazor.Utils.Navigation" Version="2.1.296" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/aoww.ProcesModels/aoww.ProcesModels.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="ArweaveAO" Version="0.0.7" />
<PackageReference Include="ArweaveAO" Version="0.0.8" />
</ItemGroup>

</Project>

0 comments on commit 5570206

Please sign in to comment.