@bennyblader/ddk-rn 0.4.0 → 1.0.0-rc2
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/README.md +184 -49
- package/android/src/main/jniLibs/arm64-v8a/libddk_ffi.so +0 -0
- package/android/src/main/jniLibs/armeabi-v7a/libddk_ffi.so +0 -0
- package/android/src/main/jniLibs/x86/libddk_ffi.so +0 -0
- package/android/src/main/jniLibs/x86_64/libddk_ffi.so +0 -0
- package/cpp/ddk_ffi.cpp +1120 -33
- package/cpp/ddk_ffi.hpp +53 -0
- package/ios/DdkRn.xcframework/ios-arm64/libddk_ffi.a +0 -0
- package/ios/DdkRn.xcframework/ios-arm64-simulator/libddk_ffi.a +0 -0
- package/lib/commonjs/ddk_ffi-ffi.js.map +1 -1
- package/lib/commonjs/ddk_ffi.js +2124 -255
- package/lib/commonjs/ddk_ffi.js.map +1 -1
- package/lib/module/ddk_ffi-ffi.js.map +1 -1
- package/lib/module/ddk_ffi.js +2103 -255
- package/lib/module/ddk_ffi.js.map +1 -1
- package/lib/typescript/commonjs/src/ddk_ffi-ffi.d.ts +54 -1
- package/lib/typescript/commonjs/src/ddk_ffi-ffi.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/ddk_ffi.d.ts +2268 -218
- package/lib/typescript/commonjs/src/ddk_ffi.d.ts.map +1 -1
- package/lib/typescript/module/src/ddk_ffi-ffi.d.ts +54 -1
- package/lib/typescript/module/src/ddk_ffi-ffi.d.ts.map +1 -1
- package/lib/typescript/module/src/ddk_ffi.d.ts +2268 -218
- package/lib/typescript/module/src/ddk_ffi.d.ts.map +1 -1
- package/package.json +17 -8
- package/src/ddk_ffi-ffi.ts +190 -0
- package/src/ddk_ffi.ts +3553 -576
package/src/ddk_ffi.ts
CHANGED
|
@@ -10,21 +10,30 @@ import {
|
|
|
10
10
|
type UniffiForeignFutureDroppedCallbackStruct,
|
|
11
11
|
} from './ddk_ffi-ffi';
|
|
12
12
|
import {
|
|
13
|
+
type FfiConverter,
|
|
13
14
|
type UniffiByteArray,
|
|
15
|
+
type UniffiGcObject,
|
|
16
|
+
type UniffiHandle,
|
|
17
|
+
type UniffiObjectFactory,
|
|
14
18
|
AbstractFfiConverterByteArray,
|
|
15
19
|
FfiConverterArray,
|
|
16
|
-
FfiConverterArrayBuffer,
|
|
17
20
|
FfiConverterBool,
|
|
18
21
|
FfiConverterInt32,
|
|
22
|
+
FfiConverterObject,
|
|
19
23
|
FfiConverterOptional,
|
|
24
|
+
FfiConverterUInt16,
|
|
20
25
|
FfiConverterUInt32,
|
|
21
26
|
FfiConverterUInt64,
|
|
22
27
|
FfiConverterUInt8,
|
|
28
|
+
FfiConverterUint8Array,
|
|
23
29
|
RustBuffer,
|
|
30
|
+
UniffiAbstractObject,
|
|
24
31
|
UniffiEnum,
|
|
25
32
|
UniffiError,
|
|
26
33
|
UniffiInternalError,
|
|
27
34
|
UniffiRustCaller,
|
|
35
|
+
destructorGuardSymbol,
|
|
36
|
+
pointerLiteralSymbol,
|
|
28
37
|
uniffiCreateFfiConverterString,
|
|
29
38
|
uniffiCreateRecord,
|
|
30
39
|
uniffiTypeNameSymbol,
|
|
@@ -41,13 +50,153 @@ const uniffiIsDebug =
|
|
|
41
50
|
|
|
42
51
|
// Public interface members begin here.
|
|
43
52
|
|
|
53
|
+
/**
|
|
54
|
+
* Accepts an offer. The accepting party's funding secret key is derived inside
|
|
55
|
+
* Rust from `keys` + `new_temporary_contract_id` and never crosses the boundary;
|
|
56
|
+
* it must match `params.party.funding_pubkey` (derive both from the same provider).
|
|
57
|
+
*/
|
|
58
|
+
export function acceptOffer(
|
|
59
|
+
offer: Uint8Array,
|
|
60
|
+
params: AcceptOfferParams,
|
|
61
|
+
keys: ContractKeyProviderLike,
|
|
62
|
+
newTemporaryContractId: Uint8Array
|
|
63
|
+
): AcceptResult /*throws*/ {
|
|
64
|
+
return ((__rb: Uint8Array) => {
|
|
65
|
+
try {
|
|
66
|
+
return FfiConverterTypeAcceptResult.lift(__rb);
|
|
67
|
+
} finally {
|
|
68
|
+
nativeModule().rustbuffer_free(__rb);
|
|
69
|
+
}
|
|
70
|
+
})(
|
|
71
|
+
uniffiCaller.rustCallWithError(
|
|
72
|
+
/*liftError:*/ FfiConverterTypeContractError.lift.bind(
|
|
73
|
+
FfiConverterTypeContractError
|
|
74
|
+
),
|
|
75
|
+
/*caller:*/ (callStatus) => {
|
|
76
|
+
return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_accept_offer(
|
|
77
|
+
FfiConverterUint8Array.lower(offer, nativeModule().rustbuffer_alloc),
|
|
78
|
+
FfiConverterTypeAcceptOfferParams.lower(
|
|
79
|
+
params,
|
|
80
|
+
nativeModule().rustbuffer_alloc
|
|
81
|
+
),
|
|
82
|
+
FfiConverterTypeContractKeyProvider.lower(
|
|
83
|
+
keys,
|
|
84
|
+
nativeModule().rustbuffer_alloc
|
|
85
|
+
),
|
|
86
|
+
FfiConverterUint8Array.lower(
|
|
87
|
+
newTemporaryContractId,
|
|
88
|
+
nativeModule().rustbuffer_alloc
|
|
89
|
+
),
|
|
90
|
+
callStatus
|
|
91
|
+
);
|
|
92
|
+
},
|
|
93
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)
|
|
94
|
+
)
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* The 32-byte chain hash for a network (`bitcoin` / `testnet` / `signet` /
|
|
100
|
+
* `regtest`). Use it for [`CreateOfferParams::chain_hash`].
|
|
101
|
+
*/
|
|
102
|
+
export function chainHashFromNetwork(network: string): Uint8Array /*throws*/ {
|
|
103
|
+
return ((__rb: Uint8Array) => {
|
|
104
|
+
try {
|
|
105
|
+
return FfiConverterUint8Array.lift(__rb);
|
|
106
|
+
} finally {
|
|
107
|
+
nativeModule().rustbuffer_free(__rb);
|
|
108
|
+
}
|
|
109
|
+
})(
|
|
110
|
+
uniffiCaller.rustCallWithError(
|
|
111
|
+
/*liftError:*/ FfiConverterTypeContractError.lift.bind(
|
|
112
|
+
FfiConverterTypeContractError
|
|
113
|
+
),
|
|
114
|
+
/*caller:*/ (callStatus) => {
|
|
115
|
+
return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_chain_hash_from_network(
|
|
116
|
+
FfiConverterString.lower(network, nativeModule().rustbuffer_alloc),
|
|
117
|
+
callStatus
|
|
118
|
+
);
|
|
119
|
+
},
|
|
120
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)
|
|
121
|
+
)
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* The 32-byte contract id derived from the offer and accept messages — the
|
|
127
|
+
* stable id of the funded contract. Use it to key stored contracts.
|
|
128
|
+
*/
|
|
129
|
+
export function computeContractId(
|
|
130
|
+
offer: Uint8Array,
|
|
131
|
+
accept: Uint8Array
|
|
132
|
+
): Uint8Array /*throws*/ {
|
|
133
|
+
return ((__rb: Uint8Array) => {
|
|
134
|
+
try {
|
|
135
|
+
return FfiConverterUint8Array.lift(__rb);
|
|
136
|
+
} finally {
|
|
137
|
+
nativeModule().rustbuffer_free(__rb);
|
|
138
|
+
}
|
|
139
|
+
})(
|
|
140
|
+
uniffiCaller.rustCallWithError(
|
|
141
|
+
/*liftError:*/ FfiConverterTypeContractError.lift.bind(
|
|
142
|
+
FfiConverterTypeContractError
|
|
143
|
+
),
|
|
144
|
+
/*caller:*/ (callStatus) => {
|
|
145
|
+
return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_compute_contract_id(
|
|
146
|
+
FfiConverterUint8Array.lower(offer, nativeModule().rustbuffer_alloc),
|
|
147
|
+
FfiConverterUint8Array.lower(accept, nativeModule().rustbuffer_alloc),
|
|
148
|
+
callStatus
|
|
149
|
+
);
|
|
150
|
+
},
|
|
151
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)
|
|
152
|
+
)
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Derives the offer/accept payouts for every outcome of a contract from its
|
|
158
|
+
* wire-encoded `ContractInfo`, for building a payout table to show users.
|
|
159
|
+
*
|
|
160
|
+
* Handles both enum contracts (each row a labeled outcome) and numeric-outcome
|
|
161
|
+
* contracts (each row an inclusive outcome range that shares a single payout,
|
|
162
|
+
* as determined by the payout function and rounding intervals). Disjoint
|
|
163
|
+
* contracts contribute the rows of each of their sub-contracts.
|
|
164
|
+
*/
|
|
165
|
+
export function contractInfoPayouts(
|
|
166
|
+
contractInfo: Uint8Array
|
|
167
|
+
): ContractPayouts /*throws*/ {
|
|
168
|
+
return ((__rb: Uint8Array) => {
|
|
169
|
+
try {
|
|
170
|
+
return FfiConverterTypeContractPayouts.lift(__rb);
|
|
171
|
+
} finally {
|
|
172
|
+
nativeModule().rustbuffer_free(__rb);
|
|
173
|
+
}
|
|
174
|
+
})(
|
|
175
|
+
uniffiCaller.rustCallWithError(
|
|
176
|
+
/*liftError:*/ FfiConverterTypeContractError.lift.bind(
|
|
177
|
+
FfiConverterTypeContractError
|
|
178
|
+
),
|
|
179
|
+
/*caller:*/ (callStatus) => {
|
|
180
|
+
return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_contract_info_payouts(
|
|
181
|
+
FfiConverterUint8Array.lower(
|
|
182
|
+
contractInfo,
|
|
183
|
+
nativeModule().rustbuffer_alloc
|
|
184
|
+
),
|
|
185
|
+
callStatus
|
|
186
|
+
);
|
|
187
|
+
},
|
|
188
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)
|
|
189
|
+
)
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
|
|
44
193
|
export function convertMnemonicToSeed(
|
|
45
194
|
mnemonic: string,
|
|
46
195
|
passphrase: string | undefined
|
|
47
|
-
):
|
|
196
|
+
): Uint8Array /*throws*/ {
|
|
48
197
|
return ((__rb: Uint8Array) => {
|
|
49
198
|
try {
|
|
50
|
-
return
|
|
199
|
+
return FfiConverterUint8Array.lift(__rb);
|
|
51
200
|
} finally {
|
|
52
201
|
nativeModule().rustbuffer_free(__rb);
|
|
53
202
|
}
|
|
@@ -125,8 +274,8 @@ export function createCet(
|
|
|
125
274
|
|
|
126
275
|
export function createCetAdaptorPointsFromOracleInfo(
|
|
127
276
|
oracleInfo: Array<OracleInfo>,
|
|
128
|
-
msgs: Array<Array<Array<
|
|
129
|
-
): Array<
|
|
277
|
+
msgs: Array<Array<Array<Uint8Array>>>
|
|
278
|
+
): Array<Uint8Array> /*throws*/ {
|
|
130
279
|
return ((__rb: Uint8Array) => {
|
|
131
280
|
try {
|
|
132
281
|
return FfiConverterSequenceBytes.lift(__rb);
|
|
@@ -159,10 +308,10 @@ export function createCetAdaptorPointsFromOracleInfo(
|
|
|
159
308
|
export function createCetAdaptorSigsFromOracleInfo(
|
|
160
309
|
cets: Array<Transaction>,
|
|
161
310
|
oracleInfo: Array<OracleInfo>,
|
|
162
|
-
fundingSecretKey:
|
|
163
|
-
fundingScriptPubkey:
|
|
311
|
+
fundingSecretKey: Uint8Array,
|
|
312
|
+
fundingScriptPubkey: Uint8Array,
|
|
164
313
|
fundOutputValue: bigint,
|
|
165
|
-
msgs: Array<Array<Array<
|
|
314
|
+
msgs: Array<Array<Array<Uint8Array>>>
|
|
166
315
|
): Array<AdaptorSignature> /*throws*/ {
|
|
167
316
|
return ((__rb: Uint8Array) => {
|
|
168
317
|
try {
|
|
@@ -185,11 +334,11 @@ export function createCetAdaptorSigsFromOracleInfo(
|
|
|
185
334
|
oracleInfo,
|
|
186
335
|
nativeModule().rustbuffer_alloc
|
|
187
336
|
),
|
|
188
|
-
|
|
337
|
+
FfiConverterUint8Array.lower(
|
|
189
338
|
fundingSecretKey,
|
|
190
339
|
nativeModule().rustbuffer_alloc
|
|
191
340
|
),
|
|
192
|
-
|
|
341
|
+
FfiConverterUint8Array.lower(
|
|
193
342
|
fundingScriptPubkey,
|
|
194
343
|
nativeModule().rustbuffer_alloc
|
|
195
344
|
),
|
|
@@ -214,9 +363,9 @@ export function createCetAdaptorSigsFromOracleInfo(
|
|
|
214
363
|
*/
|
|
215
364
|
export function createCetAdaptorSigsFromPoints(
|
|
216
365
|
cets: Array<Transaction>,
|
|
217
|
-
adaptorPoints: Array<
|
|
218
|
-
fundingSecretKey:
|
|
219
|
-
fundingScriptPubkey:
|
|
366
|
+
adaptorPoints: Array<Uint8Array>,
|
|
367
|
+
fundingSecretKey: Uint8Array,
|
|
368
|
+
fundingScriptPubkey: Uint8Array,
|
|
220
369
|
fundOutputValue: bigint
|
|
221
370
|
): Array<AdaptorSignature> /*throws*/ {
|
|
222
371
|
return ((__rb: Uint8Array) => {
|
|
@@ -240,11 +389,11 @@ export function createCetAdaptorSigsFromPoints(
|
|
|
240
389
|
adaptorPoints,
|
|
241
390
|
nativeModule().rustbuffer_alloc
|
|
242
391
|
),
|
|
243
|
-
|
|
392
|
+
FfiConverterUint8Array.lower(
|
|
244
393
|
fundingSecretKey,
|
|
245
394
|
nativeModule().rustbuffer_alloc
|
|
246
395
|
),
|
|
247
|
-
|
|
396
|
+
FfiConverterUint8Array.lower(
|
|
248
397
|
fundingScriptPubkey,
|
|
249
398
|
nativeModule().rustbuffer_alloc
|
|
250
399
|
),
|
|
@@ -266,8 +415,8 @@ export function createCetAdaptorSigsFromPoints(
|
|
|
266
415
|
export function createCets(
|
|
267
416
|
fundTxId: string,
|
|
268
417
|
fundVout: number,
|
|
269
|
-
localFinalScriptPubkey:
|
|
270
|
-
remoteFinalScriptPubkey:
|
|
418
|
+
localFinalScriptPubkey: Uint8Array,
|
|
419
|
+
remoteFinalScriptPubkey: Uint8Array,
|
|
271
420
|
outcomes: Array<Payout>,
|
|
272
421
|
lockTime: number,
|
|
273
422
|
localSerialId: bigint,
|
|
@@ -288,11 +437,11 @@ export function createCets(
|
|
|
288
437
|
return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_create_cets(
|
|
289
438
|
FfiConverterString.lower(fundTxId, nativeModule().rustbuffer_alloc),
|
|
290
439
|
FfiConverterUInt32.lower(fundVout, nativeModule().rustbuffer_alloc),
|
|
291
|
-
|
|
440
|
+
FfiConverterUint8Array.lower(
|
|
292
441
|
localFinalScriptPubkey,
|
|
293
442
|
nativeModule().rustbuffer_alloc
|
|
294
443
|
),
|
|
295
|
-
|
|
444
|
+
FfiConverterUint8Array.lower(
|
|
296
445
|
remoteFinalScriptPubkey,
|
|
297
446
|
nativeModule().rustbuffer_alloc
|
|
298
447
|
),
|
|
@@ -317,6 +466,61 @@ export function createCets(
|
|
|
317
466
|
);
|
|
318
467
|
}
|
|
319
468
|
|
|
469
|
+
/**
|
|
470
|
+
* Rebuilds the splice `FundingInput` (wire-encoded) that spends a previous
|
|
471
|
+
* contract's 2-of-2 funding output, from that contract's offer and accept
|
|
472
|
+
* messages. Only the offering party contributes a splice input; place the
|
|
473
|
+
* result in the offering party's `funding_inputs`. `max_witness_len` must be
|
|
474
|
+
* greater than 108 — use [`dlc_input_max_witness_len`].
|
|
475
|
+
*/
|
|
476
|
+
export function createDlcSpliceInput(
|
|
477
|
+
prevOffer: Uint8Array,
|
|
478
|
+
prevAccept: Uint8Array,
|
|
479
|
+
localParty: Party,
|
|
480
|
+
inputSerialId: bigint | undefined,
|
|
481
|
+
maxWitnessLen: number
|
|
482
|
+
): Uint8Array /*throws*/ {
|
|
483
|
+
return ((__rb: Uint8Array) => {
|
|
484
|
+
try {
|
|
485
|
+
return FfiConverterUint8Array.lift(__rb);
|
|
486
|
+
} finally {
|
|
487
|
+
nativeModule().rustbuffer_free(__rb);
|
|
488
|
+
}
|
|
489
|
+
})(
|
|
490
|
+
uniffiCaller.rustCallWithError(
|
|
491
|
+
/*liftError:*/ FfiConverterTypeContractError.lift.bind(
|
|
492
|
+
FfiConverterTypeContractError
|
|
493
|
+
),
|
|
494
|
+
/*caller:*/ (callStatus) => {
|
|
495
|
+
return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_create_dlc_splice_input(
|
|
496
|
+
FfiConverterUint8Array.lower(
|
|
497
|
+
prevOffer,
|
|
498
|
+
nativeModule().rustbuffer_alloc
|
|
499
|
+
),
|
|
500
|
+
FfiConverterUint8Array.lower(
|
|
501
|
+
prevAccept,
|
|
502
|
+
nativeModule().rustbuffer_alloc
|
|
503
|
+
),
|
|
504
|
+
FfiConverterTypeParty.lower(
|
|
505
|
+
localParty,
|
|
506
|
+
nativeModule().rustbuffer_alloc
|
|
507
|
+
),
|
|
508
|
+
FfiConverterOptionalUInt64.lower(
|
|
509
|
+
inputSerialId,
|
|
510
|
+
nativeModule().rustbuffer_alloc
|
|
511
|
+
),
|
|
512
|
+
FfiConverterUInt16.lower(
|
|
513
|
+
maxWitnessLen,
|
|
514
|
+
nativeModule().rustbuffer_alloc
|
|
515
|
+
),
|
|
516
|
+
callStatus
|
|
517
|
+
);
|
|
518
|
+
},
|
|
519
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)
|
|
520
|
+
)
|
|
521
|
+
);
|
|
522
|
+
}
|
|
523
|
+
|
|
320
524
|
/**
|
|
321
525
|
* Create complete DLC transactions
|
|
322
526
|
*/
|
|
@@ -390,12 +594,12 @@ export function createDlcTransactions(
|
|
|
390
594
|
* Input: 78-byte encoded xpriv, Output: 78-byte encoded xpriv
|
|
391
595
|
*/
|
|
392
596
|
export function createExtkeyFromParentPath(
|
|
393
|
-
extkey:
|
|
597
|
+
extkey: Uint8Array,
|
|
394
598
|
path: string
|
|
395
|
-
):
|
|
599
|
+
): Uint8Array /*throws*/ {
|
|
396
600
|
return ((__rb: Uint8Array) => {
|
|
397
601
|
try {
|
|
398
|
-
return
|
|
602
|
+
return FfiConverterUint8Array.lift(__rb);
|
|
399
603
|
} finally {
|
|
400
604
|
nativeModule().rustbuffer_free(__rb);
|
|
401
605
|
}
|
|
@@ -406,10 +610,7 @@ export function createExtkeyFromParentPath(
|
|
|
406
610
|
),
|
|
407
611
|
/*caller:*/ (callStatus) => {
|
|
408
612
|
return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_create_extkey_from_parent_path(
|
|
409
|
-
|
|
410
|
-
extkey,
|
|
411
|
-
nativeModule().rustbuffer_alloc
|
|
412
|
-
),
|
|
613
|
+
FfiConverterUint8Array.lower(extkey, nativeModule().rustbuffer_alloc),
|
|
413
614
|
FfiConverterString.lower(path, nativeModule().rustbuffer_alloc),
|
|
414
615
|
callStatus
|
|
415
616
|
);
|
|
@@ -424,12 +625,12 @@ export function createExtkeyFromParentPath(
|
|
|
424
625
|
* Returns 78-byte encoded xpriv
|
|
425
626
|
*/
|
|
426
627
|
export function createExtkeyFromSeed(
|
|
427
|
-
seed:
|
|
628
|
+
seed: Uint8Array,
|
|
428
629
|
network: string
|
|
429
|
-
):
|
|
630
|
+
): Uint8Array /*throws*/ {
|
|
430
631
|
return ((__rb: Uint8Array) => {
|
|
431
632
|
try {
|
|
432
|
-
return
|
|
633
|
+
return FfiConverterUint8Array.lift(__rb);
|
|
433
634
|
} finally {
|
|
434
635
|
nativeModule().rustbuffer_free(__rb);
|
|
435
636
|
}
|
|
@@ -440,7 +641,7 @@ export function createExtkeyFromSeed(
|
|
|
440
641
|
),
|
|
441
642
|
/*caller:*/ (callStatus) => {
|
|
442
643
|
return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_create_extkey_from_seed(
|
|
443
|
-
|
|
644
|
+
FfiConverterUint8Array.lower(seed, nativeModule().rustbuffer_alloc),
|
|
444
645
|
FfiConverterString.lower(network, nativeModule().rustbuffer_alloc),
|
|
445
646
|
callStatus
|
|
446
647
|
);
|
|
@@ -454,12 +655,12 @@ export function createExtkeyFromSeed(
|
|
|
454
655
|
* Create a funding script pubkey for DLC transactions
|
|
455
656
|
*/
|
|
456
657
|
export function createFundTxLockingScript(
|
|
457
|
-
localFundPubkey:
|
|
458
|
-
remoteFundPubkey:
|
|
459
|
-
):
|
|
658
|
+
localFundPubkey: Uint8Array,
|
|
659
|
+
remoteFundPubkey: Uint8Array
|
|
660
|
+
): Uint8Array /*throws*/ {
|
|
460
661
|
return ((__rb: Uint8Array) => {
|
|
461
662
|
try {
|
|
462
|
-
return
|
|
663
|
+
return FfiConverterUint8Array.lift(__rb);
|
|
463
664
|
} finally {
|
|
464
665
|
nativeModule().rustbuffer_free(__rb);
|
|
465
666
|
}
|
|
@@ -470,11 +671,11 @@ export function createFundTxLockingScript(
|
|
|
470
671
|
),
|
|
471
672
|
/*caller:*/ (callStatus) => {
|
|
472
673
|
return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_create_fund_tx_locking_script(
|
|
473
|
-
|
|
674
|
+
FfiConverterUint8Array.lower(
|
|
474
675
|
localFundPubkey,
|
|
475
676
|
nativeModule().rustbuffer_alloc
|
|
476
677
|
),
|
|
477
|
-
|
|
678
|
+
FfiConverterUint8Array.lower(
|
|
478
679
|
remoteFundPubkey,
|
|
479
680
|
nativeModule().rustbuffer_alloc
|
|
480
681
|
),
|
|
@@ -486,12 +687,71 @@ export function createFundTxLockingScript(
|
|
|
486
687
|
);
|
|
487
688
|
}
|
|
488
689
|
|
|
690
|
+
/**
|
|
691
|
+
* Rebuilds the BIP-174 funding PSBT from the offer and accept messages.
|
|
692
|
+
*/
|
|
693
|
+
export function createFundingPsbt(
|
|
694
|
+
offer: Uint8Array,
|
|
695
|
+
accept: Uint8Array
|
|
696
|
+
): Uint8Array /*throws*/ {
|
|
697
|
+
return ((__rb: Uint8Array) => {
|
|
698
|
+
try {
|
|
699
|
+
return FfiConverterUint8Array.lift(__rb);
|
|
700
|
+
} finally {
|
|
701
|
+
nativeModule().rustbuffer_free(__rb);
|
|
702
|
+
}
|
|
703
|
+
})(
|
|
704
|
+
uniffiCaller.rustCallWithError(
|
|
705
|
+
/*liftError:*/ FfiConverterTypeContractError.lift.bind(
|
|
706
|
+
FfiConverterTypeContractError
|
|
707
|
+
),
|
|
708
|
+
/*caller:*/ (callStatus) => {
|
|
709
|
+
return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_create_funding_psbt(
|
|
710
|
+
FfiConverterUint8Array.lower(offer, nativeModule().rustbuffer_alloc),
|
|
711
|
+
FfiConverterUint8Array.lower(accept, nativeModule().rustbuffer_alloc),
|
|
712
|
+
callStatus
|
|
713
|
+
);
|
|
714
|
+
},
|
|
715
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)
|
|
716
|
+
)
|
|
717
|
+
);
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
/**
|
|
721
|
+
* Creates an offer. Returns the wire-encoded `OfferDlc` to send to the accepting party.
|
|
722
|
+
*/
|
|
723
|
+
export function createOffer(params: CreateOfferParams): Uint8Array /*throws*/ {
|
|
724
|
+
return ((__rb: Uint8Array) => {
|
|
725
|
+
try {
|
|
726
|
+
return FfiConverterUint8Array.lift(__rb);
|
|
727
|
+
} finally {
|
|
728
|
+
nativeModule().rustbuffer_free(__rb);
|
|
729
|
+
}
|
|
730
|
+
})(
|
|
731
|
+
uniffiCaller.rustCallWithError(
|
|
732
|
+
/*liftError:*/ FfiConverterTypeContractError.lift.bind(
|
|
733
|
+
FfiConverterTypeContractError
|
|
734
|
+
),
|
|
735
|
+
/*caller:*/ (callStatus) => {
|
|
736
|
+
return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_create_offer(
|
|
737
|
+
FfiConverterTypeCreateOfferParams.lower(
|
|
738
|
+
params,
|
|
739
|
+
nativeModule().rustbuffer_alloc
|
|
740
|
+
),
|
|
741
|
+
callStatus
|
|
742
|
+
);
|
|
743
|
+
},
|
|
744
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)
|
|
745
|
+
)
|
|
746
|
+
);
|
|
747
|
+
}
|
|
748
|
+
|
|
489
749
|
/**
|
|
490
750
|
* Create a refund transaction
|
|
491
751
|
*/
|
|
492
752
|
export function createRefundTransaction(
|
|
493
|
-
localFinalScriptPubkey:
|
|
494
|
-
remoteFinalScriptPubkey:
|
|
753
|
+
localFinalScriptPubkey: Uint8Array,
|
|
754
|
+
remoteFinalScriptPubkey: Uint8Array,
|
|
495
755
|
localAmount: bigint,
|
|
496
756
|
remoteAmount: bigint,
|
|
497
757
|
lockTime: number,
|
|
@@ -511,11 +771,11 @@ export function createRefundTransaction(
|
|
|
511
771
|
),
|
|
512
772
|
/*caller:*/ (callStatus) => {
|
|
513
773
|
return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_create_refund_transaction(
|
|
514
|
-
|
|
774
|
+
FfiConverterUint8Array.lower(
|
|
515
775
|
localFinalScriptPubkey,
|
|
516
776
|
nativeModule().rustbuffer_alloc
|
|
517
777
|
),
|
|
518
|
-
|
|
778
|
+
FfiConverterUint8Array.lower(
|
|
519
779
|
remoteFinalScriptPubkey,
|
|
520
780
|
nativeModule().rustbuffer_alloc
|
|
521
781
|
),
|
|
@@ -611,14 +871,14 @@ export function createSplicedDlcTransactions(
|
|
|
611
871
|
* This function handles both seeds (64 bytes) and xprivs (78 bytes) which is confusing
|
|
612
872
|
*/
|
|
613
873
|
export function createXprivFromParentPath(
|
|
614
|
-
seedOrXpriv:
|
|
874
|
+
seedOrXpriv: Uint8Array,
|
|
615
875
|
baseDerivationPath: string,
|
|
616
876
|
network: string,
|
|
617
877
|
path: string
|
|
618
|
-
):
|
|
878
|
+
): Uint8Array /*throws*/ {
|
|
619
879
|
return ((__rb: Uint8Array) => {
|
|
620
880
|
try {
|
|
621
|
-
return
|
|
881
|
+
return FfiConverterUint8Array.lift(__rb);
|
|
622
882
|
} finally {
|
|
623
883
|
nativeModule().rustbuffer_free(__rb);
|
|
624
884
|
}
|
|
@@ -629,7 +889,7 @@ export function createXprivFromParentPath(
|
|
|
629
889
|
),
|
|
630
890
|
/*caller:*/ (callStatus) => {
|
|
631
891
|
return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_create_xpriv_from_parent_path(
|
|
632
|
-
|
|
892
|
+
FfiConverterUint8Array.lower(
|
|
633
893
|
seedOrXpriv,
|
|
634
894
|
nativeModule().rustbuffer_alloc
|
|
635
895
|
),
|
|
@@ -647,13 +907,59 @@ export function createXprivFromParentPath(
|
|
|
647
907
|
);
|
|
648
908
|
}
|
|
649
909
|
|
|
910
|
+
/**
|
|
911
|
+
* The required `max_witness_len` for a DLC (splice) funding input (220).
|
|
912
|
+
*/
|
|
913
|
+
export function dlcInputMaxWitnessLen(): number {
|
|
914
|
+
return FfiConverterUInt16.lift(
|
|
915
|
+
uniffiCaller.rustCall(
|
|
916
|
+
/*caller:*/ (callStatus) => {
|
|
917
|
+
return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_dlc_input_max_witness_len(
|
|
918
|
+
callStatus
|
|
919
|
+
);
|
|
920
|
+
},
|
|
921
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)
|
|
922
|
+
)
|
|
923
|
+
);
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
/**
|
|
927
|
+
* Rebuilds the unsigned funding, CET, and refund transactions from the messages.
|
|
928
|
+
*/
|
|
929
|
+
export function dlcTransactionsFromMessages(
|
|
930
|
+
offer: Uint8Array,
|
|
931
|
+
accept: Uint8Array
|
|
932
|
+
): DlcTransactions /*throws*/ {
|
|
933
|
+
return ((__rb: Uint8Array) => {
|
|
934
|
+
try {
|
|
935
|
+
return FfiConverterTypeDlcTransactions.lift(__rb);
|
|
936
|
+
} finally {
|
|
937
|
+
nativeModule().rustbuffer_free(__rb);
|
|
938
|
+
}
|
|
939
|
+
})(
|
|
940
|
+
uniffiCaller.rustCallWithError(
|
|
941
|
+
/*liftError:*/ FfiConverterTypeContractError.lift.bind(
|
|
942
|
+
FfiConverterTypeContractError
|
|
943
|
+
),
|
|
944
|
+
/*caller:*/ (callStatus) => {
|
|
945
|
+
return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_dlc_transactions_from_messages(
|
|
946
|
+
FfiConverterUint8Array.lower(offer, nativeModule().rustbuffer_alloc),
|
|
947
|
+
FfiConverterUint8Array.lower(accept, nativeModule().rustbuffer_alloc),
|
|
948
|
+
callStatus
|
|
949
|
+
);
|
|
950
|
+
},
|
|
951
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)
|
|
952
|
+
)
|
|
953
|
+
);
|
|
954
|
+
}
|
|
955
|
+
|
|
650
956
|
export function extractEcdsaSignatureFromOracleSignatures(
|
|
651
|
-
oracleSignatures: Array<
|
|
652
|
-
adaptorSignature:
|
|
653
|
-
):
|
|
957
|
+
oracleSignatures: Array<Uint8Array>,
|
|
958
|
+
adaptorSignature: Uint8Array
|
|
959
|
+
): Uint8Array /*throws*/ {
|
|
654
960
|
return ((__rb: Uint8Array) => {
|
|
655
961
|
try {
|
|
656
|
-
return
|
|
962
|
+
return FfiConverterUint8Array.lift(__rb);
|
|
657
963
|
} finally {
|
|
658
964
|
nativeModule().rustbuffer_free(__rb);
|
|
659
965
|
}
|
|
@@ -668,7 +974,7 @@ export function extractEcdsaSignatureFromOracleSignatures(
|
|
|
668
974
|
oracleSignatures,
|
|
669
975
|
nativeModule().rustbuffer_alloc
|
|
670
976
|
),
|
|
671
|
-
|
|
977
|
+
FfiConverterUint8Array.lower(
|
|
672
978
|
adaptorSignature,
|
|
673
979
|
nativeModule().rustbuffer_alloc
|
|
674
980
|
),
|
|
@@ -681,31 +987,35 @@ export function extractEcdsaSignatureFromOracleSignatures(
|
|
|
681
987
|
}
|
|
682
988
|
|
|
683
989
|
/**
|
|
684
|
-
*
|
|
685
|
-
*
|
|
990
|
+
* The accepting party verifies the sign message and completes the funding
|
|
991
|
+
* transaction. Returns the Bitcoin consensus-serialized signed transaction.
|
|
686
992
|
*/
|
|
687
|
-
export function
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
993
|
+
export function finalizeSign(
|
|
994
|
+
offer: Uint8Array,
|
|
995
|
+
accept: Uint8Array,
|
|
996
|
+
sign: Uint8Array,
|
|
997
|
+
signedFundingPsbt: Uint8Array
|
|
998
|
+
): Uint8Array /*throws*/ {
|
|
691
999
|
return ((__rb: Uint8Array) => {
|
|
692
1000
|
try {
|
|
693
|
-
return
|
|
1001
|
+
return FfiConverterUint8Array.lift(__rb);
|
|
694
1002
|
} finally {
|
|
695
1003
|
nativeModule().rustbuffer_free(__rb);
|
|
696
1004
|
}
|
|
697
1005
|
})(
|
|
698
1006
|
uniffiCaller.rustCallWithError(
|
|
699
|
-
/*liftError:*/
|
|
700
|
-
|
|
1007
|
+
/*liftError:*/ FfiConverterTypeContractError.lift.bind(
|
|
1008
|
+
FfiConverterTypeContractError
|
|
701
1009
|
),
|
|
702
1010
|
/*caller:*/ (callStatus) => {
|
|
703
|
-
return nativeModule().
|
|
704
|
-
|
|
705
|
-
|
|
1011
|
+
return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_finalize_sign(
|
|
1012
|
+
FfiConverterUint8Array.lower(offer, nativeModule().rustbuffer_alloc),
|
|
1013
|
+
FfiConverterUint8Array.lower(accept, nativeModule().rustbuffer_alloc),
|
|
1014
|
+
FfiConverterUint8Array.lower(sign, nativeModule().rustbuffer_alloc),
|
|
1015
|
+
FfiConverterUint8Array.lower(
|
|
1016
|
+
signedFundingPsbt,
|
|
706
1017
|
nativeModule().rustbuffer_alloc
|
|
707
1018
|
),
|
|
708
|
-
FfiConverterString.lower(network, nativeModule().rustbuffer_alloc),
|
|
709
1019
|
callStatus
|
|
710
1020
|
);
|
|
711
1021
|
},
|
|
@@ -715,15 +1025,44 @@ export function getPubkeyFromExtkey(
|
|
|
715
1025
|
}
|
|
716
1026
|
|
|
717
1027
|
/**
|
|
718
|
-
*
|
|
1028
|
+
* Like [`finalize_sign`], but additionally completes the 2-of-2 witness for any
|
|
1029
|
+
* splice (DLC) funding input using this (accepting) party's prior funding keys,
|
|
1030
|
+
* re-derived inside Rust from `keys`.
|
|
719
1031
|
*/
|
|
720
|
-
export function
|
|
721
|
-
|
|
722
|
-
|
|
1032
|
+
export function finalizeSignSpliced(
|
|
1033
|
+
offer: Uint8Array,
|
|
1034
|
+
accept: Uint8Array,
|
|
1035
|
+
sign: Uint8Array,
|
|
1036
|
+
signedFundingPsbt: Uint8Array,
|
|
1037
|
+
keys: ContractKeyProviderLike,
|
|
1038
|
+
spliceKeys: Array<SpliceKeyRef>
|
|
1039
|
+
): Uint8Array /*throws*/ {
|
|
1040
|
+
return ((__rb: Uint8Array) => {
|
|
1041
|
+
try {
|
|
1042
|
+
return FfiConverterUint8Array.lift(__rb);
|
|
1043
|
+
} finally {
|
|
1044
|
+
nativeModule().rustbuffer_free(__rb);
|
|
1045
|
+
}
|
|
1046
|
+
})(
|
|
1047
|
+
uniffiCaller.rustCallWithError(
|
|
1048
|
+
/*liftError:*/ FfiConverterTypeContractError.lift.bind(
|
|
1049
|
+
FfiConverterTypeContractError
|
|
1050
|
+
),
|
|
723
1051
|
/*caller:*/ (callStatus) => {
|
|
724
|
-
return nativeModule().
|
|
725
|
-
|
|
726
|
-
|
|
1052
|
+
return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_finalize_sign_spliced(
|
|
1053
|
+
FfiConverterUint8Array.lower(offer, nativeModule().rustbuffer_alloc),
|
|
1054
|
+
FfiConverterUint8Array.lower(accept, nativeModule().rustbuffer_alloc),
|
|
1055
|
+
FfiConverterUint8Array.lower(sign, nativeModule().rustbuffer_alloc),
|
|
1056
|
+
FfiConverterUint8Array.lower(
|
|
1057
|
+
signedFundingPsbt,
|
|
1058
|
+
nativeModule().rustbuffer_alloc
|
|
1059
|
+
),
|
|
1060
|
+
FfiConverterTypeContractKeyProvider.lower(
|
|
1061
|
+
keys,
|
|
1062
|
+
nativeModule().rustbuffer_alloc
|
|
1063
|
+
),
|
|
1064
|
+
FfiConverterSequenceTypeSpliceKeyRef.lower(
|
|
1065
|
+
spliceKeys,
|
|
727
1066
|
nativeModule().rustbuffer_alloc
|
|
728
1067
|
),
|
|
729
1068
|
callStatus
|
|
@@ -735,16 +1074,77 @@ export function getTotalInputVsize(inputs: Array<TxInputInfo>): number {
|
|
|
735
1074
|
}
|
|
736
1075
|
|
|
737
1076
|
/**
|
|
738
|
-
*
|
|
739
|
-
*
|
|
1077
|
+
* Builds a wire-encoded `FundingInput` from a wallet UTXO, ready to place in a
|
|
1078
|
+
* party's `funding_inputs`.
|
|
1079
|
+
*
|
|
1080
|
+
* - `previous_transaction`: the full consensus-serialized transaction that
|
|
1081
|
+
* created the UTXO being spent.
|
|
1082
|
+
* - `vout`: the output index of the UTXO within that transaction.
|
|
1083
|
+
* - `input_serial_id`: orders the input in the funding transaction; randomly
|
|
1084
|
+
* generated when `None`.
|
|
1085
|
+
* - `sequence`: the input sequence (usually `0xffffffff`).
|
|
1086
|
+
* - `max_witness_len`: the input's maximum witness length (e.g. 108 for
|
|
1087
|
+
* P2WPKH).
|
|
1088
|
+
* - `redeem_script`: the redeem script for a P2SH input, or empty for others.
|
|
740
1089
|
*/
|
|
741
|
-
export function
|
|
742
|
-
|
|
1090
|
+
export function fundingInput(
|
|
1091
|
+
previousTransaction: Uint8Array,
|
|
1092
|
+
vout: number,
|
|
1093
|
+
inputSerialId: bigint | undefined,
|
|
1094
|
+
sequence: number,
|
|
1095
|
+
maxWitnessLen: number,
|
|
1096
|
+
redeemScript: Uint8Array
|
|
1097
|
+
): Uint8Array /*throws*/ {
|
|
1098
|
+
return ((__rb: Uint8Array) => {
|
|
1099
|
+
try {
|
|
1100
|
+
return FfiConverterUint8Array.lift(__rb);
|
|
1101
|
+
} finally {
|
|
1102
|
+
nativeModule().rustbuffer_free(__rb);
|
|
1103
|
+
}
|
|
1104
|
+
})(
|
|
1105
|
+
uniffiCaller.rustCallWithError(
|
|
1106
|
+
/*liftError:*/ FfiConverterTypeContractError.lift.bind(
|
|
1107
|
+
FfiConverterTypeContractError
|
|
1108
|
+
),
|
|
1109
|
+
/*caller:*/ (callStatus) => {
|
|
1110
|
+
return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_funding_input(
|
|
1111
|
+
FfiConverterUint8Array.lower(
|
|
1112
|
+
previousTransaction,
|
|
1113
|
+
nativeModule().rustbuffer_alloc
|
|
1114
|
+
),
|
|
1115
|
+
FfiConverterUInt32.lower(vout, nativeModule().rustbuffer_alloc),
|
|
1116
|
+
FfiConverterOptionalUInt64.lower(
|
|
1117
|
+
inputSerialId,
|
|
1118
|
+
nativeModule().rustbuffer_alloc
|
|
1119
|
+
),
|
|
1120
|
+
FfiConverterUInt32.lower(sequence, nativeModule().rustbuffer_alloc),
|
|
1121
|
+
FfiConverterUInt16.lower(
|
|
1122
|
+
maxWitnessLen,
|
|
1123
|
+
nativeModule().rustbuffer_alloc
|
|
1124
|
+
),
|
|
1125
|
+
FfiConverterUint8Array.lower(
|
|
1126
|
+
redeemScript,
|
|
1127
|
+
nativeModule().rustbuffer_alloc
|
|
1128
|
+
),
|
|
1129
|
+
callStatus
|
|
1130
|
+
);
|
|
1131
|
+
},
|
|
1132
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)
|
|
1133
|
+
)
|
|
1134
|
+
);
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
/**
|
|
1138
|
+
* Extract public key from extended key (private or public)
|
|
1139
|
+
* Input: 78-byte encoded xpriv/xpub, Output: 33-byte compressed public key
|
|
1140
|
+
*/
|
|
1141
|
+
export function getPubkeyFromExtkey(
|
|
1142
|
+
extkey: Uint8Array,
|
|
743
1143
|
network: string
|
|
744
|
-
):
|
|
1144
|
+
): Uint8Array /*throws*/ {
|
|
745
1145
|
return ((__rb: Uint8Array) => {
|
|
746
1146
|
try {
|
|
747
|
-
return
|
|
1147
|
+
return FfiConverterUint8Array.lift(__rb);
|
|
748
1148
|
} finally {
|
|
749
1149
|
nativeModule().rustbuffer_free(__rb);
|
|
750
1150
|
}
|
|
@@ -754,8 +1154,8 @@ export function getXpubFromXpriv(
|
|
|
754
1154
|
FfiConverterTypeDLCError
|
|
755
1155
|
),
|
|
756
1156
|
/*caller:*/ (callStatus) => {
|
|
757
|
-
return nativeModule().
|
|
758
|
-
|
|
1157
|
+
return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_get_pubkey_from_extkey(
|
|
1158
|
+
FfiConverterUint8Array.lower(extkey, nativeModule().rustbuffer_alloc),
|
|
759
1159
|
FfiConverterString.lower(network, nativeModule().rustbuffer_alloc),
|
|
760
1160
|
callStatus
|
|
761
1161
|
);
|
|
@@ -765,14 +1165,414 @@ export function getXpubFromXpriv(
|
|
|
765
1165
|
);
|
|
766
1166
|
}
|
|
767
1167
|
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
1168
|
+
/**
|
|
1169
|
+
* Get total input virtual size for fee calculation
|
|
1170
|
+
*/
|
|
1171
|
+
export function getTotalInputVsize(inputs: Array<TxInputInfo>): number {
|
|
1172
|
+
return FfiConverterUInt32.lift(
|
|
1173
|
+
uniffiCaller.rustCall(
|
|
1174
|
+
/*caller:*/ (callStatus) => {
|
|
1175
|
+
return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_get_total_input_vsize(
|
|
1176
|
+
FfiConverterSequenceTypeTxInputInfo.lower(
|
|
1177
|
+
inputs,
|
|
1178
|
+
nativeModule().rustbuffer_alloc
|
|
1179
|
+
),
|
|
1180
|
+
callStatus
|
|
1181
|
+
);
|
|
1182
|
+
},
|
|
1183
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)
|
|
1184
|
+
)
|
|
1185
|
+
);
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
/**
|
|
1189
|
+
* Convert extended private key to extended public key
|
|
1190
|
+
* Input: 78-byte encoded xpriv, Output: 78-byte encoded xpub
|
|
1191
|
+
*/
|
|
1192
|
+
export function getXpubFromXpriv(
|
|
1193
|
+
xpriv: Uint8Array,
|
|
1194
|
+
network: string
|
|
1195
|
+
): Uint8Array /*throws*/ {
|
|
1196
|
+
return ((__rb: Uint8Array) => {
|
|
1197
|
+
try {
|
|
1198
|
+
return FfiConverterUint8Array.lift(__rb);
|
|
1199
|
+
} finally {
|
|
1200
|
+
nativeModule().rustbuffer_free(__rb);
|
|
1201
|
+
}
|
|
1202
|
+
})(
|
|
1203
|
+
uniffiCaller.rustCallWithError(
|
|
1204
|
+
/*liftError:*/ FfiConverterTypeDLCError.lift.bind(
|
|
1205
|
+
FfiConverterTypeDLCError
|
|
1206
|
+
),
|
|
1207
|
+
/*caller:*/ (callStatus) => {
|
|
1208
|
+
return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_get_xpub_from_xpriv(
|
|
1209
|
+
FfiConverterUint8Array.lower(xpriv, nativeModule().rustbuffer_alloc),
|
|
1210
|
+
FfiConverterString.lower(network, nativeModule().rustbuffer_alloc),
|
|
1211
|
+
callStatus
|
|
1212
|
+
);
|
|
1213
|
+
},
|
|
1214
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)
|
|
1215
|
+
)
|
|
1216
|
+
);
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1219
|
+
/**
|
|
1220
|
+
* The offering party verifies the accept message and produces its `SignDlc`.
|
|
1221
|
+
* The offer party's funding secret key is derived from `keys` +
|
|
1222
|
+
* `temporary_contract_id` (the new contract's id).
|
|
1223
|
+
*/
|
|
1224
|
+
export function signAccept(
|
|
1225
|
+
offer: Uint8Array,
|
|
1226
|
+
accept: Uint8Array,
|
|
1227
|
+
keys: ContractKeyProviderLike,
|
|
1228
|
+
temporaryContractId: Uint8Array,
|
|
1229
|
+
signedFundingPsbt: Uint8Array
|
|
1230
|
+
): SignResult /*throws*/ {
|
|
1231
|
+
return ((__rb: Uint8Array) => {
|
|
1232
|
+
try {
|
|
1233
|
+
return FfiConverterTypeSignResult.lift(__rb);
|
|
1234
|
+
} finally {
|
|
1235
|
+
nativeModule().rustbuffer_free(__rb);
|
|
1236
|
+
}
|
|
1237
|
+
})(
|
|
1238
|
+
uniffiCaller.rustCallWithError(
|
|
1239
|
+
/*liftError:*/ FfiConverterTypeContractError.lift.bind(
|
|
1240
|
+
FfiConverterTypeContractError
|
|
1241
|
+
),
|
|
1242
|
+
/*caller:*/ (callStatus) => {
|
|
1243
|
+
return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_sign_accept(
|
|
1244
|
+
FfiConverterUint8Array.lower(offer, nativeModule().rustbuffer_alloc),
|
|
1245
|
+
FfiConverterUint8Array.lower(accept, nativeModule().rustbuffer_alloc),
|
|
1246
|
+
FfiConverterTypeContractKeyProvider.lower(
|
|
1247
|
+
keys,
|
|
1248
|
+
nativeModule().rustbuffer_alloc
|
|
1249
|
+
),
|
|
1250
|
+
FfiConverterUint8Array.lower(
|
|
1251
|
+
temporaryContractId,
|
|
1252
|
+
nativeModule().rustbuffer_alloc
|
|
1253
|
+
),
|
|
1254
|
+
FfiConverterUint8Array.lower(
|
|
1255
|
+
signedFundingPsbt,
|
|
1256
|
+
nativeModule().rustbuffer_alloc
|
|
1257
|
+
),
|
|
1258
|
+
callStatus
|
|
1259
|
+
);
|
|
1260
|
+
},
|
|
1261
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)
|
|
1262
|
+
)
|
|
1263
|
+
);
|
|
1264
|
+
}
|
|
1265
|
+
|
|
1266
|
+
/**
|
|
1267
|
+
* Like [`sign_accept`], but additionally co-signs any splice (DLC) funding
|
|
1268
|
+
* inputs. For each splice input, `splice_keys` names the previous contract; the
|
|
1269
|
+
* prior funding secret key is re-derived inside Rust from `keys`.
|
|
1270
|
+
*/
|
|
1271
|
+
export function signAcceptSpliced(
|
|
1272
|
+
offer: Uint8Array,
|
|
1273
|
+
accept: Uint8Array,
|
|
1274
|
+
keys: ContractKeyProviderLike,
|
|
1275
|
+
temporaryContractId: Uint8Array,
|
|
1276
|
+
signedFundingPsbt: Uint8Array,
|
|
1277
|
+
spliceKeys: Array<SpliceKeyRef>
|
|
1278
|
+
): SignResult /*throws*/ {
|
|
1279
|
+
return ((__rb: Uint8Array) => {
|
|
1280
|
+
try {
|
|
1281
|
+
return FfiConverterTypeSignResult.lift(__rb);
|
|
1282
|
+
} finally {
|
|
1283
|
+
nativeModule().rustbuffer_free(__rb);
|
|
1284
|
+
}
|
|
1285
|
+
})(
|
|
1286
|
+
uniffiCaller.rustCallWithError(
|
|
1287
|
+
/*liftError:*/ FfiConverterTypeContractError.lift.bind(
|
|
1288
|
+
FfiConverterTypeContractError
|
|
1289
|
+
),
|
|
1290
|
+
/*caller:*/ (callStatus) => {
|
|
1291
|
+
return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_sign_accept_spliced(
|
|
1292
|
+
FfiConverterUint8Array.lower(offer, nativeModule().rustbuffer_alloc),
|
|
1293
|
+
FfiConverterUint8Array.lower(accept, nativeModule().rustbuffer_alloc),
|
|
1294
|
+
FfiConverterTypeContractKeyProvider.lower(
|
|
1295
|
+
keys,
|
|
1296
|
+
nativeModule().rustbuffer_alloc
|
|
1297
|
+
),
|
|
1298
|
+
FfiConverterUint8Array.lower(
|
|
1299
|
+
temporaryContractId,
|
|
1300
|
+
nativeModule().rustbuffer_alloc
|
|
1301
|
+
),
|
|
1302
|
+
FfiConverterUint8Array.lower(
|
|
1303
|
+
signedFundingPsbt,
|
|
1304
|
+
nativeModule().rustbuffer_alloc
|
|
1305
|
+
),
|
|
1306
|
+
FfiConverterSequenceTypeSpliceKeyRef.lower(
|
|
1307
|
+
spliceKeys,
|
|
1308
|
+
nativeModule().rustbuffer_alloc
|
|
1309
|
+
),
|
|
1310
|
+
callStatus
|
|
1311
|
+
);
|
|
1312
|
+
},
|
|
1313
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)
|
|
1314
|
+
)
|
|
1315
|
+
);
|
|
1316
|
+
}
|
|
1317
|
+
|
|
1318
|
+
/**
|
|
1319
|
+
* Signs the CET matching a set of oracle attestations, returning the Bitcoin
|
|
1320
|
+
* consensus-serialized transaction. It pays each party the attested outcome's
|
|
1321
|
+
* payout and is ready to broadcast — no network access happens here.
|
|
1322
|
+
*
|
|
1323
|
+
* The settling party's funding secret key is derived inside Rust from `keys` +
|
|
1324
|
+
* `temporary_contract_id` — the settling party's OWN temporary id (the offer's
|
|
1325
|
+
* for the offering party, the `new_temporary_contract_id` passed to
|
|
1326
|
+
* `accept_offer` for the accepting party). The key also identifies which side
|
|
1327
|
+
* is settling, so there is no party argument to get wrong. Either party can
|
|
1328
|
+
* settle alone: the counterparty's half of the 2-of-2 comes from decrypting its
|
|
1329
|
+
* CET adaptor signature with the oracle signatures.
|
|
1330
|
+
*
|
|
1331
|
+
* Each entry in `attestations` pairs a wire-encoded `OracleAttestation` with
|
|
1332
|
+
* the index of its oracle in the announcements of the contract info it settles.
|
|
1333
|
+
* Attestations are verified against the announcements they claim to come from,
|
|
1334
|
+
* so a forged or misindexed one cannot produce a CET
|
|
1335
|
+
* ([`ContractError::InvalidAttestation`]). When no contract outcome matches the
|
|
1336
|
+
* attested outcomes, [`ContractError::NoMatchingOutcome`] is returned — which
|
|
1337
|
+
* is also what an attestation for an unrelated event looks like.
|
|
1338
|
+
*/
|
|
1339
|
+
export function signContractCet(
|
|
1340
|
+
offer: Uint8Array,
|
|
1341
|
+
accept: Uint8Array,
|
|
1342
|
+
sign: Uint8Array,
|
|
1343
|
+
keys: ContractKeyProviderLike,
|
|
1344
|
+
temporaryContractId: Uint8Array,
|
|
1345
|
+
attestations: Array<OracleAttestationRef>
|
|
1346
|
+
): Uint8Array /*throws*/ {
|
|
1347
|
+
return ((__rb: Uint8Array) => {
|
|
1348
|
+
try {
|
|
1349
|
+
return FfiConverterUint8Array.lift(__rb);
|
|
1350
|
+
} finally {
|
|
1351
|
+
nativeModule().rustbuffer_free(__rb);
|
|
1352
|
+
}
|
|
1353
|
+
})(
|
|
1354
|
+
uniffiCaller.rustCallWithError(
|
|
1355
|
+
/*liftError:*/ FfiConverterTypeContractError.lift.bind(
|
|
1356
|
+
FfiConverterTypeContractError
|
|
1357
|
+
),
|
|
1358
|
+
/*caller:*/ (callStatus) => {
|
|
1359
|
+
return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_sign_contract_cet(
|
|
1360
|
+
FfiConverterUint8Array.lower(offer, nativeModule().rustbuffer_alloc),
|
|
1361
|
+
FfiConverterUint8Array.lower(accept, nativeModule().rustbuffer_alloc),
|
|
1362
|
+
FfiConverterUint8Array.lower(sign, nativeModule().rustbuffer_alloc),
|
|
1363
|
+
FfiConverterTypeContractKeyProvider.lower(
|
|
1364
|
+
keys,
|
|
1365
|
+
nativeModule().rustbuffer_alloc
|
|
1366
|
+
),
|
|
1367
|
+
FfiConverterUint8Array.lower(
|
|
1368
|
+
temporaryContractId,
|
|
1369
|
+
nativeModule().rustbuffer_alloc
|
|
1370
|
+
),
|
|
1371
|
+
FfiConverterSequenceTypeOracleAttestationRef.lower(
|
|
1372
|
+
attestations,
|
|
1373
|
+
nativeModule().rustbuffer_alloc
|
|
1374
|
+
),
|
|
1375
|
+
callStatus
|
|
1376
|
+
);
|
|
1377
|
+
},
|
|
1378
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)
|
|
1379
|
+
)
|
|
1380
|
+
);
|
|
1381
|
+
}
|
|
1382
|
+
|
|
1383
|
+
/**
|
|
1384
|
+
* Signs the refund transaction, returning the Bitcoin consensus-serialized
|
|
1385
|
+
* transaction. It returns each party its own collateral and can only be
|
|
1386
|
+
* broadcast once the offer's `refund_locktime` has passed — enforcing that is
|
|
1387
|
+
* the chain's job, not this function's.
|
|
1388
|
+
*
|
|
1389
|
+
* As with [`sign_contract_cet`], `temporary_contract_id` is the settling
|
|
1390
|
+
* party's own temporary id and identifies which side is settling. Both parties
|
|
1391
|
+
* signed the refund during the offer/accept exchange, so this only adds this
|
|
1392
|
+
* party's half; the counterparty's stored signature is verified first.
|
|
1393
|
+
*/
|
|
1394
|
+
export function signContractRefund(
|
|
1395
|
+
offer: Uint8Array,
|
|
1396
|
+
accept: Uint8Array,
|
|
1397
|
+
sign: Uint8Array,
|
|
1398
|
+
keys: ContractKeyProviderLike,
|
|
1399
|
+
temporaryContractId: Uint8Array
|
|
1400
|
+
): Uint8Array /*throws*/ {
|
|
1401
|
+
return ((__rb: Uint8Array) => {
|
|
1402
|
+
try {
|
|
1403
|
+
return FfiConverterUint8Array.lift(__rb);
|
|
1404
|
+
} finally {
|
|
1405
|
+
nativeModule().rustbuffer_free(__rb);
|
|
1406
|
+
}
|
|
1407
|
+
})(
|
|
1408
|
+
uniffiCaller.rustCallWithError(
|
|
1409
|
+
/*liftError:*/ FfiConverterTypeContractError.lift.bind(
|
|
1410
|
+
FfiConverterTypeContractError
|
|
1411
|
+
),
|
|
1412
|
+
/*caller:*/ (callStatus) => {
|
|
1413
|
+
return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_sign_contract_refund(
|
|
1414
|
+
FfiConverterUint8Array.lower(offer, nativeModule().rustbuffer_alloc),
|
|
1415
|
+
FfiConverterUint8Array.lower(accept, nativeModule().rustbuffer_alloc),
|
|
1416
|
+
FfiConverterUint8Array.lower(sign, nativeModule().rustbuffer_alloc),
|
|
1417
|
+
FfiConverterTypeContractKeyProvider.lower(
|
|
1418
|
+
keys,
|
|
1419
|
+
nativeModule().rustbuffer_alloc
|
|
1420
|
+
),
|
|
1421
|
+
FfiConverterUint8Array.lower(
|
|
1422
|
+
temporaryContractId,
|
|
1423
|
+
nativeModule().rustbuffer_alloc
|
|
1424
|
+
),
|
|
1425
|
+
callStatus
|
|
1426
|
+
);
|
|
1427
|
+
},
|
|
1428
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)
|
|
1429
|
+
)
|
|
1430
|
+
);
|
|
1431
|
+
}
|
|
1432
|
+
|
|
1433
|
+
/**
|
|
1434
|
+
* Signs a party's own funding inputs on the funding PSBT using a private output
|
|
1435
|
+
* descriptor (e.g. bdk's `wpkh(...)` with an xprv), returning the updated PSBT.
|
|
1436
|
+
* Each entry in `inputs` names one of this party's funding inputs (by serial
|
|
1437
|
+
* id) and the descriptor wildcard index that derives its key. Supports `wpkh()`
|
|
1438
|
+
* and `sh(wpkh())`, with or without a wildcard.
|
|
1439
|
+
*/
|
|
1440
|
+
export function signFundingPsbtWithDescriptor(
|
|
1441
|
+
offer: Uint8Array,
|
|
1442
|
+
accept: Uint8Array,
|
|
1443
|
+
fundingPsbt: Uint8Array,
|
|
1444
|
+
descriptor: string,
|
|
1445
|
+
inputs: Array<DescriptorInput>
|
|
1446
|
+
): Uint8Array /*throws*/ {
|
|
1447
|
+
return ((__rb: Uint8Array) => {
|
|
1448
|
+
try {
|
|
1449
|
+
return FfiConverterUint8Array.lift(__rb);
|
|
1450
|
+
} finally {
|
|
1451
|
+
nativeModule().rustbuffer_free(__rb);
|
|
1452
|
+
}
|
|
1453
|
+
})(
|
|
1454
|
+
uniffiCaller.rustCallWithError(
|
|
1455
|
+
/*liftError:*/ FfiConverterTypeContractError.lift.bind(
|
|
1456
|
+
FfiConverterTypeContractError
|
|
1457
|
+
),
|
|
1458
|
+
/*caller:*/ (callStatus) => {
|
|
1459
|
+
return nativeModule().ubrn_uniffi_ddk_ffi_fn_func_sign_funding_psbt_with_descriptor(
|
|
1460
|
+
FfiConverterUint8Array.lower(offer, nativeModule().rustbuffer_alloc),
|
|
1461
|
+
FfiConverterUint8Array.lower(accept, nativeModule().rustbuffer_alloc),
|
|
1462
|
+
FfiConverterUint8Array.lower(
|
|
1463
|
+
fundingPsbt,
|
|
1464
|
+
nativeModule().rustbuffer_alloc
|
|
1465
|
+
),
|
|
1466
|
+
FfiConverterString.lower(descriptor, nativeModule().rustbuffer_alloc),
|
|
1467
|
+
FfiConverterSequenceTypeDescriptorInput.lower(
|
|
1468
|
+
inputs,
|
|
1469
|
+
nativeModule().rustbuffer_alloc
|
|
1470
|
+
),
|
|
1471
|
+
callStatus
|
|
1472
|
+
);
|
|
1473
|
+
},
|
|
1474
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)
|
|
1475
|
+
)
|
|
1476
|
+
);
|
|
1477
|
+
}
|
|
1478
|
+
|
|
1479
|
+
/**
|
|
1480
|
+
* Validates an accept message against its offer: the acceptor's CET adaptor
|
|
1481
|
+
* signatures and refund signature must be valid for the contract the two
|
|
1482
|
+
* messages describe. This is the same check `sign_accept` runs internally,
|
|
1483
|
+
* exposed so a stored/received `AcceptDlc` can be verified on its own.
|
|
1484
|
+
*/
|
|
1485
|
+
export function validateAccept(
|
|
1486
|
+
offer: Uint8Array,
|
|
1487
|
+
accept: Uint8Array
|
|
1488
|
+
): void /*throws*/ {
|
|
1489
|
+
uniffiCaller.rustCallWithError(
|
|
1490
|
+
/*liftError:*/ FfiConverterTypeContractError.lift.bind(
|
|
1491
|
+
FfiConverterTypeContractError
|
|
1492
|
+
),
|
|
1493
|
+
/*caller:*/ (callStatus) => {
|
|
1494
|
+
nativeModule().ubrn_uniffi_ddk_ffi_fn_func_validate_accept(
|
|
1495
|
+
FfiConverterUint8Array.lower(offer, nativeModule().rustbuffer_alloc),
|
|
1496
|
+
FfiConverterUint8Array.lower(accept, nativeModule().rustbuffer_alloc),
|
|
1497
|
+
callStatus
|
|
1498
|
+
);
|
|
1499
|
+
},
|
|
1500
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)
|
|
1501
|
+
);
|
|
1502
|
+
}
|
|
1503
|
+
|
|
1504
|
+
/**
|
|
1505
|
+
* Validates an offer's protocol version, funding inputs, fee rate, collateral,
|
|
1506
|
+
* and oracle timeouts.
|
|
1507
|
+
*
|
|
1508
|
+
* The lifecycle functions already validate internally (`accept_offer` validates
|
|
1509
|
+
* the offer, `sign_accept` validates the accept, `finalize_sign` validates the
|
|
1510
|
+
* sign); these `validate_*` functions expose the same checks standalone, so a
|
|
1511
|
+
* consumer can independently verify a stored or received message at any time —
|
|
1512
|
+
* e.g. before persisting it, or when loading it back later.
|
|
1513
|
+
*/
|
|
1514
|
+
export function validateOffer(
|
|
1515
|
+
offer: Uint8Array,
|
|
1516
|
+
minTimeoutInterval: number,
|
|
1517
|
+
maxTimeoutInterval: number
|
|
1518
|
+
): void /*throws*/ {
|
|
1519
|
+
uniffiCaller.rustCallWithError(
|
|
1520
|
+
/*liftError:*/ FfiConverterTypeContractError.lift.bind(
|
|
1521
|
+
FfiConverterTypeContractError
|
|
1522
|
+
),
|
|
1523
|
+
/*caller:*/ (callStatus) => {
|
|
1524
|
+
nativeModule().ubrn_uniffi_ddk_ffi_fn_func_validate_offer(
|
|
1525
|
+
FfiConverterUint8Array.lower(offer, nativeModule().rustbuffer_alloc),
|
|
1526
|
+
FfiConverterUInt32.lower(
|
|
1527
|
+
minTimeoutInterval,
|
|
1528
|
+
nativeModule().rustbuffer_alloc
|
|
1529
|
+
),
|
|
1530
|
+
FfiConverterUInt32.lower(
|
|
1531
|
+
maxTimeoutInterval,
|
|
1532
|
+
nativeModule().rustbuffer_alloc
|
|
1533
|
+
),
|
|
1534
|
+
callStatus
|
|
1535
|
+
);
|
|
1536
|
+
},
|
|
1537
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)
|
|
1538
|
+
);
|
|
1539
|
+
}
|
|
1540
|
+
|
|
1541
|
+
/**
|
|
1542
|
+
* Validates a sign message against its offer and accept: the offerer's CET
|
|
1543
|
+
* adaptor signatures and refund signature must be valid. This is the same
|
|
1544
|
+
* check `finalize_sign` runs internally, exposed so a stored/received `SignDlc`
|
|
1545
|
+
* can be verified on its own.
|
|
1546
|
+
*/
|
|
1547
|
+
export function validateSign(
|
|
1548
|
+
offer: Uint8Array,
|
|
1549
|
+
accept: Uint8Array,
|
|
1550
|
+
sign: Uint8Array
|
|
1551
|
+
): void /*throws*/ {
|
|
1552
|
+
uniffiCaller.rustCallWithError(
|
|
1553
|
+
/*liftError:*/ FfiConverterTypeContractError.lift.bind(
|
|
1554
|
+
FfiConverterTypeContractError
|
|
1555
|
+
),
|
|
1556
|
+
/*caller:*/ (callStatus) => {
|
|
1557
|
+
nativeModule().ubrn_uniffi_ddk_ffi_fn_func_validate_sign(
|
|
1558
|
+
FfiConverterUint8Array.lower(offer, nativeModule().rustbuffer_alloc),
|
|
1559
|
+
FfiConverterUint8Array.lower(accept, nativeModule().rustbuffer_alloc),
|
|
1560
|
+
FfiConverterUint8Array.lower(sign, nativeModule().rustbuffer_alloc),
|
|
1561
|
+
callStatus
|
|
1562
|
+
);
|
|
1563
|
+
},
|
|
1564
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)
|
|
1565
|
+
);
|
|
1566
|
+
}
|
|
1567
|
+
|
|
1568
|
+
export function verifyCetAdaptorSigsFromOracleInfo(
|
|
1569
|
+
adaptorSigs: Array<AdaptorSignature>,
|
|
1570
|
+
cets: Array<Transaction>,
|
|
771
1571
|
oracleInfos: Array<OracleInfo>,
|
|
772
|
-
pubkey:
|
|
773
|
-
fundingScriptPubkey:
|
|
1572
|
+
pubkey: Uint8Array,
|
|
1573
|
+
fundingScriptPubkey: Uint8Array,
|
|
774
1574
|
totalCollateral: bigint,
|
|
775
|
-
msgs: Array<Array<Array<
|
|
1575
|
+
msgs: Array<Array<Array<Uint8Array>>>
|
|
776
1576
|
): boolean {
|
|
777
1577
|
return FfiConverterBool.lift(
|
|
778
1578
|
uniffiCaller.rustCall(
|
|
@@ -790,11 +1590,8 @@ export function verifyCetAdaptorSigsFromOracleInfo(
|
|
|
790
1590
|
oracleInfos,
|
|
791
1591
|
nativeModule().rustbuffer_alloc
|
|
792
1592
|
),
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
nativeModule().rustbuffer_alloc
|
|
796
|
-
),
|
|
797
|
-
FfiConverterArrayBuffer.lower(
|
|
1593
|
+
FfiConverterUint8Array.lower(pubkey, nativeModule().rustbuffer_alloc),
|
|
1594
|
+
FfiConverterUint8Array.lower(
|
|
798
1595
|
fundingScriptPubkey,
|
|
799
1596
|
nativeModule().rustbuffer_alloc
|
|
800
1597
|
),
|
|
@@ -831,93 +1628,143 @@ export function version(): string {
|
|
|
831
1628
|
);
|
|
832
1629
|
}
|
|
833
1630
|
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
1631
|
+
/**
|
|
1632
|
+
* One party's Bitcoin-level contract data (mirrors [`ddk::contract::PartyParams`]).
|
|
1633
|
+
*/
|
|
1634
|
+
export type ContractPartyParams = {
|
|
1635
|
+
/**
|
|
1636
|
+
* The 33-byte compressed DLC funding public key.
|
|
1637
|
+
*/
|
|
1638
|
+
fundingPubkey: Uint8Array;
|
|
1639
|
+
/**
|
|
1640
|
+
* The wallet UTXOs this party contributes, each a wire-encoded `FundingInput`.
|
|
1641
|
+
*/
|
|
1642
|
+
fundingInputs: Array<Uint8Array>;
|
|
1643
|
+
/**
|
|
1644
|
+
* The script pubkey (raw bytes) CET and refund payouts are sent to.
|
|
1645
|
+
*/
|
|
1646
|
+
payoutSpk: Uint8Array;
|
|
1647
|
+
/**
|
|
1648
|
+
* Serial id ordering the payout output; randomly generated when `None`.
|
|
1649
|
+
*/
|
|
1650
|
+
payoutSerialId?: bigint;
|
|
1651
|
+
/**
|
|
1652
|
+
* The script pubkey (raw bytes) funding change is sent to.
|
|
1653
|
+
*/
|
|
1654
|
+
changeSpk: Uint8Array;
|
|
1655
|
+
/**
|
|
1656
|
+
* Serial id ordering the change output; randomly generated when `None`.
|
|
1657
|
+
*/
|
|
1658
|
+
changeSerialId?: bigint;
|
|
837
1659
|
};
|
|
838
1660
|
|
|
839
1661
|
/**
|
|
840
|
-
* Generated factory for {@link
|
|
1662
|
+
* Generated factory for {@link ContractPartyParams} record objects.
|
|
841
1663
|
*/
|
|
842
|
-
export const
|
|
1664
|
+
export const ContractPartyParams = (() => {
|
|
843
1665
|
const defaults = () => ({});
|
|
844
1666
|
const create = (() => {
|
|
845
|
-
return uniffiCreateRecord<
|
|
1667
|
+
return uniffiCreateRecord<ContractPartyParams, ReturnType<typeof defaults>>(
|
|
846
1668
|
defaults
|
|
847
1669
|
);
|
|
848
1670
|
})();
|
|
849
1671
|
return Object.freeze({
|
|
850
1672
|
create,
|
|
851
1673
|
new: create,
|
|
852
|
-
defaults: () => Object.freeze(defaults()) as Partial<
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
),
|
|
886
|
-
FfiConverterUInt64.lower(
|
|
887
|
-
totalCollateral,
|
|
888
|
-
nativeModule().rustbuffer_alloc
|
|
889
|
-
),
|
|
890
|
-
FfiConverterSequenceSequenceBytes.lower(
|
|
891
|
-
msgs,
|
|
892
|
-
nativeModule().rustbuffer_alloc
|
|
893
|
-
),
|
|
894
|
-
callStatus
|
|
895
|
-
);
|
|
896
|
-
},
|
|
897
|
-
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)
|
|
898
|
-
)
|
|
1674
|
+
defaults: () => Object.freeze(defaults()) as Partial<ContractPartyParams>,
|
|
1675
|
+
});
|
|
1676
|
+
})();
|
|
1677
|
+
|
|
1678
|
+
const FfiConverterTypeContractPartyParams = (() => {
|
|
1679
|
+
type TypeName = ContractPartyParams;
|
|
1680
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
1681
|
+
read(from: RustBuffer): TypeName {
|
|
1682
|
+
return {
|
|
1683
|
+
fundingPubkey: FfiConverterUint8Array.read(from),
|
|
1684
|
+
fundingInputs: FfiConverterSequenceBytes.read(from),
|
|
1685
|
+
payoutSpk: FfiConverterUint8Array.read(from),
|
|
1686
|
+
payoutSerialId: FfiConverterOptionalUInt64.read(from),
|
|
1687
|
+
changeSpk: FfiConverterUint8Array.read(from),
|
|
1688
|
+
changeSerialId: FfiConverterOptionalUInt64.read(from),
|
|
1689
|
+
};
|
|
1690
|
+
}
|
|
1691
|
+
write(value: TypeName, into: RustBuffer): void {
|
|
1692
|
+
FfiConverterUint8Array.write(value.fundingPubkey, into);
|
|
1693
|
+
FfiConverterSequenceBytes.write(value.fundingInputs, into);
|
|
1694
|
+
FfiConverterUint8Array.write(value.payoutSpk, into);
|
|
1695
|
+
FfiConverterOptionalUInt64.write(value.payoutSerialId, into);
|
|
1696
|
+
FfiConverterUint8Array.write(value.changeSpk, into);
|
|
1697
|
+
FfiConverterOptionalUInt64.write(value.changeSerialId, into);
|
|
1698
|
+
}
|
|
1699
|
+
allocationSize(value: TypeName): number {
|
|
1700
|
+
return (
|
|
1701
|
+
FfiConverterUint8Array.allocationSize(value.fundingPubkey) +
|
|
1702
|
+
FfiConverterSequenceBytes.allocationSize(value.fundingInputs) +
|
|
1703
|
+
FfiConverterUint8Array.allocationSize(value.payoutSpk) +
|
|
1704
|
+
FfiConverterOptionalUInt64.allocationSize(value.payoutSerialId) +
|
|
1705
|
+
FfiConverterUint8Array.allocationSize(value.changeSpk) +
|
|
1706
|
+
FfiConverterOptionalUInt64.allocationSize(value.changeSerialId)
|
|
899
1707
|
);
|
|
900
|
-
}
|
|
1708
|
+
}
|
|
1709
|
+
}
|
|
1710
|
+
return new FFIConverter();
|
|
1711
|
+
})();
|
|
1712
|
+
|
|
1713
|
+
/**
|
|
1714
|
+
* Parameters for [`accept_offer`] (mirrors [`ddk::contract::AcceptOfferParams`]).
|
|
1715
|
+
*/
|
|
1716
|
+
export type AcceptOfferParams = {
|
|
1717
|
+
/**
|
|
1718
|
+
* The accepting party's Bitcoin-level contract data.
|
|
1719
|
+
*/
|
|
1720
|
+
party: ContractPartyParams;
|
|
1721
|
+
/**
|
|
1722
|
+
* The minimum accepted interval between oracle maturity and the refund locktime.
|
|
1723
|
+
*/
|
|
1724
|
+
minTimeoutInterval: number;
|
|
1725
|
+
/**
|
|
1726
|
+
* The maximum accepted interval between oracle maturity and the refund locktime.
|
|
1727
|
+
*/
|
|
1728
|
+
maxTimeoutInterval: number;
|
|
1729
|
+
};
|
|
1730
|
+
|
|
1731
|
+
/**
|
|
1732
|
+
* Generated factory for {@link AcceptOfferParams} record objects.
|
|
1733
|
+
*/
|
|
1734
|
+
export const AcceptOfferParams = (() => {
|
|
1735
|
+
const defaults = () => ({});
|
|
1736
|
+
const create = (() => {
|
|
1737
|
+
return uniffiCreateRecord<AcceptOfferParams, ReturnType<typeof defaults>>(
|
|
1738
|
+
defaults
|
|
1739
|
+
);
|
|
1740
|
+
})();
|
|
1741
|
+
return Object.freeze({
|
|
1742
|
+
create,
|
|
1743
|
+
new: create,
|
|
1744
|
+
defaults: () => Object.freeze(defaults()) as Partial<AcceptOfferParams>,
|
|
901
1745
|
});
|
|
902
1746
|
})();
|
|
903
1747
|
|
|
904
|
-
const
|
|
905
|
-
type TypeName =
|
|
1748
|
+
const FfiConverterTypeAcceptOfferParams = (() => {
|
|
1749
|
+
type TypeName = AcceptOfferParams;
|
|
906
1750
|
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
907
1751
|
read(from: RustBuffer): TypeName {
|
|
908
1752
|
return {
|
|
909
|
-
|
|
910
|
-
|
|
1753
|
+
party: FfiConverterTypeContractPartyParams.read(from),
|
|
1754
|
+
minTimeoutInterval: FfiConverterUInt32.read(from),
|
|
1755
|
+
maxTimeoutInterval: FfiConverterUInt32.read(from),
|
|
911
1756
|
};
|
|
912
1757
|
}
|
|
913
1758
|
write(value: TypeName, into: RustBuffer): void {
|
|
914
|
-
|
|
915
|
-
|
|
1759
|
+
FfiConverterTypeContractPartyParams.write(value.party, into);
|
|
1760
|
+
FfiConverterUInt32.write(value.minTimeoutInterval, into);
|
|
1761
|
+
FfiConverterUInt32.write(value.maxTimeoutInterval, into);
|
|
916
1762
|
}
|
|
917
1763
|
allocationSize(value: TypeName): number {
|
|
918
1764
|
return (
|
|
919
|
-
|
|
920
|
-
|
|
1765
|
+
FfiConverterTypeContractPartyParams.allocationSize(value.party) +
|
|
1766
|
+
FfiConverterUInt32.allocationSize(value.minTimeoutInterval) +
|
|
1767
|
+
FfiConverterUInt32.allocationSize(value.maxTimeoutInterval)
|
|
921
1768
|
);
|
|
922
1769
|
}
|
|
923
1770
|
}
|
|
@@ -986,97 +1833,55 @@ const stringConverter = (() => {
|
|
|
986
1833
|
})();
|
|
987
1834
|
const FfiConverterString = uniffiCreateFfiConverterString(stringConverter);
|
|
988
1835
|
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
* This struct is intentionally always available (not feature-gated)
|
|
996
|
-
* to support production debugging scenarios.
|
|
997
|
-
*/
|
|
998
|
-
export type CetAdaptorSignatureDebugInfo = {
|
|
999
|
-
/**
|
|
1000
|
-
* The sighash (32 bytes) - this is the message that gets signed
|
|
1001
|
-
*/
|
|
1002
|
-
sighash: ArrayBuffer;
|
|
1003
|
-
/**
|
|
1004
|
-
* The adaptor point (33 bytes compressed public key)
|
|
1005
|
-
*/
|
|
1006
|
-
adaptorPoint: ArrayBuffer;
|
|
1007
|
-
/**
|
|
1008
|
-
* Input index (always 0 for CETs)
|
|
1009
|
-
*/
|
|
1010
|
-
inputIndex: number;
|
|
1011
|
-
/**
|
|
1012
|
-
* The funding script pubkey used for sighash
|
|
1013
|
-
*/
|
|
1014
|
-
scriptPubkey: ArrayBuffer;
|
|
1015
|
-
/**
|
|
1016
|
-
* The fund output value used for sighash
|
|
1017
|
-
*/
|
|
1018
|
-
value: bigint;
|
|
1019
|
-
/**
|
|
1020
|
-
* The CET txid
|
|
1021
|
-
*/
|
|
1022
|
-
cetTxid: string;
|
|
1023
|
-
/**
|
|
1024
|
-
* Raw CET bytes for verification
|
|
1025
|
-
*/
|
|
1026
|
-
cetRaw: ArrayBuffer;
|
|
1836
|
+
export type TxInput = {
|
|
1837
|
+
txid: string;
|
|
1838
|
+
vout: number;
|
|
1839
|
+
scriptSig: Uint8Array;
|
|
1840
|
+
sequence: number;
|
|
1841
|
+
witness: Array<Uint8Array>;
|
|
1027
1842
|
};
|
|
1028
1843
|
|
|
1029
1844
|
/**
|
|
1030
|
-
* Generated factory for {@link
|
|
1845
|
+
* Generated factory for {@link TxInput} record objects.
|
|
1031
1846
|
*/
|
|
1032
|
-
export const
|
|
1847
|
+
export const TxInput = (() => {
|
|
1033
1848
|
const defaults = () => ({});
|
|
1034
1849
|
const create = (() => {
|
|
1035
|
-
return uniffiCreateRecord<
|
|
1036
|
-
CetAdaptorSignatureDebugInfo,
|
|
1037
|
-
ReturnType<typeof defaults>
|
|
1038
|
-
>(defaults);
|
|
1850
|
+
return uniffiCreateRecord<TxInput, ReturnType<typeof defaults>>(defaults);
|
|
1039
1851
|
})();
|
|
1040
1852
|
return Object.freeze({
|
|
1041
1853
|
create,
|
|
1042
1854
|
new: create,
|
|
1043
|
-
defaults: () =>
|
|
1044
|
-
Object.freeze(defaults()) as Partial<CetAdaptorSignatureDebugInfo>,
|
|
1855
|
+
defaults: () => Object.freeze(defaults()) as Partial<TxInput>,
|
|
1045
1856
|
});
|
|
1046
1857
|
})();
|
|
1047
1858
|
|
|
1048
|
-
const
|
|
1049
|
-
type TypeName =
|
|
1859
|
+
const FfiConverterTypeTxInput = (() => {
|
|
1860
|
+
type TypeName = TxInput;
|
|
1050
1861
|
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
1051
1862
|
read(from: RustBuffer): TypeName {
|
|
1052
1863
|
return {
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
cetTxid: FfiConverterString.read(from),
|
|
1059
|
-
cetRaw: FfiConverterArrayBuffer.read(from),
|
|
1864
|
+
txid: FfiConverterString.read(from),
|
|
1865
|
+
vout: FfiConverterUInt32.read(from),
|
|
1866
|
+
scriptSig: FfiConverterUint8Array.read(from),
|
|
1867
|
+
sequence: FfiConverterUInt32.read(from),
|
|
1868
|
+
witness: FfiConverterSequenceBytes.read(from),
|
|
1060
1869
|
};
|
|
1061
1870
|
}
|
|
1062
1871
|
write(value: TypeName, into: RustBuffer): void {
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
FfiConverterString.write(value.cetTxid, into);
|
|
1069
|
-
FfiConverterArrayBuffer.write(value.cetRaw, into);
|
|
1872
|
+
FfiConverterString.write(value.txid, into);
|
|
1873
|
+
FfiConverterUInt32.write(value.vout, into);
|
|
1874
|
+
FfiConverterUint8Array.write(value.scriptSig, into);
|
|
1875
|
+
FfiConverterUInt32.write(value.sequence, into);
|
|
1876
|
+
FfiConverterSequenceBytes.write(value.witness, into);
|
|
1070
1877
|
}
|
|
1071
1878
|
allocationSize(value: TypeName): number {
|
|
1072
1879
|
return (
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
FfiConverterString.allocationSize(value.cetTxid) +
|
|
1079
|
-
FfiConverterArrayBuffer.allocationSize(value.cetRaw)
|
|
1880
|
+
FfiConverterString.allocationSize(value.txid) +
|
|
1881
|
+
FfiConverterUInt32.allocationSize(value.vout) +
|
|
1882
|
+
FfiConverterUint8Array.allocationSize(value.scriptSig) +
|
|
1883
|
+
FfiConverterUInt32.allocationSize(value.sequence) +
|
|
1884
|
+
FfiConverterSequenceBytes.allocationSize(value.witness)
|
|
1080
1885
|
);
|
|
1081
1886
|
}
|
|
1082
1887
|
}
|
|
@@ -1085,7 +1890,7 @@ const FfiConverterTypeCetAdaptorSignatureDebugInfo = (() => {
|
|
|
1085
1890
|
|
|
1086
1891
|
export type TxOutput = {
|
|
1087
1892
|
value: bigint;
|
|
1088
|
-
scriptPubkey:
|
|
1893
|
+
scriptPubkey: Uint8Array;
|
|
1089
1894
|
};
|
|
1090
1895
|
|
|
1091
1896
|
/**
|
|
@@ -1125,121 +1930,17 @@ const FfiConverterTypeTxOutput = (() => {
|
|
|
1125
1930
|
read(from: RustBuffer): TypeName {
|
|
1126
1931
|
return {
|
|
1127
1932
|
value: FfiConverterUInt64.read(from),
|
|
1128
|
-
scriptPubkey:
|
|
1933
|
+
scriptPubkey: FfiConverterUint8Array.read(from),
|
|
1129
1934
|
};
|
|
1130
1935
|
}
|
|
1131
1936
|
write(value: TypeName, into: RustBuffer): void {
|
|
1132
1937
|
FfiConverterUInt64.write(value.value, into);
|
|
1133
|
-
|
|
1938
|
+
FfiConverterUint8Array.write(value.scriptPubkey, into);
|
|
1134
1939
|
}
|
|
1135
1940
|
allocationSize(value: TypeName): number {
|
|
1136
1941
|
return (
|
|
1137
1942
|
FfiConverterUInt64.allocationSize(value.value) +
|
|
1138
|
-
|
|
1139
|
-
);
|
|
1140
|
-
}
|
|
1141
|
-
}
|
|
1142
|
-
return new FFIConverter();
|
|
1143
|
-
})();
|
|
1144
|
-
|
|
1145
|
-
export type ChangeOutputAndFees = {
|
|
1146
|
-
changeOutput: TxOutput;
|
|
1147
|
-
fundFee: bigint;
|
|
1148
|
-
cetFee: bigint;
|
|
1149
|
-
};
|
|
1150
|
-
|
|
1151
|
-
/**
|
|
1152
|
-
* Generated factory for {@link ChangeOutputAndFees} record objects.
|
|
1153
|
-
*/
|
|
1154
|
-
export const ChangeOutputAndFees = (() => {
|
|
1155
|
-
const defaults = () => ({});
|
|
1156
|
-
const create = (() => {
|
|
1157
|
-
return uniffiCreateRecord<ChangeOutputAndFees, ReturnType<typeof defaults>>(
|
|
1158
|
-
defaults
|
|
1159
|
-
);
|
|
1160
|
-
})();
|
|
1161
|
-
return Object.freeze({
|
|
1162
|
-
create,
|
|
1163
|
-
new: create,
|
|
1164
|
-
defaults: () => Object.freeze(defaults()) as Partial<ChangeOutputAndFees>,
|
|
1165
|
-
});
|
|
1166
|
-
})();
|
|
1167
|
-
|
|
1168
|
-
const FfiConverterTypeChangeOutputAndFees = (() => {
|
|
1169
|
-
type TypeName = ChangeOutputAndFees;
|
|
1170
|
-
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
1171
|
-
read(from: RustBuffer): TypeName {
|
|
1172
|
-
return {
|
|
1173
|
-
changeOutput: FfiConverterTypeTxOutput.read(from),
|
|
1174
|
-
fundFee: FfiConverterUInt64.read(from),
|
|
1175
|
-
cetFee: FfiConverterUInt64.read(from),
|
|
1176
|
-
};
|
|
1177
|
-
}
|
|
1178
|
-
write(value: TypeName, into: RustBuffer): void {
|
|
1179
|
-
FfiConverterTypeTxOutput.write(value.changeOutput, into);
|
|
1180
|
-
FfiConverterUInt64.write(value.fundFee, into);
|
|
1181
|
-
FfiConverterUInt64.write(value.cetFee, into);
|
|
1182
|
-
}
|
|
1183
|
-
allocationSize(value: TypeName): number {
|
|
1184
|
-
return (
|
|
1185
|
-
FfiConverterTypeTxOutput.allocationSize(value.changeOutput) +
|
|
1186
|
-
FfiConverterUInt64.allocationSize(value.fundFee) +
|
|
1187
|
-
FfiConverterUInt64.allocationSize(value.cetFee)
|
|
1188
|
-
);
|
|
1189
|
-
}
|
|
1190
|
-
}
|
|
1191
|
-
return new FFIConverter();
|
|
1192
|
-
})();
|
|
1193
|
-
|
|
1194
|
-
export type TxInput = {
|
|
1195
|
-
txid: string;
|
|
1196
|
-
vout: number;
|
|
1197
|
-
scriptSig: ArrayBuffer;
|
|
1198
|
-
sequence: number;
|
|
1199
|
-
witness: Array<ArrayBuffer>;
|
|
1200
|
-
};
|
|
1201
|
-
|
|
1202
|
-
/**
|
|
1203
|
-
* Generated factory for {@link TxInput} record objects.
|
|
1204
|
-
*/
|
|
1205
|
-
export const TxInput = (() => {
|
|
1206
|
-
const defaults = () => ({});
|
|
1207
|
-
const create = (() => {
|
|
1208
|
-
return uniffiCreateRecord<TxInput, ReturnType<typeof defaults>>(defaults);
|
|
1209
|
-
})();
|
|
1210
|
-
return Object.freeze({
|
|
1211
|
-
create,
|
|
1212
|
-
new: create,
|
|
1213
|
-
defaults: () => Object.freeze(defaults()) as Partial<TxInput>,
|
|
1214
|
-
});
|
|
1215
|
-
})();
|
|
1216
|
-
|
|
1217
|
-
const FfiConverterTypeTxInput = (() => {
|
|
1218
|
-
type TypeName = TxInput;
|
|
1219
|
-
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
1220
|
-
read(from: RustBuffer): TypeName {
|
|
1221
|
-
return {
|
|
1222
|
-
txid: FfiConverterString.read(from),
|
|
1223
|
-
vout: FfiConverterUInt32.read(from),
|
|
1224
|
-
scriptSig: FfiConverterArrayBuffer.read(from),
|
|
1225
|
-
sequence: FfiConverterUInt32.read(from),
|
|
1226
|
-
witness: FfiConverterSequenceBytes.read(from),
|
|
1227
|
-
};
|
|
1228
|
-
}
|
|
1229
|
-
write(value: TypeName, into: RustBuffer): void {
|
|
1230
|
-
FfiConverterString.write(value.txid, into);
|
|
1231
|
-
FfiConverterUInt32.write(value.vout, into);
|
|
1232
|
-
FfiConverterArrayBuffer.write(value.scriptSig, into);
|
|
1233
|
-
FfiConverterUInt32.write(value.sequence, into);
|
|
1234
|
-
FfiConverterSequenceBytes.write(value.witness, into);
|
|
1235
|
-
}
|
|
1236
|
-
allocationSize(value: TypeName): number {
|
|
1237
|
-
return (
|
|
1238
|
-
FfiConverterString.allocationSize(value.txid) +
|
|
1239
|
-
FfiConverterUInt32.allocationSize(value.vout) +
|
|
1240
|
-
FfiConverterArrayBuffer.allocationSize(value.scriptSig) +
|
|
1241
|
-
FfiConverterUInt32.allocationSize(value.sequence) +
|
|
1242
|
-
FfiConverterSequenceBytes.allocationSize(value.witness)
|
|
1943
|
+
FfiConverterUint8Array.allocationSize(value.scriptPubkey)
|
|
1243
1944
|
);
|
|
1244
1945
|
}
|
|
1245
1946
|
}
|
|
@@ -1251,7 +1952,7 @@ export type Transaction = {
|
|
|
1251
1952
|
lockTime: number;
|
|
1252
1953
|
inputs: Array<TxInput>;
|
|
1253
1954
|
outputs: Array<TxOutput>;
|
|
1254
|
-
rawBytes:
|
|
1955
|
+
rawBytes: Uint8Array;
|
|
1255
1956
|
};
|
|
1256
1957
|
|
|
1257
1958
|
/**
|
|
@@ -1270,8 +1971,8 @@ export const Transaction = (() => {
|
|
|
1270
1971
|
defaults: () => Object.freeze(defaults()) as Partial<Transaction>,
|
|
1271
1972
|
addSignature(
|
|
1272
1973
|
self_: Transaction,
|
|
1273
|
-
signature:
|
|
1274
|
-
pubkey:
|
|
1974
|
+
signature: Uint8Array,
|
|
1975
|
+
pubkey: Uint8Array,
|
|
1275
1976
|
inputIndex: number
|
|
1276
1977
|
): Transaction {
|
|
1277
1978
|
return ((__rb: Uint8Array) => {
|
|
@@ -1291,11 +1992,11 @@ export const Transaction = (() => {
|
|
|
1291
1992
|
self_,
|
|
1292
1993
|
nativeModule().rustbuffer_alloc
|
|
1293
1994
|
),
|
|
1294
|
-
|
|
1995
|
+
FfiConverterUint8Array.lower(
|
|
1295
1996
|
signature,
|
|
1296
1997
|
nativeModule().rustbuffer_alloc
|
|
1297
1998
|
),
|
|
1298
|
-
|
|
1999
|
+
FfiConverterUint8Array.lower(
|
|
1299
2000
|
pubkey,
|
|
1300
2001
|
nativeModule().rustbuffer_alloc
|
|
1301
2002
|
),
|
|
@@ -1313,10 +2014,10 @@ export const Transaction = (() => {
|
|
|
1313
2014
|
cetAdaptorSignatureFromOracleInfo(
|
|
1314
2015
|
self_: Transaction,
|
|
1315
2016
|
oracleInfo: OracleInfo,
|
|
1316
|
-
fundingSk:
|
|
1317
|
-
fundingScriptPubkey:
|
|
2017
|
+
fundingSk: Uint8Array,
|
|
2018
|
+
fundingScriptPubkey: Uint8Array,
|
|
1318
2019
|
totalCollateral: bigint,
|
|
1319
|
-
msgs: Array<
|
|
2020
|
+
msgs: Array<Uint8Array>
|
|
1320
2021
|
): AdaptorSignature {
|
|
1321
2022
|
return ((__rb: Uint8Array) => {
|
|
1322
2023
|
try {
|
|
@@ -1339,11 +2040,11 @@ export const Transaction = (() => {
|
|
|
1339
2040
|
oracleInfo,
|
|
1340
2041
|
nativeModule().rustbuffer_alloc
|
|
1341
2042
|
),
|
|
1342
|
-
|
|
2043
|
+
FfiConverterUint8Array.lower(
|
|
1343
2044
|
fundingSk,
|
|
1344
2045
|
nativeModule().rustbuffer_alloc
|
|
1345
2046
|
),
|
|
1346
|
-
|
|
2047
|
+
FfiConverterUint8Array.lower(
|
|
1347
2048
|
fundingScriptPubkey,
|
|
1348
2049
|
nativeModule().rustbuffer_alloc
|
|
1349
2050
|
),
|
|
@@ -1365,9 +2066,9 @@ export const Transaction = (() => {
|
|
|
1365
2066
|
cetAdaptorSignatureInputs(
|
|
1366
2067
|
self_: Transaction,
|
|
1367
2068
|
oracleInfo: Array<OracleInfo>,
|
|
1368
|
-
fundingScriptPubkey:
|
|
2069
|
+
fundingScriptPubkey: Uint8Array,
|
|
1369
2070
|
fundOutputValue: bigint,
|
|
1370
|
-
msgs: Array<Array<
|
|
2071
|
+
msgs: Array<Array<Uint8Array>>
|
|
1371
2072
|
): CetAdaptorSignatureDebugInfo {
|
|
1372
2073
|
return ((__rb: Uint8Array) => {
|
|
1373
2074
|
try {
|
|
@@ -1390,7 +2091,7 @@ export const Transaction = (() => {
|
|
|
1390
2091
|
oracleInfo,
|
|
1391
2092
|
nativeModule().rustbuffer_alloc
|
|
1392
2093
|
),
|
|
1393
|
-
|
|
2094
|
+
FfiConverterUint8Array.lower(
|
|
1394
2095
|
fundingScriptPubkey,
|
|
1395
2096
|
nativeModule().rustbuffer_alloc
|
|
1396
2097
|
),
|
|
@@ -1411,12 +2112,12 @@ export const Transaction = (() => {
|
|
|
1411
2112
|
},
|
|
1412
2113
|
cetSighash(
|
|
1413
2114
|
self_: Transaction,
|
|
1414
|
-
fundingScriptPubkey:
|
|
2115
|
+
fundingScriptPubkey: Uint8Array,
|
|
1415
2116
|
fundOutputValue: bigint
|
|
1416
|
-
):
|
|
2117
|
+
): Uint8Array {
|
|
1417
2118
|
return ((__rb: Uint8Array) => {
|
|
1418
2119
|
try {
|
|
1419
|
-
return
|
|
2120
|
+
return FfiConverterUint8Array.lift(__rb);
|
|
1420
2121
|
} finally {
|
|
1421
2122
|
nativeModule().rustbuffer_free(__rb);
|
|
1422
2123
|
}
|
|
@@ -1431,7 +2132,7 @@ export const Transaction = (() => {
|
|
|
1431
2132
|
self_,
|
|
1432
2133
|
nativeModule().rustbuffer_alloc
|
|
1433
2134
|
),
|
|
1434
|
-
|
|
2135
|
+
FfiConverterUint8Array.lower(
|
|
1435
2136
|
fundingScriptPubkey,
|
|
1436
2137
|
nativeModule().rustbuffer_alloc
|
|
1437
2138
|
),
|
|
@@ -1448,14 +2149,14 @@ export const Transaction = (() => {
|
|
|
1448
2149
|
},
|
|
1449
2150
|
rawFundingInputSignature(
|
|
1450
2151
|
self_: Transaction,
|
|
1451
|
-
privkey:
|
|
2152
|
+
privkey: Uint8Array,
|
|
1452
2153
|
prevTxId: string,
|
|
1453
2154
|
prevTxVout: number,
|
|
1454
2155
|
value: bigint
|
|
1455
|
-
):
|
|
2156
|
+
): Uint8Array {
|
|
1456
2157
|
return ((__rb: Uint8Array) => {
|
|
1457
2158
|
try {
|
|
1458
|
-
return
|
|
2159
|
+
return FfiConverterUint8Array.lift(__rb);
|
|
1459
2160
|
} finally {
|
|
1460
2161
|
nativeModule().rustbuffer_free(__rb);
|
|
1461
2162
|
}
|
|
@@ -1470,7 +2171,7 @@ export const Transaction = (() => {
|
|
|
1470
2171
|
self_,
|
|
1471
2172
|
nativeModule().rustbuffer_alloc
|
|
1472
2173
|
),
|
|
1473
|
-
|
|
2174
|
+
FfiConverterUint8Array.lower(
|
|
1474
2175
|
privkey,
|
|
1475
2176
|
nativeModule().rustbuffer_alloc
|
|
1476
2177
|
),
|
|
@@ -1492,11 +2193,11 @@ export const Transaction = (() => {
|
|
|
1492
2193
|
},
|
|
1493
2194
|
signCet(
|
|
1494
2195
|
self_: Transaction,
|
|
1495
|
-
adaptorSignature:
|
|
1496
|
-
oracleSignatures: Array<
|
|
1497
|
-
fundingSecretKey:
|
|
1498
|
-
otherPubkey:
|
|
1499
|
-
fundingScriptPubkey:
|
|
2196
|
+
adaptorSignature: Uint8Array,
|
|
2197
|
+
oracleSignatures: Array<Uint8Array>,
|
|
2198
|
+
fundingSecretKey: Uint8Array,
|
|
2199
|
+
otherPubkey: Uint8Array,
|
|
2200
|
+
fundingScriptPubkey: Uint8Array,
|
|
1500
2201
|
fundOutputValue: bigint
|
|
1501
2202
|
): Transaction {
|
|
1502
2203
|
return ((__rb: Uint8Array) => {
|
|
@@ -1516,7 +2217,7 @@ export const Transaction = (() => {
|
|
|
1516
2217
|
self_,
|
|
1517
2218
|
nativeModule().rustbuffer_alloc
|
|
1518
2219
|
),
|
|
1519
|
-
|
|
2220
|
+
FfiConverterUint8Array.lower(
|
|
1520
2221
|
adaptorSignature,
|
|
1521
2222
|
nativeModule().rustbuffer_alloc
|
|
1522
2223
|
),
|
|
@@ -1524,15 +2225,15 @@ export const Transaction = (() => {
|
|
|
1524
2225
|
oracleSignatures,
|
|
1525
2226
|
nativeModule().rustbuffer_alloc
|
|
1526
2227
|
),
|
|
1527
|
-
|
|
2228
|
+
FfiConverterUint8Array.lower(
|
|
1528
2229
|
fundingSecretKey,
|
|
1529
2230
|
nativeModule().rustbuffer_alloc
|
|
1530
2231
|
),
|
|
1531
|
-
|
|
2232
|
+
FfiConverterUint8Array.lower(
|
|
1532
2233
|
otherPubkey,
|
|
1533
2234
|
nativeModule().rustbuffer_alloc
|
|
1534
2235
|
),
|
|
1535
|
-
|
|
2236
|
+
FfiConverterUint8Array.lower(
|
|
1536
2237
|
fundingScriptPubkey,
|
|
1537
2238
|
nativeModule().rustbuffer_alloc
|
|
1538
2239
|
),
|
|
@@ -1549,7 +2250,7 @@ export const Transaction = (() => {
|
|
|
1549
2250
|
},
|
|
1550
2251
|
signFundInput(
|
|
1551
2252
|
self_: Transaction,
|
|
1552
|
-
privkey:
|
|
2253
|
+
privkey: Uint8Array,
|
|
1553
2254
|
prevTxId: string,
|
|
1554
2255
|
prevTxVout: number,
|
|
1555
2256
|
value: bigint
|
|
@@ -1571,7 +2272,7 @@ export const Transaction = (() => {
|
|
|
1571
2272
|
self_,
|
|
1572
2273
|
nativeModule().rustbuffer_alloc
|
|
1573
2274
|
),
|
|
1574
|
-
|
|
2275
|
+
FfiConverterUint8Array.lower(
|
|
1575
2276
|
privkey,
|
|
1576
2277
|
nativeModule().rustbuffer_alloc
|
|
1577
2278
|
),
|
|
@@ -1594,8 +2295,8 @@ export const Transaction = (() => {
|
|
|
1594
2295
|
signMultiSigInput(
|
|
1595
2296
|
self_: Transaction,
|
|
1596
2297
|
dlcInput: DlcInputInfo,
|
|
1597
|
-
localPrivkey:
|
|
1598
|
-
remoteSignature:
|
|
2298
|
+
localPrivkey: Uint8Array,
|
|
2299
|
+
remoteSignature: Uint8Array
|
|
1599
2300
|
): Transaction {
|
|
1600
2301
|
return ((__rb: Uint8Array) => {
|
|
1601
2302
|
try {
|
|
@@ -1618,11 +2319,11 @@ export const Transaction = (() => {
|
|
|
1618
2319
|
dlcInput,
|
|
1619
2320
|
nativeModule().rustbuffer_alloc
|
|
1620
2321
|
),
|
|
1621
|
-
|
|
2322
|
+
FfiConverterUint8Array.lower(
|
|
1622
2323
|
localPrivkey,
|
|
1623
2324
|
nativeModule().rustbuffer_alloc
|
|
1624
2325
|
),
|
|
1625
|
-
|
|
2326
|
+
FfiConverterUint8Array.lower(
|
|
1626
2327
|
remoteSignature,
|
|
1627
2328
|
nativeModule().rustbuffer_alloc
|
|
1628
2329
|
),
|
|
@@ -1635,8 +2336,8 @@ export const Transaction = (() => {
|
|
|
1635
2336
|
},
|
|
1636
2337
|
verifyFundSignature(
|
|
1637
2338
|
self_: Transaction,
|
|
1638
|
-
signature:
|
|
1639
|
-
pubkey:
|
|
2339
|
+
signature: Uint8Array,
|
|
2340
|
+
pubkey: Uint8Array,
|
|
1640
2341
|
txid: string,
|
|
1641
2342
|
vout: number,
|
|
1642
2343
|
inputAmount: bigint
|
|
@@ -1652,11 +2353,11 @@ export const Transaction = (() => {
|
|
|
1652
2353
|
self_,
|
|
1653
2354
|
nativeModule().rustbuffer_alloc
|
|
1654
2355
|
),
|
|
1655
|
-
|
|
2356
|
+
FfiConverterUint8Array.lower(
|
|
1656
2357
|
signature,
|
|
1657
2358
|
nativeModule().rustbuffer_alloc
|
|
1658
2359
|
),
|
|
1659
|
-
|
|
2360
|
+
FfiConverterUint8Array.lower(
|
|
1660
2361
|
pubkey,
|
|
1661
2362
|
nativeModule().rustbuffer_alloc
|
|
1662
2363
|
),
|
|
@@ -1685,7 +2386,7 @@ const FfiConverterTypeTransaction = (() => {
|
|
|
1685
2386
|
lockTime: FfiConverterUInt32.read(from),
|
|
1686
2387
|
inputs: FfiConverterSequenceTypeTxInput.read(from),
|
|
1687
2388
|
outputs: FfiConverterSequenceTypeTxOutput.read(from),
|
|
1688
|
-
rawBytes:
|
|
2389
|
+
rawBytes: FfiConverterUint8Array.read(from),
|
|
1689
2390
|
};
|
|
1690
2391
|
}
|
|
1691
2392
|
write(value: TypeName, into: RustBuffer): void {
|
|
@@ -1693,7 +2394,7 @@ const FfiConverterTypeTransaction = (() => {
|
|
|
1693
2394
|
FfiConverterUInt32.write(value.lockTime, into);
|
|
1694
2395
|
FfiConverterSequenceTypeTxInput.write(value.inputs, into);
|
|
1695
2396
|
FfiConverterSequenceTypeTxOutput.write(value.outputs, into);
|
|
1696
|
-
|
|
2397
|
+
FfiConverterUint8Array.write(value.rawBytes, into);
|
|
1697
2398
|
}
|
|
1698
2399
|
allocationSize(value: TypeName): number {
|
|
1699
2400
|
return (
|
|
@@ -1701,385 +2402,2127 @@ const FfiConverterTypeTransaction = (() => {
|
|
|
1701
2402
|
FfiConverterUInt32.allocationSize(value.lockTime) +
|
|
1702
2403
|
FfiConverterSequenceTypeTxInput.allocationSize(value.inputs) +
|
|
1703
2404
|
FfiConverterSequenceTypeTxOutput.allocationSize(value.outputs) +
|
|
1704
|
-
|
|
2405
|
+
FfiConverterUint8Array.allocationSize(value.rawBytes)
|
|
1705
2406
|
);
|
|
1706
2407
|
}
|
|
1707
2408
|
}
|
|
1708
2409
|
return new FFIConverter();
|
|
1709
2410
|
})();
|
|
1710
2411
|
|
|
1711
|
-
export type
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
fundAmount: bigint;
|
|
1717
|
-
maxWitnessLen: number;
|
|
1718
|
-
inputSerialId: bigint;
|
|
1719
|
-
contractId: ArrayBuffer;
|
|
2412
|
+
export type DlcTransactions = {
|
|
2413
|
+
fund: Transaction;
|
|
2414
|
+
cets: Array<Transaction>;
|
|
2415
|
+
refund: Transaction;
|
|
2416
|
+
fundingScriptPubkey: Uint8Array;
|
|
1720
2417
|
};
|
|
1721
2418
|
|
|
1722
2419
|
/**
|
|
1723
|
-
* Generated factory for {@link
|
|
2420
|
+
* Generated factory for {@link DlcTransactions} record objects.
|
|
1724
2421
|
*/
|
|
1725
|
-
export const
|
|
2422
|
+
export const DlcTransactions = (() => {
|
|
1726
2423
|
const defaults = () => ({});
|
|
1727
2424
|
const create = (() => {
|
|
1728
|
-
return uniffiCreateRecord<
|
|
2425
|
+
return uniffiCreateRecord<DlcTransactions, ReturnType<typeof defaults>>(
|
|
1729
2426
|
defaults
|
|
1730
2427
|
);
|
|
1731
2428
|
})();
|
|
1732
2429
|
return Object.freeze({
|
|
1733
2430
|
create,
|
|
1734
2431
|
new: create,
|
|
1735
|
-
defaults: () => Object.freeze(defaults()) as Partial<
|
|
2432
|
+
defaults: () => Object.freeze(defaults()) as Partial<DlcTransactions>,
|
|
1736
2433
|
});
|
|
1737
2434
|
})();
|
|
1738
2435
|
|
|
1739
|
-
const
|
|
1740
|
-
type TypeName =
|
|
2436
|
+
const FfiConverterTypeDlcTransactions = (() => {
|
|
2437
|
+
type TypeName = DlcTransactions;
|
|
1741
2438
|
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
1742
2439
|
read(from: RustBuffer): TypeName {
|
|
1743
2440
|
return {
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
fundAmount: FfiConverterUInt64.read(from),
|
|
1749
|
-
maxWitnessLen: FfiConverterUInt32.read(from),
|
|
1750
|
-
inputSerialId: FfiConverterUInt64.read(from),
|
|
1751
|
-
contractId: FfiConverterArrayBuffer.read(from),
|
|
2441
|
+
fund: FfiConverterTypeTransaction.read(from),
|
|
2442
|
+
cets: FfiConverterSequenceTypeTransaction.read(from),
|
|
2443
|
+
refund: FfiConverterTypeTransaction.read(from),
|
|
2444
|
+
fundingScriptPubkey: FfiConverterUint8Array.read(from),
|
|
1752
2445
|
};
|
|
1753
2446
|
}
|
|
1754
2447
|
write(value: TypeName, into: RustBuffer): void {
|
|
1755
|
-
FfiConverterTypeTransaction.write(value.
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
FfiConverterUInt64.write(value.inputSerialId, into);
|
|
1762
|
-
FfiConverterArrayBuffer.write(value.contractId, into);
|
|
1763
|
-
}
|
|
1764
|
-
allocationSize(value: TypeName): number {
|
|
2448
|
+
FfiConverterTypeTransaction.write(value.fund, into);
|
|
2449
|
+
FfiConverterSequenceTypeTransaction.write(value.cets, into);
|
|
2450
|
+
FfiConverterTypeTransaction.write(value.refund, into);
|
|
2451
|
+
FfiConverterUint8Array.write(value.fundingScriptPubkey, into);
|
|
2452
|
+
}
|
|
2453
|
+
allocationSize(value: TypeName): number {
|
|
1765
2454
|
return (
|
|
1766
|
-
FfiConverterTypeTransaction.allocationSize(value.
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
FfiConverterUInt64.allocationSize(value.fundAmount) +
|
|
1771
|
-
FfiConverterUInt32.allocationSize(value.maxWitnessLen) +
|
|
1772
|
-
FfiConverterUInt64.allocationSize(value.inputSerialId) +
|
|
1773
|
-
FfiConverterArrayBuffer.allocationSize(value.contractId)
|
|
2455
|
+
FfiConverterTypeTransaction.allocationSize(value.fund) +
|
|
2456
|
+
FfiConverterSequenceTypeTransaction.allocationSize(value.cets) +
|
|
2457
|
+
FfiConverterTypeTransaction.allocationSize(value.refund) +
|
|
2458
|
+
FfiConverterUint8Array.allocationSize(value.fundingScriptPubkey)
|
|
1774
2459
|
);
|
|
1775
2460
|
}
|
|
1776
2461
|
}
|
|
1777
2462
|
return new FFIConverter();
|
|
1778
2463
|
})();
|
|
1779
2464
|
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
2465
|
+
/**
|
|
2466
|
+
* The result of [`accept_offer`].
|
|
2467
|
+
*/
|
|
2468
|
+
export type AcceptResult = {
|
|
2469
|
+
/**
|
|
2470
|
+
* The wire-encoded `AcceptDlc` message to send to the offering party.
|
|
2471
|
+
*/
|
|
2472
|
+
accept: Uint8Array;
|
|
2473
|
+
/**
|
|
2474
|
+
* The unsigned funding, CET, and refund transactions.
|
|
2475
|
+
*/
|
|
2476
|
+
transactions: DlcTransactions;
|
|
2477
|
+
/**
|
|
2478
|
+
* The BIP-174 funding PSBT ready to be signed by either party's funding source.
|
|
2479
|
+
*/
|
|
2480
|
+
fundingPsbt: Uint8Array;
|
|
1785
2481
|
};
|
|
1786
2482
|
|
|
1787
2483
|
/**
|
|
1788
|
-
* Generated factory for {@link
|
|
2484
|
+
* Generated factory for {@link AcceptResult} record objects.
|
|
1789
2485
|
*/
|
|
1790
|
-
export const
|
|
2486
|
+
export const AcceptResult = (() => {
|
|
1791
2487
|
const defaults = () => ({});
|
|
1792
2488
|
const create = (() => {
|
|
1793
|
-
return uniffiCreateRecord<
|
|
2489
|
+
return uniffiCreateRecord<AcceptResult, ReturnType<typeof defaults>>(
|
|
1794
2490
|
defaults
|
|
1795
2491
|
);
|
|
1796
2492
|
})();
|
|
1797
2493
|
return Object.freeze({
|
|
1798
2494
|
create,
|
|
1799
2495
|
new: create,
|
|
1800
|
-
defaults: () => Object.freeze(defaults()) as Partial<
|
|
2496
|
+
defaults: () => Object.freeze(defaults()) as Partial<AcceptResult>,
|
|
1801
2497
|
});
|
|
1802
2498
|
})();
|
|
1803
2499
|
|
|
1804
|
-
const
|
|
1805
|
-
type TypeName =
|
|
2500
|
+
const FfiConverterTypeAcceptResult = (() => {
|
|
2501
|
+
type TypeName = AcceptResult;
|
|
1806
2502
|
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
1807
2503
|
read(from: RustBuffer): TypeName {
|
|
1808
2504
|
return {
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
fundingScriptPubkey: FfiConverterArrayBuffer.read(from),
|
|
2505
|
+
accept: FfiConverterUint8Array.read(from),
|
|
2506
|
+
transactions: FfiConverterTypeDlcTransactions.read(from),
|
|
2507
|
+
fundingPsbt: FfiConverterUint8Array.read(from),
|
|
1813
2508
|
};
|
|
1814
2509
|
}
|
|
1815
2510
|
write(value: TypeName, into: RustBuffer): void {
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
FfiConverterArrayBuffer.write(value.fundingScriptPubkey, into);
|
|
2511
|
+
FfiConverterUint8Array.write(value.accept, into);
|
|
2512
|
+
FfiConverterTypeDlcTransactions.write(value.transactions, into);
|
|
2513
|
+
FfiConverterUint8Array.write(value.fundingPsbt, into);
|
|
1820
2514
|
}
|
|
1821
2515
|
allocationSize(value: TypeName): number {
|
|
1822
2516
|
return (
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
FfiConverterArrayBuffer.allocationSize(value.fundingScriptPubkey)
|
|
2517
|
+
FfiConverterUint8Array.allocationSize(value.accept) +
|
|
2518
|
+
FfiConverterTypeDlcTransactions.allocationSize(value.transactions) +
|
|
2519
|
+
FfiConverterUint8Array.allocationSize(value.fundingPsbt)
|
|
1827
2520
|
);
|
|
1828
2521
|
}
|
|
1829
2522
|
}
|
|
1830
2523
|
return new FFIConverter();
|
|
1831
2524
|
})();
|
|
1832
2525
|
|
|
1833
|
-
export type
|
|
1834
|
-
|
|
1835
|
-
|
|
2526
|
+
export type AdaptorSignature = {
|
|
2527
|
+
signature: Uint8Array;
|
|
2528
|
+
proof: Uint8Array;
|
|
1836
2529
|
};
|
|
1837
2530
|
|
|
1838
2531
|
/**
|
|
1839
|
-
* Generated factory for {@link
|
|
2532
|
+
* Generated factory for {@link AdaptorSignature} record objects.
|
|
1840
2533
|
*/
|
|
1841
|
-
export const
|
|
2534
|
+
export const AdaptorSignature = (() => {
|
|
1842
2535
|
const defaults = () => ({});
|
|
1843
2536
|
const create = (() => {
|
|
1844
|
-
return uniffiCreateRecord<
|
|
2537
|
+
return uniffiCreateRecord<AdaptorSignature, ReturnType<typeof defaults>>(
|
|
1845
2538
|
defaults
|
|
1846
2539
|
);
|
|
1847
2540
|
})();
|
|
1848
2541
|
return Object.freeze({
|
|
1849
2542
|
create,
|
|
1850
2543
|
new: create,
|
|
1851
|
-
defaults: () => Object.freeze(defaults()) as Partial<
|
|
2544
|
+
defaults: () => Object.freeze(defaults()) as Partial<AdaptorSignature>,
|
|
2545
|
+
verifyFromOracleInfo(
|
|
2546
|
+
self_: AdaptorSignature,
|
|
2547
|
+
cet: Transaction,
|
|
2548
|
+
oracleInfos: Array<OracleInfo>,
|
|
2549
|
+
pubkey: Uint8Array,
|
|
2550
|
+
fundingScriptPubkey: Uint8Array,
|
|
2551
|
+
totalCollateral: bigint,
|
|
2552
|
+
msgs: Array<Array<Uint8Array>>
|
|
2553
|
+
): boolean {
|
|
2554
|
+
return FfiConverterBool.lift(
|
|
2555
|
+
uniffiCaller.rustCall(
|
|
2556
|
+
/*caller:*/ (callStatus) => {
|
|
2557
|
+
return nativeModule().ubrn_uniffi_ddk_ffi_fn_method_adaptorsignature_verify_from_oracle_info(
|
|
2558
|
+
FfiConverterTypeAdaptorSignature.lower(
|
|
2559
|
+
self_,
|
|
2560
|
+
nativeModule().rustbuffer_alloc
|
|
2561
|
+
),
|
|
2562
|
+
FfiConverterTypeTransaction.lower(
|
|
2563
|
+
cet,
|
|
2564
|
+
nativeModule().rustbuffer_alloc
|
|
2565
|
+
),
|
|
2566
|
+
FfiConverterSequenceTypeOracleInfo.lower(
|
|
2567
|
+
oracleInfos,
|
|
2568
|
+
nativeModule().rustbuffer_alloc
|
|
2569
|
+
),
|
|
2570
|
+
FfiConverterUint8Array.lower(
|
|
2571
|
+
pubkey,
|
|
2572
|
+
nativeModule().rustbuffer_alloc
|
|
2573
|
+
),
|
|
2574
|
+
FfiConverterUint8Array.lower(
|
|
2575
|
+
fundingScriptPubkey,
|
|
2576
|
+
nativeModule().rustbuffer_alloc
|
|
2577
|
+
),
|
|
2578
|
+
FfiConverterUInt64.lower(
|
|
2579
|
+
totalCollateral,
|
|
2580
|
+
nativeModule().rustbuffer_alloc
|
|
2581
|
+
),
|
|
2582
|
+
FfiConverterSequenceSequenceBytes.lower(
|
|
2583
|
+
msgs,
|
|
2584
|
+
nativeModule().rustbuffer_alloc
|
|
2585
|
+
),
|
|
2586
|
+
callStatus
|
|
2587
|
+
);
|
|
2588
|
+
},
|
|
2589
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)
|
|
2590
|
+
)
|
|
2591
|
+
);
|
|
2592
|
+
},
|
|
1852
2593
|
});
|
|
1853
2594
|
})();
|
|
1854
2595
|
|
|
1855
|
-
const
|
|
1856
|
-
type TypeName =
|
|
2596
|
+
const FfiConverterTypeAdaptorSignature = (() => {
|
|
2597
|
+
type TypeName = AdaptorSignature;
|
|
1857
2598
|
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
1858
2599
|
read(from: RustBuffer): TypeName {
|
|
1859
2600
|
return {
|
|
1860
|
-
|
|
1861
|
-
|
|
2601
|
+
signature: FfiConverterUint8Array.read(from),
|
|
2602
|
+
proof: FfiConverterUint8Array.read(from),
|
|
1862
2603
|
};
|
|
1863
2604
|
}
|
|
1864
2605
|
write(value: TypeName, into: RustBuffer): void {
|
|
1865
|
-
|
|
1866
|
-
|
|
2606
|
+
FfiConverterUint8Array.write(value.signature, into);
|
|
2607
|
+
FfiConverterUint8Array.write(value.proof, into);
|
|
1867
2608
|
}
|
|
1868
2609
|
allocationSize(value: TypeName): number {
|
|
1869
2610
|
return (
|
|
1870
|
-
|
|
1871
|
-
|
|
2611
|
+
FfiConverterUint8Array.allocationSize(value.signature) +
|
|
2612
|
+
FfiConverterUint8Array.allocationSize(value.proof)
|
|
1872
2613
|
);
|
|
1873
2614
|
}
|
|
1874
2615
|
}
|
|
1875
2616
|
return new FFIConverter();
|
|
1876
2617
|
})();
|
|
1877
2618
|
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
2619
|
+
/**
|
|
2620
|
+
* Debug info for CET adaptor signature inputs.
|
|
2621
|
+
*
|
|
2622
|
+
* Contains all the values that go into creating an adaptor signature,
|
|
2623
|
+
* useful for comparing with external signers during debugging.
|
|
2624
|
+
*
|
|
2625
|
+
* This struct is intentionally always available (not feature-gated)
|
|
2626
|
+
* to support production debugging scenarios.
|
|
2627
|
+
*/
|
|
2628
|
+
export type CetAdaptorSignatureDebugInfo = {
|
|
2629
|
+
/**
|
|
2630
|
+
* The sighash (32 bytes) - this is the message that gets signed
|
|
2631
|
+
*/
|
|
2632
|
+
sighash: Uint8Array;
|
|
2633
|
+
/**
|
|
2634
|
+
* The adaptor point (33 bytes compressed public key)
|
|
2635
|
+
*/
|
|
2636
|
+
adaptorPoint: Uint8Array;
|
|
2637
|
+
/**
|
|
2638
|
+
* Input index (always 0 for CETs)
|
|
2639
|
+
*/
|
|
2640
|
+
inputIndex: number;
|
|
2641
|
+
/**
|
|
2642
|
+
* The funding script pubkey used for sighash
|
|
2643
|
+
*/
|
|
2644
|
+
scriptPubkey: Uint8Array;
|
|
2645
|
+
/**
|
|
2646
|
+
* The fund output value used for sighash
|
|
2647
|
+
*/
|
|
2648
|
+
value: bigint;
|
|
2649
|
+
/**
|
|
2650
|
+
* The CET txid
|
|
2651
|
+
*/
|
|
2652
|
+
cetTxid: string;
|
|
2653
|
+
/**
|
|
2654
|
+
* Raw CET bytes for verification
|
|
2655
|
+
*/
|
|
2656
|
+
cetRaw: Uint8Array;
|
|
1884
2657
|
};
|
|
1885
2658
|
|
|
1886
2659
|
/**
|
|
1887
|
-
* Generated factory for {@link
|
|
2660
|
+
* Generated factory for {@link CetAdaptorSignatureDebugInfo} record objects.
|
|
1888
2661
|
*/
|
|
1889
|
-
export const
|
|
2662
|
+
export const CetAdaptorSignatureDebugInfo = (() => {
|
|
1890
2663
|
const defaults = () => ({});
|
|
1891
2664
|
const create = (() => {
|
|
1892
|
-
return uniffiCreateRecord<
|
|
1893
|
-
|
|
1894
|
-
|
|
2665
|
+
return uniffiCreateRecord<
|
|
2666
|
+
CetAdaptorSignatureDebugInfo,
|
|
2667
|
+
ReturnType<typeof defaults>
|
|
2668
|
+
>(defaults);
|
|
1895
2669
|
})();
|
|
1896
2670
|
return Object.freeze({
|
|
1897
2671
|
create,
|
|
1898
2672
|
new: create,
|
|
1899
|
-
defaults: () =>
|
|
2673
|
+
defaults: () =>
|
|
2674
|
+
Object.freeze(defaults()) as Partial<CetAdaptorSignatureDebugInfo>,
|
|
1900
2675
|
});
|
|
1901
2676
|
})();
|
|
1902
2677
|
|
|
1903
|
-
const
|
|
1904
|
-
type TypeName =
|
|
2678
|
+
const FfiConverterTypeCetAdaptorSignatureDebugInfo = (() => {
|
|
2679
|
+
type TypeName = CetAdaptorSignatureDebugInfo;
|
|
1905
2680
|
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
1906
2681
|
read(from: RustBuffer): TypeName {
|
|
1907
2682
|
return {
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
2683
|
+
sighash: FfiConverterUint8Array.read(from),
|
|
2684
|
+
adaptorPoint: FfiConverterUint8Array.read(from),
|
|
2685
|
+
inputIndex: FfiConverterUInt32.read(from),
|
|
2686
|
+
scriptPubkey: FfiConverterUint8Array.read(from),
|
|
2687
|
+
value: FfiConverterUInt64.read(from),
|
|
2688
|
+
cetTxid: FfiConverterString.read(from),
|
|
2689
|
+
cetRaw: FfiConverterUint8Array.read(from),
|
|
1913
2690
|
};
|
|
1914
2691
|
}
|
|
1915
2692
|
write(value: TypeName, into: RustBuffer): void {
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
FfiConverterUInt64.write(value.
|
|
2693
|
+
FfiConverterUint8Array.write(value.sighash, into);
|
|
2694
|
+
FfiConverterUint8Array.write(value.adaptorPoint, into);
|
|
2695
|
+
FfiConverterUInt32.write(value.inputIndex, into);
|
|
2696
|
+
FfiConverterUint8Array.write(value.scriptPubkey, into);
|
|
2697
|
+
FfiConverterUInt64.write(value.value, into);
|
|
2698
|
+
FfiConverterString.write(value.cetTxid, into);
|
|
2699
|
+
FfiConverterUint8Array.write(value.cetRaw, into);
|
|
1921
2700
|
}
|
|
1922
2701
|
allocationSize(value: TypeName): number {
|
|
1923
2702
|
return (
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
FfiConverterUInt64.allocationSize(value.
|
|
2703
|
+
FfiConverterUint8Array.allocationSize(value.sighash) +
|
|
2704
|
+
FfiConverterUint8Array.allocationSize(value.adaptorPoint) +
|
|
2705
|
+
FfiConverterUInt32.allocationSize(value.inputIndex) +
|
|
2706
|
+
FfiConverterUint8Array.allocationSize(value.scriptPubkey) +
|
|
2707
|
+
FfiConverterUInt64.allocationSize(value.value) +
|
|
2708
|
+
FfiConverterString.allocationSize(value.cetTxid) +
|
|
2709
|
+
FfiConverterUint8Array.allocationSize(value.cetRaw)
|
|
1929
2710
|
);
|
|
1930
2711
|
}
|
|
1931
2712
|
}
|
|
1932
2713
|
return new FFIConverter();
|
|
1933
2714
|
})();
|
|
1934
2715
|
|
|
1935
|
-
export type
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
payoutScriptPubkey: ArrayBuffer;
|
|
1940
|
-
payoutSerialId: bigint;
|
|
1941
|
-
inputs: Array<TxInputInfo>;
|
|
1942
|
-
inputAmount: bigint;
|
|
1943
|
-
collateral: bigint;
|
|
1944
|
-
dlcInputs: Array<DlcInputInfo>;
|
|
2716
|
+
export type ChangeOutputAndFees = {
|
|
2717
|
+
changeOutput: TxOutput;
|
|
2718
|
+
fundFee: bigint;
|
|
2719
|
+
cetFee: bigint;
|
|
1945
2720
|
};
|
|
1946
2721
|
|
|
1947
2722
|
/**
|
|
1948
|
-
* Generated factory for {@link
|
|
2723
|
+
* Generated factory for {@link ChangeOutputAndFees} record objects.
|
|
1949
2724
|
*/
|
|
1950
|
-
export const
|
|
2725
|
+
export const ChangeOutputAndFees = (() => {
|
|
1951
2726
|
const defaults = () => ({});
|
|
1952
2727
|
const create = (() => {
|
|
1953
|
-
return uniffiCreateRecord<
|
|
2728
|
+
return uniffiCreateRecord<ChangeOutputAndFees, ReturnType<typeof defaults>>(
|
|
1954
2729
|
defaults
|
|
1955
2730
|
);
|
|
1956
2731
|
})();
|
|
1957
2732
|
return Object.freeze({
|
|
1958
2733
|
create,
|
|
1959
2734
|
new: create,
|
|
1960
|
-
defaults: () => Object.freeze(defaults()) as Partial<
|
|
1961
|
-
changeOutputAndFees(
|
|
1962
|
-
self_: PartyParams,
|
|
1963
|
-
feeRate: bigint
|
|
1964
|
-
): ChangeOutputAndFees {
|
|
1965
|
-
return ((__rb: Uint8Array) => {
|
|
1966
|
-
try {
|
|
1967
|
-
return FfiConverterTypeChangeOutputAndFees.lift(__rb);
|
|
1968
|
-
} finally {
|
|
1969
|
-
nativeModule().rustbuffer_free(__rb);
|
|
1970
|
-
}
|
|
1971
|
-
})(
|
|
1972
|
-
uniffiCaller.rustCallWithError(
|
|
1973
|
-
/*liftError:*/ FfiConverterTypeDLCError.lift.bind(
|
|
1974
|
-
FfiConverterTypeDLCError
|
|
1975
|
-
),
|
|
1976
|
-
/*caller:*/ (callStatus) => {
|
|
1977
|
-
return nativeModule().ubrn_uniffi_ddk_ffi_fn_method_partyparams_change_output_and_fees(
|
|
1978
|
-
FfiConverterTypePartyParams.lower(
|
|
1979
|
-
self_,
|
|
1980
|
-
nativeModule().rustbuffer_alloc
|
|
1981
|
-
),
|
|
1982
|
-
FfiConverterUInt64.lower(
|
|
1983
|
-
feeRate,
|
|
1984
|
-
nativeModule().rustbuffer_alloc
|
|
1985
|
-
),
|
|
1986
|
-
callStatus
|
|
1987
|
-
);
|
|
1988
|
-
},
|
|
1989
|
-
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)
|
|
1990
|
-
)
|
|
1991
|
-
);
|
|
1992
|
-
},
|
|
2735
|
+
defaults: () => Object.freeze(defaults()) as Partial<ChangeOutputAndFees>,
|
|
1993
2736
|
});
|
|
1994
2737
|
})();
|
|
1995
2738
|
|
|
1996
|
-
const
|
|
1997
|
-
type TypeName =
|
|
2739
|
+
const FfiConverterTypeChangeOutputAndFees = (() => {
|
|
2740
|
+
type TypeName = ChangeOutputAndFees;
|
|
1998
2741
|
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
1999
2742
|
read(from: RustBuffer): TypeName {
|
|
2000
2743
|
return {
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
payoutScriptPubkey: FfiConverterArrayBuffer.read(from),
|
|
2005
|
-
payoutSerialId: FfiConverterUInt64.read(from),
|
|
2006
|
-
inputs: FfiConverterSequenceTypeTxInputInfo.read(from),
|
|
2007
|
-
inputAmount: FfiConverterUInt64.read(from),
|
|
2008
|
-
collateral: FfiConverterUInt64.read(from),
|
|
2009
|
-
dlcInputs: FfiConverterSequenceTypeDlcInputInfo.read(from),
|
|
2744
|
+
changeOutput: FfiConverterTypeTxOutput.read(from),
|
|
2745
|
+
fundFee: FfiConverterUInt64.read(from),
|
|
2746
|
+
cetFee: FfiConverterUInt64.read(from),
|
|
2010
2747
|
};
|
|
2011
2748
|
}
|
|
2012
2749
|
write(value: TypeName, into: RustBuffer): void {
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
FfiConverterUInt64.write(value.
|
|
2016
|
-
FfiConverterArrayBuffer.write(value.payoutScriptPubkey, into);
|
|
2017
|
-
FfiConverterUInt64.write(value.payoutSerialId, into);
|
|
2018
|
-
FfiConverterSequenceTypeTxInputInfo.write(value.inputs, into);
|
|
2019
|
-
FfiConverterUInt64.write(value.inputAmount, into);
|
|
2020
|
-
FfiConverterUInt64.write(value.collateral, into);
|
|
2021
|
-
FfiConverterSequenceTypeDlcInputInfo.write(value.dlcInputs, into);
|
|
2750
|
+
FfiConverterTypeTxOutput.write(value.changeOutput, into);
|
|
2751
|
+
FfiConverterUInt64.write(value.fundFee, into);
|
|
2752
|
+
FfiConverterUInt64.write(value.cetFee, into);
|
|
2022
2753
|
}
|
|
2023
2754
|
allocationSize(value: TypeName): number {
|
|
2024
2755
|
return (
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
FfiConverterUInt64.allocationSize(value.
|
|
2028
|
-
FfiConverterArrayBuffer.allocationSize(value.payoutScriptPubkey) +
|
|
2029
|
-
FfiConverterUInt64.allocationSize(value.payoutSerialId) +
|
|
2030
|
-
FfiConverterSequenceTypeTxInputInfo.allocationSize(value.inputs) +
|
|
2031
|
-
FfiConverterUInt64.allocationSize(value.inputAmount) +
|
|
2032
|
-
FfiConverterUInt64.allocationSize(value.collateral) +
|
|
2033
|
-
FfiConverterSequenceTypeDlcInputInfo.allocationSize(value.dlcInputs)
|
|
2756
|
+
FfiConverterTypeTxOutput.allocationSize(value.changeOutput) +
|
|
2757
|
+
FfiConverterUInt64.allocationSize(value.fundFee) +
|
|
2758
|
+
FfiConverterUInt64.allocationSize(value.cetFee)
|
|
2034
2759
|
);
|
|
2035
2760
|
}
|
|
2036
2761
|
}
|
|
2037
2762
|
return new FFIConverter();
|
|
2038
2763
|
})();
|
|
2039
2764
|
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2765
|
+
/**
|
|
2766
|
+
* One row of a contract's payout table.
|
|
2767
|
+
*
|
|
2768
|
+
* Enum-contract rows carry an `outcome` label; numeric-contract rows carry an
|
|
2769
|
+
* inclusive `[range_start, range_end]` of outcome values that share the payout.
|
|
2770
|
+
*/
|
|
2771
|
+
export type PayoutRow = {
|
|
2772
|
+
/**
|
|
2773
|
+
* The outcome label (enum contracts only; `None` for numeric).
|
|
2774
|
+
*/
|
|
2775
|
+
outcome?: string;
|
|
2776
|
+
/**
|
|
2777
|
+
* Inclusive start of the outcome range (numeric contracts only; `None` for enum).
|
|
2778
|
+
*/
|
|
2779
|
+
rangeStart?: bigint;
|
|
2780
|
+
/**
|
|
2781
|
+
* Inclusive end of the outcome range (numeric contracts only; `None` for enum).
|
|
2782
|
+
*/
|
|
2783
|
+
rangeEnd?: bigint;
|
|
2784
|
+
/**
|
|
2785
|
+
* The payout to the offering party, in satoshis.
|
|
2786
|
+
*/
|
|
2787
|
+
offerPayoutSats: bigint;
|
|
2788
|
+
/**
|
|
2789
|
+
* The payout to the accepting party, in satoshis.
|
|
2790
|
+
*/
|
|
2791
|
+
acceptPayoutSats: bigint;
|
|
2043
2792
|
};
|
|
2044
2793
|
|
|
2045
2794
|
/**
|
|
2046
|
-
* Generated factory for {@link
|
|
2795
|
+
* Generated factory for {@link PayoutRow} record objects.
|
|
2047
2796
|
*/
|
|
2048
|
-
export const
|
|
2797
|
+
export const PayoutRow = (() => {
|
|
2049
2798
|
const defaults = () => ({});
|
|
2050
2799
|
const create = (() => {
|
|
2051
|
-
return uniffiCreateRecord<
|
|
2800
|
+
return uniffiCreateRecord<PayoutRow, ReturnType<typeof defaults>>(defaults);
|
|
2052
2801
|
})();
|
|
2053
2802
|
return Object.freeze({
|
|
2054
2803
|
create,
|
|
2055
2804
|
new: create,
|
|
2056
|
-
defaults: () => Object.freeze(defaults()) as Partial<
|
|
2805
|
+
defaults: () => Object.freeze(defaults()) as Partial<PayoutRow>,
|
|
2057
2806
|
});
|
|
2058
2807
|
})();
|
|
2059
2808
|
|
|
2060
|
-
const
|
|
2061
|
-
type TypeName =
|
|
2809
|
+
const FfiConverterTypePayoutRow = (() => {
|
|
2810
|
+
type TypeName = PayoutRow;
|
|
2062
2811
|
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
2063
2812
|
read(from: RustBuffer): TypeName {
|
|
2064
2813
|
return {
|
|
2065
|
-
|
|
2066
|
-
|
|
2814
|
+
outcome: FfiConverterOptionalString.read(from),
|
|
2815
|
+
rangeStart: FfiConverterOptionalUInt64.read(from),
|
|
2816
|
+
rangeEnd: FfiConverterOptionalUInt64.read(from),
|
|
2817
|
+
offerPayoutSats: FfiConverterUInt64.read(from),
|
|
2818
|
+
acceptPayoutSats: FfiConverterUInt64.read(from),
|
|
2067
2819
|
};
|
|
2068
2820
|
}
|
|
2069
2821
|
write(value: TypeName, into: RustBuffer): void {
|
|
2070
|
-
|
|
2071
|
-
|
|
2822
|
+
FfiConverterOptionalString.write(value.outcome, into);
|
|
2823
|
+
FfiConverterOptionalUInt64.write(value.rangeStart, into);
|
|
2824
|
+
FfiConverterOptionalUInt64.write(value.rangeEnd, into);
|
|
2825
|
+
FfiConverterUInt64.write(value.offerPayoutSats, into);
|
|
2826
|
+
FfiConverterUInt64.write(value.acceptPayoutSats, into);
|
|
2072
2827
|
}
|
|
2073
2828
|
allocationSize(value: TypeName): number {
|
|
2074
2829
|
return (
|
|
2075
|
-
|
|
2076
|
-
|
|
2830
|
+
FfiConverterOptionalString.allocationSize(value.outcome) +
|
|
2831
|
+
FfiConverterOptionalUInt64.allocationSize(value.rangeStart) +
|
|
2832
|
+
FfiConverterOptionalUInt64.allocationSize(value.rangeEnd) +
|
|
2833
|
+
FfiConverterUInt64.allocationSize(value.offerPayoutSats) +
|
|
2834
|
+
FfiConverterUInt64.allocationSize(value.acceptPayoutSats)
|
|
2835
|
+
);
|
|
2836
|
+
}
|
|
2837
|
+
}
|
|
2838
|
+
return new FFIConverter();
|
|
2839
|
+
})();
|
|
2840
|
+
|
|
2841
|
+
/**
|
|
2842
|
+
* A contract's payouts, derived from its `ContractInfo`, for display as a table.
|
|
2843
|
+
*/
|
|
2844
|
+
export type ContractPayouts = {
|
|
2845
|
+
/**
|
|
2846
|
+
* Total collateral (offer + accept), in satoshis.
|
|
2847
|
+
*/
|
|
2848
|
+
totalCollateralSats: bigint;
|
|
2849
|
+
/**
|
|
2850
|
+
* `true` for enum contracts (rows are labeled outcomes); `false` for numeric
|
|
2851
|
+
* contracts (rows are outcome ranges).
|
|
2852
|
+
*/
|
|
2853
|
+
isEnum: boolean;
|
|
2854
|
+
/**
|
|
2855
|
+
* The payout rows, in outcome order.
|
|
2856
|
+
*/
|
|
2857
|
+
rows: Array<PayoutRow>;
|
|
2858
|
+
};
|
|
2859
|
+
|
|
2860
|
+
/**
|
|
2861
|
+
* Generated factory for {@link ContractPayouts} record objects.
|
|
2862
|
+
*/
|
|
2863
|
+
export const ContractPayouts = (() => {
|
|
2864
|
+
const defaults = () => ({});
|
|
2865
|
+
const create = (() => {
|
|
2866
|
+
return uniffiCreateRecord<ContractPayouts, ReturnType<typeof defaults>>(
|
|
2867
|
+
defaults
|
|
2868
|
+
);
|
|
2869
|
+
})();
|
|
2870
|
+
return Object.freeze({
|
|
2871
|
+
create,
|
|
2872
|
+
new: create,
|
|
2873
|
+
defaults: () => Object.freeze(defaults()) as Partial<ContractPayouts>,
|
|
2874
|
+
});
|
|
2875
|
+
})();
|
|
2876
|
+
|
|
2877
|
+
const FfiConverterTypeContractPayouts = (() => {
|
|
2878
|
+
type TypeName = ContractPayouts;
|
|
2879
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
2880
|
+
read(from: RustBuffer): TypeName {
|
|
2881
|
+
return {
|
|
2882
|
+
totalCollateralSats: FfiConverterUInt64.read(from),
|
|
2883
|
+
isEnum: FfiConverterBool.read(from),
|
|
2884
|
+
rows: FfiConverterSequenceTypePayoutRow.read(from),
|
|
2885
|
+
};
|
|
2886
|
+
}
|
|
2887
|
+
write(value: TypeName, into: RustBuffer): void {
|
|
2888
|
+
FfiConverterUInt64.write(value.totalCollateralSats, into);
|
|
2889
|
+
FfiConverterBool.write(value.isEnum, into);
|
|
2890
|
+
FfiConverterSequenceTypePayoutRow.write(value.rows, into);
|
|
2891
|
+
}
|
|
2892
|
+
allocationSize(value: TypeName): number {
|
|
2893
|
+
return (
|
|
2894
|
+
FfiConverterUInt64.allocationSize(value.totalCollateralSats) +
|
|
2895
|
+
FfiConverterBool.allocationSize(value.isEnum) +
|
|
2896
|
+
FfiConverterSequenceTypePayoutRow.allocationSize(value.rows)
|
|
2897
|
+
);
|
|
2898
|
+
}
|
|
2899
|
+
}
|
|
2900
|
+
return new FFIConverter();
|
|
2901
|
+
})();
|
|
2902
|
+
|
|
2903
|
+
/**
|
|
2904
|
+
* Parameters for [`create_offer`] (mirrors [`ddk::contract::CreateOfferParams`]).
|
|
2905
|
+
*/
|
|
2906
|
+
export type CreateOfferParams = {
|
|
2907
|
+
/**
|
|
2908
|
+
* The 32-byte chain hash the contract settles on.
|
|
2909
|
+
*/
|
|
2910
|
+
chainHash: Uint8Array;
|
|
2911
|
+
/**
|
|
2912
|
+
* The 32-byte temporary contract id; randomly generated when `None`.
|
|
2913
|
+
*/
|
|
2914
|
+
temporaryContractId?: Uint8Array;
|
|
2915
|
+
/**
|
|
2916
|
+
* The contract payout and oracle information, wire-encoded `ContractInfo`.
|
|
2917
|
+
*/
|
|
2918
|
+
contractInfo: Uint8Array;
|
|
2919
|
+
/**
|
|
2920
|
+
* The collateral, in satoshis, contributed by the offering party.
|
|
2921
|
+
*/
|
|
2922
|
+
offerCollateralSats: bigint;
|
|
2923
|
+
/**
|
|
2924
|
+
* The offering party's Bitcoin-level contract data.
|
|
2925
|
+
*/
|
|
2926
|
+
party: ContractPartyParams;
|
|
2927
|
+
/**
|
|
2928
|
+
* Serial id ordering the funding output; randomly generated when `None`.
|
|
2929
|
+
*/
|
|
2930
|
+
fundOutputSerialId?: bigint;
|
|
2931
|
+
/**
|
|
2932
|
+
* The fee rate, in satoshis per virtual byte.
|
|
2933
|
+
*/
|
|
2934
|
+
feeRatePerVb: bigint;
|
|
2935
|
+
/**
|
|
2936
|
+
* The earliest time CETs can be broadcast.
|
|
2937
|
+
*/
|
|
2938
|
+
cetLocktime: number;
|
|
2939
|
+
/**
|
|
2940
|
+
* The time after which the refund transaction can be broadcast.
|
|
2941
|
+
*/
|
|
2942
|
+
refundLocktime: number;
|
|
2943
|
+
/**
|
|
2944
|
+
* Contract feature flags. Use `0` unless a protocol extension requires otherwise.
|
|
2945
|
+
*/
|
|
2946
|
+
contractFlags: number;
|
|
2947
|
+
};
|
|
2948
|
+
|
|
2949
|
+
/**
|
|
2950
|
+
* Generated factory for {@link CreateOfferParams} record objects.
|
|
2951
|
+
*/
|
|
2952
|
+
export const CreateOfferParams = (() => {
|
|
2953
|
+
const defaults = () => ({});
|
|
2954
|
+
const create = (() => {
|
|
2955
|
+
return uniffiCreateRecord<CreateOfferParams, ReturnType<typeof defaults>>(
|
|
2956
|
+
defaults
|
|
2957
|
+
);
|
|
2958
|
+
})();
|
|
2959
|
+
return Object.freeze({
|
|
2960
|
+
create,
|
|
2961
|
+
new: create,
|
|
2962
|
+
defaults: () => Object.freeze(defaults()) as Partial<CreateOfferParams>,
|
|
2963
|
+
});
|
|
2964
|
+
})();
|
|
2965
|
+
|
|
2966
|
+
const FfiConverterTypeCreateOfferParams = (() => {
|
|
2967
|
+
type TypeName = CreateOfferParams;
|
|
2968
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
2969
|
+
read(from: RustBuffer): TypeName {
|
|
2970
|
+
return {
|
|
2971
|
+
chainHash: FfiConverterUint8Array.read(from),
|
|
2972
|
+
temporaryContractId: FfiConverterOptionalBytes.read(from),
|
|
2973
|
+
contractInfo: FfiConverterUint8Array.read(from),
|
|
2974
|
+
offerCollateralSats: FfiConverterUInt64.read(from),
|
|
2975
|
+
party: FfiConverterTypeContractPartyParams.read(from),
|
|
2976
|
+
fundOutputSerialId: FfiConverterOptionalUInt64.read(from),
|
|
2977
|
+
feeRatePerVb: FfiConverterUInt64.read(from),
|
|
2978
|
+
cetLocktime: FfiConverterUInt32.read(from),
|
|
2979
|
+
refundLocktime: FfiConverterUInt32.read(from),
|
|
2980
|
+
contractFlags: FfiConverterUInt8.read(from),
|
|
2981
|
+
};
|
|
2982
|
+
}
|
|
2983
|
+
write(value: TypeName, into: RustBuffer): void {
|
|
2984
|
+
FfiConverterUint8Array.write(value.chainHash, into);
|
|
2985
|
+
FfiConverterOptionalBytes.write(value.temporaryContractId, into);
|
|
2986
|
+
FfiConverterUint8Array.write(value.contractInfo, into);
|
|
2987
|
+
FfiConverterUInt64.write(value.offerCollateralSats, into);
|
|
2988
|
+
FfiConverterTypeContractPartyParams.write(value.party, into);
|
|
2989
|
+
FfiConverterOptionalUInt64.write(value.fundOutputSerialId, into);
|
|
2990
|
+
FfiConverterUInt64.write(value.feeRatePerVb, into);
|
|
2991
|
+
FfiConverterUInt32.write(value.cetLocktime, into);
|
|
2992
|
+
FfiConverterUInt32.write(value.refundLocktime, into);
|
|
2993
|
+
FfiConverterUInt8.write(value.contractFlags, into);
|
|
2994
|
+
}
|
|
2995
|
+
allocationSize(value: TypeName): number {
|
|
2996
|
+
return (
|
|
2997
|
+
FfiConverterUint8Array.allocationSize(value.chainHash) +
|
|
2998
|
+
FfiConverterOptionalBytes.allocationSize(value.temporaryContractId) +
|
|
2999
|
+
FfiConverterUint8Array.allocationSize(value.contractInfo) +
|
|
3000
|
+
FfiConverterUInt64.allocationSize(value.offerCollateralSats) +
|
|
3001
|
+
FfiConverterTypeContractPartyParams.allocationSize(value.party) +
|
|
3002
|
+
FfiConverterOptionalUInt64.allocationSize(value.fundOutputSerialId) +
|
|
3003
|
+
FfiConverterUInt64.allocationSize(value.feeRatePerVb) +
|
|
3004
|
+
FfiConverterUInt32.allocationSize(value.cetLocktime) +
|
|
3005
|
+
FfiConverterUInt32.allocationSize(value.refundLocktime) +
|
|
3006
|
+
FfiConverterUInt8.allocationSize(value.contractFlags)
|
|
3007
|
+
);
|
|
3008
|
+
}
|
|
3009
|
+
}
|
|
3010
|
+
return new FFIConverter();
|
|
3011
|
+
})();
|
|
3012
|
+
|
|
3013
|
+
/**
|
|
3014
|
+
* Identifies a funding input and the descriptor wildcard index that derives its
|
|
3015
|
+
* key, for [`sign_funding_psbt_with_descriptor`].
|
|
3016
|
+
*/
|
|
3017
|
+
export type DescriptorInput = {
|
|
3018
|
+
/**
|
|
3019
|
+
* The serial id of the funding input to sign.
|
|
3020
|
+
*/
|
|
3021
|
+
inputSerialId: bigint;
|
|
3022
|
+
/**
|
|
3023
|
+
* The descriptor wildcard derivation index of the input's script (ignored
|
|
3024
|
+
* for descriptors without a wildcard).
|
|
3025
|
+
*/
|
|
3026
|
+
derivationIndex: number;
|
|
3027
|
+
};
|
|
3028
|
+
|
|
3029
|
+
/**
|
|
3030
|
+
* Generated factory for {@link DescriptorInput} record objects.
|
|
3031
|
+
*/
|
|
3032
|
+
export const DescriptorInput = (() => {
|
|
3033
|
+
const defaults = () => ({});
|
|
3034
|
+
const create = (() => {
|
|
3035
|
+
return uniffiCreateRecord<DescriptorInput, ReturnType<typeof defaults>>(
|
|
3036
|
+
defaults
|
|
3037
|
+
);
|
|
3038
|
+
})();
|
|
3039
|
+
return Object.freeze({
|
|
3040
|
+
create,
|
|
3041
|
+
new: create,
|
|
3042
|
+
defaults: () => Object.freeze(defaults()) as Partial<DescriptorInput>,
|
|
3043
|
+
});
|
|
3044
|
+
})();
|
|
3045
|
+
|
|
3046
|
+
const FfiConverterTypeDescriptorInput = (() => {
|
|
3047
|
+
type TypeName = DescriptorInput;
|
|
3048
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
3049
|
+
read(from: RustBuffer): TypeName {
|
|
3050
|
+
return {
|
|
3051
|
+
inputSerialId: FfiConverterUInt64.read(from),
|
|
3052
|
+
derivationIndex: FfiConverterUInt32.read(from),
|
|
3053
|
+
};
|
|
3054
|
+
}
|
|
3055
|
+
write(value: TypeName, into: RustBuffer): void {
|
|
3056
|
+
FfiConverterUInt64.write(value.inputSerialId, into);
|
|
3057
|
+
FfiConverterUInt32.write(value.derivationIndex, into);
|
|
3058
|
+
}
|
|
3059
|
+
allocationSize(value: TypeName): number {
|
|
3060
|
+
return (
|
|
3061
|
+
FfiConverterUInt64.allocationSize(value.inputSerialId) +
|
|
3062
|
+
FfiConverterUInt32.allocationSize(value.derivationIndex)
|
|
3063
|
+
);
|
|
3064
|
+
}
|
|
3065
|
+
}
|
|
3066
|
+
return new FFIConverter();
|
|
3067
|
+
})();
|
|
3068
|
+
|
|
3069
|
+
export type DlcInputInfo = {
|
|
3070
|
+
fundTx: Transaction;
|
|
3071
|
+
fundVout: number;
|
|
3072
|
+
localFundPubkey: Uint8Array;
|
|
3073
|
+
remoteFundPubkey: Uint8Array;
|
|
3074
|
+
fundAmount: bigint;
|
|
3075
|
+
maxWitnessLen: number;
|
|
3076
|
+
inputSerialId: bigint;
|
|
3077
|
+
contractId: Uint8Array;
|
|
3078
|
+
};
|
|
3079
|
+
|
|
3080
|
+
/**
|
|
3081
|
+
* Generated factory for {@link DlcInputInfo} record objects.
|
|
3082
|
+
*/
|
|
3083
|
+
export const DlcInputInfo = (() => {
|
|
3084
|
+
const defaults = () => ({});
|
|
3085
|
+
const create = (() => {
|
|
3086
|
+
return uniffiCreateRecord<DlcInputInfo, ReturnType<typeof defaults>>(
|
|
3087
|
+
defaults
|
|
3088
|
+
);
|
|
3089
|
+
})();
|
|
3090
|
+
return Object.freeze({
|
|
3091
|
+
create,
|
|
3092
|
+
new: create,
|
|
3093
|
+
defaults: () => Object.freeze(defaults()) as Partial<DlcInputInfo>,
|
|
3094
|
+
});
|
|
3095
|
+
})();
|
|
3096
|
+
|
|
3097
|
+
const FfiConverterTypeDlcInputInfo = (() => {
|
|
3098
|
+
type TypeName = DlcInputInfo;
|
|
3099
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
3100
|
+
read(from: RustBuffer): TypeName {
|
|
3101
|
+
return {
|
|
3102
|
+
fundTx: FfiConverterTypeTransaction.read(from),
|
|
3103
|
+
fundVout: FfiConverterUInt32.read(from),
|
|
3104
|
+
localFundPubkey: FfiConverterUint8Array.read(from),
|
|
3105
|
+
remoteFundPubkey: FfiConverterUint8Array.read(from),
|
|
3106
|
+
fundAmount: FfiConverterUInt64.read(from),
|
|
3107
|
+
maxWitnessLen: FfiConverterUInt32.read(from),
|
|
3108
|
+
inputSerialId: FfiConverterUInt64.read(from),
|
|
3109
|
+
contractId: FfiConverterUint8Array.read(from),
|
|
3110
|
+
};
|
|
3111
|
+
}
|
|
3112
|
+
write(value: TypeName, into: RustBuffer): void {
|
|
3113
|
+
FfiConverterTypeTransaction.write(value.fundTx, into);
|
|
3114
|
+
FfiConverterUInt32.write(value.fundVout, into);
|
|
3115
|
+
FfiConverterUint8Array.write(value.localFundPubkey, into);
|
|
3116
|
+
FfiConverterUint8Array.write(value.remoteFundPubkey, into);
|
|
3117
|
+
FfiConverterUInt64.write(value.fundAmount, into);
|
|
3118
|
+
FfiConverterUInt32.write(value.maxWitnessLen, into);
|
|
3119
|
+
FfiConverterUInt64.write(value.inputSerialId, into);
|
|
3120
|
+
FfiConverterUint8Array.write(value.contractId, into);
|
|
3121
|
+
}
|
|
3122
|
+
allocationSize(value: TypeName): number {
|
|
3123
|
+
return (
|
|
3124
|
+
FfiConverterTypeTransaction.allocationSize(value.fundTx) +
|
|
3125
|
+
FfiConverterUInt32.allocationSize(value.fundVout) +
|
|
3126
|
+
FfiConverterUint8Array.allocationSize(value.localFundPubkey) +
|
|
3127
|
+
FfiConverterUint8Array.allocationSize(value.remoteFundPubkey) +
|
|
3128
|
+
FfiConverterUInt64.allocationSize(value.fundAmount) +
|
|
3129
|
+
FfiConverterUInt32.allocationSize(value.maxWitnessLen) +
|
|
3130
|
+
FfiConverterUInt64.allocationSize(value.inputSerialId) +
|
|
3131
|
+
FfiConverterUint8Array.allocationSize(value.contractId)
|
|
3132
|
+
);
|
|
3133
|
+
}
|
|
3134
|
+
}
|
|
3135
|
+
return new FFIConverter();
|
|
3136
|
+
})();
|
|
3137
|
+
|
|
3138
|
+
/**
|
|
3139
|
+
* An oracle attestation paired with the position of the oracle that produced it
|
|
3140
|
+
* in the contract's announcements, for [`sign_contract_cet`].
|
|
3141
|
+
*/
|
|
3142
|
+
export type OracleAttestationRef = {
|
|
3143
|
+
/**
|
|
3144
|
+
* The index of the attesting oracle in the contract info's announcements.
|
|
3145
|
+
*/
|
|
3146
|
+
oracleIndex: number;
|
|
3147
|
+
/**
|
|
3148
|
+
* The wire-encoded `OracleAttestation`.
|
|
3149
|
+
*/
|
|
3150
|
+
attestation: Uint8Array;
|
|
3151
|
+
};
|
|
3152
|
+
|
|
3153
|
+
/**
|
|
3154
|
+
* Generated factory for {@link OracleAttestationRef} record objects.
|
|
3155
|
+
*/
|
|
3156
|
+
export const OracleAttestationRef = (() => {
|
|
3157
|
+
const defaults = () => ({});
|
|
3158
|
+
const create = (() => {
|
|
3159
|
+
return uniffiCreateRecord<
|
|
3160
|
+
OracleAttestationRef,
|
|
3161
|
+
ReturnType<typeof defaults>
|
|
3162
|
+
>(defaults);
|
|
3163
|
+
})();
|
|
3164
|
+
return Object.freeze({
|
|
3165
|
+
create,
|
|
3166
|
+
new: create,
|
|
3167
|
+
defaults: () => Object.freeze(defaults()) as Partial<OracleAttestationRef>,
|
|
3168
|
+
});
|
|
3169
|
+
})();
|
|
3170
|
+
|
|
3171
|
+
const FfiConverterTypeOracleAttestationRef = (() => {
|
|
3172
|
+
type TypeName = OracleAttestationRef;
|
|
3173
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
3174
|
+
read(from: RustBuffer): TypeName {
|
|
3175
|
+
return {
|
|
3176
|
+
oracleIndex: FfiConverterUInt32.read(from),
|
|
3177
|
+
attestation: FfiConverterUint8Array.read(from),
|
|
3178
|
+
};
|
|
3179
|
+
}
|
|
3180
|
+
write(value: TypeName, into: RustBuffer): void {
|
|
3181
|
+
FfiConverterUInt32.write(value.oracleIndex, into);
|
|
3182
|
+
FfiConverterUint8Array.write(value.attestation, into);
|
|
3183
|
+
}
|
|
3184
|
+
allocationSize(value: TypeName): number {
|
|
3185
|
+
return (
|
|
3186
|
+
FfiConverterUInt32.allocationSize(value.oracleIndex) +
|
|
3187
|
+
FfiConverterUint8Array.allocationSize(value.attestation)
|
|
2077
3188
|
);
|
|
2078
3189
|
}
|
|
2079
3190
|
}
|
|
2080
3191
|
return new FFIConverter();
|
|
2081
3192
|
})();
|
|
2082
3193
|
|
|
3194
|
+
export type OracleInfo = {
|
|
3195
|
+
publicKey: Uint8Array;
|
|
3196
|
+
nonces: Array<Uint8Array>;
|
|
3197
|
+
};
|
|
3198
|
+
|
|
3199
|
+
/**
|
|
3200
|
+
* Generated factory for {@link OracleInfo} record objects.
|
|
3201
|
+
*/
|
|
3202
|
+
export const OracleInfo = (() => {
|
|
3203
|
+
const defaults = () => ({});
|
|
3204
|
+
const create = (() => {
|
|
3205
|
+
return uniffiCreateRecord<OracleInfo, ReturnType<typeof defaults>>(
|
|
3206
|
+
defaults
|
|
3207
|
+
);
|
|
3208
|
+
})();
|
|
3209
|
+
return Object.freeze({
|
|
3210
|
+
create,
|
|
3211
|
+
new: create,
|
|
3212
|
+
defaults: () => Object.freeze(defaults()) as Partial<OracleInfo>,
|
|
3213
|
+
});
|
|
3214
|
+
})();
|
|
3215
|
+
|
|
3216
|
+
const FfiConverterTypeOracleInfo = (() => {
|
|
3217
|
+
type TypeName = OracleInfo;
|
|
3218
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
3219
|
+
read(from: RustBuffer): TypeName {
|
|
3220
|
+
return {
|
|
3221
|
+
publicKey: FfiConverterUint8Array.read(from),
|
|
3222
|
+
nonces: FfiConverterSequenceBytes.read(from),
|
|
3223
|
+
};
|
|
3224
|
+
}
|
|
3225
|
+
write(value: TypeName, into: RustBuffer): void {
|
|
3226
|
+
FfiConverterUint8Array.write(value.publicKey, into);
|
|
3227
|
+
FfiConverterSequenceBytes.write(value.nonces, into);
|
|
3228
|
+
}
|
|
3229
|
+
allocationSize(value: TypeName): number {
|
|
3230
|
+
return (
|
|
3231
|
+
FfiConverterUint8Array.allocationSize(value.publicKey) +
|
|
3232
|
+
FfiConverterSequenceBytes.allocationSize(value.nonces)
|
|
3233
|
+
);
|
|
3234
|
+
}
|
|
3235
|
+
}
|
|
3236
|
+
return new FFIConverter();
|
|
3237
|
+
})();
|
|
3238
|
+
|
|
3239
|
+
export type TxInputInfo = {
|
|
3240
|
+
txid: string;
|
|
3241
|
+
vout: number;
|
|
3242
|
+
scriptSig: Uint8Array;
|
|
3243
|
+
maxWitnessLength: number;
|
|
3244
|
+
serialId: bigint;
|
|
3245
|
+
};
|
|
3246
|
+
|
|
3247
|
+
/**
|
|
3248
|
+
* Generated factory for {@link TxInputInfo} record objects.
|
|
3249
|
+
*/
|
|
3250
|
+
export const TxInputInfo = (() => {
|
|
3251
|
+
const defaults = () => ({});
|
|
3252
|
+
const create = (() => {
|
|
3253
|
+
return uniffiCreateRecord<TxInputInfo, ReturnType<typeof defaults>>(
|
|
3254
|
+
defaults
|
|
3255
|
+
);
|
|
3256
|
+
})();
|
|
3257
|
+
return Object.freeze({
|
|
3258
|
+
create,
|
|
3259
|
+
new: create,
|
|
3260
|
+
defaults: () => Object.freeze(defaults()) as Partial<TxInputInfo>,
|
|
3261
|
+
});
|
|
3262
|
+
})();
|
|
3263
|
+
|
|
3264
|
+
const FfiConverterTypeTxInputInfo = (() => {
|
|
3265
|
+
type TypeName = TxInputInfo;
|
|
3266
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
3267
|
+
read(from: RustBuffer): TypeName {
|
|
3268
|
+
return {
|
|
3269
|
+
txid: FfiConverterString.read(from),
|
|
3270
|
+
vout: FfiConverterUInt32.read(from),
|
|
3271
|
+
scriptSig: FfiConverterUint8Array.read(from),
|
|
3272
|
+
maxWitnessLength: FfiConverterUInt32.read(from),
|
|
3273
|
+
serialId: FfiConverterUInt64.read(from),
|
|
3274
|
+
};
|
|
3275
|
+
}
|
|
3276
|
+
write(value: TypeName, into: RustBuffer): void {
|
|
3277
|
+
FfiConverterString.write(value.txid, into);
|
|
3278
|
+
FfiConverterUInt32.write(value.vout, into);
|
|
3279
|
+
FfiConverterUint8Array.write(value.scriptSig, into);
|
|
3280
|
+
FfiConverterUInt32.write(value.maxWitnessLength, into);
|
|
3281
|
+
FfiConverterUInt64.write(value.serialId, into);
|
|
3282
|
+
}
|
|
3283
|
+
allocationSize(value: TypeName): number {
|
|
3284
|
+
return (
|
|
3285
|
+
FfiConverterString.allocationSize(value.txid) +
|
|
3286
|
+
FfiConverterUInt32.allocationSize(value.vout) +
|
|
3287
|
+
FfiConverterUint8Array.allocationSize(value.scriptSig) +
|
|
3288
|
+
FfiConverterUInt32.allocationSize(value.maxWitnessLength) +
|
|
3289
|
+
FfiConverterUInt64.allocationSize(value.serialId)
|
|
3290
|
+
);
|
|
3291
|
+
}
|
|
3292
|
+
}
|
|
3293
|
+
return new FFIConverter();
|
|
3294
|
+
})();
|
|
3295
|
+
|
|
3296
|
+
export type PartyParams = {
|
|
3297
|
+
fundPubkey: Uint8Array;
|
|
3298
|
+
changeScriptPubkey: Uint8Array;
|
|
3299
|
+
changeSerialId: bigint;
|
|
3300
|
+
payoutScriptPubkey: Uint8Array;
|
|
3301
|
+
payoutSerialId: bigint;
|
|
3302
|
+
inputs: Array<TxInputInfo>;
|
|
3303
|
+
inputAmount: bigint;
|
|
3304
|
+
collateral: bigint;
|
|
3305
|
+
dlcInputs: Array<DlcInputInfo>;
|
|
3306
|
+
};
|
|
3307
|
+
|
|
3308
|
+
/**
|
|
3309
|
+
* Generated factory for {@link PartyParams} record objects.
|
|
3310
|
+
*/
|
|
3311
|
+
export const PartyParams = (() => {
|
|
3312
|
+
const defaults = () => ({});
|
|
3313
|
+
const create = (() => {
|
|
3314
|
+
return uniffiCreateRecord<PartyParams, ReturnType<typeof defaults>>(
|
|
3315
|
+
defaults
|
|
3316
|
+
);
|
|
3317
|
+
})();
|
|
3318
|
+
return Object.freeze({
|
|
3319
|
+
create,
|
|
3320
|
+
new: create,
|
|
3321
|
+
defaults: () => Object.freeze(defaults()) as Partial<PartyParams>,
|
|
3322
|
+
changeOutputAndFees(
|
|
3323
|
+
self_: PartyParams,
|
|
3324
|
+
feeRate: bigint
|
|
3325
|
+
): ChangeOutputAndFees {
|
|
3326
|
+
return ((__rb: Uint8Array) => {
|
|
3327
|
+
try {
|
|
3328
|
+
return FfiConverterTypeChangeOutputAndFees.lift(__rb);
|
|
3329
|
+
} finally {
|
|
3330
|
+
nativeModule().rustbuffer_free(__rb);
|
|
3331
|
+
}
|
|
3332
|
+
})(
|
|
3333
|
+
uniffiCaller.rustCallWithError(
|
|
3334
|
+
/*liftError:*/ FfiConverterTypeDLCError.lift.bind(
|
|
3335
|
+
FfiConverterTypeDLCError
|
|
3336
|
+
),
|
|
3337
|
+
/*caller:*/ (callStatus) => {
|
|
3338
|
+
return nativeModule().ubrn_uniffi_ddk_ffi_fn_method_partyparams_change_output_and_fees(
|
|
3339
|
+
FfiConverterTypePartyParams.lower(
|
|
3340
|
+
self_,
|
|
3341
|
+
nativeModule().rustbuffer_alloc
|
|
3342
|
+
),
|
|
3343
|
+
FfiConverterUInt64.lower(
|
|
3344
|
+
feeRate,
|
|
3345
|
+
nativeModule().rustbuffer_alloc
|
|
3346
|
+
),
|
|
3347
|
+
callStatus
|
|
3348
|
+
);
|
|
3349
|
+
},
|
|
3350
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)
|
|
3351
|
+
)
|
|
3352
|
+
);
|
|
3353
|
+
},
|
|
3354
|
+
});
|
|
3355
|
+
})();
|
|
3356
|
+
|
|
3357
|
+
const FfiConverterTypePartyParams = (() => {
|
|
3358
|
+
type TypeName = PartyParams;
|
|
3359
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
3360
|
+
read(from: RustBuffer): TypeName {
|
|
3361
|
+
return {
|
|
3362
|
+
fundPubkey: FfiConverterUint8Array.read(from),
|
|
3363
|
+
changeScriptPubkey: FfiConverterUint8Array.read(from),
|
|
3364
|
+
changeSerialId: FfiConverterUInt64.read(from),
|
|
3365
|
+
payoutScriptPubkey: FfiConverterUint8Array.read(from),
|
|
3366
|
+
payoutSerialId: FfiConverterUInt64.read(from),
|
|
3367
|
+
inputs: FfiConverterSequenceTypeTxInputInfo.read(from),
|
|
3368
|
+
inputAmount: FfiConverterUInt64.read(from),
|
|
3369
|
+
collateral: FfiConverterUInt64.read(from),
|
|
3370
|
+
dlcInputs: FfiConverterSequenceTypeDlcInputInfo.read(from),
|
|
3371
|
+
};
|
|
3372
|
+
}
|
|
3373
|
+
write(value: TypeName, into: RustBuffer): void {
|
|
3374
|
+
FfiConverterUint8Array.write(value.fundPubkey, into);
|
|
3375
|
+
FfiConverterUint8Array.write(value.changeScriptPubkey, into);
|
|
3376
|
+
FfiConverterUInt64.write(value.changeSerialId, into);
|
|
3377
|
+
FfiConverterUint8Array.write(value.payoutScriptPubkey, into);
|
|
3378
|
+
FfiConverterUInt64.write(value.payoutSerialId, into);
|
|
3379
|
+
FfiConverterSequenceTypeTxInputInfo.write(value.inputs, into);
|
|
3380
|
+
FfiConverterUInt64.write(value.inputAmount, into);
|
|
3381
|
+
FfiConverterUInt64.write(value.collateral, into);
|
|
3382
|
+
FfiConverterSequenceTypeDlcInputInfo.write(value.dlcInputs, into);
|
|
3383
|
+
}
|
|
3384
|
+
allocationSize(value: TypeName): number {
|
|
3385
|
+
return (
|
|
3386
|
+
FfiConverterUint8Array.allocationSize(value.fundPubkey) +
|
|
3387
|
+
FfiConverterUint8Array.allocationSize(value.changeScriptPubkey) +
|
|
3388
|
+
FfiConverterUInt64.allocationSize(value.changeSerialId) +
|
|
3389
|
+
FfiConverterUint8Array.allocationSize(value.payoutScriptPubkey) +
|
|
3390
|
+
FfiConverterUInt64.allocationSize(value.payoutSerialId) +
|
|
3391
|
+
FfiConverterSequenceTypeTxInputInfo.allocationSize(value.inputs) +
|
|
3392
|
+
FfiConverterUInt64.allocationSize(value.inputAmount) +
|
|
3393
|
+
FfiConverterUInt64.allocationSize(value.collateral) +
|
|
3394
|
+
FfiConverterSequenceTypeDlcInputInfo.allocationSize(value.dlcInputs)
|
|
3395
|
+
);
|
|
3396
|
+
}
|
|
3397
|
+
}
|
|
3398
|
+
return new FFIConverter();
|
|
3399
|
+
})();
|
|
3400
|
+
|
|
3401
|
+
export type Payout = {
|
|
3402
|
+
offer: bigint;
|
|
3403
|
+
accept: bigint;
|
|
3404
|
+
};
|
|
3405
|
+
|
|
3406
|
+
/**
|
|
3407
|
+
* Generated factory for {@link Payout} record objects.
|
|
3408
|
+
*/
|
|
3409
|
+
export const Payout = (() => {
|
|
3410
|
+
const defaults = () => ({});
|
|
3411
|
+
const create = (() => {
|
|
3412
|
+
return uniffiCreateRecord<Payout, ReturnType<typeof defaults>>(defaults);
|
|
3413
|
+
})();
|
|
3414
|
+
return Object.freeze({
|
|
3415
|
+
create,
|
|
3416
|
+
new: create,
|
|
3417
|
+
defaults: () => Object.freeze(defaults()) as Partial<Payout>,
|
|
3418
|
+
});
|
|
3419
|
+
})();
|
|
3420
|
+
|
|
3421
|
+
const FfiConverterTypePayout = (() => {
|
|
3422
|
+
type TypeName = Payout;
|
|
3423
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
3424
|
+
read(from: RustBuffer): TypeName {
|
|
3425
|
+
return {
|
|
3426
|
+
offer: FfiConverterUInt64.read(from),
|
|
3427
|
+
accept: FfiConverterUInt64.read(from),
|
|
3428
|
+
};
|
|
3429
|
+
}
|
|
3430
|
+
write(value: TypeName, into: RustBuffer): void {
|
|
3431
|
+
FfiConverterUInt64.write(value.offer, into);
|
|
3432
|
+
FfiConverterUInt64.write(value.accept, into);
|
|
3433
|
+
}
|
|
3434
|
+
allocationSize(value: TypeName): number {
|
|
3435
|
+
return (
|
|
3436
|
+
FfiConverterUInt64.allocationSize(value.offer) +
|
|
3437
|
+
FfiConverterUInt64.allocationSize(value.accept)
|
|
3438
|
+
);
|
|
3439
|
+
}
|
|
3440
|
+
}
|
|
3441
|
+
return new FFIConverter();
|
|
3442
|
+
})();
|
|
3443
|
+
|
|
3444
|
+
/**
|
|
3445
|
+
* The result of [`sign_accept`] / [`sign_accept_spliced`].
|
|
3446
|
+
*/
|
|
3447
|
+
export type SignResult = {
|
|
3448
|
+
/**
|
|
3449
|
+
* The wire-encoded `SignDlc` message to send to the accepting party.
|
|
3450
|
+
*/
|
|
3451
|
+
sign: Uint8Array;
|
|
3452
|
+
/**
|
|
3453
|
+
* The unsigned funding, CET, and refund transactions.
|
|
3454
|
+
*/
|
|
3455
|
+
transactions: DlcTransactions;
|
|
3456
|
+
};
|
|
3457
|
+
|
|
3458
|
+
/**
|
|
3459
|
+
* Generated factory for {@link SignResult} record objects.
|
|
3460
|
+
*/
|
|
3461
|
+
export const SignResult = (() => {
|
|
3462
|
+
const defaults = () => ({});
|
|
3463
|
+
const create = (() => {
|
|
3464
|
+
return uniffiCreateRecord<SignResult, ReturnType<typeof defaults>>(
|
|
3465
|
+
defaults
|
|
3466
|
+
);
|
|
3467
|
+
})();
|
|
3468
|
+
return Object.freeze({
|
|
3469
|
+
create,
|
|
3470
|
+
new: create,
|
|
3471
|
+
defaults: () => Object.freeze(defaults()) as Partial<SignResult>,
|
|
3472
|
+
});
|
|
3473
|
+
})();
|
|
3474
|
+
|
|
3475
|
+
const FfiConverterTypeSignResult = (() => {
|
|
3476
|
+
type TypeName = SignResult;
|
|
3477
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
3478
|
+
read(from: RustBuffer): TypeName {
|
|
3479
|
+
return {
|
|
3480
|
+
sign: FfiConverterUint8Array.read(from),
|
|
3481
|
+
transactions: FfiConverterTypeDlcTransactions.read(from),
|
|
3482
|
+
};
|
|
3483
|
+
}
|
|
3484
|
+
write(value: TypeName, into: RustBuffer): void {
|
|
3485
|
+
FfiConverterUint8Array.write(value.sign, into);
|
|
3486
|
+
FfiConverterTypeDlcTransactions.write(value.transactions, into);
|
|
3487
|
+
}
|
|
3488
|
+
allocationSize(value: TypeName): number {
|
|
3489
|
+
return (
|
|
3490
|
+
FfiConverterUint8Array.allocationSize(value.sign) +
|
|
3491
|
+
FfiConverterTypeDlcTransactions.allocationSize(value.transactions)
|
|
3492
|
+
);
|
|
3493
|
+
}
|
|
3494
|
+
}
|
|
3495
|
+
return new FFIConverter();
|
|
3496
|
+
})();
|
|
3497
|
+
|
|
3498
|
+
/**
|
|
3499
|
+
* References a splice (DLC) funding input and the previous contract whose
|
|
3500
|
+
* 2-of-2 output it spends, so the provider can re-derive the signing key.
|
|
3501
|
+
*/
|
|
3502
|
+
export type SpliceKeyRef = {
|
|
3503
|
+
/**
|
|
3504
|
+
* The serial id of the DLC (splice) funding input this key signs.
|
|
3505
|
+
*/
|
|
3506
|
+
inputSerialId: bigint;
|
|
3507
|
+
/**
|
|
3508
|
+
* The 32-byte temporary id of the previous contract being spliced from.
|
|
3509
|
+
*/
|
|
3510
|
+
priorTemporaryContractId: Uint8Array;
|
|
3511
|
+
};
|
|
3512
|
+
|
|
3513
|
+
/**
|
|
3514
|
+
* Generated factory for {@link SpliceKeyRef} record objects.
|
|
3515
|
+
*/
|
|
3516
|
+
export const SpliceKeyRef = (() => {
|
|
3517
|
+
const defaults = () => ({});
|
|
3518
|
+
const create = (() => {
|
|
3519
|
+
return uniffiCreateRecord<SpliceKeyRef, ReturnType<typeof defaults>>(
|
|
3520
|
+
defaults
|
|
3521
|
+
);
|
|
3522
|
+
})();
|
|
3523
|
+
return Object.freeze({
|
|
3524
|
+
create,
|
|
3525
|
+
new: create,
|
|
3526
|
+
defaults: () => Object.freeze(defaults()) as Partial<SpliceKeyRef>,
|
|
3527
|
+
});
|
|
3528
|
+
})();
|
|
3529
|
+
|
|
3530
|
+
const FfiConverterTypeSpliceKeyRef = (() => {
|
|
3531
|
+
type TypeName = SpliceKeyRef;
|
|
3532
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
3533
|
+
read(from: RustBuffer): TypeName {
|
|
3534
|
+
return {
|
|
3535
|
+
inputSerialId: FfiConverterUInt64.read(from),
|
|
3536
|
+
priorTemporaryContractId: FfiConverterUint8Array.read(from),
|
|
3537
|
+
};
|
|
3538
|
+
}
|
|
3539
|
+
write(value: TypeName, into: RustBuffer): void {
|
|
3540
|
+
FfiConverterUInt64.write(value.inputSerialId, into);
|
|
3541
|
+
FfiConverterUint8Array.write(value.priorTemporaryContractId, into);
|
|
3542
|
+
}
|
|
3543
|
+
allocationSize(value: TypeName): number {
|
|
3544
|
+
return (
|
|
3545
|
+
FfiConverterUInt64.allocationSize(value.inputSerialId) +
|
|
3546
|
+
FfiConverterUint8Array.allocationSize(value.priorTemporaryContractId)
|
|
3547
|
+
);
|
|
3548
|
+
}
|
|
3549
|
+
}
|
|
3550
|
+
return new FFIConverter();
|
|
3551
|
+
})();
|
|
3552
|
+
|
|
3553
|
+
// Error type: ContractError
|
|
3554
|
+
export enum ContractError_Tags {
|
|
3555
|
+
InvalidOffer = 'InvalidOffer',
|
|
3556
|
+
InvalidAccept = 'InvalidAccept',
|
|
3557
|
+
InvalidSign = 'InvalidSign',
|
|
3558
|
+
InvalidFundingInput = 'InvalidFundingInput',
|
|
3559
|
+
PsbtMismatch = 'PsbtMismatch',
|
|
3560
|
+
MissingFinalizedInput = 'MissingFinalizedInput',
|
|
3561
|
+
UnsupportedScriptType = 'UnsupportedScriptType',
|
|
3562
|
+
InvalidAttestation = 'InvalidAttestation',
|
|
3563
|
+
NoMatchingOutcome = 'NoMatchingOutcome',
|
|
3564
|
+
Descriptor = 'Descriptor',
|
|
3565
|
+
Wallet = 'Wallet',
|
|
3566
|
+
Bip32 = 'Bip32',
|
|
3567
|
+
Dlc = 'Dlc',
|
|
3568
|
+
Key = 'Key',
|
|
3569
|
+
Serialization = 'Serialization',
|
|
3570
|
+
InvalidNetwork = 'InvalidNetwork',
|
|
3571
|
+
InvalidLength = 'InvalidLength',
|
|
3572
|
+
}
|
|
3573
|
+
/**
|
|
3574
|
+
* Errors returned by the stateless contract API.
|
|
3575
|
+
*
|
|
3576
|
+
* Mirrors [`ddk::contract::ContractError`] as a uniffi error so the typed
|
|
3577
|
+
* variants survive across the binding boundary. Variants carry plain strings.
|
|
3578
|
+
*/
|
|
3579
|
+
export const ContractError = (() => {
|
|
3580
|
+
type InvalidOffer__interface = {
|
|
3581
|
+
tag: ContractError_Tags.InvalidOffer;
|
|
3582
|
+
inner: Readonly<{ message: string }>;
|
|
3583
|
+
};
|
|
3584
|
+
class InvalidOffer_ extends UniffiError implements InvalidOffer__interface {
|
|
3585
|
+
/**
|
|
3586
|
+
* @private
|
|
3587
|
+
* This field is private and should not be used, use `tag` instead.
|
|
3588
|
+
*/
|
|
3589
|
+
readonly [uniffiTypeNameSymbol] = 'ContractError';
|
|
3590
|
+
readonly tag = ContractError_Tags.InvalidOffer;
|
|
3591
|
+
readonly inner: Readonly<{ message: string }>;
|
|
3592
|
+
constructor(inner: { message: string }) {
|
|
3593
|
+
super('ContractError', 'InvalidOffer');
|
|
3594
|
+
|
|
3595
|
+
this.inner = Object.freeze(inner);
|
|
3596
|
+
}
|
|
3597
|
+
static new(inner: { message: string }): InvalidOffer_ {
|
|
3598
|
+
return new InvalidOffer_(inner);
|
|
3599
|
+
}
|
|
3600
|
+
|
|
3601
|
+
static instanceOf(obj: any): obj is InvalidOffer_ {
|
|
3602
|
+
return obj.tag === ContractError_Tags.InvalidOffer;
|
|
3603
|
+
}
|
|
3604
|
+
static hasInner(obj: any): obj is InvalidOffer_ {
|
|
3605
|
+
return InvalidOffer_.instanceOf(obj);
|
|
3606
|
+
}
|
|
3607
|
+
|
|
3608
|
+
static getInner(obj: InvalidOffer_): Readonly<{ message: string }> {
|
|
3609
|
+
return obj.inner;
|
|
3610
|
+
}
|
|
3611
|
+
}
|
|
3612
|
+
|
|
3613
|
+
type InvalidAccept__interface = {
|
|
3614
|
+
tag: ContractError_Tags.InvalidAccept;
|
|
3615
|
+
inner: Readonly<{ message: string }>;
|
|
3616
|
+
};
|
|
3617
|
+
class InvalidAccept_ extends UniffiError implements InvalidAccept__interface {
|
|
3618
|
+
/**
|
|
3619
|
+
* @private
|
|
3620
|
+
* This field is private and should not be used, use `tag` instead.
|
|
3621
|
+
*/
|
|
3622
|
+
readonly [uniffiTypeNameSymbol] = 'ContractError';
|
|
3623
|
+
readonly tag = ContractError_Tags.InvalidAccept;
|
|
3624
|
+
readonly inner: Readonly<{ message: string }>;
|
|
3625
|
+
constructor(inner: { message: string }) {
|
|
3626
|
+
super('ContractError', 'InvalidAccept');
|
|
3627
|
+
|
|
3628
|
+
this.inner = Object.freeze(inner);
|
|
3629
|
+
}
|
|
3630
|
+
static new(inner: { message: string }): InvalidAccept_ {
|
|
3631
|
+
return new InvalidAccept_(inner);
|
|
3632
|
+
}
|
|
3633
|
+
|
|
3634
|
+
static instanceOf(obj: any): obj is InvalidAccept_ {
|
|
3635
|
+
return obj.tag === ContractError_Tags.InvalidAccept;
|
|
3636
|
+
}
|
|
3637
|
+
static hasInner(obj: any): obj is InvalidAccept_ {
|
|
3638
|
+
return InvalidAccept_.instanceOf(obj);
|
|
3639
|
+
}
|
|
3640
|
+
|
|
3641
|
+
static getInner(obj: InvalidAccept_): Readonly<{ message: string }> {
|
|
3642
|
+
return obj.inner;
|
|
3643
|
+
}
|
|
3644
|
+
}
|
|
3645
|
+
|
|
3646
|
+
type InvalidSign__interface = {
|
|
3647
|
+
tag: ContractError_Tags.InvalidSign;
|
|
3648
|
+
inner: Readonly<{ message: string }>;
|
|
3649
|
+
};
|
|
3650
|
+
class InvalidSign_ extends UniffiError implements InvalidSign__interface {
|
|
3651
|
+
/**
|
|
3652
|
+
* @private
|
|
3653
|
+
* This field is private and should not be used, use `tag` instead.
|
|
3654
|
+
*/
|
|
3655
|
+
readonly [uniffiTypeNameSymbol] = 'ContractError';
|
|
3656
|
+
readonly tag = ContractError_Tags.InvalidSign;
|
|
3657
|
+
readonly inner: Readonly<{ message: string }>;
|
|
3658
|
+
constructor(inner: { message: string }) {
|
|
3659
|
+
super('ContractError', 'InvalidSign');
|
|
3660
|
+
|
|
3661
|
+
this.inner = Object.freeze(inner);
|
|
3662
|
+
}
|
|
3663
|
+
static new(inner: { message: string }): InvalidSign_ {
|
|
3664
|
+
return new InvalidSign_(inner);
|
|
3665
|
+
}
|
|
3666
|
+
|
|
3667
|
+
static instanceOf(obj: any): obj is InvalidSign_ {
|
|
3668
|
+
return obj.tag === ContractError_Tags.InvalidSign;
|
|
3669
|
+
}
|
|
3670
|
+
static hasInner(obj: any): obj is InvalidSign_ {
|
|
3671
|
+
return InvalidSign_.instanceOf(obj);
|
|
3672
|
+
}
|
|
3673
|
+
|
|
3674
|
+
static getInner(obj: InvalidSign_): Readonly<{ message: string }> {
|
|
3675
|
+
return obj.inner;
|
|
3676
|
+
}
|
|
3677
|
+
}
|
|
3678
|
+
|
|
3679
|
+
type InvalidFundingInput__interface = {
|
|
3680
|
+
tag: ContractError_Tags.InvalidFundingInput;
|
|
3681
|
+
inner: Readonly<{ message: string }>;
|
|
3682
|
+
};
|
|
3683
|
+
class InvalidFundingInput_
|
|
3684
|
+
extends UniffiError
|
|
3685
|
+
implements InvalidFundingInput__interface
|
|
3686
|
+
{
|
|
3687
|
+
/**
|
|
3688
|
+
* @private
|
|
3689
|
+
* This field is private and should not be used, use `tag` instead.
|
|
3690
|
+
*/
|
|
3691
|
+
readonly [uniffiTypeNameSymbol] = 'ContractError';
|
|
3692
|
+
readonly tag = ContractError_Tags.InvalidFundingInput;
|
|
3693
|
+
readonly inner: Readonly<{ message: string }>;
|
|
3694
|
+
constructor(inner: { message: string }) {
|
|
3695
|
+
super('ContractError', 'InvalidFundingInput');
|
|
3696
|
+
|
|
3697
|
+
this.inner = Object.freeze(inner);
|
|
3698
|
+
}
|
|
3699
|
+
static new(inner: { message: string }): InvalidFundingInput_ {
|
|
3700
|
+
return new InvalidFundingInput_(inner);
|
|
3701
|
+
}
|
|
3702
|
+
|
|
3703
|
+
static instanceOf(obj: any): obj is InvalidFundingInput_ {
|
|
3704
|
+
return obj.tag === ContractError_Tags.InvalidFundingInput;
|
|
3705
|
+
}
|
|
3706
|
+
static hasInner(obj: any): obj is InvalidFundingInput_ {
|
|
3707
|
+
return InvalidFundingInput_.instanceOf(obj);
|
|
3708
|
+
}
|
|
3709
|
+
|
|
3710
|
+
static getInner(obj: InvalidFundingInput_): Readonly<{ message: string }> {
|
|
3711
|
+
return obj.inner;
|
|
3712
|
+
}
|
|
3713
|
+
}
|
|
3714
|
+
|
|
3715
|
+
type PsbtMismatch__interface = {
|
|
3716
|
+
tag: ContractError_Tags.PsbtMismatch;
|
|
3717
|
+
inner: Readonly<{ message: string }>;
|
|
3718
|
+
};
|
|
3719
|
+
class PsbtMismatch_ extends UniffiError implements PsbtMismatch__interface {
|
|
3720
|
+
/**
|
|
3721
|
+
* @private
|
|
3722
|
+
* This field is private and should not be used, use `tag` instead.
|
|
3723
|
+
*/
|
|
3724
|
+
readonly [uniffiTypeNameSymbol] = 'ContractError';
|
|
3725
|
+
readonly tag = ContractError_Tags.PsbtMismatch;
|
|
3726
|
+
readonly inner: Readonly<{ message: string }>;
|
|
3727
|
+
constructor(inner: { message: string }) {
|
|
3728
|
+
super('ContractError', 'PsbtMismatch');
|
|
3729
|
+
|
|
3730
|
+
this.inner = Object.freeze(inner);
|
|
3731
|
+
}
|
|
3732
|
+
static new(inner: { message: string }): PsbtMismatch_ {
|
|
3733
|
+
return new PsbtMismatch_(inner);
|
|
3734
|
+
}
|
|
3735
|
+
|
|
3736
|
+
static instanceOf(obj: any): obj is PsbtMismatch_ {
|
|
3737
|
+
return obj.tag === ContractError_Tags.PsbtMismatch;
|
|
3738
|
+
}
|
|
3739
|
+
static hasInner(obj: any): obj is PsbtMismatch_ {
|
|
3740
|
+
return PsbtMismatch_.instanceOf(obj);
|
|
3741
|
+
}
|
|
3742
|
+
|
|
3743
|
+
static getInner(obj: PsbtMismatch_): Readonly<{ message: string }> {
|
|
3744
|
+
return obj.inner;
|
|
3745
|
+
}
|
|
3746
|
+
}
|
|
3747
|
+
|
|
3748
|
+
type MissingFinalizedInput__interface = {
|
|
3749
|
+
tag: ContractError_Tags.MissingFinalizedInput;
|
|
3750
|
+
inner: Readonly<{ inputIndex: number }>;
|
|
3751
|
+
};
|
|
3752
|
+
class MissingFinalizedInput_
|
|
3753
|
+
extends UniffiError
|
|
3754
|
+
implements MissingFinalizedInput__interface
|
|
3755
|
+
{
|
|
3756
|
+
/**
|
|
3757
|
+
* @private
|
|
3758
|
+
* This field is private and should not be used, use `tag` instead.
|
|
3759
|
+
*/
|
|
3760
|
+
readonly [uniffiTypeNameSymbol] = 'ContractError';
|
|
3761
|
+
readonly tag = ContractError_Tags.MissingFinalizedInput;
|
|
3762
|
+
readonly inner: Readonly<{ inputIndex: number }>;
|
|
3763
|
+
constructor(inner: { inputIndex: number }) {
|
|
3764
|
+
super('ContractError', 'MissingFinalizedInput');
|
|
3765
|
+
|
|
3766
|
+
this.inner = Object.freeze(inner);
|
|
3767
|
+
}
|
|
3768
|
+
static new(inner: { inputIndex: number }): MissingFinalizedInput_ {
|
|
3769
|
+
return new MissingFinalizedInput_(inner);
|
|
3770
|
+
}
|
|
3771
|
+
|
|
3772
|
+
static instanceOf(obj: any): obj is MissingFinalizedInput_ {
|
|
3773
|
+
return obj.tag === ContractError_Tags.MissingFinalizedInput;
|
|
3774
|
+
}
|
|
3775
|
+
static hasInner(obj: any): obj is MissingFinalizedInput_ {
|
|
3776
|
+
return MissingFinalizedInput_.instanceOf(obj);
|
|
3777
|
+
}
|
|
3778
|
+
|
|
3779
|
+
static getInner(
|
|
3780
|
+
obj: MissingFinalizedInput_
|
|
3781
|
+
): Readonly<{ inputIndex: number }> {
|
|
3782
|
+
return obj.inner;
|
|
3783
|
+
}
|
|
3784
|
+
}
|
|
3785
|
+
|
|
3786
|
+
type UnsupportedScriptType__interface = {
|
|
3787
|
+
tag: ContractError_Tags.UnsupportedScriptType;
|
|
3788
|
+
inner: Readonly<{ inputIndex: number }>;
|
|
3789
|
+
};
|
|
3790
|
+
class UnsupportedScriptType_
|
|
3791
|
+
extends UniffiError
|
|
3792
|
+
implements UnsupportedScriptType__interface
|
|
3793
|
+
{
|
|
3794
|
+
/**
|
|
3795
|
+
* @private
|
|
3796
|
+
* This field is private and should not be used, use `tag` instead.
|
|
3797
|
+
*/
|
|
3798
|
+
readonly [uniffiTypeNameSymbol] = 'ContractError';
|
|
3799
|
+
readonly tag = ContractError_Tags.UnsupportedScriptType;
|
|
3800
|
+
readonly inner: Readonly<{ inputIndex: number }>;
|
|
3801
|
+
constructor(inner: { inputIndex: number }) {
|
|
3802
|
+
super('ContractError', 'UnsupportedScriptType');
|
|
3803
|
+
|
|
3804
|
+
this.inner = Object.freeze(inner);
|
|
3805
|
+
}
|
|
3806
|
+
static new(inner: { inputIndex: number }): UnsupportedScriptType_ {
|
|
3807
|
+
return new UnsupportedScriptType_(inner);
|
|
3808
|
+
}
|
|
3809
|
+
|
|
3810
|
+
static instanceOf(obj: any): obj is UnsupportedScriptType_ {
|
|
3811
|
+
return obj.tag === ContractError_Tags.UnsupportedScriptType;
|
|
3812
|
+
}
|
|
3813
|
+
static hasInner(obj: any): obj is UnsupportedScriptType_ {
|
|
3814
|
+
return UnsupportedScriptType_.instanceOf(obj);
|
|
3815
|
+
}
|
|
3816
|
+
|
|
3817
|
+
static getInner(
|
|
3818
|
+
obj: UnsupportedScriptType_
|
|
3819
|
+
): Readonly<{ inputIndex: number }> {
|
|
3820
|
+
return obj.inner;
|
|
3821
|
+
}
|
|
3822
|
+
}
|
|
3823
|
+
|
|
3824
|
+
type InvalidAttestation__interface = {
|
|
3825
|
+
tag: ContractError_Tags.InvalidAttestation;
|
|
3826
|
+
inner: Readonly<{ message: string }>;
|
|
3827
|
+
};
|
|
3828
|
+
class InvalidAttestation_
|
|
3829
|
+
extends UniffiError
|
|
3830
|
+
implements InvalidAttestation__interface
|
|
3831
|
+
{
|
|
3832
|
+
/**
|
|
3833
|
+
* @private
|
|
3834
|
+
* This field is private and should not be used, use `tag` instead.
|
|
3835
|
+
*/
|
|
3836
|
+
readonly [uniffiTypeNameSymbol] = 'ContractError';
|
|
3837
|
+
readonly tag = ContractError_Tags.InvalidAttestation;
|
|
3838
|
+
readonly inner: Readonly<{ message: string }>;
|
|
3839
|
+
constructor(inner: { message: string }) {
|
|
3840
|
+
super('ContractError', 'InvalidAttestation');
|
|
3841
|
+
|
|
3842
|
+
this.inner = Object.freeze(inner);
|
|
3843
|
+
}
|
|
3844
|
+
static new(inner: { message: string }): InvalidAttestation_ {
|
|
3845
|
+
return new InvalidAttestation_(inner);
|
|
3846
|
+
}
|
|
3847
|
+
|
|
3848
|
+
static instanceOf(obj: any): obj is InvalidAttestation_ {
|
|
3849
|
+
return obj.tag === ContractError_Tags.InvalidAttestation;
|
|
3850
|
+
}
|
|
3851
|
+
static hasInner(obj: any): obj is InvalidAttestation_ {
|
|
3852
|
+
return InvalidAttestation_.instanceOf(obj);
|
|
3853
|
+
}
|
|
3854
|
+
|
|
3855
|
+
static getInner(obj: InvalidAttestation_): Readonly<{ message: string }> {
|
|
3856
|
+
return obj.inner;
|
|
3857
|
+
}
|
|
3858
|
+
}
|
|
3859
|
+
|
|
3860
|
+
type NoMatchingOutcome__interface = {
|
|
3861
|
+
tag: ContractError_Tags.NoMatchingOutcome;
|
|
3862
|
+
};
|
|
3863
|
+
class NoMatchingOutcome_
|
|
3864
|
+
extends UniffiError
|
|
3865
|
+
implements NoMatchingOutcome__interface
|
|
3866
|
+
{
|
|
3867
|
+
/**
|
|
3868
|
+
* @private
|
|
3869
|
+
* This field is private and should not be used, use `tag` instead.
|
|
3870
|
+
*/
|
|
3871
|
+
readonly [uniffiTypeNameSymbol] = 'ContractError';
|
|
3872
|
+
readonly tag = ContractError_Tags.NoMatchingOutcome;
|
|
3873
|
+
constructor() {
|
|
3874
|
+
super('ContractError', 'NoMatchingOutcome');
|
|
3875
|
+
}
|
|
3876
|
+
|
|
3877
|
+
static new(): NoMatchingOutcome_ {
|
|
3878
|
+
return new NoMatchingOutcome_();
|
|
3879
|
+
}
|
|
3880
|
+
|
|
3881
|
+
static instanceOf(obj: any): obj is NoMatchingOutcome_ {
|
|
3882
|
+
return obj.tag === ContractError_Tags.NoMatchingOutcome;
|
|
3883
|
+
}
|
|
3884
|
+
static hasInner(obj: any): obj is NoMatchingOutcome_ {
|
|
3885
|
+
return false;
|
|
3886
|
+
}
|
|
3887
|
+
}
|
|
3888
|
+
|
|
3889
|
+
type Descriptor__interface = {
|
|
3890
|
+
tag: ContractError_Tags.Descriptor;
|
|
3891
|
+
inner: Readonly<{ message: string }>;
|
|
3892
|
+
};
|
|
3893
|
+
class Descriptor_ extends UniffiError implements Descriptor__interface {
|
|
3894
|
+
/**
|
|
3895
|
+
* @private
|
|
3896
|
+
* This field is private and should not be used, use `tag` instead.
|
|
3897
|
+
*/
|
|
3898
|
+
readonly [uniffiTypeNameSymbol] = 'ContractError';
|
|
3899
|
+
readonly tag = ContractError_Tags.Descriptor;
|
|
3900
|
+
readonly inner: Readonly<{ message: string }>;
|
|
3901
|
+
constructor(inner: { message: string }) {
|
|
3902
|
+
super('ContractError', 'Descriptor');
|
|
3903
|
+
|
|
3904
|
+
this.inner = Object.freeze(inner);
|
|
3905
|
+
}
|
|
3906
|
+
static new(inner: { message: string }): Descriptor_ {
|
|
3907
|
+
return new Descriptor_(inner);
|
|
3908
|
+
}
|
|
3909
|
+
|
|
3910
|
+
static instanceOf(obj: any): obj is Descriptor_ {
|
|
3911
|
+
return obj.tag === ContractError_Tags.Descriptor;
|
|
3912
|
+
}
|
|
3913
|
+
static hasInner(obj: any): obj is Descriptor_ {
|
|
3914
|
+
return Descriptor_.instanceOf(obj);
|
|
3915
|
+
}
|
|
3916
|
+
|
|
3917
|
+
static getInner(obj: Descriptor_): Readonly<{ message: string }> {
|
|
3918
|
+
return obj.inner;
|
|
3919
|
+
}
|
|
3920
|
+
}
|
|
3921
|
+
|
|
3922
|
+
type Wallet__interface = {
|
|
3923
|
+
tag: ContractError_Tags.Wallet;
|
|
3924
|
+
inner: Readonly<{ message: string }>;
|
|
3925
|
+
};
|
|
3926
|
+
class Wallet_ extends UniffiError implements Wallet__interface {
|
|
3927
|
+
/**
|
|
3928
|
+
* @private
|
|
3929
|
+
* This field is private and should not be used, use `tag` instead.
|
|
3930
|
+
*/
|
|
3931
|
+
readonly [uniffiTypeNameSymbol] = 'ContractError';
|
|
3932
|
+
readonly tag = ContractError_Tags.Wallet;
|
|
3933
|
+
readonly inner: Readonly<{ message: string }>;
|
|
3934
|
+
constructor(inner: { message: string }) {
|
|
3935
|
+
super('ContractError', 'Wallet');
|
|
3936
|
+
|
|
3937
|
+
this.inner = Object.freeze(inner);
|
|
3938
|
+
}
|
|
3939
|
+
static new(inner: { message: string }): Wallet_ {
|
|
3940
|
+
return new Wallet_(inner);
|
|
3941
|
+
}
|
|
3942
|
+
|
|
3943
|
+
static instanceOf(obj: any): obj is Wallet_ {
|
|
3944
|
+
return obj.tag === ContractError_Tags.Wallet;
|
|
3945
|
+
}
|
|
3946
|
+
static hasInner(obj: any): obj is Wallet_ {
|
|
3947
|
+
return Wallet_.instanceOf(obj);
|
|
3948
|
+
}
|
|
3949
|
+
|
|
3950
|
+
static getInner(obj: Wallet_): Readonly<{ message: string }> {
|
|
3951
|
+
return obj.inner;
|
|
3952
|
+
}
|
|
3953
|
+
}
|
|
3954
|
+
|
|
3955
|
+
type Bip32__interface = {
|
|
3956
|
+
tag: ContractError_Tags.Bip32;
|
|
3957
|
+
inner: Readonly<{ message: string }>;
|
|
3958
|
+
};
|
|
3959
|
+
class Bip32_ extends UniffiError implements Bip32__interface {
|
|
3960
|
+
/**
|
|
3961
|
+
* @private
|
|
3962
|
+
* This field is private and should not be used, use `tag` instead.
|
|
3963
|
+
*/
|
|
3964
|
+
readonly [uniffiTypeNameSymbol] = 'ContractError';
|
|
3965
|
+
readonly tag = ContractError_Tags.Bip32;
|
|
3966
|
+
readonly inner: Readonly<{ message: string }>;
|
|
3967
|
+
constructor(inner: { message: string }) {
|
|
3968
|
+
super('ContractError', 'Bip32');
|
|
3969
|
+
|
|
3970
|
+
this.inner = Object.freeze(inner);
|
|
3971
|
+
}
|
|
3972
|
+
static new(inner: { message: string }): Bip32_ {
|
|
3973
|
+
return new Bip32_(inner);
|
|
3974
|
+
}
|
|
3975
|
+
|
|
3976
|
+
static instanceOf(obj: any): obj is Bip32_ {
|
|
3977
|
+
return obj.tag === ContractError_Tags.Bip32;
|
|
3978
|
+
}
|
|
3979
|
+
static hasInner(obj: any): obj is Bip32_ {
|
|
3980
|
+
return Bip32_.instanceOf(obj);
|
|
3981
|
+
}
|
|
3982
|
+
|
|
3983
|
+
static getInner(obj: Bip32_): Readonly<{ message: string }> {
|
|
3984
|
+
return obj.inner;
|
|
3985
|
+
}
|
|
3986
|
+
}
|
|
3987
|
+
|
|
3988
|
+
type Dlc__interface = {
|
|
3989
|
+
tag: ContractError_Tags.Dlc;
|
|
3990
|
+
inner: Readonly<{ message: string }>;
|
|
3991
|
+
};
|
|
3992
|
+
class Dlc_ extends UniffiError implements Dlc__interface {
|
|
3993
|
+
/**
|
|
3994
|
+
* @private
|
|
3995
|
+
* This field is private and should not be used, use `tag` instead.
|
|
3996
|
+
*/
|
|
3997
|
+
readonly [uniffiTypeNameSymbol] = 'ContractError';
|
|
3998
|
+
readonly tag = ContractError_Tags.Dlc;
|
|
3999
|
+
readonly inner: Readonly<{ message: string }>;
|
|
4000
|
+
constructor(inner: { message: string }) {
|
|
4001
|
+
super('ContractError', 'Dlc');
|
|
4002
|
+
|
|
4003
|
+
this.inner = Object.freeze(inner);
|
|
4004
|
+
}
|
|
4005
|
+
static new(inner: { message: string }): Dlc_ {
|
|
4006
|
+
return new Dlc_(inner);
|
|
4007
|
+
}
|
|
4008
|
+
|
|
4009
|
+
static instanceOf(obj: any): obj is Dlc_ {
|
|
4010
|
+
return obj.tag === ContractError_Tags.Dlc;
|
|
4011
|
+
}
|
|
4012
|
+
static hasInner(obj: any): obj is Dlc_ {
|
|
4013
|
+
return Dlc_.instanceOf(obj);
|
|
4014
|
+
}
|
|
4015
|
+
|
|
4016
|
+
static getInner(obj: Dlc_): Readonly<{ message: string }> {
|
|
4017
|
+
return obj.inner;
|
|
4018
|
+
}
|
|
4019
|
+
}
|
|
4020
|
+
|
|
4021
|
+
type Key__interface = {
|
|
4022
|
+
tag: ContractError_Tags.Key;
|
|
4023
|
+
inner: Readonly<{ message: string }>;
|
|
4024
|
+
};
|
|
4025
|
+
class Key_ extends UniffiError implements Key__interface {
|
|
4026
|
+
/**
|
|
4027
|
+
* @private
|
|
4028
|
+
* This field is private and should not be used, use `tag` instead.
|
|
4029
|
+
*/
|
|
4030
|
+
readonly [uniffiTypeNameSymbol] = 'ContractError';
|
|
4031
|
+
readonly tag = ContractError_Tags.Key;
|
|
4032
|
+
readonly inner: Readonly<{ message: string }>;
|
|
4033
|
+
constructor(inner: { message: string }) {
|
|
4034
|
+
super('ContractError', 'Key');
|
|
4035
|
+
|
|
4036
|
+
this.inner = Object.freeze(inner);
|
|
4037
|
+
}
|
|
4038
|
+
static new(inner: { message: string }): Key_ {
|
|
4039
|
+
return new Key_(inner);
|
|
4040
|
+
}
|
|
4041
|
+
|
|
4042
|
+
static instanceOf(obj: any): obj is Key_ {
|
|
4043
|
+
return obj.tag === ContractError_Tags.Key;
|
|
4044
|
+
}
|
|
4045
|
+
static hasInner(obj: any): obj is Key_ {
|
|
4046
|
+
return Key_.instanceOf(obj);
|
|
4047
|
+
}
|
|
4048
|
+
|
|
4049
|
+
static getInner(obj: Key_): Readonly<{ message: string }> {
|
|
4050
|
+
return obj.inner;
|
|
4051
|
+
}
|
|
4052
|
+
}
|
|
4053
|
+
|
|
4054
|
+
type Serialization__interface = {
|
|
4055
|
+
tag: ContractError_Tags.Serialization;
|
|
4056
|
+
inner: Readonly<{ message: string }>;
|
|
4057
|
+
};
|
|
4058
|
+
/**
|
|
4059
|
+
* A message or PSBT could not be (de)serialized at the FFI boundary.
|
|
4060
|
+
*/
|
|
4061
|
+
class Serialization_ extends UniffiError implements Serialization__interface {
|
|
4062
|
+
/**
|
|
4063
|
+
* @private
|
|
4064
|
+
* This field is private and should not be used, use `tag` instead.
|
|
4065
|
+
*/
|
|
4066
|
+
readonly [uniffiTypeNameSymbol] = 'ContractError';
|
|
4067
|
+
readonly tag = ContractError_Tags.Serialization;
|
|
4068
|
+
readonly inner: Readonly<{ message: string }>;
|
|
4069
|
+
constructor(inner: { message: string }) {
|
|
4070
|
+
super('ContractError', 'Serialization');
|
|
4071
|
+
|
|
4072
|
+
this.inner = Object.freeze(inner);
|
|
4073
|
+
}
|
|
4074
|
+
static new(inner: { message: string }): Serialization_ {
|
|
4075
|
+
return new Serialization_(inner);
|
|
4076
|
+
}
|
|
4077
|
+
|
|
4078
|
+
static instanceOf(obj: any): obj is Serialization_ {
|
|
4079
|
+
return obj.tag === ContractError_Tags.Serialization;
|
|
4080
|
+
}
|
|
4081
|
+
static hasInner(obj: any): obj is Serialization_ {
|
|
4082
|
+
return Serialization_.instanceOf(obj);
|
|
4083
|
+
}
|
|
4084
|
+
|
|
4085
|
+
static getInner(obj: Serialization_): Readonly<{ message: string }> {
|
|
4086
|
+
return obj.inner;
|
|
4087
|
+
}
|
|
4088
|
+
}
|
|
4089
|
+
|
|
4090
|
+
type InvalidNetwork__interface = {
|
|
4091
|
+
tag: ContractError_Tags.InvalidNetwork;
|
|
4092
|
+
inner: Readonly<{ message: string }>;
|
|
4093
|
+
};
|
|
4094
|
+
/**
|
|
4095
|
+
* The network string was not one of bitcoin/testnet/signet/regtest.
|
|
4096
|
+
*/
|
|
4097
|
+
class InvalidNetwork_
|
|
4098
|
+
extends UniffiError
|
|
4099
|
+
implements InvalidNetwork__interface
|
|
4100
|
+
{
|
|
4101
|
+
/**
|
|
4102
|
+
* @private
|
|
4103
|
+
* This field is private and should not be used, use `tag` instead.
|
|
4104
|
+
*/
|
|
4105
|
+
readonly [uniffiTypeNameSymbol] = 'ContractError';
|
|
4106
|
+
readonly tag = ContractError_Tags.InvalidNetwork;
|
|
4107
|
+
readonly inner: Readonly<{ message: string }>;
|
|
4108
|
+
constructor(inner: { message: string }) {
|
|
4109
|
+
super('ContractError', 'InvalidNetwork');
|
|
4110
|
+
|
|
4111
|
+
this.inner = Object.freeze(inner);
|
|
4112
|
+
}
|
|
4113
|
+
static new(inner: { message: string }): InvalidNetwork_ {
|
|
4114
|
+
return new InvalidNetwork_(inner);
|
|
4115
|
+
}
|
|
4116
|
+
|
|
4117
|
+
static instanceOf(obj: any): obj is InvalidNetwork_ {
|
|
4118
|
+
return obj.tag === ContractError_Tags.InvalidNetwork;
|
|
4119
|
+
}
|
|
4120
|
+
static hasInner(obj: any): obj is InvalidNetwork_ {
|
|
4121
|
+
return InvalidNetwork_.instanceOf(obj);
|
|
4122
|
+
}
|
|
4123
|
+
|
|
4124
|
+
static getInner(obj: InvalidNetwork_): Readonly<{ message: string }> {
|
|
4125
|
+
return obj.inner;
|
|
4126
|
+
}
|
|
4127
|
+
}
|
|
4128
|
+
|
|
4129
|
+
type InvalidLength__interface = {
|
|
4130
|
+
tag: ContractError_Tags.InvalidLength;
|
|
4131
|
+
inner: Readonly<{ field: string; expected: number; actual: number }>;
|
|
4132
|
+
};
|
|
4133
|
+
/**
|
|
4134
|
+
* A byte argument had the wrong length (e.g. a 32-byte id).
|
|
4135
|
+
*/
|
|
4136
|
+
class InvalidLength_ extends UniffiError implements InvalidLength__interface {
|
|
4137
|
+
/**
|
|
4138
|
+
* @private
|
|
4139
|
+
* This field is private and should not be used, use `tag` instead.
|
|
4140
|
+
*/
|
|
4141
|
+
readonly [uniffiTypeNameSymbol] = 'ContractError';
|
|
4142
|
+
readonly tag = ContractError_Tags.InvalidLength;
|
|
4143
|
+
readonly inner: Readonly<{
|
|
4144
|
+
field: string;
|
|
4145
|
+
expected: number;
|
|
4146
|
+
actual: number;
|
|
4147
|
+
}>;
|
|
4148
|
+
constructor(inner: { field: string; expected: number; actual: number }) {
|
|
4149
|
+
super('ContractError', 'InvalidLength');
|
|
4150
|
+
|
|
4151
|
+
this.inner = Object.freeze(inner);
|
|
4152
|
+
}
|
|
4153
|
+
static new(inner: {
|
|
4154
|
+
field: string;
|
|
4155
|
+
expected: number;
|
|
4156
|
+
actual: number;
|
|
4157
|
+
}): InvalidLength_ {
|
|
4158
|
+
return new InvalidLength_(inner);
|
|
4159
|
+
}
|
|
4160
|
+
|
|
4161
|
+
static instanceOf(obj: any): obj is InvalidLength_ {
|
|
4162
|
+
return obj.tag === ContractError_Tags.InvalidLength;
|
|
4163
|
+
}
|
|
4164
|
+
static hasInner(obj: any): obj is InvalidLength_ {
|
|
4165
|
+
return InvalidLength_.instanceOf(obj);
|
|
4166
|
+
}
|
|
4167
|
+
|
|
4168
|
+
static getInner(
|
|
4169
|
+
obj: InvalidLength_
|
|
4170
|
+
): Readonly<{ field: string; expected: number; actual: number }> {
|
|
4171
|
+
return obj.inner;
|
|
4172
|
+
}
|
|
4173
|
+
}
|
|
4174
|
+
|
|
4175
|
+
function instanceOf(obj: any): obj is ContractError {
|
|
4176
|
+
return obj[uniffiTypeNameSymbol] === 'ContractError';
|
|
4177
|
+
}
|
|
4178
|
+
|
|
4179
|
+
return Object.freeze({
|
|
4180
|
+
instanceOf,
|
|
4181
|
+
InvalidOffer: InvalidOffer_,
|
|
4182
|
+
InvalidAccept: InvalidAccept_,
|
|
4183
|
+
InvalidSign: InvalidSign_,
|
|
4184
|
+
InvalidFundingInput: InvalidFundingInput_,
|
|
4185
|
+
PsbtMismatch: PsbtMismatch_,
|
|
4186
|
+
MissingFinalizedInput: MissingFinalizedInput_,
|
|
4187
|
+
UnsupportedScriptType: UnsupportedScriptType_,
|
|
4188
|
+
InvalidAttestation: InvalidAttestation_,
|
|
4189
|
+
NoMatchingOutcome: NoMatchingOutcome_,
|
|
4190
|
+
Descriptor: Descriptor_,
|
|
4191
|
+
Wallet: Wallet_,
|
|
4192
|
+
Bip32: Bip32_,
|
|
4193
|
+
Dlc: Dlc_,
|
|
4194
|
+
Key: Key_,
|
|
4195
|
+
Serialization: Serialization_,
|
|
4196
|
+
InvalidNetwork: InvalidNetwork_,
|
|
4197
|
+
InvalidLength: InvalidLength_,
|
|
4198
|
+
});
|
|
4199
|
+
})();
|
|
4200
|
+
/**
|
|
4201
|
+
* Errors returned by the stateless contract API.
|
|
4202
|
+
*
|
|
4203
|
+
* Mirrors [`ddk::contract::ContractError`] as a uniffi error so the typed
|
|
4204
|
+
* variants survive across the binding boundary. Variants carry plain strings.
|
|
4205
|
+
*/
|
|
4206
|
+
export type ContractError = InstanceType<
|
|
4207
|
+
(typeof ContractError)[
|
|
4208
|
+
| 'InvalidOffer'
|
|
4209
|
+
| 'InvalidAccept'
|
|
4210
|
+
| 'InvalidSign'
|
|
4211
|
+
| 'InvalidFundingInput'
|
|
4212
|
+
| 'PsbtMismatch'
|
|
4213
|
+
| 'MissingFinalizedInput'
|
|
4214
|
+
| 'UnsupportedScriptType'
|
|
4215
|
+
| 'InvalidAttestation'
|
|
4216
|
+
| 'NoMatchingOutcome'
|
|
4217
|
+
| 'Descriptor'
|
|
4218
|
+
| 'Wallet'
|
|
4219
|
+
| 'Bip32'
|
|
4220
|
+
| 'Dlc'
|
|
4221
|
+
| 'Key'
|
|
4222
|
+
| 'Serialization'
|
|
4223
|
+
| 'InvalidNetwork'
|
|
4224
|
+
| 'InvalidLength']
|
|
4225
|
+
>;
|
|
4226
|
+
|
|
4227
|
+
// FfiConverter for enum ContractError
|
|
4228
|
+
const FfiConverterTypeContractError = (() => {
|
|
4229
|
+
const ordinalConverter = FfiConverterInt32;
|
|
4230
|
+
type TypeName = ContractError;
|
|
4231
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
4232
|
+
read(from: RustBuffer): TypeName {
|
|
4233
|
+
switch (ordinalConverter.read(from)) {
|
|
4234
|
+
case 1:
|
|
4235
|
+
return new ContractError.InvalidOffer({
|
|
4236
|
+
message: FfiConverterString.read(from),
|
|
4237
|
+
});
|
|
4238
|
+
case 2:
|
|
4239
|
+
return new ContractError.InvalidAccept({
|
|
4240
|
+
message: FfiConverterString.read(from),
|
|
4241
|
+
});
|
|
4242
|
+
case 3:
|
|
4243
|
+
return new ContractError.InvalidSign({
|
|
4244
|
+
message: FfiConverterString.read(from),
|
|
4245
|
+
});
|
|
4246
|
+
case 4:
|
|
4247
|
+
return new ContractError.InvalidFundingInput({
|
|
4248
|
+
message: FfiConverterString.read(from),
|
|
4249
|
+
});
|
|
4250
|
+
case 5:
|
|
4251
|
+
return new ContractError.PsbtMismatch({
|
|
4252
|
+
message: FfiConverterString.read(from),
|
|
4253
|
+
});
|
|
4254
|
+
case 6:
|
|
4255
|
+
return new ContractError.MissingFinalizedInput({
|
|
4256
|
+
inputIndex: FfiConverterUInt32.read(from),
|
|
4257
|
+
});
|
|
4258
|
+
case 7:
|
|
4259
|
+
return new ContractError.UnsupportedScriptType({
|
|
4260
|
+
inputIndex: FfiConverterUInt32.read(from),
|
|
4261
|
+
});
|
|
4262
|
+
case 8:
|
|
4263
|
+
return new ContractError.InvalidAttestation({
|
|
4264
|
+
message: FfiConverterString.read(from),
|
|
4265
|
+
});
|
|
4266
|
+
case 9:
|
|
4267
|
+
return new ContractError.NoMatchingOutcome();
|
|
4268
|
+
case 10:
|
|
4269
|
+
return new ContractError.Descriptor({
|
|
4270
|
+
message: FfiConverterString.read(from),
|
|
4271
|
+
});
|
|
4272
|
+
case 11:
|
|
4273
|
+
return new ContractError.Wallet({
|
|
4274
|
+
message: FfiConverterString.read(from),
|
|
4275
|
+
});
|
|
4276
|
+
case 12:
|
|
4277
|
+
return new ContractError.Bip32({
|
|
4278
|
+
message: FfiConverterString.read(from),
|
|
4279
|
+
});
|
|
4280
|
+
case 13:
|
|
4281
|
+
return new ContractError.Dlc({
|
|
4282
|
+
message: FfiConverterString.read(from),
|
|
4283
|
+
});
|
|
4284
|
+
case 14:
|
|
4285
|
+
return new ContractError.Key({
|
|
4286
|
+
message: FfiConverterString.read(from),
|
|
4287
|
+
});
|
|
4288
|
+
case 15:
|
|
4289
|
+
return new ContractError.Serialization({
|
|
4290
|
+
message: FfiConverterString.read(from),
|
|
4291
|
+
});
|
|
4292
|
+
case 16:
|
|
4293
|
+
return new ContractError.InvalidNetwork({
|
|
4294
|
+
message: FfiConverterString.read(from),
|
|
4295
|
+
});
|
|
4296
|
+
case 17:
|
|
4297
|
+
return new ContractError.InvalidLength({
|
|
4298
|
+
field: FfiConverterString.read(from),
|
|
4299
|
+
expected: FfiConverterUInt32.read(from),
|
|
4300
|
+
actual: FfiConverterUInt32.read(from),
|
|
4301
|
+
});
|
|
4302
|
+
default:
|
|
4303
|
+
throw new UniffiInternalError.UnexpectedEnumCase();
|
|
4304
|
+
}
|
|
4305
|
+
}
|
|
4306
|
+
write(value: TypeName, into: RustBuffer): void {
|
|
4307
|
+
switch (value.tag) {
|
|
4308
|
+
case ContractError_Tags.InvalidOffer: {
|
|
4309
|
+
ordinalConverter.write(1, into);
|
|
4310
|
+
const inner = value.inner;
|
|
4311
|
+
FfiConverterString.write(inner.message, into);
|
|
4312
|
+
return;
|
|
4313
|
+
}
|
|
4314
|
+
case ContractError_Tags.InvalidAccept: {
|
|
4315
|
+
ordinalConverter.write(2, into);
|
|
4316
|
+
const inner = value.inner;
|
|
4317
|
+
FfiConverterString.write(inner.message, into);
|
|
4318
|
+
return;
|
|
4319
|
+
}
|
|
4320
|
+
case ContractError_Tags.InvalidSign: {
|
|
4321
|
+
ordinalConverter.write(3, into);
|
|
4322
|
+
const inner = value.inner;
|
|
4323
|
+
FfiConverterString.write(inner.message, into);
|
|
4324
|
+
return;
|
|
4325
|
+
}
|
|
4326
|
+
case ContractError_Tags.InvalidFundingInput: {
|
|
4327
|
+
ordinalConverter.write(4, into);
|
|
4328
|
+
const inner = value.inner;
|
|
4329
|
+
FfiConverterString.write(inner.message, into);
|
|
4330
|
+
return;
|
|
4331
|
+
}
|
|
4332
|
+
case ContractError_Tags.PsbtMismatch: {
|
|
4333
|
+
ordinalConverter.write(5, into);
|
|
4334
|
+
const inner = value.inner;
|
|
4335
|
+
FfiConverterString.write(inner.message, into);
|
|
4336
|
+
return;
|
|
4337
|
+
}
|
|
4338
|
+
case ContractError_Tags.MissingFinalizedInput: {
|
|
4339
|
+
ordinalConverter.write(6, into);
|
|
4340
|
+
const inner = value.inner;
|
|
4341
|
+
FfiConverterUInt32.write(inner.inputIndex, into);
|
|
4342
|
+
return;
|
|
4343
|
+
}
|
|
4344
|
+
case ContractError_Tags.UnsupportedScriptType: {
|
|
4345
|
+
ordinalConverter.write(7, into);
|
|
4346
|
+
const inner = value.inner;
|
|
4347
|
+
FfiConverterUInt32.write(inner.inputIndex, into);
|
|
4348
|
+
return;
|
|
4349
|
+
}
|
|
4350
|
+
case ContractError_Tags.InvalidAttestation: {
|
|
4351
|
+
ordinalConverter.write(8, into);
|
|
4352
|
+
const inner = value.inner;
|
|
4353
|
+
FfiConverterString.write(inner.message, into);
|
|
4354
|
+
return;
|
|
4355
|
+
}
|
|
4356
|
+
case ContractError_Tags.NoMatchingOutcome: {
|
|
4357
|
+
ordinalConverter.write(9, into);
|
|
4358
|
+
return;
|
|
4359
|
+
}
|
|
4360
|
+
case ContractError_Tags.Descriptor: {
|
|
4361
|
+
ordinalConverter.write(10, into);
|
|
4362
|
+
const inner = value.inner;
|
|
4363
|
+
FfiConverterString.write(inner.message, into);
|
|
4364
|
+
return;
|
|
4365
|
+
}
|
|
4366
|
+
case ContractError_Tags.Wallet: {
|
|
4367
|
+
ordinalConverter.write(11, into);
|
|
4368
|
+
const inner = value.inner;
|
|
4369
|
+
FfiConverterString.write(inner.message, into);
|
|
4370
|
+
return;
|
|
4371
|
+
}
|
|
4372
|
+
case ContractError_Tags.Bip32: {
|
|
4373
|
+
ordinalConverter.write(12, into);
|
|
4374
|
+
const inner = value.inner;
|
|
4375
|
+
FfiConverterString.write(inner.message, into);
|
|
4376
|
+
return;
|
|
4377
|
+
}
|
|
4378
|
+
case ContractError_Tags.Dlc: {
|
|
4379
|
+
ordinalConverter.write(13, into);
|
|
4380
|
+
const inner = value.inner;
|
|
4381
|
+
FfiConverterString.write(inner.message, into);
|
|
4382
|
+
return;
|
|
4383
|
+
}
|
|
4384
|
+
case ContractError_Tags.Key: {
|
|
4385
|
+
ordinalConverter.write(14, into);
|
|
4386
|
+
const inner = value.inner;
|
|
4387
|
+
FfiConverterString.write(inner.message, into);
|
|
4388
|
+
return;
|
|
4389
|
+
}
|
|
4390
|
+
case ContractError_Tags.Serialization: {
|
|
4391
|
+
ordinalConverter.write(15, into);
|
|
4392
|
+
const inner = value.inner;
|
|
4393
|
+
FfiConverterString.write(inner.message, into);
|
|
4394
|
+
return;
|
|
4395
|
+
}
|
|
4396
|
+
case ContractError_Tags.InvalidNetwork: {
|
|
4397
|
+
ordinalConverter.write(16, into);
|
|
4398
|
+
const inner = value.inner;
|
|
4399
|
+
FfiConverterString.write(inner.message, into);
|
|
4400
|
+
return;
|
|
4401
|
+
}
|
|
4402
|
+
case ContractError_Tags.InvalidLength: {
|
|
4403
|
+
ordinalConverter.write(17, into);
|
|
4404
|
+
const inner = value.inner;
|
|
4405
|
+
FfiConverterString.write(inner.field, into);
|
|
4406
|
+
FfiConverterUInt32.write(inner.expected, into);
|
|
4407
|
+
FfiConverterUInt32.write(inner.actual, into);
|
|
4408
|
+
return;
|
|
4409
|
+
}
|
|
4410
|
+
default:
|
|
4411
|
+
// Throwing from here means that ContractError_Tags hasn't matched an ordinal.
|
|
4412
|
+
throw new UniffiInternalError.UnexpectedEnumCase();
|
|
4413
|
+
}
|
|
4414
|
+
}
|
|
4415
|
+
allocationSize(value: TypeName): number {
|
|
4416
|
+
switch (value.tag) {
|
|
4417
|
+
case ContractError_Tags.InvalidOffer: {
|
|
4418
|
+
const inner = value.inner;
|
|
4419
|
+
let size = ordinalConverter.allocationSize(1);
|
|
4420
|
+
size += FfiConverterString.allocationSize(inner.message);
|
|
4421
|
+
return size;
|
|
4422
|
+
}
|
|
4423
|
+
case ContractError_Tags.InvalidAccept: {
|
|
4424
|
+
const inner = value.inner;
|
|
4425
|
+
let size = ordinalConverter.allocationSize(2);
|
|
4426
|
+
size += FfiConverterString.allocationSize(inner.message);
|
|
4427
|
+
return size;
|
|
4428
|
+
}
|
|
4429
|
+
case ContractError_Tags.InvalidSign: {
|
|
4430
|
+
const inner = value.inner;
|
|
4431
|
+
let size = ordinalConverter.allocationSize(3);
|
|
4432
|
+
size += FfiConverterString.allocationSize(inner.message);
|
|
4433
|
+
return size;
|
|
4434
|
+
}
|
|
4435
|
+
case ContractError_Tags.InvalidFundingInput: {
|
|
4436
|
+
const inner = value.inner;
|
|
4437
|
+
let size = ordinalConverter.allocationSize(4);
|
|
4438
|
+
size += FfiConverterString.allocationSize(inner.message);
|
|
4439
|
+
return size;
|
|
4440
|
+
}
|
|
4441
|
+
case ContractError_Tags.PsbtMismatch: {
|
|
4442
|
+
const inner = value.inner;
|
|
4443
|
+
let size = ordinalConverter.allocationSize(5);
|
|
4444
|
+
size += FfiConverterString.allocationSize(inner.message);
|
|
4445
|
+
return size;
|
|
4446
|
+
}
|
|
4447
|
+
case ContractError_Tags.MissingFinalizedInput: {
|
|
4448
|
+
const inner = value.inner;
|
|
4449
|
+
let size = ordinalConverter.allocationSize(6);
|
|
4450
|
+
size += FfiConverterUInt32.allocationSize(inner.inputIndex);
|
|
4451
|
+
return size;
|
|
4452
|
+
}
|
|
4453
|
+
case ContractError_Tags.UnsupportedScriptType: {
|
|
4454
|
+
const inner = value.inner;
|
|
4455
|
+
let size = ordinalConverter.allocationSize(7);
|
|
4456
|
+
size += FfiConverterUInt32.allocationSize(inner.inputIndex);
|
|
4457
|
+
return size;
|
|
4458
|
+
}
|
|
4459
|
+
case ContractError_Tags.InvalidAttestation: {
|
|
4460
|
+
const inner = value.inner;
|
|
4461
|
+
let size = ordinalConverter.allocationSize(8);
|
|
4462
|
+
size += FfiConverterString.allocationSize(inner.message);
|
|
4463
|
+
return size;
|
|
4464
|
+
}
|
|
4465
|
+
case ContractError_Tags.NoMatchingOutcome: {
|
|
4466
|
+
return ordinalConverter.allocationSize(9);
|
|
4467
|
+
}
|
|
4468
|
+
case ContractError_Tags.Descriptor: {
|
|
4469
|
+
const inner = value.inner;
|
|
4470
|
+
let size = ordinalConverter.allocationSize(10);
|
|
4471
|
+
size += FfiConverterString.allocationSize(inner.message);
|
|
4472
|
+
return size;
|
|
4473
|
+
}
|
|
4474
|
+
case ContractError_Tags.Wallet: {
|
|
4475
|
+
const inner = value.inner;
|
|
4476
|
+
let size = ordinalConverter.allocationSize(11);
|
|
4477
|
+
size += FfiConverterString.allocationSize(inner.message);
|
|
4478
|
+
return size;
|
|
4479
|
+
}
|
|
4480
|
+
case ContractError_Tags.Bip32: {
|
|
4481
|
+
const inner = value.inner;
|
|
4482
|
+
let size = ordinalConverter.allocationSize(12);
|
|
4483
|
+
size += FfiConverterString.allocationSize(inner.message);
|
|
4484
|
+
return size;
|
|
4485
|
+
}
|
|
4486
|
+
case ContractError_Tags.Dlc: {
|
|
4487
|
+
const inner = value.inner;
|
|
4488
|
+
let size = ordinalConverter.allocationSize(13);
|
|
4489
|
+
size += FfiConverterString.allocationSize(inner.message);
|
|
4490
|
+
return size;
|
|
4491
|
+
}
|
|
4492
|
+
case ContractError_Tags.Key: {
|
|
4493
|
+
const inner = value.inner;
|
|
4494
|
+
let size = ordinalConverter.allocationSize(14);
|
|
4495
|
+
size += FfiConverterString.allocationSize(inner.message);
|
|
4496
|
+
return size;
|
|
4497
|
+
}
|
|
4498
|
+
case ContractError_Tags.Serialization: {
|
|
4499
|
+
const inner = value.inner;
|
|
4500
|
+
let size = ordinalConverter.allocationSize(15);
|
|
4501
|
+
size += FfiConverterString.allocationSize(inner.message);
|
|
4502
|
+
return size;
|
|
4503
|
+
}
|
|
4504
|
+
case ContractError_Tags.InvalidNetwork: {
|
|
4505
|
+
const inner = value.inner;
|
|
4506
|
+
let size = ordinalConverter.allocationSize(16);
|
|
4507
|
+
size += FfiConverterString.allocationSize(inner.message);
|
|
4508
|
+
return size;
|
|
4509
|
+
}
|
|
4510
|
+
case ContractError_Tags.InvalidLength: {
|
|
4511
|
+
const inner = value.inner;
|
|
4512
|
+
let size = ordinalConverter.allocationSize(17);
|
|
4513
|
+
size += FfiConverterString.allocationSize(inner.field);
|
|
4514
|
+
size += FfiConverterUInt32.allocationSize(inner.expected);
|
|
4515
|
+
size += FfiConverterUInt32.allocationSize(inner.actual);
|
|
4516
|
+
return size;
|
|
4517
|
+
}
|
|
4518
|
+
default:
|
|
4519
|
+
throw new UniffiInternalError.UnexpectedEnumCase();
|
|
4520
|
+
}
|
|
4521
|
+
}
|
|
4522
|
+
}
|
|
4523
|
+
return new FFIConverter();
|
|
4524
|
+
})();
|
|
4525
|
+
|
|
2083
4526
|
export enum ExtendedKey {
|
|
2084
4527
|
InvalidMnemonic,
|
|
2085
4528
|
InvalidXpriv,
|
|
@@ -2617,11 +5060,315 @@ const FfiConverterTypeDLCError = (() => {
|
|
|
2617
5060
|
return new FFIConverter();
|
|
2618
5061
|
})();
|
|
2619
5062
|
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
5063
|
+
/**
|
|
5064
|
+
* Identifies which party's funding inputs an operation applies to.
|
|
5065
|
+
*/
|
|
5066
|
+
export enum Party {
|
|
5067
|
+
/**
|
|
5068
|
+
* The party that created the offer.
|
|
5069
|
+
*/
|
|
5070
|
+
Offer,
|
|
5071
|
+
/**
|
|
5072
|
+
* The party that accepted the offer.
|
|
5073
|
+
*/
|
|
5074
|
+
Accept,
|
|
5075
|
+
}
|
|
5076
|
+
|
|
5077
|
+
const FfiConverterTypeParty = (() => {
|
|
5078
|
+
const ordinalConverter = FfiConverterInt32;
|
|
5079
|
+
type TypeName = Party;
|
|
5080
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
5081
|
+
read(from: RustBuffer): TypeName {
|
|
5082
|
+
switch (ordinalConverter.read(from)) {
|
|
5083
|
+
case 1:
|
|
5084
|
+
return Party.Offer;
|
|
5085
|
+
case 2:
|
|
5086
|
+
return Party.Accept;
|
|
5087
|
+
default:
|
|
5088
|
+
throw new UniffiInternalError.UnexpectedEnumCase();
|
|
5089
|
+
}
|
|
5090
|
+
}
|
|
5091
|
+
write(value: TypeName, into: RustBuffer): void {
|
|
5092
|
+
switch (value) {
|
|
5093
|
+
case Party.Offer:
|
|
5094
|
+
return ordinalConverter.write(1, into);
|
|
5095
|
+
case Party.Accept:
|
|
5096
|
+
return ordinalConverter.write(2, into);
|
|
5097
|
+
}
|
|
5098
|
+
}
|
|
5099
|
+
allocationSize(value: TypeName): number {
|
|
5100
|
+
return ordinalConverter.allocationSize(0);
|
|
5101
|
+
}
|
|
5102
|
+
}
|
|
5103
|
+
return new FFIConverter();
|
|
5104
|
+
})();
|
|
5105
|
+
|
|
5106
|
+
/**
|
|
5107
|
+
* Deterministically derives DLC contract funding keys from a master extended
|
|
5108
|
+
* private key. Secret keys never leave this object.
|
|
5109
|
+
*
|
|
5110
|
+
* Construct one from whatever key material the consumer holds, then call
|
|
5111
|
+
* [`ContractKeyProvider::funding_pubkey`] to obtain the public key to publish
|
|
5112
|
+
* in an offer/accept message.
|
|
5113
|
+
*/
|
|
5114
|
+
export interface ContractKeyProviderLike {
|
|
5115
|
+
/**
|
|
5116
|
+
* The 33-byte compressed funding public key for a contract, from its
|
|
5117
|
+
* 32-byte temporary id. Publish this in the offer or accept message.
|
|
5118
|
+
*/
|
|
5119
|
+
fundingPubkey(temporaryContractId: Uint8Array) /*throws*/ : Uint8Array;
|
|
5120
|
+
}
|
|
5121
|
+
/**
|
|
5122
|
+
* @deprecated Use `ContractKeyProviderLike` instead.
|
|
5123
|
+
*/
|
|
5124
|
+
export type ContractKeyProviderInterface = ContractKeyProviderLike;
|
|
5125
|
+
|
|
5126
|
+
/**
|
|
5127
|
+
* Deterministically derives DLC contract funding keys from a master extended
|
|
5128
|
+
* private key. Secret keys never leave this object.
|
|
5129
|
+
*
|
|
5130
|
+
* Construct one from whatever key material the consumer holds, then call
|
|
5131
|
+
* [`ContractKeyProvider::funding_pubkey`] to obtain the public key to publish
|
|
5132
|
+
* in an offer/accept message.
|
|
5133
|
+
*/
|
|
5134
|
+
export class ContractKeyProvider
|
|
5135
|
+
extends UniffiAbstractObject
|
|
5136
|
+
implements ContractKeyProviderLike
|
|
5137
|
+
{
|
|
5138
|
+
readonly [uniffiTypeNameSymbol] = 'ContractKeyProvider';
|
|
5139
|
+
readonly [destructorGuardSymbol]: UniffiGcObject;
|
|
5140
|
+
readonly [pointerLiteralSymbol]: UniffiHandle;
|
|
5141
|
+
// No primary constructor declared for this class.
|
|
5142
|
+
private constructor(pointer: UniffiHandle) {
|
|
5143
|
+
super();
|
|
5144
|
+
this[pointerLiteralSymbol] = pointer;
|
|
5145
|
+
this[destructorGuardSymbol] =
|
|
5146
|
+
uniffiTypeContractKeyProviderObjectFactory.bless(pointer);
|
|
5147
|
+
}
|
|
5148
|
+
|
|
5149
|
+
/**
|
|
5150
|
+
* Builds a provider from an output descriptor that carries an extended
|
|
5151
|
+
* private key (e.g. `wpkh(xprv.../84h/1h/0h/0/*)`). Watch-only descriptors
|
|
5152
|
+
* are rejected; the descriptor's own path/wildcard is not applied to
|
|
5153
|
+
* contract-key derivation.
|
|
5154
|
+
*/
|
|
5155
|
+
static fromDescriptor(
|
|
5156
|
+
descriptor: string
|
|
5157
|
+
): ContractKeyProviderLike /*throws*/ {
|
|
5158
|
+
return FfiConverterTypeContractKeyProvider.lift(
|
|
5159
|
+
uniffiCaller.rustCallWithError(
|
|
5160
|
+
/*liftError:*/ FfiConverterTypeContractError.lift.bind(
|
|
5161
|
+
FfiConverterTypeContractError
|
|
5162
|
+
),
|
|
5163
|
+
/*caller:*/ (callStatus) => {
|
|
5164
|
+
return nativeModule().ubrn_uniffi_ddk_ffi_fn_constructor_contractkeyprovider_from_descriptor(
|
|
5165
|
+
FfiConverterString.lower(
|
|
5166
|
+
descriptor,
|
|
5167
|
+
nativeModule().rustbuffer_alloc
|
|
5168
|
+
),
|
|
5169
|
+
callStatus
|
|
5170
|
+
);
|
|
5171
|
+
},
|
|
5172
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)
|
|
5173
|
+
)
|
|
5174
|
+
);
|
|
5175
|
+
}
|
|
5176
|
+
|
|
5177
|
+
/**
|
|
5178
|
+
* Builds a provider from a BIP39 mnemonic (with optional passphrase).
|
|
5179
|
+
*/
|
|
5180
|
+
static fromMnemonic(
|
|
5181
|
+
mnemonic: string,
|
|
5182
|
+
passphrase: string | undefined,
|
|
5183
|
+
network: string
|
|
5184
|
+
): ContractKeyProviderLike /*throws*/ {
|
|
5185
|
+
return FfiConverterTypeContractKeyProvider.lift(
|
|
5186
|
+
uniffiCaller.rustCallWithError(
|
|
5187
|
+
/*liftError:*/ FfiConverterTypeContractError.lift.bind(
|
|
5188
|
+
FfiConverterTypeContractError
|
|
5189
|
+
),
|
|
5190
|
+
/*caller:*/ (callStatus) => {
|
|
5191
|
+
return nativeModule().ubrn_uniffi_ddk_ffi_fn_constructor_contractkeyprovider_from_mnemonic(
|
|
5192
|
+
FfiConverterString.lower(mnemonic, nativeModule().rustbuffer_alloc),
|
|
5193
|
+
FfiConverterOptionalString.lower(
|
|
5194
|
+
passphrase,
|
|
5195
|
+
nativeModule().rustbuffer_alloc
|
|
5196
|
+
),
|
|
5197
|
+
FfiConverterString.lower(network, nativeModule().rustbuffer_alloc),
|
|
5198
|
+
callStatus
|
|
5199
|
+
);
|
|
5200
|
+
},
|
|
5201
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)
|
|
5202
|
+
)
|
|
5203
|
+
);
|
|
5204
|
+
}
|
|
5205
|
+
|
|
5206
|
+
/**
|
|
5207
|
+
* Builds a provider from a raw seed (for example the 64 bytes produced by
|
|
5208
|
+
* `convert_mnemonic_to_seed`).
|
|
5209
|
+
*/
|
|
5210
|
+
static fromSeed(
|
|
5211
|
+
seed: Uint8Array,
|
|
5212
|
+
network: string
|
|
5213
|
+
): ContractKeyProviderLike /*throws*/ {
|
|
5214
|
+
return FfiConverterTypeContractKeyProvider.lift(
|
|
5215
|
+
uniffiCaller.rustCallWithError(
|
|
5216
|
+
/*liftError:*/ FfiConverterTypeContractError.lift.bind(
|
|
5217
|
+
FfiConverterTypeContractError
|
|
5218
|
+
),
|
|
5219
|
+
/*caller:*/ (callStatus) => {
|
|
5220
|
+
return nativeModule().ubrn_uniffi_ddk_ffi_fn_constructor_contractkeyprovider_from_seed(
|
|
5221
|
+
FfiConverterUint8Array.lower(seed, nativeModule().rustbuffer_alloc),
|
|
5222
|
+
FfiConverterString.lower(network, nativeModule().rustbuffer_alloc),
|
|
5223
|
+
callStatus
|
|
5224
|
+
);
|
|
5225
|
+
},
|
|
5226
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)
|
|
5227
|
+
)
|
|
5228
|
+
);
|
|
5229
|
+
}
|
|
5230
|
+
|
|
5231
|
+
/**
|
|
5232
|
+
* Builds a provider from a 78-byte encoded master extended private key
|
|
5233
|
+
* (the encoding produced by `create_extkey_from_seed`).
|
|
5234
|
+
*/
|
|
5235
|
+
static fromXprv(xprv: Uint8Array): ContractKeyProviderLike /*throws*/ {
|
|
5236
|
+
return FfiConverterTypeContractKeyProvider.lift(
|
|
5237
|
+
uniffiCaller.rustCallWithError(
|
|
5238
|
+
/*liftError:*/ FfiConverterTypeContractError.lift.bind(
|
|
5239
|
+
FfiConverterTypeContractError
|
|
5240
|
+
),
|
|
5241
|
+
/*caller:*/ (callStatus) => {
|
|
5242
|
+
return nativeModule().ubrn_uniffi_ddk_ffi_fn_constructor_contractkeyprovider_from_xprv(
|
|
5243
|
+
FfiConverterUint8Array.lower(xprv, nativeModule().rustbuffer_alloc),
|
|
5244
|
+
callStatus
|
|
5245
|
+
);
|
|
5246
|
+
},
|
|
5247
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)
|
|
5248
|
+
)
|
|
5249
|
+
);
|
|
5250
|
+
}
|
|
5251
|
+
|
|
5252
|
+
/**
|
|
5253
|
+
* The 33-byte compressed funding public key for a contract, from its
|
|
5254
|
+
* 32-byte temporary id. Publish this in the offer or accept message.
|
|
5255
|
+
*/
|
|
5256
|
+
fundingPubkey(temporaryContractId: Uint8Array): Uint8Array /*throws*/ {
|
|
5257
|
+
return ((__rb: Uint8Array) => {
|
|
5258
|
+
try {
|
|
5259
|
+
return FfiConverterUint8Array.lift(__rb);
|
|
5260
|
+
} finally {
|
|
5261
|
+
nativeModule().rustbuffer_free(__rb);
|
|
5262
|
+
}
|
|
5263
|
+
})(
|
|
5264
|
+
uniffiCaller.rustCallWithError(
|
|
5265
|
+
/*liftError:*/ FfiConverterTypeContractError.lift.bind(
|
|
5266
|
+
FfiConverterTypeContractError
|
|
5267
|
+
),
|
|
5268
|
+
/*caller:*/ (callStatus) => {
|
|
5269
|
+
return nativeModule().ubrn_uniffi_ddk_ffi_fn_method_contractkeyprovider_funding_pubkey(
|
|
5270
|
+
uniffiTypeContractKeyProviderObjectFactory.clonePointer(this),
|
|
5271
|
+
FfiConverterUint8Array.lower(
|
|
5272
|
+
temporaryContractId,
|
|
5273
|
+
nativeModule().rustbuffer_alloc
|
|
5274
|
+
),
|
|
5275
|
+
callStatus
|
|
5276
|
+
);
|
|
5277
|
+
},
|
|
5278
|
+
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)
|
|
5279
|
+
)
|
|
5280
|
+
);
|
|
5281
|
+
}
|
|
5282
|
+
|
|
5283
|
+
uniffiDestroy(): void {
|
|
5284
|
+
const ptr = (this as any)[destructorGuardSymbol];
|
|
5285
|
+
if (ptr !== undefined) {
|
|
5286
|
+
const pointer = uniffiTypeContractKeyProviderObjectFactory.pointer(this);
|
|
5287
|
+
uniffiTypeContractKeyProviderObjectFactory.freePointer(pointer);
|
|
5288
|
+
uniffiTypeContractKeyProviderObjectFactory.unbless(ptr);
|
|
5289
|
+
delete (this as any)[destructorGuardSymbol];
|
|
5290
|
+
}
|
|
5291
|
+
}
|
|
5292
|
+
|
|
5293
|
+
static instanceOf(obj_: any): obj_ is ContractKeyProvider {
|
|
5294
|
+
return uniffiTypeContractKeyProviderObjectFactory.isConcreteType(obj_);
|
|
5295
|
+
}
|
|
5296
|
+
}
|
|
5297
|
+
|
|
5298
|
+
const uniffiTypeContractKeyProviderObjectFactory: UniffiObjectFactory<ContractKeyProviderLike> =
|
|
5299
|
+
(() => {
|
|
5300
|
+
return {
|
|
5301
|
+
create(pointer: UniffiHandle): ContractKeyProviderLike {
|
|
5302
|
+
const instance = Object.create(ContractKeyProvider.prototype);
|
|
5303
|
+
instance[pointerLiteralSymbol] = pointer;
|
|
5304
|
+
instance[destructorGuardSymbol] = this.bless(pointer);
|
|
5305
|
+
instance[uniffiTypeNameSymbol] = 'ContractKeyProvider';
|
|
5306
|
+
return instance;
|
|
5307
|
+
},
|
|
5308
|
+
|
|
5309
|
+
bless(p: UniffiHandle): UniffiGcObject {
|
|
5310
|
+
return uniffiCaller.rustCall(
|
|
5311
|
+
/*caller:*/ (status) =>
|
|
5312
|
+
nativeModule().ubrn_uniffi_internal_fn_method_contractkeyprovider_ffi__bless_pointer(
|
|
5313
|
+
p,
|
|
5314
|
+
status
|
|
5315
|
+
),
|
|
5316
|
+
/*liftString:*/ FfiConverterString.lift
|
|
5317
|
+
);
|
|
5318
|
+
},
|
|
5319
|
+
|
|
5320
|
+
unbless(ptr_: UniffiGcObject) {
|
|
5321
|
+
ptr_.markDestroyed();
|
|
5322
|
+
},
|
|
5323
|
+
|
|
5324
|
+
pointer(obj_: ContractKeyProviderLike): UniffiHandle {
|
|
5325
|
+
if ((obj_ as any)[destructorGuardSymbol] === undefined) {
|
|
5326
|
+
throw new UniffiInternalError.UnexpectedNullPointer();
|
|
5327
|
+
}
|
|
5328
|
+
return (obj_ as any)[pointerLiteralSymbol];
|
|
5329
|
+
},
|
|
5330
|
+
|
|
5331
|
+
clonePointer(obj_: ContractKeyProviderLike): UniffiHandle {
|
|
5332
|
+
const pointer = this.pointer(obj_);
|
|
5333
|
+
return uniffiCaller.rustCall(
|
|
5334
|
+
/*caller:*/ (callStatus) =>
|
|
5335
|
+
nativeModule().ubrn_uniffi_ddk_ffi_fn_clone_contractkeyprovider(
|
|
5336
|
+
pointer,
|
|
5337
|
+
callStatus
|
|
5338
|
+
),
|
|
5339
|
+
/*liftString:*/ FfiConverterString.lift
|
|
5340
|
+
);
|
|
5341
|
+
},
|
|
5342
|
+
|
|
5343
|
+
freePointer(pointer: UniffiHandle): void {
|
|
5344
|
+
uniffiCaller.rustCall(
|
|
5345
|
+
/*caller:*/ (callStatus) =>
|
|
5346
|
+
nativeModule().ubrn_uniffi_ddk_ffi_fn_free_contractkeyprovider(
|
|
5347
|
+
pointer,
|
|
5348
|
+
callStatus
|
|
5349
|
+
),
|
|
5350
|
+
/*liftString:*/ FfiConverterString.lift
|
|
5351
|
+
);
|
|
5352
|
+
},
|
|
5353
|
+
|
|
5354
|
+
isConcreteType(obj_: any): obj_ is ContractKeyProviderLike {
|
|
5355
|
+
return (
|
|
5356
|
+
obj_[destructorGuardSymbol] &&
|
|
5357
|
+
obj_[uniffiTypeNameSymbol] === 'ContractKeyProvider'
|
|
5358
|
+
);
|
|
5359
|
+
},
|
|
5360
|
+
};
|
|
5361
|
+
})();
|
|
5362
|
+
const FfiConverterTypeContractKeyProvider = new FfiConverterObject(
|
|
5363
|
+
uniffiTypeContractKeyProviderObjectFactory
|
|
2623
5364
|
);
|
|
2624
5365
|
|
|
5366
|
+
// FfiConverter for Array<Uint8Array>
|
|
5367
|
+
const FfiConverterSequenceBytes = new FfiConverterArray(FfiConverterUint8Array);
|
|
5368
|
+
|
|
5369
|
+
// FfiConverter for bigint | undefined
|
|
5370
|
+
const FfiConverterOptionalUInt64 = new FfiConverterOptional(FfiConverterUInt64);
|
|
5371
|
+
|
|
2625
5372
|
// FfiConverter for Array<TxInput>
|
|
2626
5373
|
const FfiConverterSequenceTypeTxInput = new FfiConverterArray(
|
|
2627
5374
|
FfiConverterTypeTxInput
|
|
@@ -2637,6 +5384,19 @@ const FfiConverterSequenceTypeTransaction = new FfiConverterArray(
|
|
|
2637
5384
|
FfiConverterTypeTransaction
|
|
2638
5385
|
);
|
|
2639
5386
|
|
|
5387
|
+
// FfiConverter for string | undefined
|
|
5388
|
+
const FfiConverterOptionalString = new FfiConverterOptional(FfiConverterString);
|
|
5389
|
+
|
|
5390
|
+
// FfiConverter for Array<PayoutRow>
|
|
5391
|
+
const FfiConverterSequenceTypePayoutRow = new FfiConverterArray(
|
|
5392
|
+
FfiConverterTypePayoutRow
|
|
5393
|
+
);
|
|
5394
|
+
|
|
5395
|
+
// FfiConverter for Uint8Array | undefined
|
|
5396
|
+
const FfiConverterOptionalBytes = new FfiConverterOptional(
|
|
5397
|
+
FfiConverterUint8Array
|
|
5398
|
+
);
|
|
5399
|
+
|
|
2640
5400
|
// FfiConverter for Array<TxInputInfo>
|
|
2641
5401
|
const FfiConverterSequenceTypeTxInputInfo = new FfiConverterArray(
|
|
2642
5402
|
FfiConverterTypeTxInputInfo
|
|
@@ -2647,20 +5407,17 @@ const FfiConverterSequenceTypeDlcInputInfo = new FfiConverterArray(
|
|
|
2647
5407
|
FfiConverterTypeDlcInputInfo
|
|
2648
5408
|
);
|
|
2649
5409
|
|
|
2650
|
-
// FfiConverter for string | undefined
|
|
2651
|
-
const FfiConverterOptionalString = new FfiConverterOptional(FfiConverterString);
|
|
2652
|
-
|
|
2653
5410
|
// FfiConverter for Array<OracleInfo>
|
|
2654
5411
|
const FfiConverterSequenceTypeOracleInfo = new FfiConverterArray(
|
|
2655
5412
|
FfiConverterTypeOracleInfo
|
|
2656
5413
|
);
|
|
2657
5414
|
|
|
2658
|
-
// FfiConverter for Array<Array<
|
|
5415
|
+
// FfiConverter for Array<Array<Uint8Array>>
|
|
2659
5416
|
const FfiConverterSequenceSequenceBytes = new FfiConverterArray(
|
|
2660
5417
|
FfiConverterSequenceBytes
|
|
2661
5418
|
);
|
|
2662
5419
|
|
|
2663
|
-
// FfiConverter for Array<Array<Array<
|
|
5420
|
+
// FfiConverter for Array<Array<Array<Uint8Array>>>
|
|
2664
5421
|
const FfiConverterSequenceSequenceSequenceBytes = new FfiConverterArray(
|
|
2665
5422
|
FfiConverterSequenceSequenceBytes
|
|
2666
5423
|
);
|
|
@@ -2675,6 +5432,21 @@ const FfiConverterSequenceTypePayout = new FfiConverterArray(
|
|
|
2675
5432
|
FfiConverterTypePayout
|
|
2676
5433
|
);
|
|
2677
5434
|
|
|
5435
|
+
// FfiConverter for Array<SpliceKeyRef>
|
|
5436
|
+
const FfiConverterSequenceTypeSpliceKeyRef = new FfiConverterArray(
|
|
5437
|
+
FfiConverterTypeSpliceKeyRef
|
|
5438
|
+
);
|
|
5439
|
+
|
|
5440
|
+
// FfiConverter for Array<OracleAttestationRef>
|
|
5441
|
+
const FfiConverterSequenceTypeOracleAttestationRef = new FfiConverterArray(
|
|
5442
|
+
FfiConverterTypeOracleAttestationRef
|
|
5443
|
+
);
|
|
5444
|
+
|
|
5445
|
+
// FfiConverter for Array<DescriptorInput>
|
|
5446
|
+
const FfiConverterSequenceTypeDescriptorInput = new FfiConverterArray(
|
|
5447
|
+
FfiConverterTypeDescriptorInput
|
|
5448
|
+
);
|
|
5449
|
+
|
|
2678
5450
|
/**
|
|
2679
5451
|
* This should be called before anything else.
|
|
2680
5452
|
*
|
|
@@ -2697,6 +5469,37 @@ function uniffiEnsureInitialized() {
|
|
|
2697
5469
|
bindingsContractVersion
|
|
2698
5470
|
);
|
|
2699
5471
|
}
|
|
5472
|
+
if (
|
|
5473
|
+
nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_accept_offer() !== 49334
|
|
5474
|
+
) {
|
|
5475
|
+
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
5476
|
+
'uniffi_ddk_ffi_checksum_func_accept_offer'
|
|
5477
|
+
);
|
|
5478
|
+
}
|
|
5479
|
+
if (
|
|
5480
|
+
nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_chain_hash_from_network() !==
|
|
5481
|
+
782
|
|
5482
|
+
) {
|
|
5483
|
+
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
5484
|
+
'uniffi_ddk_ffi_checksum_func_chain_hash_from_network'
|
|
5485
|
+
);
|
|
5486
|
+
}
|
|
5487
|
+
if (
|
|
5488
|
+
nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_compute_contract_id() !==
|
|
5489
|
+
7849
|
|
5490
|
+
) {
|
|
5491
|
+
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
5492
|
+
'uniffi_ddk_ffi_checksum_func_compute_contract_id'
|
|
5493
|
+
);
|
|
5494
|
+
}
|
|
5495
|
+
if (
|
|
5496
|
+
nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_contract_info_payouts() !==
|
|
5497
|
+
5148
|
|
5498
|
+
) {
|
|
5499
|
+
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
5500
|
+
'uniffi_ddk_ffi_checksum_func_contract_info_payouts'
|
|
5501
|
+
);
|
|
5502
|
+
}
|
|
2700
5503
|
if (
|
|
2701
5504
|
nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_convert_mnemonic_to_seed() !==
|
|
2702
5505
|
29793
|
|
@@ -2741,6 +5544,14 @@ function uniffiEnsureInitialized() {
|
|
|
2741
5544
|
'uniffi_ddk_ffi_checksum_func_create_cets'
|
|
2742
5545
|
);
|
|
2743
5546
|
}
|
|
5547
|
+
if (
|
|
5548
|
+
nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_create_dlc_splice_input() !==
|
|
5549
|
+
50727
|
|
5550
|
+
) {
|
|
5551
|
+
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
5552
|
+
'uniffi_ddk_ffi_checksum_func_create_dlc_splice_input'
|
|
5553
|
+
);
|
|
5554
|
+
}
|
|
2744
5555
|
if (
|
|
2745
5556
|
nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_create_dlc_transactions() !==
|
|
2746
5557
|
60266
|
|
@@ -2773,6 +5584,21 @@ function uniffiEnsureInitialized() {
|
|
|
2773
5584
|
'uniffi_ddk_ffi_checksum_func_create_fund_tx_locking_script'
|
|
2774
5585
|
);
|
|
2775
5586
|
}
|
|
5587
|
+
if (
|
|
5588
|
+
nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_create_funding_psbt() !==
|
|
5589
|
+
39942
|
|
5590
|
+
) {
|
|
5591
|
+
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
5592
|
+
'uniffi_ddk_ffi_checksum_func_create_funding_psbt'
|
|
5593
|
+
);
|
|
5594
|
+
}
|
|
5595
|
+
if (
|
|
5596
|
+
nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_create_offer() !== 39327
|
|
5597
|
+
) {
|
|
5598
|
+
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
5599
|
+
'uniffi_ddk_ffi_checksum_func_create_offer'
|
|
5600
|
+
);
|
|
5601
|
+
}
|
|
2776
5602
|
if (
|
|
2777
5603
|
nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_create_refund_transaction() !==
|
|
2778
5604
|
40230
|
|
@@ -2797,6 +5623,22 @@ function uniffiEnsureInitialized() {
|
|
|
2797
5623
|
'uniffi_ddk_ffi_checksum_func_create_xpriv_from_parent_path'
|
|
2798
5624
|
);
|
|
2799
5625
|
}
|
|
5626
|
+
if (
|
|
5627
|
+
nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_dlc_input_max_witness_len() !==
|
|
5628
|
+
49586
|
|
5629
|
+
) {
|
|
5630
|
+
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
5631
|
+
'uniffi_ddk_ffi_checksum_func_dlc_input_max_witness_len'
|
|
5632
|
+
);
|
|
5633
|
+
}
|
|
5634
|
+
if (
|
|
5635
|
+
nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_dlc_transactions_from_messages() !==
|
|
5636
|
+
56492
|
|
5637
|
+
) {
|
|
5638
|
+
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
5639
|
+
'uniffi_ddk_ffi_checksum_func_dlc_transactions_from_messages'
|
|
5640
|
+
);
|
|
5641
|
+
}
|
|
2800
5642
|
if (
|
|
2801
5643
|
nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_extract_ecdsa_signature_from_oracle_signatures() !==
|
|
2802
5644
|
4868
|
|
@@ -2805,6 +5647,28 @@ function uniffiEnsureInitialized() {
|
|
|
2805
5647
|
'uniffi_ddk_ffi_checksum_func_extract_ecdsa_signature_from_oracle_signatures'
|
|
2806
5648
|
);
|
|
2807
5649
|
}
|
|
5650
|
+
if (
|
|
5651
|
+
nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_finalize_sign() !== 20463
|
|
5652
|
+
) {
|
|
5653
|
+
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
5654
|
+
'uniffi_ddk_ffi_checksum_func_finalize_sign'
|
|
5655
|
+
);
|
|
5656
|
+
}
|
|
5657
|
+
if (
|
|
5658
|
+
nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_finalize_sign_spliced() !==
|
|
5659
|
+
32005
|
|
5660
|
+
) {
|
|
5661
|
+
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
5662
|
+
'uniffi_ddk_ffi_checksum_func_finalize_sign_spliced'
|
|
5663
|
+
);
|
|
5664
|
+
}
|
|
5665
|
+
if (
|
|
5666
|
+
nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_funding_input() !== 64911
|
|
5667
|
+
) {
|
|
5668
|
+
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
5669
|
+
'uniffi_ddk_ffi_checksum_func_funding_input'
|
|
5670
|
+
);
|
|
5671
|
+
}
|
|
2808
5672
|
if (
|
|
2809
5673
|
nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_get_pubkey_from_extkey() !==
|
|
2810
5674
|
18050
|
|
@@ -2829,6 +5693,66 @@ function uniffiEnsureInitialized() {
|
|
|
2829
5693
|
'uniffi_ddk_ffi_checksum_func_get_xpub_from_xpriv'
|
|
2830
5694
|
);
|
|
2831
5695
|
}
|
|
5696
|
+
if (
|
|
5697
|
+
nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_sign_accept() !== 37062
|
|
5698
|
+
) {
|
|
5699
|
+
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
5700
|
+
'uniffi_ddk_ffi_checksum_func_sign_accept'
|
|
5701
|
+
);
|
|
5702
|
+
}
|
|
5703
|
+
if (
|
|
5704
|
+
nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_sign_accept_spliced() !==
|
|
5705
|
+
32504
|
|
5706
|
+
) {
|
|
5707
|
+
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
5708
|
+
'uniffi_ddk_ffi_checksum_func_sign_accept_spliced'
|
|
5709
|
+
);
|
|
5710
|
+
}
|
|
5711
|
+
if (
|
|
5712
|
+
nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_sign_contract_cet() !==
|
|
5713
|
+
36727
|
|
5714
|
+
) {
|
|
5715
|
+
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
5716
|
+
'uniffi_ddk_ffi_checksum_func_sign_contract_cet'
|
|
5717
|
+
);
|
|
5718
|
+
}
|
|
5719
|
+
if (
|
|
5720
|
+
nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_sign_contract_refund() !==
|
|
5721
|
+
23156
|
|
5722
|
+
) {
|
|
5723
|
+
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
5724
|
+
'uniffi_ddk_ffi_checksum_func_sign_contract_refund'
|
|
5725
|
+
);
|
|
5726
|
+
}
|
|
5727
|
+
if (
|
|
5728
|
+
nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_sign_funding_psbt_with_descriptor() !==
|
|
5729
|
+
25961
|
|
5730
|
+
) {
|
|
5731
|
+
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
5732
|
+
'uniffi_ddk_ffi_checksum_func_sign_funding_psbt_with_descriptor'
|
|
5733
|
+
);
|
|
5734
|
+
}
|
|
5735
|
+
if (
|
|
5736
|
+
nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_validate_accept() !== 9081
|
|
5737
|
+
) {
|
|
5738
|
+
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
5739
|
+
'uniffi_ddk_ffi_checksum_func_validate_accept'
|
|
5740
|
+
);
|
|
5741
|
+
}
|
|
5742
|
+
if (
|
|
5743
|
+
nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_validate_offer() !== 24632
|
|
5744
|
+
) {
|
|
5745
|
+
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
5746
|
+
'uniffi_ddk_ffi_checksum_func_validate_offer'
|
|
5747
|
+
);
|
|
5748
|
+
}
|
|
5749
|
+
if (
|
|
5750
|
+
nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_validate_sign() !== 7419
|
|
5751
|
+
) {
|
|
5752
|
+
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
5753
|
+
'uniffi_ddk_ffi_checksum_func_validate_sign'
|
|
5754
|
+
);
|
|
5755
|
+
}
|
|
2832
5756
|
if (
|
|
2833
5757
|
nativeModule().ubrn_uniffi_ddk_ffi_checksum_func_verify_cet_adaptor_sigs_from_oracle_info() !==
|
|
2834
5758
|
32235
|
|
@@ -2842,21 +5766,74 @@ function uniffiEnsureInitialized() {
|
|
|
2842
5766
|
'uniffi_ddk_ffi_checksum_func_version'
|
|
2843
5767
|
);
|
|
2844
5768
|
}
|
|
5769
|
+
if (
|
|
5770
|
+
nativeModule().ubrn_uniffi_ddk_ffi_checksum_constructor_contractkeyprovider_from_descriptor() !==
|
|
5771
|
+
47034
|
|
5772
|
+
) {
|
|
5773
|
+
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
5774
|
+
'uniffi_ddk_ffi_checksum_constructor_contractkeyprovider_from_descriptor'
|
|
5775
|
+
);
|
|
5776
|
+
}
|
|
5777
|
+
if (
|
|
5778
|
+
nativeModule().ubrn_uniffi_ddk_ffi_checksum_constructor_contractkeyprovider_from_mnemonic() !==
|
|
5779
|
+
47667
|
|
5780
|
+
) {
|
|
5781
|
+
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
5782
|
+
'uniffi_ddk_ffi_checksum_constructor_contractkeyprovider_from_mnemonic'
|
|
5783
|
+
);
|
|
5784
|
+
}
|
|
5785
|
+
if (
|
|
5786
|
+
nativeModule().ubrn_uniffi_ddk_ffi_checksum_constructor_contractkeyprovider_from_seed() !==
|
|
5787
|
+
47192
|
|
5788
|
+
) {
|
|
5789
|
+
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
5790
|
+
'uniffi_ddk_ffi_checksum_constructor_contractkeyprovider_from_seed'
|
|
5791
|
+
);
|
|
5792
|
+
}
|
|
5793
|
+
if (
|
|
5794
|
+
nativeModule().ubrn_uniffi_ddk_ffi_checksum_constructor_contractkeyprovider_from_xprv() !==
|
|
5795
|
+
7002
|
|
5796
|
+
) {
|
|
5797
|
+
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
5798
|
+
'uniffi_ddk_ffi_checksum_constructor_contractkeyprovider_from_xprv'
|
|
5799
|
+
);
|
|
5800
|
+
}
|
|
5801
|
+
if (
|
|
5802
|
+
nativeModule().ubrn_uniffi_ddk_ffi_checksum_method_contractkeyprovider_funding_pubkey() !==
|
|
5803
|
+
58577
|
|
5804
|
+
) {
|
|
5805
|
+
throw new UniffiInternalError.ApiChecksumMismatch(
|
|
5806
|
+
'uniffi_ddk_ffi_checksum_method_contractkeyprovider_funding_pubkey'
|
|
5807
|
+
);
|
|
5808
|
+
}
|
|
2845
5809
|
}
|
|
2846
5810
|
|
|
2847
5811
|
export default Object.freeze({
|
|
2848
5812
|
initialize: uniffiEnsureInitialized,
|
|
2849
5813
|
converters: {
|
|
5814
|
+
FfiConverterTypeAcceptOfferParams,
|
|
5815
|
+
FfiConverterTypeAcceptResult,
|
|
2850
5816
|
FfiConverterTypeAdaptorSignature,
|
|
2851
5817
|
FfiConverterTypeCetAdaptorSignatureDebugInfo,
|
|
2852
5818
|
FfiConverterTypeChangeOutputAndFees,
|
|
5819
|
+
FfiConverterTypeContractError,
|
|
5820
|
+
FfiConverterTypeContractKeyProvider,
|
|
5821
|
+
FfiConverterTypeContractPartyParams,
|
|
5822
|
+
FfiConverterTypeContractPayouts,
|
|
5823
|
+
FfiConverterTypeCreateOfferParams,
|
|
2853
5824
|
FfiConverterTypeDLCError,
|
|
5825
|
+
FfiConverterTypeDescriptorInput,
|
|
2854
5826
|
FfiConverterTypeDlcInputInfo,
|
|
2855
5827
|
FfiConverterTypeDlcTransactions,
|
|
2856
5828
|
FfiConverterTypeExtendedKey,
|
|
5829
|
+
FfiConverterTypeOracleAttestationRef,
|
|
2857
5830
|
FfiConverterTypeOracleInfo,
|
|
5831
|
+
FfiConverterTypeParty,
|
|
2858
5832
|
FfiConverterTypePartyParams,
|
|
2859
5833
|
FfiConverterTypePayout,
|
|
5834
|
+
FfiConverterTypePayoutRow,
|
|
5835
|
+
FfiConverterTypeSignResult,
|
|
5836
|
+
FfiConverterTypeSpliceKeyRef,
|
|
2860
5837
|
FfiConverterTypeTransaction,
|
|
2861
5838
|
FfiConverterTypeTxInput,
|
|
2862
5839
|
FfiConverterTypeTxInputInfo,
|