@bennyblader/ddk-rn 1.0.0-rc6 → 1.0.0-rc7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -100
- package/android/build.gradle +0 -1
- package/android/src/main/jniLibs/arm64-v8a/libddk_ffi.so +0 -0
- package/android/src/main/jniLibs/armeabi-v7a/libddk_ffi.so +0 -0
- package/android/src/main/jniLibs/x86/libddk_ffi.so +0 -0
- package/android/src/main/jniLibs/x86_64/libddk_ffi.so +0 -0
- package/cpp/ddk_ffi.cpp +4583 -1245
- package/cpp/ddk_ffi.hpp +115 -10
- package/ios/DdkRn.xcframework/Info.plist +4 -4
- package/ios/DdkRn.xcframework/ios-arm64/libddk_ffi.a +0 -0
- package/ios/DdkRn.xcframework/ios-arm64-simulator/libddk_ffi.a +0 -0
- package/lib/commonjs/generated/NativeDdkRn.js.map +1 -0
- package/lib/commonjs/generated/ddk_ffi-ffi.js.map +1 -0
- package/lib/commonjs/{ddk_ffi.js → generated/ddk_ffi.js} +1458 -189
- package/lib/commonjs/generated/ddk_ffi.js.map +1 -0
- package/lib/commonjs/generated/index.js +63 -0
- package/lib/commonjs/generated/index.js.map +1 -0
- package/lib/commonjs/index.js +11 -48
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/generated/NativeDdkRn.js.map +1 -0
- package/lib/module/generated/ddk_ffi-ffi.js.map +1 -0
- package/lib/module/{ddk_ffi.js → generated/ddk_ffi.js} +1442 -184
- package/lib/module/generated/ddk_ffi.js.map +1 -0
- package/lib/module/generated/index.js +43 -0
- package/lib/module/generated/index.js.map +1 -0
- package/lib/module/index.js +2 -40
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/commonjs/src/generated/NativeDdkRn.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/{ddk_ffi-ffi.d.ts → generated/ddk_ffi-ffi.d.ts} +103 -15
- package/lib/typescript/commonjs/src/generated/ddk_ffi-ffi.d.ts.map +1 -0
- package/lib/typescript/{module/src → commonjs/src/generated}/ddk_ffi.d.ts +702 -125
- package/lib/typescript/commonjs/src/generated/ddk_ffi.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/generated/index.d.ts +8 -0
- package/lib/typescript/commonjs/src/generated/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +2 -7
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/generated/NativeDdkRn.d.ts.map +1 -0
- package/lib/typescript/module/src/{ddk_ffi-ffi.d.ts → generated/ddk_ffi-ffi.d.ts} +103 -15
- package/lib/typescript/module/src/generated/ddk_ffi-ffi.d.ts.map +1 -0
- package/lib/typescript/{commonjs/src → module/src/generated}/ddk_ffi.d.ts +702 -125
- package/lib/typescript/module/src/generated/ddk_ffi.d.ts.map +1 -0
- package/lib/typescript/module/src/generated/index.d.ts +8 -0
- package/lib/typescript/module/src/generated/index.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +2 -7
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/package.json +18 -47
- package/src/{ddk_ffi-ffi.ts → generated/ddk_ffi-ffi.ts} +261 -37
- package/src/{ddk_ffi.ts → generated/ddk_ffi.ts} +2585 -430
- package/src/generated/index.tsx +41 -0
- package/src/index.tsx +2 -41
- package/ubrn.config.yaml +4 -3
- package/lib/commonjs/NativeDdkRn.js.map +0 -1
- package/lib/commonjs/ddk_ffi-ffi.js.map +0 -1
- package/lib/commonjs/ddk_ffi.js.map +0 -1
- package/lib/module/NativeDdkRn.js.map +0 -1
- package/lib/module/ddk_ffi-ffi.js.map +0 -1
- package/lib/module/ddk_ffi.js.map +0 -1
- package/lib/typescript/commonjs/src/NativeDdkRn.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/ddk_ffi-ffi.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/ddk_ffi.d.ts.map +0 -1
- package/lib/typescript/module/src/NativeDdkRn.d.ts.map +0 -1
- package/lib/typescript/module/src/ddk_ffi-ffi.d.ts.map +0 -1
- package/lib/typescript/module/src/ddk_ffi.d.ts.map +0 -1
- /package/lib/commonjs/{NativeDdkRn.js → generated/NativeDdkRn.js} +0 -0
- /package/lib/commonjs/{ddk_ffi-ffi.js → generated/ddk_ffi-ffi.js} +0 -0
- /package/lib/module/{NativeDdkRn.js → generated/NativeDdkRn.js} +0 -0
- /package/lib/module/{ddk_ffi-ffi.js → generated/ddk_ffi-ffi.js} +0 -0
- /package/lib/typescript/commonjs/src/{NativeDdkRn.d.ts → generated/NativeDdkRn.d.ts} +0 -0
- /package/lib/typescript/module/src/{NativeDdkRn.d.ts → generated/NativeDdkRn.d.ts} +0 -0
- /package/src/{NativeDdkRn.ts → generated/NativeDdkRn.ts} +0 -0
package/README.md
CHANGED
|
@@ -48,7 +48,7 @@ import {
|
|
|
48
48
|
acceptOffer,
|
|
49
49
|
signAccept,
|
|
50
50
|
finalizeSign,
|
|
51
|
-
|
|
51
|
+
contractCetTransaction,
|
|
52
52
|
} from '@bennyblader/ddk-rn';
|
|
53
53
|
|
|
54
54
|
const keys = ContractKeyProvider.fromMnemonic(MNEMONIC, undefined, 'regtest');
|
|
@@ -71,15 +71,15 @@ const offer = createOffer({
|
|
|
71
71
|
contractFlags: 0,
|
|
72
72
|
});
|
|
73
73
|
// …acceptOffer → sign the funding PSBT → signAccept → finalizeSign →
|
|
74
|
-
//
|
|
74
|
+
// contractCetTransaction / contractRefundTransaction
|
|
75
75
|
```
|
|
76
76
|
|
|
77
77
|
Bytes cross the JSI boundary as `Uint8Array`, as they do in `@bennyblader/ddk`.
|
|
78
78
|
|
|
79
|
-
|
|
79
|
+
`../../examples/react-native/src/App.tsx` runs the complete flow on device — offline, deterministic,
|
|
80
80
|
and asserted by the Maestro E2E.
|
|
81
81
|
|
|
82
|
-
For complete API documentation, see the [main README](
|
|
82
|
+
For complete API documentation, see the [main README](../../README.md#-the-contract-api).
|
|
83
83
|
|
|
84
84
|
## Development
|
|
85
85
|
|
|
@@ -88,96 +88,35 @@ For complete API documentation, see the [main README](../README.md#-the-contract
|
|
|
88
88
|
- Node.js >= 20
|
|
89
89
|
- Rust >= 1.70
|
|
90
90
|
- pnpm
|
|
91
|
-
- UniFFI React Native, installed
|
|
92
|
-
`package.json`: `pnpm add -g uniffi-bindgen-react-native@<version>`
|
|
91
|
+
- UniFFI React Native, installed by the root `pnpm install`.
|
|
93
92
|
- iOS: Xcode 14+, CocoaPods
|
|
94
93
|
- Android: Android Studio, NDK 27.1.12297006
|
|
95
94
|
|
|
96
|
-
>
|
|
97
|
-
>
|
|
98
|
-
> recipes call the binary on `$PATH`, not the one in `node_modules`. A skew shows
|
|
99
|
-
> up as TypeScript errors like "Expected 2 arguments, but got 1" on every
|
|
100
|
-
> generated `.lower()` call.
|
|
95
|
+
> Keep the Rust UniFFI version and both npm generator pins compatible.
|
|
96
|
+
> Root commands use the workspace-local generator.
|
|
101
97
|
|
|
102
|
-
### Building from
|
|
98
|
+
### Building from source
|
|
103
99
|
|
|
104
|
-
|
|
105
|
-
# Install dependencies
|
|
106
|
-
pnpm install
|
|
107
|
-
|
|
108
|
-
# Generate all bindings and build the native libraries
|
|
109
|
-
just build
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
### Just Commands
|
|
113
|
-
|
|
114
|
-
```bash
|
|
115
|
-
# JSI + TurboModule bindings, the iOS XCFramework, and @bennyblader/ddk (N-API)
|
|
116
|
-
just build
|
|
117
|
-
|
|
118
|
-
# Generate JSI bindings only (TypeScript + C++)
|
|
119
|
-
just uniffi-jsi
|
|
120
|
-
|
|
121
|
-
# Generate TurboModule specifications
|
|
122
|
-
just uniffi-turbo
|
|
123
|
-
|
|
124
|
-
# Build the iOS XCFramework (release, stripped)
|
|
125
|
-
just build-ios
|
|
100
|
+
Run from the repository root:
|
|
126
101
|
|
|
127
|
-
|
|
128
|
-
just
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
just
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
just example-
|
|
135
|
-
|
|
136
|
-
# Android example build
|
|
137
|
-
just example-android
|
|
138
|
-
|
|
139
|
-
# Report the size of every binary destined for the npm package
|
|
140
|
-
just binary-sizes
|
|
141
|
-
|
|
142
|
-
# Clean all generated files
|
|
143
|
-
just clean
|
|
102
|
+
```sh
|
|
103
|
+
just install
|
|
104
|
+
just generate-react-native
|
|
105
|
+
just build react-native ios
|
|
106
|
+
just build react-native android
|
|
107
|
+
just native example-ios
|
|
108
|
+
just example react-native ios
|
|
109
|
+
just example react-native android
|
|
144
110
|
```
|
|
145
111
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
> app fails at link with `Undefined symbols … _uniffi_ddk_ffi_fn_func_<name>`.
|
|
150
|
-
> Nothing earlier in the chain catches this.
|
|
151
|
-
|
|
152
|
-
### Project Structure
|
|
153
|
-
|
|
154
|
-
```
|
|
155
|
-
ddk-rn/
|
|
156
|
-
├── src/ # Generated TypeScript bindings
|
|
157
|
-
│ ├── index.tsx # Main entry point (generated)
|
|
158
|
-
│ ├── ddk_ffi.ts # The API consumers import (generated)
|
|
159
|
-
│ ├── ddk_ffi-ffi.ts # Native JSI symbol declarations (generated)
|
|
160
|
-
│ └── __tests__/ # Hand-written — the only non-generated code in src/
|
|
161
|
-
├── cpp/ # Generated C++ JSI bindings
|
|
162
|
-
│ ├── ddk_ffi.hpp # C++ header (generated)
|
|
163
|
-
│ ├── ddk_ffi.cpp # C++ implementation (generated)
|
|
164
|
-
│ └── *.cpp/.h # TurboModule files (generated)
|
|
165
|
-
├── ios/ # iOS native module
|
|
166
|
-
│ ├── DdkRn.xcframework/ # Prebuilt iOS framework (generated, shipped)
|
|
167
|
-
│ └── *.h/.mm # iOS bridge code
|
|
168
|
-
├── android/ # Android native module
|
|
169
|
-
│ └── src/main/
|
|
170
|
-
│ ├── java/ # Kotlin/Java bridge code
|
|
171
|
-
│ └── jniLibs/ # Prebuilt native libraries (generated, shipped)
|
|
172
|
-
├── example/ # Example React Native app + Maestro flows
|
|
173
|
-
├── patches/ # pnpm patch for an unreleased ubrn fix
|
|
174
|
-
├── scripts/ # Package verification
|
|
175
|
-
└── ubrn.config.yaml # UniFFI React Native configuration
|
|
176
|
-
```
|
|
112
|
+
The package's `src/index.tsx` re-exports `src/generated/`. UniFFI owns everything
|
|
113
|
+
under `src/generated/` and the native adapters in `cpp/`, `ios/` and `android/`.
|
|
114
|
+
The example and Maestro flows live in `../../examples/react-native/`.
|
|
177
115
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
116
|
+
Native build and device-test recipes live in this package's `justfile`.
|
|
117
|
+
`just native --list` from the repository root lists the individual steps.
|
|
118
|
+
Rebuild native libraries after changing Rust exports, as generating TypeScript
|
|
119
|
+
alone does not update the linked native symbols.
|
|
181
120
|
|
|
182
121
|
### Testing
|
|
183
122
|
|
|
@@ -204,12 +143,12 @@ launching.
|
|
|
204
143
|
|
|
205
144
|
| command | needs | time |
|
|
206
145
|
|---|---|---|
|
|
207
|
-
| `just e2e-flows` | nothing — no device, no app | ~15s |
|
|
208
|
-
| `just e2e-ios-test` | the app already installed | ~10s |
|
|
209
|
-
| `just e2e-ios` | full: build + install + run | ~5-10m |
|
|
146
|
+
| `just native e2e-flows` | nothing — no device, no app | ~15s |
|
|
147
|
+
| `just native e2e-ios-test` | the app already installed | ~10s |
|
|
148
|
+
| `just native e2e-ios` | full: build + install + run | ~5-10m |
|
|
210
149
|
|
|
211
|
-
Android needs a one-time `just e2e-android-setup` (~1.5GB) to create the
|
|
212
|
-
emulator and AVD, then `just e2e-android`.
|
|
150
|
+
Android needs a one-time `just native e2e-android-setup` (~1.5GB) to create the
|
|
151
|
+
emulator and AVD, then `just native e2e-android`.
|
|
213
152
|
|
|
214
153
|
While editing a flow, stay in `e2e-ios-test`; only rebuild when the app itself
|
|
215
154
|
changes (JS, Rust, or the generated bindings).
|
|
@@ -235,10 +174,10 @@ apps actually build with.
|
|
|
235
174
|
|
|
236
175
|
```bash
|
|
237
176
|
# Install iOS dependencies with new architecture
|
|
238
|
-
just example-ios
|
|
177
|
+
just example react-native ios
|
|
239
178
|
|
|
240
179
|
# Run the app
|
|
241
|
-
cd
|
|
180
|
+
cd ../../examples/react-native
|
|
242
181
|
npx react-native run-ios
|
|
243
182
|
```
|
|
244
183
|
|
|
@@ -246,10 +185,10 @@ npx react-native run-ios
|
|
|
246
185
|
|
|
247
186
|
```bash
|
|
248
187
|
# Build Android app
|
|
249
|
-
just example-android
|
|
188
|
+
just example react-native android
|
|
250
189
|
|
|
251
190
|
# Run the app
|
|
252
|
-
cd
|
|
191
|
+
cd ../../examples/react-native
|
|
253
192
|
npx react-native run-android
|
|
254
193
|
```
|
|
255
194
|
|
|
@@ -264,7 +203,7 @@ just release 0.5.0
|
|
|
264
203
|
This will:
|
|
265
204
|
|
|
266
205
|
1. Check the working directory is clean
|
|
267
|
-
2. Set the version in `
|
|
206
|
+
2. Set the version in `packages/node-browser/package.json`, `packages/react-native/package.json` and `ffi/Cargo.toml`
|
|
268
207
|
3. Commit, tag as `v0.5.0` and push
|
|
269
208
|
|
|
270
209
|
Publishing happens in CI — pushing the tag is what publishes. The iOS
|
|
@@ -302,7 +241,7 @@ same bindgen, so it has the same names, the same argument lists and the same
|
|
|
302
241
|
If you encounter build issues on iOS:
|
|
303
242
|
|
|
304
243
|
```bash
|
|
305
|
-
cd
|
|
244
|
+
cd ../../examples/react-native/ios
|
|
306
245
|
pod deintegrate
|
|
307
246
|
pod install
|
|
308
247
|
```
|
|
@@ -312,7 +251,7 @@ pod install
|
|
|
312
251
|
Clean and rebuild Android:
|
|
313
252
|
|
|
314
253
|
```bash
|
|
315
|
-
cd
|
|
254
|
+
cd ../../examples/react-native/android
|
|
316
255
|
./gradlew clean
|
|
317
256
|
./gradlew build
|
|
318
257
|
```
|
|
@@ -322,13 +261,13 @@ cd example/android
|
|
|
322
261
|
If bindings are missing, regenerate them:
|
|
323
262
|
|
|
324
263
|
```bash
|
|
325
|
-
|
|
326
|
-
just build
|
|
264
|
+
pnpm --dir packages/react-native clean
|
|
265
|
+
just build react-native ios
|
|
327
266
|
```
|
|
328
267
|
|
|
329
268
|
### A modified `android/build.gradle` after building
|
|
330
269
|
|
|
331
|
-
`just build-android <abi>` narrows `abiFilters` to the ABIs you passed and wipes
|
|
270
|
+
`just native build-android <abi>` narrows `abiFilters` to the ABIs you passed and wipes
|
|
332
271
|
`jniLibs/` for the rest. Never commit that — a single-ABI `build.gradle` ships an
|
|
333
272
|
app that only runs on one architecture:
|
|
334
273
|
|
package/android/build.gradle
CHANGED
|
@@ -133,7 +133,6 @@ dependencies {
|
|
|
133
133
|
//noinspection GradleDynamicVersion
|
|
134
134
|
implementation "com.facebook.react:react-native:+"
|
|
135
135
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
136
|
-
implementation "net.java.dev.jna:jna:5.17.0@aar"
|
|
137
136
|
}
|
|
138
137
|
|
|
139
138
|
if (isNewArchitectureEnabled()) {
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|