@bennyblader/ddk-rn 0.2.6 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/ddk_ffi.ts CHANGED
@@ -36,6 +36,7 @@ import {
36
36
  FfiConverterArray,
37
37
  FfiConverterBool,
38
38
  FfiConverterInt32,
39
+ FfiConverterOptional,
39
40
  FfiConverterUInt32,
40
41
  FfiConverterUInt64,
41
42
  FfiConverterUInt8,
@@ -60,6 +61,30 @@ const uniffiIsDebug =
60
61
  true;
61
62
  // Public interface members begin here.
62
63
 
64
+ export function convertMnemonicToSeed(
65
+ mnemonic: string,
66
+ passphrase: string | undefined
67
+ ): Array</*u8*/ number> /*throws*/ {
68
+ return FfiConverterArrayUInt8.lift(
69
+ uniffiCaller.rustCallWithError(
70
+ /*liftError:*/ FfiConverterTypeDLCError.lift.bind(
71
+ FfiConverterTypeDLCError
72
+ ),
73
+ /*caller:*/ (callStatus) => {
74
+ return (() => {
75
+ console.debug(`-- uniffi_ddk_ffi_fn_func_convert_mnemonic_to_seed`);
76
+ return nativeModule()
77
+ .ubrn_uniffi_ddk_ffi_fn_func_convert_mnemonic_to_seed;
78
+ })()(
79
+ FfiConverterString.lower(mnemonic),
80
+ FfiConverterOptionalString.lower(passphrase),
81
+ callStatus
82
+ );
83
+ },
84
+ /*liftString:*/ FfiConverterString.lift
85
+ )
86
+ );
87
+ }
63
88
  export function createCet(
64
89
  localOutput: TxOutput,
65
90
  localPayoutSerialId: /*u64*/ bigint,
@@ -296,6 +321,36 @@ export function createSplicedDlcTransactions(
296
321
  )
297
322
  );
298
323
  }
324
+ export function createXprivFromParentPath(
325
+ xpriv: Array</*u8*/ number>,
326
+ baseDerivationPath: string,
327
+ network: string,
328
+ path: string
329
+ ): Array</*u8*/ number> /*throws*/ {
330
+ return FfiConverterArrayUInt8.lift(
331
+ uniffiCaller.rustCallWithError(
332
+ /*liftError:*/ FfiConverterTypeDLCError.lift.bind(
333
+ FfiConverterTypeDLCError
334
+ ),
335
+ /*caller:*/ (callStatus) => {
336
+ return (() => {
337
+ console.debug(
338
+ `-- uniffi_ddk_ffi_fn_func_create_xpriv_from_parent_path`
339
+ );
340
+ return nativeModule()
341
+ .ubrn_uniffi_ddk_ffi_fn_func_create_xpriv_from_parent_path;
342
+ })()(
343
+ FfiConverterArrayUInt8.lower(xpriv),
344
+ FfiConverterString.lower(baseDerivationPath),
345
+ FfiConverterString.lower(network),
346
+ FfiConverterString.lower(path),
347
+ callStatus
348
+ );
349
+ },
350
+ /*liftString:*/ FfiConverterString.lift
351
+ )
352
+ );
353
+ }
299
354
  export function getChangeOutputAndFees(
300
355
  params: PartyParams,
301
356
  feeRate: /*u64*/ bigint
@@ -366,27 +421,37 @@ export function getTotalInputVsize(inputs: Array<TxInputInfo>): /*u32*/ number {
366
421
  )
367
422
  );
368
423
  }
