orbis1-sdk-rn 0.0.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 (98) hide show
  1. package/LICENSE +20 -0
  2. package/Orbis1Sdk.podspec +24 -0
  3. package/README.md +269 -0
  4. package/android/build.gradle +78 -0
  5. package/android/src/main/AndroidManifest.xml +2 -0
  6. package/android/src/main/java/com/orbis1sdk/AppConstants.kt +25 -0
  7. package/android/src/main/java/com/orbis1sdk/Orbis1SdkModule.kt +15 -0
  8. package/android/src/main/java/com/orbis1sdk/Orbis1SdkPackage.kt +33 -0
  9. package/android/src/main/java/com/orbis1sdk/RgbModule.kt +2100 -0
  10. package/android/src/main/java/com/orbis1sdk/RgbPackage.kt +33 -0
  11. package/android/src/main/java/com/orbis1sdk/WalletStore.kt +49 -0
  12. package/ios/AppConstants.swift +57 -0
  13. package/ios/Orbis1Sdk.h +5 -0
  14. package/ios/Orbis1Sdk.mm +1765 -0
  15. package/ios/Rgb.h +5 -0
  16. package/ios/Rgb.mm +1761 -0
  17. package/ios/Rgb.swift +2094 -0
  18. package/ios/RgbLib.swift +7871 -0
  19. package/ios/WalletStore.swift +61 -0
  20. package/lib/module/Orbis1SDK.js +116 -0
  21. package/lib/module/Orbis1SDK.js.map +1 -0
  22. package/lib/module/core/Interfaces.js +65 -0
  23. package/lib/module/core/Interfaces.js.map +1 -0
  24. package/lib/module/core/NativeRgb.js +5 -0
  25. package/lib/module/core/NativeRgb.js.map +1 -0
  26. package/lib/module/core/RgbError.js +65 -0
  27. package/lib/module/core/RgbError.js.map +1 -0
  28. package/lib/module/core/Wallet.js +854 -0
  29. package/lib/module/core/Wallet.js.map +1 -0
  30. package/lib/module/errors/FeatureNotEnabledError.js +19 -0
  31. package/lib/module/errors/FeatureNotEnabledError.js.map +1 -0
  32. package/lib/module/features/watch-tower/WatchTowerModule.js +94 -0
  33. package/lib/module/features/watch-tower/WatchTowerModule.js.map +1 -0
  34. package/lib/module/features/watch-tower/index.js +11 -0
  35. package/lib/module/features/watch-tower/index.js.map +1 -0
  36. package/lib/module/features/watch-tower/types/WatchTowerConfig.js +10 -0
  37. package/lib/module/features/watch-tower/types/WatchTowerConfig.js.map +1 -0
  38. package/lib/module/features/watch-tower/types/index.js +4 -0
  39. package/lib/module/features/watch-tower/types/index.js.map +1 -0
  40. package/lib/module/index.js +58 -0
  41. package/lib/module/index.js.map +1 -0
  42. package/lib/module/package.json +1 -0
  43. package/lib/module/types/Feature.js +16 -0
  44. package/lib/module/types/Feature.js.map +1 -0
  45. package/lib/module/types/IFeatureModule.js +35 -0
  46. package/lib/module/types/IFeatureModule.js.map +1 -0
  47. package/lib/module/types/Orbis1CreateConfig.js +29 -0
  48. package/lib/module/types/Orbis1CreateConfig.js.map +1 -0
  49. package/lib/module/utils/FeatureRegistry.js +49 -0
  50. package/lib/module/utils/FeatureRegistry.js.map +1 -0
  51. package/lib/typescript/package.json +1 -0
  52. package/lib/typescript/src/Orbis1SDK.d.ts +57 -0
  53. package/lib/typescript/src/Orbis1SDK.d.ts.map +1 -0
  54. package/lib/typescript/src/core/Interfaces.d.ts +422 -0
  55. package/lib/typescript/src/core/Interfaces.d.ts.map +1 -0
  56. package/lib/typescript/src/core/NativeRgb.d.ts +287 -0
  57. package/lib/typescript/src/core/NativeRgb.d.ts.map +1 -0
  58. package/lib/typescript/src/core/RgbError.d.ts +28 -0
  59. package/lib/typescript/src/core/RgbError.d.ts.map +1 -0
  60. package/lib/typescript/src/core/Wallet.d.ts +656 -0
  61. package/lib/typescript/src/core/Wallet.d.ts.map +1 -0
  62. package/lib/typescript/src/errors/FeatureNotEnabledError.d.ts +11 -0
  63. package/lib/typescript/src/errors/FeatureNotEnabledError.d.ts.map +1 -0
  64. package/lib/typescript/src/features/watch-tower/WatchTowerModule.d.ts +38 -0
  65. package/lib/typescript/src/features/watch-tower/WatchTowerModule.d.ts.map +1 -0
  66. package/lib/typescript/src/features/watch-tower/index.d.ts +9 -0
  67. package/lib/typescript/src/features/watch-tower/index.d.ts.map +1 -0
  68. package/lib/typescript/src/features/watch-tower/types/WatchTowerConfig.d.ts +13 -0
  69. package/lib/typescript/src/features/watch-tower/types/WatchTowerConfig.d.ts.map +1 -0
  70. package/lib/typescript/src/features/watch-tower/types/index.d.ts +3 -0
  71. package/lib/typescript/src/features/watch-tower/types/index.d.ts.map +1 -0
  72. package/lib/typescript/src/index.d.ts +46 -0
  73. package/lib/typescript/src/index.d.ts.map +1 -0
  74. package/lib/typescript/src/types/Feature.d.ts +10 -0
  75. package/lib/typescript/src/types/Feature.d.ts.map +1 -0
  76. package/lib/typescript/src/types/IFeatureModule.d.ts +74 -0
  77. package/lib/typescript/src/types/IFeatureModule.d.ts.map +1 -0
  78. package/lib/typescript/src/types/Orbis1CreateConfig.d.ts +26 -0
  79. package/lib/typescript/src/types/Orbis1CreateConfig.d.ts.map +1 -0
  80. package/lib/typescript/src/utils/FeatureRegistry.d.ts +19 -0
  81. package/lib/typescript/src/utils/FeatureRegistry.d.ts.map +1 -0
  82. package/package.json +190 -0
  83. package/scripts/download-rgb-lib-ios.js +102 -0
  84. package/src/Orbis1SDK.ts +132 -0
  85. package/src/core/Interfaces.ts +412 -0
  86. package/src/core/NativeRgb.ts +491 -0
  87. package/src/core/RgbError.ts +84 -0
  88. package/src/core/Wallet.ts +1127 -0
  89. package/src/errors/FeatureNotEnabledError.ts +22 -0
  90. package/src/features/watch-tower/WatchTowerModule.ts +115 -0
  91. package/src/features/watch-tower/index.ts +9 -0
  92. package/src/features/watch-tower/types/WatchTowerConfig.ts +15 -0
  93. package/src/features/watch-tower/types/index.ts +2 -0
  94. package/src/index.tsx +75 -0
  95. package/src/types/Feature.ts +13 -0
  96. package/src/types/IFeatureModule.ts +99 -0
  97. package/src/types/Orbis1CreateConfig.ts +43 -0
  98. package/src/utils/FeatureRegistry.ts +61 -0
