Skip to content

Commit

Permalink
Test rc4-test SDK branch on DEV env
Browse files Browse the repository at this point in the history
Signed-off-by: David Hernando <david.hernando@make.services>
  • Loading branch information
davidatwhiletrue committed Jul 19, 2024
1 parent b7dcaf8 commit 78a9542
Show file tree
Hide file tree
Showing 7 changed files with 247 additions and 58 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
uses: actions/checkout@v4
with:
repository: make-software/casper-net-sdk
ref: casper-2.0.0
ref: rc4-test
path: casper-net-sdk

- name: Checkout net-sdk-web repo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.7" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="Moq" Version="4.20.70" />
<PackageReference Include="NUnit" Version="4.1.0" />
<PackageReference Include="NUnit" Version="3.14.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageReference Include="NUnit.Analyzers" Version="4.2.0" />
<PackageReference Include="coverlet.collector" Version="3.2.0" />
Expand Down
250 changes: 204 additions & 46 deletions Casper.Network.SDK.Web/CasperRPCService.cs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
</RadzenDataGridColumn>
<RadzenDataGridColumn TItem="BlockTransaction" Property="Version" Title="Version" Type="typeof(string)">
<Template>
@context.Version.ToString()
@(context.Version == TransactionVersion.TransactionV1 ? "TransactionV1" : "Deploy")
</Template>
</RadzenDataGridColumn>
</Columns>
Expand Down
8 changes: 4 additions & 4 deletions Docs/Demos/NCTLWebExplorer/Pages/TransactionDetail.razor
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,22 @@ else
<div class="row">
<div class="col-md-4">
<div>Timestamp</div>
<b>@TimestampToLocalTime(_transaction.Header.Timestamp)</b>
<b>@TimestampToLocalTime(_transaction.Timestamp)</b>
<div class="mt-3">Result</div>
<b>@(_executionResult.ErrorMessage == null ? "Success" : "Failed")</b>
</div>
<div class="col-md-4">
<div>Initiator</div>
<b><a href="/get-entity/@(_transaction.Header.InitiatorAddr)">@(_transaction.Header.InitiatorAddr.ToString().FormatHash())</a></b>
<b><a href="/get-entity/@(_transaction.InitiatorAddr)">@(_transaction.InitiatorAddr.ToString().FormatHash())</a></b>

<div>Block Hash</div>
<b><a href="/blocks/@(_blockHash)">@(_blockHash.FormatHash())</a></b>

<div class="mt-3">Pricing mode</div>
<b>@(_transaction.Header.PricingMode.Type.ToString())</b>
<b>@(PricingModeType())</b>

<div class="mt-3">Gas tolerance</div>
<b>@(_transaction.Header.PricingMode.GasPriceTolerance)</b>
<b>@(GasPriceTolerance())</b>
</div>
<div class="col-md-4">
<div>Gas limit</div>
Expand Down
39 changes: 35 additions & 4 deletions Docs/Demos/NCTLWebExplorer/Pages/TransactionDetail.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Casper.Network.SDK.JsonRpc;
using NCTLWebExplorer.Components;
using Casper.Network.SDK.Types;
using Casper.Network.SDK.Utils;
using Microsoft.AspNetCore.Components;
using NCTLWebExplorer.Models;
using NCTLWebExplorer.Services;
Expand All @@ -22,7 +23,7 @@ public partial class TransactionDetail
private RpcJsonViewer JsonViewerInstance { get; set; }

private string _transactionJson;
private TransactionV1 _transaction;
private Transaction _transaction;
private string _blockHash;
private ExecutionResult _executionResult;
private List<MessageSummary> _messages = new();
Expand All @@ -33,10 +34,10 @@ protected override async Task OnInitializedAsync()
try
{
Console.WriteLine("Requesting transaction: " + TransactionV1Hash);
var response = await CasperRpcService.GetTransaction(new TransactionHash() { Version1 = TransactionV1Hash });
var response = await CasperRpcService.GetTransaction(new TransactionHash() { Version1 = TransactionV1Hash});
_transactionJson = response.Result.GetRawText();
var transactionResult = response.Parse();
_transaction = transactionResult.Transaction.TransactionV1;
_transaction = transactionResult.Transaction;
_blockHash = transactionResult.ExecutionInfo.BlockHash;
_executionResult = transactionResult.ExecutionInfo.ExecutionResult;

Expand Down Expand Up @@ -77,7 +78,7 @@ private string TimestampToLocalTime(ulong timestamp)
{
try
{
var isoDateTime = Casper.Network.SDK.Utils.DateUtils.ToISOString(_transaction.Header.Timestamp);
var isoDateTime = Casper.Network.SDK.Utils.DateUtils.ToISOString(_transaction.Timestamp);
if(DateTime.TryParse(isoDateTime, out var t))
return t.ToLocalTime().ToString("", CultureInfo.CurrentCulture);
}
Expand All @@ -86,4 +87,34 @@ private string TimestampToLocalTime(ulong timestamp)
}
return timestamp.ToString();
}

private string PricingModeType()
{
switch (_transaction.PricingMode)
{
case ClassicPricingMode classicPricingMode:
return "Classic";
break;
case FixedPricingMode fixedPricingMode:
return "Fixed";
case ReservedPricingMode:
return "Reserved";
default:
return "Unknown";
}
}

private string GasPriceTolerance()
{
switch (_transaction.PricingMode)
{
case ClassicPricingMode classicPricingMode:
return classicPricingMode.GasPriceTolerance.ToString();
break;
case FixedPricingMode fixedPricingMode:
return fixedPricingMode.GasPriceTolerance.ToString();
default:
return "--";
}
}
}
2 changes: 1 addition & 1 deletion Docs/Demos/NCTLWebExplorer/Shared/MainLayout.razor
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
</RadzenStack>
<RadzenStack Orientation="Orientation.Vertical" JustifyContent="JustifyContent.Center" AlignItems="AlignItems.End" Gap="0">
<div>Built with Casper .NET SDK v3.0.0-beta1</div>
<div>Explorer version: v0.2.1</div>
<div>Explorer version: v0.2.2</div>
</RadzenStack>
</RadzenStack>
</RadzenFooter>
Expand Down

0 comments on commit 78a9542

Please sign in to comment.