Skip to content

Commit e7f6c3c

Browse files
committed
finish up
1 parent 4311bac commit e7f6c3c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+1175
-389
lines changed

.github/FUNDING.yml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
github: [kukks]
2+
custom: ['https://donate.kukks.org']

.github/workflows/ci.yml

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: 'Publish application'
2+
on: push
3+
4+
jobs:
5+
build:
6+
runs-on: ubuntu-latest
7+
steps:
8+
# Checkout the code
9+
- uses: actions/checkout@v2
10+
11+
# Install .NET Core SDK
12+
- name: Setup .NET Core
13+
uses: actions/setup-dotnet@v1
14+
with:
15+
dotnet-version: 8.0.x
16+
17+
- name: Test
18+
run: dotnet test
19+
20+
- name: Publish NuGet
21+
if: ${{ github.ref == 'refs/heads/master' }} # Publish only when the push is on master
22+
uses: Rebel028/[email protected]
23+
with:
24+
PROJECT_FILE_PATH: DotNut.Client/DotNut.csproj
25+
NUGET_KEY: ${{secrets.NUGET_KEY}}
26+
PACKAGE_NAME: DotNut
27+
INCLUDE_SYMBOLS: false
28+
VERSION_REGEX: ^\s*<PackageVersion>(.*)<\/PackageVersion>\s*$
29+
TAG_COMMIT: true
30+
TAG_FORMAT: DotNut/v*
31+
- name: Publish Github Package Registry
32+
if: ${{ github.ref == 'refs/heads/master' }} # Publish only when the push is on master
33+
uses: Rebel028/[email protected]
34+
with:
35+
PROJECT_FILE_PATH: DotNut.Client/DotNut.Client.csproj
36+
NUGET_SOURCE: "https://nuget.pkg.github.com/Kukks"
37+
NUGET_KEY: ${{secrets.GH_TOKEN}}
38+
PACKAGE_NAME: DotNut
39+
INCLUDE_SYMBOLS: false
40+
VERSION_REGEX: ^\s*<PackageVersion>(.*)<\/PackageVersion>\s*$
41+
TAG_COMMIT: true
42+
TAG_FORMAT: DotNut/v*

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
**/bin
22
**/obj
3+
.idea
4+
.idea

.idea/.idea.DotNuts/.idea/.gitignore

-13
This file was deleted.

.idea/.idea.DotNuts/.idea/encodings.xml

-4
This file was deleted.

.idea/.idea.DotNuts/.idea/indexLayout.xml

-8
This file was deleted.

.idea/.idea.DotNuts/.idea/vcs.xml

-6
This file was deleted.

DotNuts.Tests/DotNuts.Tests.csproj DotNut.Tests/DotNut.Tests.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
</ItemGroup>
2424

2525
<ItemGroup>
26-
<ProjectReference Include="..\DotNuts\DotNuts.csproj" />
26+
<ProjectReference Include="..\DotNut\DotNut.csproj" />
2727
</ItemGroup>
2828

2929
</Project>
File renamed without changes.

DotNuts.Tests/UnitTest1.cs DotNut.Tests/UnitTest1.cs

+166-14
Large diffs are not rendered by default.

DotNuts.sln DotNut.sln

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotNuts", "DotNuts\DotNuts.csproj", "{997966AE-DC46-4473-9C82-A0F1750B2481}"
3+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotNut", "DotNut\DotNut.csproj", "{997966AE-DC46-4473-9C82-A0F1750B2481}"
44
EndProject
5-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotNuts.Tests", "DotNuts.Tests\DotNuts.Tests.csproj", "{0AAAA85C-9FDC-4FD5-9CC2-ED8385B40106}"
5+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotNut.Tests", "DotNut.Tests\DotNut.Tests.csproj", "{0AAAA85C-9FDC-4FD5-9CC2-ED8385B40106}"
66
EndProject
77
Global
88
GlobalSection(SolutionConfigurationPlatforms) = preSolution