369
- export function isDustOutput(output: TxOutput): boolean {
370
- return FfiConverterBool.lift(
371
- uniffiCaller.rustCall(
424
+ export function getXpubFromXpriv(
425
+ xpriv: Array</*u8*/ number>,
426
+ network: string
427
+ ): Array</*u8*/ number> /*throws*/ {
428
+ return FfiConverterArrayUInt8.lift(
429
+ uniffiCaller.rustCallWithError(
430
+ /*liftError:*/ FfiConverterTypeDLCError.lift.bind(
431
+ FfiConverterTypeDLCError
432
+ ),
372
433
  /*caller:*/ (callStatus) => {
373
434
  return (() => {
374
- console.debug(`-- uniffi_ddk_ffi_fn_func_is_dust_output`);
375
- return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_is_dust_output;
376
- })()(FfiConverterTypeTxOutput.lower(output), callStatus);
435
+ console.debug(`-- uniffi_ddk_ffi_fn_func_get_xpub_from_xpriv`);
436
+ return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_get_xpub_from_xpriv;
437
+ })()(
438
+ FfiConverterArrayUInt8.lower(xpriv),
439
+ FfiConverterString.lower(network),
440
+ callStatus
441
+ );
377
442
  },
378
443
  /*liftString:*/ FfiConverterString.lift
379
444
  )
380
445
  );
381
446
  }
382
- export function plzWork(): string {
383
- return FfiConverterString.lift(
447
+ export function isDustOutput(output: TxOutput): boolean {
448
+ return FfiConverterBool.lift(
384
449
  uniffiCaller.rustCall(
385
450
  /*caller:*/ (callStatus) => {
386
451
  return (() => {
387
- console.debug(`-- uniffi_ddk_ffi_fn_func_plz_work`);
388
- return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_plz_work;
389
- })()(callStatus);
452
+ console.debug(`-- uniffi_ddk_ffi_fn_func_is_dust_output`);
453
+ return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_is_dust_output;
454
+ })()(FfiConverterTypeTxOutput.lower(output), callStatus);
390
455
  },
391
456
  /*liftString:*/ FfiConverterString.lift
392
457
  )
@@ -1295,7 +1360,8 @@ export enum DlcError_Tags {
1295
1360
  SerializationError = 'SerializationError',
1296
1361
  Secp256k1Error = 'Secp256k1Error',
1297
1362
  MiniscriptError = 'MiniscriptError',
1298
- NetworkError = 'NetworkError',
1363
+ InvalidNetwork = 'InvalidNetwork',
1364
+ KeyError = 'KeyError',
1299
1365
  }
1300
1366
  export const DlcError = (() => {
1301
1367
  class InvalidSignature extends UniffiError {
@@ -1474,7 +1540,7 @@ export const DlcError = (() => {
1474
1540
  return instanceOf(e) && (e as any)[variantOrdinalSymbol] === 8;
1475
1541
  }
1476
1542
  }
1477
- class NetworkError extends UniffiError {
1543
+ class InvalidNetwork extends UniffiError {
1478
1544
  /**
1479
1545
  * @private
1480
1546
  * This field is private and should not be used.
@@ -1486,16 +1552,38 @@ export const DlcError = (() => {
1486
1552
  */
1487
1553
  readonly [variantOrdinalSymbol] = 9;
1488
1554
 
1489
- public readonly tag = DlcError_Tags.NetworkError;
1555
+ public readonly tag = DlcError_Tags.InvalidNetwork;
1490
1556
 
1491
1557
  constructor(message: string) {
1492
- super('DlcError', 'NetworkError', message);
1558
+ super('DlcError', 'InvalidNetwork', message);
1493
1559
  }
1494
1560
 
1495
- static instanceOf(e: any): e is NetworkError {
1561
+ static instanceOf(e: any): e is InvalidNetwork {
1496
1562
  return instanceOf(e) && (e as any)[variantOrdinalSymbol] === 9;
1497
1563
  }
1498
1564
  }
1565
+ class KeyError extends UniffiError {
1566
+ /**
1567
+ * @private
1568
+ * This field is private and should not be used.
1569
+ */
1570
+ readonly [uniffiTypeNameSymbol]: string = 'DlcError';
1571
+ /**
1572
+ * @private
1573
+ * This field is private and should not be used.
1574
+ */
1575
+ readonly [variantOrdinalSymbol] = 10;
1576
+
1577
+ public readonly tag = DlcError_Tags.KeyError;
1578
+
1579
+ constructor(message: string) {
1580
+ super('DlcError', 'KeyError', message);
1581
+ }
1582
+
1583
+ static instanceOf(e: any): e is KeyError {
1584
+ return instanceOf(e) && (e as any)[variantOrdinalSymbol] === 10;
1585
+ }
1586
+ }
1499
1587
 
1500
1588
  // Utility function which does not rely on instanceof.
1501
1589
  function instanceOf(e: any): e is DlcError {
@@ -1510,7 +1598,8 @@ export const DlcError = (() => {
1510
1598
  SerializationError,
1511
1599
  Secp256k1Error,
1512
1600
  MiniscriptError,
1513
- NetworkError,
1601
+ InvalidNetwork,
1602
+ KeyError,
1514
1603
  instanceOf,
1515
1604
  };
1516
1605
  })();
@@ -1552,7 +1641,10 @@ const FfiConverterTypeDLCError = (() => {
1552
1641
  return new DlcError.MiniscriptError(FfiConverterString.read(from));
1553
1642
 
1554
1643
  case 9:
1555
- return new DlcError.NetworkError(FfiConverterString.read(from));
1644
+ return new DlcError.InvalidNetwork(FfiConverterString.read(from));
1645
+
1646
+ case 10:
1647
+ return new DlcError.KeyError(FfiConverterString.read(from));
1556
1648
 
1557
1649
  default:
1558
1650
  throw new UniffiInternalError.UnexpectedEnumCase();
@@ -1570,6 +1662,161 @@ const FfiConverterTypeDLCError = (() => {
1570
1662
  return new FfiConverter();
1571
1663
  })();
1572
1664
 
1665
+ // Flat error type: ExtendedKey
1666
+ export enum ExtendedKey_Tags {
1667
+ InvalidMnemonic = 'InvalidMnemonic',
1668
+ InvalidXpriv = 'InvalidXpriv',
1669
+ InvalidXpub = 'InvalidXpub',
1670
+ InvalidDerivationPath = 'InvalidDerivationPath',
1671
+ }
1672
+ export const ExtendedKey = (() => {
1673
+ class InvalidMnemonic extends UniffiError {
1674
+ /**
1675
+ * @private
1676
+ * This field is private and should not be used.
1677
+ */
1678
+ readonly [uniffiTypeNameSymbol]: string = 'ExtendedKey';
1679
+ /**
1680
+ * @private
1681
+ * This field is private and should not be used.
1682
+ */
1683
+ readonly [variantOrdinalSymbol] = 1;
1684
+
1685
+ public readonly tag = ExtendedKey_Tags.InvalidMnemonic;
1686
+
1687
+ constructor(message: string) {
1688
+ super('ExtendedKey', 'InvalidMnemonic', message);
1689
+ }
1690
+
1691
+ static instanceOf(e: any): e is InvalidMnemonic {
1692
+ return instanceOf(e) && (e as any)[variantOrdinalSymbol] === 1;
1693
+ }
1694
+ }
1695
+ class InvalidXpriv extends UniffiError {
1696
+ /**
1697
+ * @private
1698
+ * This field is private and should not be used.
1699
+ */
1700
+ readonly [uniffiTypeNameSymbol]: string = 'ExtendedKey';
1701
+ /**
1702
+ * @private
1703
+ * This field is private and should not be used.
1704
+ */
1705
+ readonly [variantOrdinalSymbol] = 2;
1706
+
1707
+ public readonly tag = ExtendedKey_Tags.InvalidXpriv;
1708
+
1709
+ constructor(message: string) {
1710
+ super('ExtendedKey', 'InvalidXpriv', message);
1711
+ }
1712
+
1713
+ static instanceOf(e: any): e is InvalidXpriv {
1714
+ return instanceOf(e) && (e as any)[variantOrdinalSymbol] === 2;
1715
+ }
1716
+ }
1717
+ class InvalidXpub extends UniffiError {
1718
+ /**
1719
+ * @private
1720
+ * This field is private and should not be used.
1721
+ */
1722
+ readonly [uniffiTypeNameSymbol]: string = 'ExtendedKey';
1723
+ /**
1724
+ * @private
1725
+ * This field is private and should not be used.
1726
+ */
1727
+ readonly [variantOrdinalSymbol] = 3;
1728
+
1729
+ public readonly tag = ExtendedKey_Tags.InvalidXpub;
1730
+
1731
+ constructor(message: string) {
1732
+ super('ExtendedKey', 'InvalidXpub', message);
1733
+ }
1734
+
1735
+ static instanceOf(e: any): e is InvalidXpub {
1736
+ return instanceOf(e) && (e as any)[variantOrdinalSymbol] === 3;
1737
+ }
1738
+ }
1739
+ class InvalidDerivationPath extends UniffiError {
1740
+ /**
1741
+ * @private
1742
+ * This field is private and should not be used.
1743
+ */
1744
+ readonly [uniffiTypeNameSymbol]: string = 'ExtendedKey';
1745
+ /**
1746
+ * @private
1747
+ * This field is private and should not be used.
1748
+ */
1749
+ readonly [variantOrdinalSymbol] = 4;
1750
+
1751
+ public readonly tag = ExtendedKey_Tags.InvalidDerivationPath;
1752
+
1753
+ constructor(message: string) {
1754
+ super('ExtendedKey', 'InvalidDerivationPath', message);
1755
+ }
1756
+
1757
+ static instanceOf(e: any): e is InvalidDerivationPath {
1758
+ return instanceOf(e) && (e as any)[variantOrdinalSymbol] === 4;
1759
+ }
1760
+ }
1761
+
1762
+ // Utility function which does not rely on instanceof.
1763
+ function instanceOf(e: any): e is ExtendedKey {
1764
+ return (e as any)[uniffiTypeNameSymbol] === 'ExtendedKey';
1765
+ }
1766
+ return {
1767
+ InvalidMnemonic,
1768
+ InvalidXpriv,
1769
+ InvalidXpub,
1770
+ InvalidDerivationPath,
1771
+ instanceOf,
1772
+ };
1773
+ })();
1774
+
1775
+ // Union type for ExtendedKey error type.
1776
+
1777
+ export type ExtendedKey = InstanceType<
1778
+ (typeof ExtendedKey)[keyof Omit<typeof ExtendedKey, 'instanceOf'>]
1779
+ >;
1780
+
1781
+ const FfiConverterTypeExtendedKey = (() => {
1782
+ const intConverter = FfiConverterInt32;
1783
+ type TypeName = ExtendedKey;
1784
+ class FfiConverter extends AbstractFfiConverterByteArray<TypeName> {
1785
+ read(from: RustBuffer): TypeName {
1786
+ switch (intConverter.read(from)) {
1787
+ case 1:
1788
+ return new ExtendedKey.InvalidMnemonic(FfiConverterString.read(from));
1789
+
1790
+ case 2:
1791
+ return new ExtendedKey.InvalidXpriv(FfiConverterString.read(from));
1792
+
1793
+ case 3:
1794
+ return new ExtendedKey.InvalidXpub(FfiConverterString.read(from));
1795
+
1796
+ case 4:
1797
+ return new ExtendedKey.InvalidDerivationPath(
1798
+ FfiConverterString.read(from)
1799
+ );
1800
+
1801
+ default:
1802
+ throw new UniffiInternalError.UnexpectedEnumCase();
1803
+ }
1804
+ }
1805
+ write(value: TypeName, into: RustBuffer): void {
1806
+ const obj = value as any;
1807
+ const index = obj[variantOrdinalSymbol] as number;
1808
+ intConverter.write(index, into);
1809
+ }
1810
+ allocationSize(value: TypeName): number {
1811
+ return intConverter.allocationSize(0);
1812
+ }
1813
+ }
1814
+ return new FfiConverter();
1815
+ })();
1816
+
1817
+ // FfiConverter for string | undefined
1818
+ const FfiConverterOptionalString = new FfiConverterOptional(FfiConverterString);
1819
+
1573
1820
  // FfiConverter for Array<DlcInputInfo>
1574
1821
  const FfiConverterArrayTypeDlcInputInfo = new FfiConverterArray(
1575
1822
  FfiConverterTypeDlcInputInfo
@@ -1630,6 +1877,14 @@ function uniffiEnsureInitialized() {
1630
1877
  bindingsContractVersion
1631
1878
  );
1632
1879
  }
1880
+ if (
1881
+ nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_convert_mnemonic_to_seed() !==
1882
+ 65049
1883
+ ) {
1884
+ throw new UniffiInternalError.ApiChecksumMismatch(
1885
+ 'uniffi_ddk_ffi_checksum_func_convert_mnemonic_to_seed'
1886
+ );
1887
+ }
1633
1888
  if (nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_create_cet() !== 23081) {
1634
1889
  throw new UniffiInternalError.ApiChecksumMismatch(
1635
1890
  'uniffi_ddk_ffi_checksum_func_create_cet'
@@ -1682,6 +1937,14 @@ function uniffiEnsureInitialized() {
1682
1937
  'uniffi_ddk_ffi_checksum_func_create_spliced_dlc_transactions'
1683
1938
  );
1684
1939
  }
1940
+ if (
1941
+ nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_create_xpriv_from_parent_path() !==
1942
+ 50010
1943
+ ) {
1944
+ throw new UniffiInternalError.ApiChecksumMismatch(
1945
+ 'uniffi_ddk_ffi_checksum_func_create_xpriv_from_parent_path'
1946
+ );
1947
+ }
1685
1948
  if (
1686
1949
  nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_get_change_output_and_fees() !==
1687
1950
  44150
@@ -1707,15 +1970,18 @@ function uniffiEnsureInitialized() {
1707
1970
  );
1708
1971
  }
1709
1972
  if (
1710
- nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_is_dust_output() !== 64174
1973
+ nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_get_xpub_from_xpriv() !==
1974
+ 44344
1711
1975
  ) {
1712
1976
  throw new UniffiInternalError.ApiChecksumMismatch(
1713
- 'uniffi_ddk_ffi_checksum_func_is_dust_output'
1977
+ 'uniffi_ddk_ffi_checksum_func_get_xpub_from_xpriv'
1714
1978
  );
1715
1979
  }
1716
- if (nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_plz_work() !== 32972) {
1980
+ if (
1981
+ nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_is_dust_output() !== 64174
1982
+ ) {
1717
1983
  throw new UniffiInternalError.ApiChecksumMismatch(
1718
- 'uniffi_ddk_ffi_checksum_func_plz_work'
1984
+ 'uniffi_ddk_ffi_checksum_func_is_dust_output'
1719
1985
  );
1720
1986
  }
1721
1987
  if (
@@ -1750,6 +2016,7 @@ export default Object.freeze({
1750
2016
  FfiConverterTypeDlcInputInfo,
1751
2017
  FfiConverterTypeDlcOutcome,
1752
2018
  FfiConverterTypeDlcTransactions,
2019
+ FfiConverterTypeExtendedKey,
1753
2020
  FfiConverterTypeOracleInfo,
1754
2021
  FfiConverterTypePartyParams,
1755
2022
  FfiConverterTypePayout,
package/ubrn.config.yaml CHANGED
@@ -15,6 +15,7 @@ ios:
15
15
  targets:
16
16
  - aarch64-apple-ios
17
17
  - aarch64-apple-ios-sim
18
+ - x86_64-apple-ios
18
19
  frameworkName: ios/DdkRn
19
20
 
20
21
  turboModule:
@@ -1,243 +0,0 @@
1
- // Creates a set of DLC transactions (fund, CETs, refund)
2
- [Throws=DLCError]
3
- DlcTransactions create_dlc_transactions(
4
- PartyParams offer_params,
5
- PartyParams accept_params,
6
- sequence<Payout> payouts,
7
- u32 refund_lock_time,
8
- u64 fee_rate_per_vb,
9
- u32 fund_lock_time,
10
- u32 cet_lock_time,
11
- u64 fund_output_serial_id
12
- );
13
-
14
- // Creates a single Contract Execution Transaction
15
- [Throws=DLCError]
16
- Transaction create_cet(
17
- TxOutput local_output,
18
- TxOutput remote_output,
19
- string fund_tx_id,
20
- u32 fund_vout,
21
- u32 lock_time,
22
- u64 local_serial_id,
23
- u64 remote_serial_id
24
- );
25
-
26
- // Creates multiple CETs for different outcomes
27
- [Throws=DLCError]
28
- sequence<Transaction> create_cets(
29
- string fund_tx_id,
30
- u32 fund_vout,
31
- sequence<u8> local_final_script_pubkey,
32
- sequence<u8> remote_final_script_pubkey,
33
- sequence<DlcOutcome> outcomes,
34
- u32 lock_time,
35
- u64 local_serial_id,
36
- u64 remote_serial_id
37
- );
38
-
39
- // Creates the funding transaction locking script (2-of-2 multisig)
40
- [Throws=DLCError]
41
- sequence<u8> create_fund_tx_locking_script(
42
- sequence<u8> local_fund_pubkey,
43
- sequence<u8> remote_fund_pubkey
44
- );
45
-
46
- // Creates a funding transaction
47
- [Throws=DLCError]
48
- Transaction create_fund_transaction(
49
- sequence<u8> local_fund_pubkey,
50
- sequence<u8> remote_fund_pubkey,
51
- u64 output_amount,
52
- sequence<TxInputInfo> local_inputs,
53
- TxOutput local_change_output,
54
- sequence<TxInputInfo> remote_inputs,
55
- TxOutput remote_change_output,
56
- string? option_dest,
57
- u64 option_premium,
58
- u32 lock_time,
59
- u64 local_serial_id,
60
- u64 remote_serial_id,
61
- u64 fund_output_serial_id
62
- );
63
-
64
- // Creates a refund transaction
65
- [Throws=DLCError]
66
- Transaction create_refund_transaction(
67
- sequence<u8> local_final_script_pubkey,
68
- sequence<u8> remote_final_script_pubkey,
69
- u64 local_amount,
70
- u64 remote_amount,
71
- u32 lock_time,
72
- string fund_tx_id,
73
- u32 fund_vout
74
- );
75
-
76
- // Signs a funding transaction input
77
- [Throws=DLCError]
78
- void sign_fund_transaction_input(
79
- Transaction fund_transaction,
80
- sequence<u8> privkey,
81
- string prev_tx_id,
82
- u32 prev_tx_vout,
83
- u64 value
84
- );
85
-
86
- // Adds a signature to a funding transaction
87
- [Throws=DLCError]
88
- void add_signature_to_fund_transaction(
89
- Transaction fund_transaction,
90
- sequence<u8> signature,
91
- sequence<u8> pubkey,
92
- string prev_tx_id,
93
- u32 prev_tx_vout
94
- );
95
-
96
- // Verifies a funding transaction signature
97
- [Throws=DLCError]
98
- boolean verify_fund_tx_signature(
99
- Transaction fund_tx,
100
- sequence<u8> signature,
101
- sequence<u8> pubkey,
102
- string txid,
103
- u32 vout,
104
- u64 input_amount
105
- );
106
-
107
- // Creates a CET adaptor signature
108
- [Throws=DLCError]
109
- AdaptorSignature create_cet_adaptor_signature(
110
- Transaction cet,
111
- sequence<u8> oracle_pubkey,
112
- sequence<sequence<u8>> oracle_r_values,
113
- sequence<u8> funding_privkey,
114
- sequence<u8> funding_script_pubkey,
115
- u64 total_collateral,
116
- sequence<sequence<u8>> messages
117
- );
118
-
119
- // Creates multiple CET adaptor signatures
120
- [Throws=DLCError]
121
- sequence<AdaptorSignature> create_cet_adaptor_signatures(
122
- sequence<Transaction> cets,
123
- sequence<u8> oracle_pubkey,
124
- sequence<sequence<u8>> oracle_r_values,
125
- sequence<u8> funding_privkey,
126
- sequence<u8> funding_script_pubkey,
127
- u64 total_collateral,
128
- sequence<sequence<sequence<u8>>> messages
129
- );
130
-
131
- // Verifies a CET adaptor signature
132
- [Throws=DLCError]
133
- boolean verify_cet_adaptor_signature(
134
- AdaptorSignature adaptor_sig,
135
- Transaction cet,
136
- sequence<u8> pubkey,
137
- sequence<u8> oracle_pubkey,
138
- sequence<sequence<u8>> oracle_r_values,
139
- sequence<u8> funding_script_pubkey,
140
- u64 total_collateral,
141
- sequence<sequence<u8>> messages
142
- );
143
-
144
- // Verifies multiple CET adaptor signatures
145
- [Throws=DLCError]
146
- boolean verify_cet_adaptor_signatures(
147
- sequence<Transaction> cets,
148
- sequence<AdaptorSignature> adaptor_sigs,
149
- sequence<sequence<sequence<u8>>> messages,
150
- sequence<u8> pubkey,
151
- sequence<u8> oracle_pubkey,
152
- sequence<sequence<u8>> oracle_r_values,
153
- sequence<u8> funding_script_pubkey,
154
- u64 total_collateral
155
- );
156
-
157
- // Signs a CET with oracle signatures
158
- [Throws=DLCError]
159
- void sign_cet(
160
- Transaction cet,
161
- AdaptorSignature adaptor_sig,
162
- sequence<sequence<u8>> oracle_signatures,
163
- sequence<u8> funding_privkey,
164
- sequence<u8> funding_script_pubkey,
165
- string fund_tx_id,
166
- u32 fund_vout,
167
- u64 fund_amount
168
- );
169
-
170
- // Gets raw funding transaction input signature
171
- [Throws=DLCError]
172
- sequence<u8> get_raw_funding_transaction_input_signature(
173
- Transaction funding_transaction,
174
- sequence<u8> privkey,
175
- string prev_tx_id,
176
- u32 prev_tx_vout,
177
- u64 value
178
- );
179
-
180
- // Adds signatures for multisig input
181
- [Throws=DLCError]
182
- void add_signatures_for_multisig_input(
183
- Transaction transaction,
184
- string prev_tx_id,
185
- u32 prev_tx_vout,
186
- sequence<u8> multisig_script,
187
- sequence<sequence<u8>> signatures
188
- );
189
-
190
- // Adds signatures to refund transaction
191
- [Throws=DLCError]
192
- void add_signatures_to_refund_tx(
193
- Transaction refund_tx,
194
- sequence<u8> fund_lockscript,
195
- sequence<sequence<u8>> signatures,
196
- string fund_tx_id,
197
- u32 fund_tx_vout
198
- );
199
-
200
- // Gets raw refund transaction signature
201
- [Throws=DLCError]
202
- sequence<u8> get_raw_refund_tx_signature(
203
- Transaction refund_tx,
204
- sequence<u8> privkey,
205
- sequence<u8> fund_lockscript,
206
- u64 input_amount,
207
- string fund_tx_id,
208
- u32 fund_tx_vout
209
- );
210
-
211
- // Verifies refund transaction signature
212
- [Throws=DLCError]
213
- boolean verify_refund_tx_signature(
214
- Transaction refund_tx,
215
- sequence<u8> signature,
216
- sequence<u8> pubkey,
217
- sequence<u8> lock_script,
218
- u64 input_amount,
219
- string fund_txid,
220
- u32 fund_vout
221
- );
222
-
223
- // Utility: Calculate total input virtual size
224
- u32 get_total_input_vsize(sequence<TxInput> inputs);
225
-
226
- // Utility: Check if output is dust
227
- boolean is_dust_output(TxOutput output);
228
-
229
- // Utility: Get change output and fees for a party
230
- [Throws=DLCError]
231
- ChangeOutputAndFees get_change_output_and_fees(
232
- PartyParams params,
233
- u64 fee_rate,
234
- u64? extra_fee
235
- );
236
-
237
- // Compute adaptor point from messages and oracle info
238
- [Throws=DLCError]
239
- sequence<u8> compute_adaptor_point(
240
- sequence<sequence<u8>> messages,
241
- sequence<sequence<u8>> r_values,
242
- sequence<u8> oracle_pubkey
243
- );