Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Casper.Network.SDK.Test/RPCResponses/GetTransactionTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Casper.Network.SDK.JsonRpc.ResultTypes;
using Casper.Network.SDK.Types;
using NUnit.Framework;
using Org.BouncyCastle.Math;
using Org.BouncyCastle.Utilities.Encoders;

namespace NetCasperTest.RPCResponses
Expand Down Expand Up @@ -36,6 +37,8 @@ public void GetTransactionWithDeployHashTest_v200()
AssertExtensions.IsHash(result.ExecutionInfo.BlockHash);
Assert.IsTrue(result.ExecutionInfo.BlockHeight > 0);
Assert.IsNotNull(result.ExecutionInfo.ExecutionResult);
Assert.AreEqual(1, result.ExecutionInfo.ExecutionResult.CurrentGasPrice);
Assert.AreEqual("30000", result.ExecutionInfo.ExecutionResult.Refund.ToString());
}

[Test]
Expand Down Expand Up @@ -136,6 +139,8 @@ public void GetTransactionWithStoredTransactionTest_v200()
AssertExtensions.IsHash(result.ExecutionInfo.BlockHash);
Assert.IsTrue(result.ExecutionInfo.BlockHeight > 0);
Assert.IsNotNull(result.ExecutionInfo.ExecutionResult);
Assert.AreEqual(2, result.ExecutionInfo.ExecutionResult.CurrentGasPrice);
Assert.AreEqual("2123123123", result.ExecutionInfo.ExecutionResult.Refund.ToString());
}

[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@
"limit": "10000",
"consumed": "10000",
"cost": "10000",
"refund": "30000",
"current_price": 1,
"payment": [],
"transfers": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@
"limit": "3000000000",
"consumed": "1241925",
"cost": "3000000000",
"refund": "2123123123",
"current_price": 2,
"transfers": [],
"size_estimate": 591,
"effects": [
Expand Down
30 changes: 30 additions & 0 deletions Casper.Network.SDK/Types/ExecutionResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ public static explicit operator ExecutionResult(ExecutionResultV1 executionResul
ErrorMessage = executionResult.ErrorMessage,
// Transfers = executionResult.Transfers,
Cost = executionResult.Cost,
Refund = 0,
CurrentGasPrice = 1,
Limit = 0,
Consumed = 0,
Effect = v2Effect,
Expand Down Expand Up @@ -81,6 +83,19 @@ public static explicit operator ExecutionResult(ExecutionResultV1 executionResul
[JsonPropertyName("cost")]
[JsonConverter(typeof(BigIntegerConverter))]
public BigInteger Cost { get; init; }

/// <summary>
/// How much was refunded (if any)
/// </summary>
[JsonPropertyName("refund")]
[JsonConverter(typeof(BigIntegerConverter))]
public BigInteger Refund { get; init; }

/// <summary>
/// The gas price of the era.
/// </summary>
[JsonPropertyName("current_price")]
public UInt16 CurrentGasPrice { get; init; }

/// <summary>
/// If there is no error message, this execution was processed successfully. If there is an error message, this
Expand Down Expand Up @@ -150,6 +165,8 @@ public override ExecutionResult Read(
ErrorMessage = erv2.ErrorMessage,
Transfers = erv2.Transfers,
Cost = erv2.Cost,
Refund = erv2.Refund,
CurrentGasPrice = erv2.CurrentGasPrice,
Limit = erv2.Limit,
Consumed = erv2.Consumed,
Effect = erv2.Effect,
Expand Down Expand Up @@ -342,6 +359,19 @@ internal class ExecutionResultV2
[JsonConverter(typeof(BigIntegerConverter))]
public BigInteger Cost { get; init; }

/// <summary>
/// How much was refunded (if any)
/// </summary>
[JsonPropertyName("refund")]
[JsonConverter(typeof(BigIntegerConverter))]
public BigInteger Refund { get; init; }

/// <summary>
/// The gas price of the era.
/// </summary>
[JsonPropertyName("current_price")]
public UInt16 CurrentGasPrice { get; init; }

/// <summary>
/// If there is no error message, this execution was processed successfully. If there is an error message, this
/// execution failed to fully process for the stated reason.
Expand Down