Skip to content

Commit

Permalink
Merge pull request #5 from michielpost/feature/milestone-01
Browse files Browse the repository at this point in the history
[WIP] Milestone 01
  • Loading branch information
michielpost authored May 15, 2024
2 parents 94b0c35 + 538d70e commit eec5ade
Show file tree
Hide file tree
Showing 78 changed files with 3,775 additions and 1,356 deletions.
39 changes: 39 additions & 0 deletions src/aoWebWallet.Tests/StorageServiceTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using aoWebWallet.Models;
using aoWebWallet.Services;
using ArweaveAO;
using ArweaveAO.Models;
using Microsoft.Extensions.Options;

namespace aoWebWallet.Tests
{
[TestClass]
public class StorageServiceTests
{
[TestMethod]
public async Task TestBuildInTokenData()
{
List<Token> result = new();

StorageService.AddSystemTokens(result);

TokenClient tokenClient = new TokenClient(Options.Create(new ArweaveConfig()), new HttpClient());

foreach(var token in result)
{
//Get live data
var data = await tokenClient.GetTokenMetaData(token.TokenId);

Assert.IsNotNull(token.TokenData);
Assert.IsNotNull(data);

Assert.AreEqual(token.TokenId, data.TokenId);
Assert.AreEqual(token.TokenData.TokenId, data.TokenId);
Assert.AreEqual(token.TokenData.Name, data.Name);
Assert.AreEqual(token.TokenData.Ticker, data.Ticker);
Assert.AreEqual(token.TokenData.Denomination, data.Denomination);
Assert.AreEqual(token.TokenData.Logo, data.Logo);

}
}
}
}
30 changes: 30 additions & 0 deletions src/aoWebWallet.Tests/aoWebWallet.Tests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.3.1" />
<PackageReference Include="MSTest.TestFramework" Version="3.3.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\aoWebWallet\aoWebWallet.csproj" />
</ItemGroup>

<ItemGroup>
<Using Include="Microsoft.VisualStudio.TestTools.UnitTesting" />
</ItemGroup>

