Add Go/CS bindings (#147)

* Publish Go/CS packages

* Fix optional param ordering

* Fix CI installed bindgens
This commit is contained in:
Ross Savage
2024-08-28 15:14:20 +02:00
committed by GitHub
parent ab63064343
commit 251c252374
31 changed files with 1809 additions and 248 deletions

View File

@@ -125,30 +125,30 @@ jobs:
name: bindings-python name: bindings-python
path: lib/bindings/ffi/python/breez_sdk_liquid.py path: lib/bindings/ffi/python/breez_sdk_liquid.py
# - name: Build C# binding - name: Build C# binding
# if: ${{ inputs.csharp }} if: ${{ inputs.csharp }}
# working-directory: lib/bindings working-directory: lib/bindings
# run: | run: |
# cargo install uniffi-bindgen-cs --git https://github.com/breez/uniffi-bindgen-cs --branch namespace 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 uniffi-bindgen-cs src/breez_sdk_liquid.udl -o ffi/csharp -c ./uniffi.toml
#
# - name: Archive C# binding - name: Archive C# binding
# if: ${{ inputs.csharp }} if: ${{ inputs.csharp }}
# uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
# with: with:
# name: bindings-csharp name: bindings-csharp
# path: lib/bindings/ffi/csharp/breez_sdk_liquid.cs path: lib/bindings/ffi/csharp/breez_sdk_liquid.cs
#
# - name: Build golang binding - name: Build golang binding
# if: ${{ inputs.golang }} if: ${{ inputs.golang }}
# working-directory: lib/bindings working-directory: lib/bindings
# run: | run: |
# cargo install uniffi-bindgen-go --git https://github.com/NordSecurity/uniffi-bindgen-go --tag v0.1.5+v0.23.0 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 uniffi-bindgen-go src/breez_sdk_liquid.udl -o ffi/golang -c ./uniffi.toml
#
# - name: Archive golang binding - name: Archive golang binding
# if: ${{ inputs.golang }} if: ${{ inputs.golang }}
# uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
# with: with:
# name: bindings-golang name: bindings-golang
# path: lib/bindings/ffi/golang/breez/breez_sdk_liquid/breez_sdk_liquid.* path: lib/bindings/ffi/golang/breez_sdk_liquid/breez_sdk_liquid.*

View File

@@ -98,6 +98,26 @@ jobs:
working-directory: lib/bindings working-directory: lib/bindings
run: cargo build 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 - name: Setup python
uses: actions/setup-python@v4 uses: actions/setup-python@v4
with: with:

View File

@@ -191,23 +191,23 @@ jobs:
python: ${{ needs.setup.outputs.python == 'true'}} python: ${{ needs.setup.outputs.python == 'true'}}
swift: ${{ needs.setup.outputs.swift == 'true'}} swift: ${{ needs.setup.outputs.swift == 'true'}}
# publish-csharp: publish-csharp:
# needs: needs:
# - setup - setup
# - build-bindings-windows - build-bindings-windows
# - build-bindings-darwin - build-bindings-darwin
# - build-bindings-linux - build-bindings-linux
# - build-language-bindings - build-language-bindings
# if: ${{ needs.setup.outputs.csharp == 'true' }} if: ${{ needs.setup.outputs.csharp == 'true' }}
# uses: ./.github/workflows/publish-csharp.yml uses: ./.github/workflows/publish-csharp.yml
# with: with:
# repository: ${{ needs.setup.outputs.repository }} repository: ${{ needs.setup.outputs.repository }}
# ref: ${{ needs.setup.outputs.csharp-ref }} ref: ${{ needs.setup.outputs.csharp-ref }}
# package-version: ${{ needs.setup.outputs.csharp-package-version }} package-version: ${{ needs.setup.outputs.csharp-package-version }}
# publish: ${{ needs.setup.outputs.publish == 'true' }} publish: ${{ needs.setup.outputs.publish == 'true' }}
# skip-tests: true skip-tests: true
# secrets: secrets:
# NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
publish-dart: publish-dart:
needs: needs:
@@ -221,23 +221,23 @@ jobs:
publish: ${{ needs.setup.outputs.publish == 'true' }} publish: ${{ needs.setup.outputs.publish == 'true' }}
secrets: secrets:
REPO_SSH_KEY: ${{ secrets.REPO_SSH_KEY }} REPO_SSH_KEY: ${{ secrets.REPO_SSH_KEY }}
#
# publish-golang: publish-golang:
# needs: needs:
# - setup - setup
# - build-bindings-android - build-bindings-android
# - build-bindings-windows - build-bindings-windows
# - build-bindings-darwin - build-bindings-darwin
# - build-bindings-linux - build-bindings-linux
# - build-language-bindings - build-language-bindings
# if: ${{ needs.setup.outputs.golang == 'true' }} if: ${{ needs.setup.outputs.golang == 'true' }}
# uses: ./.github/workflows/publish-golang.yml uses: ./.github/workflows/publish-golang.yml
# with: with:
# ref: ${{ needs.setup.outputs.ref }} ref: ${{ needs.setup.outputs.ref }}
# package-version: ${{ needs.setup.outputs.golang-package-version }} package-version: ${{ needs.setup.outputs.golang-package-version }}
# publish: ${{ needs.setup.outputs.publish == 'true' }} publish: ${{ needs.setup.outputs.publish == 'true' }}
# secrets: secrets:
# REPO_SSH_KEY: ${{ secrets.REPO_SSH_KEY }} REPO_SSH_KEY: ${{ secrets.REPO_SSH_KEY }}
publish-maven: publish-maven:
needs: needs:

View File

@@ -77,7 +77,7 @@ jobs:
- name: Update package version - name: Update package version
if: ${{ inputs.package-version }} if: ${{ inputs.package-version }}
working-directory: lib/bindings/langs/csharp/src working-directory: lib/bindings/langs/csharp/src
run: sed -i.bak -e 's/<Version>.*<\/Version>/<Version>${{ inputs.package-version }}<\/Version>/' Breez.Liquid.Sdk.csproj run: sed -i.bak -e 's/<Version>.*<\/Version>/<Version>${{ inputs.package-version }}<\/Version>/' Breez.Sdk.Liquid.csproj
- name: Setup dotnet - name: Setup dotnet
uses: actions/setup-dotnet@v3 uses: actions/setup-dotnet@v3
@@ -86,17 +86,17 @@ jobs:
- name: Build the project - name: Build the project
working-directory: lib/bindings/langs/csharp/src 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 - name: Create the package
working-directory: lib/bindings/langs/csharp/src 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 - name: Archive the package
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: 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/Breez.Liquid.Sdk.*.nupkg path: lib/bindings/langs/csharp/src/bin/Release/Breez.Sdk.Liquid.*.nupkg
test-package: test-package:
needs: build-package needs: build-package
@@ -120,7 +120,7 @@ jobs:
- uses: actions/download-artifact@v4 - uses: actions/download-artifact@v4
if: ${{ !inputs.skip-tests }} if: ${{ !inputs.skip-tests }}
with: 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 path: lib/bindings/langs/csharp/src/bin/Release
- name: Setup dotnet - name: Setup dotnet
@@ -142,9 +142,9 @@ jobs:
- name: Download archived package - name: Download archived package
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
with: with:
name: Breez.Liquid.Sdk.${{ inputs.package-version }}.nupkg name: Breez.Sdk.Liquid.${{ inputs.package-version }}.nupkg
- name: Publish to nuget.org - name: Publish to nuget.org
env: env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} 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

