@bennyblader/ddk-rn 0.1.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.
Files changed (60) hide show
  1. package/DdkRn.podspec +44 -0
  2. package/LICENSE +20 -0
  3. package/README.md +33 -0
  4. package/android/CMakeLists.txt +76 -0
  5. package/android/build.gradle +144 -0
  6. package/android/cpp-adapter.cpp +63 -0
  7. package/android/gradle.properties +5 -0
  8. package/android/proguard-rules.pro +4 -0
  9. package/android/src/main/AndroidManifest.xml +5 -0
  10. package/android/src/main/AndroidManifestNew.xml +2 -0
  11. package/android/src/main/java/com/ddkrn/DdkRnModule.kt +43 -0
  12. package/android/src/main/java/com/ddkrn/DdkRnPackage.kt +34 -0
  13. package/cpp/bennyblader-ddk-rn.cpp +16 -0
  14. package/cpp/bennyblader-ddk-rn.h +15 -0
  15. package/cpp/ddk_ffi.cpp +2557 -0
  16. package/cpp/ddk_ffi.hpp +78 -0
  17. package/ios/DdkRn.h +16 -0
  18. package/ios/DdkRn.mm +66 -0
  19. package/lib/commonjs/NativeDdkRn.js +10 -0
  20. package/lib/commonjs/NativeDdkRn.js.map +1 -0
  21. package/lib/commonjs/ddk_ffi-ffi.js +44 -0
  22. package/lib/commonjs/ddk_ffi-ffi.js.map +1 -0
  23. package/lib/commonjs/ddk_ffi.js +1072 -0
  24. package/lib/commonjs/ddk_ffi.js.map +1 -0
  25. package/lib/commonjs/index.js +63 -0
  26. package/lib/commonjs/index.js.map +1 -0
  27. package/lib/commonjs/package.json +1 -0
  28. package/lib/module/NativeDdkRn.js +7 -0
  29. package/lib/module/NativeDdkRn.js.map +1 -0
  30. package/lib/module/ddk_ffi-ffi.js +43 -0
  31. package/lib/module/ddk_ffi-ffi.js.map +1 -0
  32. package/lib/module/ddk_ffi.js +1052 -0
  33. package/lib/module/ddk_ffi.js.map +1 -0
  34. package/lib/module/index.js +43 -0
  35. package/lib/module/index.js.map +1 -0
  36. package/lib/module/package.json +1 -0
  37. package/lib/typescript/commonjs/package.json +1 -0
  38. package/lib/typescript/commonjs/src/NativeDdkRn.d.ts +8 -0
  39. package/lib/typescript/commonjs/src/NativeDdkRn.d.ts.map +1 -0
  40. package/lib/typescript/commonjs/src/ddk_ffi-ffi.d.ts +108 -0
  41. package/lib/typescript/commonjs/src/ddk_ffi-ffi.d.ts.map +1 -0
  42. package/lib/typescript/commonjs/src/ddk_ffi.d.ts +773 -0
  43. package/lib/typescript/commonjs/src/ddk_ffi.d.ts.map +1 -0
  44. package/lib/typescript/commonjs/src/index.d.ts +8 -0
  45. package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
  46. package/lib/typescript/module/package.json +1 -0
  47. package/lib/typescript/module/src/NativeDdkRn.d.ts +8 -0
  48. package/lib/typescript/module/src/NativeDdkRn.d.ts.map +1 -0
  49. package/lib/typescript/module/src/ddk_ffi-ffi.d.ts +108 -0
  50. package/lib/typescript/module/src/ddk_ffi-ffi.d.ts.map +1 -0
  51. package/lib/typescript/module/src/ddk_ffi.d.ts +773 -0
  52. package/lib/typescript/module/src/ddk_ffi.d.ts.map +1 -0
  53. package/lib/typescript/module/src/index.d.ts +8 -0
  54. package/lib/typescript/module/src/index.d.ts.map +1 -0
  55. package/package.json +206 -0
  56. package/scripts/postinstall.js +130 -0
  57. package/src/NativeDdkRn.ts +10 -0
  58. package/src/ddk_ffi-ffi.ts +307 -0
  59. package/src/ddk_ffi.ts +1743 -0
  60. package/src/index.tsx +41 -0