DotNut.sln.DotSettings.user

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
2+
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=7c67fc42_002Dfa49_002D41c5_002Db4e4_002D876bfc07dd62/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" Name="Test1" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;&#xD;
3+
&lt;TestAncestor&gt;&#xD;
4+
&lt;TestId&gt;xUnit::0AAAA85C-9FDC-4FD5-9CC2-ED8385B40106::net8.0::DotNuts.Tests.UnitTest1&lt;/TestId&gt;&#xD;
5+
&lt;/TestAncestor&gt;&#xD;
6+
&lt;/SessionState&gt;</s:String>
7+
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=b0637c43_002D4622_002D4768_002D94e5_002D70df8e44a8fe/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" IsActive="True" Name="Nut11_Signatures" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;&#xD;
8+
&lt;And&gt;&#xD;
9+
&lt;Namespace&gt;DotNuts.Tests&lt;/Namespace&gt;&#xD;
10+
&lt;Project Location="C:\Git\DotNuts\DotNuts.Tests" Presentation="&amp;lt;DotNuts.Tests&amp;gt;" /&gt;&#xD;
11+
&lt;/And&gt;&#xD;
12+
&lt;/SessionState&gt;</s:String></wpf:ResourceDictionary>

DotNuts/CashuHttpClient.cs DotNut/Api/CashuHttpClient.cs

+2-60
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
using System.Net.Http.Json;
33
using System.Text;
44
using System.Text.Json;
5-
using System.Text.Json.Serialization;
5+
using DotNut.ApiModels;
66

7-
namespace DotNuts;
7+
namespace DotNut.Api;
88

99
public class CashuHttpClient
1010
{
@@ -107,62 +107,4 @@ protected async Task<T> HandleResponse<T>(HttpResponseMessage response, Cancella
107107

108108
return result!;
109109
}
110-
}
111-
112-
public class ProofSecretSet: Dictionary<string,ProofSecret>
113-
{
114-
115-
}
116-
117-
public class ProofSecret
118-
{
119-
120-
[JsonPropertyName("nonce")]
121-
public string Nonce { get; set; }
122-
[JsonPropertyName("data")]
123-
public string Data { get; set; }
124-
[JsonPropertyName("tags")]
125-
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
126-
public string[][]? Tags { get; set; }
127-
}
128-
129-
public class PostRestoreRequest
130-
{
131-
[JsonPropertyName("outputs")]
132-
public BlindedMessage[] Outputs { get; set; }
133-
}public class PostRestoreResponse
134-
{
135-
[JsonPropertyName("outputs")]
136-
public BlindedMessage[] Outputs { get; set; }
137-
[JsonPropertyName("signatures")]
138-
public BlindSignature[] Signatures { get; set; }
139-
}
140-
141-
public class PostCheckStateRequest
142-
{
143-
[JsonPropertyName("Ys")]
144-
public string[] Ys { get; set; }
145-
}
146-
147-
public class PostCheckStateResponse
148-
{
149-
150-
[JsonPropertyName("states")]
151-
public StateResponseItem[] States { get; set; }
152-
}
153-
154-
public class StateResponseItem
155-
{
156-
157-
public string Y { get; set; }
158-
[JsonConverter(typeof(JsonStringEnumConverter))]
159-
public TokenState State { get; set; }
160-
public string? Witness { get; set; }
161-
162-
public enum TokenState
163-
{
164-
UNSPENT,
165-
PENDING,
166-
SPENT
167-
}
168110
}

DotNuts/CashuProtocolError.cs DotNut/Api/CashuProtocolError.cs

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
using System.Text.Json.Serialization;
22