package/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Orbis1
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ SOFTWARE.
@@ -0,0 +1,24 @@
1
+ require "json"
2
+
3
+ package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
+
5
+ Pod::Spec.new do |s|
6
+ s.name = "Orbis1Sdk"
7
+ s.version = package["version"]
8
+ s.summary = package["description"]
9
+ s.homepage = package["homepage"]
10
+ s.license = package["license"]
11
+ s.authors = package["author"]
12
+
13
+ s.platforms = { :ios => min_ios_version_supported }
14
+ s.source = { :git => "https://www.github.com/Orbis-1/react-native-rgb.git", :tag => "#{s.version}" }
15
+
16
+ s.source_files = "ios/**/*.{h,m,mm,swift,cpp}"
17
+ s.exclude_files = "ios/Rgb.h", "ios/Rgb.mm"
18
+ s.private_header_files = "ios/**/*.h"
19
+
20
+ s.vendored_frameworks = "ios/rgb_libFFI.xcframework"
21
+ s.preserve_paths = "ios/rgb_libFFI.xcframework"
22
+
23
+ install_modules_dependencies(s)
24
+ end
package/README.md ADDED
@@ -0,0 +1,269 @@
1
+ # orbis1-sdk-rn
2
+
3
+ Orbis1 SDK for React Native with RGB core, Watch Tower, and Gas-Free transfers.
4
+
5
+ ## Prerequisites
6
+
7
+ - **Node.js** — Use the version in [`.nvmrc`](.nvmrc) (e.g. `v22.20.0`). [nvm](https://github.com/nvm-sh/nvm) recommended:
8
+ ```sh
9
+ nvm use
10
+ ```
11
+ - **Yarn** — This repo uses [Yarn 4](https://yarnpkg.com/) (see `packageManager` in `package.json`). Use Yarn for all installs and scripts; npm is not supported for development.
12
+ - **Android** (for running the example on Android):
13
+ - [React Native environment setup](https://reactnative.dev/docs/set-up-your-environment) (Android Studio, JDK 17, Android SDK, etc.)
14
+ - **iOS** (for running the example on iOS):
15
+ - macOS only
16
+ - [Xcode](https://developer.apple.com/xcode/) and iOS Simulator or device
17
+ - [CocoaPods](https://cocoapods.org/) (installed via Bundler in the example app)
18
+ - The iOS native RGB framework (`rgb_libFFI.xcframework`) is downloaded automatically on `yarn` (postinstall) when run on macOS.
19
+
20
+ ## Installation
21
+
22
+ To use the SDK in your app:
23
+
24
+ ```sh
25
+ npm install orbis1-sdk-rn
26
+ # or
27
+ yarn add orbis1-sdk-rn
28
+ ```
29
+
30
+ ## Usage
31
+
32
+ ```js
33
+ import {
34
+ Wallet,
35
+ generateKeys,
36
+ restoreKeys,
37
+ Interfaces,
38
+ } from 'orbis1-sdk-rn';
39
+
40
+ // Generate new keys
41
+ const keys = await generateKeys(Interfaces.BitcoinNetwork.TESTNET);
42
+
43
+ // Or restore from mnemonic
44
+ const restoredKeys = await restoreKeys(
45
+ Interfaces.BitcoinNetwork.TESTNET,
46
+ 'your mnemonic phrase here'
47
+ );
48
+
49
+ // Use the Wallet class for RGB operations, transfers, etc.
50
+ const wallet = new Wallet(keys, /* ... */);
51
+ ```
52
+
53
+ ## Running the repository (development)
54
+
55
+ This repo is a **monorepo** with Yarn workspaces: the library lives in the root and an **example app** in `example/`.
56
+
57
+ ### 1. Clone and install
58
+
59
+ ```sh
60
+ git clone <repo-url>
61
+ cd orbis1-sdk-rn
62
+ ```
63
+
64
+ Use the correct Node version:
65
+
66
+ ```sh
67
+ nvm use
68
+ # or: node -v should match .nvmrc (e.g. v22.20.0)
69
+ ```
70
+
71
+ Install dependencies (required for both library and example):
72
+
73
+ ```sh
74
+ yarn
75
+ ```
76
+
77
+ - On **macOS**, `yarn` runs a postinstall script that downloads the iOS RGB framework (`rgb_libFFI.xcframework`) into `ios/`. If it’s already present, the download is skipped.
78
+ - Do **not** use `npm install` for development; the project relies on Yarn workspaces.
79
+
80
+ ### 2. Build the library (optional)
81
+
82
+ The example app uses the library from source. To build the library output (e.g. for publishing or typecheck):
83
+
84
+ ```sh
85
+ yarn prepare
86
+ # or: bob build
87
+ ```
88
+
89
+ ### 3. Run the example app
90
+
91
+ The example app uses the **local** library, so JS/TS changes are picked up without rebuilding; native changes require a rebuild.
92
+
93
+ **Start Metro (from repo root):**
94
+
95
+ ```sh
96
+ yarn example start
97
+ ```
98
+
99
+ In another terminal, run the app:
100
+
101
+ **Android:**
102
+
103
+ ```sh
104
+ yarn example android
105
+ ```
106
+
107
+ **iOS (first time or after native dependency changes):**
108
+
109
+ From the repo root:
110
+
111
+ ```sh
112
+ cd example
113
+ bundle install
114
+ bundle exec pod install --project-directory=ios
115
+ cd ..
116
+ yarn example ios
117
+ ```
118
+
119
+ Or from `example`:
120
+
121
+ ```sh
122
+ cd example
123
+ bundle install
124
+ cd ios && bundle exec pod install && cd ..
125
+ yarn ios
126
+ ```
127
+
128
+ Subsequent runs (if you didn’t change native deps):
129
+
130
+ ```sh
131
+ yarn example ios
132
+ ```
133
+
134
+ ### 4. Working with native code
135
+
136
+ - **iOS:** Open `example/ios/Orbis1SdkExample.xcworkspace` in Xcode. Library native code is under **Pods → Development Pods → orbis1-sdk-rn**.
137
+ - **Android:** Open `example/android` in Android Studio. Library code is under **orbis1-sdk-rn**.
138
+
139
+ ### 5. Verify New Architecture
140
+
141
+ To confirm the example runs with the New Architecture, check the Metro logs for something like:
142
+
143
+ ```text
144
+ Running "Orbis1SdkExample" with {"fabric":true,"initialProps":{"concurrentRoot":true},"rootTag":1}
145
+ ```
146
+
147
+ (`fabric: true` and `concurrentRoot: true` indicate the New Architecture.)
148
+
149
+ ## Scripts (from repo root)
150
+
151
+ | Command | Description |
152
+ |--------|-------------|
153
+ | `yarn` | Install dependencies (and on macOS, download iOS RGB framework) |
154
+ | `yarn prepare` | Build the library (output in `lib/`) |
155
+ | `yarn typecheck` | TypeScript type-check |
156
+ | `yarn lint` | Run ESLint |
157
+ | `yarn lint --fix` | Fix lint/format issues |
158
+ | `yarn test` | Run unit tests (Jest) |
159
+ | `yarn example start` | Start Metro for the example app |
160
+ | `yarn example android` | Run the example app on Android |
161
+ | `yarn example ios` | Run the example app on iOS |
162
+
163
+ ## Project structure
164
+
165
+ ```
166
+ orbis1-sdk-rn/
167
+ ├── .github/ # CI/CD and GitHub config
168
+ │ ├── actions/
169
+ │ │ └── setup/ # Reusable workflow: Node, Yarn cache, install
170
+ │ │ └── action.yml
171
+ │ ├── ISSUE_TEMPLATE/ # Bug report and issue config
172
+ │ └── workflows/
173
+ │ └── ci.yml # Lint, typecheck, test, build lib, Android & iOS builds
174
+
175
+ ├── android/ # Native Android module (Kotlin)
176
+ │ ├── build.gradle
177
+ │ └── src/main/
178
+ │ ├── AndroidManifest.xml
179
+ │ └── java/com/orbis1sdk/
180
+ │ ├── AppConstants.kt # Build/config constants exposed to JS
181
+ │ ├── Orbis1SdkModule.kt # Turbo Module entry (New Architecture)
182
+ │ ├── Orbis1SdkPackage.kt # Package registration
183
+ │ ├── RgbModule.kt # RGB core native implementation (bridge to rgb lib)
184
+ │ ├── RgbPackage.kt # RGB native package registration
185
+ │ └── WalletStore.kt # Persistent wallet storage
186
+
187
+ ├── ios/ # Native iOS module (Swift + Obj-C)
188
+ │ ├── AppConstants.swift # Build/config constants exposed to JS
189
+ │ ├── Orbis1Sdk.h / .mm # Turbo Module Obj-C bridge
190
+ │ ├── Rgb.h / .mm # RGB module Obj-C bridge
191
+ │ ├── Rgb.swift # RGB Swift API
192
+ │ ├── RgbLib.swift # rgb_libFFI.xcframework bindings
193
+ │ ├── WalletStore.swift # Persistent wallet storage
194
+ │ └── (rgb_libFFI.xcframework) # Downloaded by postinstall on macOS
195
+
196
+ ├── scripts/
197
+ │ └── download-rgb-lib-ios.js # Postinstall: fetches RGB iOS xcframework for macOS
198
+
199
+ ├── src/ # TypeScript/React Native library source
200
+ │ ├── index.tsx # Public API (exports, generateKeys, restoreKeys)
201
+ │ ├── __tests__/
202
+ │ │ └── index.test.tsx
203
+ │ └── core/
204
+ │ ├── Interfaces.ts # Types, enums (BitcoinNetwork, Keys, etc.)
205
+ │ ├── NativeRgb.ts # Turbo Module spec / native bridge interface
206
+ │ ├── RgbError.ts # Error types and RgbError class
207
+ │ └── Wallet.ts # Wallet class (RGB ops, transfers, persistence)
208
+
209
+ ├── example/ # Example React Native app (Yarn workspace)
210
+ │ ├── android/ # Example app Android project
211
+ │ │ ├── app/ # App module (MainActivity, MainApplication, res)
212
+ │ │ ├── build.gradle, settings.gradle, gradle.properties
213
+ │ │ └── gradlew, gradle/wrapper/
214
+ │ ├── ios/ # Example app iOS project
215
+ │ │ ├── Orbis1SdkExample/ # App target (AppDelegate, Info.plist, assets)
216
+ │ │ ├── Orbis1SdkExample.xcworkspace # Open this in Xcode (includes Pods)
217
+ │ │ ├── Orbis1SdkExample.xcodeproj/
218
+ │ │ ├── Podfile, Podfile.lock
219
+ │ │ └── .xcode.env
220
+ │ ├── src/
221
+ │ │ └── App.tsx # Example app UI
222
+ │ ├── index.js # App entry
223
+ │ ├── package.json # Deps: react, react-native; scripts: start, android, ios
224
+ │ ├── metro.config.js
225
+ │ ├── react-native.config.js # Links to parent library
226
+ │ ├── Gemfile / Gemfile.lock # CocoaPods via Bundler
227
+ │ └── app.json
228
+
229
+ ├── lib/ # Build output (from yarn prepare) — not committed
230
+ │ ├── module/ # Compiled JS (ESM)
231
+ │ └── typescript/ # Generated .d.ts
232
+
233
+ ├── package.json # Library manifest, workspaces [example, docs], scripts
234
+ ├── Orbis1Sdk.podspec # CocoaPods spec for iOS
235
+ ├── tsconfig.json / tsconfig.build.json
236
+ ├── babel.config.js
237
+ ├── eslint.config.mjs
238
+ ├── turbo.json # Turbo tasks: build:android, build:ios
239
+ ├── lefthook.yml # Git hooks (e.g. commitlint)
240
+ ├── .nvmrc # Node version (e.g. v22.20.0)
241
+ ├── .yarnrc.yml # Yarn 4 config, workspace hoisting
242
+ ├── .yarn/releases/ # Pinned Yarn binary
243
+ ├── CONTRIBUTING.md
244
+ ├── CODE_OF_CONDUCT.md
245
+ └── LICENSE
246
+ ```
247
+
248
+ ### Summary
249
+
250
+ | Path | Purpose |
251
+ |------|--------|
252
+ | `src/` | Library TypeScript source and public API; built to `lib/` by react-native-builder-bob. |
253
+ | `android/`, `ios/` | Native SDK implementation (Turbo Modules); linked into apps via the React Native CLI / CocoaPods. |
254
+ | `example/` | Standalone app that depends on the local library; used to run and test the SDK. |
255
+ | `scripts/` | Postinstall and other tooling (e.g. iOS RGB framework download). |
256
+ | `.github/` | CI (lint, typecheck, test, build library, build example on Android and iOS). |
257
+
258
+ ## Contributing
259
+
260
+ - [Development workflow](CONTRIBUTING.md#development-workflow)
261
+ - [Sending a pull request](CONTRIBUTING.md#sending-a-pull-request)
262
+ - [Code of conduct](CODE_OF_CONDUCT.md)
263
+
264
+ ## License
265
+
266
+ MIT
267
+
268
+ ---
269
+
@@ -0,0 +1,78 @@
1
+ buildscript {
2
+ ext.Orbis1Sdk = [
3
+ kotlinVersion: "2.0.21",
4
+ minSdkVersion: 24,
5
+ compileSdkVersion: 36,
6
+ targetSdkVersion: 36
7
+ ]
8
+
9
+ ext.getExtOrDefault = { prop ->
10
+ if (rootProject.ext.has(prop)) {
11
+ return rootProject.ext.get(prop)
12
+ }
13
+
14
+ return Orbis1Sdk[prop]
15
+ }
16
+
17
+ repositories {
18
+ google()
19
+ mavenCentral()
20
+ }
21
+
22
+ dependencies {
23
+ classpath "com.android.tools.build:gradle:8.7.2"
24
+ // noinspection DifferentKotlinGradleVersion
25
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}"
26
+ }
27
+ }
28
+
29
+
30
+ apply plugin: "com.android.library"
31
+ apply plugin: "kotlin-android"
32
+
33
+ apply plugin: "com.facebook.react"
34
+
35
+ android {
36
+ namespace "com.orbis1sdk"
37
+
38
+ compileSdkVersion getExtOrDefault("compileSdkVersion")
39
+
40
+ defaultConfig {
41
+ minSdkVersion getExtOrDefault("minSdkVersion")
42
+ targetSdkVersion getExtOrDefault("targetSdkVersion")
43
+ }
44
+
45
+ buildFeatures {
46
+ buildConfig true
47
+ }
48
+
49
+ buildTypes {
50
+ release {
51
+ minifyEnabled false
52
+ }
53
+ }
54
+
55
+ lint {
56
+ disable "GradleCompatible"
57
+ }
58
+
59
+ compileOptions {
60
+ sourceCompatibility JavaVersion.VERSION_1_8
61
+ targetCompatibility JavaVersion.VERSION_1_8
62
+ }
63
+ }
64
+
65
+ repositories {
66
+ mavenCentral()
67
+ google()
68
+ }
69
+
70
+ def kotlin_version = getExtOrDefault("kotlinVersion")
71
+
72
+ dependencies {
73
+ implementation "com.facebook.react:react-android"
74
+ implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
75
+ implementation("io.github.orbis-1:rgb-lib-android:0.3.0-beta.4")
76
+ implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3"
77
+ implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.1"
78
+ }
@@ -0,0 +1,2 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
+ </manifest>
@@ -0,0 +1,25 @@
1
+ package com.rgb
2
+
3
+ import android.content.Context
4
+ import java.io.File
5
+
6
+ object AppConstants {
7
+ const val rgbDirName = ""
8
+ var appContext: Context? = null
9
+ var rgbDir: File? = null
10
+ const val backupName = "%s.rgb_backup"
11
+
12
+ @JvmStatic
13
+ fun initContext(context: Context) {
14
+ appContext = context
15
+ rgbDir = File(context.filesDir, rgbDirName)
16
+ }
17
+
18
+ @JvmStatic
19
+ fun ensureInitialized(context: Context) {
20
+ if (appContext == null || rgbDir == null) {
21
+ initContext(context)
22
+ }
23
+ }
24
+ }
25
+
@@ -0,0 +1,15 @@
1
+ package com.orbis1sdk
2
+
3
+ import com.facebook.react.bridge.ReactApplicationContext
4
+
5
+ class Orbis1SdkModule(reactContext: ReactApplicationContext) :
6
+ NativeOrbis1SdkSpec(reactContext) {
7
+
8
+ override fun multiply(a: Double, b: Double): Double {
9
+ return a * b
10
+ }
11
+
12
+ companion object {
13
+ const val NAME = NativeOrbis1SdkSpec.NAME
14
+ }
15
+ }
@@ -0,0 +1,33 @@
1
+ package com.orbis1sdk
2
+
3
+ import com.facebook.react.BaseReactPackage
4
+ import com.facebook.react.bridge.NativeModule
5
+ import com.facebook.react.bridge.ReactApplicationContext
6
+ import com.facebook.react.module.model.ReactModuleInfo
7
+ import com.facebook.react.module.model.ReactModuleInfoProvider
8
+ import java.util.HashMap
9
+
10
+ class Orbis1SdkPackage : BaseReactPackage() {
11
+ override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
12
+ return if (name == Orbis1SdkModule.NAME) {
13
+ Orbis1SdkModule(reactContext)
14
+ } else {
15
+ null
16
+ }
17
+ }
18
+
19
+ override fun getReactModuleInfoProvider(): ReactModuleInfoProvider {
20
+ return ReactModuleInfoProvider {
21
+ val moduleInfos: MutableMap<String, ReactModuleInfo> = HashMap()
22
+ moduleInfos[Orbis1SdkModule.NAME] = ReactModuleInfo(
23
+ Orbis1SdkModule.NAME,
24
+ Orbis1SdkModule.NAME,
25
+ false, // canOverrideExistingModule
26
+ false, // needsEagerInit
27
+ false, // isCxxModule
28
+ true // isTurboModule
29
+ )
30
+ moduleInfos
31
+ }
32
+ }
33
+ }