@@ -0,0 +1,1052 @@
1
+ "use strict";
2
+
3
+ // This file was autogenerated by some hot garbage in the `uniffi-bindgen-react-native` crate.
4
+ // Trust me, you don't want to mess with it!
5
+ import nativeModule from "./ddk_ffi-ffi.js";
6
+ import { AbstractFfiConverterByteArray, FfiConverterArray, FfiConverterBool, FfiConverterInt32, FfiConverterUInt32, FfiConverterUInt64, FfiConverterUInt8, UniffiError, UniffiInternalError, UniffiRustCaller, uniffiCreateFfiConverterString, uniffiCreateRecord, uniffiTypeNameSymbol, variantOrdinalSymbol } from 'uniffi-bindgen-react-native';
7
+
8
+ // Get converters from the other files, if any.
9
+ const uniffiCaller = new UniffiRustCaller(() => ({
10
+ code: 0
11
+ }));
12
+ const uniffiIsDebug =
13
+ // @ts-ignore -- The process global might not be defined
14
+ typeof process !== 'object' ||
15
+ // @ts-ignore -- The process global might not be defined
16
+ process?.env?.NODE_ENV !== 'production' || true;
17
+ // Public interface members begin here.
18
+
19
+ export function createCet(localOutput, localPayoutSerialId, remoteOutput, remotePayoutSerialId, fundTxId, fundVout, lockTime) /*throws*/{
20
+ return FfiConverterTypeTransaction.lift(uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeDLCError.lift.bind(FfiConverterTypeDLCError), /*caller:*/callStatus => {
21
+ return (() => {
22
+ console.debug(`-- uniffi_ddk_ffi_fn_func_create_cet`);
23
+ return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_create_cet;
24
+ })()(FfiConverterTypeTxOutput.lower(localOutput), FfiConverterUInt64.lower(localPayoutSerialId), FfiConverterTypeTxOutput.lower(remoteOutput), FfiConverterUInt64.lower(remotePayoutSerialId), FfiConverterString.lower(fundTxId), FfiConverterUInt32.lower(fundVout), FfiConverterUInt32.lower(lockTime), callStatus);
25
+ }, /*liftString:*/FfiConverterString.lift));
26
+ }
27
+ export function createCetAdaptorSignatureFromOracleInfo(cet, oracleInfo, fundingSk, fundingScriptPubkey, totalCollateral, msgs) /*throws*/{
28
+ return FfiConverterTypeAdaptorSignature.lift(uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeDLCError.lift.bind(FfiConverterTypeDLCError), /*caller:*/callStatus => {
29
+ return (() => {
30
+ console.debug(`-- uniffi_ddk_ffi_fn_func_create_cet_adaptor_signature_from_oracle_info`);
31
+ return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_create_cet_adaptor_signature_from_oracle_info;
32
+ })()(FfiConverterTypeTransaction.lower(cet), FfiConverterTypeOracleInfo.lower(oracleInfo), FfiConverterArrayUInt8.lower(fundingSk), FfiConverterArrayUInt8.lower(fundingScriptPubkey), FfiConverterUInt64.lower(totalCollateral), FfiConverterArrayArrayUInt8.lower(msgs), callStatus);
33
+ }, /*liftString:*/FfiConverterString.lift));
34
+ }
35
+ export function createCets(fundTxId, fundVout, localFinalScriptPubkey, remoteFinalScriptPubkey, outcomes, lockTime, localSerialId, remoteSerialId) /*throws*/{
36
+ return FfiConverterArrayTypeTransaction.lift(uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeDLCError.lift.bind(FfiConverterTypeDLCError), /*caller:*/callStatus => {
37
+ return (() => {
38
+ console.debug(`-- uniffi_ddk_ffi_fn_func_create_cets`);
39
+ return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_create_cets;
40
+ })()(FfiConverterString.lower(fundTxId), FfiConverterUInt32.lower(fundVout), FfiConverterArrayUInt8.lower(localFinalScriptPubkey), FfiConverterArrayUInt8.lower(remoteFinalScriptPubkey), FfiConverterArrayTypeDlcOutcome.lower(outcomes), FfiConverterUInt32.lower(lockTime), FfiConverterUInt64.lower(localSerialId), FfiConverterUInt64.lower(remoteSerialId), callStatus);
41
+ }, /*liftString:*/FfiConverterString.lift));
42
+ }
43
+ export function createDlcTransactions(outcomes, localParams, remoteParams, refundLocktime, feeRate, fundLockTime, cetLockTime, fundOutputSerialId) /*throws*/{
44
+ return FfiConverterTypeDlcTransactions.lift(uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeDLCError.lift.bind(FfiConverterTypeDLCError), /*caller:*/callStatus => {
45
+ return (() => {
46
+ console.debug(`-- uniffi_ddk_ffi_fn_func_create_dlc_transactions`);
47
+ return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_create_dlc_transactions;
48
+ })()(FfiConverterArrayTypeDlcOutcome.lower(outcomes), FfiConverterTypePartyParams.lower(localParams), FfiConverterTypePartyParams.lower(remoteParams), FfiConverterUInt32.lower(refundLocktime), FfiConverterUInt64.lower(feeRate), FfiConverterUInt32.lower(fundLockTime), FfiConverterUInt32.lower(cetLockTime), FfiConverterUInt64.lower(fundOutputSerialId), callStatus);
49
+ }, /*liftString:*/FfiConverterString.lift));
50
+ }
51
+ export function createFundTxLockingScript(localFundPubkey, remoteFundPubkey) /*throws*/{
52
+ return FfiConverterArrayUInt8.lift(uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeDLCError.lift.bind(FfiConverterTypeDLCError), /*caller:*/callStatus => {
53
+ return (() => {
54
+ console.debug(`-- uniffi_ddk_ffi_fn_func_create_fund_tx_locking_script`);
55
+ return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_create_fund_tx_locking_script;
56
+ })()(FfiConverterArrayUInt8.lower(localFundPubkey), FfiConverterArrayUInt8.lower(remoteFundPubkey), callStatus);
57
+ }, /*liftString:*/FfiConverterString.lift));
58
+ }
59
+ export function createRefundTransaction(localFinalScriptPubkey, remoteFinalScriptPubkey, localAmount, remoteAmount, lockTime, fundTxId, fundVout) /*throws*/{
60
+ return FfiConverterTypeTransaction.lift(uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeDLCError.lift.bind(FfiConverterTypeDLCError), /*caller:*/callStatus => {
61
+ return (() => {
62
+ console.debug(`-- uniffi_ddk_ffi_fn_func_create_refund_transaction`);
63
+ return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_create_refund_transaction;
64
+ })()(FfiConverterArrayUInt8.lower(localFinalScriptPubkey), FfiConverterArrayUInt8.lower(remoteFinalScriptPubkey), FfiConverterUInt64.lower(localAmount), FfiConverterUInt64.lower(remoteAmount), FfiConverterUInt32.lower(lockTime), FfiConverterString.lower(fundTxId), FfiConverterUInt32.lower(fundVout), callStatus);
65
+ }, /*liftString:*/FfiConverterString.lift));
66
+ }
67
+ export function createSplicedDlcTransactions(outcomes, localParams, remoteParams, refundLocktime, feeRate, fundLockTime, cetLockTime, fundOutputSerialId) /*throws*/{
68
+ return FfiConverterTypeDlcTransactions.lift(uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeDLCError.lift.bind(FfiConverterTypeDLCError), /*caller:*/callStatus => {
69
+ return (() => {
70
+ console.debug(`-- uniffi_ddk_ffi_fn_func_create_spliced_dlc_transactions`);
71
+ return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_create_spliced_dlc_transactions;
72
+ })()(FfiConverterArrayTypeDlcOutcome.lower(outcomes), FfiConverterTypePartyParams.lower(localParams), FfiConverterTypePartyParams.lower(remoteParams), FfiConverterUInt32.lower(refundLocktime), FfiConverterUInt64.lower(feeRate), FfiConverterUInt32.lower(fundLockTime), FfiConverterUInt32.lower(cetLockTime), FfiConverterUInt64.lower(fundOutputSerialId), callStatus);
73
+ }, /*liftString:*/FfiConverterString.lift));
74
+ }
75
+ export function getChangeOutputAndFees(params, feeRate) /*throws*/{
76
+ return FfiConverterTypeChangeOutputAndFees.lift(uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeDLCError.lift.bind(FfiConverterTypeDLCError), /*caller:*/callStatus => {
77
+ return (() => {
78
+ console.debug(`-- uniffi_ddk_ffi_fn_func_get_change_output_and_fees`);
79
+ return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_get_change_output_and_fees;
80
+ })()(FfiConverterTypePartyParams.lower(params), FfiConverterUInt64.lower(feeRate), callStatus);
81
+ }, /*liftString:*/FfiConverterString.lift));
82
+ }
83
+ export function getRawFundingTransactionInputSignature(fundingTransaction, privkey, prevTxId, prevTxVout, value) /*throws*/{
84
+ return FfiConverterArrayUInt8.lift(uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeDLCError.lift.bind(FfiConverterTypeDLCError), /*caller:*/callStatus => {
85
+ return (() => {
86
+ console.debug(`-- uniffi_ddk_ffi_fn_func_get_raw_funding_transaction_input_signature`);
87
+ return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_get_raw_funding_transaction_input_signature;
88
+ })()(FfiConverterTypeTransaction.lower(fundingTransaction), FfiConverterArrayUInt8.lower(privkey), FfiConverterString.lower(prevTxId), FfiConverterUInt32.lower(prevTxVout), FfiConverterUInt64.lower(value), callStatus);
89
+ }, /*liftString:*/FfiConverterString.lift));
90
+ }
91
+ export function getTotalInputVsize(inputs) {
92
+ return FfiConverterUInt32.lift(uniffiCaller.rustCall(/*caller:*/callStatus => {
93
+ return (() => {
94
+ console.debug(`-- uniffi_ddk_ffi_fn_func_get_total_input_vsize`);
95
+ return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_get_total_input_vsize;
96
+ })()(FfiConverterArrayTypeTxInputInfo.lower(inputs), callStatus);
97
+ }, /*liftString:*/FfiConverterString.lift));
98
+ }
99
+ export function isDustOutput(output) {
100
+ return FfiConverterBool.lift(uniffiCaller.rustCall(/*caller:*/callStatus => {
101
+ return (() => {
102
+ console.debug(`-- uniffi_ddk_ffi_fn_func_is_dust_output`);
103
+ return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_is_dust_output;
104
+ })()(FfiConverterTypeTxOutput.lower(output), callStatus);
105
+ }, /*liftString:*/FfiConverterString.lift));
106
+ }
107
+ export function signFundTransactionInput(fundTransaction, privkey, prevTxId, prevTxVout, value) /*throws*/{
108
+ return FfiConverterTypeTransaction.lift(uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeDLCError.lift.bind(FfiConverterTypeDLCError), /*caller:*/callStatus => {
109
+ return (() => {
110
+ console.debug(`-- uniffi_ddk_ffi_fn_func_sign_fund_transaction_input`);
111
+ return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_sign_fund_transaction_input;
112
+ })()(FfiConverterTypeTransaction.lower(fundTransaction), FfiConverterArrayUInt8.lower(privkey), FfiConverterString.lower(prevTxId), FfiConverterUInt32.lower(prevTxVout), FfiConverterUInt64.lower(value), callStatus);
113
+ }, /*liftString:*/FfiConverterString.lift));
114
+ }
115
+ export function verifyFundTxSignature(fundTx, signature, pubkey, txid, vout, inputAmount) /*throws*/{
116
+ return FfiConverterBool.lift(uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeDLCError.lift.bind(FfiConverterTypeDLCError), /*caller:*/callStatus => {
117
+ return (() => {
118
+ console.debug(`-- uniffi_ddk_ffi_fn_func_verify_fund_tx_signature`);
119
+ return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_verify_fund_tx_signature;
120
+ })()(FfiConverterTypeTransaction.lower(fundTx), FfiConverterArrayUInt8.lower(signature), FfiConverterArrayUInt8.lower(pubkey), FfiConverterString.lower(txid), FfiConverterUInt32.lower(vout), FfiConverterUInt64.lower(inputAmount), callStatus);
121
+ }, /*liftString:*/FfiConverterString.lift));
122
+ }
123
+ export function version() {
124
+ return FfiConverterString.lift(uniffiCaller.rustCall(/*caller:*/callStatus => {
125
+ return (() => {
126
+ console.debug(`-- uniffi_ddk_ffi_fn_func_version`);
127
+ return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_version;
128
+ })()(callStatus);
129
+ }, /*liftString:*/FfiConverterString.lift));
130
+ }
131
+ /**
132
+ * Generated factory for {@link AdaptorSignature} record objects.
133
+ */
134
+ export const AdaptorSignature = (() => {
135
+ const defaults = () => ({});
136
+ const create = (() => {
137
+ return uniffiCreateRecord(defaults);
138
+ })();
139
+ return Object.freeze({
140
+ /**
141
+ * Create a frozen instance of {@link AdaptorSignature}, with defaults specified
142
+ * in Rust, in the {@link ddk_ffi} crate.
143
+ */
144
+ create,
145
+ /**
146
+ * Create a frozen instance of {@link AdaptorSignature}, with defaults specified
147
+ * in Rust, in the {@link ddk_ffi} crate.
148
+ */
149
+ new: create,
150
+ /**
151
+ * Defaults specified in the {@link ddk_ffi} crate.
152
+ */
153
+ defaults: () => Object.freeze(defaults())
154
+ });
155
+ })();
156
+ const FfiConverterTypeAdaptorSignature = (() => {
157
+ class FFIConverter extends AbstractFfiConverterByteArray {
158
+ read(from) {
159
+ return {
160
+ signature: FfiConverterArrayUInt8.read(from),
161
+ proof: FfiConverterArrayUInt8.read(from)
162
+ };
163
+ }
164
+ write(value, into) {
165
+ FfiConverterArrayUInt8.write(value.signature, into);
166
+ FfiConverterArrayUInt8.write(value.proof, into);
167
+ }
168
+ allocationSize(value) {
169
+ return FfiConverterArrayUInt8.allocationSize(value.signature) + FfiConverterArrayUInt8.allocationSize(value.proof);
170
+ }
171
+ }
172
+ return new FFIConverter();
173
+ })();
174
+ /**
175
+ * Generated factory for {@link ChangeOutputAndFees} record objects.
176
+ */
177
+ export const ChangeOutputAndFees = (() => {
178
+ const defaults = () => ({});
179
+ const create = (() => {
180
+ return uniffiCreateRecord(defaults);
181
+ })();
182
+ return Object.freeze({
183
+ /**
184
+ * Create a frozen instance of {@link ChangeOutputAndFees}, with defaults specified
185
+ * in Rust, in the {@link ddk_ffi} crate.
186
+ */
187
+ create,
188
+ /**
189
+ * Create a frozen instance of {@link ChangeOutputAndFees}, with defaults specified
190
+ * in Rust, in the {@link ddk_ffi} crate.
191
+ */
192
+ new: create,
193
+ /**
194
+ * Defaults specified in the {@link ddk_ffi} crate.
195
+ */
196
+ defaults: () => Object.freeze(defaults())
197
+ });
198
+ })();
199
+ const FfiConverterTypeChangeOutputAndFees = (() => {
200
+ class FFIConverter extends AbstractFfiConverterByteArray {
201
+ read(from) {
202
+ return {
203
+ changeOutput: FfiConverterTypeTxOutput.read(from),
204
+ fundFee: FfiConverterUInt64.read(from),
205
+ cetFee: FfiConverterUInt64.read(from)
206
+ };
207
+ }
208
+ write(value, into) {
209
+ FfiConverterTypeTxOutput.write(value.changeOutput, into);
210
+ FfiConverterUInt64.write(value.fundFee, into);
211
+ FfiConverterUInt64.write(value.cetFee, into);
212
+ }
213
+ allocationSize(value) {
214
+ return FfiConverterTypeTxOutput.allocationSize(value.changeOutput) + FfiConverterUInt64.allocationSize(value.fundFee) + FfiConverterUInt64.allocationSize(value.cetFee);
215
+ }
216
+ }
217
+ return new FFIConverter();
218
+ })();
219
+ /**
220
+ * Generated factory for {@link DlcInputInfo} record objects.
221
+ */
222
+ export const DlcInputInfo = (() => {
223
+ const defaults = () => ({});
224
+ const create = (() => {
225
+ return uniffiCreateRecord(defaults);
226
+ })();
227
+ return Object.freeze({
228
+ /**
229
+ * Create a frozen instance of {@link DlcInputInfo}, with defaults specified
230
+ * in Rust, in the {@link ddk_ffi} crate.
231
+ */
232
+ create,
233
+ /**
234
+ * Create a frozen instance of {@link DlcInputInfo}, with defaults specified
235
+ * in Rust, in the {@link ddk_ffi} crate.
236
+ */
237
+ new: create,
238
+ /**
239
+ * Defaults specified in the {@link ddk_ffi} crate.
240
+ */
241
+ defaults: () => Object.freeze(defaults())
242
+ });
243
+ })();
244
+ const FfiConverterTypeDlcInputInfo = (() => {
245
+ class FFIConverter extends AbstractFfiConverterByteArray {
246
+ read(from) {
247
+ return {
248
+ fundTx: FfiConverterTypeTransaction.read(from),
249
+ fundVout: FfiConverterUInt32.read(from),
250
+ localFundPubkey: FfiConverterArrayUInt8.read(from),
251
+ remoteFundPubkey: FfiConverterArrayUInt8.read(from),
252
+ fundAmount: FfiConverterUInt64.read(from),
253
+ maxWitnessLen: FfiConverterUInt32.read(from),
254
+ inputSerialId: FfiConverterUInt64.read(from),
255
+ contractId: FfiConverterArrayUInt8.read(from)
256
+ };
257
+ }
258
+ write(value, into) {
259
+ FfiConverterTypeTransaction.write(value.fundTx, into);
260
+ FfiConverterUInt32.write(value.fundVout, into);
261
+ FfiConverterArrayUInt8.write(value.localFundPubkey, into);
262
+ FfiConverterArrayUInt8.write(value.remoteFundPubkey, into);
263
+ FfiConverterUInt64.write(value.fundAmount, into);
264
+ FfiConverterUInt32.write(value.maxWitnessLen, into);
265
+ FfiConverterUInt64.write(value.inputSerialId, into);
266
+ FfiConverterArrayUInt8.write(value.contractId, into);
267
+ }
268
+ allocationSize(value) {
269
+ return FfiConverterTypeTransaction.allocationSize(value.fundTx) + FfiConverterUInt32.allocationSize(value.fundVout) + FfiConverterArrayUInt8.allocationSize(value.localFundPubkey) + FfiConverterArrayUInt8.allocationSize(value.remoteFundPubkey) + FfiConverterUInt64.allocationSize(value.fundAmount) + FfiConverterUInt32.allocationSize(value.maxWitnessLen) + FfiConverterUInt64.allocationSize(value.inputSerialId) + FfiConverterArrayUInt8.allocationSize(value.contractId);
270
+ }
271
+ }
272
+ return new FFIConverter();
273
+ })();
274
+ /**
275
+ * Generated factory for {@link DlcOutcome} record objects.
276
+ */
277
+ export const DlcOutcome = (() => {
278
+ const defaults = () => ({});
279
+ const create = (() => {
280
+ return uniffiCreateRecord(defaults);
281
+ })();
282
+ return Object.freeze({
283
+ /**
284
+ * Create a frozen instance of {@link DlcOutcome}, with defaults specified
285
+ * in Rust, in the {@link ddk_ffi} crate.
286
+ */
287
+ create,
288
+ /**
289
+ * Create a frozen instance of {@link DlcOutcome}, with defaults specified
290
+ * in Rust, in the {@link ddk_ffi} crate.
291
+ */
292
+ new: create,
293
+ /**
294
+ * Defaults specified in the {@link ddk_ffi} crate.
295
+ */
296
+ defaults: () => Object.freeze(defaults())
297
+ });
298
+ })();
299
+ const FfiConverterTypeDlcOutcome = (() => {
300
+ class FFIConverter extends AbstractFfiConverterByteArray {
301
+ read(from) {
302
+ return {
303
+ localPayout: FfiConverterUInt64.read(from),
304
+ remotePayout: FfiConverterUInt64.read(from)
305
+ };
306
+ }
307
+ write(value, into) {
308
+ FfiConverterUInt64.write(value.localPayout, into);
309
+ FfiConverterUInt64.write(value.remotePayout, into);
310
+ }
311
+ allocationSize(value) {
312
+ return FfiConverterUInt64.allocationSize(value.localPayout) + FfiConverterUInt64.allocationSize(value.remotePayout);
313
+ }
314
+ }
315
+ return new FFIConverter();
316
+ })();
317
+ /**
318
+ * Generated factory for {@link DlcTransactions} record objects.
319
+ */
320
+ export const DlcTransactions = (() => {
321
+ const defaults = () => ({});
322
+ const create = (() => {
323
+ return uniffiCreateRecord(defaults);
324
+ })();
325
+ return Object.freeze({
326
+ /**
327
+ * Create a frozen instance of {@link DlcTransactions}, with defaults specified
328
+ * in Rust, in the {@link ddk_ffi} crate.
329
+ */
330
+ create,
331
+ /**
332
+ * Create a frozen instance of {@link DlcTransactions}, with defaults specified
333
+ * in Rust, in the {@link ddk_ffi} crate.
334
+ */
335
+ new: create,
336
+ /**
337
+ * Defaults specified in the {@link ddk_ffi} crate.
338
+ */
339
+ defaults: () => Object.freeze(defaults())
340
+ });
341
+ })();
342
+ const FfiConverterTypeDlcTransactions = (() => {
343
+ class FFIConverter extends AbstractFfiConverterByteArray {
344
+ read(from) {
345
+ return {
346
+ fund: FfiConverterTypeTransaction.read(from),
347
+ cets: FfiConverterArrayTypeTransaction.read(from),
348
+ refund: FfiConverterTypeTransaction.read(from),
349
+ fundingScriptPubkey: FfiConverterArrayUInt8.read(from)
350
+ };
351
+ }
352
+ write(value, into) {
353
+ FfiConverterTypeTransaction.write(value.fund, into);
354
+ FfiConverterArrayTypeTransaction.write(value.cets, into);
355
+ FfiConverterTypeTransaction.write(value.refund, into);
356
+ FfiConverterArrayUInt8.write(value.fundingScriptPubkey, into);
357
+ }
358
+ allocationSize(value) {
359
+ return FfiConverterTypeTransaction.allocationSize(value.fund) + FfiConverterArrayTypeTransaction.allocationSize(value.cets) + FfiConverterTypeTransaction.allocationSize(value.refund) + FfiConverterArrayUInt8.allocationSize(value.fundingScriptPubkey);
360
+ }
361
+ }
362
+ return new FFIConverter();
363
+ })();
364
+ /**
365
+ * Generated factory for {@link OracleInfo} record objects.
366
+ */
367
+ export const OracleInfo = (() => {
368
+ const defaults = () => ({});
369
+ const create = (() => {
370
+ return uniffiCreateRecord(defaults);
371
+ })();
372
+ return Object.freeze({
373
+ /**
374
+ * Create a frozen instance of {@link OracleInfo}, with defaults specified
375
+ * in Rust, in the {@link ddk_ffi} crate.
376
+ */
377
+ create,
378
+ /**
379
+ * Create a frozen instance of {@link OracleInfo}, with defaults specified
380
+ * in Rust, in the {@link ddk_ffi} crate.
381
+ */
382
+ new: create,
383
+ /**
384
+ * Defaults specified in the {@link ddk_ffi} crate.
385
+ */
386
+ defaults: () => Object.freeze(defaults())
387
+ });
388
+ })();
389
+ const FfiConverterTypeOracleInfo = (() => {
390
+ class FFIConverter extends AbstractFfiConverterByteArray {
391
+ read(from) {
392
+ return {
393
+ publicKey: FfiConverterArrayUInt8.read(from),
394
+ nonces: FfiConverterArrayArrayUInt8.read(from)
395
+ };
396
+ }
397
+ write(value, into) {
398
+ FfiConverterArrayUInt8.write(value.publicKey, into);
399
+ FfiConverterArrayArrayUInt8.write(value.nonces, into);
400
+ }
401
+ allocationSize(value) {
402
+ return FfiConverterArrayUInt8.allocationSize(value.publicKey) + FfiConverterArrayArrayUInt8.allocationSize(value.nonces);
403
+ }
404
+ }
405
+ return new FFIConverter();
406
+ })();
407
+ /**
408
+ * Generated factory for {@link PartyParams} record objects.
409
+ */
410
+ export const PartyParams = (() => {
411
+ const defaults = () => ({});
412
+ const create = (() => {
413
+ return uniffiCreateRecord(defaults);
414
+ })();
415
+ return Object.freeze({
416
+ /**
417
+ * Create a frozen instance of {@link PartyParams}, with defaults specified
418
+ * in Rust, in the {@link ddk_ffi} crate.
419
+ */
420
+ create,
421
+ /**
422
+ * Create a frozen instance of {@link PartyParams}, with defaults specified
423
+ * in Rust, in the {@link ddk_ffi} crate.
424
+ */
425
+ new: create,
426
+ /**
427
+ * Defaults specified in the {@link ddk_ffi} crate.
428
+ */
429
+ defaults: () => Object.freeze(defaults())
430
+ });
431
+ })();
432
+ const FfiConverterTypePartyParams = (() => {
433
+ class FFIConverter extends AbstractFfiConverterByteArray {
434
+ read(from) {
435
+ return {
436
+ fundPubkey: FfiConverterArrayUInt8.read(from),
437
+ changeScriptPubkey: FfiConverterArrayUInt8.read(from),
438
+ changeSerialId: FfiConverterUInt64.read(from),
439
+ payoutScriptPubkey: FfiConverterArrayUInt8.read(from),
440
+ payoutSerialId: FfiConverterUInt64.read(from),
441
+ inputs: FfiConverterArrayTypeTxInputInfo.read(from),
442
+ inputAmount: FfiConverterUInt64.read(from),
443
+ collateral: FfiConverterUInt64.read(from),
444
+ dlcInputs: FfiConverterArrayTypeDlcInputInfo.read(from)
445
+ };
446
+ }
447
+ write(value, into) {
448
+ FfiConverterArrayUInt8.write(value.fundPubkey, into);
449
+ FfiConverterArrayUInt8.write(value.changeScriptPubkey, into);
450
+ FfiConverterUInt64.write(value.changeSerialId, into);
451
+ FfiConverterArrayUInt8.write(value.payoutScriptPubkey, into);
452
+ FfiConverterUInt64.write(value.payoutSerialId, into);
453
+ FfiConverterArrayTypeTxInputInfo.write(value.inputs, into);
454
+ FfiConverterUInt64.write(value.inputAmount, into);
455
+ FfiConverterUInt64.write(value.collateral, into);
456
+ FfiConverterArrayTypeDlcInputInfo.write(value.dlcInputs, into);
457
+ }
458
+ allocationSize(value) {
459
+ return FfiConverterArrayUInt8.allocationSize(value.fundPubkey) + FfiConverterArrayUInt8.allocationSize(value.changeScriptPubkey) + FfiConverterUInt64.allocationSize(value.changeSerialId) + FfiConverterArrayUInt8.allocationSize(value.payoutScriptPubkey) + FfiConverterUInt64.allocationSize(value.payoutSerialId) + FfiConverterArrayTypeTxInputInfo.allocationSize(value.inputs) + FfiConverterUInt64.allocationSize(value.inputAmount) + FfiConverterUInt64.allocationSize(value.collateral) + FfiConverterArrayTypeDlcInputInfo.allocationSize(value.dlcInputs);
460
+ }
461
+ }
462
+ return new FFIConverter();
463
+ })();
464
+ /**
465
+ * Generated factory for {@link Payout} record objects.
466
+ */
467
+ export const Payout = (() => {
468
+ const defaults = () => ({});
469
+ const create = (() => {
470
+ return uniffiCreateRecord(defaults);
471
+ })();
472
+ return Object.freeze({
473
+ /**
474
+ * Create a frozen instance of {@link Payout}, with defaults specified
475
+ * in Rust, in the {@link ddk_ffi} crate.
476
+ */
477
+ create,
478
+ /**
479
+ * Create a frozen instance of {@link Payout}, with defaults specified
480
+ * in Rust, in the {@link ddk_ffi} crate.
481
+ */
482
+ new: create,
483
+ /**
484
+ * Defaults specified in the {@link ddk_ffi} crate.
485
+ */
486
+ defaults: () => Object.freeze(defaults())
487
+ });
488
+ })();
489
+ const FfiConverterTypePayout = (() => {
490
+ class FFIConverter extends AbstractFfiConverterByteArray {
491
+ read(from) {
492
+ return {
493
+ offer: FfiConverterUInt64.read(from),
494
+ accept: FfiConverterUInt64.read(from)
495
+ };
496
+ }
497
+ write(value, into) {
498
+ FfiConverterUInt64.write(value.offer, into);
499
+ FfiConverterUInt64.write(value.accept, into);
500
+ }
501
+ allocationSize(value) {
502
+ return FfiConverterUInt64.allocationSize(value.offer) + FfiConverterUInt64.allocationSize(value.accept);
503
+ }
504
+ }
505
+ return new FFIConverter();
506
+ })();
507
+ /**
508
+ * Generated factory for {@link Transaction} record objects.
509
+ */
510
+ export const Transaction = (() => {
511
+ const defaults = () => ({});
512
+ const create = (() => {
513
+ return uniffiCreateRecord(defaults);
514
+ })();
515
+ return Object.freeze({
516
+ /**
517
+ * Create a frozen instance of {@link Transaction}, with defaults specified
518
+ * in Rust, in the {@link ddk_ffi} crate.
519
+ */
520
+ create,
521
+ /**
522
+ * Create a frozen instance of {@link Transaction}, with defaults specified
523
+ * in Rust, in the {@link ddk_ffi} crate.
524
+ */
525
+ new: create,
526
+ /**
527
+ * Defaults specified in the {@link ddk_ffi} crate.
528
+ */
529
+ defaults: () => Object.freeze(defaults())
530
+ });
531
+ })();
532
+ const FfiConverterTypeTransaction = (() => {
533
+ class FFIConverter extends AbstractFfiConverterByteArray {
534
+ read(from) {
535
+ return {
536
+ version: FfiConverterInt32.read(from),
537
+ lockTime: FfiConverterUInt32.read(from),
538
+ inputs: FfiConverterArrayTypeTxInput.read(from),
539
+ outputs: FfiConverterArrayTypeTxOutput.read(from),
540
+ rawBytes: FfiConverterArrayUInt8.read(from)
541
+ };
542
+ }
543
+ write(value, into) {
544
+ FfiConverterInt32.write(value.version, into);
545
+ FfiConverterUInt32.write(value.lockTime, into);
546
+ FfiConverterArrayTypeTxInput.write(value.inputs, into);
547
+ FfiConverterArrayTypeTxOutput.write(value.outputs, into);
548
+ FfiConverterArrayUInt8.write(value.rawBytes, into);
549
+ }
550
+ allocationSize(value) {
551
+ return FfiConverterInt32.allocationSize(value.version) + FfiConverterUInt32.allocationSize(value.lockTime) + FfiConverterArrayTypeTxInput.allocationSize(value.inputs) + FfiConverterArrayTypeTxOutput.allocationSize(value.outputs) + FfiConverterArrayUInt8.allocationSize(value.rawBytes);
552
+ }
553
+ }
554
+ return new FFIConverter();
555
+ })();
556
+ /**
557
+ * Generated factory for {@link TxInput} record objects.
558
+ */
559
+ export const TxInput = (() => {
560
+ const defaults = () => ({});
561
+ const create = (() => {
562
+ return uniffiCreateRecord(defaults);
563
+ })();
564
+ return Object.freeze({
565
+ /**
566
+ * Create a frozen instance of {@link TxInput}, with defaults specified
567
+ * in Rust, in the {@link ddk_ffi} crate.
568
+ */
569
+ create,
570
+ /**
571
+ * Create a frozen instance of {@link TxInput}, with defaults specified
572
+ * in Rust, in the {@link ddk_ffi} crate.
573
+ */
574
+ new: create,
575
+ /**
576
+ * Defaults specified in the {@link ddk_ffi} crate.
577
+ */
578
+ defaults: () => Object.freeze(defaults())
579
+ });
580
+ })();
581
+ const FfiConverterTypeTxInput = (() => {
582
+ class FFIConverter extends AbstractFfiConverterByteArray {
583
+ read(from) {
584
+ return {
585
+ txid: FfiConverterString.read(from),
586
+ vout: FfiConverterUInt32.read(from),
587
+ scriptSig: FfiConverterArrayUInt8.read(from),
588
+ sequence: FfiConverterUInt32.read(from),
589
+ witness: FfiConverterArrayArrayUInt8.read(from)
590
+ };
591
+ }
592
+ write(value, into) {
593
+ FfiConverterString.write(value.txid, into);
594
+ FfiConverterUInt32.write(value.vout, into);
595
+ FfiConverterArrayUInt8.write(value.scriptSig, into);
596
+ FfiConverterUInt32.write(value.sequence, into);
597
+ FfiConverterArrayArrayUInt8.write(value.witness, into);
598
+ }
599
+ allocationSize(value) {
600
+ return FfiConverterString.allocationSize(value.txid) + FfiConverterUInt32.allocationSize(value.vout) + FfiConverterArrayUInt8.allocationSize(value.scriptSig) + FfiConverterUInt32.allocationSize(value.sequence) + FfiConverterArrayArrayUInt8.allocationSize(value.witness);
601
+ }
602
+ }
603
+ return new FFIConverter();
604
+ })();
605
+ /**
606
+ * Generated factory for {@link TxInputInfo} record objects.
607
+ */
608
+ export const TxInputInfo = (() => {
609
+ const defaults = () => ({});
610
+ const create = (() => {
611
+ return uniffiCreateRecord(defaults);
612
+ })();
613
+ return Object.freeze({
614
+ /**
615
+ * Create a frozen instance of {@link TxInputInfo}, with defaults specified
616
+ * in Rust, in the {@link ddk_ffi} crate.
617
+ */
618
+ create,
619
+ /**
620
+ * Create a frozen instance of {@link TxInputInfo}, with defaults specified
621
+ * in Rust, in the {@link ddk_ffi} crate.
622
+ */
623
+ new: create,
624
+ /**
625
+ * Defaults specified in the {@link ddk_ffi} crate.
626
+ */
627
+ defaults: () => Object.freeze(defaults())
628
+ });
629
+ })();
630
+ const FfiConverterTypeTxInputInfo = (() => {
631
+ class FFIConverter extends AbstractFfiConverterByteArray {
632
+ read(from) {
633
+ return {
634
+ txid: FfiConverterString.read(from),
635
+ vout: FfiConverterUInt32.read(from),
636
+ scriptSig: FfiConverterArrayUInt8.read(from),
637
+ maxWitnessLength: FfiConverterUInt32.read(from),
638
+ serialId: FfiConverterUInt64.read(from)
639
+ };
640
+ }
641
+ write(value, into) {
642
+ FfiConverterString.write(value.txid, into);
643
+ FfiConverterUInt32.write(value.vout, into);
644
+ FfiConverterArrayUInt8.write(value.scriptSig, into);
645
+ FfiConverterUInt32.write(value.maxWitnessLength, into);
646
+ FfiConverterUInt64.write(value.serialId, into);
647
+ }
648
+ allocationSize(value) {
649
+ return FfiConverterString.allocationSize(value.txid) + FfiConverterUInt32.allocationSize(value.vout) + FfiConverterArrayUInt8.allocationSize(value.scriptSig) + FfiConverterUInt32.allocationSize(value.maxWitnessLength) + FfiConverterUInt64.allocationSize(value.serialId);
650
+ }
651
+ }
652
+ return new FFIConverter();
653
+ })();
654
+ /**
655
+ * Generated factory for {@link TxOutput} record objects.
656
+ */
657
+ export const TxOutput = (() => {
658
+ const defaults = () => ({});
659
+ const create = (() => {
660
+ return uniffiCreateRecord(defaults);
661
+ })();
662
+ return Object.freeze({
663
+ /**
664
+ * Create a frozen instance of {@link TxOutput}, with defaults specified
665
+ * in Rust, in the {@link ddk_ffi} crate.
666
+ */
667
+ create,
668
+ /**
669
+ * Create a frozen instance of {@link TxOutput}, with defaults specified
670
+ * in Rust, in the {@link ddk_ffi} crate.
671
+ */
672
+ new: create,
673
+ /**
674
+ * Defaults specified in the {@link ddk_ffi} crate.
675
+ */
676
+ defaults: () => Object.freeze(defaults())
677
+ });
678
+ })();
679
+ const FfiConverterTypeTxOutput = (() => {
680
+ class FFIConverter extends AbstractFfiConverterByteArray {
681
+ read(from) {
682
+ return {
683
+ value: FfiConverterUInt64.read(from),
684
+ scriptPubkey: FfiConverterArrayUInt8.read(from)
685
+ };
686
+ }
687
+ write(value, into) {
688
+ FfiConverterUInt64.write(value.value, into);
689
+ FfiConverterArrayUInt8.write(value.scriptPubkey, into);
690
+ }
691
+ allocationSize(value) {
692
+ return FfiConverterUInt64.allocationSize(value.value) + FfiConverterArrayUInt8.allocationSize(value.scriptPubkey);
693
+ }
694
+ }
695
+ return new FFIConverter();
696
+ })();
697
+ const stringConverter = {
698
+ stringToBytes: s => uniffiCaller.rustCall(status => nativeModule().ubrn_uniffi_internal_fn_func_ffi__string_to_arraybuffer(s, status)),
699
+ bytesToString: ab => uniffiCaller.rustCall(status => nativeModule().ubrn_uniffi_internal_fn_func_ffi__arraybuffer_to_string(ab, status)),
700
+ stringByteLength: s => uniffiCaller.rustCall(status => nativeModule().ubrn_uniffi_internal_fn_func_ffi__string_to_byte_length(s, status))
701
+ };
702
+ const FfiConverterString = uniffiCreateFfiConverterString(stringConverter);
703
+
704
+ // Flat error type: DlcError
705
+ export let DlcError_Tags = /*#__PURE__*/function (DlcError_Tags) {
706
+ DlcError_Tags["InvalidSignature"] = "InvalidSignature";
707
+ DlcError_Tags["InvalidPublicKey"] = "InvalidPublicKey";
708
+ DlcError_Tags["InvalidTransaction"] = "InvalidTransaction";
709
+ DlcError_Tags["InsufficientFunds"] = "InsufficientFunds";
710
+ DlcError_Tags["InvalidArgument"] = "InvalidArgument";
711
+ DlcError_Tags["SerializationError"] = "SerializationError";
712
+ DlcError_Tags["Secp256k1Error"] = "Secp256k1Error";
713
+ DlcError_Tags["MiniscriptError"] = "MiniscriptError";
714
+ DlcError_Tags["NetworkError"] = "NetworkError";
715
+ return DlcError_Tags;
716
+ }({});
717
+ export const DlcError = (() => {
718
+ class InvalidSignature extends UniffiError {
719
+ /**
720
+ * @private
721
+ * This field is private and should not be used.
722
+ */
723
+ [uniffiTypeNameSymbol] = 'DlcError';
724
+ /**
725
+ * @private
726
+ * This field is private and should not be used.
727
+ */
728
+ [variantOrdinalSymbol] = 1;
729
+ tag = DlcError_Tags.InvalidSignature;
730
+ constructor(message) {
731
+ super('DlcError', 'InvalidSignature', message);
732
+ }
733
+ static instanceOf(e) {
734
+ return instanceOf(e) && e[variantOrdinalSymbol] === 1;
735
+ }
736
+ }
737
+ class InvalidPublicKey extends UniffiError {
738
+ /**
739
+ * @private
740
+ * This field is private and should not be used.
741
+ */
742
+ [uniffiTypeNameSymbol] = 'DlcError';
743
+ /**
744
+ * @private
745
+ * This field is private and should not be used.
746
+ */
747
+ [variantOrdinalSymbol] = 2;
748
+ tag = DlcError_Tags.InvalidPublicKey;
749
+ constructor(message) {
750
+ super('DlcError', 'InvalidPublicKey', message);
751
+ }
752
+ static instanceOf(e) {
753
+ return instanceOf(e) && e[variantOrdinalSymbol] === 2;
754
+ }
755
+ }
756
+ class InvalidTransaction extends UniffiError {
757
+ /**
758
+ * @private
759
+ * This field is private and should not be used.
760
+ */
761
+ [uniffiTypeNameSymbol] = 'DlcError';
762
+ /**
763
+ * @private
764
+ * This field is private and should not be used.
765
+ */
766
+ [variantOrdinalSymbol] = 3;
767
+ tag = DlcError_Tags.InvalidTransaction;
768
+ constructor(message) {
769
+ super('DlcError', 'InvalidTransaction', message);
770
+ }
771
+ static instanceOf(e) {
772
+ return instanceOf(e) && e[variantOrdinalSymbol] === 3;
773
+ }
774
+ }
775
+ class InsufficientFunds extends UniffiError {
776
+ /**
777
+ * @private
778
+ * This field is private and should not be used.
779
+ */
780
+ [uniffiTypeNameSymbol] = 'DlcError';
781
+ /**
782
+ * @private
783
+ * This field is private and should not be used.
784
+ */
785
+ [variantOrdinalSymbol] = 4;
786
+ tag = DlcError_Tags.InsufficientFunds;
787
+ constructor(message) {
788
+ super('DlcError', 'InsufficientFunds', message);
789
+ }
790
+ static instanceOf(e) {
791
+ return instanceOf(e) && e[variantOrdinalSymbol] === 4;
792
+ }
793
+ }
794
+ class InvalidArgument extends UniffiError {
795
+ /**
796
+ * @private
797
+ * This field is private and should not be used.
798
+ */
799
+ [uniffiTypeNameSymbol] = 'DlcError';
800
+ /**
801
+ * @private
802
+ * This field is private and should not be used.
803
+ */
804
+ [variantOrdinalSymbol] = 5;
805
+ tag = DlcError_Tags.InvalidArgument;
806
+ constructor(message) {
807
+ super('DlcError', 'InvalidArgument', message);
808
+ }
809
+ static instanceOf(e) {
810
+ return instanceOf(e) && e[variantOrdinalSymbol] === 5;
811
+ }
812
+ }
813
+ class SerializationError extends UniffiError {
814
+ /**
815
+ * @private
816
+ * This field is private and should not be used.
817
+ */
818
+ [uniffiTypeNameSymbol] = 'DlcError';
819
+ /**
820
+ * @private
821
+ * This field is private and should not be used.
822
+ */
823
+ [variantOrdinalSymbol] = 6;
824
+ tag = DlcError_Tags.SerializationError;
825
+ constructor(message) {
826
+ super('DlcError', 'SerializationError', message);
827
+ }
828
+ static instanceOf(e) {
829
+ return instanceOf(e) && e[variantOrdinalSymbol] === 6;
830
+ }
831
+ }
832
+ class Secp256k1Error extends UniffiError {
833
+ /**
834
+ * @private
835
+ * This field is private and should not be used.
836
+ */
837
+ [uniffiTypeNameSymbol] = 'DlcError';
838
+ /**
839
+ * @private
840
+ * This field is private and should not be used.
841
+ */
842
+ [variantOrdinalSymbol] = 7;
843
+ tag = DlcError_Tags.Secp256k1Error;
844
+ constructor(message) {
845
+ super('DlcError', 'Secp256k1Error', message);
846
+ }
847
+ static instanceOf(e) {
848
+ return instanceOf(e) && e[variantOrdinalSymbol] === 7;
849
+ }
850
+ }
851
+ class MiniscriptError extends UniffiError {
852
+ /**
853
+ * @private
854
+ * This field is private and should not be used.
855
+ */
856
+ [uniffiTypeNameSymbol] = 'DlcError';
857
+ /**
858
+ * @private
859
+ * This field is private and should not be used.
860
+ */
861
+ [variantOrdinalSymbol] = 8;
862
+ tag = DlcError_Tags.MiniscriptError;
863
+ constructor(message) {
864
+ super('DlcError', 'MiniscriptError', message);
865
+ }
866
+ static instanceOf(e) {
867
+ return instanceOf(e) && e[variantOrdinalSymbol] === 8;
868
+ }
869
+ }
870
+ class NetworkError extends UniffiError {
871
+ /**
872
+ * @private
873
+ * This field is private and should not be used.
874
+ */
875
+ [uniffiTypeNameSymbol] = 'DlcError';
876
+ /**
877
+ * @private
878
+ * This field is private and should not be used.
879
+ */
880
+ [variantOrdinalSymbol] = 9;
881
+ tag = DlcError_Tags.NetworkError;
882
+ constructor(message) {
883
+ super('DlcError', 'NetworkError', message);
884
+ }
885
+ static instanceOf(e) {
886
+ return instanceOf(e) && e[variantOrdinalSymbol] === 9;
887
+ }
888
+ }
889
+
890
+ // Utility function which does not rely on instanceof.
891
+ function instanceOf(e) {
892
+ return e[uniffiTypeNameSymbol] === 'DlcError';
893
+ }
894
+ return {
895
+ InvalidSignature,
896
+ InvalidPublicKey,
897
+ InvalidTransaction,
898
+ InsufficientFunds,
899
+ InvalidArgument,
900
+ SerializationError,
901
+ Secp256k1Error,
902
+ MiniscriptError,
903
+ NetworkError,
904
+ instanceOf
905
+ };
906
+ })();
907
+
908
+ // Union type for DlcError error type.
909
+
910
+ const FfiConverterTypeDLCError = (() => {
911
+ const intConverter = FfiConverterInt32;
912
+ class FfiConverter extends AbstractFfiConverterByteArray {
913
+ read(from) {
914
+ switch (intConverter.read(from)) {
915
+ case 1:
916
+ return new DlcError.InvalidSignature(FfiConverterString.read(from));
917
+ case 2:
918
+ return new DlcError.InvalidPublicKey(FfiConverterString.read(from));
919
+ case 3:
920
+ return new DlcError.InvalidTransaction(FfiConverterString.read(from));
921
+ case 4:
922
+ return new DlcError.InsufficientFunds(FfiConverterString.read(from));
923
+ case 5:
924
+ return new DlcError.InvalidArgument(FfiConverterString.read(from));
925
+ case 6:
926
+ return new DlcError.SerializationError(FfiConverterString.read(from));
927
+ case 7:
928
+ return new DlcError.Secp256k1Error(FfiConverterString.read(from));
929
+ case 8:
930
+ return new DlcError.MiniscriptError(FfiConverterString.read(from));
931
+ case 9:
932
+ return new DlcError.NetworkError(FfiConverterString.read(from));
933
+ default:
934
+ throw new UniffiInternalError.UnexpectedEnumCase();
935
+ }
936
+ }
937
+ write(value, into) {
938
+ const obj = value;
939
+ const index = obj[variantOrdinalSymbol];
940
+ intConverter.write(index, into);
941
+ }
942
+ allocationSize(value) {
943
+ return intConverter.allocationSize(0);
944
+ }
945
+ }
946
+ return new FfiConverter();
947
+ })();
948
+
949
+ // FfiConverter for Array<DlcInputInfo>
950
+ const FfiConverterArrayTypeDlcInputInfo = new FfiConverterArray(FfiConverterTypeDlcInputInfo);
951
+
952
+ // FfiConverter for Array<DlcOutcome>
953
+ const FfiConverterArrayTypeDlcOutcome = new FfiConverterArray(FfiConverterTypeDlcOutcome);
954
+
955
+ // FfiConverter for Array<Transaction>
956
+ const FfiConverterArrayTypeTransaction = new FfiConverterArray(FfiConverterTypeTransaction);
957
+
958
+ // FfiConverter for Array<TxInput>
959
+ const FfiConverterArrayTypeTxInput = new FfiConverterArray(FfiConverterTypeTxInput);
960
+
961
+ // FfiConverter for Array<TxInputInfo>
962
+ const FfiConverterArrayTypeTxInputInfo = new FfiConverterArray(FfiConverterTypeTxInputInfo);
963
+
964
+ // FfiConverter for Array<TxOutput>
965
+ const FfiConverterArrayTypeTxOutput = new FfiConverterArray(FfiConverterTypeTxOutput);
966
+
967
+ // FfiConverter for Array</*u8*/number>
968
+ const FfiConverterArrayUInt8 = new FfiConverterArray(FfiConverterUInt8);
969
+
970
+ // FfiConverter for Array<Array</*u8*/number>>
971
+ const FfiConverterArrayArrayUInt8 = new FfiConverterArray(FfiConverterArrayUInt8);
972
+
973
+ /**
974
+ * This should be called before anything else.
975
+ *
976
+ * It is likely that this is being done for you by the library's `index.ts`.
977
+ *
978
+ * It checks versions of uniffi between when the Rust scaffolding was generated
979
+ * and when the bindings were generated.
980
+ *
981
+ * It also initializes the machinery to enable Rust to talk back to Javascript.
982
+ */
983
+ function uniffiEnsureInitialized() {
984
+ // Get the bindings contract version from our ComponentInterface
985
+ const bindingsContractVersion = 29;
986
+ // Get the scaffolding contract version by calling the into the dylib
987
+ const scaffoldingContractVersion = nativeModule().ubrn_ffi_ddk_ffi_uniffi_contract_version();
988
+ if (bindingsContractVersion !== scaffoldingContractVersion) {
989
+ throw new UniffiInternalError.ContractVersionMismatch(scaffoldingContractVersion, bindingsContractVersion);
990
+ }
991
+ if (nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_create_cet() !== 23081) {
992
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_ddk_ffi_checksum_func_create_cet');
993
+ }
994
+ if (nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_create_cet_adaptor_signature_from_oracle_info() !== 65174) {
995
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_ddk_ffi_checksum_func_create_cet_adaptor_signature_from_oracle_info');
996
+ }
997
+ if (nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_create_cets() !== 45293) {
998
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_ddk_ffi_checksum_func_create_cets');
999
+ }
1000
+ if (nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_create_dlc_transactions() !== 9500) {
1001
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_ddk_ffi_checksum_func_create_dlc_transactions');
1002
+ }
1003
+ if (nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_create_fund_tx_locking_script() !== 2761) {
1004
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_ddk_ffi_checksum_func_create_fund_tx_locking_script');
1005
+ }
1006
+ if (nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_create_refund_transaction() !== 57261) {
1007
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_ddk_ffi_checksum_func_create_refund_transaction');
1008
+ }
1009
+ if (nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_create_spliced_dlc_transactions() !== 51059) {
1010
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_ddk_ffi_checksum_func_create_spliced_dlc_transactions');
1011
+ }
1012
+ if (nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_get_change_output_and_fees() !== 44150) {
1013
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_ddk_ffi_checksum_func_get_change_output_and_fees');
1014
+ }
1015
+ if (nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_get_raw_funding_transaction_input_signature() !== 35708) {
1016
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_ddk_ffi_checksum_func_get_raw_funding_transaction_input_signature');
1017
+ }
1018
+ if (nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_get_total_input_vsize() !== 38213) {
1019
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_ddk_ffi_checksum_func_get_total_input_vsize');
1020
+ }
1021
+ if (nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_is_dust_output() !== 64174) {
1022
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_ddk_ffi_checksum_func_is_dust_output');
1023
+ }
1024
+ if (nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_sign_fund_transaction_input() !== 50531) {
1025
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_ddk_ffi_checksum_func_sign_fund_transaction_input');
1026
+ }
1027
+ if (nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_verify_fund_tx_signature() !== 27316) {
1028
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_ddk_ffi_checksum_func_verify_fund_tx_signature');
1029
+ }
1030
+ if (nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_version() !== 22317) {
1031
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_ddk_ffi_checksum_func_version');
1032
+ }
1033
+ }
1034
+ export default Object.freeze({
1035
+ initialize: uniffiEnsureInitialized,
1036
+ converters: {
1037
+ FfiConverterTypeAdaptorSignature,
1038
+ FfiConverterTypeChangeOutputAndFees,
1039
+ FfiConverterTypeDLCError,
1040
+ FfiConverterTypeDlcInputInfo,
1041
+ FfiConverterTypeDlcOutcome,
1042
+ FfiConverterTypeDlcTransactions,
1043
+ FfiConverterTypeOracleInfo,
1044
+ FfiConverterTypePartyParams,
1045
+ FfiConverterTypePayout,
1046
+ FfiConverterTypeTransaction,
1047
+ FfiConverterTypeTxInput,
1048
+ FfiConverterTypeTxInputInfo,
1049
+ FfiConverterTypeTxOutput
1050
+ }
1051
+ });
1052
+ //# sourceMappingURL=ddk_ffi.js.map