Skip to content

Commit

Permalink
finish up
Browse files Browse the repository at this point in the history
  • Loading branch information
Kukks committed Jun 6, 2024
1 parent 4311bac commit e7f6c3c
Show file tree
Hide file tree
Showing 65 changed files with 1,175 additions and 389 deletions.
2 changes: 2 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github: [kukks]
custom: ['https://donate.kukks.org']
42 changes: 42 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: 'Publish application'
on: push

jobs:
build:
runs-on: ubuntu-latest
steps:
# Checkout the code
- uses: actions/checkout@v2

# Install .NET Core SDK
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 8.0.x

- name: Test
run: dotnet test

- name: Publish NuGet
if: ${{ github.ref == 'refs/heads/master' }} # Publish only when the push is on master
uses: Rebel028/[email protected]
with:
PROJECT_FILE_PATH: DotNut.Client/DotNut.csproj
NUGET_KEY: ${{secrets.NUGET_KEY}}
PACKAGE_NAME: DotNut
INCLUDE_SYMBOLS: false
VERSION_REGEX: ^\s*<PackageVersion>(.*)<\/PackageVersion>\s*$
TAG_COMMIT: true
TAG_FORMAT: DotNut/v*
- name: Publish Github Package Registry
if: ${{ github.ref == 'refs/heads/master' }} # Publish only when the push is on master
uses: Rebel028/[email protected]
with:
PROJECT_FILE_PATH: DotNut.Client/DotNut.Client.csproj
NUGET_SOURCE: "https://nuget.pkg.github.com/Kukks"
NUGET_KEY: ${{secrets.GH_TOKEN}}
PACKAGE_NAME: DotNut
INCLUDE_SYMBOLS: false
VERSION_REGEX: ^\s*<PackageVersion>(.*)<\/PackageVersion>\s*$
TAG_COMMIT: true
TAG_FORMAT: DotNut/v*
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
**/bin
**/obj
.idea
.idea
13 changes: 0 additions & 13 deletions .idea/.idea.DotNuts/.idea/.gitignore

This file was deleted.

4 changes: 0 additions & 4 deletions .idea/.idea.DotNuts/.idea/encodings.xml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/.idea.DotNuts/.idea/indexLayout.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/.idea.DotNuts/.idea/vcs.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\DotNuts\DotNuts.csproj" />
<ProjectReference Include="..\DotNut\DotNut.csproj" />
</ItemGroup>

</Project>
File renamed without changes.
180 changes: 166 additions & 14 deletions DotNuts.Tests/UnitTest1.cs → DotNut.Tests/UnitTest1.cs

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions DotNuts.sln → DotNut.sln
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotNuts", "DotNuts\DotNuts.csproj", "{997966AE-DC46-4473-9C82-A0F1750B2481}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotNut", "DotNut\DotNut.csproj", "{997966AE-DC46-4473-9C82-A0F1750B2481}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotNuts.Tests", "DotNuts.Tests\DotNuts.Tests.csproj", "{0AAAA85C-9FDC-4FD5-9CC2-ED8385B40106}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotNut.Tests", "DotNut.Tests\DotNut.Tests.csproj", "{0AAAA85C-9FDC-4FD5-9CC2-ED8385B40106}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
12 changes: 12 additions & 0 deletions DotNut.sln.DotSettings.user
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<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">
<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;
&lt;TestAncestor&gt;&#xD;
&lt;TestId&gt;xUnit::0AAAA85C-9FDC-4FD5-9CC2-ED8385B40106::net8.0::DotNuts.Tests.UnitTest1&lt;/TestId&gt;&#xD;
&lt;/TestAncestor&gt;&#xD;
&lt;/SessionState&gt;</s:String>
<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;
&lt;And&gt;&#xD;
&lt;Namespace&gt;DotNuts.Tests&lt;/Namespace&gt;&#xD;
&lt;Project Location="C:\Git\DotNuts\DotNuts.Tests" Presentation="&amp;lt;DotNuts.Tests&amp;gt;" /&gt;&#xD;
&lt;/And&gt;&#xD;
&lt;/SessionState&gt;</s:String></wpf:ResourceDictionary>
62 changes: 2 additions & 60 deletions DotNuts/CashuHttpClient.cs → DotNut/Api/CashuHttpClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
using System.Net.Http.Json;
using System.Text;
using System.Text.Json;
using System.Text.Json.Serialization;
using DotNut.ApiModels;

namespace DotNuts;
namespace DotNut.Api;

public class CashuHttpClient
{
Expand Down Expand Up @@ -107,62 +107,4 @@ protected async Task<T> HandleResponse<T>(HttpResponseMessage response, Cancella

return result!;
}
}

public class ProofSecretSet: Dictionary<string,ProofSecret>
{

}

