@bennyblader/ddk-rn 0.3.3 → 0.3.5
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/cpp/ddk_ffi.cpp +45 -0
- package/cpp/ddk_ffi.hpp +2 -0
- package/ddk-ffi/Cargo.lock +2 -2
- package/ddk-ffi/Cargo.toml +1 -1
- package/ddk-ffi/src/ddk_ffi.udl +13 -9
- package/ddk-ffi/src/lib.rs +39 -21
- package/lib/commonjs/ddk_ffi-ffi.js.map +1 -1
- package/lib/commonjs/ddk_ffi.js +22 -54
- package/lib/commonjs/ddk_ffi.js.map +1 -1
- package/lib/module/ddk_ffi-ffi.js.map +1 -1
- package/lib/module/ddk_ffi.js +20 -53
- package/lib/module/ddk_ffi.js.map +1 -1
- package/lib/typescript/commonjs/src/ddk_ffi-ffi.d.ts +2 -0
- package/lib/typescript/commonjs/src/ddk_ffi-ffi.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/ddk_ffi.d.ts +4 -33
- package/lib/typescript/commonjs/src/ddk_ffi.d.ts.map +1 -1
- package/lib/typescript/module/src/ddk_ffi-ffi.d.ts +2 -0
- package/lib/typescript/module/src/ddk_ffi-ffi.d.ts.map +1 -1
- package/lib/typescript/module/src/ddk_ffi.d.ts +4 -33
- package/lib/typescript/module/src/ddk_ffi.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/ddk_ffi-ffi.ts +11 -0
- package/src/ddk_ffi.ts +55 -73
package/cpp/ddk_ffi.cpp
CHANGED
|
@@ -275,6 +275,16 @@ extern "C" {
|
|
|
275
275
|
RustBuffer msgs,
|
|
276
276
|
RustCallStatus *uniffi_out_err
|
|
277
277
|
);
|
|
278
|
+
int8_t uniffi_ddk_ffi_fn_func_verify_cet_adaptor_sigs_from_oracle_info(
|
|
279
|
+
RustBuffer adaptor_sigs,
|
|
280
|
+
RustBuffer cets,
|
|
281
|
+
RustBuffer oracle_info,
|
|
282
|
+
RustBuffer pubkey,
|
|
283
|
+
RustBuffer funding_script_pubkey,
|
|
284
|
+
uint64_t total_collateral,
|
|
285
|
+
RustBuffer msgs,
|
|
286
|
+
RustCallStatus *uniffi_out_err
|
|
287
|
+
);
|
|
278
288
|
int8_t uniffi_ddk_ffi_fn_func_verify_fund_tx_signature(
|
|
279
289
|
RustBuffer fund_tx,
|
|
280
290
|
RustBuffer signature,
|
|
@@ -534,6 +544,8 @@ extern "C" {
|
|
|
534
544
|
);
|
|
535
545
|
uint16_t uniffi_ddk_ffi_checksum_func_verify_cet_adaptor_sig_from_oracle_info(
|
|
536
546
|
);
|
|
547
|
+
uint16_t uniffi_ddk_ffi_checksum_func_verify_cet_adaptor_sigs_from_oracle_info(
|
|
548
|
+
);
|
|
537
549
|
uint16_t uniffi_ddk_ffi_checksum_func_verify_fund_tx_signature(
|
|
538
550
|
);
|
|
539
551
|
uint16_t uniffi_ddk_ffi_checksum_func_version(
|
|
@@ -2226,6 +2238,14 @@ NativeDdkFfi::NativeDdkFfi(
|
|
|
2226
2238
|
return this->cpp_uniffi_ddk_ffi_fn_func_verify_cet_adaptor_sig_from_oracle_info(rt, thisVal, args, count);
|
|
2227
2239
|
}
|
|
2228
2240
|
);
|
|
2241
|
+
props["ubrn_uniffi_ddk_ffi_fn_func_verify_cet_adaptor_sigs_from_oracle_info"] = jsi::Function::createFromHostFunction(
|
|
2242
|
+
rt,
|
|
2243
|
+
jsi::PropNameID::forAscii(rt, "ubrn_uniffi_ddk_ffi_fn_func_verify_cet_adaptor_sigs_from_oracle_info"),
|
|
2244
|
+
7,
|
|
2245
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
|
|
2246
|
+
return this->cpp_uniffi_ddk_ffi_fn_func_verify_cet_adaptor_sigs_from_oracle_info(rt, thisVal, args, count);
|
|
2247
|
+
}
|
|
2248
|
+
);
|
|
2229
2249
|
props["ubrn_uniffi_ddk_ffi_fn_func_verify_fund_tx_signature"] = jsi::Function::createFromHostFunction(
|
|
2230
2250
|
rt,
|
|
2231
2251
|
jsi::PropNameID::forAscii(rt, "ubrn_uniffi_ddk_ffi_fn_func_verify_fund_tx_signature"),
|
|
@@ -2386,6 +2406,14 @@ NativeDdkFfi::NativeDdkFfi(
|
|
|
2386
2406
|
return this->cpp_uniffi_ddk_ffi_checksum_func_verify_cet_adaptor_sig_from_oracle_info(rt, thisVal, args, count);
|
|
2387
2407
|
}
|
|
2388
2408
|
);
|
|
2409
|
+
props["ubrn_uniffi_ddk_ffi_checksum_func_verify_cet_adaptor_sigs_from_oracle_info"] = jsi::Function::createFromHostFunction(
|
|
2410
|
+
rt,
|
|
2411
|
+
jsi::PropNameID::forAscii(rt, "ubrn_uniffi_ddk_ffi_checksum_func_verify_cet_adaptor_sigs_from_oracle_info"),
|
|
2412
|
+
0,
|
|
2413
|
+
[this](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
|
|
2414
|
+
return this->cpp_uniffi_ddk_ffi_checksum_func_verify_cet_adaptor_sigs_from_oracle_info(rt, thisVal, args, count);
|
|
2415
|
+
}
|
|
2416
|
+
);
|
|
2389
2417
|
props["ubrn_uniffi_ddk_ffi_checksum_func_verify_fund_tx_signature"] = jsi::Function::createFromHostFunction(
|
|
2390
2418
|
rt,
|
|
2391
2419
|
jsi::PropNameID::forAscii(rt, "ubrn_uniffi_ddk_ffi_checksum_func_verify_fund_tx_signature"),
|
|
@@ -2643,6 +2671,16 @@ jsi::Value NativeDdkFfi::cpp_uniffi_ddk_ffi_fn_func_verify_cet_adaptor_sig_from_
|
|
|
2643
2671
|
uniffi::ddk_ffi::Bridging<RustCallStatus>::copyIntoJs(rt, callInvoker, status, args[count - 1]);
|
|
2644
2672
|
|
|
2645
2673
|
|
|
2674
|
+
return uniffi_jsi::Bridging<int8_t>::toJs(rt, callInvoker, value);
|
|
2675
|
+
}
|
|
2676
|
+
jsi::Value NativeDdkFfi::cpp_uniffi_ddk_ffi_fn_func_verify_cet_adaptor_sigs_from_oracle_info(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
|
|
2677
|
+
RustCallStatus status = uniffi::ddk_ffi::Bridging<RustCallStatus>::rustSuccess(rt);
|
|
2678
|
+
auto value = uniffi_ddk_ffi_fn_func_verify_cet_adaptor_sigs_from_oracle_info(uniffi::ddk_ffi::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[0]), uniffi::ddk_ffi::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[1]), uniffi::ddk_ffi::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[2]), uniffi::ddk_ffi::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[3]), uniffi::ddk_ffi::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[4]), uniffi_jsi::Bridging<uint64_t>::fromJs(rt, callInvoker, args[5]), uniffi::ddk_ffi::Bridging<RustBuffer>::fromJs(rt, callInvoker, args[6]),
|
|
2679
|
+
&status
|
|
2680
|
+
);
|
|
2681
|
+
uniffi::ddk_ffi::Bridging<RustCallStatus>::copyIntoJs(rt, callInvoker, status, args[count - 1]);
|
|
2682
|
+
|
|
2683
|
+
|
|
2646
2684
|
return uniffi_jsi::Bridging<int8_t>::toJs(rt, callInvoker, value);
|
|
2647
2685
|
}
|
|
2648
2686
|
jsi::Value NativeDdkFfi::cpp_uniffi_ddk_ffi_fn_func_verify_fund_tx_signature(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
|
|
@@ -2788,6 +2826,13 @@ jsi::Value NativeDdkFfi::cpp_uniffi_ddk_ffi_checksum_func_verify_cet_adaptor_sig
|
|
|
2788
2826
|
);
|
|
2789
2827
|
|
|
2790
2828
|
|
|
2829
|
+
return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
|
|
2830
|
+
}
|
|
2831
|
+
jsi::Value NativeDdkFfi::cpp_uniffi_ddk_ffi_checksum_func_verify_cet_adaptor_sigs_from_oracle_info(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
|
|
2832
|
+
auto value = uniffi_ddk_ffi_checksum_func_verify_cet_adaptor_sigs_from_oracle_info(
|
|
2833
|
+
);
|
|
2834
|
+
|
|
2835
|
+
|
|
2791
2836
|
return uniffi_jsi::Bridging<uint16_t>::toJs(rt, callInvoker, value);
|
|
2792
2837
|
}
|
|
2793
2838
|
jsi::Value NativeDdkFfi::cpp_uniffi_ddk_ffi_checksum_func_verify_fund_tx_signature(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) {
|
package/cpp/ddk_ffi.hpp
CHANGED
|
@@ -39,6 +39,7 @@ class NativeDdkFfi : public jsi::HostObject {
|
|
|
39
39
|
jsi::Value cpp_uniffi_ddk_ffi_fn_func_sign_cet(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
|
|
40
40
|
jsi::Value cpp_uniffi_ddk_ffi_fn_func_sign_fund_transaction_input(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
|
|
41
41
|
jsi::Value cpp_uniffi_ddk_ffi_fn_func_verify_cet_adaptor_sig_from_oracle_info(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
|
|
42
|
+
jsi::Value cpp_uniffi_ddk_ffi_fn_func_verify_cet_adaptor_sigs_from_oracle_info(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
|
|
42
43
|
jsi::Value cpp_uniffi_ddk_ffi_fn_func_verify_fund_tx_signature(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
|
|
43
44
|
jsi::Value cpp_uniffi_ddk_ffi_fn_func_version(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
|
|
44
45
|
jsi::Value cpp_uniffi_ddk_ffi_checksum_func_convert_mnemonic_to_seed(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
|
|
@@ -59,6 +60,7 @@ class NativeDdkFfi : public jsi::HostObject {
|
|
|
59
60
|
jsi::Value cpp_uniffi_ddk_ffi_checksum_func_sign_cet(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
|
|
60
61
|
jsi::Value cpp_uniffi_ddk_ffi_checksum_func_sign_fund_transaction_input(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
|
|
61
62
|
jsi::Value cpp_uniffi_ddk_ffi_checksum_func_verify_cet_adaptor_sig_from_oracle_info(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
|
|
63
|
+
jsi::Value cpp_uniffi_ddk_ffi_checksum_func_verify_cet_adaptor_sigs_from_oracle_info(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
|
|
62
64
|
jsi::Value cpp_uniffi_ddk_ffi_checksum_func_verify_fund_tx_signature(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
|
|
63
65
|
jsi::Value cpp_uniffi_ddk_ffi_checksum_func_version(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
|
|
64
66
|
jsi::Value cpp_ffi_ddk_ffi_uniffi_contract_version(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
|
package/ddk-ffi/Cargo.lock
CHANGED
|
@@ -282,7 +282,7 @@ checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675"
|
|
|
282
282
|
|
|
283
283
|
[[package]]
|
|
284
284
|
name = "ddk_ffi"
|
|
285
|
-
version = "0.3.
|
|
285
|
+
version = "0.3.5"
|
|
286
286
|
dependencies = [
|
|
287
287
|
"bip39",
|
|
288
288
|
"bitcoin",
|
|
@@ -295,7 +295,7 @@ dependencies = [
|
|
|
295
295
|
[[package]]
|
|
296
296
|
name = "dlc"
|
|
297
297
|
version = "0.7.1"
|
|
298
|
-
source = "git+https://github.com/bennyhodl/dlcdevkit.git?branch=deterministic-contract-keys#
|
|
298
|
+
source = "git+https://github.com/bennyhodl/dlcdevkit.git?branch=deterministic-contract-keys#7ea0a69ed6ae8888adda4576b411deb4f26a4ec3"
|
|
299
299
|
dependencies = [
|
|
300
300
|
"bitcoin",
|
|
301
301
|
"miniscript",
|
package/ddk-ffi/Cargo.toml
CHANGED
package/ddk-ffi/src/ddk_ffi.udl
CHANGED
|
@@ -22,7 +22,7 @@ namespace ddk_ffi {
|
|
|
22
22
|
|
|
23
23
|
[Throws=DLCError]
|
|
24
24
|
DlcTransactions create_dlc_transactions(
|
|
25
|
-
sequence<
|
|
25
|
+
sequence<Payout> outcomes,
|
|
26
26
|
PartyParams local_params,
|
|
27
27
|
PartyParams remote_params,
|
|
28
28
|
u32 refund_locktime,
|
|
@@ -34,7 +34,7 @@ namespace ddk_ffi {
|
|
|
34
34
|
|
|
35
35
|
[Throws=DLCError]
|
|
36
36
|
DlcTransactions create_spliced_dlc_transactions(
|
|
37
|
-
sequence<
|
|
37
|
+
sequence<Payout> outcomes,
|
|
38
38
|
PartyParams local_params,
|
|
39
39
|
PartyParams remote_params,
|
|
40
40
|
u32 refund_locktime,
|
|
@@ -61,7 +61,7 @@ namespace ddk_ffi {
|
|
|
61
61
|
u32 fund_vout,
|
|
62
62
|
sequence<u8> local_final_script_pubkey,
|
|
63
63
|
sequence<u8> remote_final_script_pubkey,
|
|
64
|
-
sequence<
|
|
64
|
+
sequence<Payout> outcomes,
|
|
65
65
|
u32 lock_time,
|
|
66
66
|
u64 local_serial_id,
|
|
67
67
|
u64 remote_serial_id
|
|
@@ -120,6 +120,16 @@ namespace ddk_ffi {
|
|
|
120
120
|
sequence<sequence<sequence<u8>>> msgs
|
|
121
121
|
);
|
|
122
122
|
|
|
123
|
+
boolean verify_cet_adaptor_sigs_from_oracle_info(
|
|
124
|
+
sequence<AdaptorSignature> adaptor_sigs,
|
|
125
|
+
sequence<Transaction> cets,
|
|
126
|
+
sequence<OracleInfo> oracle_info,
|
|
127
|
+
sequence<u8> pubkey,
|
|
128
|
+
sequence<u8> funding_script_pubkey,
|
|
129
|
+
u64 total_collateral,
|
|
130
|
+
sequence<sequence<sequence<u8>>> msgs
|
|
131
|
+
);
|
|
132
|
+
|
|
123
133
|
boolean verify_cet_adaptor_sig_from_oracle_info(
|
|
124
134
|
AdaptorSignature adaptor_sig,
|
|
125
135
|
Transaction cet,
|
|
@@ -194,12 +204,6 @@ dictionary TxInputInfo {
|
|
|
194
204
|
u64 serial_id;
|
|
195
205
|
};
|
|
196
206
|
|
|
197
|
-
// DLC outcome with payouts
|
|
198
|
-
dictionary DlcOutcome {
|
|
199
|
-
u64 local_payout;
|
|
200
|
-
u64 remote_payout;
|
|
201
|
-
};
|
|
202
|
-
|
|
203
207
|
// Payout for offer and accept parties
|
|
204
208
|
dictionary Payout {
|
|
205
209
|
u64 offer;
|
package/ddk-ffi/src/lib.rs
CHANGED
|
@@ -130,12 +130,6 @@ pub struct TxInputInfo {
|
|
|
130
130
|
pub serial_id: u64,
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
#[derive(Clone)]
|
|
134
|
-
pub struct DlcOutcome {
|
|
135
|
-
pub local_payout: u64,
|
|
136
|
-
pub remote_payout: u64,
|
|
137
|
-
}
|
|
138
|
-
|
|
139
133
|
#[derive(Clone)]
|
|
140
134
|
pub struct Payout {
|
|
141
135
|
pub offer: u64,
|
|
@@ -325,7 +319,7 @@ pub fn create_fund_tx_locking_script(
|
|
|
325
319
|
|
|
326
320
|
/// Create complete DLC transactions
|
|
327
321
|
pub fn create_dlc_transactions(
|
|
328
|
-
outcomes: Vec<
|
|
322
|
+
outcomes: Vec<Payout>,
|
|
329
323
|
local_params: PartyParams,
|
|
330
324
|
remote_params: PartyParams,
|
|
331
325
|
refund_locktime: u32,
|
|
@@ -342,8 +336,8 @@ pub fn create_dlc_transactions(
|
|
|
342
336
|
let payouts: Vec<DlcPayout> = outcomes
|
|
343
337
|
.iter()
|
|
344
338
|
.map(|outcome| DlcPayout {
|
|
345
|
-
offer: Amount::from_sat(outcome.
|
|
346
|
-
accept: Amount::from_sat(outcome.
|
|
339
|
+
offer: Amount::from_sat(outcome.offer),
|
|
340
|
+
accept: Amount::from_sat(outcome.accept),
|
|
347
341
|
})
|
|
348
342
|
.collect();
|
|
349
343
|
|
|
@@ -366,7 +360,7 @@ pub fn create_dlc_transactions(
|
|
|
366
360
|
|
|
367
361
|
/// Create spliced DLC transactions
|
|
368
362
|
pub fn create_spliced_dlc_transactions(
|
|
369
|
-
outcomes: Vec<
|
|
363
|
+
outcomes: Vec<Payout>,
|
|
370
364
|
local_params: PartyParams,
|
|
371
365
|
remote_params: PartyParams,
|
|
372
366
|
refund_locktime: u32,
|
|
@@ -383,8 +377,8 @@ pub fn create_spliced_dlc_transactions(
|
|
|
383
377
|
let payouts: Vec<DlcPayout> = outcomes
|
|
384
378
|
.iter()
|
|
385
379
|
.map(|outcome| DlcPayout {
|
|
386
|
-
offer: Amount::from_sat(outcome.
|
|
387
|
-
accept: Amount::from_sat(outcome.
|
|
380
|
+
offer: Amount::from_sat(outcome.offer),
|
|
381
|
+
accept: Amount::from_sat(outcome.accept),
|
|
388
382
|
})
|
|
389
383
|
.collect();
|
|
390
384
|
|
|
@@ -455,7 +449,7 @@ pub fn create_cets(
|
|
|
455
449
|
fund_vout: u32,
|
|
456
450
|
local_final_script_pubkey: Vec<u8>,
|
|
457
451
|
remote_final_script_pubkey: Vec<u8>,
|
|
458
|
-
outcomes: Vec<
|
|
452
|
+
outcomes: Vec<Payout>,
|
|
459
453
|
lock_time: u32,
|
|
460
454
|
local_serial_id: u64,
|
|
461
455
|
remote_serial_id: u64,
|
|
@@ -478,8 +472,8 @@ pub fn create_cets(
|
|
|
478
472
|
let payouts: Vec<DlcPayout> = outcomes
|
|
479
473
|
.iter()
|
|
480
474
|
.map(|outcome| DlcPayout {
|
|
481
|
-
offer: Amount::from_sat(outcome.
|
|
482
|
-
accept: Amount::from_sat(outcome.
|
|
475
|
+
offer: Amount::from_sat(outcome.offer),
|
|
476
|
+
accept: Amount::from_sat(outcome.accept),
|
|
483
477
|
})
|
|
484
478
|
.collect();
|
|
485
479
|
|
|
@@ -873,6 +867,30 @@ pub fn verify_cet_adaptor_sig_from_oracle_info(
|
|
|
873
867
|
true
|
|
874
868
|
}
|
|
875
869
|
|
|
870
|
+
pub fn verify_cet_adaptor_sigs_from_oracle_info(
|
|
871
|
+
adaptor_sigs: Vec<AdaptorSignature>,
|
|
872
|
+
cets: Vec<Transaction>,
|
|
873
|
+
oracle_infos: Vec<OracleInfo>,
|
|
874
|
+
pubkey: Vec<u8>,
|
|
875
|
+
funding_script_pubkey: Vec<u8>,
|
|
876
|
+
total_collateral: u64,
|
|
877
|
+
msgs: Vec<Vec<Vec<u8>>>,
|
|
878
|
+
) -> bool {
|
|
879
|
+
cets.into_iter()
|
|
880
|
+
.zip(adaptor_sigs.into_iter())
|
|
881
|
+
.all(|(cet, adaptor_sig)| {
|
|
882
|
+
verify_cet_adaptor_sig_from_oracle_info(
|
|
883
|
+
adaptor_sig,
|
|
884
|
+
cet,
|
|
885
|
+
oracle_infos.clone(),
|
|
886
|
+
pubkey.clone(),
|
|
887
|
+
funding_script_pubkey.clone(),
|
|
888
|
+
total_collateral,
|
|
889
|
+
msgs.clone(),
|
|
890
|
+
)
|
|
891
|
+
})
|
|
892
|
+
}
|
|
893
|
+
|
|
876
894
|
/// Create CET adaptor signature from oracle info
|
|
877
895
|
pub fn create_cet_adaptor_signature_from_oracle_info(
|
|
878
896
|
cet: Transaction,
|
|
@@ -1154,13 +1172,13 @@ mod tests {
|
|
|
1154
1172
|
);
|
|
1155
1173
|
|
|
1156
1174
|
let outcomes = vec![
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1175
|
+
Payout {
|
|
1176
|
+
offer: 200_000_000, // 2 BTC to offer
|
|
1177
|
+
accept: 0, // 0 BTC to accept
|
|
1160
1178
|
},
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1179
|
+
Payout {
|
|
1180
|
+
offer: 0, // 0 BTC to offer
|
|
1181
|
+
accept: 200_000_000, // 2 BTC to accept
|
|
1164
1182
|
},
|
|
1165
1183
|
];
|
|
1166
1184
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getter","globalThis","NativeDdkFfi","_default","exports","default","isRustFutureContinuationCallbackTypeCompatible","isUniffiForeignFutureTypeCompatible"],"sourceRoot":"../../src","sources":["ddk_ffi-ffi.ts"],"mappings":";;;;;;AAAA;AACA;;
|
|
1
|
+
{"version":3,"names":["getter","globalThis","NativeDdkFfi","_default","exports","default","isRustFutureContinuationCallbackTypeCompatible","isUniffiForeignFutureTypeCompatible"],"sourceRoot":"../../src","sources":["ddk_ffi-ffi.ts"],"mappings":";;;;;;AAAA;AACA;;AAoNA;AACA;AACA;AACA;AACA;AACA,MAAMA,MAAmC,GAAGA,CAAA,KACzCC,UAAU,CAASC,YAAY;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GACpBL,MAAM,EAErB;AAmHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMM,8CAGL,GAAG,IAAI;AACR,MAAMC,mCAGL,GAAG,IAAI","ignoreList":[]}
|
package/lib/commonjs/ddk_ffi.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.TxOutput = exports.TxInputInfo = exports.TxInput = exports.Transaction = exports.Payout = exports.PartyParams = exports.OracleInfo = exports.ExtendedKey_Tags = exports.ExtendedKey = exports.DlcTransactions = exports.
|
|
6
|
+
exports.TxOutput = exports.TxInputInfo = exports.TxInput = exports.Transaction = exports.Payout = exports.PartyParams = exports.OracleInfo = exports.ExtendedKey_Tags = exports.ExtendedKey = exports.DlcTransactions = exports.DlcInputInfo = exports.DlcError_Tags = exports.DlcError = exports.ChangeOutputAndFees = exports.AdaptorSignature = void 0;
|
|
7
7
|
exports.convertMnemonicToSeed = convertMnemonicToSeed;
|
|
8
8
|
exports.createCet = createCet;
|
|
9
9
|
exports.createCetAdaptorSignatureFromOracleInfo = createCetAdaptorSignatureFromOracleInfo;
|
|
@@ -23,6 +23,7 @@ exports.isDustOutput = isDustOutput;
|
|
|
23
23
|
exports.signCet = signCet;
|
|
24
24
|
exports.signFundTransactionInput = signFundTransactionInput;
|
|
25
25
|
exports.verifyCetAdaptorSigFromOracleInfo = verifyCetAdaptorSigFromOracleInfo;
|
|
26
|
+
exports.verifyCetAdaptorSigsFromOracleInfo = verifyCetAdaptorSigsFromOracleInfo;
|
|
26
27
|
exports.verifyFundTxSignature = verifyFundTxSignature;
|
|
27
28
|
exports.version = version;
|
|
28
29
|
var _ddk_ffiFfi = _interopRequireDefault(require("./ddk_ffi-ffi.js"));
|
|
@@ -79,7 +80,7 @@ function createCets(fundTxId, fundVout, localFinalScriptPubkey, remoteFinalScrip
|
|
|
79
80
|
return (() => {
|
|
80
81
|
console.debug(`-- uniffi_ddk_ffi_fn_func_create_cets`);
|
|
81
82
|
return (0, _ddk_ffiFfi.default)().ubrn_uniffi_ddk_ffi_fn_func_create_cets;
|
|
82
|
-
})()(FfiConverterString.lower(fundTxId), _uniffiBindgenReactNative.FfiConverterUInt32.lower(fundVout), FfiConverterArrayUInt8.lower(localFinalScriptPubkey), FfiConverterArrayUInt8.lower(remoteFinalScriptPubkey),
|
|
83
|
+
})()(FfiConverterString.lower(fundTxId), _uniffiBindgenReactNative.FfiConverterUInt32.lower(fundVout), FfiConverterArrayUInt8.lower(localFinalScriptPubkey), FfiConverterArrayUInt8.lower(remoteFinalScriptPubkey), FfiConverterArrayTypePayout.lower(outcomes), _uniffiBindgenReactNative.FfiConverterUInt32.lower(lockTime), _uniffiBindgenReactNative.FfiConverterUInt64.lower(localSerialId), _uniffiBindgenReactNative.FfiConverterUInt64.lower(remoteSerialId), callStatus);
|
|
83
84
|
}, /*liftString:*/FfiConverterString.lift));
|
|
84
85
|
}
|
|
85
86
|
function createDlcTransactions(outcomes, localParams, remoteParams, refundLocktime, feeRate, fundLockTime, cetLockTime, fundOutputSerialId) /*throws*/{
|
|
@@ -87,7 +88,7 @@ function createDlcTransactions(outcomes, localParams, remoteParams, refundLockti
|
|
|
87
88
|
return (() => {
|
|
88
89
|
console.debug(`-- uniffi_ddk_ffi_fn_func_create_dlc_transactions`);
|
|
89
90
|
return (0, _ddk_ffiFfi.default)().ubrn_uniffi_ddk_ffi_fn_func_create_dlc_transactions;
|
|
90
|
-
})()(
|
|
91
|
+
})()(FfiConverterArrayTypePayout.lower(outcomes), FfiConverterTypePartyParams.lower(localParams), FfiConverterTypePartyParams.lower(remoteParams), _uniffiBindgenReactNative.FfiConverterUInt32.lower(refundLocktime), _uniffiBindgenReactNative.FfiConverterUInt64.lower(feeRate), _uniffiBindgenReactNative.FfiConverterUInt32.lower(fundLockTime), _uniffiBindgenReactNative.FfiConverterUInt32.lower(cetLockTime), _uniffiBindgenReactNative.FfiConverterUInt64.lower(fundOutputSerialId), callStatus);
|
|
91
92
|
}, /*liftString:*/FfiConverterString.lift));
|
|
92
93
|
}
|
|
93
94
|
function createFundTxLockingScript(localFundPubkey, remoteFundPubkey) /*throws*/{
|
|
@@ -111,7 +112,7 @@ function createSplicedDlcTransactions(outcomes, localParams, remoteParams, refun
|
|
|
111
112
|
return (() => {
|
|
112
113
|
console.debug(`-- uniffi_ddk_ffi_fn_func_create_spliced_dlc_transactions`);
|
|
113
114
|
return (0, _ddk_ffiFfi.default)().ubrn_uniffi_ddk_ffi_fn_func_create_spliced_dlc_transactions;
|
|
114
|
-
})()(
|
|
115
|
+
})()(FfiConverterArrayTypePayout.lower(outcomes), FfiConverterTypePartyParams.lower(localParams), FfiConverterTypePartyParams.lower(remoteParams), _uniffiBindgenReactNative.FfiConverterUInt32.lower(refundLocktime), _uniffiBindgenReactNative.FfiConverterUInt64.lower(feeRate), _uniffiBindgenReactNative.FfiConverterUInt32.lower(fundLockTime), _uniffiBindgenReactNative.FfiConverterUInt32.lower(cetLockTime), _uniffiBindgenReactNative.FfiConverterUInt64.lower(fundOutputSerialId), callStatus);
|
|
115
116
|
}, /*liftString:*/FfiConverterString.lift));
|
|
116
117
|
}
|
|
117
118
|
function createXprivFromParentPath(xpriv, baseDerivationPath, network, path) /*throws*/{
|
|
@@ -186,6 +187,14 @@ function verifyCetAdaptorSigFromOracleInfo(adaptorSig, cet, oracleInfo, pubkey,
|
|
|
186
187
|
})()(FfiConverterTypeAdaptorSignature.lower(adaptorSig), FfiConverterTypeTransaction.lower(cet), FfiConverterArrayTypeOracleInfo.lower(oracleInfo), FfiConverterArrayUInt8.lower(pubkey), FfiConverterArrayUInt8.lower(fundingScriptPubkey), _uniffiBindgenReactNative.FfiConverterUInt64.lower(totalCollateral), FfiConverterArrayArrayArrayUInt8.lower(msgs), callStatus);
|
|
187
188
|
}, /*liftString:*/FfiConverterString.lift));
|
|
188
189
|
}
|
|
190
|
+
function verifyCetAdaptorSigsFromOracleInfo(adaptorSigs, cets, oracleInfo, pubkey, fundingScriptPubkey, totalCollateral, msgs) {
|
|
191
|
+
return _uniffiBindgenReactNative.FfiConverterBool.lift(uniffiCaller.rustCall(/*caller:*/callStatus => {
|
|
192
|
+
return (() => {
|
|
193
|
+
console.debug(`-- uniffi_ddk_ffi_fn_func_verify_cet_adaptor_sigs_from_oracle_info`);
|
|
194
|
+
return (0, _ddk_ffiFfi.default)().ubrn_uniffi_ddk_ffi_fn_func_verify_cet_adaptor_sigs_from_oracle_info;
|
|
195
|
+
})()(FfiConverterArrayTypeAdaptorSignature.lower(adaptorSigs), FfiConverterArrayTypeTransaction.lower(cets), FfiConverterArrayTypeOracleInfo.lower(oracleInfo), FfiConverterArrayUInt8.lower(pubkey), FfiConverterArrayUInt8.lower(fundingScriptPubkey), _uniffiBindgenReactNative.FfiConverterUInt64.lower(totalCollateral), FfiConverterArrayArrayArrayUInt8.lower(msgs), callStatus);
|
|
196
|
+
}, /*liftString:*/FfiConverterString.lift));
|
|
197
|
+
}
|
|
189
198
|
function verifyFundTxSignature(fundTx, signature, pubkey, txid, vout, inputAmount) /*throws*/{
|
|
190
199
|
return _uniffiBindgenReactNative.FfiConverterBool.lift(uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeDLCError.lift.bind(FfiConverterTypeDLCError), /*caller:*/callStatus => {
|
|
191
200
|
return (() => {
|
|
@@ -345,49 +354,6 @@ const FfiConverterTypeDlcInputInfo = (() => {
|
|
|
345
354
|
}
|
|
346
355
|
return new FFIConverter();
|
|
347
356
|
})();
|
|
348
|
-
/**
|
|
349
|
-
* Generated factory for {@link DlcOutcome} record objects.
|
|
350
|
-
*/
|
|
351
|
-
const DlcOutcome = exports.DlcOutcome = (() => {
|
|
352
|
-
const defaults = () => ({});
|
|
353
|
-
const create = (() => {
|
|
354
|
-
return (0, _uniffiBindgenReactNative.uniffiCreateRecord)(defaults);
|
|
355
|
-
})();
|
|
356
|
-
return Object.freeze({
|
|
357
|
-
/**
|
|
358
|
-
* Create a frozen instance of {@link DlcOutcome}, with defaults specified
|
|
359
|
-
* in Rust, in the {@link ddk_ffi} crate.
|
|
360
|
-
*/
|
|
361
|
-
create,
|
|
362
|
-
/**
|
|
363
|
-
* Create a frozen instance of {@link DlcOutcome}, with defaults specified
|
|
364
|
-
* in Rust, in the {@link ddk_ffi} crate.
|
|
365
|
-
*/
|
|
366
|
-
new: create,
|
|
367
|
-
/**
|
|
368
|
-
* Defaults specified in the {@link ddk_ffi} crate.
|
|
369
|
-
*/
|
|
370
|
-
defaults: () => Object.freeze(defaults())
|
|
371
|
-
});
|
|
372
|
-
})();
|
|
373
|
-
const FfiConverterTypeDlcOutcome = (() => {
|
|
374
|
-
class FFIConverter extends _uniffiBindgenReactNative.AbstractFfiConverterByteArray {
|
|
375
|
-
read(from) {
|
|
376
|
-
return {
|
|
377
|
-
localPayout: _uniffiBindgenReactNative.FfiConverterUInt64.read(from),
|
|
378
|
-
remotePayout: _uniffiBindgenReactNative.FfiConverterUInt64.read(from)
|
|
379
|
-
};
|
|
380
|
-
}
|
|
381
|
-
write(value, into) {
|
|
382
|
-
_uniffiBindgenReactNative.FfiConverterUInt64.write(value.localPayout, into);
|
|
383
|
-
_uniffiBindgenReactNative.FfiConverterUInt64.write(value.remotePayout, into);
|
|
384
|
-
}
|
|
385
|
-
allocationSize(value) {
|
|
386
|
-
return _uniffiBindgenReactNative.FfiConverterUInt64.allocationSize(value.localPayout) + _uniffiBindgenReactNative.FfiConverterUInt64.allocationSize(value.remotePayout);
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
return new FFIConverter();
|
|
390
|
-
})();
|
|
391
357
|
/**
|
|
392
358
|
* Generated factory for {@link DlcTransactions} record objects.
|
|
393
359
|
*/
|
|
@@ -1182,12 +1148,12 @@ const FfiConverterArrayTypeAdaptorSignature = new _uniffiBindgenReactNative.FfiC
|
|
|
1182
1148
|
// FfiConverter for Array<DlcInputInfo>
|
|
1183
1149
|
const FfiConverterArrayTypeDlcInputInfo = new _uniffiBindgenReactNative.FfiConverterArray(FfiConverterTypeDlcInputInfo);
|
|
1184
1150
|
|
|
1185
|
-
// FfiConverter for Array<DlcOutcome>
|
|
1186
|
-
const FfiConverterArrayTypeDlcOutcome = new _uniffiBindgenReactNative.FfiConverterArray(FfiConverterTypeDlcOutcome);
|
|
1187
|
-
|
|
1188
1151
|
// FfiConverter for Array<OracleInfo>
|
|
1189
1152
|
const FfiConverterArrayTypeOracleInfo = new _uniffiBindgenReactNative.FfiConverterArray(FfiConverterTypeOracleInfo);
|
|
1190
1153
|
|
|
1154
|
+
// FfiConverter for Array<Payout>
|
|
1155
|
+
const FfiConverterArrayTypePayout = new _uniffiBindgenReactNative.FfiConverterArray(FfiConverterTypePayout);
|
|
1156
|
+
|
|
1191
1157
|
// FfiConverter for Array<Transaction>
|
|
1192
1158
|
const FfiConverterArrayTypeTransaction = new _uniffiBindgenReactNative.FfiConverterArray(FfiConverterTypeTransaction);
|
|
1193
1159
|
|
|
@@ -1239,10 +1205,10 @@ function uniffiEnsureInitialized() {
|
|
|
1239
1205
|
if ((0, _ddk_ffiFfi.default)().ubrn_uniffi_ddk_ffi_checksum_func_create_cet_adaptor_sigs_from_oracle_info() !== 59405) {
|
|
1240
1206
|
throw new _uniffiBindgenReactNative.UniffiInternalError.ApiChecksumMismatch('uniffi_ddk_ffi_checksum_func_create_cet_adaptor_sigs_from_oracle_info');
|
|
1241
1207
|
}
|
|
1242
|
-
if ((0, _ddk_ffiFfi.default)().ubrn_uniffi_ddk_ffi_checksum_func_create_cets() !==
|
|
1208
|
+
if ((0, _ddk_ffiFfi.default)().ubrn_uniffi_ddk_ffi_checksum_func_create_cets() !== 50529) {
|
|
1243
1209
|
throw new _uniffiBindgenReactNative.UniffiInternalError.ApiChecksumMismatch('uniffi_ddk_ffi_checksum_func_create_cets');
|
|
1244
1210
|
}
|
|
1245
|
-
if ((0, _ddk_ffiFfi.default)().ubrn_uniffi_ddk_ffi_checksum_func_create_dlc_transactions() !==
|
|
1211
|
+
if ((0, _ddk_ffiFfi.default)().ubrn_uniffi_ddk_ffi_checksum_func_create_dlc_transactions() !== 29518) {
|
|
1246
1212
|
throw new _uniffiBindgenReactNative.UniffiInternalError.ApiChecksumMismatch('uniffi_ddk_ffi_checksum_func_create_dlc_transactions');
|
|
1247
1213
|
}
|
|
1248
1214
|
if ((0, _ddk_ffiFfi.default)().ubrn_uniffi_ddk_ffi_checksum_func_create_fund_tx_locking_script() !== 2761) {
|
|
@@ -1251,7 +1217,7 @@ function uniffiEnsureInitialized() {
|
|
|
1251
1217
|
if ((0, _ddk_ffiFfi.default)().ubrn_uniffi_ddk_ffi_checksum_func_create_refund_transaction() !== 57261) {
|
|
1252
1218
|
throw new _uniffiBindgenReactNative.UniffiInternalError.ApiChecksumMismatch('uniffi_ddk_ffi_checksum_func_create_refund_transaction');
|
|
1253
1219
|
}
|
|
1254
|
-
if ((0, _ddk_ffiFfi.default)().ubrn_uniffi_ddk_ffi_checksum_func_create_spliced_dlc_transactions() !==
|
|
1220
|
+
if ((0, _ddk_ffiFfi.default)().ubrn_uniffi_ddk_ffi_checksum_func_create_spliced_dlc_transactions() !== 19497) {
|
|
1255
1221
|
throw new _uniffiBindgenReactNative.UniffiInternalError.ApiChecksumMismatch('uniffi_ddk_ffi_checksum_func_create_spliced_dlc_transactions');
|
|
1256
1222
|
}
|
|
1257
1223
|
if ((0, _ddk_ffiFfi.default)().ubrn_uniffi_ddk_ffi_checksum_func_create_xpriv_from_parent_path() !== 50010) {
|
|
@@ -1281,6 +1247,9 @@ function uniffiEnsureInitialized() {
|
|
|
1281
1247
|
if ((0, _ddk_ffiFfi.default)().ubrn_uniffi_ddk_ffi_checksum_func_verify_cet_adaptor_sig_from_oracle_info() !== 52232) {
|
|
1282
1248
|
throw new _uniffiBindgenReactNative.UniffiInternalError.ApiChecksumMismatch('uniffi_ddk_ffi_checksum_func_verify_cet_adaptor_sig_from_oracle_info');
|
|
1283
1249
|
}
|
|
1250
|
+
if ((0, _ddk_ffiFfi.default)().ubrn_uniffi_ddk_ffi_checksum_func_verify_cet_adaptor_sigs_from_oracle_info() !== 37581) {
|
|
1251
|
+
throw new _uniffiBindgenReactNative.UniffiInternalError.ApiChecksumMismatch('uniffi_ddk_ffi_checksum_func_verify_cet_adaptor_sigs_from_oracle_info');
|
|
1252
|
+
}
|
|
1284
1253
|
if ((0, _ddk_ffiFfi.default)().ubrn_uniffi_ddk_ffi_checksum_func_verify_fund_tx_signature() !== 27316) {
|
|
1285
1254
|
throw new _uniffiBindgenReactNative.UniffiInternalError.ApiChecksumMismatch('uniffi_ddk_ffi_checksum_func_verify_fund_tx_signature');
|
|
1286
1255
|
}
|
|
@@ -1295,7 +1264,6 @@ var _default = exports.default = Object.freeze({
|
|
|
1295
1264
|
FfiConverterTypeChangeOutputAndFees,
|
|
1296
1265
|
FfiConverterTypeDLCError,
|
|
1297
1266
|
FfiConverterTypeDlcInputInfo,
|
|
1298
|
-
FfiConverterTypeDlcOutcome,
|
|
1299
1267
|
FfiConverterTypeDlcTransactions,
|
|
1300
1268
|
FfiConverterTypeExtendedKey,
|
|
1301
1269
|
FfiConverterTypeOracleInfo,
|