Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
RCasatta committed Nov 13, 2024
1 parent 05e9ab3 commit 874b42e
Show file tree
Hide file tree
Showing 4 changed files with 126 additions and 43 deletions.
111 changes: 68 additions & 43 deletions .github/workflows/bindings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ jobs:
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
- run: cargo build --release --target ${{ matrix.target }} -p lwk_bindings
- run: ls -l target/${{ matrix.target }}/release

Expand Down Expand Up @@ -78,6 +79,7 @@ jobs:
name: bindings-x86_64-unknown-linux-gnu
path: target/
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: |
cargo install uniffi-bindgen-cs --git https://github.com/RCasatta/uniffi-bindgen-cs --rev fa87c381f88c8cacd26cf3e91e5c63af60162c3f
uniffi-bindgen-cs --library target/liblwk.so --out-dir target
Expand All @@ -86,46 +88,69 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: bindings-interface-csharp
path: target/*.cs


# build-nuget:
# needs: build
# runs-on: ubuntu-22.04
# steps:
# - uses: actions/download-artifact@v4
# with:
# name: bindings-csharp
# path: lib/bindings/langs/csharp/src

# - uses: actions/download-artifact@v4
# with:
# name: bindings-aarch64-apple-darwin
# path: lib/bindings/langs/csharp/src/runtimes/osx-arm64/native

# - uses: actions/download-artifact@v4
# with:
# name: bindings-x86_64-apple-darwin
# path: lib/bindings/langs/csharp/src/runtimes/osx-x64/native

# - uses: actions/download-artifact@v4
# with:
# name: bindings-aarch64-unknown-linux-gnu
# path: lib/bindings/langs/csharp/src/runtimes/linux-arm64/native

# - uses: actions/download-artifact@v4
# with:
# name: bindings-x86_64-unknown-linux-gnu
# path: lib/bindings/langs/csharp/src/runtimes/linux-x64/native

# - uses: actions/download-artifact@v4
# with:
# name: bindings-x86_64-pc-windows-msvc
# path: lib/bindings/langs/csharp/src/runtimes/win-x64/native

# - uses: actions/download-artifact@v4
# with:
# name: bindings-i686-pc-windows-msvc
# path: lib/bindings/langs/csharp/src/runtimes/win-x86/native


path: target/lwk.cs

build-nuget:
needs: build
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4

- uses: actions/download-artifact@v4
with:
name: bindings-interface/csharp
path: csharp

- uses: actions/download-artifact@v4
with:
name: bindings-aarch64-apple-darwin
path: csharp/runtimes/osx-arm64/native

- uses: actions/download-artifact@v4
with:
name: bindings-x86_64-apple-darwin
path: csharp/runtimes/osx-x64/native

- uses: actions/download-artifact@v4
with:
name: bindings-aarch64-unknown-linux-gnu
path: csharp/runtimes/linux-arm64/native

- uses: actions/download-artifact@v4
with:
name: bindings-x86_64-unknown-linux-gnu
path: csharp/runtimes/linux-x64/native

- uses: actions/download-artifact@v4
with:
name: bindings-x86_64-pc-windows-msvc
path: csharp/runtimes/win-x64/native

- uses: actions/download-artifact@v4
with:
name: bindings-i686-pc-windows-msvc
path: csharp/runtimes/win-x86/native

- run: cp lwk_bindings/csharp/* csharp

- run: ls -R csharp

- name: Setup dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.0.x'

- name: Build the project
working-directory: csharp
run: dotnet build LiquidWalletKit

- name: Create the package
working-directory: csharp
run: dotnet pack --configuration Release LiquidWalletKit

- name: Archive the package
uses: actions/upload-artifact@v4
with:
name: LiquidWalletKit.0.8.2.nupkg # TODO make version parametric
path: csharp/bin/Release/*.nupkg
23 changes: 23 additions & 0 deletions lwk_bindings/csharp/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Except where noted in an individual source file, for sub-projects under the
subprojects/ directory, and noted below, this code is covered by the following
(BSD-MIT) license:

Copyright (c) Blockstream, Inc 2024

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
34 changes: 34 additions & 0 deletions lwk_bindings/csharp/LiquidWalletKit.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<PackageId>LiquidWalletKit</PackageId>
<Version>0.8.2</Version>
<Company>Blockstream</Company>
<Description>C# Liquid Wallet Kit</Description>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<EnablePackageValidation>true</EnablePackageValidation>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageProjectUrl>https://github.com/blockstream/lwk</PackageProjectUrl>
<RepositoryUrl>https://github.com/blockstream/lwk</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>bitcoin liquid blockstream sdk non-custodial</PackageTags>
<Copyright>2024 Blockstream</Copyright>
</PropertyGroup>

<ItemGroup>
<None Include="README.md" Pack="true" PackagePath="\"/>
<None Include="LICENSE" Pack="true" PackagePath="\"/>
</ItemGroup>

<ItemGroup>
<Content Include="runtimes/osx-arm64/native/liblwk.dylib" Link="runtimes/osx-arm64/native/liblwk.dylib" Pack="true" PackagePath="runtimes/osx-arm64/native/liblwk.dylib" />
<Content Include="runtimes/osx-x64/native/liblwk.dylib" Link="runtimes/osx-x64/native/liblwk.dylib" Pack="true" PackagePath="runtimes/osx-x64/native/liblwk.dylib" />
<Content Include="runtimes/linux-arm64/native/liblwk.so" Link="runtimes/linux-arm64/native/liblwk.so" Pack="true" PackagePath="runtimes/linux-arm64/native/liblwk.so" />
<Content Include="runtimes/linux-x64/native/liblwk.so" Link="runtimes/linux-x64/native/liblwk.so" Pack="true" PackagePath="runtimes/linux-x64/native/liblwk.so" />
<Content Include="runtimes/win-x64/native/lwk.dll" Link="runtimes/win-x64/native/lwk.dll" Pack="true" PackagePath="runtimes/win-x64/native/lwk.dll" />
<Content Include="runtimes/win-x86/native/lwk.dll" Link="runtimes/win-x86/native/lwk.dll" Pack="true" PackagePath="runtimes/win-x86/native/lwk.dll" />
</ItemGroup>
</Project>
1 change: 1 addition & 0 deletions lwk_bindings/csharp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# C# Liquid Wallet Kit

0 comments on commit 874b42e

Please sign in to comment.