simplicityhl-as-rust 0.2.0

Tools for working with SimplicityHL as literal Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
/* This file has been automatically generated. */

//! Transaction
//!
//! This module defines jets to introspect the contents of an Elements transaction.

#![allow(unused)]
#![allow(clippy::complexity)]

use super::*;

/// Return the [`input_amount`] at the [`current_index`].
///
/// ## Cost
///
/// 225 mWU _(milli weight units)_
pub fn current_amount() -> (Asset1, Amount1) {
    todo!()
}

/// Return the [`input_annex_hash`] at th [`current_index`].
///
/// ## Cost
///
/// 79 mWU _(milli weight units)_
pub fn current_annex_hash() -> Option<u256> {
    todo!()
}

/// Return the [`input_asset`] at the [`current_index`].
///
/// ## Cost
///
/// 171 mWU _(milli weight units)_
pub fn current_asset() -> Asset1 {
    todo!()
}

/// Return the index of the current txin.
///
/// ## Cost
///
/// 88 mWU _(milli weight units)_
pub fn current_index() -> u32 {
    todo!()
}

/// Return the [`issuance_asset_amount`] at the [`current_index`].
///
/// ## Cost
///
/// 165 mWU _(milli weight units)_
pub fn current_issuance_asset_amount() -> Option<Amount1> {
    todo!()
}

/// Return the [`issuance_asset_proof`]  at the [`current_index`].
///
/// ## Cost
///
/// 140 mWU _(milli weight units)_
pub fn current_issuance_asset_proof() -> u256 {
    todo!()
}

/// Return the [`issuance_token_amount`] at the [`current_index`].
///
/// ## Cost
///
/// 188 mWU _(milli weight units)_
pub fn current_issuance_token_amount() -> Option<TokenAmount1> {
    todo!()
}

/// Return the [`issuance_token_proof`]  at the [`current_index`].
///
/// ## Cost
///
/// 144 mWU _(milli weight units)_
pub fn current_issuance_token_proof() -> u256 {
    todo!()
}

/// Return the [`new_issuance_contract`] at the [`current_index`].
///
/// ## Cost
///
/// 145 mWU _(milli weight units)_
pub fn current_new_issuance_contract() -> Option<u256> {
    todo!()
}

/// Return the [`input_pegin`] at the [`current_index`].
///
/// ## Cost
///
/// 147 mWU _(milli weight units)_
pub fn current_pegin() -> Option<u256> {
    todo!()
}

/// Return the previous outpoint of the current txin.
///
/// ## Cost
///
/// 156 mWU _(milli weight units)_
pub fn current_prev_outpoint() -> Outpoint {
    todo!()
}

/// Return the [`reissuance_blinding`] at the [`current_index`].
///
/// ## Cost
///
/// 94 mWU _(milli weight units)_
pub fn current_reissuance_blinding() -> Option<ExplicitNonce> {
    todo!()
}

/// Return the [`reissuance_entropy`]  at the [`current_index`].
///
/// ## Cost
///
/// 85 mWU _(milli weight units)_
pub fn current_reissuance_entropy() -> Option<u256> {
    todo!()
}

/// Return the SHA256 hash of the scriptPubKey of the UTXO of the current txin.
///
/// ## Cost
///
/// 134 mWU _(milli weight units)_
pub fn current_script_hash() -> u256 {
    todo!()
}

/// Return the SHA256 hash of the scriptSig of the current txin.
///
/// SegWit UTXOs enforce scriptSig to be the empty string. In such cases, we return the SHA256 hash of the empty string.
///
/// ## Cost
///
/// 139 mWU _(milli weight units)_
pub fn current_script_sig_hash() -> u256 {
    todo!()
}

/// Return the nSequence of the current txin.
///
/// Use this jet to obtain the raw, encoded sequence number.
/// Use [`tx_lock_distance`] to obtain a relative block height, or [`tx_lock_duration`] to obtain a relative UNIX timestamp, in a safe manner.
///
/// ## Cost
///
/// 89 mWU _(milli weight units)_
pub fn current_sequence() -> u32 {
    todo!()
}

/// Return the SHA256 hash of the genesis block.
///
/// ## Cost
///
/// 148 mWU _(milli weight units)_
pub fn genesis_block_hash() -> u256 {
    todo!()
}

/// Return the asset id and the asset amount at the given input index.
///
/// Return `None` if the input does not exist.
///
/// ## Cost
///
/// 285 mWU _(milli weight units)_
pub fn input_amount(a: u32) -> Option<(Asset1, Amount1)> {
    todo!()
}

/// Return the SHA256 hash of the annex at the given input:
/// - Return `Some(Some(x))` if the input has an annex that hashes to `x`.
/// - Return `Some(None`) if the input has no annex.
/// - Return `None` if the input does not exist.
///
/// ## Cost
///
/// 90 mWU _(milli weight units)_
pub fn input_annex_hash(a: u32) -> Option<Option<u256>> {
    todo!()
}

