react-native-bdk-sdk 0.1.1

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 (108) hide show
  1. package/BdkSdk.podspec +44 -0
  2. package/LICENSE +19 -0
  3. package/README.md +24 -0
  4. package/android/CMakeLists.txt +79 -0
  5. package/android/build.gradle +144 -0
  6. package/android/cpp-adapter.cpp +43 -0
  7. package/android/generated/android/app/build/generated/source/codegen/java/com/facebook/fbreact/specs/NativeBdkSdkSpec.java +41 -0
  8. package/android/generated/android/app/build/generated/source/codegen/jni/CMakeLists.txt +28 -0
  9. package/android/generated/android/app/build/generated/source/codegen/jni/RNBdkReactNativeSpec-generated.cpp +38 -0
  10. package/android/generated/android/app/build/generated/source/codegen/jni/RNBdkReactNativeSpec.h +31 -0
  11. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNBdkReactNativeSpec/ComponentDescriptors.cpp +22 -0
  12. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNBdkReactNativeSpec/ComponentDescriptors.h +24 -0
  13. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNBdkReactNativeSpec/EventEmitters.cpp +16 -0
  14. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNBdkReactNativeSpec/EventEmitters.h +17 -0
  15. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNBdkReactNativeSpec/Props.cpp +19 -0
  16. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNBdkReactNativeSpec/Props.h +18 -0
  17. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNBdkReactNativeSpec/RNBdkReactNativeSpecJSI.h +45 -0
  18. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNBdkReactNativeSpec/ShadowNodes.cpp +17 -0
  19. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNBdkReactNativeSpec/ShadowNodes.h +23 -0
  20. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNBdkReactNativeSpec/States.cpp +16 -0
  21. package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/RNBdkReactNativeSpec/States.h +20 -0
  22. package/android/src/main/AndroidManifest.xml +5 -0
  23. package/android/src/main/java/com/reactnativebdksdk/BdkSdkModule.kt +43 -0
  24. package/android/src/main/java/com/reactnativebdksdk/BdkSdkPackage.kt +34 -0
  25. package/app.plugin.js +1 -0
  26. package/cpp/generated/bdk_ffi.cpp +6761 -0
  27. package/cpp/generated/bdk_ffi.hpp +308 -0
  28. package/cpp/react-native-bdk-sdk.cpp +16 -0
  29. package/cpp/react-native-bdk-sdk.h +15 -0
  30. package/ios/BdkSdk.h +16 -0
  31. package/ios/BdkSdk.mm +66 -0
  32. package/ios/generated/build/generated/ios/ReactCodegen/RNBdkReactNativeSpec/RNBdkReactNativeSpec-generated.mm +46 -0
  33. package/ios/generated/build/generated/ios/ReactCodegen/RNBdkReactNativeSpec/RNBdkReactNativeSpec.h +63 -0
  34. package/ios/generated/build/generated/ios/ReactCodegen/RNBdkReactNativeSpecJSI.h +45 -0
  35. package/ios/generated/build/generated/ios/ReactCodegen/react/renderer/components/RNBdkReactNativeSpec/ComponentDescriptors.cpp +22 -0
  36. package/ios/generated/build/generated/ios/ReactCodegen/react/renderer/components/RNBdkReactNativeSpec/ComponentDescriptors.h +24 -0
  37. package/ios/generated/build/generated/ios/ReactCodegen/react/renderer/components/RNBdkReactNativeSpec/EventEmitters.cpp +16 -0
  38. package/ios/generated/build/generated/ios/ReactCodegen/react/renderer/components/RNBdkReactNativeSpec/EventEmitters.h +17 -0
  39. package/ios/generated/build/generated/ios/ReactCodegen/react/renderer/components/RNBdkReactNativeSpec/Props.cpp +19 -0
  40. package/ios/generated/build/generated/ios/ReactCodegen/react/renderer/components/RNBdkReactNativeSpec/Props.h +18 -0
  41. package/ios/generated/build/generated/ios/ReactCodegen/react/renderer/components/RNBdkReactNativeSpec/RCTComponentViewHelpers.h +18 -0
  42. package/ios/generated/build/generated/ios/ReactCodegen/react/renderer/components/RNBdkReactNativeSpec/ShadowNodes.cpp +17 -0
  43. package/ios/generated/build/generated/ios/ReactCodegen/react/renderer/components/RNBdkReactNativeSpec/ShadowNodes.h +23 -0
  44. package/ios/generated/build/generated/ios/ReactCodegen/react/renderer/components/RNBdkReactNativeSpec/States.cpp +16 -0
  45. package/ios/generated/build/generated/ios/ReactCodegen/react/renderer/components/RNBdkReactNativeSpec/States.h +20 -0
  46. package/lib/commonjs/NativeBdkSdk.js +10 -0
  47. package/lib/commonjs/NativeBdkSdk.js.map +1 -0
  48. package/lib/commonjs/generated/bdk_ffi-ffi.js +48 -0
  49. package/lib/commonjs/generated/bdk_ffi-ffi.js.map +1 -0
  50. package/lib/commonjs/generated/bdk_ffi.js +4117 -0
  51. package/lib/commonjs/generated/bdk_ffi.js.map +1 -0
  52. package/lib/commonjs/index.js +63 -0
  53. package/lib/commonjs/index.js.map +1 -0
  54. package/lib/commonjs/package.json +1 -0
  55. package/lib/module/NativeBdkSdk.js +7 -0
  56. package/lib/module/NativeBdkSdk.js.map +1 -0
  57. package/lib/module/generated/bdk_ffi-ffi.js +47 -0
  58. package/lib/module/generated/bdk_ffi-ffi.js.map +1 -0
  59. package/lib/module/generated/bdk_ffi.js +4100 -0
  60. package/lib/module/generated/bdk_ffi.js.map +1 -0
  61. package/lib/module/index.js +43 -0
  62. package/lib/module/index.js.map +1 -0
  63. package/lib/module/package.json +1 -0
  64. package/lib/typescript/commonjs/package.json +1 -0
  65. package/lib/typescript/commonjs/plugin/src/index.d.ts +7 -0
  66. package/lib/typescript/commonjs/plugin/src/index.d.ts.map +1 -0
  67. package/lib/typescript/commonjs/plugin/src/withAndroid.d.ts +3 -0
  68. package/lib/typescript/commonjs/plugin/src/withAndroid.d.ts.map +1 -0
  69. package/lib/typescript/commonjs/plugin/src/withIOS.d.ts +3 -0
  70. package/lib/typescript/commonjs/plugin/src/withIOS.d.ts.map +1 -0
  71. package/lib/typescript/commonjs/src/NativeBdkSdk.d.ts +8 -0
  72. package/lib/typescript/commonjs/src/NativeBdkSdk.d.ts.map +1 -0
  73. package/lib/typescript/commonjs/src/generated/bdk_ffi-ffi.d.ts +333 -0
  74. package/lib/typescript/commonjs/src/generated/bdk_ffi-ffi.d.ts.map +1 -0
  75. package/lib/typescript/commonjs/src/generated/bdk_ffi.d.ts +3816 -0
  76. package/lib/typescript/commonjs/src/generated/bdk_ffi.d.ts.map +1 -0
  77. package/lib/typescript/commonjs/src/index.d.ts +8 -0
  78. package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
  79. package/lib/typescript/module/package.json +1 -0
  80. package/lib/typescript/module/plugin/src/index.d.ts +7 -0
  81. package/lib/typescript/module/plugin/src/index.d.ts.map +1 -0
  82. package/lib/typescript/module/plugin/src/withAndroid.d.ts +3 -0
  83. package/lib/typescript/module/plugin/src/withAndroid.d.ts.map +1 -0
  84. package/lib/typescript/module/plugin/src/withIOS.d.ts +3 -0
  85. package/lib/typescript/module/plugin/src/withIOS.d.ts.map +1 -0
  86. package/lib/typescript/module/src/NativeBdkSdk.d.ts +8 -0
  87. package/lib/typescript/module/src/NativeBdkSdk.d.ts.map +1 -0
  88. package/lib/typescript/module/src/generated/bdk_ffi-ffi.d.ts +333 -0
  89. package/lib/typescript/module/src/generated/bdk_ffi-ffi.d.ts.map +1 -0
  90. package/lib/typescript/module/src/generated/bdk_ffi.d.ts +3816 -0
  91. package/lib/typescript/module/src/generated/bdk_ffi.d.ts.map +1 -0
  92. package/lib/typescript/module/src/index.d.ts +8 -0
  93. package/lib/typescript/module/src/index.d.ts.map +1 -0
  94. package/package.json +147 -0
  95. package/plugin/build/index.d.ts +6 -0
  96. package/plugin/build/index.js +14 -0
  97. package/plugin/build/withAndroid.d.ts +2 -0
  98. package/plugin/build/withAndroid.js +20 -0
  99. package/plugin/build/withIOS.d.ts +2 -0
  100. package/plugin/build/withIOS.js +8 -0
  101. package/plugin/tsconfig.json +9 -0
  102. package/plugin/tsconfig.tsbuildinfo +1 -0
  103. package/react-native.config.js +13 -0
  104. package/scripts/postinstall.js +229 -0
  105. package/src/NativeBdkSdk.ts +10 -0
  106. package/src/generated/bdk_ffi-ffi.ts +944 -0
  107. package/src/generated/bdk_ffi.ts +6864 -0
  108. package/src/index.tsx +41 -0
