Skip to content

Commit

Permalink
Fix for receive token dialog, always display address
Browse files Browse the repository at this point in the history
  • Loading branch information
michielpost committed May 16, 2024
1 parent 9509002 commit 3812019
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/aoWebWallet/Shared/BalanceDataComponent.razor
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@
[Parameter]
public bool CanSend { get; set; }

private void Receive(BalanceDataViewModel? balanceDataVM)
private void Receive(BalanceDataViewModel balanceDataVM)
{
var parameters = new DialogParameters<ReceiveTokenDialog> { { x => x.SelectedBalanceDataVM, balanceDataVM } };
var parameters = new DialogParameters<ReceiveTokenDialog> { { x => x.SelectedBalanceDataVM, balanceDataVM }, { x => x.Address, balanceDataVM.Address } };
var options = new DialogOptions { CloseOnEscapeKey = true };
DialogService.Show<ReceiveTokenDialog>("Receive Token", parameters, options);
}
Expand Down
7 changes: 5 additions & 2 deletions src/aoWebWallet/Shared/ReceiveTokenDialog.razor
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<MudText Typo="Typo.h4">How to receive tokens?</MudText>
<MudText>Send tokens to this address:</MudText>
<MudText Class="KodeMono" style="text-overflow: ellipsis; white-space: nowrap;overflow: hidden;" Typo="Typo.subtitle1">
@SelectedBalanceDataVM?.BalanceDataLoader.Data?.Account
@Address
</MudText>
<MudText Typo="Typo.subtitle1"></MudText>
</MudStack>
Expand All @@ -25,7 +25,7 @@
<MudText Typo="Typo.h5">From aos:</MudText>
<MudText>Command:</MudText>
<MudText Class="KodeMono" Typo="Typo.subtitle1">
Send({ Target = "@SelectedBalanceDataVM?.Token?.TokenId", Action = "Transfer", Recipient = "@SelectedBalanceDataVM?.BalanceDataLoader.Data?.Account", Quantity = "TOKEN_AMOUNT"})
Send({ Target = "@SelectedBalanceDataVM?.Token?.TokenId", Action = "Transfer", Recipient = "@Address", Quantity = "TOKEN_AMOUNT"})
</MudText>
</MudStack>
</DialogContent>
Expand All @@ -40,6 +40,9 @@
[Parameter]
public BalanceDataViewModel? SelectedBalanceDataVM { get; set; }

[Parameter]
public string Address { get; set; } = string.Empty;

public async Task Submit()

Check warning on line 46 in src/aoWebWallet/Shared/ReceiveTokenDialog.razor

View workflow job for this annotation

GitHub Actions / build

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 46 in src/aoWebWallet/Shared/ReceiveTokenDialog.razor

View workflow job for this annotation

GitHub Actions / build

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
{
MudDialog.Close(DialogResult.Ok(true));
Expand Down
4 changes: 3 additions & 1 deletion src/aoWebWallet/ViewModels/BalanceDataViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ namespace aoWebWallet.ViewModels
public class BalanceDataViewModel
{
public DataLoaderViewModel<BalanceData> BalanceDataLoader { get; set; } = new DataLoaderViewModel<BalanceData>();
public Token? Token { get; set; }
public required Token Token { get; set; }

public required string Address { get; set; }

//public void Load()
//{
Expand Down
2 changes: 1 addition & 1 deletion src/aoWebWallet/ViewModels/WalletDetailViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ private async Task LoadBalanceDataList(string address, bool onlyNew = false)
continue;

}
var balanceData = new BalanceDataViewModel { Token = token };
var balanceData = new BalanceDataViewModel { Token = token, Address = address };
BalanceDataList.Add(balanceData);

await Task.Delay(50);
Expand Down

0 comments on commit 3812019

Please sign in to comment.