diff --git a/src/aoWebWallet/Models/CreateTokenModel.cs b/src/aoWebWallet/Models/CreateTokenModel.cs
index eff9043..d1ff760 100644
--- a/src/aoWebWallet/Models/CreateTokenModel.cs
+++ b/src/aoWebWallet/Models/CreateTokenModel.cs
@@ -1,11 +1,15 @@
-namespace aoWebWallet.Models
+using aoWebWallet.Services;
+
+namespace aoWebWallet.Models
{
public class CreateTokenModel
{
public string? Name { get; set; }
public string? Ticker { get; set; }
public string? LogoUrl { get; set; }
- public int Denomination { get; set; }
- public int TotalSupply { get; set; }
+ public int Denomination { get; set; } = 2;
+ public decimal TotalSupply { get; set; } = 100;
+ public string MintQuantityForTag => BalanceHelper.DecimalToTokenAmount(TotalSupply, Denomination).ToString();
+
}
}
diff --git a/src/aoWebWallet/Pages/CreateTokenPage.razor b/src/aoWebWallet/Pages/CreateTokenPage.razor
index cb31428..2bbcf66 100644
--- a/src/aoWebWallet/Pages/CreateTokenPage.razor
+++ b/src/aoWebWallet/Pages/CreateTokenPage.razor
@@ -24,26 +24,28 @@
-
+
+
-
-
- Submit
+ Submit
}
else
{
- @if (!string.IsNullOrEmpty(CreateTokenService.CreateTokenProgress.Data))
- {
- @CreateTokenService.CreateTokenProgress.Data
- }
-
@if (CreateTokenService.CreateTokenProgress.DataLoader.LoadingState == LoadingState.Finished)
{
- Return to Wallet
+ if (!string.IsNullOrEmpty(CreateTokenService.CreateTokenProgress.Data))
+ {
+
+
+ New tokenId: @CreateTokenService.CreateTokenProgress.Data
+
+ }
+
+ Return to Wallet
}
}
@@ -58,6 +60,9 @@
new BreadcrumbItem("Create Token", href: null, disabled: true)
};
+ public string DenominationFormat => "F" + (tokenModel.Denomination).ToString();
+ public bool IsDisabled => string.IsNullOrWhiteSpace(tokenModel.Name) || string.IsNullOrWhiteSpace(tokenModel.Ticker);
+
private async Task Submit()
{
isSubmitting = true;
diff --git a/src/aoWebWallet/Pages/CreateTokenPage.razor.cs b/src/aoWebWallet/Pages/CreateTokenPage.razor.cs
index 8c74ebb..937217e 100644
--- a/src/aoWebWallet/Pages/CreateTokenPage.razor.cs
+++ b/src/aoWebWallet/Pages/CreateTokenPage.razor.cs
@@ -1,4 +1,5 @@
-using aoWebWallet.ViewModels;
+using aoWebWallet.Services;
+using aoWebWallet.ViewModels;
using aoww.ProcesModels.Action;
using Microsoft.AspNetCore.Components.Routing;
@@ -8,6 +9,8 @@ public partial class CreateTokenPage : MvvmComponentBase
{
protected override void OnInitialized()
{
+ CreateTokenService.Reset();
+
WatchProp(nameof(BindingContext.ActiveWalletAddress));
WatchDataLoaderVM(BindingContext.WalletList);
WatchDataLoaderVM(CreateTokenService.CreateTokenProgress);
diff --git a/src/aoWebWallet/Services/CreateTokenService.cs b/src/aoWebWallet/Services/CreateTokenService.cs
index 512f00d..fdf04d1 100644
--- a/src/aoWebWallet/Services/CreateTokenService.cs
+++ b/src/aoWebWallet/Services/CreateTokenService.cs
@@ -10,6 +10,11 @@ public class CreateTokenService(ArweaveService arweaveService, TransactionServic
{
public DataLoaderViewModel CreateTokenProgress { get; set; } = new();
+ public void Reset()
+ {
+ CreateTokenProgress = new();
+ }
+
public Task CreateToken(Wallet wallet, CreateTokenModel tokenModel)
=> CreateTokenProgress.DataLoader.LoadAsync(async () =>
{
@@ -45,7 +50,8 @@ public class CreateTokenService(ArweaveService arweaveService, TransactionServic
if (string.IsNullOrWhiteSpace(newProcessId))
{
- return "Failed to create new process";
+ CreateTokenProgress.DataLoader.ProgressMsg = "Failed to create new process";
+ return null;
}
else
{
@@ -80,7 +86,8 @@ public class CreateTokenService(ArweaveService arweaveService, TransactionServic
if (dataId == null)
{
- return $"Failed to reach process after maximum retries ({maxRetries})";
+ CreateTokenProgress.DataLoader.ProgressMsg = $"Failed to reach process after maximum retries ({maxRetries})";
+ return null;
}
if (dataId != null)
@@ -92,13 +99,14 @@ public class CreateTokenService(ArweaveService arweaveService, TransactionServic
{
new ArweaveBlazor.Models.Tag { Name = "Target", Value = newProcessId},
new ArweaveBlazor.Models.Tag { Name = "Action", Value = "Mint"},
- new ArweaveBlazor.Models.Tag { Name = "Quantity", Value = tokenModel.TotalSupply.ToString()}
+ new ArweaveBlazor.Models.Tag { Name = "Quantity", Value = tokenModel.MintQuantityForTag}
});
Console.WriteLine("mintResult: " + mintResult);
}
- return "Token created successfully!";
+ CreateTokenProgress.DataLoader.ProgressMsg = "Token created successfully!";
+ return newProcessId;
}, x => CreateTokenProgress.Data = x);
}
}
\ No newline at end of file
diff --git a/src/aoWebWallet/Shared/Components/SendTransactionProgress.razor b/src/aoWebWallet/Shared/Components/SendTransactionProgress.razor
index 2b7e453..3e0a7f7 100644
--- a/src/aoWebWallet/Shared/Components/SendTransactionProgress.razor
+++ b/src/aoWebWallet/Shared/Components/SendTransactionProgress.razor
@@ -4,7 +4,11 @@
return;
@Title
-@DataLoader?.ProgressMsg
+@if (!string.IsNullOrWhiteSpace(DataLoader?.ProgressMsg))
+{
+
+ @DataLoader?.ProgressMsg
+}
@code {
diff --git a/src/aoWebWallet/aoWebWallet.csproj b/src/aoWebWallet/aoWebWallet.csproj
index 4f1c47b..c3fd66e 100644
--- a/src/aoWebWallet/aoWebWallet.csproj
+++ b/src/aoWebWallet/aoWebWallet.csproj
@@ -21,7 +21,7 @@
-
+