@keystonehq/react-native-keystone-wallet-core 0.1.0-alpha.1 → 0.1.0-alpha.4
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 +75 -0
- package/ios/Frameworks/KeystoneWalletCoreFFI.xcframework/Info.plist +4 -4
- package/ios/Frameworks/KeystoneWalletCoreFFI.xcframework/ios-arm64/KeystoneWalletCoreFFI.framework/Headers/keystone_wallet_coreFFI.h +39 -17
- 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 +39 -17
- package/ios/Frameworks/KeystoneWalletCoreFFI.xcframework/ios-arm64-simulator/KeystoneWalletCoreFFI.framework/KeystoneWalletCoreFFI +0 -0
- package/ios/KeystoneWalletCoreModule.m +23 -1
- package/ios/KeystoneWalletCoreModule.swift +91 -4
- package/ios/keystone_wallet_core.swift +398 -16
- package/lib/commonjs/index.js +15 -3
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/index.js +11 -2
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/index.d.ts +22 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/index.tsx +65 -2
|
@@ -9,13 +9,19 @@ 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.finalizeThenExtractPcztTransaction;
|
|
12
13
|
import uniffi.keystone_wallet_core.derivePubkeyByPathAda
|
|
13
14
|
import uniffi.keystone_wallet_core.deriveAddressByPathAda
|
|
14
15
|
import uniffi.keystone_wallet_core.deriveEnterpriseAddressByPathAda
|
|
15
16
|
import uniffi.keystone_wallet_core.deriveStakeAddressAda
|
|
16
17
|
import uniffi.keystone_wallet_core.CardanoNetwork
|
|
18
|
+
import uniffi.keystone_wallet_core.CardanoTxInput
|
|
19
|
+
import uniffi.keystone_wallet_core.CardanoTxOutput
|
|
20
|
+
import uniffi.keystone_wallet_core.composeTransactionAda
|
|
17
21
|
import com.facebook.react.bridge.WritableNativeMap
|
|
18
22
|
|
|
23
|
+
import uniffi.keystone_wallet_core.assembleTransactionAda
|
|
24
|
+
|
|
19
25
|
class KeystoneWalletCoreModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(reactContext) {
|
|
20
26
|
|
|
21
27
|
override fun getName(): String {
|
|
@@ -58,6 +64,16 @@ class KeystoneWalletCoreModule(reactContext: ReactApplicationContext) : ReactCon
|
|
|
58
64
|
}
|
|
59
65
|
}
|
|
60
66
|
|
|
67
|
+
@ReactMethod
|
|
68
|
+
fun finalizeThenExtractPcztTransaction(pczt: String) {
|
|
69
|
+
try {
|
|
70
|
+
val result = finalizeThenExtractPcztTransaction(pczt)
|
|
71
|
+
promise.resolve(result)
|
|
72
|
+
} catch (e: Exception) {
|
|
73
|
+
promise.reject("finalizeThenExtractPcztTransaction ERROR", e.message, e)
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
61
77
|
private fun getCardanoNetwork(network: String): CardanoNetwork {
|
|
62
78
|
return when (network) {
|
|
63
79
|
"Mainnet" -> CardanoNetwork.MAINNET
|
|
@@ -111,4 +127,63 @@ class KeystoneWalletCoreModule(reactContext: ReactApplicationContext) : ReactCon
|
|
|
111
127
|
promise.reject("CARDANO_ERROR", e.message, e)
|
|
112
128
|
}
|
|
113
129
|
}
|
|
130
|
+
|
|
131
|
+
@ReactMethod
|
|
132
|
+
fun composeTransactionAda(
|
|
133
|
+
inputs: ReadableArray,
|
|
134
|
+
outputs: ReadableArray,
|
|
135
|
+
changeAddress: String,
|
|
136
|
+
fee: Double,
|
|
137
|
+
ttl: Double,
|
|
138
|
+
network: String,
|
|
139
|
+
promise: Promise
|
|
140
|
+
) {
|
|
141
|
+
try {
|
|
142
|
+
val kotlinInputs = mutableListOf<CardanoTxInput>()
|
|
143
|
+
for (i in 0 until inputs.size()) {
|
|
144
|
+
val input = inputs.getMap(i) ?: continue
|
|
145
|
+
kotlinInputs.add(CardanoTxInput(
|
|
146
|
+
txHash = input.getString("txHash") ?: "",
|
|
147
|
+
txIndex = input.getDouble("txIndex").toUInt(),
|
|
148
|
+
amount = input.getDouble("amount").toULong()
|
|
149
|
+
))
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
val kotlinOutputs = mutableListOf<CardanoTxOutput>()
|
|
153
|
+
for (i in 0 until outputs.size()) {
|
|
154
|
+
val output = outputs.getMap(i) ?: continue
|
|
155
|
+
kotlinOutputs.add(CardanoTxOutput(
|
|
156
|
+
address = output.getString("address") ?: "",
|
|
157
|
+
amount = output.getDouble("amount").toULong(),
|
|
158
|
+
isChange = output.getBoolean("isChange")
|
|
159
|
+
))
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
val adaNetwork = getCardanoNetwork(network)
|
|
163
|
+
val result = composeTransactionAda(
|
|
164
|
+
kotlinInputs,
|
|
165
|
+
kotlinOutputs,
|
|
166
|
+
changeAddress,
|
|
167
|
+
fee.toULong(),
|
|
168
|
+
ttl.toULong(),
|
|
169
|
+
adaNetwork
|
|
170
|
+
)
|
|
171
|
+
promise.resolve(result)
|
|
172
|
+
} catch (e: Exception) {
|
|
173
|
+
promise.reject("CARDANO_ERROR", e.message, e)
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
@ReactMethod
|
|
178
|
+
fun assembleTransactionAda(rawTxHex: String, witnessSetHex: String, promise: Promise) {
|
|
179
|
+
try {
|
|
180
|
+
val result = assembleTransactionAda(rawTxHex, witnessSetHex)
|
|
181
|
+
val map = WritableNativeMap()
|
|
182
|
+
map.putString("txId", result.txId)
|
|
183
|
+
map.putString("txHex", result.txHex)
|
|
184
|
+
promise.resolve(map)
|
|
185
|
+
} catch (e: Exception) {
|
|
186
|
+
promise.reject("CARDANO_ERROR", e.message, e)
|
|
187
|
+
}
|
|
188
|
+
}
|
|
114
189
|
}
|
|
@@ -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
|
|
11
|
+
<string>ios-arm64</string>
|
|
12
12
|
<key>LibraryPath</key>
|
|
13
13
|
<string>KeystoneWalletCoreFFI.framework</string>
|
|
14
14
|
<key>SupportedArchitectures</key>
|
|
@@ -17,14 +17,12 @@
|
|
|
17
17
|
</array>
|
|
18
18
|
<key>SupportedPlatform</key>
|
|
19
19
|
<string>ios</string>
|
|
20
|
-
<key>SupportedPlatformVariant</key>
|
|
21
|
-
<string>simulator</string>
|
|
22
20
|
</dict>
|
|
23
21
|
<dict>
|
|
24
22
|
<key>BinaryPath</key>
|
|
25
23
|
<string>KeystoneWalletCoreFFI.framework/KeystoneWalletCoreFFI</string>
|
|
26
24
|
<key>LibraryIdentifier</key>
|
|
27
|
-
<string>ios-arm64</string>
|
|
25
|
+
<string>ios-arm64-simulator</string>
|
|
28
26
|
<key>LibraryPath</key>
|
|
29
27
|
<string>KeystoneWalletCoreFFI.framework</string>
|
|
30
28
|
<key>SupportedArchitectures</key>
|
|
@@ -33,6 +31,8 @@
|
|
|
33
31
|
</array>
|
|
34
32
|
<key>SupportedPlatform</key>
|
|
35
33
|
<string>ios</string>
|
|
34
|
+
<key>SupportedPlatformVariant</key>
|
|
35
|
+
<string>simulator</string>
|
|
36
36
|
</dict>
|
|
37
37
|
</array>
|
|
38
38
|
<key>CFBundlePackageType</key>
|
|
@@ -266,6 +266,16 @@ void uniffi_keystone_wallet_core_fn_free_pczt(void*_Nonnull ptr, RustCallStatus
|
|
|
266
266
|
RustBuffer uniffi_keystone_wallet_core_fn_method_pczt_serialize(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
|
|
267
267
|
);
|
|
268
268
|
#endif
|
|
269
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_ASSEMBLE_TRANSACTION_ADA
|
|
270
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_ASSEMBLE_TRANSACTION_ADA
|
|
271
|
+
RustBuffer uniffi_keystone_wallet_core_fn_func_assemble_transaction_ada(RustBuffer raw_tx_hex, RustBuffer witness_set_hex, RustCallStatus *_Nonnull out_status
|
|
272
|
+
);
|
|
273
|
+
#endif
|
|
274
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_COMPOSE_TRANSACTION_ADA
|
|
275
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_COMPOSE_TRANSACTION_ADA
|
|
276
|
+
RustBuffer uniffi_keystone_wallet_core_fn_func_compose_transaction_ada(RustBuffer inputs, RustBuffer outputs, RustBuffer change_address, uint64_t fee, uint64_t ttl, RustBuffer network, RustCallStatus *_Nonnull out_status
|
|
277
|
+
);
|
|
278
|
+
#endif
|
|
269
279
|
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_CREATE_PCZT
|
|
270
280
|
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_CREATE_PCZT
|
|
271
281
|
void*_Nonnull uniffi_keystone_wallet_core_fn_func_create_pczt(uint32_t consensus_branch_id, uint32_t expiry_height, uint32_t coin_type, RustCallStatus *_Nonnull out_status
|
|
@@ -276,6 +286,11 @@ void*_Nonnull uniffi_keystone_wallet_core_fn_func_create_pczt(uint32_t consensus
|
|
|
276
286
|
RustBuffer uniffi_keystone_wallet_core_fn_func_create_transparent_pczt(RustBuffer inputs, RustBuffer outputs, uint32_t block_height, RustCallStatus *_Nonnull out_status
|
|
277
287
|
);
|
|
278
288
|
#endif
|
|
289
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_CREATE_TRANSPARENT_PCZT_FOR_SWAPKIT
|
|
290
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_CREATE_TRANSPARENT_PCZT_FOR_SWAPKIT
|
|
291
|
+
RustBuffer uniffi_keystone_wallet_core_fn_func_create_transparent_pczt_for_swapkit(RustBuffer pczt_hex, uint32_t block_height, RustBuffer pubkey_hex, RustBuffer fingerprint_hex, RustBuffer path_str, RustCallStatus *_Nonnull out_status
|
|
292
|
+
);
|
|
293
|
+
#endif
|
|
279
294
|
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_DERIVE_ADDRESS_BY_PATH_ADA
|
|
280
295
|
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_DERIVE_ADDRESS_BY_PATH_ADA
|
|
281
296
|
RustBuffer uniffi_keystone_wallet_core_fn_func_derive_address_by_path_ada(RustBuffer account_xpub_hex, RustBuffer path, RustBuffer network, RustCallStatus *_Nonnull out_status
|
|
@@ -296,14 +311,9 @@ RustBuffer uniffi_keystone_wallet_core_fn_func_derive_pubkey_by_path_ada(RustBuf
|
|
|
296
311
|
RustBuffer uniffi_keystone_wallet_core_fn_func_derive_stake_address_ada(RustBuffer account_xpub_hex, RustBuffer network, RustCallStatus *_Nonnull out_status
|
|
297
312
|
);
|
|
298
313
|
#endif
|
|
299
|
-
#ifndef
|
|
300
|
-
#define
|
|
301
|
-
RustBuffer
|
|
302
|
-
);
|
|
303
|
-
#endif
|
|
304
|
-
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_EXTRACT_PCZT_TRANSACTION
|
|
305
|
-
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_EXTRACT_PCZT_TRANSACTION
|
|
306
|
-
RustBuffer uniffi_keystone_wallet_core_fn_func_extract_pczt_transaction(RustBuffer pczt_hex, RustCallStatus *_Nonnull out_status
|
|
314
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_FINALIZE_THEN_EXTRACT_PCZT_TRANSACTION
|
|
315
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_FINALIZE_THEN_EXTRACT_PCZT_TRANSACTION
|
|
316
|
+
RustBuffer uniffi_keystone_wallet_core_fn_func_finalize_then_extract_pczt_transaction(RustBuffer pczt_hex, RustCallStatus *_Nonnull out_status
|
|
307
317
|
);
|
|
308
318
|
#endif
|
|
309
319
|
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_HELLO
|
|
@@ -590,6 +600,18 @@ void ffi_keystone_wallet_core_rust_future_free_void(uint64_t handle
|
|
|
590
600
|
#ifndef UNIFFI_FFIDEF_FFI_KEYSTONE_WALLET_CORE_RUST_FUTURE_COMPLETE_VOID
|
|
591
601
|
#define UNIFFI_FFIDEF_FFI_KEYSTONE_WALLET_CORE_RUST_FUTURE_COMPLETE_VOID
|
|
592
602
|
void ffi_keystone_wallet_core_rust_future_complete_void(uint64_t handle, RustCallStatus *_Nonnull out_status
|
|
603
|
+
);
|
|
604
|
+
#endif
|
|
605
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_ASSEMBLE_TRANSACTION_ADA
|
|
606
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_ASSEMBLE_TRANSACTION_ADA
|
|
607
|
+
uint16_t uniffi_keystone_wallet_core_checksum_func_assemble_transaction_ada(void
|
|
608
|
+
|
|
609
|
+
);
|
|
610
|
+
#endif
|
|
611
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_COMPOSE_TRANSACTION_ADA
|
|
612
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_COMPOSE_TRANSACTION_ADA
|
|
613
|
+
uint16_t uniffi_keystone_wallet_core_checksum_func_compose_transaction_ada(void
|
|
614
|
+
|
|
593
615
|
);
|
|
594
616
|
#endif
|
|
595
617
|
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_CREATE_PCZT
|
|
@@ -602,6 +624,12 @@ uint16_t uniffi_keystone_wallet_core_checksum_func_create_pczt(void
|
|
|
602
624
|
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_CREATE_TRANSPARENT_PCZT
|
|
603
625
|
uint16_t uniffi_keystone_wallet_core_checksum_func_create_transparent_pczt(void
|
|
604
626
|
|
|
627
|
+
);
|
|
628
|
+
#endif
|
|
629
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_CREATE_TRANSPARENT_PCZT_FOR_SWAPKIT
|
|
630
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_CREATE_TRANSPARENT_PCZT_FOR_SWAPKIT
|
|
631
|
+
uint16_t uniffi_keystone_wallet_core_checksum_func_create_transparent_pczt_for_swapkit(void
|
|
632
|
+
|
|
605
633
|
);
|
|
606
634
|
#endif
|
|
607
635
|
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_DERIVE_ADDRESS_BY_PATH_ADA
|
|
@@ -628,15 +656,9 @@ uint16_t uniffi_keystone_wallet_core_checksum_func_derive_stake_address_ada(void
|
|
|
628
656
|
|
|
629
657
|
);
|
|
630
658
|
#endif
|
|
631
|
-
#ifndef
|
|
632
|
-
#define
|
|
633
|
-
uint16_t
|
|
634
|
-
|
|
635
|
-
);
|
|
636
|
-
#endif
|
|
637
|
-
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_EXTRACT_PCZT_TRANSACTION
|
|
638
|
-
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_EXTRACT_PCZT_TRANSACTION
|
|
639
|
-
uint16_t uniffi_keystone_wallet_core_checksum_func_extract_pczt_transaction(void
|
|
659
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_FINALIZE_THEN_EXTRACT_PCZT_TRANSACTION
|
|
660
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_FINALIZE_THEN_EXTRACT_PCZT_TRANSACTION
|
|
661
|
+
uint16_t uniffi_keystone_wallet_core_checksum_func_finalize_then_extract_pczt_transaction(void
|
|
640
662
|
|
|
641
663
|
);
|
|
642
664
|
#endif
|
|
Binary file
|
|
@@ -266,6 +266,16 @@ void uniffi_keystone_wallet_core_fn_free_pczt(void*_Nonnull ptr, RustCallStatus
|
|
|
266
266
|
RustBuffer uniffi_keystone_wallet_core_fn_method_pczt_serialize(void*_Nonnull ptr, RustCallStatus *_Nonnull out_status
|
|
267
267
|
);
|
|
268
268
|
#endif
|
|
269
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_ASSEMBLE_TRANSACTION_ADA
|
|
270
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_ASSEMBLE_TRANSACTION_ADA
|
|
271
|
+
RustBuffer uniffi_keystone_wallet_core_fn_func_assemble_transaction_ada(RustBuffer raw_tx_hex, RustBuffer witness_set_hex, RustCallStatus *_Nonnull out_status
|
|
272
|
+
);
|
|
273
|
+
#endif
|
|
274
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_COMPOSE_TRANSACTION_ADA
|
|
275
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_COMPOSE_TRANSACTION_ADA
|
|
276
|
+
RustBuffer uniffi_keystone_wallet_core_fn_func_compose_transaction_ada(RustBuffer inputs, RustBuffer outputs, RustBuffer change_address, uint64_t fee, uint64_t ttl, RustBuffer network, RustCallStatus *_Nonnull out_status
|
|
277
|
+
);
|
|
278
|
+
#endif
|
|
269
279
|
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_CREATE_PCZT
|
|
270
280
|
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_CREATE_PCZT
|
|
271
281
|
void*_Nonnull uniffi_keystone_wallet_core_fn_func_create_pczt(uint32_t consensus_branch_id, uint32_t expiry_height, uint32_t coin_type, RustCallStatus *_Nonnull out_status
|
|
@@ -276,6 +286,11 @@ void*_Nonnull uniffi_keystone_wallet_core_fn_func_create_pczt(uint32_t consensus
|
|
|
276
286
|
RustBuffer uniffi_keystone_wallet_core_fn_func_create_transparent_pczt(RustBuffer inputs, RustBuffer outputs, uint32_t block_height, RustCallStatus *_Nonnull out_status
|
|
277
287
|
);
|
|
278
288
|
#endif
|
|
289
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_CREATE_TRANSPARENT_PCZT_FOR_SWAPKIT
|
|
290
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_CREATE_TRANSPARENT_PCZT_FOR_SWAPKIT
|
|
291
|
+
RustBuffer uniffi_keystone_wallet_core_fn_func_create_transparent_pczt_for_swapkit(RustBuffer pczt_hex, uint32_t block_height, RustBuffer pubkey_hex, RustBuffer fingerprint_hex, RustBuffer path_str, RustCallStatus *_Nonnull out_status
|
|
292
|
+
);
|
|
293
|
+
#endif
|
|
279
294
|
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_DERIVE_ADDRESS_BY_PATH_ADA
|
|
280
295
|
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_DERIVE_ADDRESS_BY_PATH_ADA
|
|
281
296
|
RustBuffer uniffi_keystone_wallet_core_fn_func_derive_address_by_path_ada(RustBuffer account_xpub_hex, RustBuffer path, RustBuffer network, RustCallStatus *_Nonnull out_status
|
|
@@ -296,14 +311,9 @@ RustBuffer uniffi_keystone_wallet_core_fn_func_derive_pubkey_by_path_ada(RustBuf
|
|
|
296
311
|
RustBuffer uniffi_keystone_wallet_core_fn_func_derive_stake_address_ada(RustBuffer account_xpub_hex, RustBuffer network, RustCallStatus *_Nonnull out_status
|
|
297
312
|
);
|
|
298
313
|
#endif
|
|
299
|
-
#ifndef
|
|
300
|
-
#define
|
|
301
|
-
RustBuffer
|
|
302
|
-
);
|
|
303
|
-
#endif
|
|
304
|
-
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_EXTRACT_PCZT_TRANSACTION
|
|
305
|
-
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_EXTRACT_PCZT_TRANSACTION
|
|
306
|
-
RustBuffer uniffi_keystone_wallet_core_fn_func_extract_pczt_transaction(RustBuffer pczt_hex, RustCallStatus *_Nonnull out_status
|
|
314
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_FINALIZE_THEN_EXTRACT_PCZT_TRANSACTION
|
|
315
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_FINALIZE_THEN_EXTRACT_PCZT_TRANSACTION
|
|
316
|
+
RustBuffer uniffi_keystone_wallet_core_fn_func_finalize_then_extract_pczt_transaction(RustBuffer pczt_hex, RustCallStatus *_Nonnull out_status
|
|
307
317
|
);
|
|
308
318
|
#endif
|
|
309
319
|
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_HELLO
|
|
@@ -590,6 +600,18 @@ void ffi_keystone_wallet_core_rust_future_free_void(uint64_t handle
|
|
|
590
600
|
#ifndef UNIFFI_FFIDEF_FFI_KEYSTONE_WALLET_CORE_RUST_FUTURE_COMPLETE_VOID
|
|
591
601
|
#define UNIFFI_FFIDEF_FFI_KEYSTONE_WALLET_CORE_RUST_FUTURE_COMPLETE_VOID
|
|
592
602
|
void ffi_keystone_wallet_core_rust_future_complete_void(uint64_t handle, RustCallStatus *_Nonnull out_status
|
|
603
|
+
);
|
|
604
|
+
#endif
|
|
605
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_ASSEMBLE_TRANSACTION_ADA
|
|
606
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_ASSEMBLE_TRANSACTION_ADA
|
|
607
|
+
uint16_t uniffi_keystone_wallet_core_checksum_func_assemble_transaction_ada(void
|
|
608
|
+
|
|
609
|
+
);
|
|
610
|
+
#endif
|
|
611
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_COMPOSE_TRANSACTION_ADA
|
|
612
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_COMPOSE_TRANSACTION_ADA
|
|
613
|
+
uint16_t uniffi_keystone_wallet_core_checksum_func_compose_transaction_ada(void
|
|
614
|
+
|
|
593
615
|
);
|
|
594
616
|
#endif
|
|
595
617
|
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_CREATE_PCZT
|
|
@@ -602,6 +624,12 @@ uint16_t uniffi_keystone_wallet_core_checksum_func_create_pczt(void
|
|
|
602
624
|
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_CREATE_TRANSPARENT_PCZT
|
|
603
625
|
uint16_t uniffi_keystone_wallet_core_checksum_func_create_transparent_pczt(void
|
|
604
626
|
|
|
627
|
+
);
|
|
628
|
+
#endif
|
|
629
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_CREATE_TRANSPARENT_PCZT_FOR_SWAPKIT
|
|
630
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_CREATE_TRANSPARENT_PCZT_FOR_SWAPKIT
|
|
631
|
+
uint16_t uniffi_keystone_wallet_core_checksum_func_create_transparent_pczt_for_swapkit(void
|
|
632
|
+
|
|
605
633
|
);
|
|
606
634
|
#endif
|
|
607
635
|
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_DERIVE_ADDRESS_BY_PATH_ADA
|
|
@@ -628,15 +656,9 @@ uint16_t uniffi_keystone_wallet_core_checksum_func_derive_stake_address_ada(void
|
|
|
628
656
|
|
|
629
657
|
);
|
|
630
658
|
#endif
|
|
631
|
-
#ifndef
|
|
632
|
-
#define
|
|
633
|
-
uint16_t
|
|
634
|
-
|
|
635
|
-
);
|
|
636
|
-
#endif
|
|
637
|
-
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_EXTRACT_PCZT_TRANSACTION
|
|
638
|
-
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_EXTRACT_PCZT_TRANSACTION
|
|
639
|
-
uint16_t uniffi_keystone_wallet_core_checksum_func_extract_pczt_transaction(void
|
|
659
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_FINALIZE_THEN_EXTRACT_PCZT_TRANSACTION
|
|
660
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_FINALIZE_THEN_EXTRACT_PCZT_TRANSACTION
|
|
661
|
+
uint16_t uniffi_keystone_wallet_core_checksum_func_finalize_then_extract_pczt_transaction(void
|
|
640
662
|
|
|
641
663
|
);
|
|
642
664
|
#endif
|
|
Binary file
|
|
@@ -8,7 +8,15 @@ RCT_EXTERN_METHOD(createTransparentPczt:(NSArray *)inputs
|
|
|
8
8
|
resolve:(RCTPromiseResolveBlock)resolve
|
|
9
9
|
reject:(RCTPromiseRejectBlock)reject)
|
|
10
10
|
|
|
11
|
-
RCT_EXTERN_METHOD(
|
|
11
|
+
RCT_EXTERN_METHOD(createTransparentPcztForSwapkit:(NSString *)pcztHex
|
|
12
|
+
blockHeight:(double)blockHeight
|
|
13
|
+
pubkeyHex:(NSString *)pubkeyHex
|
|
14
|
+
fingerprintHex:(NSString *)fingerprintHex
|
|
15
|
+
path:(NSString *)path
|
|
16
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
17
|
+
reject:(RCTPromiseRejectBlock)reject)
|
|
18
|
+
|
|
19
|
+
RCT_EXTERN_METHOD(finalizeThenExtractPcztTransaction:(NSString *)pcztHex
|
|
12
20
|
resolve:(RCTPromiseResolveBlock)resolve
|
|
13
21
|
reject:(RCTPromiseRejectBlock)reject)
|
|
14
22
|
|
|
@@ -34,4 +42,18 @@ RCT_EXTERN_METHOD(deriveStakeAddressAda:(NSString *)accountXpubHex
|
|
|
34
42
|
resolve:(RCTPromiseResolveBlock)resolve
|
|
35
43
|
reject:(RCTPromiseRejectBlock)reject)
|
|
36
44
|
|
|
45
|
+
RCT_EXTERN_METHOD(composeTransactionAda:(NSArray *)inputs
|
|
46
|
+
outputs:(NSArray *)outputs
|
|
47
|
+
changeAddress:(NSString *)changeAddress
|
|
48
|
+
fee:(double)fee
|
|
49
|
+
ttl:(double)ttl
|
|
50
|
+
network:(NSString *)network
|
|
51
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
52
|
+
reject:(RCTPromiseRejectBlock)reject)
|
|
53
|
+
|
|
54
|
+
RCT_EXTERN_METHOD(assembleTransactionAda:(NSString *)rawTxHex
|
|
55
|
+
witnessSetHex:(NSString *)witnessSetHex
|
|
56
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
57
|
+
reject:(RCTPromiseRejectBlock)reject)
|
|
58
|
+
|
|
37
59
|
@end
|
|
@@ -43,11 +43,38 @@ public class KeystoneWalletCoreModule: NSObject {
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
@objc(
|
|
47
|
-
func
|
|
46
|
+
@objc(createTransparentPcztForSwapkit:blockHeight:pubkeyHex:fingerprintHex:path:resolve:reject:)
|
|
47
|
+
func createTransparentPcztForSwapkitBridge(
|
|
48
|
+
pcztHex: String,
|
|
49
|
+
blockHeight: Double,
|
|
50
|
+
pubkeyHex: String,
|
|
51
|
+
fingerprintHex: String,
|
|
52
|
+
path: String,
|
|
53
|
+
resolve: @escaping RCTPromiseResolveBlock,
|
|
54
|
+
reject: @escaping RCTPromiseRejectBlock
|
|
55
|
+
) {
|
|
56
|
+
do {
|
|
57
|
+
let result = try createTransparentPcztForSwapkit(
|
|
58
|
+
pcztHex: pcztHex,
|
|
59
|
+
blockHeight: UInt32(blockHeight),
|
|
60
|
+
pubkeyHex: pubkeyHex,
|
|
61
|
+
fingerprintHex: fingerprintHex,
|
|
62
|
+
pathStr: path
|
|
63
|
+
)
|
|
64
|
+
resolve(result)
|
|
65
|
+
} catch {
|
|
66
|
+
reject("ERR_PCZT", "Create PCZT failed", error)
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@objc(finalizeThenExtractPcztTransaction:resolve:reject:)
|
|
71
|
+
func finalizeThenExtractPcztTransactionBridge(_ pcztHex: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
|
48
72
|
do {
|
|
49
|
-
let result = try
|
|
50
|
-
resolve(
|
|
73
|
+
let result = try finalizeThenExtractPcztTransaction(pcztHex: pcztHex)
|
|
74
|
+
resolve([
|
|
75
|
+
"txId": result.txId,
|
|
76
|
+
"txHex": result.txHex
|
|
77
|
+
])
|
|
51
78
|
} catch {
|
|
52
79
|
reject("PCZT_ERROR", error.localizedDescription, error)
|
|
53
80
|
}
|
|
@@ -109,4 +136,64 @@ public class KeystoneWalletCoreModule: NSObject {
|
|
|
109
136
|
reject("CARDANO_ERROR", error.localizedDescription, error)
|
|
110
137
|
}
|
|
111
138
|
}
|
|
139
|
+
|
|
140
|
+
@objc(composeTransactionAda:outputs:changeAddress:fee:ttl:network:resolve:reject:)
|
|
141
|
+
func composeTransactionAdaBridge(
|
|
142
|
+
_ inputs: [NSDictionary],
|
|
143
|
+
outputs: [NSDictionary],
|
|
144
|
+
changeAddress: String,
|
|
145
|
+
fee: Double,
|
|
146
|
+
ttl: Double,
|
|
147
|
+
network: String,
|
|
148
|
+
resolve: @escaping RCTPromiseResolveBlock,
|
|
149
|
+
reject: @escaping RCTPromiseRejectBlock
|
|
150
|
+
) {
|
|
151
|
+
do {
|
|
152
|
+
let swiftInputs = try inputs.map { dict -> CardanoTxInput in
|
|
153
|
+
guard let txHash = dict["txHash"] as? String,
|
|
154
|
+
let txIndex = (dict["txIndex"] as? NSNumber)?.uint32Value,
|
|
155
|
+
let amount = (dict["amount"] as? NSNumber)?.uint64Value
|
|
156
|
+
else {
|
|
157
|
+
throw NSError(domain: "CardanoModule", code: 1, userInfo: [NSLocalizedDescriptionKey: "Invalid input format"])
|
|
158
|
+
}
|
|
159
|
+
return CardanoTxInput(txHash: txHash, txIndex: txIndex, amount: amount)
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
let swiftOutputs = try outputs.map { dict -> CardanoTxOutput in
|
|
163
|
+
guard let address = dict["address"] as? String,
|
|
164
|
+
let amount = (dict["amount"] as? NSNumber)?.uint64Value,
|
|
165
|
+
let isChange = dict["isChange"] as? Bool
|
|
166
|
+
else {
|
|
167
|
+
throw NSError(domain: "CardanoModule", code: 1, userInfo: [NSLocalizedDescriptionKey: "Invalid output format"])
|
|
168
|
+
}
|
|
169
|
+
return CardanoTxOutput(address: address, amount: amount, isChange: isChange)
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
let adaNetwork = try getCardanoNetwork(network: network)
|
|
173
|
+
let result = try composeTransactionAda(
|
|
174
|
+
inputs: swiftInputs,
|
|
175
|
+
outputs: swiftOutputs,
|
|
176
|
+
changeAddress: changeAddress,
|
|
177
|
+
fee: UInt64(fee),
|
|
178
|
+
ttl: UInt64(ttl),
|
|
179
|
+
network: adaNetwork
|
|
180
|
+
)
|
|
181
|
+
resolve(result)
|
|
182
|
+
} catch {
|
|
183
|
+
reject("CARDANO_ERROR", error.localizedDescription, error)
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
@objc(assembleTransactionAda:witnessSetHex:resolve:reject:)
|
|
188
|
+
func assembleTransactionAdaBridge(_ rawTxHex: String, witnessSetHex: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
|
189
|
+
do {
|
|
190
|
+
let result = try assembleTransactionAda(rawTxHex: rawTxHex, witnessSetHex: witnessSetHex)
|
|
191
|
+
resolve([
|
|
192
|
+
"txId": result.txId,
|
|
193
|
+
"txHex": result.txHex
|
|
194
|
+
])
|
|
195
|
+
} catch {
|
|
196
|
+
reject("CARDANO_ERROR", error.localizedDescription, error)
|
|
197
|
+
}
|
|
198
|
+
}
|
|
112
199
|
}
|
|
@@ -442,6 +442,30 @@ fileprivate struct FfiConverterUInt64: FfiConverterPrimitive {
|
|
|
442
442
|
}
|
|
443
443
|
}
|
|
444
444
|
|
|
445
|
+
#if swift(>=5.8)
|
|
446
|
+
@_documentation(visibility: private)
|
|
447
|
+
#endif
|
|
448
|
+
fileprivate struct FfiConverterBool : FfiConverter {
|
|
449
|
+
typealias FfiType = Int8
|
|
450
|
+
typealias SwiftType = Bool
|
|
451
|
+
|
|
452
|
+
public static func lift(_ value: Int8) throws -> Bool {
|
|
453
|
+
return value != 0
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
public static func lower(_ value: Bool) -> Int8 {
|
|
457
|
+
return value ? 1 : 0
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> Bool {
|
|
461
|
+
return try lift(readInt(&buf))
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
public static func write(_ value: Bool, into buf: inout [UInt8]) {
|
|
465
|
+
writeInt(&buf, lower(value))
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
|
|
445
469
|
#if swift(>=5.8)
|
|
446
470
|
@_documentation(visibility: private)
|
|
447
471
|
#endif
|
|
@@ -604,6 +628,154 @@ public func FfiConverterTypePczt_lower(_ value: Pczt) -> UnsafeMutableRawPointer
|
|
|
604
628
|
}
|
|
605
629
|
|
|
606
630
|
|
|
631
|
+
public struct CardanoTxInput {
|
|
632
|
+
public var txHash: String
|
|
633
|
+
public var txIndex: UInt32
|
|
634
|
+
public var amount: UInt64
|
|
635
|
+
|
|
636
|
+
// Default memberwise initializers are never public by default, so we
|
|
637
|
+
// declare one manually.
|
|
638
|
+
public init(txHash: String, txIndex: UInt32, amount: UInt64) {
|
|
639
|
+
self.txHash = txHash
|
|
640
|
+
self.txIndex = txIndex
|
|
641
|
+
self.amount = amount
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
|
|
646
|
+
|
|
647
|
+
extension CardanoTxInput: Equatable, Hashable {
|
|
648
|
+
public static func ==(lhs: CardanoTxInput, rhs: CardanoTxInput) -> Bool {
|
|
649
|
+
if lhs.txHash != rhs.txHash {
|
|
650
|
+
return false
|
|
651
|
+
}
|
|
652
|
+
if lhs.txIndex != rhs.txIndex {
|
|
653
|
+
return false
|
|
654
|
+
}
|
|
655
|
+
if lhs.amount != rhs.amount {
|
|
656
|
+
return false
|
|
657
|
+
}
|
|
658
|
+
return true
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
public func hash(into hasher: inout Hasher) {
|
|
662
|
+
hasher.combine(txHash)
|
|
663
|
+
hasher.combine(txIndex)
|
|
664
|
+
hasher.combine(amount)
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
|
|
669
|
+
#if swift(>=5.8)
|
|
670
|
+
@_documentation(visibility: private)
|
|
671
|
+
#endif
|
|
672
|
+
public struct FfiConverterTypeCardanoTxInput: FfiConverterRustBuffer {
|
|
673
|
+
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> CardanoTxInput {
|
|
674
|
+
return
|
|
675
|
+
try CardanoTxInput(
|
|
676
|
+
txHash: FfiConverterString.read(from: &buf),
|
|
677
|
+
txIndex: FfiConverterUInt32.read(from: &buf),
|
|
678
|
+
amount: FfiConverterUInt64.read(from: &buf)
|
|
679
|
+
)
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
public static func write(_ value: CardanoTxInput, into buf: inout [UInt8]) {
|
|
683
|
+
FfiConverterString.write(value.txHash, into: &buf)
|
|
684
|
+
FfiConverterUInt32.write(value.txIndex, into: &buf)
|
|
685
|
+
FfiConverterUInt64.write(value.amount, into: &buf)
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
|
|
690
|
+
#if swift(>=5.8)
|
|
691
|
+
@_documentation(visibility: private)
|
|
692
|
+
#endif
|
|
693
|
+
public func FfiConverterTypeCardanoTxInput_lift(_ buf: RustBuffer) throws -> CardanoTxInput {
|
|
694
|
+
return try FfiConverterTypeCardanoTxInput.lift(buf)
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
#if swift(>=5.8)
|
|
698
|
+
@_documentation(visibility: private)
|
|
699
|
+
#endif
|
|
700
|
+
public func FfiConverterTypeCardanoTxInput_lower(_ value: CardanoTxInput) -> RustBuffer {
|
|
701
|
+
return FfiConverterTypeCardanoTxInput.lower(value)
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
|
|
705
|
+
public struct CardanoTxOutput {
|
|
706
|
+
public var address: String
|
|
707
|
+
public var amount: UInt64
|
|
708
|
+
public var isChange: Bool
|
|
709
|
+
|
|
710
|
+
// Default memberwise initializers are never public by default, so we
|
|
711
|
+
// declare one manually.
|
|
712
|
+
public init(address: String, amount: UInt64, isChange: Bool) {
|
|
713
|
+
self.address = address
|
|
714
|
+
self.amount = amount
|
|
715
|
+
self.isChange = isChange
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
|
|
720
|
+
|
|
721
|
+
extension CardanoTxOutput: Equatable, Hashable {
|
|
722
|
+
public static func ==(lhs: CardanoTxOutput, rhs: CardanoTxOutput) -> Bool {
|
|
723
|
+
if lhs.address != rhs.address {
|
|
724
|
+
return false
|
|
725
|
+
}
|
|
726
|
+
if lhs.amount != rhs.amount {
|
|
727
|
+
return false
|
|
728
|
+
}
|
|
729
|
+
if lhs.isChange != rhs.isChange {
|
|
730
|
+
return false
|
|
731
|
+
}
|
|
732
|
+
return true
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
public func hash(into hasher: inout Hasher) {
|
|
736
|
+
hasher.combine(address)
|
|
737
|
+
hasher.combine(amount)
|
|
738
|
+
hasher.combine(isChange)
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
|
|
743
|
+
#if swift(>=5.8)
|
|
744
|
+
@_documentation(visibility: private)
|
|
745
|
+
#endif
|
|
746
|
+
public struct FfiConverterTypeCardanoTxOutput: FfiConverterRustBuffer {
|
|
747
|
+
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> CardanoTxOutput {
|
|
748
|
+
return
|
|
749
|
+
try CardanoTxOutput(
|
|
750
|
+
address: FfiConverterString.read(from: &buf),
|
|
751
|
+
amount: FfiConverterUInt64.read(from: &buf),
|
|
752
|
+
isChange: FfiConverterBool.read(from: &buf)
|
|
753
|
+
)
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
public static func write(_ value: CardanoTxOutput, into buf: inout [UInt8]) {
|
|
757
|
+
FfiConverterString.write(value.address, into: &buf)
|
|
758
|
+
FfiConverterUInt64.write(value.amount, into: &buf)
|
|
759
|
+
FfiConverterBool.write(value.isChange, into: &buf)
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
|
|
764
|
+
#if swift(>=5.8)
|
|
765
|
+
@_documentation(visibility: private)
|
|
766
|
+
#endif
|
|
767
|
+
public func FfiConverterTypeCardanoTxOutput_lift(_ buf: RustBuffer) throws -> CardanoTxOutput {
|
|
768
|
+
return try FfiConverterTypeCardanoTxOutput.lift(buf)
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
#if swift(>=5.8)
|
|
772
|
+
@_documentation(visibility: private)
|
|
773
|
+
#endif
|
|
774
|
+
public func FfiConverterTypeCardanoTxOutput_lower(_ value: CardanoTxOutput) -> RustBuffer {
|
|
775
|
+
return FfiConverterTypeCardanoTxOutput.lower(value)
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
|
|
607
779
|
public struct DerivedKeys {
|
|
608
780
|
public var paymentPubkeyHex: String
|
|
609
781
|
public var stakePubkeyHex: String
|
|
@@ -670,6 +842,72 @@ public func FfiConverterTypeDerivedKeys_lower(_ value: DerivedKeys) -> RustBuffe
|
|
|
670
842
|
}
|
|
671
843
|
|
|
672
844
|
|
|
845
|
+
public struct SignedTxResult {
|
|
846
|
+
public var txId: String
|
|
847
|
+
public var txHex: String
|
|
848
|
+
|
|
849
|
+
// Default memberwise initializers are never public by default, so we
|
|
850
|
+
// declare one manually.
|
|
851
|
+
public init(txId: String, txHex: String) {
|
|
852
|
+
self.txId = txId
|
|
853
|
+
self.txHex = txHex
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
|
|
858
|
+
|
|
859
|
+
extension SignedTxResult: Equatable, Hashable {
|
|
860
|
+
public static func ==(lhs: SignedTxResult, rhs: SignedTxResult) -> Bool {
|
|
861
|
+
if lhs.txId != rhs.txId {
|
|
862
|
+
return false
|
|
863
|
+
}
|
|
864
|
+
if lhs.txHex != rhs.txHex {
|
|
865
|
+
return false
|
|
866
|
+
}
|
|
867
|
+
return true
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
public func hash(into hasher: inout Hasher) {
|
|
871
|
+
hasher.combine(txId)
|
|
872
|
+
hasher.combine(txHex)
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
|
|
877
|
+
#if swift(>=5.8)
|
|
878
|
+
@_documentation(visibility: private)
|
|
879
|
+
#endif
|
|
880
|
+
public struct FfiConverterTypeSignedTxResult: FfiConverterRustBuffer {
|
|
881
|
+
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SignedTxResult {
|
|
882
|
+
return
|
|
883
|
+
try SignedTxResult(
|
|
884
|
+
txId: FfiConverterString.read(from: &buf),
|
|
885
|
+
txHex: FfiConverterString.read(from: &buf)
|
|
886
|
+
)
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
public static func write(_ value: SignedTxResult, into buf: inout [UInt8]) {
|
|
890
|
+
FfiConverterString.write(value.txId, into: &buf)
|
|
891
|
+
FfiConverterString.write(value.txHex, into: &buf)
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
|
|
896
|
+
#if swift(>=5.8)
|
|
897
|
+
@_documentation(visibility: private)
|
|
898
|
+
#endif
|
|
899
|
+
public func FfiConverterTypeSignedTxResult_lift(_ buf: RustBuffer) throws -> SignedTxResult {
|
|
900
|
+
return try FfiConverterTypeSignedTxResult.lift(buf)
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
#if swift(>=5.8)
|
|
904
|
+
@_documentation(visibility: private)
|
|
905
|
+
#endif
|
|
906
|
+
public func FfiConverterTypeSignedTxResult_lower(_ value: SignedTxResult) -> RustBuffer {
|
|
907
|
+
return FfiConverterTypeSignedTxResult.lower(value)
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
|
|
673
911
|
public struct TransparentInput {
|
|
674
912
|
public var txid: String
|
|
675
913
|
public var vout: UInt32
|
|
@@ -841,6 +1079,72 @@ public func FfiConverterTypeTransparentOutput_lower(_ value: TransparentOutput)
|
|
|
841
1079
|
return FfiConverterTypeTransparentOutput.lower(value)
|
|
842
1080
|
}
|
|
843
1081
|
|
|
1082
|
+
|
|
1083
|
+
public struct ZcashTxResult {
|
|
1084
|
+
public var txId: String
|
|
1085
|
+
public var txHex: String
|
|
1086
|
+
|
|
1087
|
+
// Default memberwise initializers are never public by default, so we
|
|
1088
|
+
// declare one manually.
|
|
1089
|
+
public init(txId: String, txHex: String) {
|
|
1090
|
+
self.txId = txId
|
|
1091
|
+
self.txHex = txHex
|
|
1092
|
+
}
|
|
1093
|
+
}
|
|
1094
|
+
|
|
1095
|
+
|
|
1096
|
+
|
|
1097
|
+
extension ZcashTxResult: Equatable, Hashable {
|
|
1098
|
+
public static func ==(lhs: ZcashTxResult, rhs: ZcashTxResult) -> Bool {
|
|
1099
|
+
if lhs.txId != rhs.txId {
|
|
1100
|
+
return false
|
|
1101
|
+
}
|
|
1102
|
+
if lhs.txHex != rhs.txHex {
|
|
1103
|
+
return false
|
|
1104
|
+
}
|
|
1105
|
+
return true
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1108
|
+
public func hash(into hasher: inout Hasher) {
|
|
1109
|
+
hasher.combine(txId)
|
|
1110
|
+
hasher.combine(txHex)
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1113
|
+
|
|
1114
|
+
|
|
1115
|
+
#if swift(>=5.8)
|
|
1116
|
+
@_documentation(visibility: private)
|
|
1117
|
+
#endif
|
|
1118
|
+
public struct FfiConverterTypeZcashTxResult: FfiConverterRustBuffer {
|
|
1119
|
+
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ZcashTxResult {
|
|
1120
|
+
return
|
|
1121
|
+
try ZcashTxResult(
|
|
1122
|
+
txId: FfiConverterString.read(from: &buf),
|
|
1123
|
+
txHex: FfiConverterString.read(from: &buf)
|
|
1124
|
+
)
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1127
|
+
public static func write(_ value: ZcashTxResult, into buf: inout [UInt8]) {
|
|
1128
|
+
FfiConverterString.write(value.txId, into: &buf)
|
|
1129
|
+
FfiConverterString.write(value.txHex, into: &buf)
|
|
1130
|
+
}
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
|
+
|
|
1134
|
+
#if swift(>=5.8)
|
|
1135
|
+
@_documentation(visibility: private)
|
|
1136
|
+
#endif
|
|
1137
|
+
public func FfiConverterTypeZcashTxResult_lift(_ buf: RustBuffer) throws -> ZcashTxResult {
|
|
1138
|
+
return try FfiConverterTypeZcashTxResult.lift(buf)
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1141
|
+
#if swift(>=5.8)
|
|
1142
|
+
@_documentation(visibility: private)
|
|
1143
|
+
#endif
|
|
1144
|
+
public func FfiConverterTypeZcashTxResult_lower(_ value: ZcashTxResult) -> RustBuffer {
|
|
1145
|
+
return FfiConverterTypeZcashTxResult.lower(value)
|
|
1146
|
+
}
|
|
1147
|
+
|
|
844
1148
|
// Note that we don't yet support `indirect` for enums.
|
|
845
1149
|
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
|
|
846
1150
|
|
|
@@ -1104,6 +1408,56 @@ fileprivate struct FfiConverterSequenceUInt8: FfiConverterRustBuffer {
|
|
|
1104
1408
|
}
|
|
1105
1409
|
}
|
|
1106
1410
|
|
|
1411
|
+
#if swift(>=5.8)
|
|
1412
|
+
@_documentation(visibility: private)
|
|
1413
|
+
#endif
|
|
1414
|
+
fileprivate struct FfiConverterSequenceTypeCardanoTxInput: FfiConverterRustBuffer {
|
|
1415
|
+
typealias SwiftType = [CardanoTxInput]
|
|
1416
|
+
|
|
1417
|
+
public static func write(_ value: [CardanoTxInput], into buf: inout [UInt8]) {
|
|
1418
|
+
let len = Int32(value.count)
|
|
1419
|
+
writeInt(&buf, len)
|
|
1420
|
+
for item in value {
|
|
1421
|
+
FfiConverterTypeCardanoTxInput.write(item, into: &buf)
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1424
|
+
|
|
1425
|
+
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [CardanoTxInput] {
|
|
1426
|
+
let len: Int32 = try readInt(&buf)
|
|
1427
|
+
var seq = [CardanoTxInput]()
|
|
1428
|
+
seq.reserveCapacity(Int(len))
|
|
1429
|
+
for _ in 0 ..< len {
|
|
1430
|
+
seq.append(try FfiConverterTypeCardanoTxInput.read(from: &buf))
|
|
1431
|
+
}
|
|
1432
|
+
return seq
|
|
1433
|
+
}
|
|
1434
|
+
}
|
|
1435
|
+
|
|
1436
|
+
#if swift(>=5.8)
|
|
1437
|
+
@_documentation(visibility: private)
|
|
1438
|
+
#endif
|
|
1439
|
+
fileprivate struct FfiConverterSequenceTypeCardanoTxOutput: FfiConverterRustBuffer {
|
|
1440
|
+
typealias SwiftType = [CardanoTxOutput]
|
|
1441
|
+
|
|
1442
|
+
public static func write(_ value: [CardanoTxOutput], into buf: inout [UInt8]) {
|
|
1443
|
+
let len = Int32(value.count)
|
|
1444
|
+
writeInt(&buf, len)
|
|
1445
|
+
for item in value {
|
|
1446
|
+
FfiConverterTypeCardanoTxOutput.write(item, into: &buf)
|
|
1447
|
+
}
|
|
1448
|
+
}
|
|
1449
|
+
|
|
1450
|
+
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> [CardanoTxOutput] {
|
|
1451
|
+
let len: Int32 = try readInt(&buf)
|
|
1452
|
+
var seq = [CardanoTxOutput]()
|
|
1453
|
+
seq.reserveCapacity(Int(len))
|
|
1454
|
+
for _ in 0 ..< len {
|
|
1455
|
+
seq.append(try FfiConverterTypeCardanoTxOutput.read(from: &buf))
|
|
1456
|
+
}
|
|
1457
|
+
return seq
|
|
1458
|
+
}
|
|
1459
|
+
}
|
|
1460
|
+
|
|
1107
1461
|
#if swift(>=5.8)
|
|
1108
1462
|
@_documentation(visibility: private)
|
|
1109
1463
|
#endif
|
|
@@ -1153,6 +1507,26 @@ fileprivate struct FfiConverterSequenceTypeTransparentOutput: FfiConverterRustBu
|
|
|
1153
1507
|
return seq
|
|
1154
1508
|
}
|
|
1155
1509
|
}
|
|
1510
|
+
public func assembleTransactionAda(rawTxHex: String, witnessSetHex: String)throws -> SignedTxResult {
|
|
1511
|
+
return try FfiConverterTypeSignedTxResult.lift(try rustCallWithError(FfiConverterTypeWalletError.lift) {
|
|
1512
|
+
uniffi_keystone_wallet_core_fn_func_assemble_transaction_ada(
|
|
1513
|
+
FfiConverterString.lower(rawTxHex),
|
|
1514
|
+
FfiConverterString.lower(witnessSetHex),$0
|
|
1515
|
+
)
|
|
1516
|
+
})
|
|
1517
|
+
}
|
|
1518
|
+
public func composeTransactionAda(inputs: [CardanoTxInput], outputs: [CardanoTxOutput], changeAddress: String, fee: UInt64, ttl: UInt64, network: CardanoNetwork)throws -> String {
|
|
1519
|
+
return try FfiConverterString.lift(try rustCallWithError(FfiConverterTypeWalletError.lift) {
|
|
1520
|
+
uniffi_keystone_wallet_core_fn_func_compose_transaction_ada(
|
|
1521
|
+
FfiConverterSequenceTypeCardanoTxInput.lower(inputs),
|
|
1522
|
+
FfiConverterSequenceTypeCardanoTxOutput.lower(outputs),
|
|
1523
|
+
FfiConverterString.lower(changeAddress),
|
|
1524
|
+
FfiConverterUInt64.lower(fee),
|
|
1525
|
+
FfiConverterUInt64.lower(ttl),
|
|
1526
|
+
FfiConverterTypeCardanoNetwork.lower(network),$0
|
|
1527
|
+
)
|
|
1528
|
+
})
|
|
1529
|
+
}
|
|
1156
1530
|
public func createPczt(consensusBranchId: UInt32, expiryHeight: UInt32, coinType: UInt32)throws -> Pczt {
|
|
1157
1531
|
return try FfiConverterTypePczt.lift(try rustCallWithError(FfiConverterTypePcztError.lift) {
|
|
1158
1532
|
uniffi_keystone_wallet_core_fn_func_create_pczt(
|
|
@@ -1171,6 +1545,17 @@ public func createTransparentPczt(inputs: [TransparentInput], outputs: [Transpar
|
|
|
1171
1545
|
)
|
|
1172
1546
|
})
|
|
1173
1547
|
}
|
|
1548
|
+
public func createTransparentPcztForSwapkit(pcztHex: String, blockHeight: UInt32, pubkeyHex: String, fingerprintHex: String, pathStr: String)throws -> String {
|
|
1549
|
+
return try FfiConverterString.lift(try rustCallWithError(FfiConverterTypePcztError.lift) {
|
|
1550
|
+
uniffi_keystone_wallet_core_fn_func_create_transparent_pczt_for_swapkit(
|
|
1551
|
+
FfiConverterString.lower(pcztHex),
|
|
1552
|
+
FfiConverterUInt32.lower(blockHeight),
|
|
1553
|
+
FfiConverterString.lower(pubkeyHex),
|
|
1554
|
+
FfiConverterString.lower(fingerprintHex),
|
|
1555
|
+
FfiConverterString.lower(pathStr),$0
|
|
1556
|
+
)
|
|
1557
|
+
})
|
|
1558
|
+
}
|
|
1174
1559
|
public func deriveAddressByPathAda(accountXpubHex: String, path: String, network: CardanoNetwork)throws -> String {
|
|
1175
1560
|
return try FfiConverterString.lift(try rustCallWithError(FfiConverterTypeWalletError.lift) {
|
|
1176
1561
|
uniffi_keystone_wallet_core_fn_func_derive_address_by_path_ada(
|
|
@@ -1205,18 +1590,9 @@ public func deriveStakeAddressAda(accountXpubHex: String, network: CardanoNetwor
|
|
|
1205
1590
|
)
|
|
1206
1591
|
})
|
|
1207
1592
|
}
|
|
1208
|
-
public func
|
|
1209
|
-
return try
|
|
1210
|
-
|
|
1211
|
-
FfiConverterString.lower(pcztHex),
|
|
1212
|
-
FfiConverterUInt32.lower(expiryHeight),
|
|
1213
|
-
FfiConverterString.lower(privateKeyHex),$0
|
|
1214
|
-
)
|
|
1215
|
-
})
|
|
1216
|
-
}
|
|
1217
|
-
public func extractPcztTransaction(pcztHex: String)throws -> String {
|
|
1218
|
-
return try FfiConverterString.lift(try rustCallWithError(FfiConverterTypePcztError.lift) {
|
|
1219
|
-
uniffi_keystone_wallet_core_fn_func_extract_pczt_transaction(
|
|
1593
|
+
public func finalizeThenExtractPcztTransaction(pcztHex: String)throws -> ZcashTxResult {
|
|
1594
|
+
return try FfiConverterTypeZcashTxResult.lift(try rustCallWithError(FfiConverterTypePcztError.lift) {
|
|
1595
|
+
uniffi_keystone_wallet_core_fn_func_finalize_then_extract_pczt_transaction(
|
|
1220
1596
|
FfiConverterString.lower(pcztHex),$0
|
|
1221
1597
|
)
|
|
1222
1598
|
})
|
|
@@ -1242,12 +1618,21 @@ private var initializationResult: InitializationResult = {
|
|
|
1242
1618
|
if bindings_contract_version != scaffolding_contract_version {
|
|
1243
1619
|
return InitializationResult.contractVersionMismatch
|
|
1244
1620
|
}
|
|
1621
|
+
if (uniffi_keystone_wallet_core_checksum_func_assemble_transaction_ada() != 22105) {
|
|
1622
|
+
return InitializationResult.apiChecksumMismatch
|
|
1623
|
+
}
|
|
1624
|
+
if (uniffi_keystone_wallet_core_checksum_func_compose_transaction_ada() != 48909) {
|
|
1625
|
+
return InitializationResult.apiChecksumMismatch
|
|
1626
|
+
}
|
|
1245
1627
|
if (uniffi_keystone_wallet_core_checksum_func_create_pczt() != 11746) {
|
|
1246
1628
|
return InitializationResult.apiChecksumMismatch
|
|
1247
1629
|
}
|
|
1248
1630
|
if (uniffi_keystone_wallet_core_checksum_func_create_transparent_pczt() != 17127) {
|
|
1249
1631
|
return InitializationResult.apiChecksumMismatch
|
|
1250
1632
|
}
|
|
1633
|
+
if (uniffi_keystone_wallet_core_checksum_func_create_transparent_pczt_for_swapkit() != 2710) {
|
|
1634
|
+
return InitializationResult.apiChecksumMismatch
|
|
1635
|
+
}
|
|
1251
1636
|
if (uniffi_keystone_wallet_core_checksum_func_derive_address_by_path_ada() != 24523) {
|
|
1252
1637
|
return InitializationResult.apiChecksumMismatch
|
|
1253
1638
|
}
|
|
@@ -1260,10 +1645,7 @@ private var initializationResult: InitializationResult = {
|
|
|
1260
1645
|
if (uniffi_keystone_wallet_core_checksum_func_derive_stake_address_ada() != 22900) {
|
|
1261
1646
|
return InitializationResult.apiChecksumMismatch
|
|
1262
1647
|
}
|
|
1263
|
-
if (
|
|
1264
|
-
return InitializationResult.apiChecksumMismatch
|
|
1265
|
-
}
|
|
1266
|
-
if (uniffi_keystone_wallet_core_checksum_func_extract_pczt_transaction() != 4075) {
|
|
1648
|
+
if (uniffi_keystone_wallet_core_checksum_func_finalize_then_extract_pczt_transaction() != 47467) {
|
|
1267
1649
|
return InitializationResult.apiChecksumMismatch
|
|
1268
1650
|
}
|
|
1269
1651
|
if (uniffi_keystone_wallet_core_checksum_func_hello() != 6912) {
|
package/lib/commonjs/index.js
CHANGED
|
@@ -4,12 +4,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.CardanoNetwork = void 0;
|
|
7
|
+
exports.assembleTransactionAda = assembleTransactionAda;
|
|
8
|
+
exports.composeTransactionAda = composeTransactionAda;
|
|
7
9
|
exports.createTransparentPczt = createTransparentPczt;
|
|
10
|
+
exports.createTransparentPcztForSwapkit = createTransparentPcztForSwapkit;
|
|
8
11
|
exports.deriveAddressByPathAda = deriveAddressByPathAda;
|
|
9
12
|
exports.deriveEnterpriseAddressByPathAda = deriveEnterpriseAddressByPathAda;
|
|
10
13
|
exports.derivePubkeyByPathAda = derivePubkeyByPathAda;
|
|
11
14
|
exports.deriveStakeAddressAda = deriveStakeAddressAda;
|
|
12
|
-
exports.
|
|
15
|
+
exports.finalizeThenExtractPcztTransaction = finalizeThenExtractPcztTransaction;
|
|
13
16
|
var _reactNative = require("react-native");
|
|
14
17
|
const LINKING_ERROR = `The package 'react-native-keystone-wallet-core' doesn't seem to be linked. Make sure: \n\n` + (_reactNative.Platform.select({
|
|
15
18
|
ios: "- You have run 'pod install'\n",
|
|
@@ -23,8 +26,11 @@ const KeystoneWalletCoreModule = _reactNative.NativeModules.KeystoneWalletCoreMo
|
|
|
23
26
|
function createTransparentPczt(inputs, outputs, blockHeight) {
|
|
24
27
|
return KeystoneWalletCoreModule.createTransparentPczt(inputs, outputs, blockHeight);
|
|
25
28
|
}
|
|
26
|
-
function
|
|
27
|
-
return KeystoneWalletCoreModule.
|
|
29
|
+
function finalizeThenExtractPcztTransaction(pcztHex) {
|
|
30
|
+
return KeystoneWalletCoreModule.finalizeThenExtractPcztTransaction(pcztHex);
|
|
31
|
+
}
|
|
32
|
+
function createTransparentPcztForSwapkit(pcztHex, blockHeight, pubkeyHex, fingerprintHex, path) {
|
|
33
|
+
return KeystoneWalletCoreModule.createTransparentPcztForSwapkit(pcztHex, blockHeight, pubkeyHex, fingerprintHex, path);
|
|
28
34
|
}
|
|
29
35
|
let CardanoNetwork = exports.CardanoNetwork = /*#__PURE__*/function (CardanoNetwork) {
|
|
30
36
|
CardanoNetwork["Mainnet"] = "Mainnet";
|
|
@@ -43,4 +49,10 @@ function deriveEnterpriseAddressByPathAda(accountXpubHex, path, network) {
|
|
|
43
49
|
function deriveStakeAddressAda(accountXpubHex, network) {
|
|
44
50
|
return KeystoneWalletCoreModule.deriveStakeAddressAda(accountXpubHex, network);
|
|
45
51
|
}
|
|
52
|
+
function composeTransactionAda(inputs, outputs, changeAddress, fee, ttl, network) {
|
|
53
|
+
return KeystoneWalletCoreModule.composeTransactionAda(inputs, outputs, changeAddress, fee, ttl, network);
|
|
54
|
+
}
|
|
55
|
+
function assembleTransactionAda(rawTxHex, witnessSetHex) {
|
|
56
|
+
return KeystoneWalletCoreModule.assembleTransactionAda(rawTxHex, witnessSetHex);
|
|
57
|
+
}
|
|
46
58
|
//# 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","
|
|
1
|
+
{"version":3,"names":["_reactNative","require","LINKING_ERROR","Platform","select","ios","default","KeystoneWalletCoreModule","NativeModules","Proxy","get","Error","createTransparentPczt","inputs","outputs","blockHeight","finalizeThenExtractPcztTransaction","pcztHex","createTransparentPcztForSwapkit","pubkeyHex","fingerprintHex","path","CardanoNetwork","exports","derivePubkeyByPathAda","accountXpubHex","deriveAddressByPathAda","network","deriveEnterpriseAddressByPathAda","deriveStakeAddressAda","composeTransactionAda","changeAddress","fee","ttl","assembleTransactionAda","rawTxHex","witnessSetHex"],"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;AAsBE,SAASU,qBAAqBA,CACnCC,MAA0B,EAC1BC,OAA4B,EAC5BC,WAAmB,EACF;EACjB,OAAOR,wBAAwB,CAACK,qBAAqB,CAACC,MAAM,EAAEC,OAAO,EAAEC,WAAW,CAAC;AACrF;AAEO,SAASC,kCAAkCA,CAACC,OAAe,EAA0B;EAC1F,OAAOV,wBAAwB,CAACS,kCAAkC,CAACC,OAAO,CAAC;AAC7E;AAEO,SAASC,+BAA+BA,CAC7CD,OAAe,EACfF,WAAmB,EACnBI,SAAiB,EACjBC,cAAsB,EACtBC,IAAY,EACK;EACjB,OAAOd,wBAAwB,CAACW,+BAA+B,CAC7DD,OAAO,EACPF,WAAW,EACXI,SAAS,EACTC,cAAc,EACdC,IACF,CAAC;AACH;AAAC,IAOWC,cAAc,GAAAC,OAAA,CAAAD,cAAA,0BAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA;AAKnB,SAASE,qBAAqBA,CACnCC,cAAsB,EACtBJ,IAAY,EACU;EACtB,OAAOd,wBAAwB,CAACiB,qBAAqB,CAACC,cAAc,EAAEJ,IAAI,CAAC;AAC7E;AAEO,SAASK,sBAAsBA,CACpCD,cAAsB,EACtBJ,IAAY,EACZM,OAAuB,EACN;EACjB,OAAOpB,wBAAwB,CAACmB,sBAAsB,CAACD,cAAc,EAAEJ,IAAI,EAAEM,OAAO,CAAC;AACvF;AAEO,SAASC,gCAAgCA,CAC9CH,cAAsB,EACtBJ,IAAY,EACZM,OAAuB,EACN;EACjB,OAAOpB,wBAAwB,CAACqB,gCAAgC,CAACH,cAAc,EAAEJ,IAAI,EAAEM,OAAO,CAAC;AACjG;AAEO,SAASE,qBAAqBA,CACnCJ,cAAsB,EACtBE,OAAuB,EACN;EACjB,OAAOpB,wBAAwB,CAACsB,qBAAqB,CAACJ,cAAc,EAAEE,OAAO,CAAC;AAChF;AAcO,SAASG,qBAAqBA,CACnCjB,MAAwB,EACxBC,OAA0B,EAC1BiB,aAAqB,EACrBC,GAAW,EACXC,GAAW,EACXN,OAAuB,EACN;EACjB,OAAOpB,wBAAwB,CAACuB,qBAAqB,CACnDjB,MAAM,EACNC,OAAO,EACPiB,aAAa,EACbC,GAAG,EACHC,GAAG,EACHN,OACF,CAAC;AACH;AAOO,SAASO,sBAAsBA,CACpCC,QAAgB,EAChBC,aAAqB,EACI;EACzB,OAAO7B,wBAAwB,CAAC2B,sBAAsB,CAACC,QAAQ,EAAEC,aAAa,CAAC;AACjF","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
|
@@ -11,8 +11,11 @@ const KeystoneWalletCoreModule = NativeModules.KeystoneWalletCoreModule ? Native
|
|
|
11
11
|
export function createTransparentPczt(inputs, outputs, blockHeight) {
|
|
12
12
|
return KeystoneWalletCoreModule.createTransparentPczt(inputs, outputs, blockHeight);
|
|
13
13
|
}
|
|
14
|
-
export function
|
|
15
|
-
return KeystoneWalletCoreModule.
|
|
14
|
+
export function finalizeThenExtractPcztTransaction(pcztHex) {
|
|
15
|
+
return KeystoneWalletCoreModule.finalizeThenExtractPcztTransaction(pcztHex);
|
|
16
|
+
}
|
|
17
|
+
export function createTransparentPcztForSwapkit(pcztHex, blockHeight, pubkeyHex, fingerprintHex, path) {
|
|
18
|
+
return KeystoneWalletCoreModule.createTransparentPcztForSwapkit(pcztHex, blockHeight, pubkeyHex, fingerprintHex, path);
|
|
16
19
|
}
|
|
17
20
|
export let CardanoNetwork = /*#__PURE__*/function (CardanoNetwork) {
|
|
18
21
|
CardanoNetwork["Mainnet"] = "Mainnet";
|
|
@@ -31,4 +34,10 @@ export function deriveEnterpriseAddressByPathAda(accountXpubHex, path, network)
|
|
|
31
34
|
export function deriveStakeAddressAda(accountXpubHex, network) {
|
|
32
35
|
return KeystoneWalletCoreModule.deriveStakeAddressAda(accountXpubHex, network);
|
|
33
36
|
}
|
|
37
|
+
export function composeTransactionAda(inputs, outputs, changeAddress, fee, ttl, network) {
|
|
38
|
+
return KeystoneWalletCoreModule.composeTransactionAda(inputs, outputs, changeAddress, fee, ttl, network);
|
|
39
|
+
}
|
|
40
|
+
export function assembleTransactionAda(rawTxHex, witnessSetHex) {
|
|
41
|
+
return KeystoneWalletCoreModule.assembleTransactionAda(rawTxHex, witnessSetHex);
|
|
42
|
+
}
|
|
34
43
|
//# 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","
|
|
1
|
+
{"version":3,"names":["NativeModules","Platform","LINKING_ERROR","select","ios","default","KeystoneWalletCoreModule","Proxy","get","Error","createTransparentPczt","inputs","outputs","blockHeight","finalizeThenExtractPcztTransaction","pcztHex","createTransparentPcztForSwapkit","pubkeyHex","fingerprintHex","path","CardanoNetwork","derivePubkeyByPathAda","accountXpubHex","deriveAddressByPathAda","network","deriveEnterpriseAddressByPathAda","deriveStakeAddressAda","composeTransactionAda","changeAddress","fee","ttl","assembleTransactionAda","rawTxHex","witnessSetHex"],"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;AAsBL,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,kCAAkCA,CAACC,OAAe,EAA0B;EAC1F,OAAOT,wBAAwB,CAACQ,kCAAkC,CAACC,OAAO,CAAC;AAC7E;AAEA,OAAO,SAASC,+BAA+BA,CAC7CD,OAAe,EACfF,WAAmB,EACnBI,SAAiB,EACjBC,cAAsB,EACtBC,IAAY,EACK;EACjB,OAAOb,wBAAwB,CAACU,+BAA+B,CAC7DD,OAAO,EACPF,WAAW,EACXI,SAAS,EACTC,cAAc,EACdC,IACF,CAAC;AACH;AAOA,WAAYC,cAAc,0BAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA;AAK1B,OAAO,SAASC,qBAAqBA,CACnCC,cAAsB,EACtBH,IAAY,EACU;EACtB,OAAOb,wBAAwB,CAACe,qBAAqB,CAACC,cAAc,EAAEH,IAAI,CAAC;AAC7E;AAEA,OAAO,SAASI,sBAAsBA,CACpCD,cAAsB,EACtBH,IAAY,EACZK,OAAuB,EACN;EACjB,OAAOlB,wBAAwB,CAACiB,sBAAsB,CAACD,cAAc,EAAEH,IAAI,EAAEK,OAAO,CAAC;AACvF;AAEA,OAAO,SAASC,gCAAgCA,CAC9CH,cAAsB,EACtBH,IAAY,EACZK,OAAuB,EACN;EACjB,OAAOlB,wBAAwB,CAACmB,gCAAgC,CAACH,cAAc,EAAEH,IAAI,EAAEK,OAAO,CAAC;AACjG;AAEA,OAAO,SAASE,qBAAqBA,CACnCJ,cAAsB,EACtBE,OAAuB,EACN;EACjB,OAAOlB,wBAAwB,CAACoB,qBAAqB,CAACJ,cAAc,EAAEE,OAAO,CAAC;AAChF;AAcA,OAAO,SAASG,qBAAqBA,CACnChB,MAAwB,EACxBC,OAA0B,EAC1BgB,aAAqB,EACrBC,GAAW,EACXC,GAAW,EACXN,OAAuB,EACN;EACjB,OAAOlB,wBAAwB,CAACqB,qBAAqB,CACnDhB,MAAM,EACNC,OAAO,EACPgB,aAAa,EACbC,GAAG,EACHC,GAAG,EACHN,OACF,CAAC;AACH;AAOA,OAAO,SAASO,sBAAsBA,CACpCC,QAAgB,EAChBC,aAAqB,EACI;EACzB,OAAO3B,wBAAwB,CAACyB,sBAAsB,CAACC,QAAQ,EAAEC,aAAa,CAAC;AACjF","ignoreList":[]}
|
|
@@ -11,8 +11,13 @@ export interface TransparentOutput {
|
|
|
11
11
|
address: string;
|
|
12
12
|
amount: number;
|
|
13
13
|
}
|
|
14
|
+
export interface ZcashTxResult {
|
|
15
|
+
txId: string;
|
|
16
|
+
txHex: string;
|
|
17
|
+
}
|
|
14
18
|
export declare function createTransparentPczt(inputs: TransparentInput[], outputs: TransparentOutput[], blockHeight: number): Promise<string>;
|
|
15
|
-
export declare function
|
|
19
|
+
export declare function finalizeThenExtractPcztTransaction(pcztHex: string): Promise<ZcashTxResult>;
|
|
20
|
+
export declare function createTransparentPcztForSwapkit(pcztHex: string, blockHeight: number, pubkeyHex: string, fingerprintHex: string, path: string): Promise<string>;
|
|
16
21
|
export interface DerivedKeys {
|
|
17
22
|
paymentPubkeyHex: string;
|
|
18
23
|
stakePubkeyHex: string;
|
|
@@ -25,4 +30,20 @@ export declare function derivePubkeyByPathAda(accountXpubHex: string, path: stri
|
|
|
25
30
|
export declare function deriveAddressByPathAda(accountXpubHex: string, path: string, network: CardanoNetwork): Promise<string>;
|
|
26
31
|
export declare function deriveEnterpriseAddressByPathAda(accountXpubHex: string, path: string, network: CardanoNetwork): Promise<string>;
|
|
27
32
|
export declare function deriveStakeAddressAda(accountXpubHex: string, network: CardanoNetwork): Promise<string>;
|
|
33
|
+
export interface CardanoTxInput {
|
|
34
|
+
txHash: string;
|
|
35
|
+
txIndex: number;
|
|
36
|
+
amount: number;
|
|
37
|
+
}
|
|
38
|
+
export interface CardanoTxOutput {
|
|
39
|
+
address: string;
|
|
40
|
+
amount: number;
|
|
41
|
+
isChange: boolean;
|
|
42
|
+
}
|
|
43
|
+
export declare function composeTransactionAda(inputs: CardanoTxInput[], outputs: CardanoTxOutput[], changeAddress: string, fee: number, ttl: number, network: CardanoNetwork): Promise<string>;
|
|
44
|
+
export interface SignedTxResult {
|
|
45
|
+
txId: string;
|
|
46
|
+
txHex: string;
|
|
47
|
+
}
|
|
48
|
+
export declare function assembleTransactionAda(rawTxHex: string, witnessSetHex: string): Promise<SignedTxResult>;
|
|
28
49
|
//# 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,
|
|
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,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;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,kCAAkC,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAE1F;AAED,wBAAgB,+BAA+B,CAC7C,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,cAAc,EAAE,MAAM,EACtB,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,MAAM,CAAC,CAQjB;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;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,cAAc,EAAE,EACxB,OAAO,EAAE,eAAe,EAAE,EAC1B,aAAa,EAAE,MAAM,EACrB,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,MAAM,CAAC,CASjB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,cAAc,CAAC,CAEzB"}
|
package/package.json
CHANGED
package/src/index.tsx
CHANGED
|
@@ -32,6 +32,11 @@ export interface TransparentOutput {
|
|
|
32
32
|
amount: number;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
export interface ZcashTxResult {
|
|
36
|
+
txId: string,
|
|
37
|
+
txHex: string,
|
|
38
|
+
}
|
|
39
|
+
|
|
35
40
|
export function createTransparentPczt(
|
|
36
41
|
inputs: TransparentInput[],
|
|
37
42
|
outputs: TransparentOutput[],
|
|
@@ -40,8 +45,24 @@ export function createTransparentPczt(
|
|
|
40
45
|
return KeystoneWalletCoreModule.createTransparentPczt(inputs, outputs, blockHeight);
|
|
41
46
|
}
|
|
42
47
|
|
|
43
|
-
export function
|
|
44
|
-
return KeystoneWalletCoreModule.
|
|
48
|
+
export function finalizeThenExtractPcztTransaction(pcztHex: string): Promise<ZcashTxResult> {
|
|
49
|
+
return KeystoneWalletCoreModule.finalizeThenExtractPcztTransaction(pcztHex);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function createTransparentPcztForSwapkit(
|
|
53
|
+
pcztHex: string,
|
|
54
|
+
blockHeight: number,
|
|
55
|
+
pubkeyHex: string,
|
|
56
|
+
fingerprintHex: string,
|
|
57
|
+
path: string
|
|
58
|
+
): Promise<string> {
|
|
59
|
+
return KeystoneWalletCoreModule.createTransparentPcztForSwapkit(
|
|
60
|
+
pcztHex,
|
|
61
|
+
blockHeight,
|
|
62
|
+
pubkeyHex,
|
|
63
|
+
fingerprintHex,
|
|
64
|
+
path
|
|
65
|
+
);
|
|
45
66
|
}
|
|
46
67
|
|
|
47
68
|
export interface DerivedKeys {
|
|
@@ -84,3 +105,45 @@ export function deriveStakeAddressAda(
|
|
|
84
105
|
return KeystoneWalletCoreModule.deriveStakeAddressAda(accountXpubHex, network);
|
|
85
106
|
}
|
|
86
107
|
|
|
108
|
+
export interface CardanoTxInput {
|
|
109
|
+
txHash: string;
|
|
110
|
+
txIndex: number;
|
|
111
|
+
amount: number;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export interface CardanoTxOutput {
|
|
115
|
+
address: string;
|
|
116
|
+
amount: number;
|
|
117
|
+
isChange: boolean;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export function composeTransactionAda(
|
|
121
|
+
inputs: CardanoTxInput[],
|
|
122
|
+
outputs: CardanoTxOutput[],
|
|
123
|
+
changeAddress: string,
|
|
124
|
+
fee: number,
|
|
125
|
+
ttl: number,
|
|
126
|
+
network: CardanoNetwork
|
|
127
|
+
): Promise<string> {
|
|
128
|
+
return KeystoneWalletCoreModule.composeTransactionAda(
|
|
129
|
+
inputs,
|
|
130
|
+
outputs,
|
|
131
|
+
changeAddress,
|
|
132
|
+
fee,
|
|
133
|
+
ttl,
|
|
134
|
+
network
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export interface SignedTxResult {
|
|
139
|
+
txId: string;
|
|
140
|
+
txHex: string;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export function assembleTransactionAda(
|
|
144
|
+
rawTxHex: string,
|
|
145
|
+
witnessSetHex: string
|
|
146
|
+
): Promise<SignedTxResult> {
|
|
147
|
+
return KeystoneWalletCoreModule.assembleTransactionAda(rawTxHex, witnessSetHex);
|
|
148
|
+
}
|
|
149
|
+
|