Skip to content

Commit 5012e01

Browse files
committed
ETH 0x address support
1 parent be225f0 commit 5012e01

File tree

9 files changed

+17
-16
lines changed

9 files changed

+17
-16
lines changed

src/aoWebWallet/Pages/ReceivePage.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@
171171

172172
protected override async Task OnParametersSetAsync()
173173
{
174-
if (Address != null && Address.Length != 43)
174+
if (Address != null && !AddressValidator.IsValidAddress(Address))
175175
{
176176
NavigationManager.NavigateTo("");
177177
}

src/aoWebWallet/Pages/ScanQrPage.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
return;
5454
}
5555

56-
var address = code.Substring(3, 43);
56+
var address = code.Substring(3).Trim();
5757

5858
int tokenStart = code.IndexOf("?tokenId=");
5959
if (tokenStart > 0)

src/aoWebWallet/Pages/WalletDetail.razor.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using aoWebWallet.Models;
22
using aoWebWallet.ViewModels;
3+
using ArweaveAO;
34
using Microsoft.AspNetCore.Components;
45
using MudBlazor;
56

@@ -40,7 +41,7 @@ private async void TokenList_CollectionChanged(object? sender, System.Collection
4041

4142
protected override async Task OnParametersSetAsync()
4243
{
43-
if (Address != null && Address.Length != 43)
44+
if (Address != null && !AddressValidator.IsValidAddress(Address))
4445
{
4546
NavigationManager.NavigateTo("");
4647
}

src/aoWebWallet/Shared/AddTokenDialog.razor

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<DialogContent>
66
Add a token to view your balance. Provide a process-id that implements the token standard.
77
<MudFocusTrap DefaultFocus="DefaultFocus.FirstChild">
8-
<MudTextField @bind-Value="TokenId" Label="Token Id" Mask="@(new RegexMask("^[a-zA-Z0-9_\\-]{0,43}$"))" MaxLength="43" Variant="Variant.Text"></MudTextField>
8+
<MudTextField @bind-Value="TokenId" Label="Token Id" MaxLength="43" Variant="Variant.Text"></MudTextField>
99
</MudFocusTrap>
1010
<MudText Color="Color.Secondary">@Progress</MudText>
1111
</DialogContent>
@@ -27,7 +27,7 @@
2727
Progress = "Input the process-id of an ao-process implementing the token standard.";
2828
return;
2929
}
30-
if(TokenId.Length != 43)
30+
if (!AddressValidator.IsValidArweaveAddress(TokenId))
3131
{
3232
Progress = "Length must be 43 characters.";
3333
return;

src/aoWebWallet/Shared/AddTokenToWalletDialog.razor

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<DialogContent>
77
Add a token to view your balance. Provide a process-id that implements the token standard.
88
<MudFocusTrap DefaultFocus="DefaultFocus.FirstChild">
9-
<MudTextField @bind-Value="TokenId" Label="Token Id" Mask="@(new RegexMask("^[a-zA-Z0-9_\\-]{0,43}$"))" MaxLength="43" Variant="Variant.Text"></MudTextField>
9+
<MudTextField @bind-Value="TokenId" Label="Token Id" MaxLength="43" Variant="Variant.Text"></MudTextField>
1010
</MudFocusTrap>
1111
<MudText Color="Color.Secondary">@Progress</MudText>
1212
</DialogContent>
@@ -28,7 +28,7 @@
2828
Progress = "Input the process-id of an ao-process implementing the token standard.";
2929
return;
3030
}
31-
if(TokenId.Length != 43)
31+
if (!AddressValidator.IsValidArweaveAddress(TokenId))
3232
{
3333
Progress = "Length must be 43 characters.";
3434
return;

src/aoWebWallet/Shared/Components/ActionInputComponent.razor

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,9 @@ else
146146

147147
public IEnumerable<string> ValidateProcess(Wallet? input)
148148
{
149-
if (input == null || input.Address.Length != 43)
149+
if (input == null || !AddressValidator.IsValidAddress(input.Address))
150150
{
151-
yield return "Address must have length of 43 characters.";
151+
yield return "Invalid address.";
152152
}
153153
}
154154

@@ -179,7 +179,7 @@ else
179179

180180
if (contacts.Any())
181181
return contacts;
182-
else if(value.Length == 43)
182+
else if (AddressValidator.IsValidAddress(value))
183183
return new Wallet[1] { new Wallet() { Address = value } };
184184
else
185185
return new Wallet[0];

src/aoWebWallet/Shared/EditWalletComponent.razor

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<MudPaper Class="pa-8">
66
<MudStack Spacing="2">
7-
<MudTextField @bind-Value="Address" ReadOnly="@IsReadOnly" Required="true" RequiredError="Input a wallet address" Mask="@(new RegexMask("^[a-zA-Z0-9_\\-]{0,43}$"))" Label="Wallet Address" Variant="Variant.Text"></MudTextField>
7+
<MudTextField @bind-Value="Address" ReadOnly="@IsReadOnly" Required="true" RequiredError="Input a wallet address" Label="Wallet Address" Variant="Variant.Text"></MudTextField>
88
<MudText Color="Color.Secondary">@Progress</MudText>
99
<MudTextField @bind-Value="Name" Label="Wallet Name" Variant="Variant.Text"></MudTextField>
1010

@@ -54,9 +54,9 @@
5454
// return false;
5555
// }
5656
57-
if (string.IsNullOrWhiteSpace(Address) || Address.Length != 43)
57+
if (string.IsNullOrWhiteSpace(Address) || !AddressValidator.IsValidAddress(Address))
5858
{
59-
Progress = "Length must be 43 characters.";
59+
Progress = "Provide a valid Arweave or Ethereum address.";
6060
StateHasChanged();
6161
return false;
6262
}

src/aoWebWallet/aoWebWallet.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
</PropertyGroup>
1313

1414
<ItemGroup>
15-
<PackageReference Include="ArweaveAO" Version="0.0.6" />
16-
<PackageReference Include="ArweaveBlazor" Version="0.0.9" />
15+
<PackageReference Include="ArweaveAO" Version="0.0.7" />
16+
<PackageReference Include="ArweaveBlazor" Version="0.0.10" />
1717
<PackageReference Include="ClipLazor" Version="2.1.1" />
1818
<PackageReference Include="CodeBeam.MudBlazor.Extensions" Version="7.0.1" />
1919
<PackageReference Include="MudBlazor" Version="7.6.0" />

src/aoww.ProcesModels/aoww.ProcesModels.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
</PropertyGroup>
99

1010
<ItemGroup>
11-
<PackageReference Include="ArweaveAO" Version="0.0.6" />
11+
<PackageReference Include="ArweaveAO" Version="0.0.7" />
1212
</ItemGroup>
1313

1414
</Project>

0 commit comments

Comments
 (0)