/// Return the asset id of the input at the given index.
///
/// Return `None` if the input does not exist.
///
/// ## Cost
///
/// 162 mWU _(milli weight units)_
pub fn input_asset(a: u32) -> Option<Asset1> {
    todo!()
}

/// Return the parent genesis block hash if the input at the given index is a peg-in.
///
/// - Return `Some(None)` if the input is not a peg-in.
/// - Return `None` if the input does not exist.
///
/// ## Cost
///
/// 151 mWU _(milli weight units)_
pub fn input_pegin(a: u32) -> Option<Option<u256>> {
    todo!()
}

/// Return the previous outpoint of the input at the given index.
///
/// Return `None` if the input does not exist.
///
/// ## Cost
///
/// 160 mWU _(milli weight units)_
pub fn input_prev_outpoint(a: u32) -> Option<Outpoint> {
    todo!()
}

/// Return the SHA256 hash of the scriptPubKey of the UTXO of the input at the given index.
///
/// Return `None` if the input does not exist.
///
/// ## Cost
///
/// 147 mWU _(milli weight units)_
pub fn input_script_hash(a: u32) -> Option<u256> {
    todo!()
}

/// Return the SHA256 hash of the scriptSigKey of the input at the given index.
///
/// Return `None` if the input does not exist.
///
/// SegWit UTXOs enforce scriptSig to be the empty string. In such cases, we return the SHA256 hash of the empty string.
///
/// ## Cost
///
/// 153 mWU _(milli weight units)_
pub fn input_script_sig_hash(a: u32) -> Option<u256> {
    todo!()
}

/// Return the nSequence of the input at the given index.
///
/// Return `None` if the input does not exist.
///
/// ## Cost
///
/// 99 mWU _(milli weight units)_
pub fn input_sequence(a: u32) -> Option<u32> {
    todo!()
}

/// Return the internal key of the current input.
///
/// We assume that Simplicity can be spent in Taproot outputs only, so there always exists an internal key.
///
/// ## Cost
///
/// 152 mWU _(milli weight units)_
pub fn internal_key() -> Pubkey {
    todo!()
}

/// Return the possibly confidential amount of the issuance if the input at the given index has an issuance.
///
/// - Return `Some(None)` if the input does not have an issuance.
/// - Return `None` if the input does not exist.
///
/// ## Cost
///
/// 162 mWU _(milli weight units)_
pub fn issuance_asset_amount(a: u32) -> Option<Option<Amount1>> {
    todo!()
}

/// Return the SHA256 hash of the range proof for the amount of the issuance at the given input index.
///
/// - Return the hash of the empty string if the input does not have an issuance.
/// - Return `None` if the input does not exist.
///
/// ## Cost
///
/// 150 mWU _(milli weight units)_
pub fn issuance_asset_proof(a: u32) -> Option<u256> {
    todo!()
}

/// Return the possibly confidential amount of the reissuance tokens if the input at the given index has an issuance.
///
/// - Return `Some(Some(Right(0)))` if the input is itself a reissuance.
/// - Return `Some(None)` if the input does not have an issuance.
/// - Return `None` if the input does not exist.
///
/// ## Cost
///
/// 196 mWU _(milli weight units)_
pub fn issuance_token_amount(a: u32) -> Option<Option<TokenAmount1>> {
    todo!()
}

/// Return the SHA256 hash of the range proof for the amount of the reissuance tokens at the given input index.
///
/// - Return the hash of the empty string if the input does not have an issuance.
/// - Return `None` if the input does not exist.
///
/// ## Cost
///
/// 150 mWU _(milli weight units)_
pub fn issuance_token_proof(a: u32) -> Option<u256> {
    todo!()
}

/// Return the lock time of the transaction.
///
/// ## Cost
///
/// 85 mWU _(milli weight units)_
pub fn lock_time() -> Lock {
    todo!()
}

/// Return the contract hash for the new issuance at the given input index.
///
/// - Return `Some(None)` if the input does not have a new issuance.
/// - Return `None` if the input does not exist.
///
/// ## Cost
///
/// 157 mWU _(milli weight units)_
pub fn new_issuance_contract(a: u32) -> Option<Option<u256>> {
    todo!()
}

/// Return the number of inputs of the transaction.
///
/// ## Cost
///
/// 86 mWU _(milli weight units)_
pub fn num_inputs() -> u32 {
    todo!()
}

/// Return the number of outputs of the transaction.
///
/// ## Cost
///
/// 79 mWU _(milli weight units)_
pub fn num_outputs() -> u32 {
    todo!()
}

/// Return the asset amount of the output at the given index.
///
/// Return `None` if the output does not exist.
///
/// ## Cost
///
/// 298 mWU _(milli weight units)_
pub fn output_amount(a: u32) -> Option<(Asset1, Amount1)> {
    todo!()
}

/// Return the asset id of the output at the given index.
///
/// Return `None` if the output does not exist.
///
/// ## Cost
///
/// 170 mWU _(milli weight units)_
pub fn output_asset(a: u32) -> Option<Asset1> {
    todo!()
}

