Skip to content

Commit

Permalink
Merge pull request #8 from SubstrateGaming/fix/version-string
Browse files Browse the repository at this point in the history
Fix version as string and add a new json test file
  • Loading branch information
darkfriend77 authored Dec 26, 2023
2 parents 2b6248d + 7f87cee commit 9e03daa
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Substrate.NET.Wallet.Test/Data/json_alice.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"encoded": "zK4aZ3HY/hDg2bu2dVHuD2r/iqbkFUeNvSVBrxHFRqMAgAAAAQAAAAgAAACDJ2JvRxnkuTY539k9YnVulR9tFKwgGD8/XY72s0ipqAKKa6Wl78agyAvM0k9x/jhZOGuIJbUMGOZYFaO5LM71KONS6lA/5z3L+ciEumA4Hug6hvjAsZHsBqo5spr8oPMmNYFp4btafaQSBIk2DN7SdgOvxxujq6l0G9bmLxJVQSZC2BNRz5b/ULejlwO7XN0/lh1jSFrlRGMFXCv8",
"encoding": {
"content": [ "pkcs8", "sr25519" ],
"type": [ "scrypt", "xsalsa20-poly1305" ],
"version": "3"
},
"address": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY",
"meta": {
"genesisHash": "",
"name": "Alice",
"whenCreated": 1696861808127
}
}
1 change: 1 addition & 0 deletions Substrate.NET.Wallet.Test/KeyringTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ protected string readJsonFromFile(string jsonFile)
};

[Test]
[TestCase("json_alice.json", "alicealice")]
[TestCase("json_account1.json", "SUBSTRATE")]
[TestCase("json_generated_1.json", "AccountTest4")]
public void ValidJson_WithValidPassword_ShouldUnlock(string json, string password)
Expand Down
3 changes: 3 additions & 0 deletions Substrate.NET.Wallet.Test/Substrate.NET.Wallet.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
</ItemGroup>

<ItemGroup>
<None Update="Data\json_alice.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Data\json_account1.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
Expand Down
3 changes: 3 additions & 0 deletions Substrate.NET.Wallet/Keyring/WalletFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Text.Json.Serialization;

namespace Substrate.NET.Wallet.Keyring
{
Expand Down Expand Up @@ -76,6 +77,8 @@ public class Encoding
{
public List<string> content { get; set; }
public List<string> type { get; set; }

[JsonNumberHandling(JsonNumberHandling.AllowReadingFromString)]
public int version { get; set; }
}

Expand Down

0 comments on commit 9e03daa

Please sign in to comment.