Skip to content

Commit

Permalink
Action dry run bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
michielpost committed May 2, 2024
1 parent 4124d77 commit 3c25939
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
18 changes: 14 additions & 4 deletions src/aoWebWallet/Pages/ActionPage.razor
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,14 @@
{
<MudStack>
<MudText Typo="Typo.h5">Transfer success!</MudText>
<MudText>TransactionId</MudText>
<MudText>Message Id</MudText>
<MudText Class="KodeMono" Typo="Typo.caption">
@transactionService.LastTransaction.Data?.Id
</MudText>
</MudStack>

<MudButton Color="Color.Primary" OnClick="ReturnToWallet">Return to wallet</MudButton>
<MudButton Color="Color.Primary" Variant="Variant.Filled" OnClick="ReturnToWallet">Return to wallet</MudButton>
@* <MudButton Color="Color.Primary" Variant="Variant.Filled" OnClick="ViewTransaction">View Transaction</MudButton> *@
}
}

Expand Down Expand Up @@ -152,9 +153,9 @@
return;

//Do we need the owner wallet?
Wallet? ownerWallet = BindingContext.WalletList.Data.Where(x => x.Address == wallet.OwnerAddress).FirstOrDefault();
//Wallet? ownerWallet = BindingContext.WalletList.Data.Where(x => x.Address == wallet.OwnerAddress).FirstOrDefault();
transactionService.DryRunAction(wallet, ownerWallet, AoAction);
transactionService.DryRunAction(wallet, AoAction);

}
private void Cancel()
Expand All @@ -167,6 +168,15 @@
NavigationManager.NavigateTo($"/wallet/{selectedWallet}");
}

private void ViewTransaction()
{
if (!string.IsNullOrEmpty(transactionService.LastTransaction.Data?.Id))
NavigationManager.NavigateTo($"/transaction/{transactionService.LastTransaction.Data?.Id}");
else
ReturnToWallet();

}

private async Task Submit()
{
if (BindingContext.WalletList.Data == null)
Expand Down
4 changes: 2 additions & 2 deletions src/aoWebWallet/Services/TransactionService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ public void Reset()
return null;
}

public Task<MessageResult?> DryRunAction(Wallet wallet, Wallet? ownerWallet, AoAction action)
public Task<MessageResult?> DryRunAction(Wallet wallet, AoAction action)
=> DryRunResult.DataLoader.LoadAsync(async () =>
{
var target = action.Target?.Value ?? string.Empty;
var druRunRequest = new DryRunRequest()
{
Target = target,
Owner = ownerWallet?.Address ?? wallet.Address,
Owner = wallet.Address,
Tags = action.ToDryRunTags()
};
Expand Down

0 comments on commit 3c25939

Please sign in to comment.