</Project>
12 changes: 10 additions & 2 deletions src/aoWebWallet.sln
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Libs", "Libs", "{06E5BC39-7
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "webvNext.DataLoader", "webvNext.DataLoader\webvNext.DataLoader.csproj", "{17CA4374-64D0-4618-852F-8A76D0A57166}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "aoww.Services", "aoww.Services\aoww.Services.csproj", "{178C3213-D574-4B39-A2DA-1FB1D2806242}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "aoww.Services", "aoww.Services\aoww.Services.csproj", "{178C3213-D574-4B39-A2DA-1FB1D2806242}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{89AC47DF-65AD-4870-AA1D-74ABF1F3D8FE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "aoww.Services.Tests", "aoww.Services.Tests\aoww.Services.Tests.csproj", "{322F4807-05CF-431D-B400-7420E1B29936}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "aoww.Services.Tests", "aoww.Services.Tests\aoww.Services.Tests.csproj", "{322F4807-05CF-431D-B400-7420E1B29936}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "aoWebWallet.Tests", "aoWebWallet.Tests\aoWebWallet.Tests.csproj", "{12E9E40E-96D1-4501-A9A4-EBE4D4F43D8D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -37,13 +39,19 @@ Global
{322F4807-05CF-431D-B400-7420E1B29936}.Debug|Any CPU.Build.0 = Debug|Any CPU
{322F4807-05CF-431D-B400-7420E1B29936}.Release|Any CPU.ActiveCfg = Release|Any CPU
{322F4807-05CF-431D-B400-7420E1B29936}.Release|Any CPU.Build.0 = Release|Any CPU
{12E9E40E-96D1-4501-A9A4-EBE4D4F43D8D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{12E9E40E-96D1-4501-A9A4-EBE4D4F43D8D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{12E9E40E-96D1-4501-A9A4-EBE4D4F43D8D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{12E9E40E-96D1-4501-A9A4-EBE4D4F43D8D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{17CA4374-64D0-4618-852F-8A76D0A57166} = {06E5BC39-764A-48B9-B4F9-F48387A2C965}
{178C3213-D574-4B39-A2DA-1FB1D2806242} = {06E5BC39-764A-48B9-B4F9-F48387A2C965}
{322F4807-05CF-431D-B400-7420E1B29936} = {89AC47DF-65AD-4870-AA1D-74ABF1F3D8FE}
{12E9E40E-96D1-4501-A9A4-EBE4D4F43D8D} = {89AC47DF-65AD-4870-AA1D-74ABF1F3D8FE}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {432E3F8E-53FF-4D9C-869D-48449BD3B8B4}
Expand Down
17 changes: 17 additions & 0 deletions src/aoWebWallet/Extensions/WalletExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using aoWebWallet.Models;

namespace aoWebWallet.Extensions
{
public static class WalletExtensions
{
public static string ToAutocompleteDisplay(this Wallet wallet)
{
if (string.IsNullOrWhiteSpace(wallet.Name))
{
return wallet.Address;
}

return $"{wallet.Name} ({wallet.Address})";
}
}
}
18 changes: 10 additions & 8 deletions src/aoWebWallet/Layout/MainLayout.razor
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
string? versionHash = Program.GetVersionHash();
}

<MudThemeProvider IsDarkMode="MainViewModel.IsDarkMode" />
<MudThemeProvider IsDarkMode="true" />
<MudDialogProvider CloseButton="true" CloseOnEscapeKey="true"/>
<MudSnackbarProvider />

<MudLayout Class="d-flex flex-column d-min-h-vh-100">
<MudAppBar Elevation="1">
<MudLink Href="">
<MudImage title="aoWebWallet" Src="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyBpZD0iTGF5ZXJfMiIgZGF0YS1uYW1lPSJMYXllciAyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMzExLjU4IDI0MC45MiI+CiAgPGRlZnM+CiAgICA8c3R5bGU+CiAgICAgIC5jbHMtMSB7CiAgICAgICAgZmlsbDogI2ZmZjsKICAgICAgICBmaWxsLXJ1bGU6IGV2ZW5vZGQ7CiAgICAgIH0KICAgIDwvc3R5bGU+CiAgPC9kZWZzPgogIDxnIGlkPSJMYXllcl8xLTIiIGRhdGEtbmFtZT0iTGF5ZXIgMSI+CiAgICA8Zz4KICAgICAgPHBvbHlnb24gY2xhc3M9ImNscy0xIiBwb2ludHM9IjAgMjQwLjQ1IDgwLjIgMjQwLjQ1IDk2LjU3IDE5Ni4xOSA1OS43NCAxMjAuNzkgMCAyNDAuNDUiLz4KICAgICAgPHBvbHlnb24gY2xhc3M9ImNscy0xIiBwb2ludHM9IjEyMy41NyAxLjEyIDk2LjU3IDYyLjYgMTgwLjg2IDI0MC40NSAyNDEuNTggMjQwLjQ1IDIxMi43NyAxODAuNjIgMTIzLjU3IDEuMTIiLz4KICAgICAgPHBvbHlnb24gY2xhc3M9ImNscy0xIiBwb2ludHM9Ijc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yMC4yM3M1My44MywxMjAuMjMsMTIwLjIzLDEyMC4yMywxMjAuMjMtNTMuODMsMTIwLjIzLTEyMC4yM1M0MjguMiwwLDM2MS44LDBabTAsMTkzLjI2Yy00MC4zNCwwLTczLjAzLTMyLjctNzMuMDMtNzMuMDNzMzIuNy03My4wMyw3My4wMy03My4wMyw3My4wMywzMi43LDczLjAzLDczLjAzLTMyLjcsNzMuMDMtNzMuMDMsNzMuMDNaIi8+CiAgICA8L2c+CiAgPC9nPgo8L3N2Zz4="
Width="88" Class="pt-2" Alt="AOWW"/>
Width="100" Class="pt-2" Alt="AOWW"/>
</MudLink>
<MudSpacer />
<MudIconButton title="menu" Icon="@Icons.Material.Filled.Workspaces" Color="MudBlazor.Color.Inherit" Edge="MudBlazor.Edge.Start" OnClick="@((e) => DrawerToggle())" />
Expand All @@ -27,20 +27,22 @@
<MudMainContent>
@Body
</MudMainContent>
<div Class="mt-auto">
<div Class="mt-auto mb-4">
<!-- Footer content -->
<MudDivider DividerType="DividerType.FullWidth" Class="mt-6 mb-2"/>
<MudLink Href="https://twitter.com/aoWebWallet" target="_blank" Class="d-flex justify-center mb-2">
<svg fill="#949498" width="25px" viewBox="0 0 24 24" aria-hidden="true"><g><path d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"></path></g></svg>
</MudLink>
<div style="display:flex; flex-direction: column; justify-content:center; padding:3px 0 10px 0; margin-top:20px; align-items: center; width:100%">
<MudDivider DividerType="DividerType.FullWidth" Class="mb-8" />
<MudImage style="opacity: 0.55" Src="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyBpZD0iTGF5ZXJfMiIgZGF0YS1uYW1lPSJMYXllciAyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZp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M9ImNscy0xIiBwb2ludHM9IjEyMzEuMzggMi41OSAxMjE1LjAxIDQ2Ljg1IDEyNTEuODQgMTIyLjI2IDEzMTEuNTggMi41OSAxMjMxLjM4IDIuNTkiLz4KICAgICAgPHBvbHlnb24gY2xhc3M9ImNscy0xIiBwb2ludHM9IjkwMiAxLjEyIDkzMC44IDYwLjk2IDEwMjAgMjQwLjQ1IDEwNDcuMDEgMTc4Ljk4IDk2Mi43MiAxLjEyIDkwMiAxLjEyIi8+CiAgICAgIDxwb2x5Z29uIGNsYXNzPSJjbHMtMSIgcG9pbnRzPSIxMTQzLjM0IDEuNTkgMTE0My41OCAxLjEyIDEwNjMuMzggMS4xMiAxMDQ3LjAxIDQ1LjM4IDEwODMuODQgMTIwLjc5IDExMTIuNjQgNjMuMSAxMjAxIDI0MC45MiAxMjI4LjAxIDE3OS40NSAxMTQzLjcyIDEuNTkgMTE0My4zNCAxLjU5Ii8+CiAgICAgIDxwYXRoIGNsYXNzPSJjbHMtMSIgZD0ibTM2MS44LDBjLTY2LjQsMC0xMjAuMjMsNTMuODMtMTIwLjIzLDEyMC4yM3M1My44MywxMjAuMjMsMTIwLjIzLDEyMC4yMywxMjAuMjMtNTMuODMsMTIwLjIzLTEyMC4yM1M0MjguMiwwLDM2MS44LDBabTAsMTkzLjI2Yy00MC4zNCwwLTczLjAzLTMyLjctNzMuMDMtNzMuMDNzMzIuNy03My4wMyw3My4wMy03My4wMyw3My4wMywzMi43LDczLjAzLDczLjAzLTMyLjcsNzMuMDMtNzMuMDMsNzMuMDNaIi8+CiAgICA8L2c+CiAgPC9nPgo8L3N2Zz4="
Width="66" Class="pt-0" Alt="AOWW Logotype" />
</div>
<MudText Typo="Typo.caption" Class="d-flex justify-center KodeMono">
Version: @Program.GetVersionWithoutHash()
@if (!string.IsNullOrEmpty(versionHash))
{
<text>-</text><a href="https://github.com/michielpost/aoWebWallet/tree/@versionHash" target="_blank">@versionHash</a>
}
</MudText>
<MudText Typo="Typo.caption" Class="d-flex justify-center mb-2 KodeMono">zsXSvJtHVSK4QyPch4Uf0JMiZi9uEhgVvyz6qeEJcfY</MudText>


</div>
</MudLayout>

Expand Down
11 changes: 0 additions & 11 deletions src/aoWebWallet/Layout/MainLayout.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ public partial class MainLayout

protected override void OnInitialized()
{
BindingContext.PropertyChanged += BindingContext_PropertyChanged;

base.OnInitialized();
}

Expand All @@ -27,17 +25,8 @@ protected override async Task OnAfterRenderAsync(bool firstRender)
await base.OnAfterRenderAsync(firstRender);
}

private void BindingContext_PropertyChanged(object? sender, System.ComponentModel.PropertyChangedEventArgs e)
{
if (e.PropertyName == nameof(MainViewModel.IsDarkMode))
{
this.StateHasChanged();
}
}

public virtual void Dispose()
{
BindingContext.PropertyChanged -= BindingContext_PropertyChanged;
}
}
}
178 changes: 178 additions & 0 deletions src/aoWebWallet/Models/ActionParam.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@

using System.Text;

namespace aoWebWallet.Models
{
public class AoAction
{
public List<ActionParam> Params { get; set; } = new();

public ActionParam? Target => Params.Where(x => x.ParamType == ActionParamType.Target).FirstOrDefault();
public IEnumerable<ActionParam> AllWithoutTarget => Params.Where(x => x.ParamType != ActionParamType.Target);
public IEnumerable<ActionParam> Filled => Params.Where(x => x.ParamType == ActionParamType.Filled);
public IEnumerable<ActionParam> AllInputs => Params.Where(x =>
x.ParamType != ActionParamType.Filled
&& x.ParamType != ActionParamType.Target);

public string? IsValid()
{
if (Target == null)
return "No Target process specified.";

foreach(var input in AllInputs)
{
if (string.IsNullOrEmpty(input.Value))
return $"Please enter a value for {input.Key}";
}

return null;
}

public List<ArweaveBlazor.Models.Tag> ToEvalTags()
{
return Params.Select(x => new ArweaveBlazor.Models.Tag { Name = x.Key, Value = x.Value ?? string.Empty }).ToList();
}

public List<ArweaveBlazor.Models.Tag> ToTags()
{
return AllWithoutTarget.Select(x => new ArweaveBlazor.Models.Tag { Name = x.Key, Value = x.Value ?? string.Empty }).ToList();
}

public List<ArweaveAO.Models.Tag> ToDryRunTags()
{
return AllWithoutTarget.Select(x => new ArweaveAO.Models.Tag { Name = x.Key, Value = x.Value ?? string.Empty }).ToList();
}


public string ToQueryString()
{
if (Target == null)
return string.Empty;

StringBuilder sb = new StringBuilder();

sb.Append($"{Target.Key}={Target.Value}&");

foreach (var param in this.Filled)
{
sb.Append($"{param.Key}={param.Value}&");
}

foreach (var param in this.AllInputs)
{
var args = string.Join(';', param.Args);
if (args.Length > 0)
{
sb.Append($"X-{param.ParamType}={param.Key};{args}&");
}
else
{
sb.Append($"X-{param.ParamType}={param.Key}&");
}
}

return sb.ToString().TrimEnd('&');
}

public static AoAction CreateFromQueryString(string qstring)
{
// Parsing query string
var queryStringValues = System.Web.HttpUtility.ParseQueryString(qstring);

AoAction action = new AoAction();

foreach (var key in queryStringValues.AllKeys)
{
if (key == null)
continue;

var values = queryStringValues.GetValues(key);
if (values == null || !values.Any())
continue;

foreach (var val in values)
{
string actionKey = key;
string? actionValue = val.ToString();
ActionParamType actionParamType = ActionParamType.Filled;

var actionValueSplit = actionValue.Split(';', StringSplitOptions.RemoveEmptyEntries);
actionValue = actionValueSplit.First();
List<string> args = actionValueSplit.Skip(1).ToList();

if (key.Equals("Target", StringComparison.InvariantCultureIgnoreCase))
actionParamType = ActionParamType.Target;
if (key.Equals("X-Quantity", StringComparison.InvariantCultureIgnoreCase))
actionParamType = ActionParamType.Quantity;
if (key.Equals("X-Balance", StringComparison.InvariantCultureIgnoreCase))
actionParamType = ActionParamType.Balance;
else if (key.Equals("X-Process", StringComparison.InvariantCultureIgnoreCase))
actionParamType = ActionParamType.Process;
else if (key.Equals("X-Integer", StringComparison.InvariantCultureIgnoreCase))
actionParamType = ActionParamType.Integer;
else if (key.Equals("X-Input", StringComparison.InvariantCultureIgnoreCase))
actionParamType = ActionParamType.Input;

if (actionParamType != ActionParamType.Filled
&& actionParamType != ActionParamType.Target)
{
actionKey = actionValue;
actionValue = null;
}

action.Params.Add(new ActionParam
{
Key = actionKey,
Value = actionValue,
Args = args,
ParamType = actionParamType
});

}
}

return action;
}

public static AoAction CreateForTokenTransaction(string tokenId)
{
return new AoAction
{
Params = new List<ActionParam>
{
new ActionParam { Key= "Target", ParamType = ActionParamType.Target, Value= tokenId },
new ActionParam { Key= "Action", ParamType = ActionParamType.Filled, Value= "Transfer" },
new ActionParam { Key= "Recipient", ParamType = ActionParamType.Process },
new ActionParam { Key= "Quantity", ParamType = ActionParamType.Balance, Args = new List<string> { tokenId } }
}

};
}
}

public class ActionParam
{
public required string Key { get; set; }
public string? Value { get; set; }

/// <summary>
/// Arguments (like TokenId)
/// </summary>
public List<string> Args { get; set; } = new();

public ActionParamType ParamType { get; set; }

}

public enum ActionParamType
{
None = 0,
Target,
Filled,
Input,
Integer,
Process,
Balance, //Arg1: TokenId //Must have balance
Quantity, //Arg1: TokenId //Does not care about balance
}
}
7 changes: 7 additions & 0 deletions src/aoWebWallet/Models/GatewayConfig.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace aoWebWallet.Models
{
public class GatewayConfig
{
public string GatewayUrl { get; set; } = "https://arweave.net";
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace aoWebWallet.ViewModels
namespace aoWebWallet.Models
{
public class Transaction
{
Expand Down
Loading

0 comments on commit eec5ade

Please sign in to comment.