package/BdkSdk.podspec ADDED
@@ -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 = "BdkSdk"
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/Psycarlo/react-native-bdk-sdk.git", :tag => "#{s.version}" }
17
+
18
+ s.source_files = "ios/*.{h,m,mm,swift}", "ios/generated/**/*.{h}", "cpp/**/*.{hpp,cpp,c,h}", "cpp/generated/**/*.{hpp,cpp,c,h}"
19
+ s.vendored_frameworks = "build/RnBdk.xcframework"
20
+ s.dependency "uniffi-bindgen-react-native", "0.30.0-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
package/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2026 Psycarlo
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,24 @@
1
+ # todo
2
+
3
+ ## Getting Started
4
+
5
+ ## Maintainers
6
+
7
+ ### Requirements
8
+
9
+ - [pnpm](https://pnpm.io/installation)
10
+ - [just](https://github.com/casey/just)
11
+
12
+ ### Generate bindings
13
+
14
+ 1. Install dependencies
15
+
16
+ ```bash
17
+ pnpm install
18
+ ```
19
+
20
+ 2. Generate
21
+
22
+ ```bash
23
+ just generate
24
+ ```
@@ -0,0 +1,79 @@
1
+ # Generated by uniffi-bindgen-react-native
2
+ cmake_minimum_required(VERSION 3.9.0)
3
+ project(BdkSdk)
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(react-native-bdk-sdk SHARED
27
+ ../cpp/react-native-bdk-sdk.cpp
28
+ ../cpp/generated/bdk_ffi.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
+ # Set linker flags for 16KB page size alignment (required for Android 15+)
41
+ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,max-page-size=16384")
42
+
43
+ cmake_path(
44
+ SET MY_RUST_LIB
45
+ ${CMAKE_SOURCE_DIR}/src/main/jniLibs/${ANDROID_ABI}/libbdk_ffi.so
46
+ NORMALIZE
47
+ )
48
+ add_library(my_rust_lib SHARED IMPORTED)
49
+ set_target_properties(my_rust_lib PROPERTIES IMPORTED_LOCATION ${MY_RUST_LIB} IMPORTED_NO_SONAME ON)
50
+
51
+ # Add ReactAndroid libraries, being careful to account for different versions.
52
+ find_package(ReactAndroid REQUIRED CONFIG)
53
+ find_library(LOGCAT log)
54
+
55
+ # REACTNATIVE_MERGED_SO seems to be only be set in a build.gradle.kt file,
56
+ # which we don't use. Thus falling back to version number sniffing.
57
+ if (ReactAndroid_VERSION_MINOR GREATER_EQUAL 76)
58
+ set(REACTNATIVE_MERGED_SO true)
59
+ endif()
60
+
61
+ # https://github.com/react-native-community/discussions-and-proposals/discussions/816
62
+ # This if-then-else can be removed once this library does not support version below 0.76
63
+ if (REACTNATIVE_MERGED_SO)
64
+ target_link_libraries(react-native-bdk-sdk ReactAndroid::reactnative)
65
+ else()
66
+ target_link_libraries(react-native-bdk-sdk
67
+ ReactAndroid::turbomodulejsijni
68
+ ReactAndroid::react_nativemodule_core
69
+ )
70
+ endif()
71
+
72
+ find_package(fbjni REQUIRED CONFIG)
73
+ target_link_libraries(
74
+ react-native-bdk-sdk
75
+ fbjni::fbjni
76
+ ReactAndroid::jsi
77
+ ${LOGCAT}
78
+ my_rust_lib
79
+ )
@@ -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["BdkSdk_" + name]
37
+ }
38
+
39
+ def getExtOrIntegerDefault(name) {
40
+ return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["BdkSdk_" + 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.reactnativebdksdk"
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", "armeabi-v7a", "x86", "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 = "BdkSdk"
142
+ codegenJavaPackageName = "com.reactnativebdksdk"
143
+ }
144
+ }
@@ -0,0 +1,43 @@
1
+ // Generated by uniffi-bindgen-react-native
2
+ #include <jni.h>
3
+ #include <jsi/jsi.h>
4
+ #include <ReactCommon/CallInvokerHolder.h>
5
+ #include "react-native-bdk-sdk.h"
6
+
7
+ namespace jsi = facebook::jsi;
8
+ namespace react = facebook::react;
9
+
10
+ // Automated testing checks Java_com_reactnativebdksdk_BdkSdkModule and bdksdk
11
+ // by comparing the whole line here.
12
+ /*
13
+ Java_com_reactnativebdksdk_BdkSdkModule_nativeMultiply(JNIEnv *env, jclass type, jdouble a, jdouble b) {
14
+ return bdksdk::multiply(a, b);
15
+ }
16
+ */
17
+
18
+ // Installer coming from BdkSdkModule
19
+ extern "C"
20
+ JNIEXPORT jboolean JNICALL
21
+ Java_com_reactnativebdksdk_BdkSdkModule_nativeInstallRustCrate(
22
+ JNIEnv *env,
23
+ jclass type,
24
+ jlong rtPtr,
25
+ jobject callInvokerHolderJavaObj
26
+ ) {
27
+ using JCallInvokerHolder = facebook::react::CallInvokerHolder;
28
+
29
+ auto holderLocal = facebook::jni::make_local(callInvokerHolderJavaObj);
30
+ auto holderRef = facebook::jni::static_ref_cast<JCallInvokerHolder::javaobject>(holderLocal);
31
+ auto* holderCxx = holderRef->cthis();
32
+ auto jsCallInvoker = holderCxx->getCallInvoker();
33
+ auto runtime = reinterpret_cast<jsi::Runtime *>(rtPtr);
34
+
35
+ return bdksdk::installRustCrate(*runtime, jsCallInvoker);
36
+ }
37
+
38
+ extern "C"
39
+ JNIEXPORT jboolean JNICALL
40
+ Java_com_reactnativebdksdk_BdkSdkModule_nativeCleanupRustCrate(JNIEnv *env, jclass type, jlong rtPtr) {
41
+ auto runtime = reinterpret_cast<jsi::Runtime *>(rtPtr);
42
+ return bdksdk::cleanupRustCrate(*runtime);
43
+ }
@@ -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.facebook.fbreact.specs;
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 NativeBdkSdkSpec extends ReactContextBaseJavaModule implements TurboModule {
23
+ public static final String NAME = "BdkSdk";
24
+
25
+ public NativeBdkSdkSpec(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/RNBdkReactNativeSpec/*.cpp)
10
+
11
+ add_library(
12
+ react_codegen_RNBdkReactNativeSpec
13
+ OBJECT
14
+ ${react_codegen_SRCS}
15
+ )
16
+
17
+ target_include_directories(react_codegen_RNBdkReactNativeSpec PUBLIC . react/renderer/components/RNBdkReactNativeSpec)
18
+
19
+ target_link_libraries(
20
+ react_codegen_RNBdkReactNativeSpec
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_RNBdkReactNativeSpec 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 "RNBdkReactNativeSpec.h"
12
+
13
+ namespace facebook::react {
14
+
15
+ static facebook::jsi::Value __hostFunction_NativeBdkSdkSpecJSI_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_NativeBdkSdkSpecJSI_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
+ NativeBdkSdkSpecJSI::NativeBdkSdkSpecJSI(const JavaTurboModule::InitParams &params)
26
+ : JavaTurboModule(params) {
27
+ methodMap_["installRustCrate"] = MethodMetadata {0, __hostFunction_NativeBdkSdkSpecJSI_installRustCrate};
28
+ methodMap_["cleanupRustCrate"] = MethodMetadata {0, __hostFunction_NativeBdkSdkSpecJSI_cleanupRustCrate};
29
+ }
30
+
31
+ std::shared_ptr<TurboModule> RNBdkReactNativeSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams &params) {
32
+ if (moduleName == "BdkSdk") {
33
+ return std::make_shared<NativeBdkSdkSpecJSI>(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 'NativeBdkSdk'
21
+ */
22
+ class JSI_EXPORT NativeBdkSdkSpecJSI : public JavaTurboModule {
23
+ public:
24
+ NativeBdkSdkSpecJSI(const JavaTurboModule::InitParams &params);
25
+ };
26
+
27
+
28
+ JSI_EXPORT
29
+ std::shared_ptr<TurboModule> RNBdkReactNativeSpec_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 <react/renderer/components/RNBdkReactNativeSpec/ComponentDescriptors.h>
12
+ #include <react/renderer/core/ConcreteComponentDescriptor.h>
13
+ #include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
14
+
15
+ namespace facebook::react {
16
+
17
+ void RNBdkReactNativeSpec_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 <react/renderer/components/RNBdkReactNativeSpec/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 RNBdkReactNativeSpec_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 <react/renderer/components/RNBdkReactNativeSpec/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 <react/renderer/components/RNBdkReactNativeSpec/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
@@ -0,0 +1,45 @@
1
+ /**
2
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
+ *
4
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
5
+ * once the code is regenerated.
6
+ *
7
+ * @generated by codegen project: GenerateModuleH.js
8
+ */
9
+
10
+ #pragma once
11
+
12
+ #include <ReactCommon/TurboModule.h>
13
+ #include <react/bridging/Bridging.h>
14
+
15
+ namespace facebook::react {
16
+
17
+
18
+ template <typename T>
19
+ class JSI_EXPORT NativeBdkSdkCxxSpec : public TurboModule {
20
+ public:
21
+ static constexpr std::string_view kModuleName = "BdkSdk";
22
+
23
+ protected:
24
+ NativeBdkSdkCxxSpec(std::shared_ptr<CallInvoker> jsInvoker) : TurboModule(std::string{NativeBdkSdkCxxSpec::kModuleName}, jsInvoker) {
25
+ methodMap_["installRustCrate"] = MethodMetadata {.argCount = 0, .invoker = __installRustCrate};
26
+ methodMap_["cleanupRustCrate"] = MethodMetadata {.argCount = 0, .invoker = __cleanupRustCrate};
27
+ }
28
+
29
+ private:
30
+ static jsi::Value __installRustCrate(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* /*args*/, size_t /*count*/) {
31
+ static_assert(
32
+ bridging::getParameterCount(&T::installRustCrate) == 1,
33
+ "Expected installRustCrate(...) to have 1 parameters");
34
+ return bridging::callFromJs<bool>(rt, &T::installRustCrate, static_cast<NativeBdkSdkCxxSpec*>(&turboModule)->jsInvoker_, static_cast<T*>(&turboModule));
35
+ }
36
+
37
+ static jsi::Value __cleanupRustCrate(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* /*args*/, size_t /*count*/) {
38
+ static_assert(
39
+ bridging::getParameterCount(&T::cleanupRustCrate) == 1,
40
+ "Expected cleanupRustCrate(...) to have 1 parameters");
41
+ return bridging::callFromJs<bool>(rt, &T::cleanupRustCrate, static_cast<NativeBdkSdkCxxSpec*>(&turboModule)->jsInvoker_, static_cast<T*>(&turboModule));
42
+ }
43
+ };
44
+
45
+ } // namespace facebook::react