@@ -8,7 +8,9 @@ This package provides multiple binding strategies for maximum compatibility:
88
99- ** C/C++ Bindings** - Generated with ` cbindgen ` for native applications
1010- ** WebAssembly** - Browser and Node.js support via ` wasm-bindgen `
11- - ** UniFFI Bindings** - Modern Swift, Kotlin, and Python bindings via Mozilla's UniFFI
11+ - ** UniFFI Bindings** - Modern bindings via Mozilla's UniFFI
12+ - Swift, Kotlin, Python (built-in)
13+ - C# and Go (via external generators)
1214
1315## Project Structure
1416
@@ -28,7 +30,9 @@ dojo.c/
2830├── bindings/ # Generated bindings output
2931│ ├── swift/
3032│ ├── kotlin/
31- │ └── python/
33+ │ ├── python/
34+ │ ├── csharp/
35+ │ └── go/
3236└── example/ # C usage examples
3337```
3438
@@ -64,33 +68,77 @@ Headers are automatically generated during `cargo build`:
6468- ` dojo.hpp ` - C++ header
6569- ` dojo.pyx ` - Cython definitions
6670
67- ### UniFFI Bindings (Swift, Kotlin, Python)
71+ ### UniFFI Bindings
6872
73+ Build the library first:
6974``` bash
70- # Build the library first
71- cargo build --release
75+ cargo build --release -p dojo-uniffi
76+ ```
77+
78+ #### Swift, Kotlin, Python (Built-in)
7279
80+ ``` bash
7381# Generate Swift bindings (iOS/macOS)
7482cargo run --bin uniffi-bindgen-swift --release -- \
75- target/release/libdojo_c .dylib bindings/swift --swift-sources
83+ target/release/libdojo_uniffi .dylib bindings/swift --swift-sources
7684
7785# Generate Kotlin bindings (Android)
7886cargo run --bin uniffi-bindgen-kotlin --release -- \
79- target/release/libdojo_c .dylib bindings/kotlin
87+ target/release/libdojo_uniffi .dylib bindings/kotlin
8088
8189# Generate Python bindings
8290cargo run --bin uniffi-bindgen-python --release -- \
83- target/release/libdojo_c.dylib bindings/python
91+ target/release/libdojo_uniffi.dylib bindings/python
92+ ```
93+
94+ #### C# and Go (External Generators)
95+
96+ C# and Go bindings use external tools. Install them first:
97+
98+ ``` bash
99+ # Install external binding generators (one-time setup)
100+ ./scripts/install_bindgen_tools.sh
101+ ```
102+
103+ Then generate bindings:
104+
105+ ``` bash
106+ # Generate C# bindings
107+ ./scripts/build_csharp.sh
108+
109+ # Generate Go bindings
110+ ./scripts/build_go.sh
111+
112+ # Or generate all bindings at once
113+ ./scripts/build_all_bindings.sh
114+ ```
115+
116+ ** Manual installation:**
117+
118+ ``` bash
119+ # C# (requires uniffi-bindgen-cs)
120+ cargo install uniffi-bindgen-cs --git https://github.com/NordSecurity/uniffi-bindgen-cs --tag v0.10.0+v0.29.4
121+
122+ # Go (requires uniffi-bindgen-go)
123+ cargo install uniffi-bindgen-go --git https://github.com/NordSecurity/uniffi-bindgen-go --tag v0.4.0+v0.28.3
84124```
85125
86126See [ ` src/uniffi/README.md ` ] ( src/uniffi/README.md ) for detailed UniFFI documentation.
87127
128+ ## Documentation
129+
130+ - ** [ BINDINGS_GUIDE.md] ( BINDINGS_GUIDE.md ) ** - Comprehensive guide for all language bindings
131+ - ** [ QUICK_REFERENCE.md] ( QUICK_REFERENCE.md ) ** - Quick command reference for all languages
132+ - ** [ CSHARP_GO_BINDINGS_SUMMARY.md] ( CSHARP_GO_BINDINGS_SUMMARY.md ) ** - Details on C# and Go implementation
133+
88134## Language Support Status
89135
90136| Language | Status | Notes |
91137| ----------| --------| -------|
92138| ** Swift** | ✅ Fully Functional | All features working, synchronous client |
93139| ** Python** | ✅ Fully Functional | All features working, synchronous client |
140+ | ** C#** | ✅ Functional | Via external uniffi-bindgen-cs (v0.10.0+v0.29.4) |
141+ | ** Go** | ✅ Functional | Via external uniffi-bindgen-go (v0.4.0+v0.28.3) |
94142| ** C/C++** | ✅ Functional | Basic functionality via cbindgen |
95143| ** WebAssembly** | ✅ Functional | Browser and Node.js support |
96144| ** Kotlin** | 🚧 Not Working | UniFFI v0.30 limitations with complex types |
@@ -112,6 +160,8 @@ clang example/main.c target/release/libdojo_c.dylib
112160
113161### Python Example
114162
163+ See ` examples/python/ ` for complete examples.
164+
115165``` python
116166from dojo import ToriiClient
117167
@@ -131,3 +181,42 @@ sub_id = await client.subscribe_entity_updates(
131181 EntityUpdateCallback(on_entity_update, on_error)
132182)
133183```
184+
185+ ### C# Example
186+
187+ See ` examples/csharp/ ` for complete examples.
188+
189+ ``` bash
190+ cd examples/csharp
191+ export DYLD_LIBRARY_PATH=../../target/release:$DYLD_LIBRARY_PATH # macOS
192+ dotnet run
193+ ```
194+
195+ ``` csharp
196+ using uniffi .dojo ;
197+
198+ var client = await ToriiClient .NewWithConfig (" http://localhost:8080" , 4 * 1024 * 1024 );
199+ var page = await client .Entities (query );
200+ ```
201+
202+ ### Go Example
203+
204+ See ` examples/go/ ` for complete examples.
205+
206+ ``` bash
207+ cd examples/go
208+ export DYLD_LIBRARY_PATH=../../target/release:$DYLD_LIBRARY_PATH # macOS
209+ go run fetch_entities.go
210+ ```
211+
212+ ``` go
213+ import dojo " dojo/uniffi/dojo"
214+
215+ client , err := dojo.ToriiClientNewWithConfig (" http://localhost:8080" , 4 *1024 *1024 )
216+ if err != nil {
217+ log.Fatal (err)
218+ }
219+ defer client.Destroy ()
220+
221+ page , err := client.Entities (query)
222+ ```
0 commit comments