@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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 fedimint
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,7 @@
1
+ # @fedimint/react-native
2
+
3
+ Fedimint Client SDK for React-Native.
4
+
5
+ ## Credit
6
+
7
+ Used the [bdk-rn](https://github.com/bitcoindevkit/bdk-rn) and [spark-sdk](https://github.com/breez/spark-sdk/tree/main) libraries as a reference.
@@ -0,0 +1,45 @@
1
+ # Generated by uniffi-bindgen-react-native
2
+ require "json"
3
+
4
+ package = JSON.parse(File.read(File.join(__dir__, "package.json")))
5
+ folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
6
+
7
+ Pod::Spec.new do |s|
8
+ s.name = "ReactNative"
9
+ s.version = package["version"]
10
+ s.summary = package["description"]
11
+ s.homepage = package["homepage"]
12
+ s.license = package["license"]
13
+ s.authors = package["author"]
14
+
15
+ s.platforms = { :ios => min_ios_version_supported }
16
+ s.source = { :git => "https://github.com/fedimint/fedimint-sdk.git", :tag => "#{s.version}" }
17
+
18
+ s.source_files = "ios/**/*.{h,m,mm,swift}", "ios/generated/**/*.{h,m,mm}", "cpp/**/*.{hpp,cpp,c,h}", "cpp/generated/**/*.{hpp,cpp,c,h}"
19
+ s.vendored_frameworks = "FedimintReactNativeBindingsFramework.xcframework"
20
+ s.frameworks = "SystemConfiguration", "Security"
21
+ s.dependency "uniffi-bindgen-react-native", "0.29.3-1"
22
+
23
+ # Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
24
+ # See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
25
+ if respond_to?(:install_modules_dependencies, true)
26
+ install_modules_dependencies(s)
27
+ else
28
+ s.dependency "React-Core"
29
+
30
+ # Don't install the dependencies when we run `pod install` in the old architecture.
31
+ if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
32
+ s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
33
+ s.pod_target_xcconfig = {
34
+ "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
35
+ "OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
36
+ "CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
37
+ }
38
+ s.dependency "React-Codegen"
39
+ s.dependency "RCT-Folly"
40
+ s.dependency "RCTRequired"
41
+ s.dependency "RCTTypeSafety"
42
+ s.dependency "ReactCommon/turbomodule/core"
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,44 @@
1
+ # Generated by uniffi-bindgen-react-native
2
+ require "json"
3
+
4
+ package = JSON.parse(File.read(File.join(__dir__, "package.json")))
5
+ folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
6
+
7
+ Pod::Spec.new do |s|
8
+ s.name = "ReactNativeBindings"
9
+ s.version = package["version"]
10
+ s.summary = package["description"]
11
+ s.homepage = package["homepage"]
12
+ s.license = package["license"]
13
+ s.authors = package["author"]
14
+
15
+ s.platforms = { :ios => min_ios_version_supported }
16
+ s.source = { :git => "https://github.com/fedimint/fedimint-sdk.git", :tag => "#{s.version}" }
17
+
18
+ s.source_files = "ios/**/*.{h,m,mm,swift}", "ios/generated/**/*.{h,m,mm}", "cpp/**/*.{hpp,cpp,c,h}", "cpp/generated/**/*.{hpp,cpp,c,h}"
19
+ s.vendored_frameworks = "FedimintReactNativeBindingsFramework.xcframework"
20
+ s.dependency "uniffi-bindgen-react-native", "0.29.3-1"
21
+
22
+ # Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
23
+ # See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
24
+ if respond_to?(:install_modules_dependencies, true)
25
+ install_modules_dependencies(s)
26
+ else
27
+ s.dependency "React-Core"
28
+
29
+ # Don't install the dependencies when we run `pod install` in the old architecture.
30
+ if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
31
+ s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
32
+ s.pod_target_xcconfig = {
33
+ "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
34
+ "OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
35
+ "CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
36
+ }
37
+ s.dependency "React-Codegen"
38
+ s.dependency "RCT-Folly"
39
+ s.dependency "RCTRequired"
40
+ s.dependency "RCTTypeSafety"
41
+ s.dependency "ReactCommon/turbomodule/core"
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,76 @@
1
+ # Generated by uniffi-bindgen-react-native
2
+ cmake_minimum_required(VERSION 3.9.0)
3
+ project(ReactNativeBindings)
4
+
5
+ set (CMAKE_VERBOSE_MAKEFILE ON)
6
+ set (CMAKE_CXX_STANDARD 17)
7
+
8
+ # Resolve the path to the uniffi-bindgen-react-native package
9
+ execute_process(
10
+ COMMAND node -p "require.resolve('uniffi-bindgen-react-native/package.json')"
11
+ OUTPUT_VARIABLE UNIFFI_BINDGEN_PATH
12
+ OUTPUT_STRIP_TRAILING_WHITESPACE
13
+ )
14
+ # Get the directory; get_filename_component and cmake_path will normalize
15
+ # paths with Windows path separators.
16
+ get_filename_component(UNIFFI_BINDGEN_PATH "${UNIFFI_BINDGEN_PATH}" DIRECTORY)
17
+
18
+ # Specifies a path to native header files.
19
+ include_directories(
20
+ ../cpp
21
+ ../cpp/generated
22
+
23
+ ${UNIFFI_BINDGEN_PATH}/cpp/includes
24
+ )
25
+
26
+ add_library(fedimint-react-native-bindings SHARED
27
+ ../cpp/fedimint-react-native-bindings.cpp
28
+ ../cpp/generated/fedimint_client_uniffi.cpp
29
+ cpp-adapter.cpp
30
+ )
31
+
32
+ # Set C++ compiler flags
33
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2")
34
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions")
35
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -frtti")
36
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector-all")
37
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
38
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
39
+
40
+ cmake_path(
41
+ SET MY_RUST_LIB
42
+ ${CMAKE_SOURCE_DIR}/src/main/jniLibs/${ANDROID_ABI}/libfedimint_client_uniffi.so
43
+ NORMALIZE
44
+ )
45
+ add_library(my_rust_lib SHARED IMPORTED)
46
+ set_target_properties(my_rust_lib PROPERTIES IMPORTED_LOCATION ${MY_RUST_LIB} IMPORTED_NO_SONAME ON)
47
+
48
+ # Add ReactAndroid libraries, being careful to account for different versions.
49
+ find_package(ReactAndroid REQUIRED CONFIG)
50
+ find_library(LOGCAT log)
51
+
52
+ # REACTNATIVE_MERGED_SO seems to be only be set in a build.gradle.kt file,
53
+ # which we don't use. Thus falling back to version number sniffing.
54
+ if (ReactAndroid_VERSION_MINOR GREATER_EQUAL 76)
55
+ set(REACTNATIVE_MERGED_SO true)
56
+ endif()
57
+
58
+ # https://github.com/react-native-community/discussions-and-proposals/discussions/816
59
+ # This if-then-else can be removed once this library does not support version below 0.76
60
+ if (REACTNATIVE_MERGED_SO)
61
+ target_link_libraries(fedimint-react-native-bindings ReactAndroid::reactnative)
62
+ else()
63
+ target_link_libraries(fedimint-react-native-bindings
64
+ ReactAndroid::turbomodulejsijni
65
+ ReactAndroid::react_nativemodule_core
66
+ )
67
+ endif()
68
+
69
+ find_package(fbjni REQUIRED CONFIG)
70
+ target_link_libraries(
71
+ fedimint-react-native-bindings
72
+ fbjni::fbjni
73
+ ReactAndroid::jsi
74
+ ${LOGCAT}
75
+ my_rust_lib
76
+ )
@@ -0,0 +1,144 @@
1
+ // Generated by uniffi-bindgen-react-native
2
+
3
+ buildscript {
4
+ // Buildscript is evaluated before everything else so we can't use getExtOrDefault
5
+ def kotlin_version = rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("kotlinVersion") : project.properties["DummyLibForAndroid_kotlinVersion"]
6
+
7
+ repositories {
8
+ google()
9
+ mavenCentral()
10
+ }
11
+
12
+ dependencies {
13
+ classpath "com.android.tools.build:gradle:7.2.1"
14
+ // noinspection DifferentKotlinGradleVersion
15
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
16
+ }
17
+ }
18
+
19
+ def reactNativeArchitectures() {
20
+ def value = rootProject.getProperties().get("reactNativeArchitectures")
21
+ return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
22
+ }
23
+
24
+ def isNewArchitectureEnabled() {
25
+ return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
26
+ }
27
+
28
+ apply plugin: "com.android.library"
29
+ apply plugin: "kotlin-android"
30
+
31
+ if (isNewArchitectureEnabled()) {
32
+ apply plugin: "com.facebook.react"
33
+ }
34
+
35
+ def getExtOrDefault(name) {
36
+ return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["ReactNativeBindings_" + name]
37
+ }
38
+
39
+ def getExtOrIntegerDefault(name) {
40
+ return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["ReactNativeBindings_" + name]).toInteger()
41
+ }
42
+
43
+ def supportsNamespace() {
44
+ def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
45
+ def major = parsed[0].toInteger()
46
+ def minor = parsed[1].toInteger()
47
+
48
+ // Namespace support was added in 7.3.0
49
+ return (major == 7 && minor >= 3) || major >= 8
50
+ }
51
+
52
+ android {
53
+ if (supportsNamespace()) {
54
+ namespace "com.fedimint.reactnative"
55
+
56
+ sourceSets {
57
+ main {
58
+ manifest.srcFile "src/main/AndroidManifestNew.xml"
59
+ }
60
+ }
61
+ }
62
+
63
+ ndkVersion getExtOrDefault("ndkVersion")
64
+ compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
65
+
66
+ defaultConfig {
67
+ minSdkVersion getExtOrIntegerDefault("minSdkVersion")
68
+ targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
69
+ buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
70
+ consumerProguardFiles 'proguard-rules.pro'
71
+
72
+ buildFeatures {
73
+ prefab true
74
+ }
75
+ externalNativeBuild {
76
+ cmake {
77
+ arguments '-DANDROID_STL=c++_shared'
78
+ abiFilters (*reactNativeArchitectures())
79
+ }
80
+ }
81
+ ndk {
82
+ abiFilters "arm64-v8a", "x86_64"
83
+ }
84
+ }
85
+
86
+ externalNativeBuild {
87
+ cmake {
88
+ path "CMakeLists.txt"
89
+ }
90
+ }
91
+
92
+ buildFeatures {
93
+ buildConfig true
94
+ }
95
+
96
+ buildTypes {
97
+ release {
98
+ minifyEnabled false
99
+ }
100
+ }
101
+
102
+ lintOptions {
103
+ disable "GradleCompatible"
104
+ }
105
+
106
+ compileOptions {
107
+ sourceCompatibility JavaVersion.VERSION_1_8
108
+ targetCompatibility JavaVersion.VERSION_1_8
109
+ }
110
+
111
+ sourceSets {
112
+ main {
113
+ if (isNewArchitectureEnabled()) {
114
+ java.srcDirs += [
115
+ "generated/java",
116
+ "generated/jni"
117
+ ]
118
+ }
119
+ }
120
+ }
121
+ }
122
+
123
+ repositories {
124
+ mavenCentral()
125
+ google()
126
+ }
127
+
128
+ def kotlin_version = getExtOrDefault("kotlinVersion")
129
+
130
+ dependencies {
131
+ // For < 0.71, this will be from the local maven repo
132
+ // For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
133
+ //noinspection GradleDynamicVersion
134
+ implementation "com.facebook.react:react-native:+"
135
+ implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
136
+ }
137
+
138
+ if (isNewArchitectureEnabled()) {
139
+ react {
140
+ jsRootDir = file("../src/")
141
+ libraryName = "ReactNativeBindings"
142
+ codegenJavaPackageName = "com.fedimint.reactnative"
143
+ }
144
+ }
@@ -0,0 +1,44 @@
1
+ // Generated by uniffi-bindgen-react-native
2
+ #include <jni.h>
3
+ #include <jsi/jsi.h>
4
+ #include <fbjni/fbjni.h>
5
+ #include <ReactCommon/CallInvokerHolder.h>
6
+ #include "fedimint-react-native-bindings.h"
7
+
8
+ namespace jsi = facebook::jsi;
9
+ namespace react = facebook::react;
10
+
11
+ // Automated testing checks Java_com_fedimint_reactnative_ReactNativeBindingsModule and fedimint_reactnativebindings
12
+ // by comparing the whole line here.
13
+ /*
14
+ Java_com_fedimint_reactnative_ReactNativeBindingsModule_nativeMultiply(JNIEnv *env, jclass type, jdouble a, jdouble b) {
15
+ return fedimint_reactnativebindings::multiply(a, b);
16
+ }
17
+ */
18
+
19
+ // Installer coming from ReactNativeBindingsModule
20
+ extern "C"
21
+ JNIEXPORT jboolean JNICALL
22
+ Java_com_fedimint_reactnative_ReactNativeBindingsModule_nativeInstallRustCrate(
23
+ JNIEnv *env,
24
+ jclass type,
25
+ jlong rtPtr,
26
+ jobject callInvokerHolderJavaObj
27
+ ) {
28
+ // React Native 0.77+ uses fbjni HybridClass for CallInvokerHolder
29
+ // Use the proper fbjni API to extract the CallInvoker
30
+ auto callInvokerHolder = facebook::jni::wrap_alias(
31
+ reinterpret_cast<facebook::react::CallInvokerHolder::javaobject>(callInvokerHolderJavaObj)
32
+ )->cthis();
33
+ auto jsCallInvoker = callInvokerHolder->getCallInvoker();
34
+
35
+ auto runtime = reinterpret_cast<jsi::Runtime *>(rtPtr);
36
+ return fedimint_reactnativebindings::installRustCrate(*runtime, jsCallInvoker);
37
+ }
38
+
39
+ extern "C"
40
+ JNIEXPORT jboolean JNICALL
41
+ Java_com_fedimint_reactnative_ReactNativeBindingsModule_nativeCleanupRustCrate(JNIEnv *env, jclass type, jlong rtPtr) {
42
+ auto runtime = reinterpret_cast<jsi::Runtime *>(rtPtr);
43
+ return fedimint_reactnativebindings::cleanupRustCrate(*runtime);
44
+ }
@@ -0,0 +1,41 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateModuleJavaSpec.js
9
+ *
10
+ * @nolint
11
+ */
12
+
13
+ package com.fedimint.reactnative;
14
+
15
+ import com.facebook.proguard.annotations.DoNotStrip;
16
+ import com.facebook.react.bridge.ReactApplicationContext;
17
+ import com.facebook.react.bridge.ReactContextBaseJavaModule;
18
+ import com.facebook.react.bridge.ReactMethod;
19
+ import com.facebook.react.turbomodule.core.interfaces.TurboModule;
20
+ import javax.annotation.Nonnull;
21
+
22
+ public abstract class NativeReactNativeBindingsSpec extends ReactContextBaseJavaModule implements TurboModule {
23
+ public static final String NAME = "ReactNativeBindings";
24
+
25
+ public NativeReactNativeBindingsSpec(ReactApplicationContext reactContext) {
26
+ super(reactContext);
27
+ }
28
+
29
+ @Override
30
+ public @Nonnull String getName() {
31
+ return NAME;
32
+ }
33
+
34
+ @ReactMethod(isBlockingSynchronousMethod = true)
35
+ @DoNotStrip
36
+ public abstract boolean installRustCrate();
37
+
38
+ @ReactMethod(isBlockingSynchronousMethod = true)
39
+ @DoNotStrip
40
+ public abstract boolean cleanupRustCrate();
41
+ }
@@ -0,0 +1,28 @@
1
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
2
+ #
3
+ # This source code is licensed under the MIT license found in the
4
+ # LICENSE file in the root directory of this source tree.
5
+
6
+ cmake_minimum_required(VERSION 3.13)
7
+ set(CMAKE_VERBOSE_MAKEFILE on)
8
+
9
+ file(GLOB react_codegen_SRCS CONFIGURE_DEPENDS *.cpp react/renderer/components/ReactNativeBindingsSpec/*.cpp)
10
+
11
+ add_library(
12
+ react_codegen_ReactNativeBindingsSpec
13
+ OBJECT
14
+ ${react_codegen_SRCS}
15
+ )
16
+
17
+ target_include_directories(react_codegen_ReactNativeBindingsSpec PUBLIC . react/renderer/components/ReactNativeBindingsSpec)
18
+
19
+ target_link_libraries(
20
+ react_codegen_ReactNativeBindingsSpec
21
+ fbjni
22
+ jsi
23
+ # We need to link different libraries based on whether we are building rncore or not, that's necessary
24
+ # because we want to break a circular dependency between react_codegen_rncore and reactnative
25
+ reactnative
26
+ )
27
+
28
+ target_compile_reactnative_options(react_codegen_ReactNativeBindingsSpec PRIVATE)
@@ -0,0 +1,38 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateModuleJniCpp.js
9
+ */
10
+
11
+ #include "ReactNativeBindingsSpec.h"
12
+
13
+ namespace facebook::react {
14
+
15
+ static facebook::jsi::Value __hostFunction_NativeReactNativeBindingsSpecJSI_installRustCrate(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
16
+ static jmethodID cachedMethodId = nullptr;
17
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, BooleanKind, "installRustCrate", "()Z", args, count, cachedMethodId);
18
+ }
19
+
20
+ static facebook::jsi::Value __hostFunction_NativeReactNativeBindingsSpecJSI_cleanupRustCrate(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
21
+ static jmethodID cachedMethodId = nullptr;
22
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, BooleanKind, "cleanupRustCrate", "()Z", args, count, cachedMethodId);
23
+ }
24
+
25
+ NativeReactNativeBindingsSpecJSI::NativeReactNativeBindingsSpecJSI(const JavaTurboModule::InitParams &params)
26
+ : JavaTurboModule(params) {
27
+ methodMap_["installRustCrate"] = MethodMetadata {0, __hostFunction_NativeReactNativeBindingsSpecJSI_installRustCrate};
28
+ methodMap_["cleanupRustCrate"] = MethodMetadata {0, __hostFunction_NativeReactNativeBindingsSpecJSI_cleanupRustCrate};
29
+ }
30
+
31
+ std::shared_ptr<TurboModule> ReactNativeBindingsSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams &params) {
32
+ if (moduleName == "ReactNativeBindings") {
33
+ return std::make_shared<NativeReactNativeBindingsSpecJSI>(params);
34
+ }
35
+ return nullptr;
36
+ }
37
+
38
+ } // namespace facebook::react
@@ -0,0 +1,31 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateModuleJniH.js
9
+ */
10
+
11
+ #pragma once
12
+
13
+ #include <ReactCommon/JavaTurboModule.h>
14
+ #include <ReactCommon/TurboModule.h>
15
+ #include <jsi/jsi.h>
16
+
17
+ namespace facebook::react {
18
+
19
+ /**
20
+ * JNI C++ class for module 'NativeReactNativeBindings'
21
+ */
22
+ class JSI_EXPORT NativeReactNativeBindingsSpecJSI : public JavaTurboModule {
23
+ public:
24
+ NativeReactNativeBindingsSpecJSI(const JavaTurboModule::InitParams &params);
25
+ };
26
+
27
+
28
+ JSI_EXPORT
29
+ std::shared_ptr<TurboModule> ReactNativeBindingsSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams &params);
30
+
31
+ } // namespace facebook::react
@@ -0,0 +1,22 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateComponentDescriptorCpp.js
9
+ */
10
+
11
+ #include "ComponentDescriptors.h"
12
+ #include <react/renderer/core/ConcreteComponentDescriptor.h>
13
+ #include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
14
+
15
+ namespace facebook::react {
16
+
17
+ void ReactNativeBindingsSpec_registerComponentDescriptorsFromCodegen(
18
+ std::shared_ptr<const ComponentDescriptorProviderRegistry> registry) {
19
+
20
+ }
21
+
22
+ } // namespace facebook::react
@@ -0,0 +1,24 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateComponentDescriptorH.js
9
+ */
10
+
11
+ #pragma once
12
+
13
+ #include "ShadowNodes.h"
14
+ #include <react/renderer/core/ConcreteComponentDescriptor.h>
15
+ #include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
16
+
17
+ namespace facebook::react {
18
+
19
+
20
+
21
+ void ReactNativeBindingsSpec_registerComponentDescriptorsFromCodegen(
22
+ std::shared_ptr<const ComponentDescriptorProviderRegistry> registry);
23
+
24
+ } // namespace facebook::react
@@ -0,0 +1,16 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateEventEmitterCpp.js
9
+ */
10
+
11
+ #include "EventEmitters.h"
12
+
13
+
14
+ namespace facebook::react {
15
+
16
+ } // namespace facebook::react
@@ -0,0 +1,17 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateEventEmitterH.js
9
+ */
10
+ #pragma once
11
+
12
+ #include <react/renderer/components/view/ViewEventEmitter.h>
13
+
14
+
15
+ namespace facebook::react {
16
+
17
+ } // namespace facebook::react
@@ -0,0 +1,19 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GeneratePropsCpp.js
9
+ */
10
+
11
+ #include "Props.h"
12
+ #include <react/renderer/core/PropsParserContext.h>
13
+ #include <react/renderer/core/propsConversions.h>
14
+
15
+ namespace facebook::react {
16
+
17
+
18
+
19
+ } // namespace facebook::react
@@ -0,0 +1,18 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GeneratePropsH.js
9
+ */
10
+ #pragma once
11
+
12
+
13
+
14
+ namespace facebook::react {
15
+
16
+
17
+
18
+ } // namespace facebook::react