Switch ScalarJsonConverter from 'JsonConverter' to 'JsonConverter<T>'
MODIFY
WalletWasabi/WabiSabi/Crypto/Serialization/ScalarJsonConverter.cs
WalletWasabi/WabiSabi/Crypto/Serialization/ScalarJsonConverter.cs
@@ -3,14 +3,10 @@ using Newtonsoft.Json;
namespace WalletWasabi.WabiSabi.Crypto.Serialization;
-public class ScalarJsonConverter : JsonConverter
+public class ScalarJsonConverter : JsonConverter<Scalar>
{
- public override bool CanConvert(Type objectType)
- {
- return objectType == typeof(Scalar);
- }
-
- public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
+ /// <inheritdoc />
+ public override Scalar ReadJson(JsonReader reader, Type objectType, Scalar existingValue, bool hasExistingValue, JsonSerializer serializer)
{
if (reader.Value is string serialized)
{
@@ -19,7 +15,8 @@ public class ScalarJsonConverter : JsonConverter
throw new ArgumentException($"No valid serialized {nameof(Scalar)} passed.");
}
- public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
+ /// <inheritdoc />
+ public override void WriteJson(JsonWriter writer, Scalar value, JsonSerializer serializer)
{
if (value is Scalar scalar)
{

Switch ScalarJsonConverter from 'JsonConverter' to 'JsonConverter<T>'