@bennyblader/ddk-rn 0.3.42 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/DdkRn.podspec +1 -1
  2. package/README.md +14 -0
  3. package/android/CMakeLists.txt +6 -3
  4. package/android/build.gradle +0 -1
  5. package/android/cpp-adapter.cpp +6 -26
  6. package/android/src/main/jniLibs/arm64-v8a/libddk_ffi.so +0 -0
  7. package/android/src/main/jniLibs/armeabi-v7a/libddk_ffi.so +0 -0
  8. package/android/src/main/jniLibs/x86/libddk_ffi.so +0 -0
  9. package/android/src/main/jniLibs/x86_64/libddk_ffi.so +0 -0
  10. package/cpp/bennyblader-ddk-rn.cpp +1 -1
  11. package/cpp/ddk_ffi.cpp +2361 -2671
  12. package/cpp/ddk_ffi.hpp +86 -255
  13. package/ios/DdkRn.xcframework/Info.plist +43 -0
  14. package/ios/DdkRn.xcframework/ios-arm64/libddk_ffi.a +0 -0
  15. package/ios/DdkRn.xcframework/ios-arm64-simulator/libddk_ffi.a +0 -0
  16. package/lib/commonjs/ddk_ffi-ffi.js +6 -29
  17. package/lib/commonjs/ddk_ffi-ffi.js.map +1 -1
  18. package/lib/commonjs/ddk_ffi.js +961 -944
  19. package/lib/commonjs/ddk_ffi.js.map +1 -1
  20. package/lib/module/ddk_ffi-ffi.js +6 -29
  21. package/lib/module/ddk_ffi-ffi.js.map +1 -1
  22. package/lib/module/ddk_ffi.js +924 -896
  23. package/lib/module/ddk_ffi.js.map +1 -1
  24. package/lib/typescript/commonjs/src/ddk_ffi-ffi.d.ts +71 -96
  25. package/lib/typescript/commonjs/src/ddk_ffi-ffi.d.ts.map +1 -1
  26. package/lib/typescript/commonjs/src/ddk_ffi.d.ts +500 -471
  27. package/lib/typescript/commonjs/src/ddk_ffi.d.ts.map +1 -1
  28. package/lib/typescript/module/src/ddk_ffi-ffi.d.ts +71 -96
  29. package/lib/typescript/module/src/ddk_ffi-ffi.d.ts.map +1 -1
  30. package/lib/typescript/module/src/ddk_ffi.d.ts +500 -471
  31. package/lib/typescript/module/src/ddk_ffi.d.ts.map +1 -1
  32. package/package.json +8 -38
  33. package/src/ddk_ffi-ffi.ts +419 -170
  34. package/src/ddk_ffi.ts +2648 -1939
  35. package/ubrn.config.yaml +18 -1
  36. package/ddk-ffi/Cargo.lock +0 -1013
  37. package/ddk-ffi/Cargo.toml +0 -36
  38. package/ddk-ffi/build.rs +0 -3
  39. package/ddk-ffi/rust-toolchain.toml +0 -10
  40. package/ddk-ffi/src/ddk_ffi.udl +0 -376
  41. package/ddk-ffi/src/lib.rs +0 -2509
  42. package/ddk-ffi/src/uniffi-bindgen.rs +0 -3
  43. package/ddk-ffi/uniffi.toml +0 -18
  44. package/scripts/apply-hotfix.js +0 -96
  45. package/scripts/postinstall.js +0 -298
  46. package/scripts/prepare-rust-src.js +0 -51
