react-native-nitro-ark 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -0
- package/NitroArk.podspec +30 -0
- package/README.md +22 -0
- package/android/CMakeLists.txt +64 -0
- package/android/build.gradle +145 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/AndroidManifestNew.xml +2 -0
- package/android/src/main/cpp/cpp-adapter.cpp +6 -0
- package/android/src/main/java/com/nitroark/NitroArkPackage.kt +22 -0
- package/cpp/HybridArk.cpp +8 -0
- package/cpp/NitroArk.hpp +558 -0
- package/cpp/bark-cpp.h +382 -0
- package/lib/commonjs/NitroArk.nitro.js +6 -0
- package/lib/commonjs/NitroArk.nitro.js.map +1 -0
- package/lib/commonjs/index.js +292 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/module/NitroArk.nitro.js +4 -0
- package/lib/module/NitroArk.nitro.js.map +1 -0
- package/lib/module/index.js +268 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/src/NitroArk.nitro.d.ts +59 -0
- package/lib/typescript/commonjs/src/NitroArk.nitro.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +180 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/src/NitroArk.nitro.d.ts +59 -0
- package/lib/typescript/module/src/NitroArk.nitro.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +180 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -0
- package/nitrogen/generated/android/NitroArk+autolinking.cmake +78 -0
- package/nitrogen/generated/android/NitroArk+autolinking.gradle +27 -0
- package/nitrogen/generated/android/NitroArkOnLoad.cpp +44 -0
- package/nitrogen/generated/android/NitroArkOnLoad.hpp +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroark/NitroArkOnLoad.kt +35 -0
- package/nitrogen/generated/ios/NitroArk+autolinking.rb +60 -0
- package/nitrogen/generated/ios/NitroArk-Swift-Cxx-Bridge.cpp +17 -0
- package/nitrogen/generated/ios/NitroArk-Swift-Cxx-Bridge.hpp +27 -0
- package/nitrogen/generated/ios/NitroArk-Swift-Cxx-Umbrella.hpp +38 -0
- package/nitrogen/generated/ios/NitroArkAutolinking.mm +35 -0
- package/nitrogen/generated/ios/NitroArkAutolinking.swift +12 -0
- package/nitrogen/generated/shared/c++/BarkBalance.hpp +77 -0
- package/nitrogen/generated/shared/c++/BarkConfigOpts.hpp +90 -0
- package/nitrogen/generated/shared/c++/BarkCreateOpts.hpp +96 -0
- package/nitrogen/generated/shared/c++/BarkRefreshModeType.hpp +94 -0
- package/nitrogen/generated/shared/c++/BarkRefreshOpts.hpp +81 -0
- package/nitrogen/generated/shared/c++/BarkSendManyOutput.hpp +73 -0
- package/nitrogen/generated/shared/c++/HybridNitroArkSpec.cpp +40 -0
- package/nitrogen/generated/shared/c++/HybridNitroArkSpec.hpp +95 -0
- package/package.json +178 -0
- package/src/NitroArk.nitro.ts +159 -0
- package/src/index.tsx +443 -0
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import type { NitroArk, BarkCreateOpts, BarkBalance, BarkRefreshOpts, BarkSendManyOutput } from './NitroArk.nitro';
|
|
2
|
+
export declare const NitroArkHybridObject: NitroArk;
|
|
3
|
+
/**
|
|
4
|
+
* Creates a new BIP39 mnemonic phrase.
|
|
5
|
+
* @returns A promise resolving to the mnemonic string.
|
|
6
|
+
*/
|
|
7
|
+
export declare function createMnemonic(): Promise<string>;
|
|
8
|
+
/**
|
|
9
|
+
* Creates a new wallet at the specified directory.
|
|
10
|
+
* @param datadir Path to the data directory.
|
|
11
|
+
* @param opts Creation options.
|
|
12
|
+
* @returns A promise that resolves on success or rejects on error.
|
|
13
|
+
*/
|
|
14
|
+
export declare function createWallet(datadir: string, opts: BarkCreateOpts): Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
* Gets the offchain and onchain balances.
|
|
17
|
+
* @param datadir Path to the data directory.
|
|
18
|
+
* @param no_sync Whether to skip syncing the wallet. Defaults to false.
|
|
19
|
+
* @param mnemonic The wallet mnemonic phrase.
|
|
20
|
+
* @returns A promise resolving to the BarkBalance object.
|
|
21
|
+
*/
|
|
22
|
+
export declare function getBalance(datadir: string, mnemonic: string, no_sync?: boolean): Promise<BarkBalance>;
|
|
23
|
+
/**
|
|
24
|
+
* Gets a fresh onchain address.
|
|
25
|
+
* @param datadir Path to the data directory.
|
|
26
|
+
* @param mnemonic The wallet mnemonic phrase.
|
|
27
|
+
* @returns A promise resolving to the Bitcoin address string.
|
|
28
|
+
*/
|
|
29
|
+
export declare function getOnchainAddress(datadir: string, mnemonic: string): Promise<string>;
|
|
30
|
+
/**
|
|
31
|
+
* Gets the list of onchain UTXOs as a JSON string.
|
|
32
|
+
* @param datadir Path to the data directory.
|
|
33
|
+
* @param mnemonic The wallet mnemonic phrase.
|
|
34
|
+
* @param no_sync Whether to skip syncing the wallet. Defaults to false.
|
|
35
|
+
* @returns A promise resolving to the JSON string of UTXOs.
|
|
36
|
+
*/
|
|
37
|
+
export declare function getOnchainUtxos(datadir: string, mnemonic: string, no_sync?: boolean): Promise<string>;
|
|
38
|
+
/**
|
|
39
|
+
* Gets the wallet's VTXO public key (hex string).
|
|
40
|
+
* @param datadir Path to the data directory.
|
|
41
|
+
* @param mnemonic The wallet mnemonic phrase.
|
|
42
|
+
* @returns A promise resolving to the hex-encoded public key string.
|
|
43
|
+
*/
|
|
44
|
+
export declare function getVtxoPubkey(datadir: string, mnemonic: string): Promise<string>;
|
|
45
|
+
/**
|
|
46
|
+
* Gets the list of VTXOs as a JSON string.
|
|
47
|
+
* @param datadir Path to the data directory.
|
|
48
|
+
* @param mnemonic The wallet mnemonic phrase.
|
|
49
|
+
* @param no_sync Whether to skip syncing the wallet. Defaults to false.
|
|
50
|
+
* @returns A promise resolving to the JSON string of VTXOs.
|
|
51
|
+
*/
|
|
52
|
+
export declare function getVtxos(datadir: string, mnemonic: string, no_sync?: boolean): Promise<string>;
|
|
53
|
+
/**
|
|
54
|
+
* Sends funds using the onchain wallet.
|
|
55
|
+
* @param datadir Path to the data directory.
|
|
56
|
+
* @param mnemonic The wallet mnemonic phrase.
|
|
57
|
+
* @param destination The destination Bitcoin address.
|
|
58
|
+
* @param amountSat The amount to send in satoshis.
|
|
59
|
+
* @param no_sync Whether to skip syncing the wallet. Defaults to false.
|
|
60
|
+
* @returns A promise resolving to the transaction ID string.
|
|
61
|
+
*/
|
|
62
|
+
export declare function sendOnchain(datadir: string, mnemonic: string, destination: string, amountSat: number, no_sync?: boolean): Promise<string>;
|
|
63
|
+
/**
|
|
64
|
+
* Sends all funds from the onchain wallet to a destination address.
|
|
65
|
+
* @param datadir Path to the data directory.
|
|
66
|
+
* @param mnemonic The wallet mnemonic phrase.
|
|
67
|
+
* @param destination The destination Bitcoin address.
|
|
68
|
+
* @param no_sync Whether to skip syncing the wallet. Defaults to false.
|
|
69
|
+
* @returns A promise resolving to the transaction ID string.
|
|
70
|
+
*/
|
|
71
|
+
export declare function drainOnchain(datadir: string, mnemonic: string, destination: string, no_sync?: boolean): Promise<string>;
|
|
72
|
+
/**
|
|
73
|
+
* Sends funds to multiple recipients using the onchain wallet.
|
|
74
|
+
* @param datadir Path to the data directory.
|
|
75
|
+
* @param mnemonic The wallet mnemonic phrase.
|
|
76
|
+
* @param outputs An array of objects containing destination address and amountSat.
|
|
77
|
+
* @param no_sync Whether to skip syncing the wallet. Defaults to false.
|
|
78
|
+
* @returns A promise resolving to the transaction ID string.
|
|
79
|
+
*/
|
|
80
|
+
export declare function sendManyOnchain(datadir: string, mnemonic: string, outputs: BarkSendManyOutput[], no_sync?: boolean): Promise<string>;
|
|
81
|
+
/**
|
|
82
|
+
* Refreshes VTXOs based on specified criteria.
|
|
83
|
+
* @param datadir Path to the data directory.
|
|
84
|
+
* @param mnemonic The wallet mnemonic phrase.
|
|
85
|
+
* @param refreshOpts Options specifying which VTXOs to refresh.
|
|
86
|
+
* `mode_type` should be one of: 'DefaultThreshold', 'ThresholdBlocks', 'ThresholdHours', 'Counterparty', 'All', 'Specific'.
|
|
87
|
+
* @param no_sync Whether to skip syncing the wallet. Defaults to false.
|
|
88
|
+
* @returns A promise resolving to a JSON status string.
|
|
89
|
+
* @example
|
|
90
|
+
* // Refresh using default threshold
|
|
91
|
+
* refreshVtxos(datadir, mnemonic, { mode_type: 'DefaultThreshold' });
|
|
92
|
+
* // Refresh specific VTXOs
|
|
93
|
+
* refreshVtxos(datadir, mnemonic, { mode_type: 'Specific', specific_vtxo_ids: ['vtxo_id_1', 'vtxo_id_2'] });
|
|
94
|
+
* // Refresh if older than 10 blocks
|
|
95
|
+
* refreshVtxos(datadir, mnemonic, { mode_type: 'ThresholdBlocks', threshold_value: 10 });
|
|
96
|
+
*/
|
|
97
|
+
export declare function refreshVtxos(datadir: string, mnemonic: string, refreshOpts: BarkRefreshOpts, no_sync?: boolean): Promise<string>;
|
|
98
|
+
/**
|
|
99
|
+
* Boards a specific amount from the onchain wallet into Ark.
|
|
100
|
+
* @param datadir Path to the data directory.
|
|
101
|
+
* @param mnemonic The wallet mnemonic phrase.
|
|
102
|
+
* @param amountSat The amount in satoshis to board.
|
|
103
|
+
* @param no_sync Whether to skip syncing the onchain wallet. Defaults to false.
|
|
104
|
+
* @returns A promise resolving to a JSON status string.
|
|
105
|
+
*/
|
|
106
|
+
export declare function boardAmount(datadir: string, mnemonic: string, amountSat: number, no_sync?: boolean): Promise<string>;
|
|
107
|
+
/**
|
|
108
|
+
* Boards all available funds from the onchain wallet into Ark.
|
|
109
|
+
* @param datadir Path to the data directory.
|
|
110
|
+
* @param mnemonic The wallet mnemonic phrase.
|
|
111
|
+
* @param no_sync Whether to skip syncing the onchain wallet. Defaults to false.
|
|
112
|
+
* @returns A promise resolving to a JSON status string.
|
|
113
|
+
*/
|
|
114
|
+
export declare function boardAll(datadir: string, mnemonic: string, no_sync?: boolean): Promise<string>;
|
|
115
|
+
/**
|
|
116
|
+
* Sends funds offchain using Ark VTXOs.
|
|
117
|
+
* @param datadir Path to the data directory.
|
|
118
|
+
* @param mnemonic The wallet mnemonic phrase.
|
|
119
|
+
* @param destination Ark address (VTXO pubkey) or onchain Bitcoin address.
|
|
120
|
+
* @param amountSat The amount in satoshis to send.
|
|
121
|
+
* @param comment Optional comment (can be null).
|
|
122
|
+
* @param no_sync Whether to skip syncing the wallet. Defaults to false.
|
|
123
|
+
* @returns A promise resolving to a JSON status string.
|
|
124
|
+
*/
|
|
125
|
+
export declare function send(datadir: string, mnemonic: string, destination: string, amountSat: number, comment?: string | null, no_sync?: boolean): Promise<string>;
|
|
126
|
+
/**
|
|
127
|
+
* Sends an onchain payment via an Ark round.
|
|
128
|
+
* @param datadir Path to the data directory.
|
|
129
|
+
* @param mnemonic The wallet mnemonic phrase.
|
|
130
|
+
* @param destination The destination Bitcoin address.
|
|
131
|
+
* @param amountSat The amount in satoshis to send.
|
|
132
|
+
* @param no_sync Whether to skip syncing the wallet. Defaults to false.
|
|
133
|
+
* @returns A promise resolving to a JSON status string.
|
|
134
|
+
*/
|
|
135
|
+
export declare function sendRoundOnchain(datadir: string, mnemonic: string, destination: string, amountSat: number, no_sync?: boolean): Promise<string>;
|
|
136
|
+
/**
|
|
137
|
+
* Offboards specific VTXOs to an optional onchain address.
|
|
138
|
+
* @param datadir Path to the data directory.
|
|
139
|
+
* @param mnemonic The wallet mnemonic phrase.
|
|
140
|
+
* @param vtxoIds Array of VtxoId strings to offboard.
|
|
141
|
+
* @param optionalAddress Optional destination Bitcoin address (null if sending to internal wallet).
|
|
142
|
+
* @param no_sync Whether to skip syncing the wallet. Defaults to false.
|
|
143
|
+
* @returns A promise resolving to a JSON result string.
|
|
144
|
+
*/
|
|
145
|
+
export declare function offboardSpecific(datadir: string, mnemonic: string, vtxoIds: string[], optionalAddress?: string | null, no_sync?: boolean): Promise<string>;
|
|
146
|
+
/**
|
|
147
|
+
* Offboards all VTXOs to an optional onchain address.
|
|
148
|
+
* @param datadir Path to the data directory.
|
|
149
|
+
* @param mnemonic The wallet mnemonic phrase.
|
|
150
|
+
* @param optionalAddress Optional destination Bitcoin address (null if sending to internal wallet).
|
|
151
|
+
* @param no_sync Whether to skip syncing the wallet. Defaults to false.
|
|
152
|
+
* @returns A promise resolving to a JSON result string.
|
|
153
|
+
*/
|
|
154
|
+
export declare function offboardAll(datadir: string, mnemonic: string, optionalAddress?: string | null, no_sync?: boolean): Promise<string>;
|
|
155
|
+
/**
|
|
156
|
+
* Starts the exit process for specific VTXOs.
|
|
157
|
+
* @param datadir Path to the data directory.
|
|
158
|
+
* @param mnemonic The wallet mnemonic phrase.
|
|
159
|
+
* @param vtxoIds Array of VtxoId strings to start exiting.
|
|
160
|
+
* @param no_sync Whether to skip syncing the wallet (Note: This might depend on potential C header updates). Defaults to false.
|
|
161
|
+
* @returns A promise resolving to a JSON status string.
|
|
162
|
+
*/
|
|
163
|
+
export declare function exitStartSpecific(datadir: string, mnemonic: string, vtxoIds: string[], no_sync?: boolean): Promise<string>;
|
|
164
|
+
/**
|
|
165
|
+
* Starts the exit process for all VTXOs in the wallet.
|
|
166
|
+
* @param datadir Path to the data directory.
|
|
167
|
+
* @param mnemonic The wallet mnemonic phrase.
|
|
168
|
+
* @param no_sync Whether to skip syncing the wallet (Note: This might depend on potential C header updates). Defaults to false.
|
|
169
|
+
* @returns A promise resolving to a JSON status string.
|
|
170
|
+
*/
|
|
171
|
+
export declare function exitStartAll(datadir: string, mnemonic: string, no_sync?: boolean): Promise<string>;
|
|
172
|
+
/**
|
|
173
|
+
* Progresses the exit process once and returns the current status.
|
|
174
|
+
* @param datadir Path to the data directory.
|
|
175
|
+
* @param mnemonic The wallet mnemonic phrase.
|
|
176
|
+
* @returns A promise resolving to a JSON status string.
|
|
177
|
+
*/
|
|
178
|
+
export declare function exitProgressOnce(datadir: string, mnemonic: string): Promise<string>;
|
|
179
|
+
export type { BarkCreateOpts, BarkConfigOpts, BarkBalance, BarkRefreshOpts, BarkRefreshModeType, BarkSendManyOutput, } from './NitroArk.nitro';
|
|
180
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
#
|
|
2
|
+
# NitroArk+autolinking.cmake
|
|
3
|
+
# This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
# https://github.com/mrousavy/nitro
|
|
5
|
+
# Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
#
|
|
7
|
+
|
|
8
|
+
# This is a CMake file that adds all files generated by Nitrogen
|
|
9
|
+
# to the current CMake project.
|
|
10
|
+
#
|
|
11
|
+
# To use it, add this to your CMakeLists.txt:
|
|
12
|
+
# ```cmake
|
|
13
|
+
# include(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/NitroArk+autolinking.cmake)
|
|
14
|
+
# ```
|
|
15
|
+
|
|
16
|
+
# Add all headers that were generated by Nitrogen
|
|
17
|
+
include_directories(
|
|
18
|
+
"../nitrogen/generated/shared/c++"
|
|
19
|
+
"../nitrogen/generated/android/c++"
|
|
20
|
+
"../nitrogen/generated/android/"
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
# Add all .cpp sources that were generated by Nitrogen
|
|
24
|
+
target_sources(
|
|
25
|
+
# CMake project name (Android C++ library name)
|
|
26
|
+
NitroArk PRIVATE
|
|
27
|
+
# Autolinking Setup
|
|
28
|
+
../nitrogen/generated/android/NitroArkOnLoad.cpp
|
|
29
|
+
# Shared Nitrogen C++ sources
|
|
30
|
+
../nitrogen/generated/shared/c++/HybridNitroArkSpec.cpp
|
|
31
|
+
# Android-specific Nitrogen C++ sources
|
|
32
|
+
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
# Define a flag to check if we are building properly
|
|
36
|
+
add_definitions(-DBUILDING_NITROARK_WITH_GENERATED_CMAKE_PROJECT)
|
|
37
|
+
|
|
38
|
+
# From node_modules/react-native/ReactAndroid/cmake-utils/folly-flags.cmake
|
|
39
|
+
# Used in node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake
|
|
40
|
+
target_compile_definitions(
|
|
41
|
+
NitroArk PRIVATE
|
|
42
|
+
-DFOLLY_NO_CONFIG=1
|
|
43
|
+
-DFOLLY_HAVE_CLOCK_GETTIME=1
|
|
44
|
+
-DFOLLY_USE_LIBCPP=1
|
|
45
|
+
-DFOLLY_CFG_NO_COROUTINES=1
|
|
46
|
+
-DFOLLY_MOBILE=1
|
|
47
|
+
-DFOLLY_HAVE_RECVMMSG=1
|
|
48
|
+
-DFOLLY_HAVE_PTHREAD=1
|
|
49
|
+
# Once we target android-23 above, we can comment
|
|
50
|
+
# the following line. NDK uses GNU style stderror_r() after API 23.
|
|
51
|
+
-DFOLLY_HAVE_XSI_STRERROR_R=1
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
# Add all libraries required by the generated specs
|
|
55
|
+
find_package(fbjni REQUIRED) # <-- Used for communication between Java <-> C++
|
|
56
|
+
find_package(ReactAndroid REQUIRED) # <-- Used to set up React Native bindings (e.g. CallInvoker/TurboModule)
|
|
57
|
+
find_package(react-native-nitro-modules REQUIRED) # <-- Used to create all HybridObjects and use the Nitro core library
|
|
58
|
+
|
|
59
|
+
# Link all libraries together
|
|
60
|
+
target_link_libraries(
|
|
61
|
+
NitroArk
|
|
62
|
+
fbjni::fbjni # <-- Facebook C++ JNI helpers
|
|
63
|
+
ReactAndroid::jsi # <-- RN: JSI
|
|
64
|
+
react-native-nitro-modules::NitroModules # <-- NitroModules Core :)
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
# Link react-native (different prefab between RN 0.75 and RN 0.76)
|
|
68
|
+
if(ReactAndroid_VERSION_MINOR GREATER_EQUAL 76)
|
|
69
|
+
target_link_libraries(
|
|
70
|
+
NitroArk
|
|
71
|
+
ReactAndroid::reactnative # <-- RN: Native Modules umbrella prefab
|
|
72
|
+
)
|
|
73
|
+
else()
|
|
74
|
+
target_link_libraries(
|
|
75
|
+
NitroArk
|
|
76
|
+
ReactAndroid::react_nativemodule_core # <-- RN: TurboModules Core
|
|
77
|
+
)
|
|
78
|
+
endif()
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroArk+autolinking.gradle
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
/// This is a Gradle file that adds all files generated by Nitrogen
|
|
9
|
+
/// to the current Gradle project.
|
|
10
|
+
///
|
|
11
|
+
/// To use it, add this to your build.gradle:
|
|
12
|
+
/// ```gradle
|
|
13
|
+
/// apply from: '../nitrogen/generated/android/NitroArk+autolinking.gradle'
|
|
14
|
+
/// ```
|
|
15
|
+
|
|
16
|
+
logger.warn("[NitroModules] 🔥 NitroArk is boosted by nitro!")
|
|
17
|
+
|
|
18
|
+
android {
|
|
19
|
+
sourceSets {
|
|
20
|
+
main {
|
|
21
|
+
java.srcDirs += [
|
|
22
|
+
// Nitrogen files
|
|
23
|
+
"${project.projectDir}/../nitrogen/generated/android/kotlin"
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroArkOnLoad.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#ifndef BUILDING_NITROARK_WITH_GENERATED_CMAKE_PROJECT
|
|
9
|
+
#error NitroArkOnLoad.cpp is not being built with the autogenerated CMakeLists.txt project. Is a different CMakeLists.txt building this?
|
|
10
|
+
#endif
|
|
11
|
+
|
|
12
|
+
#include "NitroArkOnLoad.hpp"
|
|
13
|
+
|
|
14
|
+
#include <jni.h>
|
|
15
|
+
#include <fbjni/fbjni.h>
|
|
16
|
+
#include <NitroModules/HybridObjectRegistry.hpp>
|
|
17
|
+
|
|
18
|
+
#include "NitroArk.hpp"
|
|
19
|
+
|
|
20
|
+
namespace margelo::nitro::nitroark {
|
|
21
|
+
|
|
22
|
+
int initialize(JavaVM* vm) {
|
|
23
|
+
using namespace margelo::nitro;
|
|
24
|
+
using namespace margelo::nitro::nitroark;
|
|
25
|
+
using namespace facebook;
|
|
26
|
+
|
|
27
|
+
return facebook::jni::initialize(vm, [] {
|
|
28
|
+
// Register native JNI methods
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
// Register Nitro Hybrid Objects
|
|
32
|
+
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
33
|
+
"NitroArk",
|
|
34
|
+
[]() -> std::shared_ptr<HybridObject> {
|
|
35
|
+
static_assert(std::is_default_constructible_v<NitroArk>,
|
|
36
|
+
"The HybridObject \"NitroArk\" is not default-constructible! "
|
|
37
|
+
"Create a public constructor that takes zero arguments to be able to autolink this HybridObject.");
|
|
38
|
+
return std::make_shared<NitroArk>();
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
} // namespace margelo::nitro::nitroark
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroArkOnLoad.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include <jni.h>
|
|
9
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
10
|
+
|
|
11
|
+
namespace margelo::nitro::nitroark {
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Initializes the native (C++) part of NitroArk, and autolinks all Hybrid Objects.
|
|
15
|
+
* Call this in your `JNI_OnLoad` function (probably inside `cpp-adapter.cpp`).
|
|
16
|
+
* Example:
|
|
17
|
+
* ```cpp (cpp-adapter.cpp)
|
|
18
|
+
* JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) {
|
|
19
|
+
* return margelo::nitro::nitroark::initialize(vm);
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
int initialize(JavaVM* vm);
|
|
24
|
+
|
|
25
|
+
} // namespace margelo::nitro::nitroark
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroArkOnLoad.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.nitroark
|
|
9
|
+
|
|
10
|
+
import android.util.Log
|
|
11
|
+
|
|
12
|
+
internal class NitroArkOnLoad {
|
|
13
|
+
companion object {
|
|
14
|
+
private const val TAG = "NitroArkOnLoad"
|
|
15
|
+
private var didLoad = false
|
|
16
|
+
/**
|
|
17
|
+
* Initializes the native part of "NitroArk".
|
|
18
|
+
* This method is idempotent and can be called more than once.
|
|
19
|
+
*/
|
|
20
|
+
@JvmStatic
|
|
21
|
+
fun initializeNative() {
|
|
22
|
+
if (didLoad) return
|
|
23
|
+
try {
|
|
24
|
+
Log.i(TAG, "Loading NitroArk C++ library...")
|
|
25
|
+
System.loadLibrary("NitroArk")
|
|
26
|
+
Log.i(TAG, "Successfully loaded NitroArk C++ library!")
|
|
27
|
+
didLoad = true
|
|
28
|
+
} catch (e: Error) {
|
|
29
|
+
Log.e(TAG, "Failed to load NitroArk C++ library! Is it properly installed and linked? " +
|
|
30
|
+
"Is the name correct? (see `CMakeLists.txt`, at `add_library(...)`)", e)
|
|
31
|
+
throw e
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
#
|
|
2
|
+
# NitroArk+autolinking.rb
|
|
3
|
+
# This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
# https://github.com/mrousavy/nitro
|
|
5
|
+
# Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
#
|
|
7
|
+
|
|
8
|
+
# This is a Ruby script that adds all files generated by Nitrogen
|
|
9
|
+
# to the given podspec.
|
|
10
|
+
#
|
|
11
|
+
# To use it, add this to your .podspec:
|
|
12
|
+
# ```ruby
|
|
13
|
+
# Pod::Spec.new do |spec|
|
|
14
|
+
# # ...
|
|
15
|
+
#
|
|
16
|
+
# # Add all files generated by Nitrogen
|
|
17
|
+
# load 'nitrogen/generated/ios/NitroArk+autolinking.rb'
|
|
18
|
+
# add_nitrogen_files(spec)
|
|
19
|
+
# end
|
|
20
|
+
# ```
|
|
21
|
+
|
|
22
|
+
def add_nitrogen_files(spec)
|
|
23
|
+
Pod::UI.puts "[NitroModules] 🔥 NitroArk is boosted by nitro!"
|
|
24
|
+
|
|
25
|
+
spec.dependency "NitroModules"
|
|
26
|
+
|
|
27
|
+
current_source_files = Array(spec.attributes_hash['source_files'])
|
|
28
|
+
spec.source_files = current_source_files + [
|
|
29
|
+
# Generated cross-platform specs
|
|
30
|
+
"nitrogen/generated/shared/**/*.{h,hpp,c,cpp,swift}",
|
|
31
|
+
# Generated bridges for the cross-platform specs
|
|
32
|
+
"nitrogen/generated/ios/**/*.{h,hpp,c,cpp,mm,swift}",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
current_public_header_files = Array(spec.attributes_hash['public_header_files'])
|
|
36
|
+
spec.public_header_files = current_public_header_files + [
|
|
37
|
+
# Generated specs
|
|
38
|
+
"nitrogen/generated/shared/**/*.{h,hpp}",
|
|
39
|
+
# Swift to C++ bridging helpers
|
|
40
|
+
"nitrogen/generated/ios/NitroArk-Swift-Cxx-Bridge.hpp"
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
current_private_header_files = Array(spec.attributes_hash['private_header_files'])
|
|
44
|
+
spec.private_header_files = current_private_header_files + [
|
|
45
|
+
# iOS specific specs
|
|
46
|
+
"nitrogen/generated/ios/c++/**/*.{h,hpp}",
|
|
47
|
+
# Views are framework-specific and should be private
|
|
48
|
+
"nitrogen/generated/shared/**/views/**/*"
|
|
49
|
+
]
|
|
50
|
+
|
|
51
|
+
current_pod_target_xcconfig = spec.attributes_hash['pod_target_xcconfig'] || {}
|
|
52
|
+
spec.pod_target_xcconfig = current_pod_target_xcconfig.merge({
|
|
53
|
+
# Use C++ 20
|
|
54
|
+
"CLANG_CXX_LANGUAGE_STANDARD" => "c++20",
|
|
55
|
+
# Enables C++ <-> Swift interop (by default it's only C)
|
|
56
|
+
"SWIFT_OBJC_INTEROP_MODE" => "objcxx",
|
|
57
|
+
# Enables stricter modular headers
|
|
58
|
+
"DEFINES_MODULE" => "YES",
|
|
59
|
+
})
|
|
60
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroArk-Swift-Cxx-Bridge.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "NitroArk-Swift-Cxx-Bridge.hpp"
|
|
9
|
+
|
|
10
|
+
// Include C++ implementation defined types
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
namespace margelo::nitro::nitroark::bridge::swift {
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
} // namespace margelo::nitro::nitroark::bridge::swift
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroArk-Swift-Cxx-Bridge.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
// Forward declarations of C++ defined types
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
// Forward declarations of Swift defined types
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
// Include C++ defined types
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Contains specialized versions of C++ templated types so they can be accessed from Swift,
|
|
21
|
+
* as well as helper functions to interact with those C++ types from Swift.
|
|
22
|
+
*/
|
|
23
|
+
namespace margelo::nitro::nitroark::bridge::swift {
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
} // namespace margelo::nitro::nitroark::bridge::swift
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroArk-Swift-Cxx-Umbrella.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
// Forward declarations of C++ defined types
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
// Include C++ defined types
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
// C++ helpers for Swift
|
|
17
|
+
#include "NitroArk-Swift-Cxx-Bridge.hpp"
|
|
18
|
+
|
|
19
|
+
// Common C++ types used in Swift
|
|
20
|
+
#include <NitroModules/ArrayBufferHolder.hpp>
|
|
21
|
+
#include <NitroModules/AnyMapHolder.hpp>
|
|
22
|
+
#include <NitroModules/RuntimeError.hpp>
|
|
23
|
+
#include <NitroModules/DateToChronoDate.hpp>
|
|
24
|
+
|
|
25
|
+
// Forward declarations of Swift defined types
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
// Include Swift defined types
|
|
29
|
+
#if __has_include("NitroArk-Swift.h")
|
|
30
|
+
// This header is generated by Xcode/Swift on every app build.
|
|
31
|
+
// If it cannot be found, make sure the Swift module's name (= podspec name) is actually "NitroArk".
|
|
32
|
+
#include "NitroArk-Swift.h"
|
|
33
|
+
// Same as above, but used when building with frameworks (`use_frameworks`)
|
|
34
|
+
#elif __has_include(<NitroArk/NitroArk-Swift.h>)
|
|
35
|
+
#include <NitroArk/NitroArk-Swift.h>
|
|
36
|
+
#else
|
|
37
|
+
#error NitroArk's autogenerated Swift header cannot be found! Make sure the Swift module's name (= podspec name) is actually "NitroArk", and try building the app first.
|
|
38
|
+
#endif
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroArkAutolinking.mm
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#import <Foundation/Foundation.h>
|
|
9
|
+
#import <NitroModules/HybridObjectRegistry.hpp>
|
|
10
|
+
|
|
11
|
+
#import <type_traits>
|
|
12
|
+
|
|
13
|
+
#include "NitroArk.hpp"
|
|
14
|
+
|
|
15
|
+
@interface NitroArkAutolinking : NSObject
|
|
16
|
+
@end
|
|
17
|
+
|
|
18
|
+
@implementation NitroArkAutolinking
|
|
19
|
+
|
|
20
|
+
+ (void) load {
|
|
21
|
+
using namespace margelo::nitro;
|
|
22
|
+
using namespace margelo::nitro::nitroark;
|
|
23
|
+
|
|
24
|
+
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
25
|
+
"NitroArk",
|
|
26
|
+
[]() -> std::shared_ptr<HybridObject> {
|
|
27
|
+
static_assert(std::is_default_constructible_v<NitroArk>,
|
|
28
|
+
"The HybridObject \"NitroArk\" is not default-constructible! "
|
|
29
|
+
"Create a public constructor that takes zero arguments to be able to autolink this HybridObject.");
|
|
30
|
+
return std::make_shared<NitroArk>();
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroArkAutolinking.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
public final class NitroArkAutolinking {
|
|
9
|
+
public typealias bridge = margelo.nitro.nitroark.bridge.swift
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// BarkBalance.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
namespace margelo::nitro::nitroark {
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* A struct which can be represented as a JavaScript object (BarkBalance).
|
|
29
|
+
*/
|
|
30
|
+
struct BarkBalance {
|
|
31
|
+
public:
|
|
32
|
+
double onchain SWIFT_PRIVATE;
|
|
33
|
+
double offchain SWIFT_PRIVATE;
|
|
34
|
+
double pending_exit SWIFT_PRIVATE;
|
|
35
|
+
|
|
36
|
+
public:
|
|
37
|
+
BarkBalance() = default;
|
|
38
|
+
explicit BarkBalance(double onchain, double offchain, double pending_exit): onchain(onchain), offchain(offchain), pending_exit(pending_exit) {}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
} // namespace margelo::nitro::nitroark
|
|
42
|
+
|
|
43
|
+
namespace margelo::nitro {
|
|
44
|
+
|
|
45
|
+
using namespace margelo::nitro::nitroark;
|
|
46
|
+
|
|
47
|
+
// C++ BarkBalance <> JS BarkBalance (object)
|
|
48
|
+
template <>
|
|
49
|
+
struct JSIConverter<BarkBalance> final {
|
|
50
|
+
static inline BarkBalance fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
51
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
52
|
+
return BarkBalance(
|
|
53
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "onchain")),
|
|
54
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "offchain")),
|
|
55
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "pending_exit"))
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const BarkBalance& arg) {
|
|
59
|
+
jsi::Object obj(runtime);
|
|
60
|
+
obj.setProperty(runtime, "onchain", JSIConverter<double>::toJSI(runtime, arg.onchain));
|
|
61
|
+
obj.setProperty(runtime, "offchain", JSIConverter<double>::toJSI(runtime, arg.offchain));
|
|
62
|
+
obj.setProperty(runtime, "pending_exit", JSIConverter<double>::toJSI(runtime, arg.pending_exit));
|
|
63
|
+
return obj;
|
|
64
|
+
}
|
|
65
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
66
|
+
if (!value.isObject()) {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
jsi::Object obj = value.getObject(runtime);
|
|
70
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "onchain"))) return false;
|
|
71
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "offchain"))) return false;
|
|
72
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "pending_exit"))) return false;
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
} // namespace margelo::nitro
|