diff --git a/.github/workflows/build-language-bindings.yml b/.github/workflows/build-language-bindings.yml index dabc0b7..0cf8203 100644 --- a/.github/workflows/build-language-bindings.yml +++ b/.github/workflows/build-language-bindings.yml @@ -125,30 +125,30 @@ jobs: name: bindings-python path: lib/bindings/ffi/python/breez_sdk_liquid.py -# - name: Build C# binding -# if: ${{ inputs.csharp }} -# working-directory: lib/bindings -# run: | -# cargo install uniffi-bindgen-cs --git https://github.com/breez/uniffi-bindgen-cs --branch namespace -# uniffi-bindgen-cs src/breez_sdk_liquid.udl -o ffi/csharp -c ./uniffi.toml -# -# - name: Archive C# binding -# if: ${{ inputs.csharp }} -# uses: actions/upload-artifact@v4 -# with: -# name: bindings-csharp -# path: lib/bindings/ffi/csharp/breez_sdk_liquid.cs -# -# - name: Build golang binding -# if: ${{ inputs.golang }} -# working-directory: lib/bindings -# run: | -# cargo install uniffi-bindgen-go --git https://github.com/NordSecurity/uniffi-bindgen-go --tag v0.1.5+v0.23.0 -# uniffi-bindgen-go src/breez_sdk_liquid.udl -o ffi/golang -c ./uniffi.toml -# -# - name: Archive golang binding -# if: ${{ inputs.golang }} -# uses: actions/upload-artifact@v4 -# with: -# name: bindings-golang -# path: lib/bindings/ffi/golang/breez/breez_sdk_liquid/breez_sdk_liquid.* + - name: Build C# binding + if: ${{ inputs.csharp }} + working-directory: lib/bindings + run: | + cargo install uniffi-bindgen-cs --git https://github.com/NordSecurity/uniffi-bindgen-cs --tag v0.8.0+v0.25.0 + uniffi-bindgen-cs src/breez_sdk_liquid.udl -o ffi/csharp -c ./uniffi.toml + + - name: Archive C# binding + if: ${{ inputs.csharp }} + uses: actions/upload-artifact@v4 + with: + name: bindings-csharp + path: lib/bindings/ffi/csharp/breez_sdk_liquid.cs + + - name: Build golang binding + if: ${{ inputs.golang }} + working-directory: lib/bindings + run: | + cargo install uniffi-bindgen-go --git https://github.com/NordSecurity/uniffi-bindgen-go --tag v0.2.1+v0.25.0 + uniffi-bindgen-go src/breez_sdk_liquid.udl -o ffi/golang -c ./uniffi.toml + + - name: Archive golang binding + if: ${{ inputs.golang }} + uses: actions/upload-artifact@v4 + with: + name: bindings-golang + path: lib/bindings/ffi/golang/breez_sdk_liquid/breez_sdk_liquid.* diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 01fc8a6..2627b1d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -98,6 +98,26 @@ jobs: working-directory: lib/bindings run: cargo build + - name: Build C# bindings + working-directory: lib/bindings + run: | + cargo install uniffi-bindgen-cs --git https://github.com/NordSecurity/uniffi-bindgen-cs --tag v0.8.0+v0.25.0 + uniffi-bindgen-cs src/breez_sdk_liquid.udl -o ffi/csharp -c ./uniffi.toml + cp ../target/debug/libbreez_sdk_liquid_bindings.so ffi/csharp + + - name: Build golang bindings + working-directory: lib/bindings + run: | + cargo install uniffi-bindgen-go --git https://github.com/NordSecurity/uniffi-bindgen-go --tag v0.2.1+v0.25.0 + uniffi-bindgen-go src/breez_sdk_liquid.udl -o ffi/golang -c ./uniffi.toml + cp ../target/debug/libbreez_sdk_liquid_bindings.so ffi/golang + cp -r ffi/golang/breez_sdk_liquid tests/bindings/golang/ + + - name: Setup go + uses: actions/setup-go@v4 + with: + go-version: '1.19.9' + - name: Setup python uses: actions/setup-python@v4 with: diff --git a/.github/workflows/publish-all-platforms.yml b/.github/workflows/publish-all-platforms.yml index b3f521d..3dd6905 100644 --- a/.github/workflows/publish-all-platforms.yml +++ b/.github/workflows/publish-all-platforms.yml @@ -191,23 +191,23 @@ jobs: python: ${{ needs.setup.outputs.python == 'true'}} swift: ${{ needs.setup.outputs.swift == 'true'}} -# publish-csharp: -# needs: -# - setup -# - build-bindings-windows -# - build-bindings-darwin -# - build-bindings-linux -# - build-language-bindings -# if: ${{ needs.setup.outputs.csharp == 'true' }} -# uses: ./.github/workflows/publish-csharp.yml -# with: -# repository: ${{ needs.setup.outputs.repository }} -# ref: ${{ needs.setup.outputs.csharp-ref }} -# package-version: ${{ needs.setup.outputs.csharp-package-version }} -# publish: ${{ needs.setup.outputs.publish == 'true' }} -# skip-tests: true -# secrets: -# NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} + publish-csharp: + needs: + - setup + - build-bindings-windows + - build-bindings-darwin + - build-bindings-linux + - build-language-bindings + if: ${{ needs.setup.outputs.csharp == 'true' }} + uses: ./.github/workflows/publish-csharp.yml + with: + repository: ${{ needs.setup.outputs.repository }} + ref: ${{ needs.setup.outputs.csharp-ref }} + package-version: ${{ needs.setup.outputs.csharp-package-version }} + publish: ${{ needs.setup.outputs.publish == 'true' }} + skip-tests: true + secrets: + NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} publish-dart: needs: @@ -221,23 +221,23 @@ jobs: publish: ${{ needs.setup.outputs.publish == 'true' }} secrets: REPO_SSH_KEY: ${{ secrets.REPO_SSH_KEY }} -# -# publish-golang: -# needs: -# - setup -# - build-bindings-android -# - build-bindings-windows -# - build-bindings-darwin -# - build-bindings-linux -# - build-language-bindings -# if: ${{ needs.setup.outputs.golang == 'true' }} -# uses: ./.github/workflows/publish-golang.yml -# with: -# ref: ${{ needs.setup.outputs.ref }} -# package-version: ${{ needs.setup.outputs.golang-package-version }} -# publish: ${{ needs.setup.outputs.publish == 'true' }} -# secrets: -# REPO_SSH_KEY: ${{ secrets.REPO_SSH_KEY }} + + publish-golang: + needs: + - setup + - build-bindings-android + - build-bindings-windows + - build-bindings-darwin + - build-bindings-linux + - build-language-bindings + if: ${{ needs.setup.outputs.golang == 'true' }} + uses: ./.github/workflows/publish-golang.yml + with: + ref: ${{ needs.setup.outputs.ref }} + package-version: ${{ needs.setup.outputs.golang-package-version }} + publish: ${{ needs.setup.outputs.publish == 'true' }} + secrets: + REPO_SSH_KEY: ${{ secrets.REPO_SSH_KEY }} publish-maven: needs: diff --git a/.github/workflows/publish-csharp.yml b/.github/workflows/publish-csharp.yml index 257e74d..81b911c 100644 --- a/.github/workflows/publish-csharp.yml +++ b/.github/workflows/publish-csharp.yml @@ -77,7 +77,7 @@ jobs: - name: Update package version if: ${{ inputs.package-version }} working-directory: lib/bindings/langs/csharp/src - run: sed -i.bak -e 's/.*<\/Version>/${{ inputs.package-version }}<\/Version>/' Breez.Liquid.Sdk.csproj + run: sed -i.bak -e 's/.*<\/Version>/${{ inputs.package-version }}<\/Version>/' Breez.Sdk.Liquid.csproj - name: Setup dotnet uses: actions/setup-dotnet@v3 @@ -86,17 +86,17 @@ jobs: - name: Build the project working-directory: lib/bindings/langs/csharp/src - run: dotnet build Breez.Liquid.Sdk.csproj + run: dotnet build Breez.Sdk.Liquid.csproj - name: Create the package working-directory: lib/bindings/langs/csharp/src - run: dotnet pack --configuration Release Breez.Liquid.Sdk.csproj + run: dotnet pack --configuration Release Breez.Sdk.Liquid.csproj - name: Archive the package uses: actions/upload-artifact@v4 with: - name: Breez.Liquid.Sdk.${{ inputs.package-version || '0.0.1' }}.nupkg - path: lib/bindings/langs/csharp/src/bin/Release/Breez.Liquid.Sdk.*.nupkg + name: Breez.Sdk.Liquid.${{ inputs.package-version || '0.0.1' }}.nupkg + path: lib/bindings/langs/csharp/src/bin/Release/Breez.Sdk.Liquid.*.nupkg test-package: needs: build-package @@ -120,7 +120,7 @@ jobs: - uses: actions/download-artifact@v4 if: ${{ !inputs.skip-tests }} with: - name: Breez.Liquid.Sdk.${{ inputs.package-version || '0.0.1' }}.nupkg + name: Breez.Sdk.Liquid.${{ inputs.package-version || '0.0.1' }}.nupkg path: lib/bindings/langs/csharp/src/bin/Release - name: Setup dotnet @@ -142,9 +142,9 @@ jobs: - name: Download archived package uses: actions/download-artifact@v4 with: - name: Breez.Liquid.Sdk.${{ inputs.package-version }}.nupkg + name: Breez.Sdk.Liquid.${{ inputs.package-version }}.nupkg - name: Publish to nuget.org env: NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} - run: dotnet nuget push Breez.Liquid.Sdk.${{ inputs.package-version }}.nupkg --api-key "$NUGET_API_KEY" --source https://api.nuget.org/v3/index.json + run: dotnet nuget push Breez.Sdk.Liquid.${{ inputs.package-version }}.nupkg --api-key "$NUGET_API_KEY" --source https://api.nuget.org/v3/index.json diff --git a/lib/Cargo.lock b/lib/Cargo.lock index 870899f..5996575 100644 --- a/lib/Cargo.lock +++ b/lib/Cargo.lock @@ -691,7 +691,7 @@ dependencies = [ "once_cell", "thiserror", "tokio", - "uniffi 0.27.3", + "uniffi 0.25.3", "uniffi_bindgen 0.25.3", "uniffi_bindgen_kotlin_multiplatform", ] @@ -1425,18 +1425,7 @@ checksum = "0d6b4de4a8eb6c46a8c77e1d3be942cb9a8bf073c22374578e5ba4b08ed0ff68" dependencies = [ "log", "plain", - "scroll 0.11.0", -] - -[[package]] -name = "goblin" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b363a30c165f666402fe6a3024d3bec7ebc898f96a4a23bd1c99f8dbf3f4f47" -dependencies = [ - "log", - "plain", - "scroll 0.12.0", + "scroll", ] [[package]] @@ -2234,6 +2223,12 @@ version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +[[package]] +name = "oneshot-uniffi" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c548d5c78976f6955d72d0ced18c48ca07030f7a1d4024529fedd7c1c01b29c" + [[package]] name = "opaque-debug" version = "0.3.1" @@ -3048,16 +3043,7 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04c565b551bafbef4157586fa379538366e4385d42082f255bfd96e4fe8519da" dependencies = [ - "scroll_derive 0.11.1", -] - -[[package]] -name = "scroll" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ab8598aa408498679922eff7fa985c25d58a90771bd6be794434c5277eab1a6" -dependencies = [ - "scroll_derive 0.12.0", + "scroll_derive", ] [[package]] @@ -3071,17 +3057,6 @@ dependencies = [ "syn 2.0.75", ] -[[package]] -name = "scroll_derive" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f81c2fde025af7e69b1d1420531c8a8811ca898919db177141a85313b1cb932" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.75", -] - [[package]] name = "sct" version = "0.7.1" @@ -3377,12 +3352,6 @@ version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" -[[package]] -name = "smawk" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7c388c1b5e93756d0c740965c41e8822f866621d41acbdf6336a6a168f8840c" - [[package]] name = "socket2" version = "0.5.7" @@ -3560,9 +3529,6 @@ name = "textwrap" version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23d434d3f8967a09480fb04132ebe0a3e088c173e6d0ee7897abbdf4eab0f8b9" -dependencies = [ - "smawk", -] [[package]] name = "thiserror" @@ -3927,17 +3893,17 @@ dependencies = [ [[package]] name = "uniffi" -version = "0.27.3" +version = "0.25.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb3a4c447c50fcda7bc5604a8588b7e1f37ffbfd8838a1516a290398efa7c6f0" +checksum = "21345172d31092fd48c47fd56c53d4ae9e41c4b1f559fb8c38c1ab1685fd919f" dependencies = [ "anyhow", "camino", "clap 4.5.16", - "uniffi_bindgen 0.27.3", - "uniffi_build 0.27.3", - "uniffi_core 0.27.3", - "uniffi_macros 0.27.3", + "uniffi_bindgen 0.25.3", + "uniffi_build 0.25.3", + "uniffi_core 0.25.3", + "uniffi_macros 0.25.3", ] [[package]] @@ -3952,7 +3918,7 @@ dependencies = [ "camino", "fs-err", "glob", - "goblin 0.6.1", + "goblin", "heck 0.4.1", "once_cell", "paste", @@ -3961,7 +3927,7 @@ dependencies = [ "toml", "uniffi_meta 0.23.0", "uniffi_testing 0.23.0", - "weedle2 4.0.0", + "weedle2", ] [[package]] @@ -3974,9 +3940,10 @@ dependencies = [ "askama 0.12.1", "camino", "cargo_metadata", + "clap 4.5.16", "fs-err", "glob", - "goblin 0.6.1", + "goblin", "heck 0.4.1", "once_cell", "paste", @@ -3984,32 +3951,7 @@ dependencies = [ "toml", "uniffi_meta 0.25.3", "uniffi_testing 0.25.3", - "uniffi_udl 0.25.3", -] - -[[package]] -name = "uniffi_bindgen" -version = "0.27.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0be2bc6bafd82c979b0faca77c7b26630d54017de9f5bd5a686ec6ef038ad5d9" -dependencies = [ - "anyhow", - "askama 0.12.1", - "camino", - "cargo_metadata", - "clap 4.5.16", - "fs-err", - "glob", - "goblin 0.8.2", - "heck 0.4.1", - "once_cell", - "paste", - "serde", - "textwrap", - "toml", - "uniffi_meta 0.27.3", - "uniffi_testing 0.27.3", - "uniffi_udl 0.27.3", + "uniffi_udl", ] [[package]] @@ -4042,13 +3984,13 @@ dependencies = [ [[package]] name = "uniffi_build" -version = "0.27.3" +version = "0.25.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c59b65d59685ff3a10569287c6419f76487b4052ac52d5a0df38b2253d7f440" +checksum = "001964dd3682d600084b3aaf75acf9c3426699bc27b65e96bb32d175a31c74e9" dependencies = [ "anyhow", "camino", - "uniffi_bindgen 0.27.3", + "uniffi_bindgen 0.25.3", ] [[package]] @@ -4071,16 +4013,6 @@ dependencies = [ "syn 2.0.75", ] -[[package]] -name = "uniffi_checksum_derive" -version = "0.27.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5c400339a9d1d17be34257d0b407e91d64af335e5b4fa49f4bf28467fc8d635" -dependencies = [ - "quote", - "syn 2.0.75", -] - [[package]] name = "uniffi_core" version = "0.23.0" @@ -4099,15 +4031,16 @@ dependencies = [ [[package]] name = "uniffi_core" -version = "0.27.3" +version = "0.25.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a02e67ac9634b10da9e4aa63a29a7920b8f1395eafef1ea659b2dd76dda96906" +checksum = "6121a127a3af1665cd90d12dd2b3683c2643c5103281d0fed5838324ca1fad5b" dependencies = [ "anyhow", "bytes", "camino", "log", "once_cell", + "oneshot-uniffi", "paste", "static_assertions", ] @@ -4133,9 +4066,9 @@ dependencies = [ [[package]] name = "uniffi_macros" -version = "0.27.3" +version = "0.25.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6f08d5592c669b80a8af5066027098bebec4b4af17a9b8b299bac5f518ab89e" +checksum = "11cf7a58f101fcedafa5b77ea037999b88748607f0ef3a33eaa0efc5392e92e4" dependencies = [ "bincode", "camino", @@ -4146,7 +4079,8 @@ dependencies = [ "serde", "syn 2.0.75", "toml", - "uniffi_meta 0.27.3", + "uniffi_build 0.25.3", + "uniffi_meta 0.25.3", ] [[package]] @@ -4172,18 +4106,6 @@ dependencies = [ "uniffi_checksum_derive 0.25.3", ] -[[package]] -name = "uniffi_meta" -version = "0.27.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "583bab49f2bdf5681f9732f8b67a7e555ad920dbb5427be21450217bf1818189" -dependencies = [ - "anyhow", - "bytes", - "siphasher", - "uniffi_checksum_derive 0.27.3", -] - [[package]] name = "uniffi_testing" version = "0.23.0" @@ -4212,19 +4134,6 @@ dependencies = [ "once_cell", ] -[[package]] -name = "uniffi_testing" -version = "0.27.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13963044ca9bde9b709d2eee68bc11dafc7acea144ae0fdc0cf29ed4add44481" -dependencies = [ - "anyhow", - "camino", - "cargo_metadata", - "fs-err", - "once_cell", -] - [[package]] name = "uniffi_udl" version = "0.25.3" @@ -4234,20 +4143,7 @@ dependencies = [ "anyhow", "uniffi_meta 0.25.3", "uniffi_testing 0.25.3", - "weedle2 4.0.0", -] - -[[package]] -name = "uniffi_udl" -version = "0.27.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b92f984bb0d9a06778f256aec963e1e9a80714014f7a90fb0e01008821fe5a97" -dependencies = [ - "anyhow", - "textwrap", - "uniffi_meta 0.27.3", - "uniffi_testing 0.27.3", - "weedle2 5.0.0", + "weedle2", ] [[package]] @@ -4491,15 +4387,6 @@ dependencies = [ "nom", ] -[[package]] -name = "weedle2" -version = "5.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "998d2c24ec099a87daf9467808859f9d82b61f1d9c9701251aea037f514eae0e" -dependencies = [ - "nom", -] - [[package]] name = "which" version = "4.4.2" diff --git a/lib/Cargo.toml b/lib/Cargo.toml index 43aa916..a6da766 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -35,8 +35,9 @@ anyhow = "1.0" log = "0.4.20" once_cell = "1.19" thiserror = "1.0" -uniffi = "0.27.1" -uniffi_macros = "0.27.1" +# Version must match that used by uniffi-bindgen-go +uniffi = "0.25.0" +uniffi_macros = "0.25.0" [patch.crates-io] # https://github.com/BlockstreamResearch/rust-secp256k1-zkp/pull/48/commits diff --git a/lib/bindings/langs/csharp/README.md b/lib/bindings/langs/csharp/README.md new file mode 100644 index 0000000..f1488d0 --- /dev/null +++ b/lib/bindings/langs/csharp/README.md @@ -0,0 +1,15 @@ +# Breez Liquid SDK — C#.Net Bindings + +## Usage +``` +dotnet add package Breez.Sdk.Liquid +``` + +## Create a package +Run the GitHub workflow 'Publish C# Bindings' when creating a new release of Breez Liquid SDK. +It will create an artifact containing a zip file with the nuget package in it. + +## Publish package + +- Manually upload the package to the breeztech nuget organization, or +- `dotnet nuget push ./bin/Debug/Breez.Sdk.Liquid.{version}.nupkg --api-key PUT-API-KEY-HERE --source https://api.nuget.org/v3/index.json` \ No newline at end of file diff --git a/lib/bindings/langs/csharp/src/.gitignore b/lib/bindings/langs/csharp/src/.gitignore new file mode 100644 index 0000000..f9e3ea4 --- /dev/null +++ b/lib/bindings/langs/csharp/src/.gitignore @@ -0,0 +1,481 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET +project.lock.json +project.fragment.lock.json +artifacts/ + +# Tye +.tye/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.tlog +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio 6 auto-generated project file (contains which files were open etc.) +*.vbp + +# Visual Studio 6 workspace and project file (working project files containing files to include in project) +*.dsw +*.dsp + +# Visual Studio 6 technical files +*.ncb +*.aps + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# Visual Studio History (VSHistory) files +.vshistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +# VS Code files for those working on multiple tools +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +*.code-workspace + +# Local History for Visual Studio Code +.history/ + +# Windows Installer files from build outputs +*.cab +*.msi +*.msix +*.msm +*.msp + +# JetBrains Rider +*.sln.iml + +## +## Visual studio for Mac +## + + +# globs +Makefile.in +*.userprefs +*.usertasks +config.make +config.status +aclocal.m4 +install-sh +autom4te.cache/ +*.tar.gz +tarballs/ +test-results/ + +# Mac bundle stuff +*.dmg +*.app + +# content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore +# Windows thumbnail cache files +Thumbs.db +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +# Files generated for the build +runtimes/* +breez_sdk_liquid.cs diff --git a/lib/bindings/langs/csharp/src/Breez.Sdk.Liquid.csproj b/lib/bindings/langs/csharp/src/Breez.Sdk.Liquid.csproj new file mode 100644 index 0000000..7da8d9b --- /dev/null +++ b/lib/bindings/langs/csharp/src/Breez.Sdk.Liquid.csproj @@ -0,0 +1,34 @@ + + + Breez.Sdk.Liquid + 0.0.1 + Breez + C# Breez Liquid SDK + net6.0 + enable + enable + true + true + README.md + LICENSE + https://breez.technology/sdk/ + https://github.com/breez/breez-sdk-liquid + git + bitcoin lightning liquid breez sdk non-custodial + 2024 Breez + + + + + + + + + + + + + + + + diff --git a/lib/bindings/langs/csharp/test/.gitignore b/lib/bindings/langs/csharp/test/.gitignore new file mode 100644 index 0000000..af175a3 --- /dev/null +++ b/lib/bindings/langs/csharp/test/.gitignore @@ -0,0 +1,457 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# Tye +.tye/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +## +## Visual studio for Mac +## + + +# globs +Makefile.in +*.userprefs +*.usertasks +config.make +config.status +aclocal.m4 +install-sh +autom4te.cache/ +*.tar.gz +tarballs/ +test-results/ + +# Mac bundle stuff +*.dmg +*.app + +# content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore +# Windows thumbnail cache files +Thumbs.db +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +# JetBrains Rider +.idea/ +*.sln.iml + +## +## Visual Studio Code +## +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json + +## Breez specific files +*.sql diff --git a/lib/bindings/langs/csharp/test/Program.cs b/lib/bindings/langs/csharp/test/Program.cs new file mode 100644 index 0000000..8c2832b --- /dev/null +++ b/lib/bindings/langs/csharp/test/Program.cs @@ -0,0 +1,21 @@ + +using Breez.Sdk.Liquid; + +try +{ + var mnemonic = "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about"; + + var config = BreezSdkLiquidMethods.DefaultConfig(LiquidNetwork.Testnet); + + var connectReq = new ConnectRequest(config, mnemonic); + BindingLiquidSdk sdk = BreezSdkLiquidMethods.Connect(connectReq); + + GetInfoResponse? info = sdk.GetInfo(); + + Console.WriteLine(info!.pubkey); +} +catch (Exception e) +{ + Console.WriteLine(e.Message); + throw; +} diff --git a/lib/bindings/langs/csharp/test/readme.md b/lib/bindings/langs/csharp/test/readme.md new file mode 100644 index 0000000..47fc1cb --- /dev/null +++ b/lib/bindings/langs/csharp/test/readme.md @@ -0,0 +1,2 @@ +This program is used by the C# nuget CI workflow to test the generated nuget +package on multiple platforms. \ No newline at end of file diff --git a/lib/bindings/langs/csharp/test/sdk-cs-demo.csproj b/lib/bindings/langs/csharp/test/sdk-cs-demo.csproj new file mode 100644 index 0000000..e1d9ca4 --- /dev/null +++ b/lib/bindings/langs/csharp/test/sdk-cs-demo.csproj @@ -0,0 +1,17 @@ + + + Exe + net6.0 + sdk_cs_demo + enable + enable + + + + $(RestoreSources);../src/bin/Release;https://api.nuget.org/v3/index.json + + + + + + diff --git a/lib/bindings/langs/swift/Package.swift b/lib/bindings/langs/swift/Package.swift index ec10a62..c7881b7 100644 --- a/lib/bindings/langs/swift/Package.swift +++ b/lib/bindings/langs/swift/Package.swift @@ -6,8 +6,10 @@ import PackageDescription let package = Package( name: "bindings-swift", platforms: [ - .macOS(.v12), - .iOS(.v11), + // Required by uniffi 0.25 + // Can be reverted to v12/v11 for uniffi 0.27 + .macOS(.v15), + .iOS(.v13), ], products: [ .library(name: "BreezSDKLiquid", targets: ["breez_sdk_liquidFFI", "BreezSDKLiquid"]), diff --git a/lib/bindings/makefile b/lib/bindings/makefile index 9e2f97f..c12fc3e 100644 --- a/lib/bindings/makefile +++ b/lib/bindings/makefile @@ -127,6 +127,31 @@ bindings-swift: ios-universal darwin-universal rm langs/swift/Sources/BreezSDKLiquid/breez_sdk_liquidFFI.h rm langs/swift/Sources/BreezSDKLiquid/breez_sdk_liquidFFI.modulemap +csharp-darwin: darwin-universal + cargo install uniffi-bindgen-cs --git https://github.com/NordSecurity/uniffi-bindgen-cs --tag v0.8.0+v0.25.0 + uniffi-bindgen-cs src/breez_sdk_liquid.udl -o ffi/csharp -c ./uniffi.toml + cp ../target/darwin-universal/release/libbreez_sdk_liquid_bindings.dylib ffi/csharp + +csharp-linux: $(SOURCES) + cargo install uniffi-bindgen-cs --git https://github.com/NordSecurity/uniffi-bindgen-cs --tag v0.8.0+v0.25.0 + cargo build --release --target $(TARGET) + uniffi-bindgen-cs src/breez_sdk_liquid.udl -o ffi/csharp -c ./uniffi.toml + cp ../target/$(TARGET)/release/libbreez_sdk_liquid_bindings.so ffi/csharp + +## Go +golang-darwin: darwin-universal + cargo install uniffi-bindgen-go --git https://github.com/NordSecurity/uniffi-bindgen-go --tag v0.2.1+v0.25.0 + uniffi-bindgen-go src/breez_sdk_liquid.udl -o ffi/golang -c ./uniffi.toml + cp ../target/darwin-universal/release/libbreez_sdk_liquid_bindings.dylib ffi/golang + cp -r ffi/golang/breez_sdk_liquid tests/bindings/golang/ + +golang-linux: $(SOURCES) + cargo install uniffi-bindgen-go --git https://github.com/NordSecurity/uniffi-bindgen-go --tag v0.2.1+v0.25.0 + cargo build --release --target $(TARGET) + uniffi-bindgen-go src/breez_sdk_liquid.udl -o ffi/golang -c ./uniffi.toml + cp ../target/$(TARGET)/release/libbreez_sdk_liquid_bindings.so ffi/golang + cp -r ffi/golang/breez_sdk_liquid tests/bindings/golang/ + ## Python python-linux: $(SOURCES) cargo build --release --target $(TARGET) diff --git a/lib/bindings/src/breez_sdk_liquid.udl b/lib/bindings/src/breez_sdk_liquid.udl index bc3d0bc..50b1a2c 100644 --- a/lib/bindings/src/breez_sdk_liquid.udl +++ b/lib/bindings/src/breez_sdk_liquid.udl @@ -450,14 +450,14 @@ interface PaymentDetails { }; dictionary Payment { - string? destination; - string? tx_id = null; u32 timestamp; u64 amount_sat; u64 fees_sat; PaymentType payment_type; PaymentState status; - PaymentDetails? details; + string? destination = null; + string? tx_id = null; + PaymentDetails? details = null; }; enum PaymentType { diff --git a/lib/bindings/tests/bindings/csharp/.gitignore b/lib/bindings/tests/bindings/csharp/.gitignore new file mode 100644 index 0000000..af175a3 --- /dev/null +++ b/lib/bindings/tests/bindings/csharp/.gitignore @@ -0,0 +1,457 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# Tye +.tye/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +## +## Visual studio for Mac +## + + +# globs +Makefile.in +*.userprefs +*.usertasks +config.make +config.status +aclocal.m4 +install-sh +autom4te.cache/ +*.tar.gz +tarballs/ +test-results/ + +# Mac bundle stuff +*.dmg +*.app + +# content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore +# Windows thumbnail cache files +Thumbs.db +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +# JetBrains Rider +.idea/ +*.sln.iml + +## +## Visual Studio Code +## +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json + +## Breez specific files +*.sql diff --git a/lib/bindings/tests/bindings/csharp/Program.cs b/lib/bindings/tests/bindings/csharp/Program.cs new file mode 100644 index 0000000..9576d38 --- /dev/null +++ b/lib/bindings/tests/bindings/csharp/Program.cs @@ -0,0 +1,20 @@ + +using Breez.Sdk.Liquid; + +try +{ + var mnemonic = "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about"; + + var config = BreezSdkLiquidMethods.DefaultConfig(LiquidNetwork.Testnet); + + var connectReq = new ConnectRequest(config, mnemonic); + BindingLiquidSdk sdk = BreezSdkLiquidMethods.Connect(connectReq); + + GetInfoResponse? info = sdk.GetInfo(); + + Console.WriteLine(info!.pubkey); +} +catch (Exception e) +{ + Console.WriteLine(e.Message); +} diff --git a/lib/bindings/tests/bindings/csharp/sdk-cs-demo.csproj b/lib/bindings/tests/bindings/csharp/sdk-cs-demo.csproj new file mode 100644 index 0000000..eee5dbd --- /dev/null +++ b/lib/bindings/tests/bindings/csharp/sdk-cs-demo.csproj @@ -0,0 +1,19 @@ + + + Exe + net7.0 + sdk_cs_demo + enable + enable + true + + + + + PreserveNewest + + + PreserveNewest + + + diff --git a/lib/bindings/tests/bindings/golang/.gitignore b/lib/bindings/tests/bindings/golang/.gitignore new file mode 100644 index 0000000..655547b --- /dev/null +++ b/lib/bindings/tests/bindings/golang/.gitignore @@ -0,0 +1,3 @@ +breez_sdk_liquid.* +liquid*/ +*.sql diff --git a/lib/bindings/tests/bindings/golang/go.mod b/lib/bindings/tests/bindings/golang/go.mod new file mode 100644 index 0000000..b4d5a57 --- /dev/null +++ b/lib/bindings/tests/bindings/golang/go.mod @@ -0,0 +1,3 @@ +module example.org/golang + +go 1.19 diff --git a/lib/bindings/tests/bindings/golang/test_breez_sdk_liquid.go b/lib/bindings/tests/bindings/golang/test_breez_sdk_liquid.go new file mode 100644 index 0000000..ad5431d --- /dev/null +++ b/lib/bindings/tests/bindings/golang/test_breez_sdk_liquid.go @@ -0,0 +1,30 @@ +package main + +import ( + "log" + + "example.org/golang/breez_sdk_liquid" +) + +func main() { + mnemonic := "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about" + + config := breez_sdk_liquid.DefaultConfig(breez_sdk_liquid.LiquidNetworkTestnet) + + sdk, err := breez_sdk_liquid.Connect(breez_sdk_liquid.ConnectRequest{ + Config: config, + Mnemonic: mnemonic, + }) + + if err != nil { + log.Fatalf("Connect failed: %#v", err) + } + + info, err := sdk.GetInfo() + + if err != nil { + log.Fatalf("GetInfo failed: %#v", err) + } + + log.Print(info.Pubkey) +} diff --git a/lib/bindings/tests/bindings/test_breez_liquid_sdk.cs b/lib/bindings/tests/bindings/test_breez_liquid_sdk.cs new file mode 100644 index 0000000..95ebb4d --- /dev/null +++ b/lib/bindings/tests/bindings/test_breez_liquid_sdk.cs @@ -0,0 +1,21 @@ + +using breez_sdk_liquid.breez_sdk_liquid; + +try +{ + var mnemonic = "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about"; + + var config = BreezSdkLiquidMethods.DefaultConfig(LiquidNetwork.Testnet); + + var connectReq = new ConnectRequest(config, mnemonic); + BindingLiquidSdk sdk = BreezSdkLiquidMethods.Connect(connectReq); + + GetInfoResponse? info = sdk.GetInfo(); + + Console.WriteLine(info!.pubkey); +} +catch (Exception e) +{ + Console.WriteLine(e.Message); + throw; +} diff --git a/lib/bindings/tests/test_generated_bindings.rs b/lib/bindings/tests/test_generated_bindings.rs index f6c2d33..e76a9a6 100644 --- a/lib/bindings/tests/test_generated_bindings.rs +++ b/lib/bindings/tests/test_generated_bindings.rs @@ -1,5 +1,40 @@ +use std::process::Command; + uniffi::build_foreign_language_testcases!( "tests/bindings/test_breez_sdk_liquid.swift", "tests/bindings/test_breez_sdk_liquid.kts", "tests/bindings/test_breez_sdk_liquid.py" ); + +#[test] +fn test_csharp() { + let output = Command::new("dotnet") + .arg("run") + .arg("--project") + .arg("tests/bindings/csharp/sdk-cs-demo.csproj") + .output() + .expect("failed to execute process"); + println!("status: {}", output.status); + println!("stdout: {}", String::from_utf8_lossy(&output.stdout)); + println!("stderr: {}", String::from_utf8_lossy(&output.stderr)); + assert!(output.status.success()); +} + +#[test] +fn test_golang() { + let output = Command::new("go") + .env( + "CGO_LDFLAGS", + "-lbreez_sdk_liquid_bindings -L../../../ffi/golang -Wl,-rpath,../../../ffi/golang", + ) + .env("CGO_ENABLED", "1") + .current_dir("tests/bindings/golang/") + .arg("run") + .arg("./") + .output() + .expect("failed to execute process"); + println!("status: {}", output.status); + println!("stdout: {}", String::from_utf8_lossy(&output.stdout)); + println!("stderr: {}", String::from_utf8_lossy(&output.stderr)); + assert!(output.status.success()); +} diff --git a/lib/bindings/uniffi.toml b/lib/bindings/uniffi.toml index 94a70ad..588f037 100644 --- a/lib/bindings/uniffi.toml +++ b/lib/bindings/uniffi.toml @@ -10,3 +10,14 @@ cdylib_name = "breez_sdk_liquid_bindings" # https://mozilla.github.io/uniffi-rs/python/configuration.html [bindings.python] cdylib_name = "breez_sdk_liquid_bindings" + +# https://github.com/NordSecurity/uniffi-bindgen-cs/blob/main/docs/CONFIGURATION.md +[bindings.csharp] +package_name = "breez_sdk_liquid" +cdylib_name = "breez_sdk_liquid_bindings" +namespace = "Breez.Sdk.Liquid" + +# https://github.com/NordSecurity/uniffi-bindgen-go/blob/main/docs/CONFIGURATION.md +[bindings.go] +package_name = "breez_sdk_liquid" +cdylib_name = "breez_sdk_liquid_bindings" diff --git a/packages/react-native/BreezSDKLiquid.podspec.dev b/packages/react-native/BreezSDKLiquid.podspec.dev index 6222749..23cc186 100644 --- a/packages/react-native/BreezSDKLiquid.podspec.dev +++ b/packages/react-native/BreezSDKLiquid.podspec.dev @@ -10,7 +10,7 @@ Pod::Spec.new do |s| s.license = package["license"] s.authors = package["author"] - s.platforms = { :ios => "11.0" } + s.platforms = { :ios => "13.0" } s.source = { :git => "https://github.com/breez/breez-sdk-liquid.git", :tag => "#{s.version}" } s.source_files = "ios/**/*.{h,m,mm,swift}" diff --git a/packages/react-native/android/src/main/java/com/breezsdkliquid/BreezSDKLiquidMapper.kt b/packages/react-native/android/src/main/java/com/breezsdkliquid/BreezSDKLiquidMapper.kt index d0d7516..115d368 100644 --- a/packages/react-native/android/src/main/java/com/breezsdkliquid/BreezSDKLiquidMapper.kt +++ b/packages/react-native/android/src/main/java/com/breezsdkliquid/BreezSDKLiquidMapper.kt @@ -1156,26 +1156,26 @@ fun asPayment(payment: ReadableMap): Payment? { ) { return null } - val destination = if (hasNonNullKey(payment, "destination")) payment.getString("destination") else null - val txId = if (hasNonNullKey(payment, "txId")) payment.getString("txId") else null val timestamp = payment.getInt("timestamp").toUInt() val amountSat = payment.getDouble("amountSat").toULong() val feesSat = payment.getDouble("feesSat").toULong() val paymentType = payment.getString("paymentType")?.let { asPaymentType(it) }!! val status = payment.getString("status")?.let { asPaymentState(it) }!! + val destination = if (hasNonNullKey(payment, "destination")) payment.getString("destination") else null + val txId = if (hasNonNullKey(payment, "txId")) payment.getString("txId") else null val details = if (hasNonNullKey(payment, "details")) payment.getMap("details")?.let { asPaymentDetails(it) } else null - return Payment(destination, txId, timestamp, amountSat, feesSat, paymentType, status, details) + return Payment(timestamp, amountSat, feesSat, paymentType, status, destination, txId, details) } fun readableMapOf(payment: Payment): ReadableMap = readableMapOf( - "destination" to payment.destination, - "txId" to payment.txId, "timestamp" to payment.timestamp, "amountSat" to payment.amountSat, "feesSat" to payment.feesSat, "paymentType" to payment.paymentType.name.lowercase(), "status" to payment.status.name.lowercase(), + "destination" to payment.destination, + "txId" to payment.txId, "details" to payment.details?.let { readableMapOf(it) }, ) diff --git a/packages/react-native/breez_sdk_liquid.podspec b/packages/react-native/breez_sdk_liquid.podspec index ed42742..7340436 100644 --- a/packages/react-native/breez_sdk_liquid.podspec +++ b/packages/react-native/breez_sdk_liquid.podspec @@ -10,7 +10,7 @@ Pod::Spec.new do |s| s.license = package["license"] s.authors = package["author"] - s.platforms = { :ios => "11.0" } + s.platforms = { :ios => "13.0" } s.source = { :git => "https://github.com/breez/breez-sdk-liquid.git", :tag => "#{s.version}" } s.source_files = "ios/**/*.{h,m,mm,swift}" diff --git a/packages/react-native/example/ios/Podfile b/packages/react-native/example/ios/Podfile index 608d760..3e30b24 100644 --- a/packages/react-native/example/ios/Podfile +++ b/packages/react-native/example/ios/Podfile @@ -1,7 +1,7 @@ require_relative '../node_modules/react-native/scripts/react_native_pods' require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' -platform :ios, '12.4' +platform :ios, '13' install! 'cocoapods', :deterministic_uuids => false target 'BreezSDKLiquidExample' do @@ -39,7 +39,7 @@ target 'BreezSDKLiquidExample' do # should also work. installer.pods_project.targets.each do |target| target.build_configurations.each do |config| - config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.4' + config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13' end end __apply_Xcode_12_5_M1_post_install_workaround(installer) diff --git a/packages/react-native/ios/BreezSDKLiquidMapper.swift b/packages/react-native/ios/BreezSDKLiquidMapper.swift index c9a925b..48ca642 100644 --- a/packages/react-native/ios/BreezSDKLiquidMapper.swift +++ b/packages/react-native/ios/BreezSDKLiquidMapper.swift @@ -1350,20 +1350,6 @@ enum BreezSDKLiquidMapper { } static func asPayment(payment: [String: Any?]) throws -> Payment { - var destination: String? - if hasNonNilKey(data: payment, key: "destination") { - guard let destinationTmp = payment["destination"] as? String else { - throw SdkError.Generic(message: errUnexpectedValue(fieldName: "destination")) - } - destination = destinationTmp - } - var txId: String? - if hasNonNilKey(data: payment, key: "txId") { - guard let txIdTmp = payment["txId"] as? String else { - throw SdkError.Generic(message: errUnexpectedValue(fieldName: "txId")) - } - txId = txIdTmp - } guard let timestamp = payment["timestamp"] as? UInt32 else { throw SdkError.Generic(message: errMissingMandatoryField(fieldName: "timestamp", typeName: "Payment")) } @@ -1383,23 +1369,37 @@ enum BreezSDKLiquidMapper { } let status = try asPaymentState(paymentState: statusTmp) + var destination: String? + if hasNonNilKey(data: payment, key: "destination") { + guard let destinationTmp = payment["destination"] as? String else { + throw SdkError.Generic(message: errUnexpectedValue(fieldName: "destination")) + } + destination = destinationTmp + } + var txId: String? + if hasNonNilKey(data: payment, key: "txId") { + guard let txIdTmp = payment["txId"] as? String else { + throw SdkError.Generic(message: errUnexpectedValue(fieldName: "txId")) + } + txId = txIdTmp + } var details: PaymentDetails? if let detailsTmp = payment["details"] as? [String: Any?] { details = try asPaymentDetails(paymentDetails: detailsTmp) } - return Payment(destination: destination, txId: txId, timestamp: timestamp, amountSat: amountSat, feesSat: feesSat, paymentType: paymentType, status: status, details: details) + return Payment(timestamp: timestamp, amountSat: amountSat, feesSat: feesSat, paymentType: paymentType, status: status, destination: destination, txId: txId, details: details) } static func dictionaryOf(payment: Payment) -> [String: Any?] { return [ - "destination": payment.destination == nil ? nil : payment.destination, - "txId": payment.txId == nil ? nil : payment.txId, "timestamp": payment.timestamp, "amountSat": payment.amountSat, "feesSat": payment.feesSat, "paymentType": valueOf(paymentType: payment.paymentType), "status": valueOf(paymentState: payment.status), + "destination": payment.destination == nil ? nil : payment.destination, + "txId": payment.txId == nil ? nil : payment.txId, "details": payment.details == nil ? nil : dictionaryOf(paymentDetails: payment.details!), ] } diff --git a/packages/react-native/src/index.ts b/packages/react-native/src/index.ts index 4ba14ac..897a363 100644 --- a/packages/react-native/src/index.ts +++ b/packages/react-native/src/index.ts @@ -212,13 +212,13 @@ export interface PayOnchainRequest { } export interface Payment { - destination?: string - txId?: string timestamp: number amountSat: number feesSat: number paymentType: PaymentType status: PaymentState + destination?: string + txId?: string details?: PaymentDetails }