@keystonehq/react-native-keystone-wallet-core 0.1.0-alpha.5 → 0.1.0
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/android/build.gradle +10 -6
- package/android/libs/KeystoneWalletCoreWrapper-release.aar +0 -0
- package/android/src/main/java/com/reactnativekeystonewalletcore/KeystoneWalletCoreModule.kt +52 -2
- package/ios/Frameworks/KeystoneWalletCoreFFI.xcframework/ios-arm64/KeystoneWalletCoreFFI.framework/Headers/keystone_wallet_coreFFI.h +11 -12
- package/ios/Frameworks/KeystoneWalletCoreFFI.xcframework/ios-arm64/KeystoneWalletCoreFFI.framework/KeystoneWalletCoreFFI +0 -0
- package/ios/Frameworks/KeystoneWalletCoreFFI.xcframework/ios-arm64-simulator/KeystoneWalletCoreFFI.framework/Headers/keystone_wallet_coreFFI.h +11 -12
- package/ios/Frameworks/KeystoneWalletCoreFFI.xcframework/ios-arm64-simulator/KeystoneWalletCoreFFI.framework/KeystoneWalletCoreFFI +0 -0
- package/ios/keystone_wallet_core.swift +411 -512
- package/package.json +1 -1
package/android/build.gradle
CHANGED
|
@@ -4,8 +4,8 @@ buildscript {
|
|
|
4
4
|
mavenCentral()
|
|
5
5
|
}
|
|
6
6
|
dependencies {
|
|
7
|
-
classpath "com.android.tools.build:gradle:
|
|
8
|
-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.
|
|
7
|
+
classpath "com.android.tools.build:gradle:8.11.0"
|
|
8
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.24"
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
|
|
@@ -13,12 +13,12 @@ apply plugin: "com.android.library"
|
|
|
13
13
|
apply plugin: "kotlin-android"
|
|
14
14
|
|
|
15
15
|
android {
|
|
16
|
-
compileSdkVersion
|
|
16
|
+
compileSdkVersion 34
|
|
17
17
|
namespace "com.reactnativekeystonewalletcore"
|
|
18
18
|
|
|
19
19
|
defaultConfig {
|
|
20
|
-
minSdkVersion
|
|
21
|
-
targetSdkVersion
|
|
20
|
+
minSdkVersion 24
|
|
21
|
+
targetSdkVersion 34
|
|
22
22
|
versionCode 1
|
|
23
23
|
versionName "1.0"
|
|
24
24
|
}
|
|
@@ -45,5 +45,9 @@ repositories {
|
|
|
45
45
|
dependencies {
|
|
46
46
|
implementation "com.facebook.react:react-native:+"
|
|
47
47
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.8.0"
|
|
48
|
-
|
|
48
|
+
|
|
49
|
+
// Dependencies from KeystoneWalletCoreWrapper AAR
|
|
50
|
+
implementation files("libs/KeystoneWalletCoreWrapper-release.aar")
|
|
51
|
+
implementation "net.java.dev.jna:jna:5.13.0@aar"
|
|
52
|
+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4"
|
|
49
53
|
}
|
|
Binary file
|
|
@@ -9,6 +9,8 @@ import com.facebook.react.bridge.ReadableMap
|
|
|
9
9
|
import uniffi.keystone_wallet_core.TransparentInput
|
|
10
10
|
import uniffi.keystone_wallet_core.TransparentOutput
|
|
11
11
|
import uniffi.keystone_wallet_core.createTransparentPczt
|
|
12
|
+
import uniffi.keystone_wallet_core.createTransparentPcztForSwapkit
|
|
13
|
+
import uniffi.keystone_wallet_core.extractTransactionInputsAda
|
|
12
14
|
import uniffi.keystone_wallet_core.finalizeThenExtractPcztTransaction;
|
|
13
15
|
import uniffi.keystone_wallet_core.derivePubkeyByPathAda
|
|
14
16
|
import uniffi.keystone_wallet_core.deriveAddressByPathAda
|
|
@@ -19,6 +21,7 @@ import uniffi.keystone_wallet_core.CardanoTxInput
|
|
|
19
21
|
import uniffi.keystone_wallet_core.CardanoTxOutput
|
|
20
22
|
import uniffi.keystone_wallet_core.composeTransactionAda
|
|
21
23
|
import com.facebook.react.bridge.WritableNativeMap
|
|
24
|
+
import com.facebook.react.bridge.WritableNativeArray
|
|
22
25
|
|
|
23
26
|
import uniffi.keystone_wallet_core.assembleTransactionAda
|
|
24
27
|
|
|
@@ -65,15 +68,28 @@ class KeystoneWalletCoreModule(reactContext: ReactApplicationContext) : ReactCon
|
|
|
65
68
|
}
|
|
66
69
|
|
|
67
70
|
@ReactMethod
|
|
68
|
-
fun finalizeThenExtractPcztTransaction(pczt: String) {
|
|
71
|
+
fun finalizeThenExtractPcztTransaction(pczt: String, promise: Promise) {
|
|
69
72
|
try {
|
|
70
73
|
val result = finalizeThenExtractPcztTransaction(pczt)
|
|
71
|
-
|
|
74
|
+
val resultMap = WritableNativeMap()
|
|
75
|
+
resultMap.putString("txId", result.txId)
|
|
76
|
+
resultMap.putString("txHex", result.txHex)
|
|
77
|
+
promise.resolve(resultMap)
|
|
72
78
|
} catch (e: Exception) {
|
|
73
79
|
promise.reject("finalizeThenExtractPcztTransaction ERROR", e.message, e)
|
|
74
80
|
}
|
|
75
81
|
}
|
|
76
82
|
|
|
83
|
+
@ReactMethod
|
|
84
|
+
fun createTransparentPcztForSwapkit(pcztHex: String, blockHeight: Double, pubkeyHex: String, fingerprintHex: String, pathStr: String, promise: Promise) {
|
|
85
|
+
try {
|
|
86
|
+
val result = createTransparentPcztForSwapkit(pcztHex, blockHeight.toUInt(), pubkeyHex, fingerprintHex, pathStr)
|
|
87
|
+
promise.resolve(result)
|
|
88
|
+
} catch (e: Exception) {
|
|
89
|
+
promise.reject("CREATE_PCZT_SWAPKIT_ERROR", e.message, e)
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
77
93
|
private fun getCardanoNetwork(network: String): CardanoNetwork {
|
|
78
94
|
return when (network) {
|
|
79
95
|
"Mainnet" -> CardanoNetwork.MAINNET
|
|
@@ -186,4 +202,38 @@ class KeystoneWalletCoreModule(reactContext: ReactApplicationContext) : ReactCon
|
|
|
186
202
|
promise.reject("CARDANO_ERROR", e.message, e)
|
|
187
203
|
}
|
|
188
204
|
}
|
|
205
|
+
|
|
206
|
+
@ReactMethod
|
|
207
|
+
fun extractTransactionInputsAda(txHex: String, promise: Promise) {
|
|
208
|
+
try {
|
|
209
|
+
val result = extractTransactionInputsAda(txHex)
|
|
210
|
+
val map = WritableNativeMap()
|
|
211
|
+
|
|
212
|
+
val inputsArray = WritableNativeArray()
|
|
213
|
+
for (input in result.inputs) {
|
|
214
|
+
val inputMap = WritableNativeMap()
|
|
215
|
+
inputMap.putString("txHash", input.txHash)
|
|
216
|
+
inputMap.putDouble("txIndex", input.txIndex.toDouble())
|
|
217
|
+
inputsArray.pushMap(inputMap)
|
|
218
|
+
}
|
|
219
|
+
map.putArray("inputs", inputsArray)
|
|
220
|
+
|
|
221
|
+
val outputsArray = WritableNativeArray()
|
|
222
|
+
for (output in result.outputs) {
|
|
223
|
+
val outputMap = WritableNativeMap()
|
|
224
|
+
outputMap.putString("address", output.address)
|
|
225
|
+
outputMap.putDouble("amount", output.amount.toDouble())
|
|
226
|
+
outputMap.putBoolean("isChange", output.isChange)
|
|
227
|
+
outputsArray.pushMap(outputMap)
|
|
228
|
+
}
|
|
229
|
+
map.putArray("outputs", outputsArray)
|
|
230
|
+
|
|
231
|
+
map.putDouble("fee", result.fee.toDouble())
|
|
232
|
+
map.putDouble("ttl", result.ttl.toDouble())
|
|
233
|
+
|
|
234
|
+
promise.resolve(map)
|
|
235
|
+
} catch (e: Exception) {
|
|
236
|
+
promise.reject("CARDANO_ERROR", e.message, e)
|
|
237
|
+
}
|
|
238
|
+
}
|
|
189
239
|
}
|
|
@@ -311,15 +311,14 @@ RustBuffer uniffi_keystone_wallet_core_fn_func_derive_pubkey_by_path_ada(RustBuf
|
|
|
311
311
|
RustBuffer uniffi_keystone_wallet_core_fn_func_derive_stake_address_ada(RustBuffer account_xpub_hex, RustBuffer network, RustCallStatus *_Nonnull out_status
|
|
312
312
|
);
|
|
313
313
|
#endif
|
|
314
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_EXTRACT_TRANSACTION_INPUTS_ADA
|
|
315
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_EXTRACT_TRANSACTION_INPUTS_ADA
|
|
316
|
+
RustBuffer uniffi_keystone_wallet_core_fn_func_extract_transaction_inputs_ada(RustBuffer tx_hex, RustCallStatus *_Nonnull out_status
|
|
317
|
+
);
|
|
318
|
+
#endif
|
|
314
319
|
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_FINALIZE_THEN_EXTRACT_PCZT_TRANSACTION
|
|
315
320
|
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_FINALIZE_THEN_EXTRACT_PCZT_TRANSACTION
|
|
316
321
|
RustBuffer uniffi_keystone_wallet_core_fn_func_finalize_then_extract_pczt_transaction(RustBuffer pczt_hex, RustCallStatus *_Nonnull out_status
|
|
317
|
-
);
|
|
318
|
-
#endif
|
|
319
|
-
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_HELLO
|
|
320
|
-
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_HELLO
|
|
321
|
-
void uniffi_keystone_wallet_core_fn_func_hello(RustCallStatus *_Nonnull out_status
|
|
322
|
-
|
|
323
322
|
);
|
|
324
323
|
#endif
|
|
325
324
|
#ifndef UNIFFI_FFIDEF_FFI_KEYSTONE_WALLET_CORE_RUSTBUFFER_ALLOC
|
|
@@ -656,15 +655,15 @@ uint16_t uniffi_keystone_wallet_core_checksum_func_derive_stake_address_ada(void
|
|
|
656
655
|
|
|
657
656
|
);
|
|
658
657
|
#endif
|
|
659
|
-
#ifndef
|
|
660
|
-
#define
|
|
661
|
-
uint16_t
|
|
658
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_EXTRACT_TRANSACTION_INPUTS_ADA
|
|
659
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_EXTRACT_TRANSACTION_INPUTS_ADA
|
|
660
|
+
uint16_t uniffi_keystone_wallet_core_checksum_func_extract_transaction_inputs_ada(void
|
|
662
661
|
|
|
663
662
|
);
|
|
664
663
|
#endif
|
|
665
|
-
#ifndef
|
|
666
|
-
#define
|
|
667
|
-
uint16_t
|
|
664
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_FINALIZE_THEN_EXTRACT_PCZT_TRANSACTION
|
|
665
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_FINALIZE_THEN_EXTRACT_PCZT_TRANSACTION
|
|
666
|
+
uint16_t uniffi_keystone_wallet_core_checksum_func_finalize_then_extract_pczt_transaction(void
|
|
668
667
|
|
|
669
668
|
);
|
|
670
669
|
#endif
|
|
Binary file
|
|
@@ -311,15 +311,14 @@ RustBuffer uniffi_keystone_wallet_core_fn_func_derive_pubkey_by_path_ada(RustBuf
|
|
|
311
311
|
RustBuffer uniffi_keystone_wallet_core_fn_func_derive_stake_address_ada(RustBuffer account_xpub_hex, RustBuffer network, RustCallStatus *_Nonnull out_status
|
|
312
312
|
);
|
|
313
313
|
#endif
|
|
314
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_EXTRACT_TRANSACTION_INPUTS_ADA
|
|
315
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_EXTRACT_TRANSACTION_INPUTS_ADA
|
|
316
|
+
RustBuffer uniffi_keystone_wallet_core_fn_func_extract_transaction_inputs_ada(RustBuffer tx_hex, RustCallStatus *_Nonnull out_status
|
|
317
|
+
);
|
|
318
|
+
#endif
|
|
314
319
|
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_FINALIZE_THEN_EXTRACT_PCZT_TRANSACTION
|
|
315
320
|
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_FINALIZE_THEN_EXTRACT_PCZT_TRANSACTION
|
|
316
321
|
RustBuffer uniffi_keystone_wallet_core_fn_func_finalize_then_extract_pczt_transaction(RustBuffer pczt_hex, RustCallStatus *_Nonnull out_status
|
|
317
|
-
);
|
|
318
|
-
#endif
|
|
319
|
-
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_HELLO
|
|
320
|
-
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_HELLO
|
|
321
|
-
void uniffi_keystone_wallet_core_fn_func_hello(RustCallStatus *_Nonnull out_status
|
|
322
|
-
|
|
323
322
|
);
|
|
324
323
|
#endif
|
|
325
324
|
#ifndef UNIFFI_FFIDEF_FFI_KEYSTONE_WALLET_CORE_RUSTBUFFER_ALLOC
|
|
@@ -656,15 +655,15 @@ uint16_t uniffi_keystone_wallet_core_checksum_func_derive_stake_address_ada(void
|
|
|
656
655
|
|
|
657
656
|
);
|
|
658
657
|
#endif
|
|
659
|
-
#ifndef
|
|
660
|
-
#define
|
|
661
|
-
uint16_t
|
|
658
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_EXTRACT_TRANSACTION_INPUTS_ADA
|
|
659
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_EXTRACT_TRANSACTION_INPUTS_ADA
|
|
660
|
+
uint16_t uniffi_keystone_wallet_core_checksum_func_extract_transaction_inputs_ada(void
|
|
662
661
|
|
|
663
662
|
);
|
|
664
663
|
#endif
|
|
665
|
-
#ifndef
|
|
666
|
-
#define
|
|
667
|
-
uint16_t
|
|
664
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_FINALIZE_THEN_EXTRACT_PCZT_TRANSACTION
|
|
665
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_FINALIZE_THEN_EXTRACT_PCZT_TRANSACTION
|
|
666
|
+
uint16_t uniffi_keystone_wallet_core_checksum_func_finalize_then_extract_pczt_transaction(void
|
|
668
667
|
|
|
669
668
|
);
|
|
670
669
|
#endif
|