Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/workflows/dart.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Build and Test Dart
on:
pull_request:
paths:
- payjoin-ffi/**
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know we reverted this back to expand and look at all changes within the ffi repo as laid out in #722 but would it maybe be worth exploring some more targeted paths like? And then do the same for the python workflows so there aren't uneeded tests

Suggested change
- payjoin-ffi/**
- payjoin-ffi/dart/**
- payjoin-ffi/src/**

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or also exclusionary to cover things like build.rs changing

Suggested change
- payjoin-ffi/**
- payjoin-ffi/**
- !payjoin-ffi/python/**

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the simplicity of "any payjoin-ffi change triggers CI for all FFI languages" is worth keeping to prevent issues slipping by unnoticed.


jobs:
test:
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: payjoin-ffi/dart
strategy:
matrix:
os: [ubuntu-latest, macos-13]
steps:
- name: Checkout
uses: actions/checkout@v4

- name: "Install Rust 1.85.0"
uses: dtolnay/rust-toolchain@1.85.0

- name: Install Dart
uses: dart-lang/setup-dart@v1
with:
sdk: stable

- name: "Use cache"
uses: Swatinem/rust-cache@v2

- name: Generate bindings and binaries
run: |
if [ "${{ matrix.os }}" = "macos-13" ]; then
bash ./scripts/generate_macos.sh
else
bash ./scripts/generate_linux.sh
fi

- name: Run tests
# Skip integration test on macOS due to Docker issues
run: |
if [ "${{ matrix.os }}" = "macos-13" ]; then
dart test "test/test_payjoin_unit_test.dart"
else
dart test
fi

28 changes: 7 additions & 21 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Copied from [bdk-ffi](https://github.com/bitcoindevkit/bdk-ffi/blob/master/.github/workflows/test-python.yaml)
name: Build and Test Python
on:
pull_request:
Expand All @@ -7,11 +6,8 @@ on:

jobs:
build-wheels-and-test:
name: "Build and test wheels with Redis"
name: "Build and test Linux"
runs-on: ubuntu-latest
services:
redis:
image: redis:7-alpine
defaults:
run:
working-directory: payjoin-ffi/python
Expand All @@ -27,10 +23,8 @@ jobs:
- name: "Checkout"
uses: actions/checkout@v4

- name: "Install Rust 1.78.0"
uses: actions-rs/toolchain@v1
with:
toolchain: 1.78.0
- name: "Install Rust 1.85.0"
uses: dtolnay/rust-toolchain@1.85.0

- name: "Install Python"
uses: actions/setup-python@v4
Expand All @@ -57,8 +51,6 @@ jobs:
run: pip install ./dist/*.whl

- name: "Run tests"
env:
REDIS_URL: redis://localhost:6379
run: python -m unittest -v

build-macos:
Expand All @@ -77,19 +69,14 @@ jobs:
with:
submodules: true

- name: "Install Rust 1.78.0"
uses: actions-rs/toolchain@v1
with:
toolchain: 1.78.0
- name: "Install Rust 1.85.0"
uses: dtolnay/rust-toolchain@1.85.0

- name: "Install Python"
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}

- name: Setup Docker on macOS
uses: douglascamata/setup-docker-macos-action@v1.0.0

- name: "Use cache"
uses: Swatinem/rust-cache@v2

Expand All @@ -103,6 +90,5 @@ jobs:
run: pip3 install ./dist/*.whl

- name: "Run tests"
env:
REDIS_URL: redis://localhost:6379
run: python3 -m unittest -v
# Skip integration test on macOS due to Docker issues
run: python3 -m unittest -v test/test_payjoin_unit_test.py
24 changes: 5 additions & 19 deletions payjoin-ffi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,21 @@ Welcome! This repository creates libraries for various programming languages, al

Our mission is to provide developers with cross-language libraries that seamlessly integrate with different platform languages. By offering support for multiple languages, we aim to enhance the accessibility and usability of Payjoin, empowering developers to incorporate this privacy-enhancing feature into their applications, no matter their preferred programming language.

With a commitment to collaboration and interoperability, this repository strives to foster a more inclusive and diverse ecosystem around Payjoin, contributing to the wider adoption of privacy-focused practices within the Bitcoin community. Join us in our mission to build a more private and secure future for Bitcoin transactions through Payjoin!

**Current Status:**
This project is in the pre-alpha stage and currently in the design phase. The first language bindings available will be for Python, followed by Swift and Kotlin. Our ultimate goal is to provide Payjoin implementations for Android, iOS, Java, Python, React Native, Flutter, C#, and Golang.

## Supported Target Languages and Platforms

Each supported language and the platform(s) it's packaged for has its own directory. The Rust code in this project is in the `src` directory and is a wrapper around the [Payjoin Dev Kit] to expose its APIs uniformly using the [mozilla/uniffi-rs] bindings generator for each supported target language.
Each supported language is in its own directory. The Rust code in this project is in the `src` directory and is a wrapper around the [Payjoin Dev Kit] to expose its APIs uniformly using the [mozilla/uniffi-rs] bindings generator for each supported target language.

The directories below include instructions for using, building, and publishing the native language bindings for [Payjoin Dev Kit] supported by this project.

| Language | Platform | Published Package | Building Documentation | API Docs |
|----------|-----------------------|-------------------|------------------------------------|----------|
| Python | linux, macOS | payjoin | [Readme payjoin](python/README.md) | |
| Language | Platform | Repository | Published Package |
|----------|-----------------------|-------------------|------------------------------------|
| Python | linux, macOS | [payjoin-ffi/python](python) | [payjoin](https://pypi.org/project/payjoin/) |
| Dart | linux, macOS | [payjoin-ffi/dart](dart) | N/A |

## Minimum Supported Rust Version (MSRV)

This library should compile with any combination of features with Rust 1.78.0.

## Using the Libraries

### Python

```shell
pip install payjoin

```


## References

[Payjoin Dev Kit](https://payjoindevkit.org/)
Expand Down
21 changes: 21 additions & 0 deletions payjoin-ffi/dart/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Payjoin Dart Bindings

Welcome to the Dart language bindings for the [Payjoin Dev Kit](https://payjoindevkit.org/)!

## Running Tests

Follow these steps to clone the repository and run the tests.


```shell
git clone https://github.com/payjoin/rust-payjoin.git
cd rust-payjoin/payjoin-ffi/dart

# Generate the bindings (use the script appropriate for your platform)
bash ./scripts/generate_<platform>.sh

# Run all tests
dart test
```

Note that you'll need Docker to run the integration tests. If you get a "Failed to start container" error, ensure the Docker engine is running on your machine.
2 changes: 2 additions & 0 deletions payjoin-ffi/dart/scripts/generate_linux.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env bash
set -euo pipefail
dart --version
dart pub get
LIBNAME=libpayjoin_ffi.so
LINUX_TARGET=x86_64-unknown-linux-gnu

Expand Down
2 changes: 2 additions & 0 deletions payjoin-ffi/dart/scripts/generate_macos.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/usr/bin/env bash

set -euo pipefail
dart --version
dart pub get
LIBNAME=libpayjoin_ffi.dylib

echo "Generating payjoin_ffi.dart..."
Expand Down
12 changes: 2 additions & 10 deletions payjoin-ffi/python/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Payjoin
# Payjoin Python Bindings

Welcome to the Python language bindings for the [Payjoin Dev Kit](https://payjoindevkit.org/)! Let's get you up and running with some smooth transactions and a sprinkle of fun.
Welcome to the Python language bindings for the [Payjoin Dev Kit](https://payjoindevkit.org/)!

## Install from PyPI

Expand All @@ -23,9 +23,6 @@ cd rust-payjoin/payjoin-ffi/python
python -m venv venv
source venv/bin/activate

# Install dependencies
pip install --requirement requirements.txt --requirement requirements-dev.txt

# Generate the bindings (use the script appropriate for your platform)
PYBIN="./venv/bin/" bash ./scripts/generate_<platform>.sh

Expand All @@ -49,15 +46,10 @@ You can [filter which tests](https://docs.python.org/3/library/unittest.html#com
python -m venv venv
source venv/bin/activate

# Install dependencies
pip install --requirement requirements.txt

# Generate the bindings (use the script appropriate for your platform)
PYBIN="./venv/bin/" bash ./scripts/generate_<platform>.sh

# Build the wheel
python setup.py --verbose bdist_wheel

```
We hope everything worked smoothly! Now go forth test, and may your test results be as reliable as the Bitcoin blockchain itself!
₿🔒🤝