@fedimint/react-native-bindings 0.0.0-om-rn1-d72fdc108a01df2d7d64c2b85c8b1f9fd43927cb

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.
Files changed (111) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +7 -0
  3. package/ReactNative.podspec +45 -0
  4. package/ReactNativeBindings.podspec +44 -0
  5. package/android/CMakeLists.txt +76 -0
  6. package/android/build.gradle +144 -0
  7. package/android/cpp-adapter.cpp +44 -0
  8. package/android/generated/java/com/fedimint/reactnative/NativeReactNativeBindingsSpec.java +41 -0
  9. package/android/generated/jni/CMakeLists.txt +28 -0
  10. package/android/generated/jni/ReactNativeBindingsSpec-generated.cpp +38 -0
  11. package/android/generated/jni/ReactNativeBindingsSpec.h +31 -0
  12. package/android/generated/jni/react/renderer/components/ReactNativeBindingsSpec/ComponentDescriptors.cpp +22 -0
  13. package/android/generated/jni/react/renderer/components/ReactNativeBindingsSpec/ComponentDescriptors.h +24 -0
  14. package/android/generated/jni/react/renderer/components/ReactNativeBindingsSpec/EventEmitters.cpp +16 -0
  15. package/android/generated/jni/react/renderer/components/ReactNativeBindingsSpec/EventEmitters.h +17 -0
  16. package/android/generated/jni/react/renderer/components/ReactNativeBindingsSpec/Props.cpp +19 -0
  17. package/android/generated/jni/react/renderer/components/ReactNativeBindingsSpec/Props.h +18 -0
  18. package/android/generated/jni/react/renderer/components/ReactNativeBindingsSpec/ReactNativeBindingsSpecJSI.h +45 -0
  19. package/android/generated/jni/react/renderer/components/ReactNativeBindingsSpec/ShadowNodes.cpp +17 -0
  20. package/android/generated/jni/react/renderer/components/ReactNativeBindingsSpec/ShadowNodes.h +23 -0
  21. package/android/generated/jni/react/renderer/components/ReactNativeBindingsSpec/States.cpp +16 -0
  22. package/android/generated/jni/react/renderer/components/ReactNativeBindingsSpec/States.h +20 -0
  23. package/android/src/main/AndroidManifest.xml +5 -0
  24. package/android/src/main/java/com/fedimint/reactnative/ReactNativeBindingsModule.kt +43 -0
  25. package/android/src/main/java/com/fedimint/reactnative/ReactNativeBindingsPackage.kt +34 -0
  26. package/app.plugin.js +1 -0
  27. package/cpp/fedimint-react-native-bindings.cpp +16 -0
  28. package/cpp/fedimint-react-native-bindings.h +15 -0
  29. package/cpp/generated/fedimint_client_uniffi.cpp +2281 -0
  30. package/cpp/generated/fedimint_client_uniffi.hpp +95 -0
  31. package/ios/ReactNativeBindings.h +16 -0
  32. package/ios/ReactNativeBindings.mm +66 -0
  33. package/ios/generated/ReactCodegen/ReactNativeBindingsSpec/ComponentDescriptors.cpp +22 -0
  34. package/ios/generated/ReactCodegen/ReactNativeBindingsSpec/ComponentDescriptors.h +24 -0
  35. package/ios/generated/ReactCodegen/ReactNativeBindingsSpec/EventEmitters.cpp +16 -0
  36. package/ios/generated/ReactCodegen/ReactNativeBindingsSpec/EventEmitters.h +17 -0
  37. package/ios/generated/ReactCodegen/ReactNativeBindingsSpec/Props.cpp +19 -0
  38. package/ios/generated/ReactCodegen/ReactNativeBindingsSpec/Props.h +18 -0
  39. package/ios/generated/ReactCodegen/ReactNativeBindingsSpec/RCTComponentViewHelpers.h +18 -0
  40. package/ios/generated/ReactCodegen/ReactNativeBindingsSpec/ReactNativeBindingsSpec-generated.mm +46 -0
  41. package/ios/generated/ReactCodegen/ReactNativeBindingsSpec/ReactNativeBindingsSpec.h +63 -0
  42. package/ios/generated/ReactCodegen/ReactNativeBindingsSpec/ShadowNodes.cpp +17 -0
  43. package/ios/generated/ReactCodegen/ReactNativeBindingsSpec/ShadowNodes.h +23 -0
  44. package/ios/generated/ReactCodegen/ReactNativeBindingsSpec/States.cpp +16 -0
  45. package/ios/generated/ReactCodegen/ReactNativeBindingsSpec/States.h +20 -0
  46. package/ios/generated/ReactCodegen/ReactNativeBindingsSpecJSI.h +45 -0
  47. package/lib/commonjs/NativeReactNativeBindings.js +10 -0
  48. package/lib/commonjs/NativeReactNativeBindings.js.map +1 -0
  49. package/lib/commonjs/generated/fedimint_client_uniffi-ffi.js +44 -0
  50. package/lib/commonjs/generated/fedimint_client_uniffi-ffi.js.map +1 -0
  51. package/lib/commonjs/generated/fedimint_client_uniffi.js +426 -0
  52. package/lib/commonjs/generated/fedimint_client_uniffi.js.map +1 -0
  53. package/lib/commonjs/index.js +63 -0
  54. package/lib/commonjs/index.js.map +1 -0
  55. package/lib/commonjs/package.json +1 -0
  56. package/lib/module/NativeReactNativeBindings.js +7 -0
  57. package/lib/module/NativeReactNativeBindings.js.map +1 -0
  58. package/lib/module/generated/fedimint_client_uniffi-ffi.js +43 -0
  59. package/lib/module/generated/fedimint_client_uniffi-ffi.js.map +1 -0
  60. package/lib/module/generated/fedimint_client_uniffi.js +420 -0
  61. package/lib/module/generated/fedimint_client_uniffi.js.map +1 -0
  62. package/lib/module/index.js +43 -0
  63. package/lib/module/index.js.map +1 -0
  64. package/lib/module/package.json +1 -0
  65. package/lib/typescript/commonjs/package.json +1 -0
  66. package/lib/typescript/commonjs/plugin/src/index.d.ts +11 -0
  67. package/lib/typescript/commonjs/plugin/src/index.d.ts.map +1 -0
  68. package/lib/typescript/commonjs/plugin/src/utils.d.ts +9 -0
  69. package/lib/typescript/commonjs/plugin/src/utils.d.ts.map +1 -0
  70. package/lib/typescript/commonjs/plugin/src/withAndroid.d.ts +6 -0
  71. package/lib/typescript/commonjs/plugin/src/withAndroid.d.ts.map +1 -0
  72. package/lib/typescript/commonjs/plugin/src/withBinaryArtifacts.d.ts +7 -0
  73. package/lib/typescript/commonjs/plugin/src/withBinaryArtifacts.d.ts.map +1 -0
  74. package/lib/typescript/commonjs/plugin/src/withIOS.d.ts +7 -0
  75. package/lib/typescript/commonjs/plugin/src/withIOS.d.ts.map +1 -0
  76. package/lib/typescript/commonjs/src/NativeReactNativeBindings.d.ts +8 -0
  77. package/lib/typescript/commonjs/src/NativeReactNativeBindings.d.ts.map +1 -0
  78. package/lib/typescript/commonjs/src/generated/fedimint_client_uniffi-ffi.d.ts +95 -0
  79. package/lib/typescript/commonjs/src/generated/fedimint_client_uniffi-ffi.d.ts.map +1 -0
  80. package/lib/typescript/commonjs/src/generated/fedimint_client_uniffi.d.ts +501 -0
  81. package/lib/typescript/commonjs/src/generated/fedimint_client_uniffi.d.ts.map +1 -0
  82. package/lib/typescript/commonjs/src/index.d.ts +8 -0
  83. package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
  84. package/lib/typescript/module/package.json +1 -0
  85. package/lib/typescript/module/plugin/src/index.d.ts +11 -0
  86. package/lib/typescript/module/plugin/src/index.d.ts.map +1 -0
  87. package/lib/typescript/module/plugin/src/utils.d.ts +9 -0
  88. package/lib/typescript/module/plugin/src/utils.d.ts.map +1 -0
  89. package/lib/typescript/module/plugin/src/withAndroid.d.ts +6 -0
  90. package/lib/typescript/module/plugin/src/withAndroid.d.ts.map +1 -0
  91. package/lib/typescript/module/plugin/src/withBinaryArtifacts.d.ts +7 -0
  92. package/lib/typescript/module/plugin/src/withBinaryArtifacts.d.ts.map +1 -0
  93. package/lib/typescript/module/plugin/src/withIOS.d.ts +7 -0
  94. package/lib/typescript/module/plugin/src/withIOS.d.ts.map +1 -0
  95. package/lib/typescript/module/src/NativeReactNativeBindings.d.ts +8 -0
  96. package/lib/typescript/module/src/NativeReactNativeBindings.d.ts.map +1 -0
  97. package/lib/typescript/module/src/generated/fedimint_client_uniffi-ffi.d.ts +95 -0
  98. package/lib/typescript/module/src/generated/fedimint_client_uniffi-ffi.d.ts.map +1 -0
  99. package/lib/typescript/module/src/generated/fedimint_client_uniffi.d.ts +501 -0
  100. package/lib/typescript/module/src/generated/fedimint_client_uniffi.d.ts.map +1 -0
  101. package/lib/typescript/module/src/index.d.ts +8 -0
  102. package/lib/typescript/module/src/index.d.ts.map +1 -0
  103. package/package.json +146 -0
  104. package/patches/rn083_callinvoker.patch +50 -0
  105. package/plugin/tsconfig.json +18 -0
  106. package/react-native.config.js +15 -0
  107. package/scripts/download-binaries.js +111 -0
  108. package/src/NativeReactNativeBindings.ts +10 -0
  109. package/src/generated/fedimint_client_uniffi-ffi.ts +221 -0
  110. package/src/generated/fedimint_client_uniffi.ts +651 -0
  111. package/src/index.tsx +41 -0
