Skip to content

feat(sdk): ffi support and swift bindings #2661

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 56 commits into
base: v2.0-dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
ee755aa
ios start
QuantumExplorer Jun 2, 2025
6adc716
more work on ios
QuantumExplorer Jun 2, 2025
fd7ce13
more work
QuantumExplorer Jun 2, 2025
1d10634
ios
QuantumExplorer Jun 2, 2025
d01cd9b
feat: add data contract put methods and standardize return types in i…
QuantumExplorer Jun 2, 2025
efb64cf
more
QuantumExplorer Jun 2, 2025
afbb390
ios
QuantumExplorer Jun 2, 2025
b76a342
fmt
QuantumExplorer Jun 2, 2025
85bedad
ios
QuantumExplorer Jun 2, 2025
a3e7d27
more work
QuantumExplorer Jun 2, 2025
bd2aa90
token
QuantumExplorer Jun 3, 2025
7df79c4
more work
QuantumExplorer Jun 3, 2025
00e18fe
more work
QuantumExplorer Jun 3, 2025
cdbe84e
more work
QuantumExplorer Jun 3, 2025
78bb3ed
more work
QuantumExplorer Jun 3, 2025
9295685
more work
QuantumExplorer Jun 3, 2025
8c9642e
more work
QuantumExplorer Jun 3, 2025
a43c67f
more work
QuantumExplorer Jun 3, 2025
77a17e6
fixes
QuantumExplorer Jun 3, 2025
cb4cc31
Merge branch 'v2.0-dev' into ios
QuantumExplorer Jun 4, 2025
ad333cc
document ffi
QuantumExplorer Jun 4, 2025
21fb1b2
better ffi for tokens
QuantumExplorer Jun 4, 2025
4a3f2db
better ffi for tokens
QuantumExplorer Jun 4, 2025
1022009
more work
QuantumExplorer Jun 4, 2025
2eb6d08
more work
QuantumExplorer Jun 4, 2025
b7802d2
refactor: split identity FFI module into organized submodules
QuantumExplorer Jun 4, 2025
aa96f4c
more work
QuantumExplorer Jun 4, 2025
ebfcfd2
more work on sdk
QuantumExplorer Jun 4, 2025
182fe70
more fixes
QuantumExplorer Jun 4, 2025
189b17d
more work
QuantumExplorer Jun 4, 2025
2892fc0
more work
QuantumExplorer Jun 5, 2025
d99bb62
more work
QuantumExplorer Jun 5, 2025
33b470d
queries
Jun 6, 2025
96d0ea2
more work
QuantumExplorer Jun 6, 2025
a38268e
more work
Jun 6, 2025
5e997f7
more work
QuantumExplorer Jun 6, 2025
b73419a
more work
QuantumExplorer Jun 6, 2025
a63d61e
more work
QuantumExplorer Jun 6, 2025
3dacba6
fix
QuantumExplorer Jun 6, 2025
a599d16
more work
QuantumExplorer Jun 6, 2025
faa5933
more work
QuantumExplorer Jun 6, 2025
93016ae
swift example app
QuantumExplorer Jun 8, 2025
719e89d
more work
QuantumExplorer Jun 8, 2025
d93094d
more work
QuantumExplorer Jun 8, 2025
b1d3d15
more work
QuantumExplorer Jun 8, 2025
a0a2be1
more work
QuantumExplorer Jun 8, 2025
84eed10
architecture
QuantumExplorer Jun 9, 2025
8757f3a
architecture
QuantumExplorer Jun 9, 2025
56434ee
architecture
QuantumExplorer Jun 9, 2025
a54c27a
Update SDK_ARCHITECTURE.md
QuantumExplorer Jun 9, 2025
2b12a5f
more iOS work
QuantumExplorer Jun 10, 2025
ff7d5f7
Merge branch 'ios' of github.com:dashpay/platform into ios
QuantumExplorer Jun 10, 2025
2582392
Merge branch 'v2.0-dev' into ios
QuantumExplorer Jun 10, 2025
81975f4
added package
QuantumExplorer Jun 10, 2025
63b2b38
Merge branch 'ios' of github.com:dashpay/platform into ios
QuantumExplorer Jun 10, 2025
8b68aae
more work
QuantumExplorer Jun 10, 2025
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
8 changes: 8 additions & 0 deletions .github/package-filters/rs-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,11 @@ dash-sdk:
- packages/rs-sdk/**
- *dapi_client
- *drive

rs-sdk-ffi:
- .github/workflows/tests*
- packages/rs-sdk-ffi/**
- packages/rs-sdk/**
- packages/rs-drive-proof-verifier/**
- *dapi_client
- *drive
57 changes: 57 additions & 0 deletions .github/workflows/tests-rs-sdk-ffi-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Test rs-sdk-ffi build

on:
workflow_dispatch:
pull_request:
paths:
- 'packages/rs-sdk-ffi/**'
- 'packages/rs-sdk/**'
- '.github/workflows/tests-rs-sdk-ffi-build.yml'
push:
branches:
- master
- 'v[0-9]+\.[0-9]+-dev'
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix branch filter pattern to use glob syntax.

The string 'v[0-9]+\.[0-9]+-dev' is interpreted as a literal glob and won’t match branches like v1.2-dev. Replace it with a valid glob, for example:

-      - 'v[0-9]+\.[0-9]+-dev'
+      - 'v*.*-dev'
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- 'v[0-9]+\.[0-9]+-dev'
- 'v*.*-dev'
🧰 Tools
🪛 actionlint (1.7.7)

13-13: character '' is invalid for branch and tag names. only special characters [, ?, +, *, , ! can be escaped with . see man git-check-ref-format for more details. note that regular expression is unavailable. note: filter pattern syntax is explained at https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet

(glob)

🤖 Prompt for AI Agents
In .github/workflows/tests-rs-sdk-ffi-build.yml at line 13, the branch filter
pattern uses a regex-like string 'v[0-9]+\.[0-9]+-dev' which is treated as a
literal glob and does not match branches like 'v1.2-dev'. Replace this pattern
with a valid glob pattern that matches the intended branches, such as 'v*-dev'
or a similar glob expression that correctly matches versioned dev branches.

paths:
- 'packages/rs-sdk-ffi/**'
- 'packages/rs-sdk/**'
- '.github/workflows/tests-rs-sdk-ffi-build.yml'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build-ffi-cross-compile:
name: Build FFI for Apple target
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@v4

- name: Setup Rust
uses: ./.github/actions/rust
with:
target: aarch64-apple-darwin

- name: Install cross-compilation dependencies
run: |
# Install osxcross or other cross-compilation tools if needed
# For now, we'll just add the target
rustup target add aarch64-apple-darwin

Comment on lines +36 to +41
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Install the full cross-compilation toolchain.

Simply adding the Rust target isn’t sufficient to link for aarch64-apple-darwin. You should install or configure the necessary system dependencies (e.g., a cross-linker, clang, SDK headers):

-   run: |
-     # Install osxcross or other cross-compilation tools if needed
-     # For now, we'll just add the target
-     rustup target add aarch64-apple-darwin
+   run: |
+     sudo apt-get update
+     sudo apt-get install -y clang cmake libssl-dev xz-utils
+     # (Optional) Install osxcross toolchain here if your setup requires it.
+     rustup target add aarch64-apple-darwin
🤖 Prompt for AI Agents
In .github/workflows/tests-rs-sdk-ffi-build.yml around lines 36 to 41, the
workflow only adds the Rust target for aarch64-apple-darwin but does not install
the full cross-compilation toolchain. Update the script to install or configure
all necessary system dependencies such as a cross-linker, clang, and SDK headers
required for linking to that target, ensuring the build can complete
successfully.

- name: Build FFI library for Apple target
working-directory: packages/rs-sdk-ffi
env:
# Set up cross-compilation environment variables if needed
CARGO_TARGET_AARCH64_APPLE_DARWIN_LINKER: rust-lld
run: |
cargo build --release --target aarch64-apple-darwin

- name: Verify build output
run: |
if [ ! -f "target/aarch64-apple-darwin/release/librs_sdk_ffi.a" ]; then
echo "Error: FFI library was not built for Apple target"
exit 1
fi
echo "FFI library successfully built for Apple target"
ls -la target/aarch64-apple-darwin/release/librs_sdk_ffi.a
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,28 @@ node_modules

# Rust build artifacts
/target
packages/*/target
.gitaipconfig

# Swift build artifacts and IDE files
.build/
.swiftpm/
.index-build/
DerivedData/
*.xcworkspace
xcuserdata/
*.dSYM/
*.o
*.swiftdeps
*.d

# Generated Swift SDK header files
packages/swift-sdk/Sources/CDashSDKFFI/DashSDKFFI.h
packages/swift-sdk/generated/DashSDKFFI.h

# Generated Swift SDK files
packages/swift-sdk/Sources/CDashSDKFFI/librs_sdk_ffi.pc
packages/swift-sdk/SwiftExampleApp/DashSDK.xcframework/

# rs-sdk-ffi build directory
packages/rs-sdk-ffi/build/
41 changes: 41 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ members = [
"packages/check-features",
"packages/wallet-utils-contract",
"packages/token-history-contract",
"packages/keyword-search-contract"
"packages/keyword-search-contract",
"packages/rs-sdk-ffi"
]

exclude = ["packages/wasm-sdk"] # This one is experimental and not ready for use
Expand Down
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@ COPY --parents \
packages/wasm-dpp \
packages/rs-dapi-client \
packages/rs-sdk \
packages/rs-sdk-ffi \
packages/check-features \
/platform/

Expand Down
Loading
Loading