public class ProofSecret
{

[JsonPropertyName("nonce")]
public string Nonce { get; set; }
[JsonPropertyName("data")]
public string Data { get; set; }
[JsonPropertyName("tags")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string[][]? Tags { get; set; }
}

public class PostRestoreRequest
{
[JsonPropertyName("outputs")]
public BlindedMessage[] Outputs { get; set; }
}public class PostRestoreResponse
{
[JsonPropertyName("outputs")]
public BlindedMessage[] Outputs { get; set; }
[JsonPropertyName("signatures")]
public BlindSignature[] Signatures { get; set; }
}

public class PostCheckStateRequest
{
[JsonPropertyName("Ys")]
public string[] Ys { get; set; }
}

public class PostCheckStateResponse
{

[JsonPropertyName("states")]
public StateResponseItem[] States { get; set; }
}

public class StateResponseItem
{

public string Y { get; set; }
[JsonConverter(typeof(JsonStringEnumConverter))]
public TokenState State { get; set; }
public string? Witness { get; set; }

public enum TokenState
{
UNSPENT,
PENDING,
SPENT
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System.Text.Json.Serialization;

namespace DotNut.Api;

public class CashuProtocolError
{
[JsonPropertyName("detail")] public string Detail { get; set; }

Check warning on line 7 in DotNut/Api/CashuProtocolError.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'Detail' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
public class CashuProtocolException : Exception
namespace DotNut.Api;

public class CashuProtocolException : Exception
{
public CashuProtocolException(CashuProtocolError error) : base(error.Detail)
{
Expand Down
16 changes: 16 additions & 0 deletions DotNut/ApiModels/GetInfoResponse.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System.Text.Json;
using System.Text.Json.Serialization;

namespace DotNut.ApiModels;

public class GetInfoResponse
{
[JsonPropertyName("name")] public string Name { get; set; }
[JsonPropertyName("pubkey")] public string Pubkey { get; set; }
[JsonPropertyName("version")] public string Version { get; set; }
[JsonPropertyName("description")] public string Description { get; set; }
[JsonPropertyName("description_long")] public string DescriptionLong { get; set; }
[JsonPropertyName("contact")] public List<List<string>> Contact { get; set; }
[JsonPropertyName("motd")] public string Motd { get; set; }
[JsonPropertyName("nuts")] public Dictionary<string, JsonDocument> Nuts { get; set; }
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Text.Json.Serialization;

namespace DotNuts;
namespace DotNut.ApiModels;

public class GetKeysResponse
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Text.Json.Serialization;

namespace DotNuts;
namespace DotNut.ApiModels;

public class GetKeysetsResponse
{
Expand Down
9 changes: 9 additions & 0 deletions DotNut/ApiModels/PostCheckStateRequest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using System.Text.Json.Serialization;

namespace DotNut.ApiModels;

public class PostCheckStateRequest
{
[JsonPropertyName("Ys")]
public string[] Ys { get; set; }
}
10 changes: 10 additions & 0 deletions DotNut/ApiModels/PostCheckStateResponse.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System.Text.Json.Serialization;

namespace DotNut.ApiModels;

public class PostCheckStateResponse
{

[JsonPropertyName("states")]
public StateResponseItem[] States { get; set; }
}
9 changes: 9 additions & 0 deletions DotNut/ApiModels/PostRestoreRequest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using System.Text.Json.Serialization;

namespace DotNut.ApiModels;

public class PostRestoreRequest
{
[JsonPropertyName("outputs")]
public BlindedMessage[] Outputs { get; set; }
}
11 changes: 11 additions & 0 deletions DotNut/ApiModels/PostRestoreResponse.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using System.Text.Json.Serialization;

namespace DotNut.ApiModels;

public class PostRestoreResponse
{
[JsonPropertyName("outputs")]
public BlindedMessage[] Outputs { get; set; }
[JsonPropertyName("signatures")]
public BlindSignature[] Signatures { get; set; }
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Text.Json.Serialization;

namespace DotNuts;
namespace DotNut.ApiModels;

public class PostSwapRequest
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Text.Json.Serialization;

namespace DotNuts;
namespace DotNut.ApiModels;

public class PostSwapResponse
{
Expand Down
19 changes: 19 additions & 0 deletions DotNut/ApiModels/StateResponseItem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System.Text.Json.Serialization;

namespace DotNut.ApiModels;

public class StateResponseItem
{

public string Y { get; set; }

Check warning on line 8 in DotNut/ApiModels/StateResponseItem.cs

View workflow job for this annotation

GitHub Actions / build

Non-nullable property 'Y' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
[JsonConverter(typeof(JsonStringEnumConverter))]
public TokenState State { get; set; }
public string? Witness { get; set; }

public enum TokenState
{
UNSPENT,
PENDING,
SPENT
}
}
8 changes: 8 additions & 0 deletions DotNuts/BlindSignature.cs → DotNut/BlindSignature.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using System.Text.Json.Serialization;
using DotNut.JsonConverters;

namespace DotNut;

public class BlindSignature
{
Expand All @@ -9,4 +12,9 @@ public class BlindSignature
public KeysetId Id { get; set; }

[JsonPropertyName("C_")] public PubKey C_ { get; set; }


[JsonPropertyName("dleq")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public DLEQProof? DLEQ { get; set; }
}
3 changes: 2 additions & 1 deletion DotNuts/BlindedMessage.cs → DotNut/BlindedMessage.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Text.Json.Serialization;
using NBitcoin.Secp256k1;

namespace DotNut;

public class BlindedMessage
{
Expand Down
Loading

0 comments on commit e7f6c3c

Please sign in to comment.