package/package.json ADDED
@@ -0,0 +1,146 @@
1
+ {
2
+ "name": "@fedimint/react-native-bindings",
3
+ "version": "0.0.0-om-rn1-d72fdc108a01df2d7d64c2b85c8b1f9fd43927cb",
4
+ "description": "Fedimint Client SDK for React-Native",
5
+ "source": "./src/index.tsx",
6
+ "main": "./lib/commonjs/index.js",
7
+ "module": "./lib/module/index.js",
8
+ "exports": {
9
+ ".": {
10
+ "source": "./src/index.tsx",
11
+ "types": "./lib/typescript/module/src/index.d.ts",
12
+ "default": "./lib/module/index.js"
13
+ },
14
+ "./package.json": "./package.json"
15
+ },
16
+ "files": [
17
+ "src",
18
+ "lib",
19
+ "android",
20
+ "ios",
21
+ "scripts",
22
+ "cpp",
23
+ "plugin",
24
+ "patches",
25
+ "app.plugin.js",
26
+ "*.podspec",
27
+ "react-native.config.js",
28
+ "!ios/build",
29
+ "!android/build",
30
+ "!android/gradle",
31
+ "!android/gradlew",
32
+ "!android/gradlew.bat",
33
+ "!android/local.properties",
34
+ "!android/src/main/jniLibs",
35
+ "!plugin/src",
36
+ "!**/__tests__",
37
+ "!**/__fixtures__",
38
+ "!**/__mocks__",
39
+ "!**/.*",
40
+ "!*.xcframework"
41
+ ],
42
+ "keywords": [
43
+ "react-native",
44
+ "ios",
45
+ "android"
46
+ ],
47
+ "repository": {
48
+ "type": "git",
49
+ "url": "git+https://github.com/fedimint/fedimint-sdk.git"
50
+ },
51
+ "author": "Fedimint Developers <reach.oms2004@gmail.com> (https://github.com/fedimint)",
52
+ "license": "MIT",
53
+ "bugs": {
54
+ "url": "https://github.com/fedimint/fedimint-sdk/issues"
55
+ },
56
+ "homepage": "https://github.com/fedimint/fedimint-sdk#readme",
57
+ "publishConfig": {
58
+ "registry": "https://registry.npmjs.org/"
59
+ },
60
+ "devDependencies": {
61
+ "@babel/preset-env": "^7.29.0",
62
+ "@react-native-community/cli": "15.0.1",
63
+ "@types/jest": "^29.5.5",
64
+ "@types/react": "^19.0.8",
65
+ "del-cli": "^5.1.0",
66
+ "jest": "^29.7.0",
67
+ "prettier": "^3.0.3",
68
+ "react": "19.2.0",
69
+ "react-native": "0.83.1",
70
+ "react-native-builder-bob": "^0.40.17",
71
+ "typescript": "^5.2.2"
72
+ },
73
+ "resolutions": {
74
+ "@types/react": "^19.0.8"
75
+ },
76
+ "peerDependencies": {
77
+ "react": "*",
78
+ "react-native": "*"
79
+ },
80
+ "react-native-builder-bob": {
81
+ "source": "src",
82
+ "output": "lib",
83
+ "targets": [
84
+ "codegen",
85
+ [
86
+ "commonjs",
87
+ {
88
+ "esm": true
89
+ }
90
+ ],
91
+ [
92
+ "module",
93
+ {
94
+ "esm": true
95
+ }
96
+ ],
97
+ [
98
+ "typescript",
99
+ {
100
+ "project": "tsconfig.build.json"
101
+ }
102
+ ]
103
+ ]
104
+ },
105
+ "codegenConfig": {
106
+ "name": "ReactNativeBindingsSpec",
107
+ "type": "all",
108
+ "jsSrcsDir": "src",
109
+ "outputDir": {
110
+ "android": "android/generated",
111
+ "ios": "ios/generated"
112
+ },
113
+ "android": {
114
+ "javaPackageName": "com.fedimint.reactnative"
115
+ },
116
+ "includesGeneratedCode": true
117
+ },
118
+ "create-react-native-library": {
119
+ "type": "module-new",
120
+ "languages": "cpp",
121
+ "version": "0.41.2"
122
+ },
123
+ "dependencies": {
124
+ "@expo/config-plugins": "^9.0.0",
125
+ "uniffi-bindgen-react-native": "0.29.3-1",
126
+ "@fedimint/types": "0.0.0-om-rn1-d72fdc108a01df2d7d64c2b85c8b1f9fd43927cb"
127
+ },
128
+ "checksums": {
129
+ "android": "2cf6baa1447a765337571e82dcfff25effc324fddfd9c65e81de5c7bce0a2d53",
130
+ "ios": "f04625c75e21b12c100beb47227a08f13a677003a165ac86647cd97c6c61128e"
131
+ },
132
+ "scripts": {
133
+ "ubrn:ios": "ubrn build ios --and-generate",
134
+ "ubrn:android": "ubrn build android --and-generate && patch -p0 --forward < patches/rn083_callinvoker.patch || true",
135
+ "ubrn:ios:release": "ubrn build ios --and-generate --release",
136
+ "ubrn:android:release": "ubrn build android --and-generate --release && patch -p0 --forward < patches/rn083_callinvoker.patch || true",
137
+ "ubrn:checkout": "ubrn checkout",
138
+ "ubrn:clean": "rm -rfv cpp/ android/CMakeLists.txt android/src/main/java android/*.cpp ios/ src/Native* src/index.*ts* src/generated/",
139
+ "clean:deep": "pnpm clean && rm -rfv cpp/ android/CMakeLists.txt android/src/main/java android/*.cpp ios/ src/Native* src/index.*ts* src/generated/",
140
+ "clean": "rm -rfv android/build example/android/build example/android/app/build example/ios/build lib plugin/build",
141
+ "build": "bob build && pnpm build:plugin",
142
+ "build:plugin": "cd plugin && tsc",
143
+ "typecheck": "tsc",
144
+ "postinstall": "node scripts/download-binaries.js"
145
+ }
146
+ }
@@ -0,0 +1,50 @@
1
+ --- android/cpp-adapter.cpp.orig 2026-02-04 04:45:17
2
+ +++ android/cpp-adapter.cpp 2026-02-04 04:45:39
3
+ @@ -1,6 +1,7 @@
4
+ // Generated by uniffi-bindgen-react-native
5
+ #include <jni.h>
6
+ #include <jsi/jsi.h>
7
+ +#include <fbjni/fbjni.h>
8
+ #include <ReactCommon/CallInvokerHolder.h>
9
+ #include "fedimint-react-native.h"
10
+
11
+ @@ -24,33 +25,13 @@
12
+ jlong rtPtr,
13
+ jobject callInvokerHolderJavaObj
14
+ ) {
15
+ - // https://github.com/realm/realm-js/blob/main/packages/realm/binding/android/src/main/cpp/io_realm_react_RealmReactModule.cpp#L122-L145
16
+ - // React Native uses the fbjni library for handling JNI, which has the concept of "hybrid objects",
17
+ - // which are Java objects containing a pointer to a C++ object. The CallInvokerHolder, which has the
18
+ - // invokeAsync method we want access to, is one such hybrid object.
19
+ - // Rather than reworking our code to use fbjni throughout, this code unpacks the C++ object from the Java
20
+ - // object `callInvokerHolderJavaObj` manually, based on reverse engineering the fbjni code.
21
+ + // React Native 0.77+ uses fbjni HybridClass for CallInvokerHolder
22
+ + // Use the proper fbjni API to extract the CallInvoker
23
+ + auto callInvokerHolder = facebook::jni::wrap_alias(
24
+ + reinterpret_cast<facebook::react::CallInvokerHolder::javaobject>(callInvokerHolderJavaObj)
25
+ + )->cthis();
26
+ + auto jsCallInvoker = callInvokerHolder->getCallInvoker();
27
+
28
+ - // 1. Get the Java object referred to by the mHybridData field of the Java holder object
29
+ - auto callInvokerHolderClass = env->GetObjectClass(callInvokerHolderJavaObj);
30
+ - auto hybridDataField = env->GetFieldID(callInvokerHolderClass, "mHybridData", "Lcom/facebook/jni/HybridData;");
31
+ - auto hybridDataObj = env->GetObjectField(callInvokerHolderJavaObj, hybridDataField);
32
+ -
33
+ - // 2. Get the destructor Java object referred to by the mDestructor field from the myHybridData Java object
34
+ - auto hybridDataClass = env->FindClass("com/facebook/jni/HybridData");
35
+ - auto destructorField =
36
+ - env->GetFieldID(hybridDataClass, "mDestructor", "Lcom/facebook/jni/HybridData$Destructor;");
37
+ - auto destructorObj = env->GetObjectField(hybridDataObj, destructorField);
38
+ -
39
+ - // 3. Get the mNativePointer field from the mDestructor Java object
40
+ - auto destructorClass = env->FindClass("com/facebook/jni/HybridData$Destructor");
41
+ - auto nativePointerField = env->GetFieldID(destructorClass, "mNativePointer", "J");
42
+ - auto nativePointerValue = env->GetLongField(destructorObj, nativePointerField);
43
+ -
44
+ - // 4. Cast the mNativePointer back to its C++ type
45
+ - auto nativePointer = reinterpret_cast<facebook::react::CallInvokerHolder*>(nativePointerValue);
46
+ - auto jsCallInvoker = nativePointer->getCallInvoker();
47
+ -
48
+ auto runtime = reinterpret_cast<jsi::Runtime *>(rtPtr);
49
+ return fedimint_reactnative::installRustCrate(*runtime, jsCallInvoker);
50
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "compilerOptions": {
3
+ "outDir": "./build",
4
+ "rootDir": "./src",
5
+ "declaration": true,
6
+ "module": "commonjs",
7
+ "moduleResolution": "node",
8
+ "target": "ES2020",
9
+ "lib": ["ES2020"],
10
+ "strict": true,
11
+ "esModuleInterop": true,
12
+ "skipLibCheck": true,
13
+ "resolveJsonModule": true,
14
+ "verbatimModuleSyntax": false
15
+ },
16
+ "include": ["src/**/*"],
17
+ "exclude": ["node_modules", "build"]
18
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @fedimint/react-native-bindings configuration
3
+ * @type {import('@react-native-community/cli-types').UserDependencyConfig}
4
+ */
5
+ module.exports = {
6
+ dependency: {
7
+ platforms: {
8
+ android: {
9
+ cmakeListsPath: 'generated/android/app/build/generated/source/codegen/jni/CMakeLists.txt',
10
+ packageImportPath: 'import com.fedimint.reactnative.ReactNativeBindingsPackage;',
11
+ packageInstance: 'new ReactNativeBindingsPackage()',
12
+ },
13
+ },
14
+ },
15
+ };
@@ -0,0 +1,111 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+ const https = require('https');
4
+ const { execSync } = require('child_process');
5
+ const crypto = require('crypto');
6
+
7
+ const pkg = require('../package.json');
8
+
9
+ // Check if we should skip
10
+ if (process.env.EXPO_PUBLIC_SKIP_POSTINSTALL) {
11
+ console.log('Skipping postinstall due to EXPO_PUBLIC_SKIP_POSTINSTALL');
12
+ process.exit(0);
13
+ }
14
+
15
+ // Check if artifacts already exist (simple check)
16
+ const androidLibCheck = path.join(__dirname, '../android/src/main/jniLibs');
17
+ const iosFrameworkCheck = path.join(__dirname, '../FedimintReactNativeBindingsFramework.xcframework');
18
+
19
+ if (fs.existsSync(androidLibCheck) && fs.existsSync(iosFrameworkCheck)) {
20
+ console.log('Binaries already present, skipping download.');
21
+ process.exit(0);
22
+ }
23
+
24
+ const REPO = 'https://github.com/fedimint/fedimint-sdk';
25
+ let TAG = `v${pkg.version}`;
26
+ if (pkg.version.includes('-') || pkg.version.includes('snapshot')) {
27
+ TAG = 'snapshot';
28
+ }
29
+ const ANDROID_CHECKSUM = pkg.checksums ? pkg.checksums.android : null;
30
+ const IOS_CHECKSUM = pkg.checksums ? pkg.checksums.ios : null;
31
+
32
+ if (!ANDROID_CHECKSUM || !IOS_CHECKSUM) {
33
+ console.warn("Checksums not found in package.json. Skipping download (assume local dev or first install).");
34
+ process.exit(0);
35
+ }
36
+
37
+ const downloadFile = (url, dest) => {
38
+ return new Promise((resolve, reject) => {
39
+ const file = fs.createWriteStream(dest);
40
+ https.get(url, (response) => {
41
+ if (response.statusCode === 302 || response.statusCode === 301) {
42
+ downloadFile(response.headers.location, dest).then(resolve).catch(reject);
43
+ return;
44
+ }
45
+ response.pipe(file);
46
+ file.on('finish', () => {
47
+ file.close(resolve);
48
+ });
49
+ }).on('error', (err) => {
50
+ fs.unlink(dest, () => { });
51
+ reject(err);
52
+ });
53
+ });
54
+ };
55
+
56
+ const verifyChecksum = (file, expected) => {
57
+ const fileBuffer = fs.readFileSync(file);
58
+ const hashSum = crypto.createHash('sha256');
59
+ hashSum.update(fileBuffer);
60
+ const hex = hashSum.digest('hex');
61
+ return hex === expected;
62
+ };
63
+
64
+ const unzip = (file, dest) => {
65
+ try {
66
+ execSync(`unzip -o ${file} -d ${dest}`);
67
+ } catch (e) {
68
+ console.error(`Failed to unzip ${file}: ${e.message}`);
69
+ throw e;
70
+ }
71
+ };
72
+
73
+ const main = async () => {
74
+ const androidUrl = `${REPO}/releases/download/${TAG}/android-artifacts.zip`;
75
+ const iosUrl = `${REPO}/releases/download/${TAG}/ios-artifacts.zip`;
76
+
77
+ console.log(`Downloading Android artifacts from ${androidUrl}...`);
78
+ await downloadFile(androidUrl, 'android-artifacts.zip');
79
+
80
+ if (!verifyChecksum('android-artifacts.zip', ANDROID_CHECKSUM)) {
81
+ console.error('Android checkum mismatch!');
82
+ process.exit(1);
83
+ }
84
+
85
+ console.log('Extracting Android artifacts...');
86
+ // Adjust destination if needed based on zip structure
87
+ unzip('android-artifacts.zip', path.join(__dirname, '../'));
88
+ fs.unlinkSync('android-artifacts.zip');
89
+
90
+
91
+ console.log(`Downloading iOS artifacts from ${iosUrl}...`);
92
+ await downloadFile(iosUrl, 'ios-artifacts.zip');
93
+
94
+ if (!verifyChecksum('ios-artifacts.zip', IOS_CHECKSUM)) {
95
+ console.error('iOS checkum mismatch!');
96
+ process.exit(1);
97
+ }
98
+
99
+ console.log('Extracting iOS artifacts...');
100
+ unzip('ios-artifacts.zip', path.join(__dirname, '../'));
101
+ fs.unlinkSync('ios-artifacts.zip');
102
+
103
+ console.log('Binaries downloaded and installed successfully.');
104
+ };
105
+
106
+ main().catch(err => {
107
+ console.error('Error downloading binaries:', err);
108
+ // Don't fail install in case of network error, just warn?
109
+ // Or fail strictly? The user requested script did `exit 1` on checksum fail, so we might want to fail.
110
+ process.exit(1);
111
+ });
@@ -0,0 +1,10 @@
1
+ // Generated by uniffi-bindgen-react-native
2
+ import type { TurboModule } from 'react-native';
3
+ import { TurboModuleRegistry } from 'react-native';
4
+
5
+ export interface Spec extends TurboModule {
6
+ installRustCrate(): boolean;
7
+ cleanupRustCrate(): boolean;
8
+ }
9
+
10
+ export default TurboModuleRegistry.getEnforcing<Spec>('ReactNativeBindings');
@@ -0,0 +1,221 @@
1
+ // This file was autogenerated by some hot garbage in the `uniffi-bindgen-react-native` crate.
2
+ // Trust me, you don't want to mess with it!
3
+
4
+ import {
5
+ type StructuralEquality as UniffiStructuralEquality,
6
+ type UniffiForeignFuture as RuntimeUniffiForeignFuture,
7
+ type UniffiRustCallStatus,
8
+ type UniffiRustArcPtr,
9
+ type UniffiRustFutureContinuationCallback as RuntimeUniffiRustFutureContinuationCallback,
10
+ type UniffiResult,
11
+ } from 'uniffi-bindgen-react-native'
12
+
13
+ interface NativeModuleInterface {
14
+ ubrn_uniffi_internal_fn_func_ffi__string_to_byte_length(
15
+ string: string,
16
+ uniffi_out_err: UniffiRustCallStatus,
17
+ ): number
18
+ ubrn_uniffi_internal_fn_func_ffi__string_to_arraybuffer(
19
+ string: string,
20
+ uniffi_out_err: UniffiRustCallStatus,
21
+ ): Uint8Array
22
+ ubrn_uniffi_internal_fn_func_ffi__arraybuffer_to_string(
23
+ buffer: Uint8Array,
24
+ uniffi_out_err: UniffiRustCallStatus,
25
+ ): string
26
+ ubrn_uniffi_fedimint_client_uniffi_fn_clone_rpchandler(
27
+ ptr: bigint,
28
+ uniffi_out_err: UniffiRustCallStatus,
29
+ ): bigint
30
+ ubrn_uniffi_fedimint_client_uniffi_fn_free_rpchandler(
31
+ ptr: bigint,
32
+ uniffi_out_err: UniffiRustCallStatus,
33
+ ): void
34
+ ubrn_uniffi_fedimint_client_uniffi_fn_constructor_rpchandler_new(
35
+ dbPath: Uint8Array,
36
+ uniffi_out_err: UniffiRustCallStatus,
37
+ ): bigint
38
+ ubrn_uniffi_fedimint_client_uniffi_fn_method_rpchandler_rpc(
39
+ ptr: bigint,
40
+ requestJson: Uint8Array,
41
+ callback: bigint,
42
+ uniffi_out_err: UniffiRustCallStatus,
43
+ ): void
44
+ ubrn_uniffi_fedimint_client_uniffi_fn_init_callback_vtable_rpccallback(
45
+ vtable: UniffiVTableCallbackInterfaceRpcCallback,
46
+ ): void
47
+ ubrn_uniffi_fedimint_client_uniffi_checksum_method_rpchandler_rpc(): number
48
+ ubrn_uniffi_fedimint_client_uniffi_checksum_constructor_rpchandler_new(): number
49
+ ubrn_uniffi_fedimint_client_uniffi_checksum_method_rpccallback_on_response(): number
50
+ ubrn_ffi_fedimint_client_uniffi_uniffi_contract_version(): number
51
+ ubrn_uniffi_internal_fn_method_rpchandler_ffi__bless_pointer(
52
+ pointer: bigint,
53
+ uniffi_out_err: UniffiRustCallStatus,
54
+ ): UniffiRustArcPtr
55
+ }
56
+
57
+ // Casting globalThis to any allows us to look for `NativeFedimintClientUniffi`
58
+ // if it was added via JSI.
59
+ //
60
+ // We use a getter here rather than simply `globalThis.NativeFedimintClientUniffi` so that
61
+ // if/when the startup sequence isn't just so, an empty value isn't inadvertantly cached.
62
+ const getter: () => NativeModuleInterface = () =>
63
+ (globalThis as any).NativeFedimintClientUniffi
64
+ export default getter
65
+
66
+ // Structs and function types for calling back into Typescript from Rust.
67
+ export type UniffiRustFutureContinuationCallback = (
68
+ data: bigint,
69
+ pollResult: number,
70
+ ) => void
71
+ type UniffiForeignFutureFree = (handle: bigint) => void
72
+ type UniffiCallbackInterfaceFree = (handle: bigint) => void
73
+ export type UniffiForeignFuture = {
74
+ handle: bigint
75
+ free: UniffiForeignFutureFree
76
+ }
77
+ export type UniffiForeignFutureStructU8 = {
78
+ returnValue: number
79
+ callStatus: UniffiRustCallStatus
80
+ }
81
+ export type UniffiForeignFutureCompleteU8 = (
82
+ callbackData: bigint,
83
+ result: UniffiForeignFutureStructU8,
84
+ ) => void
85
+ export type UniffiForeignFutureStructI8 = {
86
+ returnValue: number
87
+ callStatus: UniffiRustCallStatus
88
+ }
89
+ export type UniffiForeignFutureCompleteI8 = (
90
+ callbackData: bigint,
91
+ result: UniffiForeignFutureStructI8,
92
+ ) => void
93
+ export type UniffiForeignFutureStructU16 = {
94
+ returnValue: number
95
+ callStatus: UniffiRustCallStatus
96
+ }
97
+ export type UniffiForeignFutureCompleteU16 = (
98
+ callbackData: bigint,
99
+ result: UniffiForeignFutureStructU16,
100
+ ) => void
101
+ export type UniffiForeignFutureStructI16 = {
102
+ returnValue: number
103
+ callStatus: UniffiRustCallStatus
104
+ }
105
+ export type UniffiForeignFutureCompleteI16 = (
106
+ callbackData: bigint,
107
+ result: UniffiForeignFutureStructI16,
108
+ ) => void
109
+ export type UniffiForeignFutureStructU32 = {
110
+ returnValue: number
111
+ callStatus: UniffiRustCallStatus
112
+ }
113
+ export type UniffiForeignFutureCompleteU32 = (
114
+ callbackData: bigint,
115
+ result: UniffiForeignFutureStructU32,
116
+ ) => void
117
+ export type UniffiForeignFutureStructI32 = {
118
+ returnValue: number
119
+ callStatus: UniffiRustCallStatus
120
+ }
121
+ export type UniffiForeignFutureCompleteI32 = (
122
+ callbackData: bigint,
123
+ result: UniffiForeignFutureStructI32,
124
+ ) => void
125
+ export type UniffiForeignFutureStructU64 = {
126
+ returnValue: bigint
127
+ callStatus: UniffiRustCallStatus
128
+ }
129
+ export type UniffiForeignFutureCompleteU64 = (
130
+ callbackData: bigint,
131
+ result: UniffiForeignFutureStructU64,
132
+ ) => void
133
+ export type UniffiForeignFutureStructI64 = {
134
+ returnValue: bigint
135
+ callStatus: UniffiRustCallStatus
136
+ }
137
+ export type UniffiForeignFutureCompleteI64 = (
138
+ callbackData: bigint,
139
+ result: UniffiForeignFutureStructI64,
140
+ ) => void
141
+ export type UniffiForeignFutureStructF32 = {
142
+ returnValue: number
143
+ callStatus: UniffiRustCallStatus
144
+ }
145
+ export type UniffiForeignFutureCompleteF32 = (
146
+ callbackData: bigint,
147
+ result: UniffiForeignFutureStructF32,
148
+ ) => void
149
+ export type UniffiForeignFutureStructF64 = {
150
+ returnValue: number
151
+ callStatus: UniffiRustCallStatus
152
+ }
153
+ export type UniffiForeignFutureCompleteF64 = (
154
+ callbackData: bigint,
155
+ result: UniffiForeignFutureStructF64,
156
+ ) => void
157
+ export type UniffiForeignFutureStructPointer = {
158
+ returnValue: bigint
159
+ callStatus: UniffiRustCallStatus
160
+ }
161
+ export type UniffiForeignFutureCompletePointer = (
162
+ callbackData: bigint,
163
+ result: UniffiForeignFutureStructPointer,
164
+ ) => void
165
+ export type UniffiForeignFutureStructRustBuffer = {
166
+ returnValue: Uint8Array
167
+ callStatus: UniffiRustCallStatus
168
+ }
169
+ export type UniffiForeignFutureCompleteRustBuffer = (
170
+ callbackData: bigint,
171
+ result: UniffiForeignFutureStructRustBuffer,
172
+ ) => void
173
+ export type UniffiForeignFutureStructVoid = {
174
+ callStatus: UniffiRustCallStatus
175
+ }
176
+ export type UniffiForeignFutureCompleteVoid = (
177
+ callbackData: bigint,
178
+ result: UniffiForeignFutureStructVoid,
179
+ ) => void
180
+ type UniffiCallbackInterfaceRpcCallbackMethod0 = (
181
+ uniffiHandle: bigint,
182
+ responseJson: Uint8Array,
183
+ ) => UniffiResult<void>
184
+ export type UniffiVTableCallbackInterfaceRpcCallback = {
185
+ onResponse: UniffiCallbackInterfaceRpcCallbackMethod0
186
+ uniffiFree: UniffiCallbackInterfaceFree
187
+ }
188
+
189
+ // UniffiRustFutureContinuationCallback is generated as part of the component interface's
190
+ // ffi_definitions. However, we need it in the runtime.
191
+ // We could:
192
+ // (a) do some complicated template logic to ensure the declaration is not generated here (possible)
193
+ // (b) import the generated declaration into the runtime (m a y b e) or…
194
+ // (c) generate the declaration anyway, and use a different declaration in the runtime.
195
+ //
196
+ // We chose (c) here as the simplest. In addition, we perform a compile time check that
197
+ // the two versions of `UniffiRustFutureContinuationCallback` are structurally equivalent.
198
+ //
199
+ // If you see the error:
200
+ // ```
201
+ // Type 'true' is not assignable to type 'false'.(2322)
202
+ // ```
203
+ // Then a new version of uniffi has changed the signature of the callback. Most likely, code in
204
+ // `typescript/src/async-rust-call.ts` will need to be changed.
205
+ //
206
+ // If you see the error:
207
+ // ```
208
+ // Cannot find name 'UniffiRustFutureContinuationCallback'. Did you mean 'RuntimeUniffiRustFutureContinuationCallback'?(2552)
209
+ // ```
210
+ // then you may not be using callbacks or promises, and uniffi is now not generating Futures and callbacks.
211
+ // You should not generate this if that is the case.
212
+ //
213
+ // ('You' being the bindings generator maintainer).
214
+ const isRustFutureContinuationCallbackTypeCompatible: UniffiStructuralEquality<
215
+ RuntimeUniffiRustFutureContinuationCallback,
216
+ UniffiRustFutureContinuationCallback
217
+ > = true
218
+ const isUniffiForeignFutureTypeCompatible: UniffiStructuralEquality<
219
+ RuntimeUniffiForeignFuture,
220
+ UniffiForeignFuture
221
+ > = true