@bennyblader/ddk-rn 0.4.0 → 1.0.0-rc1

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.
@@ -6,7 +6,7 @@
6
6
  /* eslint-disable */
7
7
  // @ts-nocheck
8
8
  import nativeModule from "./ddk_ffi-ffi.js";
9
- import { AbstractFfiConverterByteArray, FfiConverterArray, FfiConverterArrayBuffer, FfiConverterBool, FfiConverterInt32, FfiConverterOptional, FfiConverterUInt32, FfiConverterUInt64, FfiConverterUInt8, UniffiError, UniffiInternalError, UniffiRustCaller, uniffiCreateFfiConverterString, uniffiCreateRecord, uniffiTypeNameSymbol } from '@ubjs/core';
9
+ import { AbstractFfiConverterByteArray, FfiConverterArray, FfiConverterArrayBuffer, FfiConverterBool, FfiConverterInt32, FfiConverterObject, FfiConverterOptional, FfiConverterUInt16, FfiConverterUInt32, FfiConverterUInt64, FfiConverterUInt8, UniffiAbstractObject, UniffiError, UniffiInternalError, UniffiRustCaller, destructorGuardSymbol, pointerLiteralSymbol, uniffiCreateFfiConverterString, uniffiCreateRecord, uniffiTypeNameSymbol } from '@ubjs/core';
10
10
  const uniffiCaller = new UniffiRustCaller(() => ({
11
11
  code: 0
12
12
  }));
@@ -18,6 +18,75 @@ process?.env?.NODE_ENV !== 'production' || false;
18
18
 
19
19
  // Public interface members begin here.
20
20
 
21
+ /**
22
+ * Accepts an offer. The accepting party's funding secret key is derived inside
23
+ * Rust from `keys` + `new_temporary_contract_id` and never crosses the boundary;
24
+ * it must match `params.party.funding_pubkey` (derive both from the same provider).
25
+ */
26
+ export function acceptOffer(offer, params, keys, newTemporaryContractId) /*throws*/{
27
+ return (__rb => {
28
+ try {
29
+ return FfiConverterTypeAcceptResult.lift(__rb);
30
+ } finally {
31
+ nativeModule().rustbuffer_free(__rb);
32
+ }
33
+ })(uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeContractError.lift.bind(FfiConverterTypeContractError), /*caller:*/callStatus => {
34
+ return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_accept_offer(FfiConverterArrayBuffer.lower(offer, nativeModule().rustbuffer_alloc), FfiConverterTypeAcceptOfferParams.lower(params, nativeModule().rustbuffer_alloc), FfiConverterTypeContractKeyProvider.lower(keys, nativeModule().rustbuffer_alloc), FfiConverterArrayBuffer.lower(newTemporaryContractId, nativeModule().rustbuffer_alloc), callStatus);
35
+ }, /*liftString:*/FfiConverterString.lift.bind(FfiConverterString)));
36
+ }
37
+
38
+ /**
39
+ * The 32-byte chain hash for a network (`bitcoin` / `testnet` / `signet` /
40
+ * `regtest`). Use it for [`CreateOfferParams::chain_hash`].
41
+ */
42
+ export function chainHashFromNetwork(network) /*throws*/{
43
+ return (__rb => {
44
+ try {
45
+ return FfiConverterArrayBuffer.lift(__rb);
46
+ } finally {
47
+ nativeModule().rustbuffer_free(__rb);
48
+ }
49
+ })(uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeContractError.lift.bind(FfiConverterTypeContractError), /*caller:*/callStatus => {
50
+ return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_chain_hash_from_network(FfiConverterString.lower(network, nativeModule().rustbuffer_alloc), callStatus);
51
+ }, /*liftString:*/FfiConverterString.lift.bind(FfiConverterString)));
52
+ }
53
+
54
+ /**
55
+ * The 32-byte contract id derived from the offer and accept messages — the
56
+ * stable id of the funded contract. Use it to key stored contracts.
57
+ */
58
+ export function computeContractId(offer, accept) /*throws*/{
59
+ return (__rb => {
60
+ try {
61
+ return FfiConverterArrayBuffer.lift(__rb);
62
+ } finally {
63
+ nativeModule().rustbuffer_free(__rb);
64
+ }
65
+ })(uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeContractError.lift.bind(FfiConverterTypeContractError), /*caller:*/callStatus => {
66
+ return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_compute_contract_id(FfiConverterArrayBuffer.lower(offer, nativeModule().rustbuffer_alloc), FfiConverterArrayBuffer.lower(accept, nativeModule().rustbuffer_alloc), callStatus);
67
+ }, /*liftString:*/FfiConverterString.lift.bind(FfiConverterString)));
68
+ }
69
+
70
+ /**
71
+ * Derives the offer/accept payouts for every outcome of a contract from its
72
+ * wire-encoded `ContractInfo`, for building a payout table to show users.
73
+ *
74
+ * Handles both enum contracts (each row a labeled outcome) and numeric-outcome
75
+ * contracts (each row an inclusive outcome range that shares a single payout,
76
+ * as determined by the payout function and rounding intervals). Disjoint
77
+ * contracts contribute the rows of each of their sub-contracts.
78
+ */
79
+ export function contractInfoPayouts(contractInfo) /*throws*/{
80
+ return (__rb => {
81
+ try {
82
+ return FfiConverterTypeContractPayouts.lift(__rb);
83
+ } finally {
84
+ nativeModule().rustbuffer_free(__rb);
85
+ }
86
+ })(uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeContractError.lift.bind(FfiConverterTypeContractError), /*caller:*/callStatus => {
87
+ return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_contract_info_payouts(FfiConverterArrayBuffer.lower(contractInfo, nativeModule().rustbuffer_alloc), callStatus);
88
+ }, /*liftString:*/FfiConverterString.lift.bind(FfiConverterString)));
89
+ }
21
90
  export function convertMnemonicToSeed(mnemonic, passphrase) /*throws*/{
22
91
  return (__rb => {
23
92
  try {
@@ -97,6 +166,25 @@ export function createCets(fundTxId, fundVout, localFinalScriptPubkey, remoteFin
97
166
  }, /*liftString:*/FfiConverterString.lift.bind(FfiConverterString)));
98
167
  }
99
168
 
169
+ /**
170
+ * Rebuilds the splice `FundingInput` (wire-encoded) that spends a previous
171
+ * contract's 2-of-2 funding output, from that contract's offer and accept
172
+ * messages. Only the offering party contributes a splice input; place the
173
+ * result in the offering party's `funding_inputs`. `max_witness_len` must be
174
+ * greater than 108 — use [`dlc_input_max_witness_len`].
175
+ */
176
+ export function createDlcSpliceInput(prevOffer, prevAccept, localParty, inputSerialId, maxWitnessLen) /*throws*/{
177
+ return (__rb => {
178
+ try {
179
+ return FfiConverterArrayBuffer.lift(__rb);
180
+ } finally {
181
+ nativeModule().rustbuffer_free(__rb);
182
+ }
183
+ })(uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeContractError.lift.bind(FfiConverterTypeContractError), /*caller:*/callStatus => {
184
+ return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_create_dlc_splice_input(FfiConverterArrayBuffer.lower(prevOffer, nativeModule().rustbuffer_alloc), FfiConverterArrayBuffer.lower(prevAccept, nativeModule().rustbuffer_alloc), FfiConverterTypeParty.lower(localParty, nativeModule().rustbuffer_alloc), FfiConverterOptionalUInt64.lower(inputSerialId, nativeModule().rustbuffer_alloc), FfiConverterUInt16.lower(maxWitnessLen, nativeModule().rustbuffer_alloc), callStatus);
185
+ }, /*liftString:*/FfiConverterString.lift.bind(FfiConverterString)));
186
+ }
187
+
100
188
  /**
101
189
  * Create complete DLC transactions
102
190
  */
@@ -159,6 +247,36 @@ export function createFundTxLockingScript(localFundPubkey, remoteFundPubkey) /*t
159
247
  }, /*liftString:*/FfiConverterString.lift.bind(FfiConverterString)));
160
248
  }
161
249
 
250
+ /**
251
+ * Rebuilds the BIP-174 funding PSBT from the offer and accept messages.
252
+ */
253
+ export function createFundingPsbt(offer, accept) /*throws*/{
254
+ return (__rb => {
255
+ try {
256
+ return FfiConverterArrayBuffer.lift(__rb);
257
+ } finally {
258
+ nativeModule().rustbuffer_free(__rb);
259
+ }
260
+ })(uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeContractError.lift.bind(FfiConverterTypeContractError), /*caller:*/callStatus => {
261
+ return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_create_funding_psbt(FfiConverterArrayBuffer.lower(offer, nativeModule().rustbuffer_alloc), FfiConverterArrayBuffer.lower(accept, nativeModule().rustbuffer_alloc), callStatus);
262
+ }, /*liftString:*/FfiConverterString.lift.bind(FfiConverterString)));
263
+ }
264
+
265
+ /**
266
+ * Creates an offer. Returns the wire-encoded `OfferDlc` to send to the accepting party.
267
+ */
268
+ export function createOffer(params) /*throws*/{
269
+ return (__rb => {
270
+ try {
271
+ return FfiConverterArrayBuffer.lift(__rb);
272
+ } finally {
273
+ nativeModule().rustbuffer_free(__rb);
274
+ }
275
+ })(uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeContractError.lift.bind(FfiConverterTypeContractError), /*caller:*/callStatus => {
276
+ return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_create_offer(FfiConverterTypeCreateOfferParams.lower(params, nativeModule().rustbuffer_alloc), callStatus);
277
+ }, /*liftString:*/FfiConverterString.lift.bind(FfiConverterString)));
278
+ }
279
+
162
280
  /**
163
281
  * Create a refund transaction
164
282
  */
@@ -204,6 +322,30 @@ export function createXprivFromParentPath(seedOrXpriv, baseDerivationPath, netwo
204
322
  return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_create_xpriv_from_parent_path(FfiConverterArrayBuffer.lower(seedOrXpriv, nativeModule().rustbuffer_alloc), FfiConverterString.lower(baseDerivationPath, nativeModule().rustbuffer_alloc), FfiConverterString.lower(network, nativeModule().rustbuffer_alloc), FfiConverterString.lower(path, nativeModule().rustbuffer_alloc), callStatus);
205
323
  }, /*liftString:*/FfiConverterString.lift.bind(FfiConverterString)));
206
324
  }
325
+
326
+ /**
327
+ * The required `max_witness_len` for a DLC (splice) funding input (220).
328
+ */
329
+ export function dlcInputMaxWitnessLen() {
330
+ return FfiConverterUInt16.lift(uniffiCaller.rustCall(/*caller:*/callStatus => {
331
+ return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_dlc_input_max_witness_len(callStatus);
332
+ }, /*liftString:*/FfiConverterString.lift.bind(FfiConverterString)));
333
+ }
334
+
335
+ /**
336
+ * Rebuilds the unsigned funding, CET, and refund transactions from the messages.
337
+ */
338
+ export function dlcTransactionsFromMessages(offer, accept) /*throws*/{
339
+ return (__rb => {
340
+ try {
341
+ return FfiConverterTypeDlcTransactions.lift(__rb);
342
+ } finally {
343
+ nativeModule().rustbuffer_free(__rb);
344
+ }
345
+ })(uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeContractError.lift.bind(FfiConverterTypeContractError), /*caller:*/callStatus => {
346
+ return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_dlc_transactions_from_messages(FfiConverterArrayBuffer.lower(offer, nativeModule().rustbuffer_alloc), FfiConverterArrayBuffer.lower(accept, nativeModule().rustbuffer_alloc), callStatus);
347
+ }, /*liftString:*/FfiConverterString.lift.bind(FfiConverterString)));
348
+ }
207
349
  export function extractEcdsaSignatureFromOracleSignatures(oracleSignatures, adaptorSignature) /*throws*/{
208
350
  return (__rb => {
209
351
  try {
@@ -216,6 +358,65 @@ export function extractEcdsaSignatureFromOracleSignatures(oracleSignatures, adap
216
358
  }, /*liftString:*/FfiConverterString.lift.bind(FfiConverterString)));
217
359
  }
218
360
 
361
+ /**
362
+ * The accepting party verifies the sign message and completes the funding
363
+ * transaction. Returns the Bitcoin consensus-serialized signed transaction.
364
+ */
365
+ export function finalizeSign(offer, accept, sign, signedFundingPsbt) /*throws*/{
366
+ return (__rb => {
367
+ try {
368
+ return FfiConverterArrayBuffer.lift(__rb);
369
+ } finally {
370
+ nativeModule().rustbuffer_free(__rb);
371
+ }
372
+ })(uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeContractError.lift.bind(FfiConverterTypeContractError), /*caller:*/callStatus => {
373
+ return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_finalize_sign(FfiConverterArrayBuffer.lower(offer, nativeModule().rustbuffer_alloc), FfiConverterArrayBuffer.lower(accept, nativeModule().rustbuffer_alloc), FfiConverterArrayBuffer.lower(sign, nativeModule().rustbuffer_alloc), FfiConverterArrayBuffer.lower(signedFundingPsbt, nativeModule().rustbuffer_alloc), callStatus);
374
+ }, /*liftString:*/FfiConverterString.lift.bind(FfiConverterString)));
375
+ }
376
+
377
+ /**
378
+ * Like [`finalize_sign`], but additionally completes the 2-of-2 witness for any
379
+ * splice (DLC) funding input using this (accepting) party's prior funding keys,
380
+ * re-derived inside Rust from `keys`.
381
+ */
382
+ export function finalizeSignSpliced(offer, accept, sign, signedFundingPsbt, keys, spliceKeys) /*throws*/{
383
+ return (__rb => {
384
+ try {
385
+ return FfiConverterArrayBuffer.lift(__rb);
386
+ } finally {
387
+ nativeModule().rustbuffer_free(__rb);
388
+ }
389
+ })(uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeContractError.lift.bind(FfiConverterTypeContractError), /*caller:*/callStatus => {
390
+ return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_finalize_sign_spliced(FfiConverterArrayBuffer.lower(offer, nativeModule().rustbuffer_alloc), FfiConverterArrayBuffer.lower(accept, nativeModule().rustbuffer_alloc), FfiConverterArrayBuffer.lower(sign, nativeModule().rustbuffer_alloc), FfiConverterArrayBuffer.lower(signedFundingPsbt, nativeModule().rustbuffer_alloc), FfiConverterTypeContractKeyProvider.lower(keys, nativeModule().rustbuffer_alloc), FfiConverterSequenceTypeSpliceKeyRef.lower(spliceKeys, nativeModule().rustbuffer_alloc), callStatus);
391
+ }, /*liftString:*/FfiConverterString.lift.bind(FfiConverterString)));
392
+ }
393
+
394
+ /**
395
+ * Builds a wire-encoded `FundingInput` from a wallet UTXO, ready to place in a
396
+ * party's `funding_inputs`.
397
+ *
398
+ * - `previous_transaction`: the full consensus-serialized transaction that
399
+ * created the UTXO being spent.
400
+ * - `vout`: the output index of the UTXO within that transaction.
401
+ * - `input_serial_id`: orders the input in the funding transaction; randomly
402
+ * generated when `None`.
403
+ * - `sequence`: the input sequence (usually `0xffffffff`).
404
+ * - `max_witness_len`: the input's maximum witness length (e.g. 108 for
405
+ * P2WPKH).
406
+ * - `redeem_script`: the redeem script for a P2SH input, or empty for others.
407
+ */
408
+ export function fundingInput(previousTransaction, vout, inputSerialId, sequence, maxWitnessLen, redeemScript) /*throws*/{
409
+ return (__rb => {
410
+ try {
411
+ return FfiConverterArrayBuffer.lift(__rb);
412
+ } finally {
413
+ nativeModule().rustbuffer_free(__rb);
414
+ }
415
+ })(uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeContractError.lift.bind(FfiConverterTypeContractError), /*caller:*/callStatus => {
416
+ return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_funding_input(FfiConverterArrayBuffer.lower(previousTransaction, nativeModule().rustbuffer_alloc), FfiConverterUInt32.lower(vout, nativeModule().rustbuffer_alloc), FfiConverterOptionalUInt64.lower(inputSerialId, nativeModule().rustbuffer_alloc), FfiConverterUInt32.lower(sequence, nativeModule().rustbuffer_alloc), FfiConverterUInt16.lower(maxWitnessLen, nativeModule().rustbuffer_alloc), FfiConverterArrayBuffer.lower(redeemScript, nativeModule().rustbuffer_alloc), callStatus);
417
+ }, /*liftString:*/FfiConverterString.lift.bind(FfiConverterString)));
418
+ }
419
+
219
420
  /**
220
421
  * Extract public key from extended key (private or public)
221
422
  * Input: 78-byte encoded xpriv/xpub, Output: 33-byte compressed public key
@@ -256,6 +457,155 @@ export function getXpubFromXpriv(xpriv, network) /*throws*/{
256
457
  return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_get_xpub_from_xpriv(FfiConverterArrayBuffer.lower(xpriv, nativeModule().rustbuffer_alloc), FfiConverterString.lower(network, nativeModule().rustbuffer_alloc), callStatus);
257
458
  }, /*liftString:*/FfiConverterString.lift.bind(FfiConverterString)));
258
459
  }