/// Check if the output at the given index is a fee output.
///
/// Return `None` if the output does not exist.
///
/// ## Cost
///
/// 92 mWU _(milli weight units)_
pub fn output_is_fee(a: u32) -> Option<bool> {
    todo!()
}

/// Return the nonce of the output at the given index.
///
/// - Return `Some(None)` if the output does not have a nonce.
/// - Return `None` if the output does not exist.
///
/// ## Cost
///
/// 196 mWU _(milli weight units)_
pub fn output_nonce(a: u32) -> Option<Option<Nonce>> {
    todo!()
}

/// Return the `b`-th entry of a null data (`OP_RETURN`) output at index `a`.
///
/// - Return `Some(Some(Right(Right(x-1))))` if the entry is `OP_x` for `x` in the range 1..=16.
/// - Return `Some(Some(Right(Left(0))))` if the entry is `OP_1NEGATE`.
/// - Return `Some(Some(Right(Left(1))))` if the entry is `OP_RESERVED`.
/// - Return `Some(Some(Left((x, hash))))` if the entry is pushed data. `hash` is the SHA256 hash of the data pushed and `x` indicates how the data was pushed:
///     - `x == 0` means the push was an immediate 0 to 75 bytes.
///     - `x == 1` means the push was an `OP_PUSHDATA1`.
///     - `x == 2` means the push was an `OP_PUSHDATA2`.
///     - `x == 3` means the push was an `OP_PUSHDATA4`.
/// - Return `Some(None)` if the null data has fewer than `b` entries.
/// - Return `None` if the output is not a null data output.
///
/// Use this jet to read peg-out data from an output.
///
/// ## Cost
///
/// 87 mWU _(milli weight units)_
pub fn output_null_datum(a: u32, b: u32) -> Option<Option<Either<(u2, u256),Either<u1,u4>>>> {
    todo!()
}

/// Return the SHA256 hash of the range proof of the output at the given index.
///
/// Return `None` if the output does not exist.
///
/// ## Cost
///
/// 154 mWU _(milli weight units)_
pub fn output_range_proof(a: u32) -> Option<u256> {
    todo!()
}

/// Return the SHA256 hash of the scriptPubKey of the output at the given index.
///
/// Return `None` if the output does not exist.
///
/// ## Cost
///
/// 151 mWU _(milli weight units)_
pub fn output_script_hash(a: u32) -> Option<u256> {
    todo!()
}

/// Return the SHA256 hash of the surjection proof of the output at the given index.
///
/// Return `None` if the output does not exist.
///
/// ## Cost
///
/// 151 mWU _(milli weight units)_
pub fn output_surjection_proof(a: u32) -> Option<u256> {
    todo!()
}

/// Return the blinding factor used for the reissuance at the given input index.
///
/// - Return `Some(None)` if the input does not have a reissuance.
/// - Return `None` if the input does not exist.
///
/// ## Cost
///
/// 91 mWU _(milli weight units)_
pub fn reissuance_blinding(a: u32) -> Option<Option<ExplicitNonce>> {
    todo!()
}

/// Return the entropy used for the reissuance at the given input index.
///
/// - Return `Some(None)` if the input does not have a reissuance.
/// - Return `None` if the input does not exist.
///
/// ## Cost
///
/// 93 mWU _(milli weight units)_
pub fn reissuance_entropy(a: u32) -> Option<Option<u256>> {
    todo!()
}

/// Return the CMR of the Simplicity program in the current input.
///
/// This is the CMR of the currently executed Simplicity program.
///
/// ## Cost
///
/// 136 mWU _(milli weight units)_
pub fn script_cmr() -> u256 {
    todo!()
}

/// Return the tap leaf version of the current input.
///
/// We assume that Simplicity can be spent in Taproot outputs only, so there always exists a tap leaf.
///
/// ## Cost
///
/// 105 mWU _(milli weight units)_
pub fn tapleaf_version() -> u8 {
    todo!()
}

/// Return the SHA256 hash of the tap path of the current input.
///
/// We assume that Simplicity can be spent in Taproot outputs only, so there always exists a tap path.
///
/// ## Cost
///
/// 83 mWU _(milli weight units)_
pub fn tappath(a: u8) -> Option<u256> {
    todo!()
}

/// Return the total amount of fees paid to the given asset id.
///
/// Return zero for any asset without fees.
///
/// ## Cost
///
/// 230 mWU _(milli weight units)_
pub fn total_fee(a: ExplicitAsset) -> ExplicitAmount {
    todo!()
}

/// Return the transaction ID.
///
/// ## Cost
///
/// 139 mWU _(milli weight units)_
pub fn transaction_id() -> u256 {
    todo!()
}

/// Return the version number of the transaction.
///
/// ## Cost
///
/// 93 mWU _(milli weight units)_
pub fn version() -> u32 {
    todo!()
}