@keystonehq/react-native-keystone-wallet-core 0.1.0-alpha.0 → 0.1.0-alpha.3
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 +135 -0
- package/ios/Frameworks/KeystoneWalletCoreFFI.xcframework/Info.plist +4 -4
- package/ios/Frameworks/KeystoneWalletCoreFFI.xcframework/ios-arm64/KeystoneWalletCoreFFI.framework/Headers/keystone_wallet_coreFFI.h +79 -12
- package/ios/Frameworks/KeystoneWalletCoreFFI.xcframework/ios-arm64/KeystoneWalletCoreFFI.framework/KeystoneWalletCoreFFI +0 -0
- package/ios/Frameworks/KeystoneWalletCoreFFI.xcframework/ios-arm64-simulator/KeystoneWalletCoreFFI.framework/Headers/keystone_wallet_coreFFI.h +79 -12
- package/ios/Frameworks/KeystoneWalletCoreFFI.xcframework/ios-arm64-simulator/KeystoneWalletCoreFFI.framework/KeystoneWalletCoreFFI +0 -0
- package/ios/KeystoneWalletCoreModule.m +37 -1
- package/ios/KeystoneWalletCoreModule.swift +120 -3
- package/ios/keystone_wallet_core.swift +575 -10
- package/lib/commonjs/index.js +33 -3
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/index.js +25 -2
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/index.d.ts +29 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/index.tsx +84 -2
|
@@ -9,6 +9,18 @@ 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;
|
|
13
|
+
import uniffi.keystone_wallet_core.derivePubkeyByPathAda
|
|
14
|
+
import uniffi.keystone_wallet_core.deriveAddressByPathAda
|
|
15
|
+
import uniffi.keystone_wallet_core.deriveEnterpriseAddressByPathAda
|
|
16
|
+
import uniffi.keystone_wallet_core.deriveStakeAddressAda
|
|
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
|
|
21
|
+
import com.facebook.react.bridge.WritableNativeMap
|
|
22
|
+
|
|
23
|
+
import uniffi.keystone_wallet_core.assembleTransactionAda
|
|
12
24
|
|
|
13
25
|
class KeystoneWalletCoreModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(reactContext) {
|
|
14
26
|
|
|
@@ -51,4 +63,127 @@ class KeystoneWalletCoreModule(reactContext: ReactApplicationContext) : ReactCon
|
|
|
51
63
|
promise.reject("CREATE_PCZT_ERROR", e.message, e)
|
|
52
64
|
}
|
|
53
65
|
}
|
|
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
|
+
|
|
77
|
+
private fun getCardanoNetwork(network: String): CardanoNetwork {
|
|
78
|
+
return when (network) {
|
|
79
|
+
"Mainnet" -> CardanoNetwork.MAINNET
|
|
80
|
+
"Testnet" -> CardanoNetwork.TESTNET
|
|
81
|
+
else -> throw IllegalArgumentException("Invalid Cardano network: $network")
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
@ReactMethod
|
|
86
|
+
fun derivePubkeyByPathAda(accountXpubHex: String, path: String, promise: Promise) {
|
|
87
|
+
try {
|
|
88
|
+
val result = derivePubkeyByPathAda(accountXpubHex, path)
|
|
89
|
+
val map = WritableNativeMap()
|
|
90
|
+
map.putString("paymentPubkeyHex", result.paymentPubkeyHex)
|
|
91
|
+
map.putString("stakePubkeyHex", result.stakePubkeyHex)
|
|
92
|
+
promise.resolve(map)
|
|
93
|
+
} catch (e: Exception) {
|
|
94
|
+
promise.reject("CARDANO_ERROR", e.message, e)
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
@ReactMethod
|
|
99
|
+
fun deriveAddressByPathAda(accountXpubHex: String, path: String, network: String, promise: Promise) {
|
|
100
|
+
try {
|
|
101
|
+
val adaNetwork = getCardanoNetwork(network)
|
|
102
|
+
val result = deriveAddressByPathAda(accountXpubHex, path, adaNetwork)
|
|
103
|
+
promise.resolve(result)
|
|
104
|
+
} catch (e: Exception) {
|
|
105
|
+
promise.reject("CARDANO_ERROR", e.message, e)
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
@ReactMethod
|
|
110
|
+
fun deriveEnterpriseAddressByPathAda(accountXpubHex: String, path: String, network: String, promise: Promise) {
|
|
111
|
+
try {
|
|
112
|
+
val adaNetwork = getCardanoNetwork(network)
|
|
113
|
+
val result = deriveEnterpriseAddressByPathAda(accountXpubHex, path, adaNetwork)
|
|
114
|
+
promise.resolve(result)
|
|
115
|
+
} catch (e: Exception) {
|
|
116
|
+
promise.reject("CARDANO_ERROR", e.message, e)
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
@ReactMethod
|
|
121
|
+
fun deriveStakeAddressAda(accountXpubHex: String, network: String, promise: Promise) {
|
|
122
|
+
try {
|
|
123
|
+
val adaNetwork = getCardanoNetwork(network)
|
|
124
|
+
val result = deriveStakeAddressAda(accountXpubHex, adaNetwork)
|
|
125
|
+
promise.resolve(result)
|
|
126
|
+
} catch (e: Exception) {
|
|
127
|
+
promise.reject("CARDANO_ERROR", e.message, e)
|
|
128
|
+
}
|
|
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
|
+
}
|
|
54
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</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>
|
|
@@ -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,14 +286,35 @@ 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
|
|
279
|
-
#ifndef
|
|
280
|
-
#define
|
|
281
|
-
RustBuffer
|
|
289
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_DERIVE_ADDRESS_BY_PATH_ADA
|
|
290
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_DERIVE_ADDRESS_BY_PATH_ADA
|
|
291
|
+
RustBuffer uniffi_keystone_wallet_core_fn_func_derive_address_by_path_ada(RustBuffer account_xpub_hex, RustBuffer path, RustBuffer network, RustCallStatus *_Nonnull out_status
|
|
292
|
+
);
|
|
293
|
+
#endif
|
|
294
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_DERIVE_ENTERPRISE_ADDRESS_BY_PATH_ADA
|
|
295
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_DERIVE_ENTERPRISE_ADDRESS_BY_PATH_ADA
|
|
296
|
+
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
|
|
297
|
+
);
|
|
298
|
+
#endif
|
|
299
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_DERIVE_PUBKEY_BY_PATH_ADA
|
|
300
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_DERIVE_PUBKEY_BY_PATH_ADA
|
|
301
|
+
RustBuffer uniffi_keystone_wallet_core_fn_func_derive_pubkey_by_path_ada(RustBuffer account_xpub_hex, RustBuffer path, RustCallStatus *_Nonnull out_status
|
|
282
302
|
);
|
|
283
303
|
#endif
|
|
284
|
-
#ifndef
|
|
285
|
-
#define
|
|
286
|
-
RustBuffer
|
|
304
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_DERIVE_STAKE_ADDRESS_ADA
|
|
305
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_DERIVE_STAKE_ADDRESS_ADA
|
|
306
|
+
RustBuffer uniffi_keystone_wallet_core_fn_func_derive_stake_address_ada(RustBuffer account_xpub_hex, RustBuffer network, RustCallStatus *_Nonnull out_status
|
|
307
|
+
);
|
|
308
|
+
#endif
|
|
309
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_FINALIZE_THEN_EXTRACT_PCZT_TRANSACTION
|
|
310
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_FINALIZE_THEN_EXTRACT_PCZT_TRANSACTION
|
|
311
|
+
RustBuffer uniffi_keystone_wallet_core_fn_func_finalize_then_extract_pczt_transaction(RustBuffer pczt_hex, RustCallStatus *_Nonnull out_status
|
|
312
|
+
);
|
|
313
|
+
#endif
|
|
314
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_HELLO
|
|
315
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_HELLO
|
|
316
|
+
void uniffi_keystone_wallet_core_fn_func_hello(RustCallStatus *_Nonnull out_status
|
|
317
|
+
|
|
287
318
|
);
|
|
288
319
|
#endif
|
|
289
320
|
#ifndef UNIFFI_FFIDEF_FFI_KEYSTONE_WALLET_CORE_RUSTBUFFER_ALLOC
|
|
@@ -564,6 +595,18 @@ void ffi_keystone_wallet_core_rust_future_free_void(uint64_t handle
|
|
|
564
595
|
#ifndef UNIFFI_FFIDEF_FFI_KEYSTONE_WALLET_CORE_RUST_FUTURE_COMPLETE_VOID
|
|
565
596
|
#define UNIFFI_FFIDEF_FFI_KEYSTONE_WALLET_CORE_RUST_FUTURE_COMPLETE_VOID
|
|
566
597
|
void ffi_keystone_wallet_core_rust_future_complete_void(uint64_t handle, RustCallStatus *_Nonnull out_status
|
|
598
|
+
);
|
|
599
|
+
#endif
|
|
600
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_ASSEMBLE_TRANSACTION_ADA
|
|
601
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_ASSEMBLE_TRANSACTION_ADA
|
|
602
|
+
uint16_t uniffi_keystone_wallet_core_checksum_func_assemble_transaction_ada(void
|
|
603
|
+
|
|
604
|
+
);
|
|
605
|
+
#endif
|
|
606
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_COMPOSE_TRANSACTION_ADA
|
|
607
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_COMPOSE_TRANSACTION_ADA
|
|
608
|
+
uint16_t uniffi_keystone_wallet_core_checksum_func_compose_transaction_ada(void
|
|
609
|
+
|
|
567
610
|
);
|
|
568
611
|
#endif
|
|
569
612
|
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_CREATE_PCZT
|
|
@@ -578,15 +621,39 @@ uint16_t uniffi_keystone_wallet_core_checksum_func_create_transparent_pczt(void
|
|
|
578
621
|
|
|
579
622
|
);
|
|
580
623
|
#endif
|
|
581
|
-
#ifndef
|
|
582
|
-
#define
|
|
583
|
-
uint16_t
|
|
624
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_DERIVE_ADDRESS_BY_PATH_ADA
|
|
625
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_DERIVE_ADDRESS_BY_PATH_ADA
|
|
626
|
+
uint16_t uniffi_keystone_wallet_core_checksum_func_derive_address_by_path_ada(void
|
|
627
|
+
|
|
628
|
+
);
|
|
629
|
+
#endif
|
|
630
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_DERIVE_ENTERPRISE_ADDRESS_BY_PATH_ADA
|
|
631
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_DERIVE_ENTERPRISE_ADDRESS_BY_PATH_ADA
|
|
632
|
+
uint16_t uniffi_keystone_wallet_core_checksum_func_derive_enterprise_address_by_path_ada(void
|
|
633
|
+
|
|
634
|
+
);
|
|
635
|
+
#endif
|
|
636
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_DERIVE_PUBKEY_BY_PATH_ADA
|
|
637
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_DERIVE_PUBKEY_BY_PATH_ADA
|
|
638
|
+
uint16_t uniffi_keystone_wallet_core_checksum_func_derive_pubkey_by_path_ada(void
|
|
639
|
+
|
|
640
|
+
);
|
|
641
|
+
#endif
|
|
642
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_DERIVE_STAKE_ADDRESS_ADA
|
|
643
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_DERIVE_STAKE_ADDRESS_ADA
|
|
644
|
+
uint16_t uniffi_keystone_wallet_core_checksum_func_derive_stake_address_ada(void
|
|
645
|
+
|
|
646
|
+
);
|
|
647
|
+
#endif
|
|
648
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_FINALIZE_THEN_EXTRACT_PCZT_TRANSACTION
|
|
649
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_FINALIZE_THEN_EXTRACT_PCZT_TRANSACTION
|
|
650
|
+
uint16_t uniffi_keystone_wallet_core_checksum_func_finalize_then_extract_pczt_transaction(void
|
|
584
651
|
|
|
585
652
|
);
|
|
586
653
|
#endif
|
|
587
|
-
#ifndef
|
|
588
|
-
#define
|
|
589
|
-
uint16_t
|
|
654
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_HELLO
|
|
655
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_HELLO
|
|
656
|
+
uint16_t uniffi_keystone_wallet_core_checksum_func_hello(void
|
|
590
657
|
|
|
591
658
|
);
|
|
592
659
|
#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,14 +286,35 @@ 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
|
|
279
|
-
#ifndef
|
|
280
|
-
#define
|
|
281
|
-
RustBuffer
|
|
289
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_DERIVE_ADDRESS_BY_PATH_ADA
|
|
290
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_DERIVE_ADDRESS_BY_PATH_ADA
|
|
291
|
+
RustBuffer uniffi_keystone_wallet_core_fn_func_derive_address_by_path_ada(RustBuffer account_xpub_hex, RustBuffer path, RustBuffer network, RustCallStatus *_Nonnull out_status
|
|
292
|
+
);
|
|
293
|
+
#endif
|
|
294
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_DERIVE_ENTERPRISE_ADDRESS_BY_PATH_ADA
|
|
295
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_DERIVE_ENTERPRISE_ADDRESS_BY_PATH_ADA
|
|
296
|
+
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
|
|
297
|
+
);
|
|
298
|
+
#endif
|
|
299
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_DERIVE_PUBKEY_BY_PATH_ADA
|
|
300
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_DERIVE_PUBKEY_BY_PATH_ADA
|
|
301
|
+
RustBuffer uniffi_keystone_wallet_core_fn_func_derive_pubkey_by_path_ada(RustBuffer account_xpub_hex, RustBuffer path, RustCallStatus *_Nonnull out_status
|
|
282
302
|
);
|
|
283
303
|
#endif
|
|
284
|
-
#ifndef
|
|
285
|
-
#define
|
|
286
|
-
RustBuffer
|
|
304
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_DERIVE_STAKE_ADDRESS_ADA
|
|
305
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_DERIVE_STAKE_ADDRESS_ADA
|
|
306
|
+
RustBuffer uniffi_keystone_wallet_core_fn_func_derive_stake_address_ada(RustBuffer account_xpub_hex, RustBuffer network, RustCallStatus *_Nonnull out_status
|
|
307
|
+
);
|
|
308
|
+
#endif
|
|
309
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_FINALIZE_THEN_EXTRACT_PCZT_TRANSACTION
|
|
310
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_FINALIZE_THEN_EXTRACT_PCZT_TRANSACTION
|
|
311
|
+
RustBuffer uniffi_keystone_wallet_core_fn_func_finalize_then_extract_pczt_transaction(RustBuffer pczt_hex, RustCallStatus *_Nonnull out_status
|
|
312
|
+
);
|
|
313
|
+
#endif
|
|
314
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_HELLO
|
|
315
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_FN_FUNC_HELLO
|
|
316
|
+
void uniffi_keystone_wallet_core_fn_func_hello(RustCallStatus *_Nonnull out_status
|
|
317
|
+
|
|
287
318
|
);
|
|
288
319
|
#endif
|
|
289
320
|
#ifndef UNIFFI_FFIDEF_FFI_KEYSTONE_WALLET_CORE_RUSTBUFFER_ALLOC
|
|
@@ -564,6 +595,18 @@ void ffi_keystone_wallet_core_rust_future_free_void(uint64_t handle
|
|
|
564
595
|
#ifndef UNIFFI_FFIDEF_FFI_KEYSTONE_WALLET_CORE_RUST_FUTURE_COMPLETE_VOID
|
|
565
596
|
#define UNIFFI_FFIDEF_FFI_KEYSTONE_WALLET_CORE_RUST_FUTURE_COMPLETE_VOID
|
|
566
597
|
void ffi_keystone_wallet_core_rust_future_complete_void(uint64_t handle, RustCallStatus *_Nonnull out_status
|
|
598
|
+
);
|
|
599
|
+
#endif
|
|
600
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_ASSEMBLE_TRANSACTION_ADA
|
|
601
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_ASSEMBLE_TRANSACTION_ADA
|
|
602
|
+
uint16_t uniffi_keystone_wallet_core_checksum_func_assemble_transaction_ada(void
|
|
603
|
+
|
|
604
|
+
);
|
|
605
|
+
#endif
|
|
606
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_COMPOSE_TRANSACTION_ADA
|
|
607
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_COMPOSE_TRANSACTION_ADA
|
|
608
|
+
uint16_t uniffi_keystone_wallet_core_checksum_func_compose_transaction_ada(void
|
|
609
|
+
|
|
567
610
|
);
|
|
568
611
|
#endif
|
|
569
612
|
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_CREATE_PCZT
|
|
@@ -578,15 +621,39 @@ uint16_t uniffi_keystone_wallet_core_checksum_func_create_transparent_pczt(void
|
|
|
578
621
|
|
|
579
622
|
);
|
|
580
623
|
#endif
|
|
581
|
-
#ifndef
|
|
582
|
-
#define
|
|
583
|
-
uint16_t
|
|
624
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_DERIVE_ADDRESS_BY_PATH_ADA
|
|
625
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_DERIVE_ADDRESS_BY_PATH_ADA
|
|
626
|
+
uint16_t uniffi_keystone_wallet_core_checksum_func_derive_address_by_path_ada(void
|
|
627
|
+
|
|
628
|
+
);
|
|
629
|
+
#endif
|
|
630
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_DERIVE_ENTERPRISE_ADDRESS_BY_PATH_ADA
|
|
631
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_DERIVE_ENTERPRISE_ADDRESS_BY_PATH_ADA
|
|
632
|
+
uint16_t uniffi_keystone_wallet_core_checksum_func_derive_enterprise_address_by_path_ada(void
|
|
633
|
+
|
|
634
|
+
);
|
|
635
|
+
#endif
|
|
636
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_DERIVE_PUBKEY_BY_PATH_ADA
|
|
637
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_DERIVE_PUBKEY_BY_PATH_ADA
|
|
638
|
+
uint16_t uniffi_keystone_wallet_core_checksum_func_derive_pubkey_by_path_ada(void
|
|
639
|
+
|
|
640
|
+
);
|
|
641
|
+
#endif
|
|
642
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_DERIVE_STAKE_ADDRESS_ADA
|
|
643
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_DERIVE_STAKE_ADDRESS_ADA
|
|
644
|
+
uint16_t uniffi_keystone_wallet_core_checksum_func_derive_stake_address_ada(void
|
|
645
|
+
|
|
646
|
+
);
|
|
647
|
+
#endif
|
|
648
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_FINALIZE_THEN_EXTRACT_PCZT_TRANSACTION
|
|
649
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_FINALIZE_THEN_EXTRACT_PCZT_TRANSACTION
|
|
650
|
+
uint16_t uniffi_keystone_wallet_core_checksum_func_finalize_then_extract_pczt_transaction(void
|
|
584
651
|
|
|
585
652
|
);
|
|
586
653
|
#endif
|
|
587
|
-
#ifndef
|
|
588
|
-
#define
|
|
589
|
-
uint16_t
|
|
654
|
+
#ifndef UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_HELLO
|
|
655
|
+
#define UNIFFI_FFIDEF_UNIFFI_KEYSTONE_WALLET_CORE_CHECKSUM_FUNC_HELLO
|
|
656
|
+
uint16_t uniffi_keystone_wallet_core_checksum_func_hello(void
|
|
590
657
|
|
|
591
658
|
);
|
|
592
659
|
#endif
|
|
Binary file
|
|
@@ -8,7 +8,43 @@ 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(finalizeThenExtractPcztTransaction:(NSString *)pcztHex
|
|
12
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
13
|
+
reject:(RCTPromiseRejectBlock)reject)
|
|
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
|
+
|
|
37
|
+
RCT_EXTERN_METHOD(composeTransactionAda:(NSArray *)inputs
|
|
38
|
+
outputs:(NSArray *)outputs
|
|
39
|
+
changeAddress:(NSString *)changeAddress
|
|
40
|
+
fee:(double)fee
|
|
41
|
+
ttl:(double)ttl
|
|
42
|
+
network:(NSString *)network
|
|
43
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
44
|
+
reject:(RCTPromiseRejectBlock)reject)
|
|
45
|
+
|
|
46
|
+
RCT_EXTERN_METHOD(assembleTransactionAda:(NSString *)rawTxHex
|
|
47
|
+
witnessSetHex:(NSString *)witnessSetHex
|
|
12
48
|
resolve:(RCTPromiseResolveBlock)resolve
|
|
13
49
|
reject:(RCTPromiseRejectBlock)reject)
|
|
14
50
|
|
|
@@ -43,13 +43,130 @@ public class KeystoneWalletCoreModule: NSObject {
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
@objc(
|
|
47
|
-
func
|
|
46
|
+
@objc(finalizeThenExtractPcztTransaction:resolve:reject:)
|
|
47
|
+
func finalizeThenExtractPcztTransactionBridge(_ pcztHex: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
|
48
48
|
do {
|
|
49
|
-
let result = try
|
|
49
|
+
let result = try finalizeThenExtractPcztTransaction(pcztHex: pcztHex)
|
|
50
50
|
resolve(result)
|
|
51
51
|
} catch {
|
|
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
|
+
}
|
|
112
|
+
|
|
113
|
+
@objc(composeTransactionAda:outputs:changeAddress:fee:ttl:network:resolve:reject:)
|
|
114
|
+
func composeTransactionAdaBridge(
|
|
115
|
+
_ inputs: [NSDictionary],
|
|
116
|
+
outputs: [NSDictionary],
|
|
117
|
+
changeAddress: String,
|
|
118
|
+
fee: Double,
|
|
119
|
+
ttl: Double,
|
|
120
|
+
network: String,
|
|
121
|
+
resolve: @escaping RCTPromiseResolveBlock,
|
|
122
|
+
reject: @escaping RCTPromiseRejectBlock
|
|
123
|
+
) {
|
|
124
|
+
do {
|
|
125
|
+
let swiftInputs = try inputs.map { dict -> CardanoTxInput in
|
|
126
|
+
guard let txHash = dict["txHash"] as? String,
|
|
127
|
+
let txIndex = (dict["txIndex"] as? NSNumber)?.uint32Value,
|
|
128
|
+
let amount = (dict["amount"] as? NSNumber)?.uint64Value
|
|
129
|
+
else {
|
|
130
|
+
throw NSError(domain: "CardanoModule", code: 1, userInfo: [NSLocalizedDescriptionKey: "Invalid input format"])
|
|
131
|
+
}
|
|
132
|
+
return CardanoTxInput(txHash: txHash, txIndex: txIndex, amount: amount)
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
let swiftOutputs = try outputs.map { dict -> CardanoTxOutput in
|
|
136
|
+
guard let address = dict["address"] as? String,
|
|
137
|
+
let amount = (dict["amount"] as? NSNumber)?.uint64Value,
|
|
138
|
+
let isChange = dict["isChange"] as? Bool
|
|
139
|
+
else {
|
|
140
|
+
throw NSError(domain: "CardanoModule", code: 1, userInfo: [NSLocalizedDescriptionKey: "Invalid output format"])
|
|
141
|
+
}
|
|
142
|
+
return CardanoTxOutput(address: address, amount: amount, isChange: isChange)
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
let adaNetwork = try getCardanoNetwork(network: network)
|
|
146
|
+
let result = try composeTransactionAda(
|
|
147
|
+
inputs: swiftInputs,
|
|
148
|
+
outputs: swiftOutputs,
|
|
149
|
+
changeAddress: changeAddress,
|
|
150
|
+
fee: UInt64(fee),
|
|
151
|
+
ttl: UInt64(ttl),
|
|
152
|
+
network: adaNetwork
|
|
153
|
+
)
|
|
154
|
+
resolve(result)
|
|
155
|
+
} catch {
|
|
156
|
+
reject("CARDANO_ERROR", error.localizedDescription, error)
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
@objc(assembleTransactionAda:witnessSetHex:resolve:reject:)
|
|
161
|
+
func assembleTransactionAdaBridge(_ rawTxHex: String, witnessSetHex: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
|
162
|
+
do {
|
|
163
|
+
let result = try assembleTransactionAda(rawTxHex: rawTxHex, witnessSetHex: witnessSetHex)
|
|
164
|
+
resolve([
|
|
165
|
+
"txId": result.txId,
|
|
166
|
+
"txHex": result.txHex
|
|
167
|
+
])
|
|
168
|
+
} catch {
|
|
169
|
+
reject("CARDANO_ERROR", error.localizedDescription, error)
|
|
170
|
+
}
|
|
171
|
+
}
|
|
55
172
|
}
|