simfony_as_rust/jet/
transaction.rs

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
/* 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`].
pub fn current_amount() -> (Asset1, Amount1) {
    todo!()
}

/// Return the [`input_annex_hash`] at th [`current_index`].
pub fn current_annex_hash() -> Option<u256> {
    todo!()
}

/// Return the [`input_asset`] at the [`current_index`].
pub fn current_asset() -> Asset1 {
    todo!()
}

/// Return the index of the current txin.
pub fn current_index() -> u32 {
    todo!()
}

/// Return the [`issuance_asset_amount`] at the [`current_index`].
pub fn current_issuance_asset_amount() -> Option<Amount1> {
    todo!()
}

/// Return the [`issuance_asset_proof`]  at the [`current_index`].
pub fn current_issuance_asset_proof() -> u256 {
    todo!()
}

/// Return the [`issuance_token_amount`] at the [`current_index`].
pub fn current_issuance_token_amount() -> Option<TokenAmount1> {
    todo!()
}

/// Return the [`issuance_token_proof`]  at the [`current_index`].
pub fn current_issuance_token_proof() -> u256 {
    todo!()
}

/// Return the [`new_issuance_contract`] at the [`current_index`].
pub fn current_new_issuance_contract() -> Option<u256> {
    todo!()
}

/// Return the [`input_pegin`] at the [`current_index`].
pub fn current_pegin() -> Option<u256> {
    todo!()
}

/// Return the previous outpoint of the current txin.
pub fn current_prev_outpoint() -> Outpoint {
    todo!()
}

/// Return the [`reissuance_blinding`] at the [`current_index`].
pub fn current_reissuance_blinding() -> Option<ExplicitNonce> {
    todo!()
}

/// Return the [`reissuance_entropy`]  at the [`current_index`].
pub fn current_reissuance_entropy() -> Option<u256> {
    todo!()
}

/// Return the SHA256 hash of the scriptPubKey of the UTXO of the current txin.
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.
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.
pub fn current_sequence() -> u32 {
    todo!()
}

/// Return the SHA256 hash of the genesis block.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
pub fn issuance_token_proof(a: u32) -> Option<u256> {
    todo!()
}

/// Return the lock time of the transaction.
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.
pub fn new_issuance_contract(a: u32) -> Option<Option<u256>> {
    todo!()
}

/// Return the number of inputs of the transaction.
pub fn num_inputs() -> u32 {
    todo!()
}

/// Return the number of outputs of the transaction.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
pub fn total_fee(a: ExplicitAsset) -> ExplicitAmount {
    todo!()
}

/// Return the transaction ID.
pub fn transaction_id() -> u256 {
    todo!()
}

/// Return the version number of the transaction.
pub fn version() -> u32 {
    todo!()
}