3+
namespace DotNut.Api;
4+
35
public class CashuProtocolError
46
{
57
[JsonPropertyName("detail")] public string Detail { get; set; }

DotNuts/CashuProtocolException.cs DotNut/Api/CashuProtocolException.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
public class CashuProtocolException : Exception
1+
namespace DotNut.Api;
2+
3+
public class CashuProtocolException : Exception
24
{
35
public CashuProtocolException(CashuProtocolError error) : base(error.Detail)
46
{

DotNut/ApiModels/GetInfoResponse.cs

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using System.Text.Json;
2+
using System.Text.Json.Serialization;
3+
4+
namespace DotNut.ApiModels;
5+
6+
public class GetInfoResponse
7+
{
8+
[JsonPropertyName("name")] public string Name { get; set; }
9+
[JsonPropertyName("pubkey")] public string Pubkey { get; set; }
10+
[JsonPropertyName("version")] public string Version { get; set; }
11+
[JsonPropertyName("description")] public string Description { get; set; }
12+
[JsonPropertyName("description_long")] public string DescriptionLong { get; set; }
13+
[JsonPropertyName("contact")] public List<List<string>> Contact { get; set; }
14+
[JsonPropertyName("motd")] public string Motd { get; set; }
15+
[JsonPropertyName("nuts")] public Dictionary<string, JsonDocument> Nuts { get; set; }
16+
}

DotNuts/GetKeysResponse.cs DotNut/ApiModels/GetKeysResponse.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System.Text.Json.Serialization;
22

3-
namespace DotNuts;
3+
namespace DotNut.ApiModels;
44

55
public class GetKeysResponse
66
{

DotNuts/GetKeysetsResponse.cs DotNut/ApiModels/GetKeysetsResponse.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System.Text.Json.Serialization;
22

3-
namespace DotNuts;
3+
namespace DotNut.ApiModels;
44

55
public class GetKeysetsResponse
66
{
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using System.Text.Json.Serialization;
2+
3+
namespace DotNut.ApiModels;
4+
5+
public class PostCheckStateRequest
6+
{
7+
[JsonPropertyName("Ys")]
8+
public string[] Ys { get; set; }
9+
}
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using System.Text.Json.Serialization;
2+
3+
namespace DotNut.ApiModels;
4+
5+
public class PostCheckStateResponse
6+
{
7+
8+
[JsonPropertyName("states")]
9+
public StateResponseItem[] States { get; set; }
10+
}
+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using System.Text.Json.Serialization;
2+
3+
namespace DotNut.ApiModels;
4+
5+
public class PostRestoreRequest
6+
{
7+
[JsonPropertyName("outputs")]
8+
public BlindedMessage[] Outputs { get; set; }
9+
}
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
using System.Text.Json.Serialization;
2+
3+
namespace DotNut.ApiModels;
4+
5+
public class PostRestoreResponse
6+
{
7+
[JsonPropertyName("outputs")]
8+
public BlindedMessage[] Outputs { get; set; }
9+
[JsonPropertyName("signatures")]
10+
public BlindSignature[] Signatures { get; set; }
11+
}

DotNuts/PostSwapRequest.cs DotNut/ApiModels/PostSwapRequest.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System.Text.Json.Serialization;
22

3-
namespace DotNuts;
3+
namespace DotNut.ApiModels;
44

55
public class PostSwapRequest
66
{

DotNuts/PostSwapResponse.cs DotNut/ApiModels/PostSwapResponse.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System.Text.Json.Serialization;
22

3-
namespace DotNuts;
3+
namespace DotNut.ApiModels;
44

55
public class PostSwapResponse
66
{

DotNut/ApiModels/StateResponseItem.cs

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using System.Text.Json.Serialization;
2+
3+
namespace DotNut.ApiModels;
4+
5+
public class StateResponseItem
6+
{
7+
8+
public string Y { get; set; }
9+
[JsonConverter(typeof(JsonStringEnumConverter))]
10+
public TokenState State { get; set; }
11+
public string? Witness { get; set; }
12+
13+
public enum TokenState
14+
{
15+
UNSPENT,
16+
PENDING,
17+
SPENT
18+
}
19+
}

DotNuts/BlindSignature.cs DotNut/BlindSignature.cs

+8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
using System.Text.Json.Serialization;
2+
using DotNut.JsonConverters;
3+
4+
namespace DotNut;
25

36
public class BlindSignature
47
{
@@ -9,4 +12,9 @@ public class BlindSignature
912
public KeysetId Id { get; set; }
1013

1114
[JsonPropertyName("C_")] public PubKey C_ { get; set; }
15+
16+
17+
[JsonPropertyName("dleq")]
18+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
19+
public DLEQProof? DLEQ { get; set; }
1220
}

DotNuts/BlindedMessage.cs DotNut/BlindedMessage.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System.Text.Json.Serialization;
2-
using NBitcoin.Secp256k1;
2+
3+
namespace DotNut;
34

45
public class BlindedMessage
56
{

0 commit comments

Comments
 (0)