460
+
461
+ /**
462
+ * The offering party verifies the accept message and produces its `SignDlc`.
463
+ * The offer party's funding secret key is derived from `keys` +
464
+ * `temporary_contract_id` (the new contract's id).
465
+ */
466
+ export function signAccept(offer, accept, keys, temporaryContractId, signedFundingPsbt) /*throws*/{
467
+ return (__rb => {
468
+ try {
469
+ return FfiConverterTypeSignResult.lift(__rb);
470
+ } finally {
471
+ nativeModule().rustbuffer_free(__rb);
472
+ }
473
+ })(uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeContractError.lift.bind(FfiConverterTypeContractError), /*caller:*/callStatus => {
474
+ return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_sign_accept(FfiConverterArrayBuffer.lower(offer, nativeModule().rustbuffer_alloc), FfiConverterArrayBuffer.lower(accept, nativeModule().rustbuffer_alloc), FfiConverterTypeContractKeyProvider.lower(keys, nativeModule().rustbuffer_alloc), FfiConverterArrayBuffer.lower(temporaryContractId, nativeModule().rustbuffer_alloc), FfiConverterArrayBuffer.lower(signedFundingPsbt, nativeModule().rustbuffer_alloc), callStatus);
475
+ }, /*liftString:*/FfiConverterString.lift.bind(FfiConverterString)));
476
+ }
477
+
478
+ /**
479
+ * Like [`sign_accept`], but additionally co-signs any splice (DLC) funding
480
+ * inputs. For each splice input, `splice_keys` names the previous contract; the
481
+ * prior funding secret key is re-derived inside Rust from `keys`.
482
+ */
483
+ export function signAcceptSpliced(offer, accept, keys, temporaryContractId, signedFundingPsbt, spliceKeys) /*throws*/{
484
+ return (__rb => {
485
+ try {
486
+ return FfiConverterTypeSignResult.lift(__rb);
487
+ } finally {
488
+ nativeModule().rustbuffer_free(__rb);
489
+ }
490
+ })(uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeContractError.lift.bind(FfiConverterTypeContractError), /*caller:*/callStatus => {
491
+ return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_sign_accept_spliced(FfiConverterArrayBuffer.lower(offer, nativeModule().rustbuffer_alloc), FfiConverterArrayBuffer.lower(accept, nativeModule().rustbuffer_alloc), FfiConverterTypeContractKeyProvider.lower(keys, nativeModule().rustbuffer_alloc), FfiConverterArrayBuffer.lower(temporaryContractId, nativeModule().rustbuffer_alloc), FfiConverterArrayBuffer.lower(signedFundingPsbt, nativeModule().rustbuffer_alloc), FfiConverterSequenceTypeSpliceKeyRef.lower(spliceKeys, nativeModule().rustbuffer_alloc), callStatus);
492
+ }, /*liftString:*/FfiConverterString.lift.bind(FfiConverterString)));
493
+ }
494
+
495
+ /**
496
+ * Signs the CET matching a set of oracle attestations, returning the Bitcoin
497
+ * consensus-serialized transaction. It pays each party the attested outcome's
498
+ * payout and is ready to broadcast — no network access happens here.
499
+ *
500
+ * The settling party's funding secret key is derived inside Rust from `keys` +
501
+ * `temporary_contract_id` — the settling party's OWN temporary id (the offer's
502
+ * for the offering party, the `new_temporary_contract_id` passed to
503
+ * `accept_offer` for the accepting party). The key also identifies which side
504
+ * is settling, so there is no party argument to get wrong. Either party can
505
+ * settle alone: the counterparty's half of the 2-of-2 comes from decrypting its
506
+ * CET adaptor signature with the oracle signatures.
507
+ *
508
+ * Each entry in `attestations` pairs a wire-encoded `OracleAttestation` with
509
+ * the index of its oracle in the announcements of the contract info it settles.
510
+ * Attestations are verified against the announcements they claim to come from,
511
+ * so a forged or misindexed one cannot produce a CET
512
+ * ([`ContractError::InvalidAttestation`]). When no contract outcome matches the
513
+ * attested outcomes, [`ContractError::NoMatchingOutcome`] is returned — which
514
+ * is also what an attestation for an unrelated event looks like.
515
+ */
516
+ export function signContractCet(offer, accept, sign, keys, temporaryContractId, attestations) /*throws*/{
517
+ return (__rb => {
518
+ try {
519
+ return FfiConverterArrayBuffer.lift(__rb);
520
+ } finally {
521
+ nativeModule().rustbuffer_free(__rb);
522
+ }
523
+ })(uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeContractError.lift.bind(FfiConverterTypeContractError), /*caller:*/callStatus => {
524
+ return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_sign_contract_cet(FfiConverterArrayBuffer.lower(offer, nativeModule().rustbuffer_alloc), FfiConverterArrayBuffer.lower(accept, nativeModule().rustbuffer_alloc), FfiConverterArrayBuffer.lower(sign, nativeModule().rustbuffer_alloc), FfiConverterTypeContractKeyProvider.lower(keys, nativeModule().rustbuffer_alloc), FfiConverterArrayBuffer.lower(temporaryContractId, nativeModule().rustbuffer_alloc), FfiConverterSequenceTypeOracleAttestationRef.lower(attestations, nativeModule().rustbuffer_alloc), callStatus);
525
+ }, /*liftString:*/FfiConverterString.lift.bind(FfiConverterString)));
526
+ }
527
+
528
+ /**
529
+ * Signs the refund transaction, returning the Bitcoin consensus-serialized
530
+ * transaction. It returns each party its own collateral and can only be
531
+ * broadcast once the offer's `refund_locktime` has passed — enforcing that is
532
+ * the chain's job, not this function's.
533
+ *
534
+ * As with [`sign_contract_cet`], `temporary_contract_id` is the settling
535
+ * party's own temporary id and identifies which side is settling. Both parties
536
+ * signed the refund during the offer/accept exchange, so this only adds this
537
+ * party's half; the counterparty's stored signature is verified first.
538
+ */
539
+ export function signContractRefund(offer, accept, sign, keys, temporaryContractId) /*throws*/{
540
+ return (__rb => {
541
+ try {
542
+ return FfiConverterArrayBuffer.lift(__rb);
543
+ } finally {
544
+ nativeModule().rustbuffer_free(__rb);
545
+ }
546
+ })(uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeContractError.lift.bind(FfiConverterTypeContractError), /*caller:*/callStatus => {
547
+ return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_sign_contract_refund(FfiConverterArrayBuffer.lower(offer, nativeModule().rustbuffer_alloc), FfiConverterArrayBuffer.lower(accept, nativeModule().rustbuffer_alloc), FfiConverterArrayBuffer.lower(sign, nativeModule().rustbuffer_alloc), FfiConverterTypeContractKeyProvider.lower(keys, nativeModule().rustbuffer_alloc), FfiConverterArrayBuffer.lower(temporaryContractId, nativeModule().rustbuffer_alloc), callStatus);
548
+ }, /*liftString:*/FfiConverterString.lift.bind(FfiConverterString)));
549
+ }
550
+
551
+ /**
552
+ * Signs a party's own funding inputs on the funding PSBT using a private output
553
+ * descriptor (e.g. bdk's `wpkh(...)` with an xprv), returning the updated PSBT.
554
+ * Each entry in `inputs` names one of this party's funding inputs (by serial
555
+ * id) and the descriptor wildcard index that derives its key. Supports `wpkh()`
556
+ * and `sh(wpkh())`, with or without a wildcard.
557
+ */
558
+ export function signFundingPsbtWithDescriptor(offer, accept, fundingPsbt, descriptor, inputs) /*throws*/{
559
+ return (__rb => {
560
+ try {
561
+ return FfiConverterArrayBuffer.lift(__rb);
562
+ } finally {
563
+ nativeModule().rustbuffer_free(__rb);
564
+ }
565
+ })(uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeContractError.lift.bind(FfiConverterTypeContractError), /*caller:*/callStatus => {
566
+ return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_sign_funding_psbt_with_descriptor(FfiConverterArrayBuffer.lower(offer, nativeModule().rustbuffer_alloc), FfiConverterArrayBuffer.lower(accept, nativeModule().rustbuffer_alloc), FfiConverterArrayBuffer.lower(fundingPsbt, nativeModule().rustbuffer_alloc), FfiConverterString.lower(descriptor, nativeModule().rustbuffer_alloc), FfiConverterSequenceTypeDescriptorInput.lower(inputs, nativeModule().rustbuffer_alloc), callStatus);
567
+ }, /*liftString:*/FfiConverterString.lift.bind(FfiConverterString)));
568
+ }
569
+
570
+ /**
571
+ * Validates an accept message against its offer: the acceptor's CET adaptor
572
+ * signatures and refund signature must be valid for the contract the two
573
+ * messages describe. This is the same check `sign_accept` runs internally,
574
+ * exposed so a stored/received `AcceptDlc` can be verified on its own.
575
+ */
576
+ export function validateAccept(offer, accept) /*throws*/{
577
+ uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeContractError.lift.bind(FfiConverterTypeContractError), /*caller:*/callStatus => {
578
+ nativeModule().ubrn_uniffi_ddk_ffi_fn_func_validate_accept(FfiConverterArrayBuffer.lower(offer, nativeModule().rustbuffer_alloc), FfiConverterArrayBuffer.lower(accept, nativeModule().rustbuffer_alloc), callStatus);
579
+ }, /*liftString:*/FfiConverterString.lift.bind(FfiConverterString));
580
+ }
581
+
582
+ /**
583
+ * Validates an offer's protocol version, funding inputs, fee rate, collateral,
584
+ * and oracle timeouts.
585
+ *
586
+ * The lifecycle functions already validate internally (`accept_offer` validates
587
+ * the offer, `sign_accept` validates the accept, `finalize_sign` validates the
588
+ * sign); these `validate_*` functions expose the same checks standalone, so a
589
+ * consumer can independently verify a stored or received message at any time —
590
+ * e.g. before persisting it, or when loading it back later.
591
+ */
592
+ export function validateOffer(offer, minTimeoutInterval, maxTimeoutInterval) /*throws*/{
593
+ uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeContractError.lift.bind(FfiConverterTypeContractError), /*caller:*/callStatus => {
594
+ nativeModule().ubrn_uniffi_ddk_ffi_fn_func_validate_offer(FfiConverterArrayBuffer.lower(offer, nativeModule().rustbuffer_alloc), FfiConverterUInt32.lower(minTimeoutInterval, nativeModule().rustbuffer_alloc), FfiConverterUInt32.lower(maxTimeoutInterval, nativeModule().rustbuffer_alloc), callStatus);
595
+ }, /*liftString:*/FfiConverterString.lift.bind(FfiConverterString));
596
+ }
597
+
598
+ /**
599
+ * Validates a sign message against its offer and accept: the offerer's CET
600
+ * adaptor signatures and refund signature must be valid. This is the same
601
+ * check `finalize_sign` runs internally, exposed so a stored/received `SignDlc`
602
+ * can be verified on its own.
603
+ */
604
+ export function validateSign(offer, accept, sign) /*throws*/{
605
+ uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeContractError.lift.bind(FfiConverterTypeContractError), /*caller:*/callStatus => {
606
+ nativeModule().ubrn_uniffi_ddk_ffi_fn_func_validate_sign(FfiConverterArrayBuffer.lower(offer, nativeModule().rustbuffer_alloc), FfiConverterArrayBuffer.lower(accept, nativeModule().rustbuffer_alloc), FfiConverterArrayBuffer.lower(sign, nativeModule().rustbuffer_alloc), callStatus);
607
+ }, /*liftString:*/FfiConverterString.lift.bind(FfiConverterString));
608
+ }
259
609
  export function verifyCetAdaptorSigsFromOracleInfo(adaptorSigs, cets, oracleInfos, pubkey, fundingScriptPubkey, totalCollateral, msgs) {
260
610
  return FfiConverterBool.lift(uniffiCaller.rustCall(/*caller:*/callStatus => {
261
611
  return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_verify_cet_adaptor_sigs_from_oracle_info(FfiConverterSequenceTypeAdaptorSignature.lower(adaptorSigs, nativeModule().rustbuffer_alloc), FfiConverterSequenceTypeTransaction.lower(cets, nativeModule().rustbuffer_alloc), FfiConverterSequenceTypeOracleInfo.lower(oracleInfos, nativeModule().rustbuffer_alloc), FfiConverterArrayBuffer.lower(pubkey, nativeModule().rustbuffer_alloc), FfiConverterArrayBuffer.lower(fundingScriptPubkey, nativeModule().rustbuffer_alloc), FfiConverterUInt64.lower(totalCollateral, nativeModule().rustbuffer_alloc), FfiConverterSequenceSequenceSequenceBytes.lower(msgs, nativeModule().rustbuffer_alloc), callStatus);
@@ -272,10 +622,15 @@ export function version() {
272
622
  return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_version(callStatus);
273
623
  }, /*liftString:*/FfiConverterString.lift.bind(FfiConverterString)));
274
624
  }
625
+
275
626
  /**
276
- * Generated factory for {@link AdaptorSignature} record objects.
627
+ * One party's Bitcoin-level contract data (mirrors [`ddk::contract::PartyParams`]).
277
628
  */
278
- export const AdaptorSignature = (() => {
629
+
630
+ /**
631
+ * Generated factory for {@link ContractPartyParams} record objects.
632
+ */
633
+ export const ContractPartyParams = (() => {
279
634
  const defaults = () => ({});
280
635
  const create = (() => {
281
636
  return uniffiCreateRecord(defaults);
@@ -283,28 +638,70 @@ export const AdaptorSignature = (() => {
283
638
  return Object.freeze({
284
639
  create,
285
640
  new: create,
286
- defaults: () => Object.freeze(defaults()),
287
- verifyFromOracleInfo(self_, cet, oracleInfos, pubkey, fundingScriptPubkey, totalCollateral, msgs) {
288
- return FfiConverterBool.lift(uniffiCaller.rustCall(/*caller:*/callStatus => {
289
- return nativeModule().ubrn_uniffi_ddk_ffi_fn_method_adaptorsignature_verify_from_oracle_info(FfiConverterTypeAdaptorSignature.lower(self_, nativeModule().rustbuffer_alloc), FfiConverterTypeTransaction.lower(cet, nativeModule().rustbuffer_alloc), FfiConverterSequenceTypeOracleInfo.lower(oracleInfos, nativeModule().rustbuffer_alloc), FfiConverterArrayBuffer.lower(pubkey, nativeModule().rustbuffer_alloc), FfiConverterArrayBuffer.lower(fundingScriptPubkey, nativeModule().rustbuffer_alloc), FfiConverterUInt64.lower(totalCollateral, nativeModule().rustbuffer_alloc), FfiConverterSequenceSequenceBytes.lower(msgs, nativeModule().rustbuffer_alloc), callStatus);
290
- }, /*liftString:*/FfiConverterString.lift.bind(FfiConverterString)));
641
+ defaults: () => Object.freeze(defaults())
642
+ });
643
+ })();
644
+ const FfiConverterTypeContractPartyParams = (() => {
645
+ class FFIConverter extends AbstractFfiConverterByteArray {
646
+ read(from) {
647
+ return {
648
+ fundingPubkey: FfiConverterArrayBuffer.read(from),
649
+ fundingInputs: FfiConverterSequenceBytes.read(from),
650
+ payoutSpk: FfiConverterArrayBuffer.read(from),
651
+ payoutSerialId: FfiConverterOptionalUInt64.read(from),
652
+ changeSpk: FfiConverterArrayBuffer.read(from),
653
+ changeSerialId: FfiConverterOptionalUInt64.read(from)
654
+ };
655
+ }
656
+ write(value, into) {
657
+ FfiConverterArrayBuffer.write(value.fundingPubkey, into);
658
+ FfiConverterSequenceBytes.write(value.fundingInputs, into);
659
+ FfiConverterArrayBuffer.write(value.payoutSpk, into);
660
+ FfiConverterOptionalUInt64.write(value.payoutSerialId, into);
661
+ FfiConverterArrayBuffer.write(value.changeSpk, into);
662
+ FfiConverterOptionalUInt64.write(value.changeSerialId, into);
663
+ }
664
+ allocationSize(value) {
665
+ return FfiConverterArrayBuffer.allocationSize(value.fundingPubkey) + FfiConverterSequenceBytes.allocationSize(value.fundingInputs) + FfiConverterArrayBuffer.allocationSize(value.payoutSpk) + FfiConverterOptionalUInt64.allocationSize(value.payoutSerialId) + FfiConverterArrayBuffer.allocationSize(value.changeSpk) + FfiConverterOptionalUInt64.allocationSize(value.changeSerialId);
291
666
  }
667
+ }
668
+ return new FFIConverter();
669
+ })();
670
+
671
+ /**
672
+ * Parameters for [`accept_offer`] (mirrors [`ddk::contract::AcceptOfferParams`]).
673
+ */
674
+
675
+ /**
676
+ * Generated factory for {@link AcceptOfferParams} record objects.
677
+ */
678
+ export const AcceptOfferParams = (() => {
679
+ const defaults = () => ({});
680
+ const create = (() => {
681
+ return uniffiCreateRecord(defaults);
682
+ })();
683
+ return Object.freeze({
684
+ create,
685
+ new: create,
686
+ defaults: () => Object.freeze(defaults())
292
687
  });
293
688
  })();
294
- const FfiConverterTypeAdaptorSignature = (() => {
689
+ const FfiConverterTypeAcceptOfferParams = (() => {
295
690
  class FFIConverter extends AbstractFfiConverterByteArray {
296
691
  read(from) {
297
692
  return {
298
- signature: FfiConverterArrayBuffer.read(from),
299
- proof: FfiConverterArrayBuffer.read(from)
693
+ party: FfiConverterTypeContractPartyParams.read(from),
694
+ minTimeoutInterval: FfiConverterUInt32.read(from),
695
+ maxTimeoutInterval: FfiConverterUInt32.read(from)
300
696
  };
301
697
  }
302
698
  write(value, into) {
303
- FfiConverterArrayBuffer.write(value.signature, into);
304
- FfiConverterArrayBuffer.write(value.proof, into);
699
+ FfiConverterTypeContractPartyParams.write(value.party, into);
700
+ FfiConverterUInt32.write(value.minTimeoutInterval, into);
701
+ FfiConverterUInt32.write(value.maxTimeoutInterval, into);
305
702
  }
306
703
  allocationSize(value) {
307
- return FfiConverterArrayBuffer.allocationSize(value.signature) + FfiConverterArrayBuffer.allocationSize(value.proof);
704
+ return FfiConverterTypeContractPartyParams.allocationSize(value.party) + FfiConverterUInt32.allocationSize(value.minTimeoutInterval) + FfiConverterUInt32.allocationSize(value.maxTimeoutInterval);
308
705
  }
309
706
  }
310
707
  return new FFIConverter();
@@ -347,21 +744,10 @@ const stringConverter = (() => {
347
744
  };
348
745
  })();
349
746
  const FfiConverterString = uniffiCreateFfiConverterString(stringConverter);
350
-
351
747
  /**
352
- * Debug info for CET adaptor signature inputs.
353
- *
354
- * Contains all the values that go into creating an adaptor signature,
355
- * useful for comparing with external signers during debugging.
356
- *
357
- * This struct is intentionally always available (not feature-gated)
358
- * to support production debugging scenarios.
359
- */
360
-
361
- /**
362
- * Generated factory for {@link CetAdaptorSignatureDebugInfo} record objects.
748
+ * Generated factory for {@link TxInput} record objects.
363
749
  */
364
- export const CetAdaptorSignatureDebugInfo = (() => {
750
+ export const TxInput = (() => {
365
751
  const defaults = () => ({});
366
752
  const create = (() => {
367
753
  return uniffiCreateRecord(defaults);
@@ -372,30 +758,26 @@ export const CetAdaptorSignatureDebugInfo = (() => {
372
758
  defaults: () => Object.freeze(defaults())
373
759
  });
374
760
  })();
375
- const FfiConverterTypeCetAdaptorSignatureDebugInfo = (() => {
761
+ const FfiConverterTypeTxInput = (() => {
376
762
  class FFIConverter extends AbstractFfiConverterByteArray {
377
763
  read(from) {
378
764
  return {
379
- sighash: FfiConverterArrayBuffer.read(from),
380
- adaptorPoint: FfiConverterArrayBuffer.read(from),
381
- inputIndex: FfiConverterUInt32.read(from),
382
- scriptPubkey: FfiConverterArrayBuffer.read(from),
383
- value: FfiConverterUInt64.read(from),
384
- cetTxid: FfiConverterString.read(from),
385
- cetRaw: FfiConverterArrayBuffer.read(from)
765
+ txid: FfiConverterString.read(from),
766
+ vout: FfiConverterUInt32.read(from),
767
+ scriptSig: FfiConverterArrayBuffer.read(from),
768
+ sequence: FfiConverterUInt32.read(from),
769
+ witness: FfiConverterSequenceBytes.read(from)
386
770
  };
387
771
  }
388
772
  write(value, into) {
389
- FfiConverterArrayBuffer.write(value.sighash, into);
390
- FfiConverterArrayBuffer.write(value.adaptorPoint, into);
391
- FfiConverterUInt32.write(value.inputIndex, into);
392
- FfiConverterArrayBuffer.write(value.scriptPubkey, into);
393
- FfiConverterUInt64.write(value.value, into);
394
- FfiConverterString.write(value.cetTxid, into);
395
- FfiConverterArrayBuffer.write(value.cetRaw, into);
773
+ FfiConverterString.write(value.txid, into);
774
+ FfiConverterUInt32.write(value.vout, into);
775
+ FfiConverterArrayBuffer.write(value.scriptSig, into);
776
+ FfiConverterUInt32.write(value.sequence, into);
777
+ FfiConverterSequenceBytes.write(value.witness, into);
396
778
  }
397
779
  allocationSize(value) {
398
- return FfiConverterArrayBuffer.allocationSize(value.sighash) + FfiConverterArrayBuffer.allocationSize(value.adaptorPoint) + FfiConverterUInt32.allocationSize(value.inputIndex) + FfiConverterArrayBuffer.allocationSize(value.scriptPubkey) + FfiConverterUInt64.allocationSize(value.value) + FfiConverterString.allocationSize(value.cetTxid) + FfiConverterArrayBuffer.allocationSize(value.cetRaw);
780
+ return FfiConverterString.allocationSize(value.txid) + FfiConverterUInt32.allocationSize(value.vout) + FfiConverterArrayBuffer.allocationSize(value.scriptSig) + FfiConverterUInt32.allocationSize(value.sequence) + FfiConverterSequenceBytes.allocationSize(value.witness);
399
781
  }
400
782
  }
401
783
  return new FFIConverter();
@@ -437,78 +819,6 @@ const FfiConverterTypeTxOutput = (() => {
437
819
  }
438
820
  return new FFIConverter();
439
821
  })();
440
- /**
441
- * Generated factory for {@link ChangeOutputAndFees} record objects.
442
- */
443
- export const ChangeOutputAndFees = (() => {
444
- const defaults = () => ({});
445
- const create = (() => {
446
- return uniffiCreateRecord(defaults);
447
- })();
448
- return Object.freeze({
449
- create,
450
- new: create,
451
- defaults: () => Object.freeze(defaults())
452
- });
453
- })();
454
- const FfiConverterTypeChangeOutputAndFees = (() => {
455
- class FFIConverter extends AbstractFfiConverterByteArray {
456
- read(from) {
457
- return {
458
- changeOutput: FfiConverterTypeTxOutput.read(from),
459
- fundFee: FfiConverterUInt64.read(from),
460
- cetFee: FfiConverterUInt64.read(from)
461
- };
462
- }
463
- write(value, into) {
464
- FfiConverterTypeTxOutput.write(value.changeOutput, into);
465
- FfiConverterUInt64.write(value.fundFee, into);
466
- FfiConverterUInt64.write(value.cetFee, into);
467
- }
468
- allocationSize(value) {
469
- return FfiConverterTypeTxOutput.allocationSize(value.changeOutput) + FfiConverterUInt64.allocationSize(value.fundFee) + FfiConverterUInt64.allocationSize(value.cetFee);
470
- }
471
- }
472
- return new FFIConverter();
473
- })();
474
- /**
475
- * Generated factory for {@link TxInput} record objects.
476
- */
477
- export const TxInput = (() => {
478
- const defaults = () => ({});
479
- const create = (() => {
480
- return uniffiCreateRecord(defaults);
481
- })();
482
- return Object.freeze({
483
- create,
484
- new: create,
485
- defaults: () => Object.freeze(defaults())
486
- });
487
- })();
488
- const FfiConverterTypeTxInput = (() => {
489
- class FFIConverter extends AbstractFfiConverterByteArray {
490
- read(from) {
491
- return {
492
- txid: FfiConverterString.read(from),
493
- vout: FfiConverterUInt32.read(from),
494
- scriptSig: FfiConverterArrayBuffer.read(from),
495
- sequence: FfiConverterUInt32.read(from),
496
- witness: FfiConverterSequenceBytes.read(from)
497
- };
498
- }
499
- write(value, into) {
500
- FfiConverterString.write(value.txid, into);
501
- FfiConverterUInt32.write(value.vout, into);
502
- FfiConverterArrayBuffer.write(value.scriptSig, into);
503
- FfiConverterUInt32.write(value.sequence, into);
504
- FfiConverterSequenceBytes.write(value.witness, into);
505
- }
506
- allocationSize(value) {
507
- return FfiConverterString.allocationSize(value.txid) + FfiConverterUInt32.allocationSize(value.vout) + FfiConverterArrayBuffer.allocationSize(value.scriptSig) + FfiConverterUInt32.allocationSize(value.sequence) + FfiConverterSequenceBytes.allocationSize(value.witness);
508
- }
509
- }
510
- return new FFIConverter();
511
- })();
512
822
  /**
513
823
  * Generated factory for {@link Transaction} record objects.
514
824
  */
@@ -640,50 +950,6 @@ const FfiConverterTypeTransaction = (() => {
640
950
  }
641
951
  return new FFIConverter();
642
952
  })();
643
- /**
644
- * Generated factory for {@link DlcInputInfo} record objects.
645
- */
646
- export const DlcInputInfo = (() => {
647
- const defaults = () => ({});
648
- const create = (() => {
649
- return uniffiCreateRecord(defaults);
650
- })();
651
- return Object.freeze({
652
- create,
653
- new: create,
654
- defaults: () => Object.freeze(defaults())
655
- });
656
- })();
657
- const FfiConverterTypeDlcInputInfo = (() => {
658
- class FFIConverter extends AbstractFfiConverterByteArray {
659
- read(from) {
660
- return {
661
- fundTx: FfiConverterTypeTransaction.read(from),
662
- fundVout: FfiConverterUInt32.read(from),
663
- localFundPubkey: FfiConverterArrayBuffer.read(from),
664
- remoteFundPubkey: FfiConverterArrayBuffer.read(from),
665
- fundAmount: FfiConverterUInt64.read(from),
666
- maxWitnessLen: FfiConverterUInt32.read(from),
667
- inputSerialId: FfiConverterUInt64.read(from),
668
- contractId: FfiConverterArrayBuffer.read(from)
669
- };
670
- }
671
- write(value, into) {
672
- FfiConverterTypeTransaction.write(value.fundTx, into);
673
- FfiConverterUInt32.write(value.fundVout, into);
674
- FfiConverterArrayBuffer.write(value.localFundPubkey, into);
675
- FfiConverterArrayBuffer.write(value.remoteFundPubkey, into);
676
- FfiConverterUInt64.write(value.fundAmount, into);
677
- FfiConverterUInt32.write(value.maxWitnessLen, into);
678
- FfiConverterUInt64.write(value.inputSerialId, into);
679
- FfiConverterArrayBuffer.write(value.contractId, into);
680
- }
681
- allocationSize(value) {
682
- return FfiConverterTypeTransaction.allocationSize(value.fundTx) + FfiConverterUInt32.allocationSize(value.fundVout) + FfiConverterArrayBuffer.allocationSize(value.localFundPubkey) + FfiConverterArrayBuffer.allocationSize(value.remoteFundPubkey) + FfiConverterUInt64.allocationSize(value.fundAmount) + FfiConverterUInt32.allocationSize(value.maxWitnessLen) + FfiConverterUInt64.allocationSize(value.inputSerialId) + FfiConverterArrayBuffer.allocationSize(value.contractId);
683
- }
684
- }
685
- return new FFIConverter();
686
- })();
687
953
  /**
688
954
  * Generated factory for {@link DlcTransactions} record objects.
689
955
  */
@@ -720,10 +986,15 @@ const FfiConverterTypeDlcTransactions = (() => {
720
986
  }
721
987
  return new FFIConverter();
722
988
  })();
989
+
723
990
  /**
724
- * Generated factory for {@link OracleInfo} record objects.
991
+ * The result of [`accept_offer`].
725
992
  */
726
- export const OracleInfo = (() => {
993
+
994
+ /**
995
+ * Generated factory for {@link AcceptResult} record objects.
996
+ */
997
+ export const AcceptResult = (() => {
727
998
  const defaults = () => ({});
728
999
  const create = (() => {
729
1000
  return uniffiCreateRecord(defaults);
@@ -734,28 +1005,30 @@ export const OracleInfo = (() => {
734
1005
  defaults: () => Object.freeze(defaults())
735
1006
  });
736
1007
  })();
737
- const FfiConverterTypeOracleInfo = (() => {
1008
+ const FfiConverterTypeAcceptResult = (() => {
738
1009
  class FFIConverter extends AbstractFfiConverterByteArray {
739
1010
  read(from) {
740
1011
  return {
741
- publicKey: FfiConverterArrayBuffer.read(from),
742
- nonces: FfiConverterSequenceBytes.read(from)
1012
+ accept: FfiConverterArrayBuffer.read(from),
1013
+ transactions: FfiConverterTypeDlcTransactions.read(from),
1014
+ fundingPsbt: FfiConverterArrayBuffer.read(from)
743
1015
  };
744
1016
  }
745
1017
  write(value, into) {
746
- FfiConverterArrayBuffer.write(value.publicKey, into);
747
- FfiConverterSequenceBytes.write(value.nonces, into);
1018
+ FfiConverterArrayBuffer.write(value.accept, into);
1019
+ FfiConverterTypeDlcTransactions.write(value.transactions, into);
1020
+ FfiConverterArrayBuffer.write(value.fundingPsbt, into);
748
1021
  }
749
1022
  allocationSize(value) {
750
- return FfiConverterArrayBuffer.allocationSize(value.publicKey) + FfiConverterSequenceBytes.allocationSize(value.nonces);
1023
+ return FfiConverterArrayBuffer.allocationSize(value.accept) + FfiConverterTypeDlcTransactions.allocationSize(value.transactions) + FfiConverterArrayBuffer.allocationSize(value.fundingPsbt);
751
1024
  }
752
1025
  }
753
1026
  return new FFIConverter();
754
1027
  })();
755
1028
  /**
756
- * Generated factory for {@link TxInputInfo} record objects.
1029
+ * Generated factory for {@link AdaptorSignature} record objects.
757
1030
  */
758
- export const TxInputInfo = (() => {
1031
+ export const AdaptorSignature = (() => {
759
1032
  const defaults = () => ({});
760
1033
  const create = (() => {
761
1034
  return uniffiCreateRecord(defaults);
@@ -763,37 +1036,47 @@ export const TxInputInfo = (() => {
763
1036
  return Object.freeze({
764
1037
  create,
765
1038
  new: create,
766
- defaults: () => Object.freeze(defaults())
1039
+ defaults: () => Object.freeze(defaults()),
1040
+ verifyFromOracleInfo(self_, cet, oracleInfos, pubkey, fundingScriptPubkey, totalCollateral, msgs) {
1041
+ return FfiConverterBool.lift(uniffiCaller.rustCall(/*caller:*/callStatus => {
1042
+ return nativeModule().ubrn_uniffi_ddk_ffi_fn_method_adaptorsignature_verify_from_oracle_info(FfiConverterTypeAdaptorSignature.lower(self_, nativeModule().rustbuffer_alloc), FfiConverterTypeTransaction.lower(cet, nativeModule().rustbuffer_alloc), FfiConverterSequenceTypeOracleInfo.lower(oracleInfos, nativeModule().rustbuffer_alloc), FfiConverterArrayBuffer.lower(pubkey, nativeModule().rustbuffer_alloc), FfiConverterArrayBuffer.lower(fundingScriptPubkey, nativeModule().rustbuffer_alloc), FfiConverterUInt64.lower(totalCollateral, nativeModule().rustbuffer_alloc), FfiConverterSequenceSequenceBytes.lower(msgs, nativeModule().rustbuffer_alloc), callStatus);
1043
+ }, /*liftString:*/FfiConverterString.lift.bind(FfiConverterString)));
1044
+ }
767
1045
  });
768
1046
  })();
769
- const FfiConverterTypeTxInputInfo = (() => {
1047
+ const FfiConverterTypeAdaptorSignature = (() => {
770
1048
  class FFIConverter extends AbstractFfiConverterByteArray {
771
1049
  read(from) {
772
1050
  return {
773
- txid: FfiConverterString.read(from),
774
- vout: FfiConverterUInt32.read(from),
775
- scriptSig: FfiConverterArrayBuffer.read(from),
776
- maxWitnessLength: FfiConverterUInt32.read(from),
777
- serialId: FfiConverterUInt64.read(from)
1051
+ signature: FfiConverterArrayBuffer.read(from),
1052
+ proof: FfiConverterArrayBuffer.read(from)
778
1053
  };
779
1054
  }
780
1055
  write(value, into) {
781
- FfiConverterString.write(value.txid, into);
782
- FfiConverterUInt32.write(value.vout, into);
783
- FfiConverterArrayBuffer.write(value.scriptSig, into);
784
- FfiConverterUInt32.write(value.maxWitnessLength, into);
785
- FfiConverterUInt64.write(value.serialId, into);
1056
+ FfiConverterArrayBuffer.write(value.signature, into);
1057
+ FfiConverterArrayBuffer.write(value.proof, into);
786
1058
  }
787
1059
  allocationSize(value) {
788
- return FfiConverterString.allocationSize(value.txid) + FfiConverterUInt32.allocationSize(value.vout) + FfiConverterArrayBuffer.allocationSize(value.scriptSig) + FfiConverterUInt32.allocationSize(value.maxWitnessLength) + FfiConverterUInt64.allocationSize(value.serialId);
1060
+ return FfiConverterArrayBuffer.allocationSize(value.signature) + FfiConverterArrayBuffer.allocationSize(value.proof);
789
1061
  }
790
1062
  }
791
1063
  return new FFIConverter();
792
1064
  })();
1065
+
793
1066
  /**
794
- * Generated factory for {@link PartyParams} record objects.
1067
+ * Debug info for CET adaptor signature inputs.
1068
+ *
1069
+ * Contains all the values that go into creating an adaptor signature,
1070
+ * useful for comparing with external signers during debugging.
1071
+ *
1072
+ * This struct is intentionally always available (not feature-gated)
1073
+ * to support production debugging scenarios.
795
1074
  */
796
- export const PartyParams = (() => {
1075
+
1076
+ /**
1077
+ * Generated factory for {@link CetAdaptorSignatureDebugInfo} record objects.
1078
+ */
1079
+ export const CetAdaptorSignatureDebugInfo = (() => {
797
1080
  const defaults = () => ({});
798
1081
  const create = (() => {
799
1082
  return uniffiCreateRecord(defaults);
@@ -801,56 +1084,41 @@ export const PartyParams = (() => {
801
1084
  return Object.freeze({
802
1085
  create,
803
1086
  new: create,
804
- defaults: () => Object.freeze(defaults()),
805
- changeOutputAndFees(self_, feeRate) {
806
- return (__rb => {
807
- try {
808
- return FfiConverterTypeChangeOutputAndFees.lift(__rb);
809
- } finally {
810
- nativeModule().rustbuffer_free(__rb);
811
- }
812
- })(uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeDLCError.lift.bind(FfiConverterTypeDLCError), /*caller:*/callStatus => {
813
- return nativeModule().ubrn_uniffi_ddk_ffi_fn_method_partyparams_change_output_and_fees(FfiConverterTypePartyParams.lower(self_, nativeModule().rustbuffer_alloc), FfiConverterUInt64.lower(feeRate, nativeModule().rustbuffer_alloc), callStatus);
814
- }, /*liftString:*/FfiConverterString.lift.bind(FfiConverterString)));
815
- }
1087
+ defaults: () => Object.freeze(defaults())
816
1088
  });
817
1089
  })();
818
- const FfiConverterTypePartyParams = (() => {
1090
+ const FfiConverterTypeCetAdaptorSignatureDebugInfo = (() => {
819
1091
  class FFIConverter extends AbstractFfiConverterByteArray {
820
1092
  read(from) {
821
1093
  return {
822
- fundPubkey: FfiConverterArrayBuffer.read(from),
823
- changeScriptPubkey: FfiConverterArrayBuffer.read(from),
824
- changeSerialId: FfiConverterUInt64.read(from),
825
- payoutScriptPubkey: FfiConverterArrayBuffer.read(from),
826
- payoutSerialId: FfiConverterUInt64.read(from),
827
- inputs: FfiConverterSequenceTypeTxInputInfo.read(from),
828
- inputAmount: FfiConverterUInt64.read(from),
829
- collateral: FfiConverterUInt64.read(from),
830
- dlcInputs: FfiConverterSequenceTypeDlcInputInfo.read(from)
1094
+ sighash: FfiConverterArrayBuffer.read(from),
1095
+ adaptorPoint: FfiConverterArrayBuffer.read(from),
1096
+ inputIndex: FfiConverterUInt32.read(from),
1097
+ scriptPubkey: FfiConverterArrayBuffer.read(from),
1098
+ value: FfiConverterUInt64.read(from),
1099
+ cetTxid: FfiConverterString.read(from),
1100
+ cetRaw: FfiConverterArrayBuffer.read(from)
831
1101
  };
832
1102
  }
833
1103
  write(value, into) {
834
- FfiConverterArrayBuffer.write(value.fundPubkey, into);
835
- FfiConverterArrayBuffer.write(value.changeScriptPubkey, into);
836
- FfiConverterUInt64.write(value.changeSerialId, into);
837
- FfiConverterArrayBuffer.write(value.payoutScriptPubkey, into);
838
- FfiConverterUInt64.write(value.payoutSerialId, into);
839
- FfiConverterSequenceTypeTxInputInfo.write(value.inputs, into);
840
- FfiConverterUInt64.write(value.inputAmount, into);
841
- FfiConverterUInt64.write(value.collateral, into);
842
- FfiConverterSequenceTypeDlcInputInfo.write(value.dlcInputs, into);
1104
+ FfiConverterArrayBuffer.write(value.sighash, into);
1105
+ FfiConverterArrayBuffer.write(value.adaptorPoint, into);
1106
+ FfiConverterUInt32.write(value.inputIndex, into);
1107
+ FfiConverterArrayBuffer.write(value.scriptPubkey, into);
1108
+ FfiConverterUInt64.write(value.value, into);
1109
+ FfiConverterString.write(value.cetTxid, into);
1110
+ FfiConverterArrayBuffer.write(value.cetRaw, into);
843
1111
  }
844
1112
  allocationSize(value) {
845
- return FfiConverterArrayBuffer.allocationSize(value.fundPubkey) + FfiConverterArrayBuffer.allocationSize(value.changeScriptPubkey) + FfiConverterUInt64.allocationSize(value.changeSerialId) + FfiConverterArrayBuffer.allocationSize(value.payoutScriptPubkey) + FfiConverterUInt64.allocationSize(value.payoutSerialId) + FfiConverterSequenceTypeTxInputInfo.allocationSize(value.inputs) + FfiConverterUInt64.allocationSize(value.inputAmount) + FfiConverterUInt64.allocationSize(value.collateral) + FfiConverterSequenceTypeDlcInputInfo.allocationSize(value.dlcInputs);
1113
+ return FfiConverterArrayBuffer.allocationSize(value.sighash) + FfiConverterArrayBuffer.allocationSize(value.adaptorPoint) + FfiConverterUInt32.allocationSize(value.inputIndex) + FfiConverterArrayBuffer.allocationSize(value.scriptPubkey) + FfiConverterUInt64.allocationSize(value.value) + FfiConverterString.allocationSize(value.cetTxid) + FfiConverterArrayBuffer.allocationSize(value.cetRaw);
846
1114
  }
847
1115
  }
848
1116
  return new FFIConverter();
849
1117
  })();
850
1118
  /**
851
- * Generated factory for {@link Payout} record objects.
1119
+ * Generated factory for {@link ChangeOutputAndFees} record objects.
852
1120
  */
853
- export const Payout = (() => {
1121
+ export const ChangeOutputAndFees = (() => {
854
1122
  const defaults = () => ({});
855
1123
  const create = (() => {
856
1124
  return uniffiCreateRecord(defaults);
@@ -861,20 +1129,1318 @@ export const Payout = (() => {
861
1129
  defaults: () => Object.freeze(defaults())
862
1130
  });
863
1131
  })();
864
- const FfiConverterTypePayout = (() => {
1132
+ const FfiConverterTypeChangeOutputAndFees = (() => {
865
1133
  class FFIConverter extends AbstractFfiConverterByteArray {
866
1134
  read(from) {
867
1135
  return {
868
- offer: FfiConverterUInt64.read(from),
869
- accept: FfiConverterUInt64.read(from)
870
- };
1136
+ changeOutput: FfiConverterTypeTxOutput.read(from),
1137
+ fundFee: FfiConverterUInt64.read(from),
1138
+ cetFee: FfiConverterUInt64.read(from)
1139
+ };
1140
+ }
1141
+ write(value, into) {
1142
+ FfiConverterTypeTxOutput.write(value.changeOutput, into);
1143
+ FfiConverterUInt64.write(value.fundFee, into);
1144
+ FfiConverterUInt64.write(value.cetFee, into);
1145
+ }
1146
+ allocationSize(value) {
1147
+ return FfiConverterTypeTxOutput.allocationSize(value.changeOutput) + FfiConverterUInt64.allocationSize(value.fundFee) + FfiConverterUInt64.allocationSize(value.cetFee);
1148
+ }
1149
+ }
1150
+ return new FFIConverter();
1151
+ })();
1152
+
1153
+ /**
1154
+ * One row of a contract's payout table.
1155
+ *
1156
+ * Enum-contract rows carry an `outcome` label; numeric-contract rows carry an
1157
+ * inclusive `[range_start, range_end]` of outcome values that share the payout.
1158
+ */
1159
+
1160
+ /**
1161
+ * Generated factory for {@link PayoutRow} record objects.
1162
+ */
1163
+ export const PayoutRow = (() => {
1164
+ const defaults = () => ({});
1165
+ const create = (() => {
1166
+ return uniffiCreateRecord(defaults);
1167
+ })();
1168
+ return Object.freeze({
1169
+ create,
1170
+ new: create,
1171
+ defaults: () => Object.freeze(defaults())
1172
+ });
1173
+ })();
1174
+ const FfiConverterTypePayoutRow = (() => {
1175
+ class FFIConverter extends AbstractFfiConverterByteArray {
1176
+ read(from) {
1177
+ return {
1178
+ outcome: FfiConverterOptionalString.read(from),
1179
+ rangeStart: FfiConverterOptionalUInt64.read(from),
1180
+ rangeEnd: FfiConverterOptionalUInt64.read(from),
1181
+ offerPayoutSats: FfiConverterUInt64.read(from),
1182
+ acceptPayoutSats: FfiConverterUInt64.read(from)
1183
+ };
1184
+ }
1185
+ write(value, into) {
1186
+ FfiConverterOptionalString.write(value.outcome, into);
1187
+ FfiConverterOptionalUInt64.write(value.rangeStart, into);
1188
+ FfiConverterOptionalUInt64.write(value.rangeEnd, into);
1189
+ FfiConverterUInt64.write(value.offerPayoutSats, into);
1190
+ FfiConverterUInt64.write(value.acceptPayoutSats, into);
1191
+ }
1192
+ allocationSize(value) {
1193
+ return FfiConverterOptionalString.allocationSize(value.outcome) + FfiConverterOptionalUInt64.allocationSize(value.rangeStart) + FfiConverterOptionalUInt64.allocationSize(value.rangeEnd) + FfiConverterUInt64.allocationSize(value.offerPayoutSats) + FfiConverterUInt64.allocationSize(value.acceptPayoutSats);
1194
+ }
1195
+ }
1196
+ return new FFIConverter();
1197
+ })();
1198
+
1199
+ /**
1200
+ * A contract's payouts, derived from its `ContractInfo`, for display as a table.
1201
+ */
1202
+
1203
+ /**
1204
+ * Generated factory for {@link ContractPayouts} record objects.
1205
+ */
1206
+ export const ContractPayouts = (() => {
1207
+ const defaults = () => ({});
1208
+ const create = (() => {
1209
+ return uniffiCreateRecord(defaults);
1210
+ })();
1211
+ return Object.freeze({
1212
+ create,
1213
+ new: create,
1214
+ defaults: () => Object.freeze(defaults())
1215
+ });
1216
+ })();
1217
+ const FfiConverterTypeContractPayouts = (() => {
1218
+ class FFIConverter extends AbstractFfiConverterByteArray {
1219
+ read(from) {
1220
+ return {
1221
+ totalCollateralSats: FfiConverterUInt64.read(from),
1222
+ isEnum: FfiConverterBool.read(from),
1223
+ rows: FfiConverterSequenceTypePayoutRow.read(from)
1224
+ };
1225
+ }
1226
+ write(value, into) {
1227
+ FfiConverterUInt64.write(value.totalCollateralSats, into);
1228
+ FfiConverterBool.write(value.isEnum, into);
1229
+ FfiConverterSequenceTypePayoutRow.write(value.rows, into);
1230
+ }
1231
+ allocationSize(value) {
1232
+ return FfiConverterUInt64.allocationSize(value.totalCollateralSats) + FfiConverterBool.allocationSize(value.isEnum) + FfiConverterSequenceTypePayoutRow.allocationSize(value.rows);
1233
+ }
1234
+ }
1235
+ return new FFIConverter();
1236
+ })();
1237
+
1238
+ /**
1239
+ * Parameters for [`create_offer`] (mirrors [`ddk::contract::CreateOfferParams`]).
1240
+ */
1241
+
1242
+ /**
1243
+ * Generated factory for {@link CreateOfferParams} record objects.
1244
+ */
1245
+ export const CreateOfferParams = (() => {
1246
+ const defaults = () => ({});
1247
+ const create = (() => {
1248
+ return uniffiCreateRecord(defaults);
1249
+ })();
1250
+ return Object.freeze({
1251
+ create,
1252
+ new: create,
1253
+ defaults: () => Object.freeze(defaults())
1254
+ });
1255
+ })();
1256
+ const FfiConverterTypeCreateOfferParams = (() => {
1257
+ class FFIConverter extends AbstractFfiConverterByteArray {
1258
+ read(from) {
1259
+ return {
1260
+ chainHash: FfiConverterArrayBuffer.read(from),
1261
+ temporaryContractId: FfiConverterOptionalBytes.read(from),
1262
+ contractInfo: FfiConverterArrayBuffer.read(from),
1263
+ offerCollateralSats: FfiConverterUInt64.read(from),
1264
+ party: FfiConverterTypeContractPartyParams.read(from),
1265
+ fundOutputSerialId: FfiConverterOptionalUInt64.read(from),
1266
+ feeRatePerVb: FfiConverterUInt64.read(from),
1267
+ cetLocktime: FfiConverterUInt32.read(from),
1268
+ refundLocktime: FfiConverterUInt32.read(from),
1269
+ contractFlags: FfiConverterUInt8.read(from)
1270
+ };
1271
+ }
1272
+ write(value, into) {
1273
+ FfiConverterArrayBuffer.write(value.chainHash, into);
1274
+ FfiConverterOptionalBytes.write(value.temporaryContractId, into);
1275
+ FfiConverterArrayBuffer.write(value.contractInfo, into);
1276
+ FfiConverterUInt64.write(value.offerCollateralSats, into);
1277
+ FfiConverterTypeContractPartyParams.write(value.party, into);
1278
+ FfiConverterOptionalUInt64.write(value.fundOutputSerialId, into);
1279
+ FfiConverterUInt64.write(value.feeRatePerVb, into);
1280
+ FfiConverterUInt32.write(value.cetLocktime, into);
1281
+ FfiConverterUInt32.write(value.refundLocktime, into);
1282
+ FfiConverterUInt8.write(value.contractFlags, into);
1283
+ }
1284
+ allocationSize(value) {
1285
+ return FfiConverterArrayBuffer.allocationSize(value.chainHash) + FfiConverterOptionalBytes.allocationSize(value.temporaryContractId) + FfiConverterArrayBuffer.allocationSize(value.contractInfo) + FfiConverterUInt64.allocationSize(value.offerCollateralSats) + FfiConverterTypeContractPartyParams.allocationSize(value.party) + FfiConverterOptionalUInt64.allocationSize(value.fundOutputSerialId) + FfiConverterUInt64.allocationSize(value.feeRatePerVb) + FfiConverterUInt32.allocationSize(value.cetLocktime) + FfiConverterUInt32.allocationSize(value.refundLocktime) + FfiConverterUInt8.allocationSize(value.contractFlags);
1286
+ }
1287
+ }
1288
+ return new FFIConverter();
1289
+ })();
1290
+
1291
+ /**
1292
+ * Identifies a funding input and the descriptor wildcard index that derives its
1293
+ * key, for [`sign_funding_psbt_with_descriptor`].
1294
+ */
1295
+
1296
+ /**
1297
+ * Generated factory for {@link DescriptorInput} record objects.
1298
+ */
1299
+ export const DescriptorInput = (() => {
1300
+ const defaults = () => ({});
1301
+ const create = (() => {
1302
+ return uniffiCreateRecord(defaults);
1303
+ })();
1304
+ return Object.freeze({
1305
+ create,
1306
+ new: create,
1307
+ defaults: () => Object.freeze(defaults())
1308
+ });
1309
+ })();
1310
+ const FfiConverterTypeDescriptorInput = (() => {
1311
+ class FFIConverter extends AbstractFfiConverterByteArray {
1312
+ read(from) {
1313
+ return {
1314
+ inputSerialId: FfiConverterUInt64.read(from),
1315
+ derivationIndex: FfiConverterUInt32.read(from)
1316
+ };
1317
+ }
1318
+ write(value, into) {
1319
+ FfiConverterUInt64.write(value.inputSerialId, into);
1320
+ FfiConverterUInt32.write(value.derivationIndex, into);
1321
+ }
1322
+ allocationSize(value) {
1323
+ return FfiConverterUInt64.allocationSize(value.inputSerialId) + FfiConverterUInt32.allocationSize(value.derivationIndex);
1324
+ }
1325
+ }
1326
+ return new FFIConverter();
1327
+ })();
1328
+ /**
1329
+ * Generated factory for {@link DlcInputInfo} record objects.
1330
+ */
1331
+ export const DlcInputInfo = (() => {
1332
+ const defaults = () => ({});
1333
+ const create = (() => {
1334
+ return uniffiCreateRecord(defaults);
1335
+ })();
1336
+ return Object.freeze({
1337
+ create,
1338
+ new: create,
1339
+ defaults: () => Object.freeze(defaults())
1340
+ });
1341
+ })();
1342
+ const FfiConverterTypeDlcInputInfo = (() => {
1343
+ class FFIConverter extends AbstractFfiConverterByteArray {
1344
+ read(from) {
1345
+ return {
1346
+ fundTx: FfiConverterTypeTransaction.read(from),
1347
+ fundVout: FfiConverterUInt32.read(from),
1348
+ localFundPubkey: FfiConverterArrayBuffer.read(from),
1349
+ remoteFundPubkey: FfiConverterArrayBuffer.read(from),
1350
+ fundAmount: FfiConverterUInt64.read(from),
1351
+ maxWitnessLen: FfiConverterUInt32.read(from),
1352
+ inputSerialId: FfiConverterUInt64.read(from),
1353
+ contractId: FfiConverterArrayBuffer.read(from)
1354
+ };
1355
+ }
1356
+ write(value, into) {
1357
+ FfiConverterTypeTransaction.write(value.fundTx, into);
1358
+ FfiConverterUInt32.write(value.fundVout, into);
1359
+ FfiConverterArrayBuffer.write(value.localFundPubkey, into);
1360
+ FfiConverterArrayBuffer.write(value.remoteFundPubkey, into);
1361
+ FfiConverterUInt64.write(value.fundAmount, into);
1362
+ FfiConverterUInt32.write(value.maxWitnessLen, into);
1363
+ FfiConverterUInt64.write(value.inputSerialId, into);
1364
+ FfiConverterArrayBuffer.write(value.contractId, into);
1365
+ }
1366
+ allocationSize(value) {
1367
+ return FfiConverterTypeTransaction.allocationSize(value.fundTx) + FfiConverterUInt32.allocationSize(value.fundVout) + FfiConverterArrayBuffer.allocationSize(value.localFundPubkey) + FfiConverterArrayBuffer.allocationSize(value.remoteFundPubkey) + FfiConverterUInt64.allocationSize(value.fundAmount) + FfiConverterUInt32.allocationSize(value.maxWitnessLen) + FfiConverterUInt64.allocationSize(value.inputSerialId) + FfiConverterArrayBuffer.allocationSize(value.contractId);
1368
+ }
1369
+ }
1370
+ return new FFIConverter();
1371
+ })();
1372
+
1373
+ /**
1374
+ * An oracle attestation paired with the position of the oracle that produced it
1375
+ * in the contract's announcements, for [`sign_contract_cet`].
1376
+ */
1377
+
1378
+ /**
1379
+ * Generated factory for {@link OracleAttestationRef} record objects.
1380
+ */
1381
+ export const OracleAttestationRef = (() => {
1382
+ const defaults = () => ({});
1383
+ const create = (() => {
1384
+ return uniffiCreateRecord(defaults);
1385
+ })();
1386
+ return Object.freeze({
1387
+ create,
1388
+ new: create,
1389
+ defaults: () => Object.freeze(defaults())
1390
+ });
1391
+ })();
1392
+ const FfiConverterTypeOracleAttestationRef = (() => {
1393
+ class FFIConverter extends AbstractFfiConverterByteArray {
1394
+ read(from) {
1395
+ return {
1396
+ oracleIndex: FfiConverterUInt32.read(from),
1397
+ attestation: FfiConverterArrayBuffer.read(from)
1398
+ };
1399
+ }
1400
+ write(value, into) {
1401
+ FfiConverterUInt32.write(value.oracleIndex, into);
1402
+ FfiConverterArrayBuffer.write(value.attestation, into);
1403
+ }
1404
+ allocationSize(value) {
1405
+ return FfiConverterUInt32.allocationSize(value.oracleIndex) + FfiConverterArrayBuffer.allocationSize(value.attestation);
1406
+ }
1407
+ }
1408
+ return new FFIConverter();
1409
+ })();
1410
+ /**
1411
+ * Generated factory for {@link OracleInfo} record objects.
1412
+ */
1413
+ export const OracleInfo = (() => {
1414
+ const defaults = () => ({});
1415
+ const create = (() => {
1416
+ return uniffiCreateRecord(defaults);
1417
+ })();
1418
+ return Object.freeze({
1419
+ create,
1420
+ new: create,
1421
+ defaults: () => Object.freeze(defaults())
1422
+ });
1423
+ })();
1424
+ const FfiConverterTypeOracleInfo = (() => {
1425
+ class FFIConverter extends AbstractFfiConverterByteArray {
1426
+ read(from) {
1427
+ return {
1428
+ publicKey: FfiConverterArrayBuffer.read(from),
1429
+ nonces: FfiConverterSequenceBytes.read(from)
1430
+ };
1431
+ }
1432
+ write(value, into) {
1433
+ FfiConverterArrayBuffer.write(value.publicKey, into);
1434
+ FfiConverterSequenceBytes.write(value.nonces, into);
1435
+ }
1436
+ allocationSize(value) {
1437
+ return FfiConverterArrayBuffer.allocationSize(value.publicKey) + FfiConverterSequenceBytes.allocationSize(value.nonces);
1438
+ }
1439
+ }
1440
+ return new FFIConverter();
1441
+ })();
1442
+ /**
1443
+ * Generated factory for {@link TxInputInfo} record objects.
1444
+ */
1445
+ export const TxInputInfo = (() => {
1446
+ const defaults = () => ({});
1447
+ const create = (() => {
1448
+ return uniffiCreateRecord(defaults);
1449
+ })();
1450
+ return Object.freeze({
1451
+ create,
1452
+ new: create,
1453
+ defaults: () => Object.freeze(defaults())
1454
+ });
1455
+ })();
1456
+ const FfiConverterTypeTxInputInfo = (() => {
1457
+ class FFIConverter extends AbstractFfiConverterByteArray {
1458
+ read(from) {
1459
+ return {
1460
+ txid: FfiConverterString.read(from),
1461
+ vout: FfiConverterUInt32.read(from),
1462
+ scriptSig: FfiConverterArrayBuffer.read(from),
1463
+ maxWitnessLength: FfiConverterUInt32.read(from),
1464
+ serialId: FfiConverterUInt64.read(from)
1465
+ };
1466
+ }
1467
+ write(value, into) {
1468
+ FfiConverterString.write(value.txid, into);
1469
+ FfiConverterUInt32.write(value.vout, into);
1470
+ FfiConverterArrayBuffer.write(value.scriptSig, into);
1471
+ FfiConverterUInt32.write(value.maxWitnessLength, into);
1472
+ FfiConverterUInt64.write(value.serialId, into);
1473
+ }
1474
+ allocationSize(value) {
1475
+ return FfiConverterString.allocationSize(value.txid) + FfiConverterUInt32.allocationSize(value.vout) + FfiConverterArrayBuffer.allocationSize(value.scriptSig) + FfiConverterUInt32.allocationSize(value.maxWitnessLength) + FfiConverterUInt64.allocationSize(value.serialId);
1476
+ }
1477
+ }
1478
+ return new FFIConverter();
1479
+ })();
1480
+ /**
1481
+ * Generated factory for {@link PartyParams} record objects.
1482
+ */
1483
+ export const PartyParams = (() => {
1484
+ const defaults = () => ({});
1485
+ const create = (() => {
1486
+ return uniffiCreateRecord(defaults);
1487
+ })();
1488
+ return Object.freeze({
1489
+ create,
1490
+ new: create,
1491
+ defaults: () => Object.freeze(defaults()),
1492
+ changeOutputAndFees(self_, feeRate) {
1493
+ return (__rb => {
1494
+ try {
1495
+ return FfiConverterTypeChangeOutputAndFees.lift(__rb);
1496
+ } finally {
1497
+ nativeModule().rustbuffer_free(__rb);
1498
+ }
1499
+ })(uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeDLCError.lift.bind(FfiConverterTypeDLCError), /*caller:*/callStatus => {
1500
+ return nativeModule().ubrn_uniffi_ddk_ffi_fn_method_partyparams_change_output_and_fees(FfiConverterTypePartyParams.lower(self_, nativeModule().rustbuffer_alloc), FfiConverterUInt64.lower(feeRate, nativeModule().rustbuffer_alloc), callStatus);
1501
+ }, /*liftString:*/FfiConverterString.lift.bind(FfiConverterString)));
1502
+ }
1503
+ });
1504
+ })();
1505
+ const FfiConverterTypePartyParams = (() => {
1506
+ class FFIConverter extends AbstractFfiConverterByteArray {
1507
+ read(from) {
1508
+ return {
1509
+ fundPubkey: FfiConverterArrayBuffer.read(from),
1510
+ changeScriptPubkey: FfiConverterArrayBuffer.read(from),
1511
+ changeSerialId: FfiConverterUInt64.read(from),
1512
+ payoutScriptPubkey: FfiConverterArrayBuffer.read(from),
1513
+ payoutSerialId: FfiConverterUInt64.read(from),
1514
+ inputs: FfiConverterSequenceTypeTxInputInfo.read(from),
1515
+ inputAmount: FfiConverterUInt64.read(from),
1516
+ collateral: FfiConverterUInt64.read(from),
1517
+ dlcInputs: FfiConverterSequenceTypeDlcInputInfo.read(from)
1518
+ };
1519
+ }
1520
+ write(value, into) {
1521
+ FfiConverterArrayBuffer.write(value.fundPubkey, into);
1522
+ FfiConverterArrayBuffer.write(value.changeScriptPubkey, into);
1523
+ FfiConverterUInt64.write(value.changeSerialId, into);
1524
+ FfiConverterArrayBuffer.write(value.payoutScriptPubkey, into);
1525
+ FfiConverterUInt64.write(value.payoutSerialId, into);
1526
+ FfiConverterSequenceTypeTxInputInfo.write(value.inputs, into);
1527
+ FfiConverterUInt64.write(value.inputAmount, into);
1528
+ FfiConverterUInt64.write(value.collateral, into);
1529
+ FfiConverterSequenceTypeDlcInputInfo.write(value.dlcInputs, into);
1530
+ }
1531
+ allocationSize(value) {
1532
+ return FfiConverterArrayBuffer.allocationSize(value.fundPubkey) + FfiConverterArrayBuffer.allocationSize(value.changeScriptPubkey) + FfiConverterUInt64.allocationSize(value.changeSerialId) + FfiConverterArrayBuffer.allocationSize(value.payoutScriptPubkey) + FfiConverterUInt64.allocationSize(value.payoutSerialId) + FfiConverterSequenceTypeTxInputInfo.allocationSize(value.inputs) + FfiConverterUInt64.allocationSize(value.inputAmount) + FfiConverterUInt64.allocationSize(value.collateral) + FfiConverterSequenceTypeDlcInputInfo.allocationSize(value.dlcInputs);
1533
+ }
1534
+ }
1535
+ return new FFIConverter();
1536
+ })();
1537
+ /**
1538
+ * Generated factory for {@link Payout} record objects.
1539
+ */
1540
+ export const Payout = (() => {
1541
+ const defaults = () => ({});
1542
+ const create = (() => {
1543
+ return uniffiCreateRecord(defaults);
1544
+ })();
1545
+ return Object.freeze({
1546
+ create,
1547
+ new: create,
1548
+ defaults: () => Object.freeze(defaults())
1549
+ });
1550
+ })();
1551
+ const FfiConverterTypePayout = (() => {
1552
+ class FFIConverter extends AbstractFfiConverterByteArray {
1553
+ read(from) {
1554
+ return {
1555
+ offer: FfiConverterUInt64.read(from),
1556
+ accept: FfiConverterUInt64.read(from)
1557
+ };
1558
+ }
1559
+ write(value, into) {
1560
+ FfiConverterUInt64.write(value.offer, into);
1561
+ FfiConverterUInt64.write(value.accept, into);
1562
+ }
1563
+ allocationSize(value) {
1564
+ return FfiConverterUInt64.allocationSize(value.offer) + FfiConverterUInt64.allocationSize(value.accept);
1565
+ }
1566
+ }
1567
+ return new FFIConverter();
1568
+ })();
1569
+
1570
+ /**
1571
+ * The result of [`sign_accept`] / [`sign_accept_spliced`].
1572
+ */
1573
+
1574
+ /**
1575
+ * Generated factory for {@link SignResult} record objects.
1576
+ */
1577
+ export const SignResult = (() => {
1578
+ const defaults = () => ({});
1579
+ const create = (() => {
1580
+ return uniffiCreateRecord(defaults);
1581
+ })();
1582
+ return Object.freeze({
1583
+ create,
1584
+ new: create,
1585
+ defaults: () => Object.freeze(defaults())
1586
+ });
1587
+ })();
1588
+ const FfiConverterTypeSignResult = (() => {
1589
+ class FFIConverter extends AbstractFfiConverterByteArray {
1590
+ read(from) {
1591
+ return {
1592
+ sign: FfiConverterArrayBuffer.read(from),
1593
+ transactions: FfiConverterTypeDlcTransactions.read(from)
1594
+ };
1595
+ }
1596
+ write(value, into) {
1597
+ FfiConverterArrayBuffer.write(value.sign, into);
1598
+ FfiConverterTypeDlcTransactions.write(value.transactions, into);
1599
+ }
1600
+ allocationSize(value) {
1601
+ return FfiConverterArrayBuffer.allocationSize(value.sign) + FfiConverterTypeDlcTransactions.allocationSize(value.transactions);
1602
+ }
1603
+ }
1604
+ return new FFIConverter();
1605
+ })();
1606
+
1607
+ /**
1608
+ * References a splice (DLC) funding input and the previous contract whose
1609
+ * 2-of-2 output it spends, so the provider can re-derive the signing key.
1610
+ */
1611
+
1612
+ /**
1613
+ * Generated factory for {@link SpliceKeyRef} record objects.
1614
+ */
1615
+ export const SpliceKeyRef = (() => {
1616
+ const defaults = () => ({});
1617
+ const create = (() => {
1618
+ return uniffiCreateRecord(defaults);
1619
+ })();
1620
+ return Object.freeze({
1621
+ create,
1622
+ new: create,
1623
+ defaults: () => Object.freeze(defaults())
1624
+ });
1625
+ })();
1626
+ const FfiConverterTypeSpliceKeyRef = (() => {
1627
+ class FFIConverter extends AbstractFfiConverterByteArray {
1628
+ read(from) {
1629
+ return {
1630
+ inputSerialId: FfiConverterUInt64.read(from),
1631
+ priorTemporaryContractId: FfiConverterArrayBuffer.read(from)
1632
+ };
1633
+ }
1634
+ write(value, into) {
1635
+ FfiConverterUInt64.write(value.inputSerialId, into);
1636
+ FfiConverterArrayBuffer.write(value.priorTemporaryContractId, into);
1637
+ }
1638
+ allocationSize(value) {
1639
+ return FfiConverterUInt64.allocationSize(value.inputSerialId) + FfiConverterArrayBuffer.allocationSize(value.priorTemporaryContractId);
1640
+ }
1641
+ }
1642
+ return new FFIConverter();
1643
+ })();
1644
+
1645
+ // Error type: ContractError
1646
+ export let ContractError_Tags = /*#__PURE__*/function (ContractError_Tags) {
1647
+ ContractError_Tags["InvalidOffer"] = "InvalidOffer";
1648
+ ContractError_Tags["InvalidAccept"] = "InvalidAccept";
1649
+ ContractError_Tags["InvalidSign"] = "InvalidSign";
1650
+ ContractError_Tags["InvalidFundingInput"] = "InvalidFundingInput";
1651
+ ContractError_Tags["PsbtMismatch"] = "PsbtMismatch";
1652
+ ContractError_Tags["MissingFinalizedInput"] = "MissingFinalizedInput";
1653
+ ContractError_Tags["UnsupportedScriptType"] = "UnsupportedScriptType";
1654
+ ContractError_Tags["InvalidAttestation"] = "InvalidAttestation";
1655
+ ContractError_Tags["NoMatchingOutcome"] = "NoMatchingOutcome";
1656
+ ContractError_Tags["Descriptor"] = "Descriptor";
1657
+ ContractError_Tags["Wallet"] = "Wallet";
1658
+ ContractError_Tags["Bip32"] = "Bip32";
1659
+ ContractError_Tags["Dlc"] = "Dlc";
1660
+ ContractError_Tags["Key"] = "Key";
1661
+ ContractError_Tags["Serialization"] = "Serialization";
1662
+ ContractError_Tags["InvalidNetwork"] = "InvalidNetwork";
1663
+ ContractError_Tags["InvalidLength"] = "InvalidLength";
1664
+ return ContractError_Tags;
1665
+ }({});
1666
+ /**
1667
+ * Errors returned by the stateless contract API.
1668
+ *
1669
+ * Mirrors [`ddk::contract::ContractError`] as a uniffi error so the typed
1670
+ * variants survive across the binding boundary. Variants carry plain strings.
1671
+ */
1672
+ export const ContractError = (() => {
1673
+ class InvalidOffer_ extends UniffiError {
1674
+ /**
1675
+ * @private
1676
+ * This field is private and should not be used, use `tag` instead.
1677
+ */
1678
+ [uniffiTypeNameSymbol] = 'ContractError';
1679
+ tag = ContractError_Tags.InvalidOffer;
1680
+ constructor(inner) {
1681
+ super('ContractError', 'InvalidOffer');
1682
+ this.inner = Object.freeze(inner);
1683
+ }
1684
+ static new(inner) {
1685
+ return new InvalidOffer_(inner);
1686
+ }
1687
+ static instanceOf(obj) {
1688
+ return obj.tag === ContractError_Tags.InvalidOffer;
1689
+ }
1690
+ static hasInner(obj) {
1691
+ return InvalidOffer_.instanceOf(obj);
1692
+ }
1693
+ static getInner(obj) {
1694
+ return obj.inner;
1695
+ }
1696
+ }
1697
+ class InvalidAccept_ extends UniffiError {
1698
+ /**
1699
+ * @private
1700
+ * This field is private and should not be used, use `tag` instead.
1701
+ */
1702
+ [uniffiTypeNameSymbol] = 'ContractError';
1703
+ tag = ContractError_Tags.InvalidAccept;
1704
+ constructor(inner) {
1705
+ super('ContractError', 'InvalidAccept');
1706
+ this.inner = Object.freeze(inner);
1707
+ }
1708
+ static new(inner) {
1709
+ return new InvalidAccept_(inner);
1710
+ }
1711
+ static instanceOf(obj) {
1712
+ return obj.tag === ContractError_Tags.InvalidAccept;
1713
+ }
1714
+ static hasInner(obj) {
1715
+ return InvalidAccept_.instanceOf(obj);
1716
+ }
1717
+ static getInner(obj) {
1718
+ return obj.inner;
1719
+ }
1720
+ }
1721
+ class InvalidSign_ extends UniffiError {
1722
+ /**
1723
+ * @private
1724
+ * This field is private and should not be used, use `tag` instead.
1725
+ */
1726
+ [uniffiTypeNameSymbol] = 'ContractError';
1727
+ tag = ContractError_Tags.InvalidSign;
1728
+ constructor(inner) {
1729
+ super('ContractError', 'InvalidSign');
1730
+ this.inner = Object.freeze(inner);
1731
+ }
1732
+ static new(inner) {
1733
+ return new InvalidSign_(inner);
1734
+ }
1735
+ static instanceOf(obj) {
1736
+ return obj.tag === ContractError_Tags.InvalidSign;
1737
+ }
1738
+ static hasInner(obj) {
1739
+ return InvalidSign_.instanceOf(obj);
1740
+ }
1741
+ static getInner(obj) {
1742
+ return obj.inner;
1743
+ }
1744
+ }
1745
+ class InvalidFundingInput_ extends UniffiError {
1746
+ /**
1747
+ * @private
1748
+ * This field is private and should not be used, use `tag` instead.
1749
+ */
1750
+ [uniffiTypeNameSymbol] = 'ContractError';
1751
+ tag = ContractError_Tags.InvalidFundingInput;
1752
+ constructor(inner) {
1753
+ super('ContractError', 'InvalidFundingInput');
1754
+ this.inner = Object.freeze(inner);
1755
+ }
1756
+ static new(inner) {
1757
+ return new InvalidFundingInput_(inner);
1758
+ }
1759
+ static instanceOf(obj) {
1760
+ return obj.tag === ContractError_Tags.InvalidFundingInput;
1761
+ }
1762
+ static hasInner(obj) {
1763
+ return InvalidFundingInput_.instanceOf(obj);
1764
+ }
1765
+ static getInner(obj) {
1766
+ return obj.inner;
1767
+ }
1768
+ }
1769
+ class PsbtMismatch_ extends UniffiError {
1770
+ /**
1771
+ * @private
1772
+ * This field is private and should not be used, use `tag` instead.
1773
+ */
1774
+ [uniffiTypeNameSymbol] = 'ContractError';
1775
+ tag = ContractError_Tags.PsbtMismatch;
1776
+ constructor(inner) {
1777
+ super('ContractError', 'PsbtMismatch');
1778
+ this.inner = Object.freeze(inner);
1779
+ }
1780
+ static new(inner) {
1781
+ return new PsbtMismatch_(inner);
1782
+ }
1783
+ static instanceOf(obj) {
1784
+ return obj.tag === ContractError_Tags.PsbtMismatch;
1785
+ }
1786
+ static hasInner(obj) {
1787
+ return PsbtMismatch_.instanceOf(obj);
1788
+ }
1789
+ static getInner(obj) {
1790
+ return obj.inner;
1791
+ }
1792
+ }
1793
+ class MissingFinalizedInput_ extends UniffiError {
1794
+ /**
1795
+ * @private
1796
+ * This field is private and should not be used, use `tag` instead.
1797
+ */
1798
+ [uniffiTypeNameSymbol] = 'ContractError';
1799
+ tag = ContractError_Tags.MissingFinalizedInput;
1800
+ constructor(inner) {
1801
+ super('ContractError', 'MissingFinalizedInput');
1802
+ this.inner = Object.freeze(inner);
1803
+ }
1804
+ static new(inner) {
1805
+ return new MissingFinalizedInput_(inner);
1806
+ }
1807
+ static instanceOf(obj) {
1808
+ return obj.tag === ContractError_Tags.MissingFinalizedInput;
1809
+ }
1810
+ static hasInner(obj) {
1811
+ return MissingFinalizedInput_.instanceOf(obj);
1812
+ }
1813
+ static getInner(obj) {
1814
+ return obj.inner;
1815
+ }
1816
+ }
1817
+ class UnsupportedScriptType_ extends UniffiError {
1818
+ /**
1819
+ * @private
1820
+ * This field is private and should not be used, use `tag` instead.
1821
+ */
1822
+ [uniffiTypeNameSymbol] = 'ContractError';
1823
+ tag = ContractError_Tags.UnsupportedScriptType;
1824
+ constructor(inner) {
1825
+ super('ContractError', 'UnsupportedScriptType');
1826
+ this.inner = Object.freeze(inner);
1827
+ }
1828
+ static new(inner) {
1829
+ return new UnsupportedScriptType_(inner);
1830
+ }
1831
+ static instanceOf(obj) {
1832
+ return obj.tag === ContractError_Tags.UnsupportedScriptType;
1833
+ }
1834
+ static hasInner(obj) {
1835
+ return UnsupportedScriptType_.instanceOf(obj);
1836
+ }
1837
+ static getInner(obj) {
1838
+ return obj.inner;
1839
+ }
1840
+ }
1841
+ class InvalidAttestation_ extends UniffiError {
1842
+ /**
1843
+ * @private
1844
+ * This field is private and should not be used, use `tag` instead.
1845
+ */
1846
+ [uniffiTypeNameSymbol] = 'ContractError';
1847
+ tag = ContractError_Tags.InvalidAttestation;
1848
+ constructor(inner) {
1849
+ super('ContractError', 'InvalidAttestation');
1850
+ this.inner = Object.freeze(inner);
1851
+ }
1852
+ static new(inner) {
1853
+ return new InvalidAttestation_(inner);
1854
+ }
1855
+ static instanceOf(obj) {
1856
+ return obj.tag === ContractError_Tags.InvalidAttestation;
1857
+ }
1858
+ static hasInner(obj) {
1859
+ return InvalidAttestation_.instanceOf(obj);
1860
+ }
1861
+ static getInner(obj) {
1862
+ return obj.inner;
1863
+ }
1864
+ }
1865
+ class NoMatchingOutcome_ extends UniffiError {
1866
+ /**
1867
+ * @private
1868
+ * This field is private and should not be used, use `tag` instead.
1869
+ */
1870
+ [uniffiTypeNameSymbol] = 'ContractError';
1871
+ tag = ContractError_Tags.NoMatchingOutcome;
1872
+ constructor() {
1873
+ super('ContractError', 'NoMatchingOutcome');
1874
+ }
1875
+ static new() {
1876
+ return new NoMatchingOutcome_();
1877
+ }
1878
+ static instanceOf(obj) {
1879
+ return obj.tag === ContractError_Tags.NoMatchingOutcome;
1880
+ }
1881
+ static hasInner(obj) {
1882
+ return false;
1883
+ }
1884
+ }
1885
+ class Descriptor_ extends UniffiError {
1886
+ /**
1887
+ * @private
1888
+ * This field is private and should not be used, use `tag` instead.
1889
+ */
1890
+ [uniffiTypeNameSymbol] = 'ContractError';
1891
+ tag = ContractError_Tags.Descriptor;
1892
+ constructor(inner) {
1893
+ super('ContractError', 'Descriptor');
1894
+ this.inner = Object.freeze(inner);
1895
+ }
1896
+ static new(inner) {
1897
+ return new Descriptor_(inner);
1898
+ }
1899
+ static instanceOf(obj) {
1900
+ return obj.tag === ContractError_Tags.Descriptor;
1901
+ }
1902
+ static hasInner(obj) {
1903
+ return Descriptor_.instanceOf(obj);
1904
+ }
1905
+ static getInner(obj) {
1906
+ return obj.inner;
1907
+ }
1908
+ }
1909
+ class Wallet_ extends UniffiError {
1910
+ /**
1911
+ * @private
1912
+ * This field is private and should not be used, use `tag` instead.
1913
+ */
1914
+ [uniffiTypeNameSymbol] = 'ContractError';
1915
+ tag = ContractError_Tags.Wallet;
1916
+ constructor(inner) {
1917
+ super('ContractError', 'Wallet');
1918
+ this.inner = Object.freeze(inner);
1919
+ }
1920
+ static new(inner) {
1921
+ return new Wallet_(inner);
1922
+ }
1923
+ static instanceOf(obj) {
1924
+ return obj.tag === ContractError_Tags.Wallet;
1925
+ }
1926
+ static hasInner(obj) {
1927
+ return Wallet_.instanceOf(obj);
1928
+ }
1929
+ static getInner(obj) {
1930
+ return obj.inner;
1931
+ }
1932
+ }
1933
+ class Bip32_ extends UniffiError {
1934
+ /**
1935
+ * @private
1936
+ * This field is private and should not be used, use `tag` instead.
1937
+ */
1938
+ [uniffiTypeNameSymbol] = 'ContractError';
1939
+ tag = ContractError_Tags.Bip32;
1940
+ constructor(inner) {
1941
+ super('ContractError', 'Bip32');
1942
+ this.inner = Object.freeze(inner);
1943
+ }
1944
+ static new(inner) {
1945
+ return new Bip32_(inner);
1946
+ }
1947
+ static instanceOf(obj) {
1948
+ return obj.tag === ContractError_Tags.Bip32;
1949
+ }
1950
+ static hasInner(obj) {
1951
+ return Bip32_.instanceOf(obj);
1952
+ }
1953
+ static getInner(obj) {
1954
+ return obj.inner;
1955
+ }
1956
+ }
1957
+ class Dlc_ extends UniffiError {
1958
+ /**
1959
+ * @private
1960
+ * This field is private and should not be used, use `tag` instead.
1961
+ */
1962
+ [uniffiTypeNameSymbol] = 'ContractError';
1963
+ tag = ContractError_Tags.Dlc;
1964
+ constructor(inner) {
1965
+ super('ContractError', 'Dlc');
1966
+ this.inner = Object.freeze(inner);
1967
+ }
1968
+ static new(inner) {
1969
+ return new Dlc_(inner);
1970
+ }
1971
+ static instanceOf(obj) {
1972
+ return obj.tag === ContractError_Tags.Dlc;
1973
+ }
1974
+ static hasInner(obj) {
1975
+ return Dlc_.instanceOf(obj);
1976
+ }
1977
+ static getInner(obj) {
1978
+ return obj.inner;
1979
+ }
1980
+ }
1981
+ class Key_ extends UniffiError {
1982
+ /**
1983
+ * @private
1984
+ * This field is private and should not be used, use `tag` instead.
1985
+ */
1986
+ [uniffiTypeNameSymbol] = 'ContractError';
1987
+ tag = ContractError_Tags.Key;
1988
+ constructor(inner) {
1989
+ super('ContractError', 'Key');
1990
+ this.inner = Object.freeze(inner);
1991
+ }
1992
+ static new(inner) {
1993
+ return new Key_(inner);
1994
+ }
1995
+ static instanceOf(obj) {
1996
+ return obj.tag === ContractError_Tags.Key;
1997
+ }
1998
+ static hasInner(obj) {
1999
+ return Key_.instanceOf(obj);
2000
+ }
2001
+ static getInner(obj) {
2002
+ return obj.inner;
2003
+ }
2004
+ }
2005
+ /**
2006
+ * A message or PSBT could not be (de)serialized at the FFI boundary.
2007
+ */
2008
+ class Serialization_ extends UniffiError {
2009
+ /**
2010
+ * @private
2011
+ * This field is private and should not be used, use `tag` instead.
2012
+ */
2013
+ [uniffiTypeNameSymbol] = 'ContractError';
2014
+ tag = ContractError_Tags.Serialization;
2015
+ constructor(inner) {
2016
+ super('ContractError', 'Serialization');
2017
+ this.inner = Object.freeze(inner);
2018
+ }
2019
+ static new(inner) {
2020
+ return new Serialization_(inner);
2021
+ }
2022
+ static instanceOf(obj) {
2023
+ return obj.tag === ContractError_Tags.Serialization;
2024
+ }
2025
+ static hasInner(obj) {
2026
+ return Serialization_.instanceOf(obj);
2027
+ }
2028
+ static getInner(obj) {
2029
+ return obj.inner;
2030
+ }
2031
+ }
2032
+ /**
2033
+ * The network string was not one of bitcoin/testnet/signet/regtest.
2034
+ */
2035
+ class InvalidNetwork_ extends UniffiError {
2036
+ /**
2037
+ * @private
2038
+ * This field is private and should not be used, use `tag` instead.
2039
+ */
2040
+ [uniffiTypeNameSymbol] = 'ContractError';
2041
+ tag = ContractError_Tags.InvalidNetwork;
2042
+ constructor(inner) {
2043
+ super('ContractError', 'InvalidNetwork');
2044
+ this.inner = Object.freeze(inner);
2045
+ }
2046
+ static new(inner) {
2047
+ return new InvalidNetwork_(inner);
2048
+ }
2049
+ static instanceOf(obj) {
2050
+ return obj.tag === ContractError_Tags.InvalidNetwork;
2051
+ }
2052
+ static hasInner(obj) {
2053
+ return InvalidNetwork_.instanceOf(obj);
2054
+ }
2055
+ static getInner(obj) {
2056
+ return obj.inner;
2057
+ }
2058
+ }
2059
+ /**
2060
+ * A byte argument had the wrong length (e.g. a 32-byte id).
2061
+ */
2062
+ class InvalidLength_ extends UniffiError {
2063
+ /**
2064
+ * @private
2065
+ * This field is private and should not be used, use `tag` instead.
2066
+ */
2067
+ [uniffiTypeNameSymbol] = 'ContractError';
2068
+ tag = ContractError_Tags.InvalidLength;
2069
+ constructor(inner) {
2070
+ super('ContractError', 'InvalidLength');
2071
+ this.inner = Object.freeze(inner);
2072
+ }
2073
+ static new(inner) {
2074
+ return new InvalidLength_(inner);
2075
+ }
2076
+ static instanceOf(obj) {
2077
+ return obj.tag === ContractError_Tags.InvalidLength;
2078
+ }
2079
+ static hasInner(obj) {
2080
+ return InvalidLength_.instanceOf(obj);
2081
+ }
2082
+ static getInner(obj) {
2083
+ return obj.inner;
2084
+ }
2085
+ }
2086
+ function instanceOf(obj) {
2087
+ return obj[uniffiTypeNameSymbol] === 'ContractError';
2088
+ }
2089
+ return Object.freeze({
2090
+ instanceOf,
2091
+ InvalidOffer: InvalidOffer_,
2092
+ InvalidAccept: InvalidAccept_,
2093
+ InvalidSign: InvalidSign_,
2094
+ InvalidFundingInput: InvalidFundingInput_,
2095
+ PsbtMismatch: PsbtMismatch_,
2096
+ MissingFinalizedInput: MissingFinalizedInput_,
2097
+ UnsupportedScriptType: UnsupportedScriptType_,
2098
+ InvalidAttestation: InvalidAttestation_,
2099
+ NoMatchingOutcome: NoMatchingOutcome_,
2100
+ Descriptor: Descriptor_,
2101
+ Wallet: Wallet_,
2102
+ Bip32: Bip32_,
2103
+ Dlc: Dlc_,
2104
+ Key: Key_,
2105
+ Serialization: Serialization_,
2106
+ InvalidNetwork: InvalidNetwork_,
2107
+ InvalidLength: InvalidLength_
2108
+ });
2109
+ })();
2110
+ /**
2111
+ * Errors returned by the stateless contract API.
2112
+ *
2113
+ * Mirrors [`ddk::contract::ContractError`] as a uniffi error so the typed
2114
+ * variants survive across the binding boundary. Variants carry plain strings.
2115
+ */
2116
+
2117
+ // FfiConverter for enum ContractError
2118
+ const FfiConverterTypeContractError = (() => {
2119
+ const ordinalConverter = FfiConverterInt32;
2120
+ class FFIConverter extends AbstractFfiConverterByteArray {
2121
+ read(from) {
2122
+ switch (ordinalConverter.read(from)) {
2123
+ case 1:
2124
+ return new ContractError.InvalidOffer({
2125
+ message: FfiConverterString.read(from)
2126
+ });
2127
+ case 2:
2128
+ return new ContractError.InvalidAccept({
2129
+ message: FfiConverterString.read(from)
2130
+ });
2131
+ case 3:
2132
+ return new ContractError.InvalidSign({
2133
+ message: FfiConverterString.read(from)
2134
+ });
2135
+ case 4:
2136
+ return new ContractError.InvalidFundingInput({
2137
+ message: FfiConverterString.read(from)
2138
+ });
2139
+ case 5:
2140
+ return new ContractError.PsbtMismatch({
2141
+ message: FfiConverterString.read(from)
2142
+ });
2143
+ case 6:
2144
+ return new ContractError.MissingFinalizedInput({
2145
+ inputIndex: FfiConverterUInt32.read(from)
2146
+ });
2147
+ case 7:
2148
+ return new ContractError.UnsupportedScriptType({
2149
+ inputIndex: FfiConverterUInt32.read(from)
2150
+ });
2151
+ case 8:
2152
+ return new ContractError.InvalidAttestation({
2153
+ message: FfiConverterString.read(from)
2154
+ });
2155
+ case 9:
2156
+ return new ContractError.NoMatchingOutcome();
2157
+ case 10:
2158
+ return new ContractError.Descriptor({
2159
+ message: FfiConverterString.read(from)
2160
+ });
2161
+ case 11:
2162
+ return new ContractError.Wallet({
2163
+ message: FfiConverterString.read(from)
2164
+ });
2165
+ case 12:
2166
+ return new ContractError.Bip32({
2167
+ message: FfiConverterString.read(from)
2168
+ });
2169
+ case 13:
2170
+ return new ContractError.Dlc({
2171
+ message: FfiConverterString.read(from)
2172
+ });
2173
+ case 14:
2174
+ return new ContractError.Key({
2175
+ message: FfiConverterString.read(from)
2176
+ });
2177
+ case 15:
2178
+ return new ContractError.Serialization({
2179
+ message: FfiConverterString.read(from)
2180
+ });
2181
+ case 16:
2182
+ return new ContractError.InvalidNetwork({
2183
+ message: FfiConverterString.read(from)
2184
+ });
2185
+ case 17:
2186
+ return new ContractError.InvalidLength({
2187
+ field: FfiConverterString.read(from),
2188
+ expected: FfiConverterUInt32.read(from),
2189
+ actual: FfiConverterUInt32.read(from)
2190
+ });
2191
+ default:
2192
+ throw new UniffiInternalError.UnexpectedEnumCase();
2193
+ }
871
2194
  }
872
2195
  write(value, into) {
873
- FfiConverterUInt64.write(value.offer, into);
874
- FfiConverterUInt64.write(value.accept, into);
2196
+ switch (value.tag) {
2197
+ case ContractError_Tags.InvalidOffer:
2198
+ {
2199
+ ordinalConverter.write(1, into);
2200
+ const inner = value.inner;
2201
+ FfiConverterString.write(inner.message, into);
2202
+ return;
2203
+ }
2204
+ case ContractError_Tags.InvalidAccept:
2205
+ {
2206
+ ordinalConverter.write(2, into);
2207
+ const inner = value.inner;
2208
+ FfiConverterString.write(inner.message, into);
2209
+ return;
2210
+ }
2211
+ case ContractError_Tags.InvalidSign:
2212
+ {
2213
+ ordinalConverter.write(3, into);
2214
+ const inner = value.inner;
2215
+ FfiConverterString.write(inner.message, into);
2216
+ return;
2217
+ }
2218
+ case ContractError_Tags.InvalidFundingInput:
2219
+ {
2220
+ ordinalConverter.write(4, into);
2221
+ const inner = value.inner;
2222
+ FfiConverterString.write(inner.message, into);
2223
+ return;
2224
+ }
2225
+ case ContractError_Tags.PsbtMismatch:
2226
+ {
2227
+ ordinalConverter.write(5, into);
2228
+ const inner = value.inner;
2229
+ FfiConverterString.write(inner.message, into);
2230
+ return;
2231
+ }
2232
+ case ContractError_Tags.MissingFinalizedInput:
2233
+ {
2234
+ ordinalConverter.write(6, into);
2235
+ const inner = value.inner;
2236
+ FfiConverterUInt32.write(inner.inputIndex, into);
2237
+ return;
2238
+ }
2239
+ case ContractError_Tags.UnsupportedScriptType:
2240
+ {
2241
+ ordinalConverter.write(7, into);
2242
+ const inner = value.inner;
2243
+ FfiConverterUInt32.write(inner.inputIndex, into);
2244
+ return;
2245
+ }
2246
+ case ContractError_Tags.InvalidAttestation:
2247
+ {
2248
+ ordinalConverter.write(8, into);
2249
+ const inner = value.inner;
2250
+ FfiConverterString.write(inner.message, into);
2251
+ return;
2252
+ }
2253
+ case ContractError_Tags.NoMatchingOutcome:
2254
+ {
2255
+ ordinalConverter.write(9, into);
2256
+ return;
2257
+ }
2258
+ case ContractError_Tags.Descriptor:
2259
+ {
2260
+ ordinalConverter.write(10, into);
2261
+ const inner = value.inner;
2262
+ FfiConverterString.write(inner.message, into);
2263
+ return;
2264
+ }
2265
+ case ContractError_Tags.Wallet:
2266
+ {
2267
+ ordinalConverter.write(11, into);
2268
+ const inner = value.inner;
2269
+ FfiConverterString.write(inner.message, into);
2270
+ return;
2271
+ }
2272
+ case ContractError_Tags.Bip32:
2273
+ {
2274
+ ordinalConverter.write(12, into);
2275
+ const inner = value.inner;
2276
+ FfiConverterString.write(inner.message, into);
2277
+ return;
2278
+ }
2279
+ case ContractError_Tags.Dlc:
2280
+ {
2281
+ ordinalConverter.write(13, into);
2282
+ const inner = value.inner;
2283
+ FfiConverterString.write(inner.message, into);
2284
+ return;
2285
+ }
2286
+ case ContractError_Tags.Key:
2287
+ {
2288
+ ordinalConverter.write(14, into);
2289
+ const inner = value.inner;
2290
+ FfiConverterString.write(inner.message, into);
2291
+ return;
2292
+ }
2293
+ case ContractError_Tags.Serialization:
2294
+ {
2295
+ ordinalConverter.write(15, into);
2296
+ const inner = value.inner;
2297
+ FfiConverterString.write(inner.message, into);
2298
+ return;
2299
+ }
2300
+ case ContractError_Tags.InvalidNetwork:
2301
+ {
2302
+ ordinalConverter.write(16, into);
2303
+ const inner = value.inner;
2304
+ FfiConverterString.write(inner.message, into);
2305
+ return;
2306
+ }
2307
+ case ContractError_Tags.InvalidLength:
2308
+ {
2309
+ ordinalConverter.write(17, into);
2310
+ const inner = value.inner;
2311
+ FfiConverterString.write(inner.field, into);
2312
+ FfiConverterUInt32.write(inner.expected, into);
2313
+ FfiConverterUInt32.write(inner.actual, into);
2314
+ return;
2315
+ }
2316
+ default:
2317
+ // Throwing from here means that ContractError_Tags hasn't matched an ordinal.
2318
+ throw new UniffiInternalError.UnexpectedEnumCase();
2319
+ }
875
2320
  }
876
2321
  allocationSize(value) {
877
- return FfiConverterUInt64.allocationSize(value.offer) + FfiConverterUInt64.allocationSize(value.accept);
2322
+ switch (value.tag) {
2323
+ case ContractError_Tags.InvalidOffer:
2324
+ {
2325
+ const inner = value.inner;
2326
+ let size = ordinalConverter.allocationSize(1);
2327
+ size += FfiConverterString.allocationSize(inner.message);
2328
+ return size;
2329
+ }
2330
+ case ContractError_Tags.InvalidAccept:
2331
+ {
2332
+ const inner = value.inner;
2333
+ let size = ordinalConverter.allocationSize(2);
2334
+ size += FfiConverterString.allocationSize(inner.message);
2335
+ return size;
2336
+ }
2337
+ case ContractError_Tags.InvalidSign:
2338
+ {
2339
+ const inner = value.inner;
2340
+ let size = ordinalConverter.allocationSize(3);
2341
+ size += FfiConverterString.allocationSize(inner.message);
2342
+ return size;
2343
+ }
2344
+ case ContractError_Tags.InvalidFundingInput:
2345
+ {
2346
+ const inner = value.inner;
2347
+ let size = ordinalConverter.allocationSize(4);
2348
+ size += FfiConverterString.allocationSize(inner.message);
2349
+ return size;
2350
+ }
2351
+ case ContractError_Tags.PsbtMismatch:
2352
+ {
2353
+ const inner = value.inner;
2354
+ let size = ordinalConverter.allocationSize(5);
2355
+ size += FfiConverterString.allocationSize(inner.message);
2356
+ return size;
2357
+ }
2358
+ case ContractError_Tags.MissingFinalizedInput:
2359
+ {
2360
+ const inner = value.inner;
2361
+ let size = ordinalConverter.allocationSize(6);
2362
+ size += FfiConverterUInt32.allocationSize(inner.inputIndex);
2363
+ return size;
2364
+ }
2365
+ case ContractError_Tags.UnsupportedScriptType:
2366
+ {
2367
+ const inner = value.inner;
2368
+ let size = ordinalConverter.allocationSize(7);
2369
+ size += FfiConverterUInt32.allocationSize(inner.inputIndex);
2370
+ return size;
2371
+ }
2372
+ case ContractError_Tags.InvalidAttestation:
2373
+ {
2374
+ const inner = value.inner;
2375
+ let size = ordinalConverter.allocationSize(8);
2376
+ size += FfiConverterString.allocationSize(inner.message);
2377
+ return size;
2378
+ }
2379
+ case ContractError_Tags.NoMatchingOutcome:
2380
+ {
2381
+ return ordinalConverter.allocationSize(9);
2382
+ }
2383
+ case ContractError_Tags.Descriptor:
2384
+ {
2385
+ const inner = value.inner;
2386
+ let size = ordinalConverter.allocationSize(10);
2387
+ size += FfiConverterString.allocationSize(inner.message);
2388
+ return size;
2389
+ }
2390
+ case ContractError_Tags.Wallet:
2391
+ {
2392
+ const inner = value.inner;
2393
+ let size = ordinalConverter.allocationSize(11);
2394
+ size += FfiConverterString.allocationSize(inner.message);
2395
+ return size;
2396
+ }
2397
+ case ContractError_Tags.Bip32:
2398
+ {
2399
+ const inner = value.inner;
2400
+ let size = ordinalConverter.allocationSize(12);
2401
+ size += FfiConverterString.allocationSize(inner.message);
2402
+ return size;
2403
+ }
2404
+ case ContractError_Tags.Dlc:
2405
+ {
2406
+ const inner = value.inner;
2407
+ let size = ordinalConverter.allocationSize(13);
2408
+ size += FfiConverterString.allocationSize(inner.message);
2409
+ return size;
2410
+ }
2411
+ case ContractError_Tags.Key:
2412
+ {
2413
+ const inner = value.inner;
2414
+ let size = ordinalConverter.allocationSize(14);
2415
+ size += FfiConverterString.allocationSize(inner.message);
2416
+ return size;
2417
+ }
2418
+ case ContractError_Tags.Serialization:
2419
+ {
2420
+ const inner = value.inner;
2421
+ let size = ordinalConverter.allocationSize(15);
2422
+ size += FfiConverterString.allocationSize(inner.message);
2423
+ return size;
2424
+ }
2425
+ case ContractError_Tags.InvalidNetwork:
2426
+ {
2427
+ const inner = value.inner;
2428
+ let size = ordinalConverter.allocationSize(16);
2429
+ size += FfiConverterString.allocationSize(inner.message);
2430
+ return size;
2431
+ }
2432
+ case ContractError_Tags.InvalidLength:
2433
+ {
2434
+ const inner = value.inner;
2435
+ let size = ordinalConverter.allocationSize(17);
2436
+ size += FfiConverterString.allocationSize(inner.field);
2437
+ size += FfiConverterUInt32.allocationSize(inner.expected);
2438
+ size += FfiConverterUInt32.allocationSize(inner.actual);
2439
+ return size;
2440
+ }
2441
+ default:
2442
+ throw new UniffiInternalError.UnexpectedEnumCase();
2443
+ }
878
2444
  }
879
2445
  }
880
2446
  return new FFIConverter();
@@ -1324,9 +2890,188 @@ const FfiConverterTypeDLCError = (() => {
1324
2890
  return new FFIConverter();
1325
2891
  })();
1326
2892
 
2893
+ /**
2894
+ * Identifies which party's funding inputs an operation applies to.
2895
+ */
2896
+ export let Party = /*#__PURE__*/function (Party) {
2897
+ /**
2898
+ * The party that created the offer.
2899
+ */
2900
+ Party[Party["Offer"] = 0] = "Offer";
2901
+ /**
2902
+ * The party that accepted the offer.
2903
+ */
2904
+ Party[Party["Accept"] = 1] = "Accept";
2905
+ return Party;
2906
+ }({});
2907
+ const FfiConverterTypeParty = (() => {
2908
+ const ordinalConverter = FfiConverterInt32;
2909
+ class FFIConverter extends AbstractFfiConverterByteArray {
2910
+ read(from) {
2911
+ switch (ordinalConverter.read(from)) {
2912
+ case 1:
2913
+ return Party.Offer;
2914
+ case 2:
2915
+ return Party.Accept;
2916
+ default:
2917
+ throw new UniffiInternalError.UnexpectedEnumCase();
2918
+ }
2919
+ }
2920
+ write(value, into) {
2921
+ switch (value) {
2922
+ case Party.Offer:
2923
+ return ordinalConverter.write(1, into);
2924
+ case Party.Accept:
2925
+ return ordinalConverter.write(2, into);
2926
+ }
2927
+ }
2928
+ allocationSize(value) {
2929
+ return ordinalConverter.allocationSize(0);
2930
+ }
2931
+ }
2932
+ return new FFIConverter();
2933
+ })();
2934
+
2935
+ /**
2936
+ * Deterministically derives DLC contract funding keys from a master extended
2937
+ * private key. Secret keys never leave this object.
2938
+ *
2939
+ * Construct one from whatever key material the consumer holds, then call
2940
+ * [`ContractKeyProvider::funding_pubkey`] to obtain the public key to publish
2941
+ * in an offer/accept message.
2942
+ */
2943
+
2944
+ /**
2945
+ * @deprecated Use `ContractKeyProviderLike` instead.
2946
+ */
2947
+
2948
+ /**
2949
+ * Deterministically derives DLC contract funding keys from a master extended
2950
+ * private key. Secret keys never leave this object.
2951
+ *
2952
+ * Construct one from whatever key material the consumer holds, then call
2953
+ * [`ContractKeyProvider::funding_pubkey`] to obtain the public key to publish
2954
+ * in an offer/accept message.
2955
+ */
2956
+ export class ContractKeyProvider extends UniffiAbstractObject {
2957
+ [uniffiTypeNameSymbol] = 'ContractKeyProvider';
2958
+ // No primary constructor declared for this class.
2959
+ constructor(pointer) {
2960
+ super();
2961
+ this[pointerLiteralSymbol] = pointer;
2962
+ this[destructorGuardSymbol] = uniffiTypeContractKeyProviderObjectFactory.bless(pointer);
2963
+ }
2964
+
2965
+ /**
2966
+ * Builds a provider from an output descriptor that carries an extended
2967
+ * private key (e.g. `wpkh(xprv.../84h/1h/0h/0/*)`). Watch-only descriptors
2968
+ * are rejected; the descriptor's own path/wildcard is not applied to
2969
+ * contract-key derivation.
2970
+ */
2971
+ static fromDescriptor(descriptor) /*throws*/{
2972
+ return FfiConverterTypeContractKeyProvider.lift(uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeContractError.lift.bind(FfiConverterTypeContractError), /*caller:*/callStatus => {
2973
+ return nativeModule().ubrn_uniffi_ddk_ffi_fn_constructor_contractkeyprovider_from_descriptor(FfiConverterString.lower(descriptor, nativeModule().rustbuffer_alloc), callStatus);
2974
+ }, /*liftString:*/FfiConverterString.lift.bind(FfiConverterString)));
2975
+ }
2976
+
2977
+ /**
2978
+ * Builds a provider from a BIP39 mnemonic (with optional passphrase).
2979
+ */
2980
+ static fromMnemonic(mnemonic, passphrase, network) /*throws*/{
2981
+ return FfiConverterTypeContractKeyProvider.lift(uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeContractError.lift.bind(FfiConverterTypeContractError), /*caller:*/callStatus => {
2982
+ return nativeModule().ubrn_uniffi_ddk_ffi_fn_constructor_contractkeyprovider_from_mnemonic(FfiConverterString.lower(mnemonic, nativeModule().rustbuffer_alloc), FfiConverterOptionalString.lower(passphrase, nativeModule().rustbuffer_alloc), FfiConverterString.lower(network, nativeModule().rustbuffer_alloc), callStatus);
2983
+ }, /*liftString:*/FfiConverterString.lift.bind(FfiConverterString)));
2984
+ }
2985
+
2986
+ /**
2987
+ * Builds a provider from a raw seed (for example the 64 bytes produced by
2988
+ * `convert_mnemonic_to_seed`).
2989
+ */
2990
+ static fromSeed(seed, network) /*throws*/{
2991
+ return FfiConverterTypeContractKeyProvider.lift(uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeContractError.lift.bind(FfiConverterTypeContractError), /*caller:*/callStatus => {
2992
+ return nativeModule().ubrn_uniffi_ddk_ffi_fn_constructor_contractkeyprovider_from_seed(FfiConverterArrayBuffer.lower(seed, nativeModule().rustbuffer_alloc), FfiConverterString.lower(network, nativeModule().rustbuffer_alloc), callStatus);
2993
+ }, /*liftString:*/FfiConverterString.lift.bind(FfiConverterString)));
2994
+ }
2995
+
2996
+ /**
2997
+ * Builds a provider from a 78-byte encoded master extended private key
2998
+ * (the encoding produced by `create_extkey_from_seed`).
2999
+ */
3000
+ static fromXprv(xprv) /*throws*/{
3001
+ return FfiConverterTypeContractKeyProvider.lift(uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeContractError.lift.bind(FfiConverterTypeContractError), /*caller:*/callStatus => {
3002
+ return nativeModule().ubrn_uniffi_ddk_ffi_fn_constructor_contractkeyprovider_from_xprv(FfiConverterArrayBuffer.lower(xprv, nativeModule().rustbuffer_alloc), callStatus);
3003
+ }, /*liftString:*/FfiConverterString.lift.bind(FfiConverterString)));
3004
+ }
3005
+
3006
+ /**
3007
+ * The 33-byte compressed funding public key for a contract, from its
3008
+ * 32-byte temporary id. Publish this in the offer or accept message.
3009
+ */
3010
+ fundingPubkey(temporaryContractId) /*throws*/{
3011
+ return (__rb => {
3012
+ try {
3013
+ return FfiConverterArrayBuffer.lift(__rb);
3014
+ } finally {
3015
+ nativeModule().rustbuffer_free(__rb);
3016
+ }
3017
+ })(uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeContractError.lift.bind(FfiConverterTypeContractError), /*caller:*/callStatus => {
3018
+ return nativeModule().ubrn_uniffi_ddk_ffi_fn_method_contractkeyprovider_funding_pubkey(uniffiTypeContractKeyProviderObjectFactory.clonePointer(this), FfiConverterArrayBuffer.lower(temporaryContractId, nativeModule().rustbuffer_alloc), callStatus);
3019
+ }, /*liftString:*/FfiConverterString.lift.bind(FfiConverterString)));
3020
+ }
3021
+ uniffiDestroy() {
3022
+ const ptr = this[destructorGuardSymbol];
3023
+ if (ptr !== undefined) {
3024
+ const pointer = uniffiTypeContractKeyProviderObjectFactory.pointer(this);
3025
+ uniffiTypeContractKeyProviderObjectFactory.freePointer(pointer);
3026
+ uniffiTypeContractKeyProviderObjectFactory.unbless(ptr);
3027
+ delete this[destructorGuardSymbol];
3028
+ }
3029
+ }
3030
+ static instanceOf(obj_) {
3031
+ return uniffiTypeContractKeyProviderObjectFactory.isConcreteType(obj_);
3032
+ }
3033
+ }
3034
+ const uniffiTypeContractKeyProviderObjectFactory = (() => {
3035
+ return {
3036
+ create(pointer) {
3037
+ const instance = Object.create(ContractKeyProvider.prototype);
3038
+ instance[pointerLiteralSymbol] = pointer;
3039
+ instance[destructorGuardSymbol] = this.bless(pointer);
3040
+ instance[uniffiTypeNameSymbol] = 'ContractKeyProvider';
3041
+ return instance;
3042
+ },
3043
+ bless(p) {
3044
+ return uniffiCaller.rustCall(/*caller:*/status => nativeModule().ubrn_uniffi_internal_fn_method_contractkeyprovider_ffi__bless_pointer(p, status), /*liftString:*/FfiConverterString.lift);
3045
+ },
3046
+ unbless(ptr_) {
3047
+ ptr_.markDestroyed();
3048
+ },
3049
+ pointer(obj_) {
3050
+ if (obj_[destructorGuardSymbol] === undefined) {
3051
+ throw new UniffiInternalError.UnexpectedNullPointer();
3052
+ }
3053
+ return obj_[pointerLiteralSymbol];
3054
+ },
3055
+ clonePointer(obj_) {
3056
+ const pointer = this.pointer(obj_);
3057
+ return uniffiCaller.rustCall(/*caller:*/callStatus => nativeModule().ubrn_uniffi_ddk_ffi_fn_clone_contractkeyprovider(pointer, callStatus), /*liftString:*/FfiConverterString.lift);
3058
+ },
3059
+ freePointer(pointer) {
3060
+ uniffiCaller.rustCall(/*caller:*/callStatus => nativeModule().ubrn_uniffi_ddk_ffi_fn_free_contractkeyprovider(pointer, callStatus), /*liftString:*/FfiConverterString.lift);
3061
+ },
3062
+ isConcreteType(obj_) {
3063
+ return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === 'ContractKeyProvider';
3064
+ }
3065
+ };
3066
+ })();
3067
+ const FfiConverterTypeContractKeyProvider = new FfiConverterObject(uniffiTypeContractKeyProviderObjectFactory);
3068
+
1327
3069
  // FfiConverter for Array<ArrayBuffer>
1328
3070
  const FfiConverterSequenceBytes = new FfiConverterArray(FfiConverterArrayBuffer);
1329
3071
 
3072
+ // FfiConverter for bigint | undefined
3073
+ const FfiConverterOptionalUInt64 = new FfiConverterOptional(FfiConverterUInt64);
3074
+
1330
3075
  // FfiConverter for Array<TxInput>
1331
3076
  const FfiConverterSequenceTypeTxInput = new FfiConverterArray(FfiConverterTypeTxInput);
1332
3077
 
@@ -1336,15 +3081,21 @@ const FfiConverterSequenceTypeTxOutput = new FfiConverterArray(FfiConverterTypeT
1336
3081
  // FfiConverter for Array<Transaction>
1337
3082
  const FfiConverterSequenceTypeTransaction = new FfiConverterArray(FfiConverterTypeTransaction);
1338
3083
 
3084
+ // FfiConverter for string | undefined
3085
+ const FfiConverterOptionalString = new FfiConverterOptional(FfiConverterString);
3086
+
3087
+ // FfiConverter for Array<PayoutRow>
3088
+ const FfiConverterSequenceTypePayoutRow = new FfiConverterArray(FfiConverterTypePayoutRow);
3089
+
3090
+ // FfiConverter for ArrayBuffer | undefined
3091
+ const FfiConverterOptionalBytes = new FfiConverterOptional(FfiConverterArrayBuffer);
3092
+
1339
3093
  // FfiConverter for Array<TxInputInfo>
1340
3094
  const FfiConverterSequenceTypeTxInputInfo = new FfiConverterArray(FfiConverterTypeTxInputInfo);
1341
3095
 
1342
3096
  // FfiConverter for Array<DlcInputInfo>
1343
3097
  const FfiConverterSequenceTypeDlcInputInfo = new FfiConverterArray(FfiConverterTypeDlcInputInfo);
1344
3098
 
1345
- // FfiConverter for string | undefined
1346
- const FfiConverterOptionalString = new FfiConverterOptional(FfiConverterString);
1347
-
1348
3099
  // FfiConverter for Array<OracleInfo>
1349
3100
  const FfiConverterSequenceTypeOracleInfo = new FfiConverterArray(FfiConverterTypeOracleInfo);
1350
3101
 
@@ -1360,6 +3111,15 @@ const FfiConverterSequenceTypeAdaptorSignature = new FfiConverterArray(FfiConver
1360
3111
  // FfiConverter for Array<Payout>
1361
3112
  const FfiConverterSequenceTypePayout = new FfiConverterArray(FfiConverterTypePayout);
1362
3113
 
3114
+ // FfiConverter for Array<SpliceKeyRef>
3115
+ const FfiConverterSequenceTypeSpliceKeyRef = new FfiConverterArray(FfiConverterTypeSpliceKeyRef);
3116
+
3117
+ // FfiConverter for Array<OracleAttestationRef>
3118
+ const FfiConverterSequenceTypeOracleAttestationRef = new FfiConverterArray(FfiConverterTypeOracleAttestationRef);
3119
+
3120
+ // FfiConverter for Array<DescriptorInput>
3121
+ const FfiConverterSequenceTypeDescriptorInput = new FfiConverterArray(FfiConverterTypeDescriptorInput);
3122
+
1363
3123
  /**
1364
3124
  * This should be called before anything else.
1365
3125
  *
@@ -1378,6 +3138,18 @@ function uniffiEnsureInitialized() {
1378
3138
  if (bindingsContractVersion !== scaffoldingContractVersion) {
1379
3139
  throw new UniffiInternalError.ContractVersionMismatch(scaffoldingContractVersion, bindingsContractVersion);
1380
3140
  }
3141
+ if (nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_accept_offer() !== 49334) {
3142
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_ddk_ffi_checksum_func_accept_offer');
3143
+ }
3144
+ if (nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_chain_hash_from_network() !== 782) {
3145
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_ddk_ffi_checksum_func_chain_hash_from_network');
3146
+ }
3147
+ if (nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_compute_contract_id() !== 7849) {
3148
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_ddk_ffi_checksum_func_compute_contract_id');
3149
+ }
3150
+ if (nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_contract_info_payouts() !== 5148) {
3151
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_ddk_ffi_checksum_func_contract_info_payouts');
3152
+ }
1381
3153
  if (nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_convert_mnemonic_to_seed() !== 29793) {
1382
3154
  throw new UniffiInternalError.ApiChecksumMismatch('uniffi_ddk_ffi_checksum_func_convert_mnemonic_to_seed');
1383
3155
  }
@@ -1396,6 +3168,9 @@ function uniffiEnsureInitialized() {
1396
3168
  if (nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_create_cets() !== 22051) {
1397
3169
  throw new UniffiInternalError.ApiChecksumMismatch('uniffi_ddk_ffi_checksum_func_create_cets');
1398
3170
  }
3171
+ if (nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_create_dlc_splice_input() !== 50727) {
3172
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_ddk_ffi_checksum_func_create_dlc_splice_input');
3173
+ }
1399
3174
  if (nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_create_dlc_transactions() !== 60266) {
1400
3175
  throw new UniffiInternalError.ApiChecksumMismatch('uniffi_ddk_ffi_checksum_func_create_dlc_transactions');
1401
3176
  }
@@ -1408,6 +3183,12 @@ function uniffiEnsureInitialized() {
1408
3183
  if (nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_create_fund_tx_locking_script() !== 37235) {
1409
3184
  throw new UniffiInternalError.ApiChecksumMismatch('uniffi_ddk_ffi_checksum_func_create_fund_tx_locking_script');
1410
3185
  }
3186
+ if (nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_create_funding_psbt() !== 39942) {
3187
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_ddk_ffi_checksum_func_create_funding_psbt');
3188
+ }
3189
+ if (nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_create_offer() !== 39327) {
3190
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_ddk_ffi_checksum_func_create_offer');
3191
+ }
1411
3192
  if (nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_create_refund_transaction() !== 40230) {
1412
3193
  throw new UniffiInternalError.ApiChecksumMismatch('uniffi_ddk_ffi_checksum_func_create_refund_transaction');
1413
3194
  }
@@ -1417,9 +3198,24 @@ function uniffiEnsureInitialized() {
1417
3198
  if (nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_create_xpriv_from_parent_path() !== 7895) {
1418
3199
  throw new UniffiInternalError.ApiChecksumMismatch('uniffi_ddk_ffi_checksum_func_create_xpriv_from_parent_path');
1419
3200
  }
3201
+ if (nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_dlc_input_max_witness_len() !== 49586) {
3202
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_ddk_ffi_checksum_func_dlc_input_max_witness_len');
3203
+ }
3204
+ if (nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_dlc_transactions_from_messages() !== 56492) {
3205
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_ddk_ffi_checksum_func_dlc_transactions_from_messages');
3206
+ }
1420
3207
  if (nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_extract_ecdsa_signature_from_oracle_signatures() !== 4868) {
1421
3208
  throw new UniffiInternalError.ApiChecksumMismatch('uniffi_ddk_ffi_checksum_func_extract_ecdsa_signature_from_oracle_signatures');
1422
3209
  }
3210
+ if (nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_finalize_sign() !== 20463) {
3211
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_ddk_ffi_checksum_func_finalize_sign');
3212
+ }
3213
+ if (nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_finalize_sign_spliced() !== 32005) {
3214
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_ddk_ffi_checksum_func_finalize_sign_spliced');
3215
+ }
3216
+ if (nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_funding_input() !== 64911) {
3217
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_ddk_ffi_checksum_func_funding_input');
3218
+ }
1423
3219
  if (nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_get_pubkey_from_extkey() !== 18050) {
1424
3220
  throw new UniffiInternalError.ApiChecksumMismatch('uniffi_ddk_ffi_checksum_func_get_pubkey_from_extkey');
1425
3221
  }
@@ -1429,26 +3225,78 @@ function uniffiEnsureInitialized() {
1429
3225
  if (nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_get_xpub_from_xpriv() !== 8843) {
1430
3226
  throw new UniffiInternalError.ApiChecksumMismatch('uniffi_ddk_ffi_checksum_func_get_xpub_from_xpriv');
1431
3227
  }
3228
+ if (nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_sign_accept() !== 37062) {
3229
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_ddk_ffi_checksum_func_sign_accept');
3230
+ }
3231
+ if (nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_sign_accept_spliced() !== 32504) {
3232
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_ddk_ffi_checksum_func_sign_accept_spliced');
3233
+ }
3234
+ if (nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_sign_contract_cet() !== 36727) {
3235
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_ddk_ffi_checksum_func_sign_contract_cet');
3236
+ }
3237
+ if (nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_sign_contract_refund() !== 23156) {
3238
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_ddk_ffi_checksum_func_sign_contract_refund');
3239
+ }
3240
+ if (nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_sign_funding_psbt_with_descriptor() !== 25961) {
3241
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_ddk_ffi_checksum_func_sign_funding_psbt_with_descriptor');
3242
+ }
3243
+ if (nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_validate_accept() !== 9081) {
3244
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_ddk_ffi_checksum_func_validate_accept');
3245
+ }
3246
+ if (nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_validate_offer() !== 24632) {
3247
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_ddk_ffi_checksum_func_validate_offer');
3248
+ }
3249
+ if (nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_validate_sign() !== 7419) {
3250
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_ddk_ffi_checksum_func_validate_sign');
3251
+ }
1432
3252
  if (nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_verify_cet_adaptor_sigs_from_oracle_info() !== 32235) {
1433
3253
  throw new UniffiInternalError.ApiChecksumMismatch('uniffi_ddk_ffi_checksum_func_verify_cet_adaptor_sigs_from_oracle_info');
1434
3254
  }
1435
3255
  if (nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_version() !== 2994) {
1436
3256
  throw new UniffiInternalError.ApiChecksumMismatch('uniffi_ddk_ffi_checksum_func_version');
1437
3257
  }
3258
+ if (nativeModule().ubrn_uniffi_ddk_ffi_checksum_constructor_contractkeyprovider_from_descriptor() !== 47034) {
3259
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_ddk_ffi_checksum_constructor_contractkeyprovider_from_descriptor');
3260
+ }
3261
+ if (nativeModule().ubrn_uniffi_ddk_ffi_checksum_constructor_contractkeyprovider_from_mnemonic() !== 47667) {
3262
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_ddk_ffi_checksum_constructor_contractkeyprovider_from_mnemonic');
3263
+ }
3264
+ if (nativeModule().ubrn_uniffi_ddk_ffi_checksum_constructor_contractkeyprovider_from_seed() !== 47192) {
3265
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_ddk_ffi_checksum_constructor_contractkeyprovider_from_seed');
3266
+ }
3267
+ if (nativeModule().ubrn_uniffi_ddk_ffi_checksum_constructor_contractkeyprovider_from_xprv() !== 7002) {
3268
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_ddk_ffi_checksum_constructor_contractkeyprovider_from_xprv');
3269
+ }
3270
+ if (nativeModule().ubrn_uniffi_ddk_ffi_checksum_method_contractkeyprovider_funding_pubkey() !== 58577) {
3271
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_ddk_ffi_checksum_method_contractkeyprovider_funding_pubkey');
3272
+ }
1438
3273
  }
1439
3274
  export default Object.freeze({
1440
3275
  initialize: uniffiEnsureInitialized,
1441
3276
  converters: {
3277
+ FfiConverterTypeAcceptOfferParams,
3278
+ FfiConverterTypeAcceptResult,
1442
3279
  FfiConverterTypeAdaptorSignature,
1443
3280
  FfiConverterTypeCetAdaptorSignatureDebugInfo,
1444
3281
  FfiConverterTypeChangeOutputAndFees,
3282
+ FfiConverterTypeContractError,
3283
+ FfiConverterTypeContractKeyProvider,
3284
+ FfiConverterTypeContractPartyParams,
3285
+ FfiConverterTypeContractPayouts,
3286
+ FfiConverterTypeCreateOfferParams,
1445
3287
  FfiConverterTypeDLCError,
3288
+ FfiConverterTypeDescriptorInput,
1446
3289
  FfiConverterTypeDlcInputInfo,
1447
3290
  FfiConverterTypeDlcTransactions,
1448
3291
  FfiConverterTypeExtendedKey,
3292
+ FfiConverterTypeOracleAttestationRef,
1449
3293
  FfiConverterTypeOracleInfo,
3294
+ FfiConverterTypeParty,
1450
3295
  FfiConverterTypePartyParams,
1451
3296
  FfiConverterTypePayout,
3297
+ FfiConverterTypePayoutRow,
3298
+ FfiConverterTypeSignResult,
3299
+ FfiConverterTypeSpliceKeyRef,
1452
3300
  FfiConverterTypeTransaction,
1453
3301
  FfiConverterTypeTxInput,
1454
3302
  FfiConverterTypeTxInputInfo,