175
lib/Cargo.lock generated
View File

@@ -691,7 +691,7 @@ dependencies = [
"once_cell", "once_cell",
"thiserror", "thiserror",
"tokio", "tokio",
"uniffi 0.27.3", "uniffi 0.25.3",
"uniffi_bindgen 0.25.3", "uniffi_bindgen 0.25.3",
"uniffi_bindgen_kotlin_multiplatform", "uniffi_bindgen_kotlin_multiplatform",
] ]
@@ -1425,18 +1425,7 @@ checksum = "0d6b4de4a8eb6c46a8c77e1d3be942cb9a8bf073c22374578e5ba4b08ed0ff68"
dependencies = [ dependencies = [
"log", "log",
"plain", "plain",
"scroll 0.11.0", "scroll",
]
[[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",
] ]
[[package]] [[package]]
@@ -2234,6 +2223,12 @@ version = "1.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
[[package]]
name = "oneshot-uniffi"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c548d5c78976f6955d72d0ced18c48ca07030f7a1d4024529fedd7c1c01b29c"
[[package]] [[package]]
name = "opaque-debug" name = "opaque-debug"
version = "0.3.1" version = "0.3.1"
@@ -3048,16 +3043,7 @@ version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04c565b551bafbef4157586fa379538366e4385d42082f255bfd96e4fe8519da" checksum = "04c565b551bafbef4157586fa379538366e4385d42082f255bfd96e4fe8519da"
dependencies = [ dependencies = [
"scroll_derive 0.11.1", "scroll_derive",
]
[[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",
] ]
[[package]] [[package]]
@@ -3071,17 +3057,6 @@ dependencies = [
"syn 2.0.75", "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]] [[package]]
name = "sct" name = "sct"
version = "0.7.1" version = "0.7.1"
@@ -3377,12 +3352,6 @@ version = "1.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
[[package]]
name = "smawk"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b7c388c1b5e93756d0c740965c41e8822f866621d41acbdf6336a6a168f8840c"
[[package]] [[package]]
name = "socket2" name = "socket2"
version = "0.5.7" version = "0.5.7"
@@ -3560,9 +3529,6 @@ name = "textwrap"
version = "0.16.1" version = "0.16.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23d434d3f8967a09480fb04132ebe0a3e088c173e6d0ee7897abbdf4eab0f8b9" checksum = "23d434d3f8967a09480fb04132ebe0a3e088c173e6d0ee7897abbdf4eab0f8b9"
dependencies = [
"smawk",
]
[[package]] [[package]]
name = "thiserror" name = "thiserror"
@@ -3927,17 +3893,17 @@ dependencies = [
[[package]] [[package]]
name = "uniffi" name = "uniffi"
version = "0.27.3" version = "0.25.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb3a4c447c50fcda7bc5604a8588b7e1f37ffbfd8838a1516a290398efa7c6f0" checksum = "21345172d31092fd48c47fd56c53d4ae9e41c4b1f559fb8c38c1ab1685fd919f"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"camino", "camino",
"clap 4.5.16", "clap 4.5.16",
"uniffi_bindgen 0.27.3", "uniffi_bindgen 0.25.3",
"uniffi_build 0.27.3", "uniffi_build 0.25.3",
"uniffi_core 0.27.3", "uniffi_core 0.25.3",
"uniffi_macros 0.27.3", "uniffi_macros 0.25.3",
] ]
[[package]] [[package]]
@@ -3952,7 +3918,7 @@ dependencies = [
"camino", "camino",
"fs-err", "fs-err",
"glob", "glob",
"goblin 0.6.1", "goblin",
"heck 0.4.1", "heck 0.4.1",
"once_cell", "once_cell",
"paste", "paste",
@@ -3961,7 +3927,7 @@ dependencies = [
"toml", "toml",
"uniffi_meta 0.23.0", "uniffi_meta 0.23.0",
"uniffi_testing 0.23.0", "uniffi_testing 0.23.0",
"weedle2 4.0.0", "weedle2",
] ]
[[package]] [[package]]
@@ -3974,9 +3940,10 @@ dependencies = [
"askama 0.12.1", "askama 0.12.1",
"camino", "camino",
"cargo_metadata", "cargo_metadata",
"clap 4.5.16",
"fs-err", "fs-err",
"glob", "glob",
"goblin 0.6.1", "goblin",
"heck 0.4.1", "heck 0.4.1",
"once_cell", "once_cell",
"paste", "paste",
@@ -3984,32 +3951,7 @@ dependencies = [
"toml", "toml",
"uniffi_meta 0.25.3", "uniffi_meta 0.25.3",
"uniffi_testing 0.25.3", "uniffi_testing 0.25.3",
"uniffi_udl 0.25.3", "uniffi_udl",
]
[[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",
] ]
[[package]] [[package]]
@@ -4042,13 +3984,13 @@ dependencies = [
[[package]] [[package]]
name = "uniffi_build" name = "uniffi_build"
version = "0.27.3" version = "0.25.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1c59b65d59685ff3a10569287c6419f76487b4052ac52d5a0df38b2253d7f440" checksum = "001964dd3682d600084b3aaf75acf9c3426699bc27b65e96bb32d175a31c74e9"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"camino", "camino",
"uniffi_bindgen 0.27.3", "uniffi_bindgen 0.25.3",
] ]
[[package]] [[package]]
@@ -4071,16 +4013,6 @@ dependencies = [
"syn 2.0.75", "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]] [[package]]
name = "uniffi_core" name = "uniffi_core"
version = "0.23.0" version = "0.23.0"
@@ -4099,15 +4031,16 @@ dependencies = [
[[package]] [[package]]
name = "uniffi_core" name = "uniffi_core"
version = "0.27.3" version = "0.25.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a02e67ac9634b10da9e4aa63a29a7920b8f1395eafef1ea659b2dd76dda96906" checksum = "6121a127a3af1665cd90d12dd2b3683c2643c5103281d0fed5838324ca1fad5b"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bytes", "bytes",
"camino", "camino",
"log", "log",
"once_cell", "once_cell",
"oneshot-uniffi",
"paste", "paste",
"static_assertions", "static_assertions",
] ]
@@ -4133,9 +4066,9 @@ dependencies = [
[[package]] [[package]]
name = "uniffi_macros" name = "uniffi_macros"
version = "0.27.3" version = "0.25.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6f08d5592c669b80a8af5066027098bebec4b4af17a9b8b299bac5f518ab89e" checksum = "11cf7a58f101fcedafa5b77ea037999b88748607f0ef3a33eaa0efc5392e92e4"
dependencies = [ dependencies = [
"bincode", "bincode",
"camino", "camino",
@@ -4146,7 +4079,8 @@ dependencies = [
"serde", "serde",
"syn 2.0.75", "syn 2.0.75",
"toml", "toml",
"uniffi_meta 0.27.3", "uniffi_build 0.25.3",
"uniffi_meta 0.25.3",
] ]
[[package]] [[package]]
@@ -4172,18 +4106,6 @@ dependencies = [
"uniffi_checksum_derive 0.25.3", "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]] [[package]]
name = "uniffi_testing" name = "uniffi_testing"
version = "0.23.0" version = "0.23.0"
@@ -4212,19 +4134,6 @@ dependencies = [
"once_cell", "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]] [[package]]
name = "uniffi_udl" name = "uniffi_udl"
version = "0.25.3" version = "0.25.3"
@@ -4234,20 +4143,7 @@ dependencies = [
"anyhow", "anyhow",
"uniffi_meta 0.25.3", "uniffi_meta 0.25.3",
"uniffi_testing 0.25.3", "uniffi_testing 0.25.3",
"weedle2 4.0.0", "weedle2",
]
[[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",
] ]
[[package]] [[package]]
@@ -4491,15 +4387,6 @@ dependencies = [
"nom", "nom",
] ]
[[package]]
name = "weedle2"
version = "5.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "998d2c24ec099a87daf9467808859f9d82b61f1d9c9701251aea037f514eae0e"
dependencies = [
"nom",
]
[[package]] [[package]]
name = "which" name = "which"
version = "4.4.2" version = "4.4.2"

View File

@@ -35,8 +35,9 @@ anyhow = "1.0"
log = "0.4.20" log = "0.4.20"
once_cell = "1.19" once_cell = "1.19"
thiserror = "1.0" thiserror = "1.0"
uniffi = "0.27.1" # Version must match that used by uniffi-bindgen-go
uniffi_macros = "0.27.1" uniffi = "0.25.0"
uniffi_macros = "0.25.0"
[patch.crates-io] [patch.crates-io]
# https://github.com/BlockstreamResearch/rust-secp256k1-zkp/pull/48/commits # https://github.com/BlockstreamResearch/rust-secp256k1-zkp/pull/48/commits

View File

@@ -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`

481
lib/bindings/langs/csharp/src/.gitignore vendored Normal file
View File

@@ -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

View File

@@ -0,0 +1,34 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<PackageId>Breez.Sdk.Liquid</PackageId>
<Version>0.0.1</Version>
<Company>Breez</Company>
<Description>C# Breez Liquid SDK</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://breez.technology/sdk/</PackageProjectUrl>
<RepositoryUrl>https://github.com/breez/breez-sdk-liquid</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>bitcoin lightning liquid breez sdk non-custodial</PackageTags>
<Copyright>2024 Breez</Copyright>
</PropertyGroup>
<ItemGroup>
<None Include="../../../../../README.md" Pack="true" PackagePath="\"/>
<None Include="../../../../../LICENSE" Pack="true" PackagePath="\"/>
</ItemGroup>
<ItemGroup>
<Content Include="runtimes/osx-arm64/native/libbreez_sdk_liquid_bindings.dylib" Link="runtimes/osx-arm64/native/libbreez_sdk_liquid_bindings.dylib" Pack="true" PackagePath="runtimes/osx-arm64/native/libbreez_sdk_liquid_bindings.dylib" />
<Content Include="runtimes/osx-x64/native/libbreez_sdk_liquid_bindings.dylib" Link="runtimes/osx-x64/native/libbreez_sdk_liquid_bindings.dylib" Pack="true" PackagePath="runtimes/osx-x64/native/libbreez_sdk_liquid_bindings.dylib" />
<Content Include="runtimes/linux-arm64/native/libbreez_sdk_liquid_bindings.so" Link="runtimes/linux-arm64/native/libbreez_sdk_liquid_bindings.so" Pack="true" PackagePath="runtimes/linux-arm64/native/libbreez_sdk_liquid_bindings.so" />
<Content Include="runtimes/linux-x64/native/libbreez_sdk_liquid_bindings.so" Link="runtimes/linux-x64/native/libbreez_sdk_liquid_bindings.so" Pack="true" PackagePath="runtimes/linux-x64/native/libbreez_sdk_liquid_bindings.so" />
<Content Include="runtimes/win-x64/native/breez_sdk_liquid_bindings.dll" Link="runtimes/win-x64/native/breez_sdk_liquid_bindings.dll" Pack="true" PackagePath="runtimes/win-x64/native/breez_sdk_liquid_bindings.dll" />
<Content Include="runtimes/win-x86/native/breez_sdk_liquid_bindings.dll" Link="runtimes/win-x86/native/breez_sdk_liquid_bindings.dll" Pack="true" PackagePath="runtimes/win-x86/native/breez_sdk_liquid_bindings.dll" />
</ItemGroup>
</Project>

View File

@@ -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

View File

@@ -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;
}

View File

@@ -0,0 +1,2 @@
This program is used by the C# nuget CI workflow to test the generated nuget
package on multiple platforms.

View File

@@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>sdk_cs_demo</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup>
<RestoreSources>$(RestoreSources);../src/bin/Release;https://api.nuget.org/v3/index.json</RestoreSources>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Breez.Sdk.Liquid" Version="*" />
</ItemGroup>
</Project>

View File

@@ -6,8 +6,10 @@ import PackageDescription
let package = Package( let package = Package(
name: "bindings-swift", name: "bindings-swift",
platforms: [ platforms: [
.macOS(.v12), // Required by uniffi 0.25
.iOS(.v11), // Can be reverted to v12/v11 for uniffi 0.27
.macOS(.v15),
.iOS(.v13),
], ],
products: [ products: [
.library(name: "BreezSDKLiquid", targets: ["breez_sdk_liquidFFI", "BreezSDKLiquid"]), .library(name: "BreezSDKLiquid", targets: ["breez_sdk_liquidFFI", "BreezSDKLiquid"]),

View File

@@ -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.h
rm langs/swift/Sources/BreezSDKLiquid/breez_sdk_liquidFFI.modulemap 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
python-linux: $(SOURCES) python-linux: $(SOURCES)
cargo build --release --target $(TARGET) cargo build --release --target $(TARGET)

View File

@@ -450,14 +450,14 @@ interface PaymentDetails {
}; };
dictionary Payment { dictionary Payment {
string? destination;
string? tx_id = null;
u32 timestamp; u32 timestamp;
u64 amount_sat; u64 amount_sat;
u64 fees_sat; u64 fees_sat;
PaymentType payment_type; PaymentType payment_type;
PaymentState status; PaymentState status;
PaymentDetails? details; string? destination = null;
string? tx_id = null;
PaymentDetails? details = null;
}; };
enum PaymentType { enum PaymentType {

View File

@@ -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

View File

@@ -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);
}

View File

@@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<RootNamespace>sdk_cs_demo</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<Compile Include="../../../ffi/csharp/breez_sdk_liquid.cs" Link="breez_sdk_liquid.cs" CopyToOutputDirectory="Never" />
<Content Include="../../../ffi/csharp/libbreez_sdk_liquid_bindings.so" Condition=" '$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' ">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="../../../ffi/csharp/libbreez_sdk_liquid_bindings.dylib" Condition=" '$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))' ">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,3 @@
breez_sdk_liquid.*
liquid*/
*.sql

View File

@@ -0,0 +1,3 @@
module example.org/golang
go 1.19

View File

@@ -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)
}

View File

@@ -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;
}

View File

@@ -1,5 +1,40 @@
use std::process::Command;
uniffi::build_foreign_language_testcases!( uniffi::build_foreign_language_testcases!(
"tests/bindings/test_breez_sdk_liquid.swift", "tests/bindings/test_breez_sdk_liquid.swift",
"tests/bindings/test_breez_sdk_liquid.kts", "tests/bindings/test_breez_sdk_liquid.kts",
"tests/bindings/test_breez_sdk_liquid.py" "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());
}

View File

@@ -10,3 +10,14 @@ cdylib_name = "breez_sdk_liquid_bindings"
# https://mozilla.github.io/uniffi-rs/python/configuration.html # https://mozilla.github.io/uniffi-rs/python/configuration.html
[bindings.python] [bindings.python]
cdylib_name = "breez_sdk_liquid_bindings" 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"

View File

@@ -10,7 +10,7 @@ Pod::Spec.new do |s|
s.license = package["license"] s.license = package["license"]
s.authors = package["author"] 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 = { :git => "https://github.com/breez/breez-sdk-liquid.git", :tag => "#{s.version}" }
s.source_files = "ios/**/*.{h,m,mm,swift}" s.source_files = "ios/**/*.{h,m,mm,swift}"

View File

@@ -1156,26 +1156,26 @@ fun asPayment(payment: ReadableMap): Payment? {
) { ) {
return null 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 timestamp = payment.getInt("timestamp").toUInt()
val amountSat = payment.getDouble("amountSat").toULong() val amountSat = payment.getDouble("amountSat").toULong()
val feesSat = payment.getDouble("feesSat").toULong() val feesSat = payment.getDouble("feesSat").toULong()
val paymentType = payment.getString("paymentType")?.let { asPaymentType(it) }!! val paymentType = payment.getString("paymentType")?.let { asPaymentType(it) }!!
val status = payment.getString("status")?.let { asPaymentState(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 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 = fun readableMapOf(payment: Payment): ReadableMap =
readableMapOf( readableMapOf(
"destination" to payment.destination,
"txId" to payment.txId,
"timestamp" to payment.timestamp, "timestamp" to payment.timestamp,
"amountSat" to payment.amountSat, "amountSat" to payment.amountSat,
"feesSat" to payment.feesSat, "feesSat" to payment.feesSat,
"paymentType" to payment.paymentType.name.lowercase(), "paymentType" to payment.paymentType.name.lowercase(),
"status" to payment.status.name.lowercase(), "status" to payment.status.name.lowercase(),
"destination" to payment.destination,
"txId" to payment.txId,
"details" to payment.details?.let { readableMapOf(it) }, "details" to payment.details?.let { readableMapOf(it) },
) )

View File

@@ -10,7 +10,7 @@ Pod::Spec.new do |s|
s.license = package["license"] s.license = package["license"]
s.authors = package["author"] 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 = { :git => "https://github.com/breez/breez-sdk-liquid.git", :tag => "#{s.version}" }
s.source_files = "ios/**/*.{h,m,mm,swift}" s.source_files = "ios/**/*.{h,m,mm,swift}"

View File

@@ -1,7 +1,7 @@
require_relative '../node_modules/react-native/scripts/react_native_pods' require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
platform :ios, '12.4' platform :ios, '13'
install! 'cocoapods', :deterministic_uuids => false install! 'cocoapods', :deterministic_uuids => false
target 'BreezSDKLiquidExample' do target 'BreezSDKLiquidExample' do
@@ -39,7 +39,7 @@ target 'BreezSDKLiquidExample' do
# should also work. # should also work.
installer.pods_project.targets.each do |target| installer.pods_project.targets.each do |target|
target.build_configurations.each do |config| target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.4' config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13'
end end
end end
__apply_Xcode_12_5_M1_post_install_workaround(installer) __apply_Xcode_12_5_M1_post_install_workaround(installer)

View File

@@ -1350,20 +1350,6 @@ enum BreezSDKLiquidMapper {
} }
static func asPayment(payment: [String: Any?]) throws -> Payment { 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 { guard let timestamp = payment["timestamp"] as? UInt32 else {
throw SdkError.Generic(message: errMissingMandatoryField(fieldName: "timestamp", typeName: "Payment")) throw SdkError.Generic(message: errMissingMandatoryField(fieldName: "timestamp", typeName: "Payment"))
} }
@@ -1383,23 +1369,37 @@ enum BreezSDKLiquidMapper {
} }
let status = try asPaymentState(paymentState: statusTmp) 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? var details: PaymentDetails?
if let detailsTmp = payment["details"] as? [String: Any?] { if let detailsTmp = payment["details"] as? [String: Any?] {
details = try asPaymentDetails(paymentDetails: detailsTmp) 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?] { static func dictionaryOf(payment: Payment) -> [String: Any?] {
return [ return [
"destination": payment.destination == nil ? nil : payment.destination,
"txId": payment.txId == nil ? nil : payment.txId,
"timestamp": payment.timestamp, "timestamp": payment.timestamp,
"amountSat": payment.amountSat, "amountSat": payment.amountSat,
"feesSat": payment.feesSat, "feesSat": payment.feesSat,
"paymentType": valueOf(paymentType: payment.paymentType), "paymentType": valueOf(paymentType: payment.paymentType),
"status": valueOf(paymentState: payment.status), "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!), "details": payment.details == nil ? nil : dictionaryOf(paymentDetails: payment.details!),
] ]
} }

View File

@@ -212,13 +212,13 @@ export interface PayOnchainRequest {
} }
export interface Payment { export interface Payment {
destination?: string
txId?: string
timestamp: number timestamp: number
amountSat: number amountSat: number
feesSat: number feesSat: number
paymentType: PaymentType paymentType: PaymentType
status: PaymentState status: PaymentState
destination?: string
txId?: string
details?: PaymentDetails details?: PaymentDetails
} }