Switch HDFingerprintJsonConverter from 'JsonConverter<T>' to 'JsonConverter<T?>'
MODIFY
WalletWasabi/JsonConverters/HDFingerprintJsonConverter.cs
WalletWasabi/JsonConverters/HDFingerprintJsonConverter.cs
@@ -3,23 +3,22 @@ using Newtonsoft.Json;
namespace WalletWasabi.JsonConverters;
-public class HDFingerprintJsonConverter : JsonConverter<HDFingerprint>
+public class HDFingerprintJsonConverter : JsonConverter<HDFingerprint?>
{
/// <inheritdoc />
- public override HDFingerprint ReadJson(JsonReader reader, Type objectType, HDFingerprint existingValue, bool hasExistingValue, JsonSerializer serializer)
+ public override HDFingerprint? ReadJson(JsonReader reader, Type objectType, HDFingerprint? existingValue, bool hasExistingValue, JsonSerializer serializer)
{
var s = (string?)reader.Value;
if (string.IsNullOrWhiteSpace(s))
{
- return default;
+ return null;
}
- var fp = new HDFingerprint(ByteHelpers.FromHex(s));
- return fp;
+ return new HDFingerprint(ByteHelpers.FromHex(s));
}
/// <inheritdoc />
- public override void WriteJson(JsonWriter writer, HDFingerprint value, JsonSerializer serializer)
+ public override void WriteJson(JsonWriter writer, HDFingerprint? value, JsonSerializer serializer)
{
writer.WriteValue(value.ToString());
}

Switch HDFingerprintJsonConverter from 'JsonConverter<T>' to 'JsonConverter<T?>'