@@ -1,36 +0,0 @@
1
- [package]
2
- name = "ddk_ffi"
3
- version = "0.3.42"
4
- edition = "2021"
5
- license = "MIT"
6
- description = "rust-dlc language bindings"
7
- repository = "https://github.com/bennyhodl/ddk-ffi"
8
- homepage = "https://github.com/bennyhodl/ddk-ffi"
9
- readme = "README.md"
10
-
11
- [lib]
12
- name = "ddk_ffi"
13
- crate-type = ["cdylib", "staticlib", "rlib"]
14
-
15
- [dependencies]
16
- uniffi = { version = "0.29.4", features = ["cli"] }
17
- # ddk-dlc = { path = "../../../ernest/dlcdevkit/dlc", features = ["use-serde"] }
18
- # ddk-dlc = { git = "https://github.com/bennyhodl/dlcdevkit.git", branch = "master", features = ["use-serde"] }
19
- ddk-dlc = { version = "1.1.1", features = ["use-serde"] }
20
- bitcoin = "0.32.7"
21
- thiserror = "2.0.12"
22
- secp256k1-zkp = "0.11.0"
23
- bip39 = "2.2.0"
24
-
25
- [dev-dependencies]
26
- bip39 = {version = "2.2.0", features = ["rand"]}
27
-
28
- [build-dependencies]
29
- uniffi = { version = "0.29.4", features = ["build"] }
30
-
31
- [package.metadata.uniffi]
32
- udl_file = "src/ddk_ffi.udl"
33
-
34
- [[bin]]
35
- name = "uniffi-bindgen"
36
- path = "src/uniffi-bindgen.rs"
package/ddk-ffi/build.rs DELETED
@@ -1,3 +0,0 @@
1
- fn main() {
2
- uniffi::generate_scaffolding("src/ddk_ffi.udl").unwrap();
3
- }
@@ -1,10 +0,0 @@
1
- [toolchain]
2
- channel = "stable"
3
- targets = [
4
- "aarch64-apple-ios",
5
- "aarch64-apple-ios-sim",
6
- "aarch64-linux-android",
7
- "armv7-linux-androideabi",
8
- "i686-linux-android",
9
- "x86_64-linux-android"
10
- ]
@@ -1,376 +0,0 @@
1
- namespace ddk_ffi {
2
- string version();
3
-
4
- // === SEED OPERATIONS ===
5
- [Throws=DLCError]
6
- sequence<u8> convert_mnemonic_to_seed(string mnemonic, string? passphrase);
7
-
8
- [Throws=DLCError]
9
- sequence<u8> create_extkey_from_seed(sequence<u8> seed, string network);
10
-
11
- // === EXTENDED KEY OPERATIONS ===
12
- [Throws=DLCError]
13
- sequence<u8> create_extkey_from_parent_path(sequence<u8> extkey, string path);
14
-
15
- [Throws=DLCError]
16
- sequence<u8> get_pubkey_from_extkey(sequence<u8> extkey, string network);
17
-
18
- [Throws=DLCError]
19
- sequence<u8> get_xpub_from_xpriv(sequence<u8> xpriv, string network);
20
-
21
- // === DEPRECATED ===
22
- [Throws=DLCError]
23
- sequence<u8> create_xpriv_from_parent_path(
24
- sequence<u8> seed_or_xpriv,
25
- string base_derivation_path,
26
- string network,
27
- string path
28
- );
29
-
30
- // DLC Transaction Creation Functions
31
- [Throws=DLCError]
32
- sequence<u8> create_fund_tx_locking_script(
33
- sequence<u8> local_fund_pubkey,
34
- sequence<u8> remote_fund_pubkey
35
- );
36
-
37
- [Throws=DLCError]
38
- DlcTransactions create_dlc_transactions(
39
- sequence<Payout> outcomes,
40
- PartyParams local_params,
41
- PartyParams remote_params,
42
- u32 refund_locktime,
43
- u64 fee_rate,
44
- u32 fund_lock_time,
45
- u32 cet_lock_time,
46
- u64 fund_output_serial_id,
47
- u8 contract_flags
48
- );
49
-
50
- [Throws=DLCError]
51
- DlcTransactions create_spliced_dlc_transactions(
52
- sequence<Payout> outcomes,
53
- PartyParams local_params,
54
- PartyParams remote_params,
55
- u32 refund_locktime,
56
- u64 fee_rate,
57
- u32 fund_lock_time,
58
- u32 cet_lock_time,
59
- u64 fund_output_serial_id,
60
- u8 contract_flags
61
- );
62
-
63
- [Throws=DLCError]
64
- Transaction create_cet(
65
- TxOutput local_output,
66
- u64 local_payout_serial_id,
67
- TxOutput remote_output,
68
- u64 remote_payout_serial_id,
69
- string fund_tx_id,
70
- u32 fund_vout,
71
- u32 lock_time
72
- );
73
-
74
- [Throws=DLCError]
75
- sequence<Transaction> create_cets(
76
- string fund_tx_id,
77
- u32 fund_vout,
78
- sequence<u8> local_final_script_pubkey,
79
- sequence<u8> remote_final_script_pubkey,
80
- sequence<Payout> outcomes,
81
- u32 lock_time,
82
- u64 local_serial_id,
83
- u64 remote_serial_id
84
- );
85
-
86
- [Throws=DLCError]
87
- Transaction create_refund_transaction(
88
- sequence<u8> local_final_script_pubkey,
89
- sequence<u8> remote_final_script_pubkey,
90
- u64 local_amount,
91
- u64 remote_amount,
92
- u32 lock_time,
93
- string fund_tx_id,
94
- u32 fund_vout
95
- );
96
-
97
- // Utility Functions
98
- boolean is_dust_output(TxOutput output);
99
-
100
- [Throws=DLCError]
101
- ChangeOutputAndFees get_change_output_and_fees(
102
- PartyParams params,
103
- u64 fee_rate
104
- );
105
-
106
- u32 get_total_input_vsize(sequence<TxInputInfo> inputs);
107
-
108
- [Throws=DLCError]
109
- boolean verify_fund_tx_signature(
110
- Transaction fund_tx,
111
- sequence<u8> signature,
112
- sequence<u8> pubkey,
113
- string txid,
114
- u32 vout,
115
- u64 input_amount
116
- );
117
-
118
- [Throws=DLCError]
119
- Transaction add_signature_to_transaction(
120
- Transaction tx,
121
- sequence<u8> signature,
122
- sequence<u8> pubkey,
123
- u32 input_index
124
- );
125
-
126
- [Throws=DLCError]
127
- Transaction sign_multi_sig_input(
128
- Transaction tx,
129
- DlcInputInfo dlc_input,
130
- sequence<u8> local_privkey,
131
- sequence<u8> remote_signature
132
- );
133
-
134
- [Throws=DLCError]
135
- Transaction sign_cet(
136
- Transaction cet,
137
- sequence<u8> adaptor_signature,
138
- sequence<sequence<u8>> oracle_signatures,
139
- sequence<u8> funding_secret_key,
140
- sequence<u8> other_pubkey,
141
- sequence<u8> funding_script_pubkey,
142
- u64 fund_output_value
143
- );
144
-
145
- [Throws=DLCError]
146
- sequence<AdaptorSignature> create_cet_adaptor_sigs_from_oracle_info(
147
- sequence<Transaction> cets,
148
- sequence<OracleInfo> oracle_info,
149
- sequence<u8> funding_secret_key,
150
- sequence<u8> funding_script_pubkey,
151
- u64 fund_output_value,
152
- sequence<sequence<sequence<sequence<u8>>>> msgs
153
- );
154
-
155
- [Throws=DLCError]
156
- sequence<AdaptorSignature> create_cet_adaptor_sigs_from_points(
157
- sequence<Transaction> cets,
158
- sequence<sequence<u8>> adaptor_points,
159
- sequence<u8> funding_secret_key,
160
- sequence<u8> funding_script_pubkey,
161
- u64 fund_output_value
162
- );
163
-
164
- boolean verify_cet_adaptor_sigs_from_oracle_info(
165
- sequence<AdaptorSignature> adaptor_sigs,
166
- sequence<Transaction> cets,
167
- sequence<OracleInfo> oracle_info,
168
- sequence<u8> pubkey,
169
- sequence<u8> funding_script_pubkey,
170
- u64 total_collateral,
171
- sequence<sequence<sequence<sequence<u8>>>> msgs
172
- );
173
-
174
- boolean verify_cet_adaptor_sig_from_oracle_info(
175
- AdaptorSignature adaptor_sig,
176
- Transaction cet,
177
- sequence<OracleInfo> oracle_info,
178
- sequence<u8> pubkey,
179
- sequence<u8> funding_script_pubkey,
180
- u64 total_collateral,
181
- sequence<sequence<sequence<u8>>> msgs
182
- );
183
-
184
- // Signing Functions
185
- [Throws=DLCError]
186
- sequence<u8> get_raw_funding_transaction_input_signature(
187
- Transaction funding_transaction,
188
- sequence<u8> privkey,
189
- string prev_tx_id,
190
- u32 prev_tx_vout,
191
- u64 value
192
- );
193
-
194
- [Throws=DLCError]
195
- Transaction sign_fund_transaction_input(
196
- Transaction fund_transaction,
197
- sequence<u8> privkey,
198
- string prev_tx_id,
199
- u32 prev_tx_vout,
200
- u64 value
201
- );
202
-
203
- // Adaptor Signature Functions
204
- [Throws=DLCError]
205
- AdaptorSignature create_cet_adaptor_signature_from_oracle_info(
206
- Transaction cet,
207
- OracleInfo oracle_info,
208
- sequence<u8> funding_sk,
209
- sequence<u8> funding_script_pubkey,
210
- u64 total_collateral,
211
- sequence<sequence<u8>> msgs
212
- );
213
-
214
- [Throws=DLCError]
215
- sequence<sequence<u8>> create_cet_adaptor_points_from_oracle_info(
216
- sequence<OracleInfo> oracle_info,
217
- sequence<sequence<sequence<sequence<u8>>>> msgs
218
- );
219
-
220
- [Throws=DLCError]
221
- sequence<u8> extract_ecdsa_signature_from_oracle_signatures(
222
- sequence<sequence<u8>> oracle_signatures,
223
- sequence<u8> adaptor_signature
224
- );
225
-
226
- // Debug function to get all inputs for adaptor signature creation
227
- // Use this to compare values with Fordefi
228
- [Throws=DLCError]
229
- CetAdaptorSignatureDebugInfo get_cet_adaptor_signature_inputs(
230
- Transaction cet,
231
- sequence<OracleInfo> oracle_info,
232
- sequence<u8> funding_script_pubkey,
233
- u64 fund_output_value,
234
- sequence<sequence<sequence<u8>>> msgs
235
- );
236
-
237
- // Get sighash for a CET - the actual message that gets signed
238
- [Throws=DLCError]
239
- sequence<u8> get_cet_sighash(
240
- Transaction cet,
241
- sequence<u8> funding_script_pubkey,
242
- u64 fund_output_value
243
- );
244
- };
245
-
246
- // Transaction representation
247
- dictionary Transaction {
248
- i32 version;
249
- u32 lock_time;
250
- sequence<TxInput> inputs;
251
- sequence<TxOutput> outputs;
252
- sequence<u8> raw_bytes;
253
- };
254
-
255
- // Transaction input
256
- dictionary TxInput {
257
- string txid;
258
- u32 vout;
259
- sequence<u8> script_sig;
260
- u32 sequence;
261
- sequence<sequence<u8>> witness;
262
- };
263
-
264
- // Transaction output
265
- dictionary TxOutput {
266
- u64 value;
267
- sequence<u8> script_pubkey;
268
- };
269
-
270
- // Input information for funding
271
- dictionary TxInputInfo {
272
- string txid;
273
- u32 vout;
274
- sequence<u8> script_sig;
275
- u32 max_witness_length;
276
- u64 serial_id;
277
- };
278
-
279
- // Payout for offer and accept parties
280
- dictionary Payout {
281
- u64 offer;
282
- u64 accept;
283
- };
284
-
285
- // Parameters for a party in the DLC
286
- dictionary PartyParams {
287
- sequence<u8> fund_pubkey;
288
- sequence<u8> change_script_pubkey;
289
- u64 change_serial_id;
290
- sequence<u8> payout_script_pubkey;
291
- u64 payout_serial_id;
292
- sequence<TxInputInfo> inputs;
293
- u64 input_amount;
294
- u64 collateral;
295
- sequence<DlcInputInfo> dlc_inputs;
296
- };
297
-
298
- dictionary DlcInputInfo {
299
- Transaction fund_tx;
300
- u32 fund_vout;
301
- sequence<u8> local_fund_pubkey;
302
- sequence<u8> remote_fund_pubkey;
303
- u64 fund_amount;
304
- u32 max_witness_len;
305
- u64 input_serial_id;
306
- sequence<u8> contract_id;
307
- };
308
-
309
- // Container for all DLC transactions
310
- dictionary DlcTransactions {
311
- Transaction fund;
312
- sequence<Transaction> cets;
313
- Transaction refund;
314
- sequence<u8> funding_script_pubkey;
315
- };
316
-
317
- // Adaptor signature with proof
318
- dictionary AdaptorSignature {
319
- sequence<u8> signature;
320
- sequence<u8> proof;
321
- };
322
-
323
- // Change output and fees result
324
- dictionary ChangeOutputAndFees {
325
- TxOutput change_output;
326
- u64 fund_fee;
327
- u64 cet_fee;
328
- };
329
-
330
- // Oracle information
331
- dictionary OracleInfo {
332
- sequence<u8> public_key;
333
- sequence<sequence<u8>> nonces;
334
- };
335
-
336
- // Debug info for CET adaptor signature inputs
337
- // All the values that go into creating an adaptor signature
338
- dictionary CetAdaptorSignatureDebugInfo {
339
- // The sighash (32 bytes) - this is the message that gets signed
340
- sequence<u8> sighash;
341
- // The adaptor point (33 bytes compressed public key)
342
- sequence<u8> adaptor_point;
343
- // Input index (always 0 for CETs)
344
- u32 input_index;
345
- // The funding script pubkey used for sighash
346
- sequence<u8> script_pubkey;
347
- // The fund output value used for sighash
348
- u64 value;
349
- // The CET txid
350
- string cet_txid;
351
- // Raw CET bytes for verification
352
- sequence<u8> cet_raw;
353
- };
354
-
355
- // Error types for DLC operations
356
- [Error]
357
- enum DLCError {
358
- "InvalidSignature",
359
- "InvalidPublicKey",
360
- "InvalidTransaction",
361
- "InsufficientFunds",
362
- "InvalidArgument",
363
- "SerializationError",
364
- "Secp256k1Error",
365
- "MiniscriptError",
366
- "InvalidNetwork",
367
- "KeyError",
368
- };
369
-
370
- [Error]
371
- enum ExtendedKey {
372
- "InvalidMnemonic",
373
- "InvalidXpriv",
374
- "InvalidXpub",
375
- "InvalidDerivationPath",
376
- };