@keystonehq/react-native-keystone-wallet-core 0.1.0-alpha.0 → 0.1.0-alpha.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.
- package/android/src/main/java/com/reactnativekeystonewalletcore/KeystoneWalletCoreModule.kt +60 -0
- package/ios/Frameworks/KeystoneWalletCoreFFI.xcframework/Info.plist +4 -4
- package/ios/Frameworks/KeystoneWalletCoreFFI.xcframework/ios-arm64/KeystoneWalletCoreFFI.framework/Headers/keystone_wallet_coreFFI.h +56 -0
- 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 +56 -0
- package/ios/Frameworks/KeystoneWalletCoreFFI.xcframework/ios-arm64-simulator/KeystoneWalletCoreFFI.framework/KeystoneWalletCoreFFI +0 -0
- package/ios/KeystoneWalletCoreModule.m +22 -0
- package/ios/KeystoneWalletCoreModule.swift +57 -0
- package/ios/keystone_wallet_core.swift +263 -0
- package/lib/commonjs/index.js +22 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/index.js +17 -0
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/index.d.ts +12 -0
- package/lib/typescript/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/index.tsx +40 -0
|
@@ -9,6 +9,12 @@ 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.derivePubkeyByPathAda
|
|
13
|
+
import uniffi.keystone_wallet_core.deriveAddressByPathAda
|
|
14
|
+
import uniffi.keystone_wallet_core.deriveEnterpriseAddressByPathAda
|
|
15
|
+
import uniffi.keystone_wallet_core.deriveStakeAddressAda
|
|
16
|
+
import uniffi.keystone_wallet_core.CardanoNetwork
|
|
17
|
+
import com.facebook.react.bridge.WritableNativeMap
|
|
12
18
|
|
|
13
19
|
class KeystoneWalletCoreModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(reactContext) {
|
|
14
20
|
|
|
@@ -51,4 +57,58 @@ class KeystoneWalletCoreModule(reactContext: ReactApplicationContext) : ReactCon
|
|
|
51
57
|
promise.reject("CREATE_PCZT_ERROR", e.message, e)
|
|
52
58
|
}
|
|
53
59
|
}
|
|
60
|
+
|
|
61
|
+
private fun getCardanoNetwork(network: String): CardanoNetwork {
|
|
62
|
+
return when (network) {
|
|
63
|
+
"Mainnet" -> CardanoNetwork.MAINNET
|
|
64
|
+
"Testnet" -> CardanoNetwork.TESTNET
|
|
65
|
+
else -> throw IllegalArgumentException("Invalid Cardano network: $network")
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
@ReactMethod
|
|
70
|
+
fun derivePubkeyByPathAda(accountXpubHex: String, path: String, promise: Promise) {
|
|
71
|
+
try {
|
|
72
|
+
val result = derivePubkeyByPathAda(accountXpubHex, path)
|
|
73
|
+
val map = WritableNativeMap()
|
|
74
|
+
map.putString("paymentPubkeyHex", result.paymentPubkeyHex)
|
|
75
|
+
map.putString("stakePubkeyHex", result.stakePubkeyHex)
|
|
76
|
+
promise.resolve(map)
|
|
77
|
+
} catch (e: Exception) {
|
|
78
|
+
promise.reject("CARDANO_ERROR", e.message, e)
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
@ReactMethod
|
|
83
|
+
fun deriveAddressByPathAda(accountXpubHex: String, path: String, network: String, promise: Promise) {
|
|
84
|
+
try {
|
|
85
|
+
val adaNetwork = getCardanoNetwork(network)
|
|
86
|
+
val result = deriveAddressByPathAda(accountXpubHex, path, adaNetwork)
|
|
87
|
+
promise.resolve(result)
|
|
88
|
+
} catch (e: Exception) {
|
|
89
|
+
promise.reject("CARDANO_ERROR", e.message, e)
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
@ReactMethod
|
|
94
|
+
fun deriveEnterpriseAddressByPathAda(accountXpubHex: String, path: String, network: String, promise: Promise) {
|
|
95
|
+
try {
|
|
96
|
+
val adaNetwork = getCardanoNetwork(network)
|
|
97
|
+
val result = deriveEnterpriseAddressByPathAda(accountXpubHex, path, adaNetwork)
|
|
98
|
+
promise.resolve(result)
|
|
99
|
+
} catch (e: Exception) {
|
|
100
|
+
promise.reject("CARDANO_ERROR", e.message, e)
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
@ReactMethod
|
|
105
|
+
fun deriveStakeAddressAda(accountXpubHex: String, network: String, promise: Promise) {
|
|
106
|
+
try {
|
|
107
|
+
val adaNetwork = getCardanoNetwork(network)
|
|
108
|
+
val result = deriveStakeAddressAda(accountXpubHex, adaNetwork)
|
|
109
|
+
promise.resolve(result)
|
|
110
|
+
} catch (e: Exception) {
|
|
111
|
+
promise.reject("CARDANO_ERROR", e.message, e)
|
|
112
|
+
}
|
|
113
|
+
}
|
|
54
114
|
}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<key>BinaryPath</key>
|
|
9
9
|
<string>KeystoneWalletCoreFFI.framework/KeystoneWalletCoreFFI</string>
|
|
10
10
|
<key>LibraryIdentifier</key>
|
|
11
|
-
<string>ios-arm64</string>
|
|
11
|
+
<string>ios-arm64-simulator</string>
|
|
12
12
|
<key>LibraryPath</key>
|
|
13
13
|
<string>KeystoneWalletCoreFFI.framework</string>
|
|
14
14
|
<key>SupportedArchitectures</key>
|
|
@@ -17,12 +17,14 @@
|
|
|
17
17
|
</array>
|
|
18
18
|
<key>SupportedPlatform</key>
|
|
19
19
|
<string>ios</string>
|
|
20
|
+
<key>SupportedPlatformVariant</key>
|
|
21
|
+
<string>simulator</string>
|
|
20
22
|
</dict>
|
|
21
23
|
<dict>
|
|
22
24
|
<key>BinaryPath</key>
|
|
23
25
|
<string>KeystoneWalletCoreFFI.framework/KeystoneWalletCoreFFI</string>
|
|
24
26
|
<key>LibraryIdentifier</key>
|
|
25
|
-
<string>ios-arm64
|
|
27
|
+
<string>ios-arm64</string>
|
|
26
28
|
<key>LibraryPath</key>
|
|
27
29
|
<string>KeystoneWalletCoreFFI.framework</string>
|
|
28
30
|
<key>SupportedArchitectures</key>
|
|
@@ -31,8 +33,6 @@
|
|
|
31
33
|
</array>
|
|
32
34
|
<key>SupportedPlatform</key>
|
|
33
35
|
<string>ios</string>
|
|
34
|
-
<key>SupportedPlatformVariant</key>
|
|
35
|
-
<string>simulator</string>
|
|
36
36
|
</dict>
|
|
37
37
|
</array>
|
|
38
38
|
<key>CFBundlePackageType</key>
|
|
@@ -276,6 +276,26 @@ void*_Nonnull uniffi_keystone_wallet_core_fn_func_create_pczt(uint32_t consensus
|
|
|
276
276
|
RustBuffer uniffi_keystone_wallet_core_fn_func_create_transparent_pczt(RustBuffer inputs, RustBuffer outputs, uint32_t block_height, RustCallStatus *_Nonnull out_status
|
|
277
277
|
);
|
|
278
278
|
#endif
|
|
279
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_DERIVE_ADDRESS_BY_PATH_ADA
|
|
280
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_DERIVE_ADDRESS_BY_PATH_ADA
|
|
281
|
+
RustBuffer uniffi_keystone_wallet_core_fn_func_derive_address_by_path_ada(RustBuffer account_xpub_hex, RustBuffer path, RustBuffer network, RustCallStatus *_Nonnull out_status
|
|
282
|
+
);
|
|
283
|
+
#endif
|
|
284
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_DERIVE_ENTERPRISE_ADDRESS_BY_PATH_ADA
|
|
285
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_DERIVE_ENTERPRISE_ADDRESS_BY_PATH_ADA
|
|
286
|
+
RustBuffer uniffi_keystone_wallet_core_fn_func_derive_enterprise_address_by_path_ada(RustBuffer account_xpub_hex, RustBuffer path, RustBuffer network, RustCallStatus *_Nonnull out_status
|
|
287
|
+
);
|
|
288
|
+
#endif
|
|
289
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_DERIVE_PUBKEY_BY_PATH_ADA
|
|
290
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_DERIVE_PUBKEY_BY_PATH_ADA
|
|
291
|
+
RustBuffer uniffi_keystone_wallet_core_fn_func_derive_pubkey_by_path_ada(RustBuffer account_xpub_hex, RustBuffer path, RustCallStatus *_Nonnull out_status
|
|
292
|
+
);
|
|
293
|
+
#endif
|
|
294
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_DERIVE_STAKE_ADDRESS_ADA
|
|
295
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_DERIVE_STAKE_ADDRESS_ADA
|
|
296
|
+
RustBuffer uniffi_keystone_wallet_core_fn_func_derive_stake_address_ada(RustBuffer account_xpub_hex, RustBuffer network, RustCallStatus *_Nonnull out_status
|
|
297
|
+
);
|
|
298
|
+
#endif
|
|
279
299
|
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_EXTRACT_AND_FINALIZE_PCZT
|
|
280
300
|
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_EXTRACT_AND_FINALIZE_PCZT
|
|
281
301
|
RustBuffer uniffi_keystone_wallet_core_fn_func_extract_and_finalize_pczt(RustBuffer pczt_hex, uint32_t expiry_height, RustBuffer private_key_hex, RustCallStatus *_Nonnull out_status
|
|
@@ -284,6 +304,12 @@ RustBuffer uniffi_keystone_wallet_core_fn_func_extract_and_finalize_pczt(RustBuf
|
|
|
284
304
|
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_EXTRACT_PCZT_TRANSACTION
|
|
285
305
|
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_EXTRACT_PCZT_TRANSACTION
|
|
286
306
|
RustBuffer uniffi_keystone_wallet_core_fn_func_extract_pczt_transaction(RustBuffer pczt_hex, RustCallStatus *_Nonnull out_status
|
|
307
|
+
);
|
|
308
|
+
#endif
|
|
309
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_HELLO
|
|
310
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_HELLO
|
|
311
|
+
void uniffi_keystone_wallet_core_fn_func_hello(RustCallStatus *_Nonnull out_status
|
|
312
|
+
|
|
287
313
|
);
|
|
288
314
|
#endif
|
|
289
315
|
#ifndef UNIFFI_FFIDEF_FFI_KEYSTONE_WALLET_CORE_RUSTBUFFER_ALLOC
|
|
@@ -576,6 +602,30 @@ uint16_t uniffi_keystone_wallet_core_checksum_func_create_pczt(void
|
|
|
576
602
|
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_CREATE_TRANSPARENT_PCZT
|
|
577
603
|
uint16_t uniffi_keystone_wallet_core_checksum_func_create_transparent_pczt(void
|
|
578
604
|
|
|
605
|
+
);
|
|
606
|
+
#endif
|
|
607
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_DERIVE_ADDRESS_BY_PATH_ADA
|
|
608
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_DERIVE_ADDRESS_BY_PATH_ADA
|
|
609
|
+
uint16_t uniffi_keystone_wallet_core_checksum_func_derive_address_by_path_ada(void
|
|
610
|
+
|
|
611
|
+
);
|
|
612
|
+
#endif
|
|
613
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_DERIVE_ENTERPRISE_ADDRESS_BY_PATH_ADA
|
|
614
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_DERIVE_ENTERPRISE_ADDRESS_BY_PATH_ADA
|
|
615
|
+
uint16_t uniffi_keystone_wallet_core_checksum_func_derive_enterprise_address_by_path_ada(void
|
|
616
|
+
|
|
617
|
+
);
|
|
618
|
+
#endif
|
|
619
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_DERIVE_PUBKEY_BY_PATH_ADA
|
|
620
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_DERIVE_PUBKEY_BY_PATH_ADA
|
|
621
|
+
uint16_t uniffi_keystone_wallet_core_checksum_func_derive_pubkey_by_path_ada(void
|
|
622
|
+
|
|
623
|
+
);
|
|
624
|
+
#endif
|
|
625
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_DERIVE_STAKE_ADDRESS_ADA
|
|
626
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_DERIVE_STAKE_ADDRESS_ADA
|
|
627
|
+
uint16_t uniffi_keystone_wallet_core_checksum_func_derive_stake_address_ada(void
|
|
628
|
+
|
|
579
629
|
);
|
|
580
630
|
#endif
|
|
581
631
|
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_EXTRACT_AND_FINALIZE_PCZT
|
|
@@ -588,6 +638,12 @@ uint16_t uniffi_keystone_wallet_core_checksum_func_extract_and_finalize_pczt(voi
|
|
|
588
638
|
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_EXTRACT_PCZT_TRANSACTION
|
|
589
639
|
uint16_t uniffi_keystone_wallet_core_checksum_func_extract_pczt_transaction(void
|
|
590
640
|
|
|
641
|
+
);
|
|
642
|
+
#endif
|
|
643
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_HELLO
|
|
644
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_HELLO
|
|
645
|
+
uint16_t uniffi_keystone_wallet_core_checksum_func_hello(void
|
|
646
|
+
|
|
591
647
|
);
|
|
592
648
|
#endif
|
|
593
649
|
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_METHOD_PCZT_SERIALIZE
|
|
Binary file
|
|
@@ -276,6 +276,26 @@ void*_Nonnull uniffi_keystone_wallet_core_fn_func_create_pczt(uint32_t consensus
|
|
|
276
276
|
RustBuffer uniffi_keystone_wallet_core_fn_func_create_transparent_pczt(RustBuffer inputs, RustBuffer outputs, uint32_t block_height, RustCallStatus *_Nonnull out_status
|
|
277
277
|
);
|
|
278
278
|
#endif
|
|
279
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_DERIVE_ADDRESS_BY_PATH_ADA
|
|
280
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_DERIVE_ADDRESS_BY_PATH_ADA
|
|
281
|
+
RustBuffer uniffi_keystone_wallet_core_fn_func_derive_address_by_path_ada(RustBuffer account_xpub_hex, RustBuffer path, RustBuffer network, RustCallStatus *_Nonnull out_status
|
|
282
|
+
);
|
|
283
|
+
#endif
|
|
284
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_DERIVE_ENTERPRISE_ADDRESS_BY_PATH_ADA
|
|
285
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_DERIVE_ENTERPRISE_ADDRESS_BY_PATH_ADA
|
|
286
|
+
RustBuffer uniffi_keystone_wallet_core_fn_func_derive_enterprise_address_by_path_ada(RustBuffer account_xpub_hex, RustBuffer path, RustBuffer network, RustCallStatus *_Nonnull out_status
|
|
287
|
+
);
|
|
288
|
+
#endif
|
|
289
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_DERIVE_PUBKEY_BY_PATH_ADA
|
|
290
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_DERIVE_PUBKEY_BY_PATH_ADA
|
|
291
|
+
RustBuffer uniffi_keystone_wallet_core_fn_func_derive_pubkey_by_path_ada(RustBuffer account_xpub_hex, RustBuffer path, RustCallStatus *_Nonnull out_status
|
|
292
|
+
);
|
|
293
|
+
#endif
|
|
294
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_DERIVE_STAKE_ADDRESS_ADA
|
|
295
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_DERIVE_STAKE_ADDRESS_ADA
|
|
296
|
+
RustBuffer uniffi_keystone_wallet_core_fn_func_derive_stake_address_ada(RustBuffer account_xpub_hex, RustBuffer network, RustCallStatus *_Nonnull out_status
|
|
297
|
+
);
|
|
298
|
+
#endif
|
|
279
299
|
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_EXTRACT_AND_FINALIZE_PCZT
|
|
280
300
|
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_EXTRACT_AND_FINALIZE_PCZT
|
|
281
301
|
RustBuffer uniffi_keystone_wallet_core_fn_func_extract_and_finalize_pczt(RustBuffer pczt_hex, uint32_t expiry_height, RustBuffer private_key_hex, RustCallStatus *_Nonnull out_status
|
|
@@ -284,6 +304,12 @@ RustBuffer uniffi_keystone_wallet_core_fn_func_extract_and_finalize_pczt(RustBuf
|
|
|
284
304
|
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_EXTRACT_PCZT_TRANSACTION
|
|
285
305
|
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_EXTRACT_PCZT_TRANSACTION
|
|
286
306
|
RustBuffer uniffi_keystone_wallet_core_fn_func_extract_pczt_transaction(RustBuffer pczt_hex, RustCallStatus *_Nonnull out_status
|
|
307
|
+
);
|
|
308
|
+
#endif
|
|
309
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_HELLO
|
|
310
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_HELLO
|
|
311
|
+
void uniffi_keystone_wallet_core_fn_func_hello(RustCallStatus *_Nonnull out_status
|
|
312
|
+
|
|
287
313
|
);
|
|
288
314
|
#endif
|
|
289
315
|
#ifndef UNIFFI_FFIDEF_FFI_KEYSTONE_WALLET_CORE_RUSTBUFFER_ALLOC
|
|
@@ -576,6 +602,30 @@ uint16_t uniffi_keystone_wallet_core_checksum_func_create_pczt(void
|
|
|
576
602
|
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_CREATE_TRANSPARENT_PCZT
|
|
577
603
|
uint16_t uniffi_keystone_wallet_core_checksum_func_create_transparent_pczt(void
|
|
578
604
|
|
|
605
|
+
);
|
|
606
|
+
#endif
|
|
607
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_DERIVE_ADDRESS_BY_PATH_ADA
|
|
608
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_DERIVE_ADDRESS_BY_PATH_ADA
|
|
609
|
+
uint16_t uniffi_keystone_wallet_core_checksum_func_derive_address_by_path_ada(void
|
|
610
|
+
|
|
611
|
+
);
|
|
612
|
+
#endif
|
|
613
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_DERIVE_ENTERPRISE_ADDRESS_BY_PATH_ADA
|
|
614
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_DERIVE_ENTERPRISE_ADDRESS_BY_PATH_ADA
|
|
615
|
+
uint16_t uniffi_keystone_wallet_core_checksum_func_derive_enterprise_address_by_path_ada(void
|
|
616
|
+
|
|
617
|
+
);
|
|
618
|
+
#endif
|
|
619
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_DERIVE_PUBKEY_BY_PATH_ADA
|
|
620
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_DERIVE_PUBKEY_BY_PATH_ADA
|
|
621
|
+
uint16_t uniffi_keystone_wallet_core_checksum_func_derive_pubkey_by_path_ada(void
|
|
622
|
+
|
|
623
|
+
);
|
|
624
|
+
#endif
|
|
625
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_DERIVE_STAKE_ADDRESS_ADA
|
|
626
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_DERIVE_STAKE_ADDRESS_ADA
|
|
627
|
+
uint16_t uniffi_keystone_wallet_core_checksum_func_derive_stake_address_ada(void
|
|
628
|
+
|
|
579
629
|
);
|
|
580
630
|
#endif
|
|
581
631
|
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_EXTRACT_AND_FINALIZE_PCZT
|
|
@@ -588,6 +638,12 @@ uint16_t uniffi_keystone_wallet_core_checksum_func_extract_and_finalize_pczt(voi
|
|
|
588
638
|
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_EXTRACT_PCZT_TRANSACTION
|
|
589
639
|
uint16_t uniffi_keystone_wallet_core_checksum_func_extract_pczt_transaction(void
|
|
590
640
|
|
|
641
|
+
);
|
|
642
|
+
#endif
|
|
643
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_HELLO
|
|
644
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_HELLO
|
|
645
|
+
uint16_t uniffi_keystone_wallet_core_checksum_func_hello(void
|
|
646
|
+
|
|
591
647
|
);
|
|
592
648
|
#endif
|
|
593
649
|
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_METHOD_PCZT_SERIALIZE
|
|
Binary file
|
|
@@ -12,4 +12,26 @@ RCT_EXTERN_METHOD(extractPcztTransaction:(NSString *)pcztHex
|
|
|
12
12
|
resolve:(RCTPromiseResolveBlock)resolve
|
|
13
13
|
reject:(RCTPromiseRejectBlock)reject)
|
|
14
14
|
|
|
15
|
+
RCT_EXTERN_METHOD(derivePubkeyByPathAda:(NSString *)accountXpubHex
|
|
16
|
+
path:(NSString *)path
|
|
17
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
18
|
+
reject:(RCTPromiseRejectBlock)reject)
|
|
19
|
+
|
|
20
|
+
RCT_EXTERN_METHOD(deriveAddressByPathAda:(NSString *)accountXpubHex
|
|
21
|
+
path:(NSString *)path
|
|
22
|
+
network:(NSString *)network
|
|
23
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
24
|
+
reject:(RCTPromiseRejectBlock)reject)
|
|
25
|
+
|
|
26
|
+
RCT_EXTERN_METHOD(deriveEnterpriseAddressByPathAda:(NSString *)accountXpubHex
|
|
27
|
+
path:(NSString *)path
|
|
28
|
+
network:(NSString *)network
|
|
29
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
30
|
+
reject:(RCTPromiseRejectBlock)reject)
|
|
31
|
+
|
|
32
|
+
RCT_EXTERN_METHOD(deriveStakeAddressAda:(NSString *)accountXpubHex
|
|
33
|
+
network:(NSString *)network
|
|
34
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
35
|
+
reject:(RCTPromiseRejectBlock)reject)
|
|
36
|
+
|
|
15
37
|
@end
|
|
@@ -52,4 +52,61 @@ public class KeystoneWalletCoreModule: NSObject {
|
|
|
52
52
|
reject("PCZT_ERROR", error.localizedDescription, error)
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
+
|
|
56
|
+
private func getCardanoNetwork(network: String) throws -> CardanoNetwork {
|
|
57
|
+
switch network {
|
|
58
|
+
case "Mainnet":
|
|
59
|
+
return .mainnet
|
|
60
|
+
case "Testnet":
|
|
61
|
+
return .testnet
|
|
62
|
+
default:
|
|
63
|
+
throw NSError(domain: "CardanoModule", code: 1, userInfo: [NSLocalizedDescriptionKey: "Invalid Cardano network: \(network)"])
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@objc(derivePubkeyByPathAda:path:resolve:reject:)
|
|
68
|
+
func derivePubkeyByPathAdaBridge(_ accountXpubHex: String, path: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
|
69
|
+
do {
|
|
70
|
+
let result = try derivePubkeyByPathAda(accountXpubHex: accountXpubHex, path: path)
|
|
71
|
+
resolve([
|
|
72
|
+
"paymentPubkeyHex": result.paymentPubkeyHex,
|
|
73
|
+
"stakePubkeyHex": result.stakePubkeyHex
|
|
74
|
+
])
|
|
75
|
+
} catch {
|
|
76
|
+
reject("CARDANO_ERROR", error.localizedDescription, error)
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
@objc(deriveAddressByPathAda:path:network:resolve:reject:)
|
|
81
|
+
func deriveAddressByPathAdaBridge(_ accountXpubHex: String, path: String, network: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
|
82
|
+
do {
|
|
83
|
+
let adaNetwork = try getCardanoNetwork(network: network)
|
|
84
|
+
let result = try deriveAddressByPathAda(accountXpubHex: accountXpubHex, path: path, network: adaNetwork)
|
|
85
|
+
resolve(result)
|
|
86
|
+
} catch {
|
|
87
|
+
reject("CARDANO_ERROR", error.localizedDescription, error)
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
@objc(deriveEnterpriseAddressByPathAda:path:network:resolve:reject:)
|
|
92
|
+
func deriveEnterpriseAddressByPathAdaBridge(_ accountXpubHex: String, path: String, network: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
|
93
|
+
do {
|
|
94
|
+
let adaNetwork = try getCardanoNetwork(network: network)
|
|
95
|
+
let result = try deriveEnterpriseAddressByPathAda(accountXpubHex: accountXpubHex, path: path, network: adaNetwork)
|
|
96
|
+
resolve(result)
|
|
97
|
+
} catch {
|
|
98
|
+
reject("CARDANO_ERROR", error.localizedDescription, error)
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
@objc(deriveStakeAddressAda:network:resolve:reject:)
|
|
103
|
+
func deriveStakeAddressAdaBridge(_ accountXpubHex: String, network: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
|
104
|
+
do {
|
|
105
|
+
let adaNetwork = try getCardanoNetwork(network: network)
|
|
106
|
+
let result = try deriveStakeAddressAda(accountXpubHex: accountXpubHex, network: adaNetwork)
|
|
107
|
+
resolve(result)
|
|
108
|
+
} catch {
|
|
109
|
+
reject("CARDANO_ERROR", error.localizedDescription, error)
|
|
110
|
+
}
|
|
111
|
+
}
|
|
55
112
|
}
|
|
@@ -604,6 +604,72 @@ public func FfiConverterTypePczt_lower(_ value: Pczt) -> UnsafeMutableRawPointer
|
|
|
604
604
|
}
|
|
605
605
|
|
|
606
606
|
|
|
607
|
+
public struct DerivedKeys {
|
|
608
|
+
public var paymentPubkeyHex: String
|
|
609
|
+
public var stakePubkeyHex: String
|
|
610
|
+
|
|
611
|
+
// Default memberwise initializers are never public by default, so we
|
|
612
|
+
// declare one manually.
|
|
613
|
+
public init(paymentPubkeyHex: String, stakePubkeyHex: String) {
|
|
614
|
+
self.paymentPubkeyHex = paymentPubkeyHex
|
|
615
|
+
self.stakePubkeyHex = stakePubkeyHex
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
|
|
620
|
+
|
|
621
|
+
extension DerivedKeys: Equatable, Hashable {
|
|
622
|
+
public static func ==(lhs: DerivedKeys, rhs: DerivedKeys) -> Bool {
|
|
623
|
+
if lhs.paymentPubkeyHex != rhs.paymentPubkeyHex {
|
|
624
|
+
return false
|
|
625
|
+
}
|
|
626
|
+
if lhs.stakePubkeyHex != rhs.stakePubkeyHex {
|
|
627
|
+
return false
|
|
628
|
+
}
|
|
629
|
+
return true
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
public func hash(into hasher: inout Hasher) {
|
|
633
|
+
hasher.combine(paymentPubkeyHex)
|
|
634
|
+
hasher.combine(stakePubkeyHex)
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
|
|
639
|
+
#if swift(>=5.8)
|
|
640
|
+
@_documentation(visibility: private)
|
|
641
|
+
#endif
|
|
642
|
+
public struct FfiConverterTypeDerivedKeys: FfiConverterRustBuffer {
|
|
643
|
+
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> DerivedKeys {
|
|
644
|
+
return
|
|
645
|
+
try DerivedKeys(
|
|
646
|
+
paymentPubkeyHex: FfiConverterString.read(from: &buf),
|
|
647
|
+
stakePubkeyHex: FfiConverterString.read(from: &buf)
|
|
648
|
+
)
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
public static func write(_ value: DerivedKeys, into buf: inout [UInt8]) {
|
|
652
|
+
FfiConverterString.write(value.paymentPubkeyHex, into: &buf)
|
|
653
|
+
FfiConverterString.write(value.stakePubkeyHex, into: &buf)
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
|
|
658
|
+
#if swift(>=5.8)
|
|
659
|
+
@_documentation(visibility: private)
|
|
660
|
+
#endif
|
|
661
|
+
public func FfiConverterTypeDerivedKeys_lift(_ buf: RustBuffer) throws -> DerivedKeys {
|
|
662
|
+
return try FfiConverterTypeDerivedKeys.lift(buf)
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
#if swift(>=5.8)
|
|
666
|
+
@_documentation(visibility: private)
|
|
667
|
+
#endif
|
|
668
|
+
public func FfiConverterTypeDerivedKeys_lower(_ value: DerivedKeys) -> RustBuffer {
|
|
669
|
+
return FfiConverterTypeDerivedKeys.lower(value)
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
|
|
607
673
|
public struct TransparentInput {
|
|
608
674
|
public var txid: String
|
|
609
675
|
public var vout: UInt32
|
|
@@ -775,6 +841,70 @@ public func FfiConverterTypeTransparentOutput_lower(_ value: TransparentOutput)
|
|
|
775
841
|
return FfiConverterTypeTransparentOutput.lower(value)
|
|
776
842
|
}
|
|
777
843
|
|
|
844
|
+
// Note that we don't yet support `indirect` for enums.
|
|
845
|
+
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
|
|
846
|
+
|
|
847
|
+
public enum CardanoNetwork {
|
|
848
|
+
|
|
849
|
+
case mainnet
|
|
850
|
+
case testnet
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
|
|
854
|
+
#if swift(>=5.8)
|
|
855
|
+
@_documentation(visibility: private)
|
|
856
|
+
#endif
|
|
857
|
+
public struct FfiConverterTypeCardanoNetwork: FfiConverterRustBuffer {
|
|
858
|
+
typealias SwiftType = CardanoNetwork
|
|
859
|
+
|
|
860
|
+
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> CardanoNetwork {
|
|
861
|
+
let variant: Int32 = try readInt(&buf)
|
|
862
|
+
switch variant {
|
|
863
|
+
|
|
864
|
+
case 1: return .mainnet
|
|
865
|
+
|
|
866
|
+
case 2: return .testnet
|
|
867
|
+
|
|
868
|
+
default: throw UniffiInternalError.unexpectedEnumCase
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
public static func write(_ value: CardanoNetwork, into buf: inout [UInt8]) {
|
|
873
|
+
switch value {
|
|
874
|
+
|
|
875
|
+
|
|
876
|
+
case .mainnet:
|
|
877
|
+
writeInt(&buf, Int32(1))
|
|
878
|
+
|
|
879
|
+
|
|
880
|
+
case .testnet:
|
|
881
|
+
writeInt(&buf, Int32(2))
|
|
882
|
+
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
|
|
888
|
+
#if swift(>=5.8)
|
|
889
|
+
@_documentation(visibility: private)
|
|
890
|
+
#endif
|
|
891
|
+
public func FfiConverterTypeCardanoNetwork_lift(_ buf: RustBuffer) throws -> CardanoNetwork {
|
|
892
|
+
return try FfiConverterTypeCardanoNetwork.lift(buf)
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
#if swift(>=5.8)
|
|
896
|
+
@_documentation(visibility: private)
|
|
897
|
+
#endif
|
|
898
|
+
public func FfiConverterTypeCardanoNetwork_lower(_ value: CardanoNetwork) -> RustBuffer {
|
|
899
|
+
return FfiConverterTypeCardanoNetwork.lower(value)
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
|
|
903
|
+
|
|
904
|
+
extension CardanoNetwork: Equatable, Hashable {}
|
|
905
|
+
|
|
906
|
+
|
|
907
|
+
|
|
778
908
|
|
|
779
909
|
public enum PcztError {
|
|
780
910
|
|
|
@@ -870,6 +1000,85 @@ extension PcztError: Foundation.LocalizedError {
|
|
|
870
1000
|
}
|
|
871
1001
|
}
|
|
872
1002
|
|
|
1003
|
+
|
|
1004
|
+
public enum WalletError {
|
|
1005
|
+
|
|
1006
|
+
|
|
1007
|
+
|
|
1008
|
+
case HexError(message: String)
|
|
1009
|
+
|
|
1010
|
+
case InvalidPath(message: String)
|
|
1011
|
+
|
|
1012
|
+
case CslError(message: String)
|
|
1013
|
+
|
|
1014
|
+
case ParseError(message: String)
|
|
1015
|
+
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
|
|
1019
|
+
#if swift(>=5.8)
|
|
1020
|
+
@_documentation(visibility: private)
|
|
1021
|
+
#endif
|
|
1022
|
+
public struct FfiConverterTypeWalletError: FfiConverterRustBuffer {
|
|
1023
|
+
typealias SwiftType = WalletError
|
|
1024
|
+
|
|
1025
|
+
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> WalletError {
|
|
1026
|
+
let variant: Int32 = try readInt(&buf)
|
|
1027
|
+
switch variant {
|
|
1028
|
+
|
|
1029
|
+
|
|
1030
|
+
|
|
1031
|
+
|
|
1032
|
+
case 1: return .HexError(
|
|
1033
|
+
message: try FfiConverterString.read(from: &buf)
|
|
1034
|
+
)
|
|
1035
|
+
|
|
1036
|
+
case 2: return .InvalidPath(
|
|
1037
|
+
message: try FfiConverterString.read(from: &buf)
|
|
1038
|
+
)
|
|
1039
|
+
|
|
1040
|
+
case 3: return .CslError(
|
|
1041
|
+
message: try FfiConverterString.read(from: &buf)
|
|
1042
|
+
)
|
|
1043
|
+
|
|
1044
|
+
case 4: return .ParseError(
|
|
1045
|
+
message: try FfiConverterString.read(from: &buf)
|
|
1046
|
+
)
|
|
1047
|
+
|
|
1048
|
+
|
|
1049
|
+
default: throw UniffiInternalError.unexpectedEnumCase
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
public static func write(_ value: WalletError, into buf: inout [UInt8]) {
|
|
1054
|
+
switch value {
|
|
1055
|
+
|
|
1056
|
+
|
|
1057
|
+
|
|
1058
|
+
|
|
1059
|
+
case .HexError(_ /* message is ignored*/):
|
|
1060
|
+
writeInt(&buf, Int32(1))
|
|
1061
|
+
case .InvalidPath(_ /* message is ignored*/):
|
|
1062
|
+
writeInt(&buf, Int32(2))
|
|
1063
|
+
case .CslError(_ /* message is ignored*/):
|
|
1064
|
+
writeInt(&buf, Int32(3))
|
|
1065
|
+
case .ParseError(_ /* message is ignored*/):
|
|
1066
|
+
writeInt(&buf, Int32(4))
|
|
1067
|
+
|
|
1068
|
+
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
|
|
1073
|
+
|
|
1074
|
+
extension WalletError: Equatable, Hashable {}
|
|
1075
|
+
|
|
1076
|
+
extension WalletError: Foundation.LocalizedError {
|
|
1077
|
+
public var errorDescription: String? {
|
|
1078
|
+
String(reflecting: self)
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1081
|
+
|
|
873
1082
|
#if swift(>=5.8)
|
|
874
1083
|
@_documentation(visibility: private)
|
|
875
1084
|
#endif
|
|
@@ -962,6 +1171,40 @@ public func createTransparentPczt(inputs: [TransparentInput], outputs: [Transpar
|
|
|
962
1171
|
)
|
|
963
1172
|
})
|
|
964
1173
|
}
|
|
1174
|
+
public func deriveAddressByPathAda(accountXpubHex: String, path: String, network: CardanoNetwork)throws -> String {
|
|
1175
|
+
return try FfiConverterString.lift(try rustCallWithError(FfiConverterTypeWalletError.lift) {
|
|
1176
|
+
uniffi_keystone_wallet_core_fn_func_derive_address_by_path_ada(
|
|
1177
|
+
FfiConverterString.lower(accountXpubHex),
|
|
1178
|
+
FfiConverterString.lower(path),
|
|
1179
|
+
FfiConverterTypeCardanoNetwork.lower(network),$0
|
|
1180
|
+
)
|
|
1181
|
+
})
|
|
1182
|
+
}
|
|
1183
|
+
public func deriveEnterpriseAddressByPathAda(accountXpubHex: String, path: String, network: CardanoNetwork)throws -> String {
|
|
1184
|
+
return try FfiConverterString.lift(try rustCallWithError(FfiConverterTypeWalletError.lift) {
|
|
1185
|
+
uniffi_keystone_wallet_core_fn_func_derive_enterprise_address_by_path_ada(
|
|
1186
|
+
FfiConverterString.lower(accountXpubHex),
|
|
1187
|
+
FfiConverterString.lower(path),
|
|
1188
|
+
FfiConverterTypeCardanoNetwork.lower(network),$0
|
|
1189
|
+
)
|
|
1190
|
+
})
|
|
1191
|
+
}
|
|
1192
|
+
public func derivePubkeyByPathAda(accountXpubHex: String, path: String)throws -> DerivedKeys {
|
|
1193
|
+
return try FfiConverterTypeDerivedKeys.lift(try rustCallWithError(FfiConverterTypeWalletError.lift) {
|
|
1194
|
+
uniffi_keystone_wallet_core_fn_func_derive_pubkey_by_path_ada(
|
|
1195
|
+
FfiConverterString.lower(accountXpubHex),
|
|
1196
|
+
FfiConverterString.lower(path),$0
|
|
1197
|
+
)
|
|
1198
|
+
})
|
|
1199
|
+
}
|
|
1200
|
+
public func deriveStakeAddressAda(accountXpubHex: String, network: CardanoNetwork)throws -> String {
|
|
1201
|
+
return try FfiConverterString.lift(try rustCallWithError(FfiConverterTypeWalletError.lift) {
|
|
1202
|
+
uniffi_keystone_wallet_core_fn_func_derive_stake_address_ada(
|
|
1203
|
+
FfiConverterString.lower(accountXpubHex),
|
|
1204
|
+
FfiConverterTypeCardanoNetwork.lower(network),$0
|
|
1205
|
+
)
|
|
1206
|
+
})
|
|
1207
|
+
}
|
|
965
1208
|
public func extractAndFinalizePczt(pcztHex: String, expiryHeight: UInt32, privateKeyHex: String)throws -> String {
|
|
966
1209
|
return try FfiConverterString.lift(try rustCallWithError(FfiConverterTypePcztError.lift) {
|
|
967
1210
|
uniffi_keystone_wallet_core_fn_func_extract_and_finalize_pczt(
|
|
@@ -978,6 +1221,11 @@ public func extractPcztTransaction(pcztHex: String)throws -> String {
|
|
|
978
1221
|
)
|
|
979
1222
|
})
|
|
980
1223
|
}
|
|
1224
|
+
public func hello() {try! rustCall() {
|
|
1225
|
+
uniffi_keystone_wallet_core_fn_func_hello($0
|
|
1226
|
+
)
|
|
1227
|
+
}
|
|
1228
|
+
}
|
|
981
1229
|
|
|
982
1230
|
private enum InitializationResult {
|
|
983
1231
|
case ok
|
|
@@ -1000,12 +1248,27 @@ private var initializationResult: InitializationResult = {
|
|
|
1000
1248
|
if (uniffi_keystone_wallet_core_checksum_func_create_transparent_pczt() != 17127) {
|
|
1001
1249
|
return InitializationResult.apiChecksumMismatch
|
|
1002
1250
|
}
|
|
1251
|
+
if (uniffi_keystone_wallet_core_checksum_func_derive_address_by_path_ada() != 24523) {
|
|
1252
|
+
return InitializationResult.apiChecksumMismatch
|
|
1253
|
+
}
|
|
1254
|
+
if (uniffi_keystone_wallet_core_checksum_func_derive_enterprise_address_by_path_ada() != 54377) {
|
|
1255
|
+
return InitializationResult.apiChecksumMismatch
|
|
1256
|
+
}
|
|
1257
|
+
if (uniffi_keystone_wallet_core_checksum_func_derive_pubkey_by_path_ada() != 53793) {
|
|
1258
|
+
return InitializationResult.apiChecksumMismatch
|
|
1259
|
+
}
|
|
1260
|
+
if (uniffi_keystone_wallet_core_checksum_func_derive_stake_address_ada() != 22900) {
|
|
1261
|
+
return InitializationResult.apiChecksumMismatch
|
|
1262
|
+
}
|
|
1003
1263
|
if (uniffi_keystone_wallet_core_checksum_func_extract_and_finalize_pczt() != 38408) {
|
|
1004
1264
|
return InitializationResult.apiChecksumMismatch
|
|
1005
1265
|
}
|
|
1006
1266
|
if (uniffi_keystone_wallet_core_checksum_func_extract_pczt_transaction() != 4075) {
|
|
1007
1267
|
return InitializationResult.apiChecksumMismatch
|
|
1008
1268
|
}
|
|
1269
|
+
if (uniffi_keystone_wallet_core_checksum_func_hello() != 6912) {
|
|
1270
|
+
return InitializationResult.apiChecksumMismatch
|
|
1271
|
+
}
|
|
1009
1272
|
if (uniffi_keystone_wallet_core_checksum_method_pczt_serialize() != 18950) {
|
|
1010
1273
|
return InitializationResult.apiChecksumMismatch
|
|
1011
1274
|
}
|
package/lib/commonjs/index.js
CHANGED
|
@@ -3,7 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.CardanoNetwork = void 0;
|
|
6
7
|
exports.createTransparentPczt = createTransparentPczt;
|
|
8
|
+
exports.deriveAddressByPathAda = deriveAddressByPathAda;
|
|
9
|
+
exports.deriveEnterpriseAddressByPathAda = deriveEnterpriseAddressByPathAda;
|
|
10
|
+
exports.derivePubkeyByPathAda = derivePubkeyByPathAda;
|
|
11
|
+
exports.deriveStakeAddressAda = deriveStakeAddressAda;
|
|
7
12
|
exports.extractPcztTransaction = extractPcztTransaction;
|
|
8
13
|
var _reactNative = require("react-native");
|
|
9
14
|
const LINKING_ERROR = `The package 'react-native-keystone-wallet-core' doesn't seem to be linked. Make sure: \n\n` + (_reactNative.Platform.select({
|
|
@@ -21,4 +26,21 @@ function createTransparentPczt(inputs, outputs, blockHeight) {
|
|
|
21
26
|
function extractPcztTransaction(pcztHex) {
|
|
22
27
|
return KeystoneWalletCoreModule.extractPcztTransaction(pcztHex);
|
|
23
28
|
}
|
|
29
|
+
let CardanoNetwork = exports.CardanoNetwork = /*#__PURE__*/function (CardanoNetwork) {
|
|
30
|
+
CardanoNetwork["Mainnet"] = "Mainnet";
|
|
31
|
+
CardanoNetwork["Testnet"] = "Testnet";
|
|
32
|
+
return CardanoNetwork;
|
|
33
|
+
}({});
|
|
34
|
+
function derivePubkeyByPathAda(accountXpubHex, path) {
|
|
35
|
+
return KeystoneWalletCoreModule.derivePubkeyByPathAda(accountXpubHex, path);
|
|
36
|
+
}
|
|
37
|
+
function deriveAddressByPathAda(accountXpubHex, path, network) {
|
|
38
|
+
return KeystoneWalletCoreModule.deriveAddressByPathAda(accountXpubHex, path, network);
|
|
39
|
+
}
|
|
40
|
+
function deriveEnterpriseAddressByPathAda(accountXpubHex, path, network) {
|
|
41
|
+
return KeystoneWalletCoreModule.deriveEnterpriseAddressByPathAda(accountXpubHex, path, network);
|
|
42
|
+
}
|
|
43
|
+
function deriveStakeAddressAda(accountXpubHex, network) {
|
|
44
|
+
return KeystoneWalletCoreModule.deriveStakeAddressAda(accountXpubHex, network);
|
|
45
|
+
}
|
|
24
46
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","LINKING_ERROR","Platform","select","ios","default","KeystoneWalletCoreModule","NativeModules","Proxy","get","Error","createTransparentPczt","inputs","outputs","blockHeight","extractPcztTransaction","pcztHex"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_reactNative","require","LINKING_ERROR","Platform","select","ios","default","KeystoneWalletCoreModule","NativeModules","Proxy","get","Error","createTransparentPczt","inputs","outputs","blockHeight","extractPcztTransaction","pcztHex","CardanoNetwork","exports","derivePubkeyByPathAda","accountXpubHex","path","deriveAddressByPathAda","network","deriveEnterpriseAddressByPathAda","deriveStakeAddressAda"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,MAAMC,aAAa,GACjB,4FAA4F,IAC3FC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,IAAI,EAAE,CAAC,GAC/E,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,wBAAwB,GAAGC,0BAAa,CAACD,wBAAwB,GACnEC,0BAAa,CAACD,wBAAwB,GACtC,IAAIE,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACT,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAiBE,SAASU,qBAAqBA,CACnCC,MAA0B,EAC1BC,OAA4B,EAC5BC,WAAmB,EACF;EACjB,OAAOR,wBAAwB,CAACK,qBAAqB,CAACC,MAAM,EAAEC,OAAO,EAAEC,WAAW,CAAC;AACrF;AAEO,SAASC,sBAAsBA,CAACC,OAAe,EAAmB;EACvE,OAAOV,wBAAwB,CAACS,sBAAsB,CAACC,OAAO,CAAC;AACjE;AAAC,IAOWC,cAAc,GAAAC,OAAA,CAAAD,cAAA,0BAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA;AAKnB,SAASE,qBAAqBA,CACnCC,cAAsB,EACtBC,IAAY,EACU;EACtB,OAAOf,wBAAwB,CAACa,qBAAqB,CAACC,cAAc,EAAEC,IAAI,CAAC;AAC7E;AAEO,SAASC,sBAAsBA,CACpCF,cAAsB,EACtBC,IAAY,EACZE,OAAuB,EACN;EACjB,OAAOjB,wBAAwB,CAACgB,sBAAsB,CAACF,cAAc,EAAEC,IAAI,EAAEE,OAAO,CAAC;AACvF;AAEO,SAASC,gCAAgCA,CAC9CJ,cAAsB,EACtBC,IAAY,EACZE,OAAuB,EACN;EACjB,OAAOjB,wBAAwB,CAACkB,gCAAgC,CAACJ,cAAc,EAAEC,IAAI,EAAEE,OAAO,CAAC;AACjG;AAEO,SAASE,qBAAqBA,CACnCL,cAAsB,EACtBG,OAAuB,EACN;EACjB,OAAOjB,wBAAwB,CAACmB,qBAAqB,CAACL,cAAc,EAAEG,OAAO,CAAC;AAChF","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
|
@@ -14,4 +14,21 @@ export function createTransparentPczt(inputs, outputs, blockHeight) {
|
|
|
14
14
|
export function extractPcztTransaction(pcztHex) {
|
|
15
15
|
return KeystoneWalletCoreModule.extractPcztTransaction(pcztHex);
|
|
16
16
|
}
|
|
17
|
+
export let CardanoNetwork = /*#__PURE__*/function (CardanoNetwork) {
|
|
18
|
+
CardanoNetwork["Mainnet"] = "Mainnet";
|
|
19
|
+
CardanoNetwork["Testnet"] = "Testnet";
|
|
20
|
+
return CardanoNetwork;
|
|
21
|
+
}({});
|
|
22
|
+
export function derivePubkeyByPathAda(accountXpubHex, path) {
|
|
23
|
+
return KeystoneWalletCoreModule.derivePubkeyByPathAda(accountXpubHex, path);
|
|
24
|
+
}
|
|
25
|
+
export function deriveAddressByPathAda(accountXpubHex, path, network) {
|
|
26
|
+
return KeystoneWalletCoreModule.deriveAddressByPathAda(accountXpubHex, path, network);
|
|
27
|
+
}
|
|
28
|
+
export function deriveEnterpriseAddressByPathAda(accountXpubHex, path, network) {
|
|
29
|
+
return KeystoneWalletCoreModule.deriveEnterpriseAddressByPathAda(accountXpubHex, path, network);
|
|
30
|
+
}
|
|
31
|
+
export function deriveStakeAddressAda(accountXpubHex, network) {
|
|
32
|
+
return KeystoneWalletCoreModule.deriveStakeAddressAda(accountXpubHex, network);
|
|
33
|
+
}
|
|
17
34
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeModules","Platform","LINKING_ERROR","select","ios","default","KeystoneWalletCoreModule","Proxy","get","Error","createTransparentPczt","inputs","outputs","blockHeight","extractPcztTransaction","pcztHex"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAEtD,MAAMC,aAAa,GACjB,4FAA4F,IAC3FD,QAAQ,CAACE,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,IAAI,EAAE,CAAC,GAC/E,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,wBAAwB,GAAGN,aAAa,CAACM,wBAAwB,GACnEN,aAAa,CAACM,wBAAwB,GACtC,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACP,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAiBL,OAAO,SAASQ,qBAAqBA,CACnCC,MAA0B,EAC1BC,OAA4B,EAC5BC,WAAmB,EACF;EACjB,OAAOP,wBAAwB,CAACI,qBAAqB,CAACC,MAAM,EAAEC,OAAO,EAAEC,WAAW,CAAC;AACrF;AAEA,OAAO,SAASC,sBAAsBA,CAACC,OAAe,EAAmB;EACvE,OAAOT,wBAAwB,CAACQ,sBAAsB,CAACC,OAAO,CAAC;AACjE","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["NativeModules","Platform","LINKING_ERROR","select","ios","default","KeystoneWalletCoreModule","Proxy","get","Error","createTransparentPczt","inputs","outputs","blockHeight","extractPcztTransaction","pcztHex","CardanoNetwork","derivePubkeyByPathAda","accountXpubHex","path","deriveAddressByPathAda","network","deriveEnterpriseAddressByPathAda","deriveStakeAddressAda"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAEtD,MAAMC,aAAa,GACjB,4FAA4F,IAC3FD,QAAQ,CAACE,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,IAAI,EAAE,CAAC,GAC/E,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,wBAAwB,GAAGN,aAAa,CAACM,wBAAwB,GACnEN,aAAa,CAACM,wBAAwB,GACtC,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACP,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAiBL,OAAO,SAASQ,qBAAqBA,CACnCC,MAA0B,EAC1BC,OAA4B,EAC5BC,WAAmB,EACF;EACjB,OAAOP,wBAAwB,CAACI,qBAAqB,CAACC,MAAM,EAAEC,OAAO,EAAEC,WAAW,CAAC;AACrF;AAEA,OAAO,SAASC,sBAAsBA,CAACC,OAAe,EAAmB;EACvE,OAAOT,wBAAwB,CAACQ,sBAAsB,CAACC,OAAO,CAAC;AACjE;AAOA,WAAYC,cAAc,0BAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA;AAK1B,OAAO,SAASC,qBAAqBA,CACnCC,cAAsB,EACtBC,IAAY,EACU;EACtB,OAAOb,wBAAwB,CAACW,qBAAqB,CAACC,cAAc,EAAEC,IAAI,CAAC;AAC7E;AAEA,OAAO,SAASC,sBAAsBA,CACpCF,cAAsB,EACtBC,IAAY,EACZE,OAAuB,EACN;EACjB,OAAOf,wBAAwB,CAACc,sBAAsB,CAACF,cAAc,EAAEC,IAAI,EAAEE,OAAO,CAAC;AACvF;AAEA,OAAO,SAASC,gCAAgCA,CAC9CJ,cAAsB,EACtBC,IAAY,EACZE,OAAuB,EACN;EACjB,OAAOf,wBAAwB,CAACgB,gCAAgC,CAACJ,cAAc,EAAEC,IAAI,EAAEE,OAAO,CAAC;AACjG;AAEA,OAAO,SAASE,qBAAqBA,CACnCL,cAAsB,EACtBG,OAAuB,EACN;EACjB,OAAOf,wBAAwB,CAACiB,qBAAqB,CAACL,cAAc,EAAEG,OAAO,CAAC;AAChF","ignoreList":[]}
|
|
@@ -13,4 +13,16 @@ export interface TransparentOutput {
|
|
|
13
13
|
}
|
|
14
14
|
export declare function createTransparentPczt(inputs: TransparentInput[], outputs: TransparentOutput[], blockHeight: number): Promise<string>;
|
|
15
15
|
export declare function extractPcztTransaction(pcztHex: string): Promise<string>;
|
|
16
|
+
export interface DerivedKeys {
|
|
17
|
+
paymentPubkeyHex: string;
|
|
18
|
+
stakePubkeyHex: string;
|
|
19
|
+
}
|
|
20
|
+
export declare enum CardanoNetwork {
|
|
21
|
+
Mainnet = "Mainnet",
|
|
22
|
+
Testnet = "Testnet"
|
|
23
|
+
}
|
|
24
|
+
export declare function derivePubkeyByPathAda(accountXpubHex: string, path: string): Promise<DerivedKeys>;
|
|
25
|
+
export declare function deriveAddressByPathAda(accountXpubHex: string, path: string, network: CardanoNetwork): Promise<string>;
|
|
26
|
+
export declare function deriveEnterpriseAddressByPathAda(accountXpubHex: string, path: string, network: CardanoNetwork): Promise<string>;
|
|
27
|
+
export declare function deriveStakeAddressAda(accountXpubHex: string, network: CardanoNetwork): Promise<string>;
|
|
16
28
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAmBA,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,gBAAgB,EAAE,EAC1B,OAAO,EAAE,iBAAiB,EAAE,EAC5B,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,MAAM,CAAC,CAEjB;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAEvE"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAmBA,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,gBAAgB,EAAE,EAC1B,OAAO,EAAE,iBAAiB,EAAE,EAC5B,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,MAAM,CAAC,CAEjB;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAEvE;AAED,MAAM,WAAW,WAAW;IAC1B,gBAAgB,EAAE,MAAM,CAAC;IACzB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,oBAAY,cAAc;IACxB,OAAO,YAAY;IACnB,OAAO,YAAY;CACpB;AAED,wBAAgB,qBAAqB,CACnC,cAAc,EAAE,MAAM,EACtB,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,WAAW,CAAC,CAEtB;AAED,wBAAgB,sBAAsB,CACpC,cAAc,EAAE,MAAM,EACtB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,MAAM,CAAC,CAEjB;AAED,wBAAgB,gCAAgC,CAC9C,cAAc,EAAE,MAAM,EACtB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,MAAM,CAAC,CAEjB;AAED,wBAAgB,qBAAqB,CACnC,cAAc,EAAE,MAAM,EACtB,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,MAAM,CAAC,CAEjB"}
|
package/package.json
CHANGED
package/src/index.tsx
CHANGED
|
@@ -44,3 +44,43 @@ export function extractPcztTransaction(pcztHex: string): Promise<string> {
|
|
|
44
44
|
return KeystoneWalletCoreModule.extractPcztTransaction(pcztHex);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
+
export interface DerivedKeys {
|
|
48
|
+
paymentPubkeyHex: string;
|
|
49
|
+
stakePubkeyHex: string;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export enum CardanoNetwork {
|
|
53
|
+
Mainnet = 'Mainnet',
|
|
54
|
+
Testnet = 'Testnet',
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function derivePubkeyByPathAda(
|
|
58
|
+
accountXpubHex: string,
|
|
59
|
+
path: string
|
|
60
|
+
): Promise<DerivedKeys> {
|
|
61
|
+
return KeystoneWalletCoreModule.derivePubkeyByPathAda(accountXpubHex, path);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function deriveAddressByPathAda(
|
|
65
|
+
accountXpubHex: string,
|
|
66
|
+
path: string,
|
|
67
|
+
network: CardanoNetwork
|
|
68
|
+
): Promise<string> {
|
|
69
|
+
return KeystoneWalletCoreModule.deriveAddressByPathAda(accountXpubHex, path, network);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function deriveEnterpriseAddressByPathAda(
|
|
73
|
+
accountXpubHex: string,
|
|
74
|
+
path: string,
|
|
75
|
+
network: CardanoNetwork
|
|
76
|
+
): Promise<string> {
|
|
77
|
+
return KeystoneWalletCoreModule.deriveEnterpriseAddressByPathAda(accountXpubHex, path, network);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export function deriveStakeAddressAda(
|
|
81
|
+
accountXpubHex: string,
|
|
82
|
+
network: CardanoNetwork
|
|
83
|
+
): Promise<string> {
|
|
84
|
+
return KeystoneWalletCoreModule.deriveStakeAddressAda(accountXpubHex, network);
|
|
85
|
+
}
|
|
86
|
+
|