simfony_as_rust/jet/
mod.rs

1//! Declaration of each jet.
2//!
3//! Currently for documentation purposes only.
4
5pub mod arithmetic;
6pub mod bitcoin_without_primitives;
7pub mod digital_signatures;
8pub mod elliptic_curve_functions;
9pub mod hash_functions;
10pub mod issuance;
11pub mod multi_bit_logic;
12pub mod signature_hash_modes;
13pub mod time_locks;
14pub mod transaction;
15
16pub use arithmetic::*;
17pub use bitcoin_without_primitives::*;
18pub use digital_signatures::*;
19pub use elliptic_curve_functions::*;
20pub use hash_functions::*;
21pub use issuance::*;
22pub use multi_bit_logic::*;
23pub use signature_hash_modes::*;
24pub use time_locks::*;
25pub use transaction::*;
26
27use either::Either;
28use std::marker::PhantomData;
29
30// Phantom declarations to generate documentation.
31
32/// 1-bit unsigned integer.
33#[allow(non_camel_case_types)]
34pub struct u1;
35
36/// 2-bit unsigned integer.
37#[allow(non_camel_case_types)]
38pub struct u2;
39
40/// 4-bit unsigned integer.
41#[allow(non_camel_case_types)]
42pub struct u4;
43
44/// 256-bit unsigned integer.
45#[allow(non_camel_case_types)]
46pub struct u256;
47
48/// List of less than `BOUND` many values of type `A`.
49pub struct List<A, const BOUND: usize> {
50    phantom: PhantomData<[A; BOUND]>,
51}
52
53/// State of a SHA256 hash engine. SHA context for streams of 8-bit values.
54pub type Ctx8 = (List<u8, 64>, (u64, u256));
55
56/// X-only public key.
57pub type Pubkey = u256;
58/// 256-bit message (signature hash).
59pub type Message = u256;
60/// 512-bit messaage (CMR of program that computes signature hash + signature hash).
61pub type Message64 = [u8; 64];
62/// Schnorr signature.
63pub type Signature = [u8; 64];
64
65/// Scalar of the secp256k1 elliptic curve.
66pub type Scalar = u256;
67/// Field element (coordinate) of the secp256k1 elliptic curve.
68pub type Fe = u256;
69/// Group element (point) of the secp256k1 elliptic curve in affine coordinates.
70pub type Ge = (Fe, Fe);
71/// Group element (point) of the secp256k1 elliptic curve in projective / Jacobian coordinates.
72pub type Gej = (Ge, Fe);
73/// Group element (point) of the secp256k1 elliptic curve in compressed affine coordinates
74/// (whether y is odd + affine x coordinate).
75pub type Point = (u1, Fe);
76
77/// Height of a Bitcoin block.
78pub type Height = u32;
79/// UNIX timestamp of a Bitcoin block.
80pub type Time = u32;
81/// Relative distance between Bitcoin blocks in terms of height.
82pub type Distance = u16;
83/// Relative distance between Bitcoin blocks in terms of UNIX timestamps.
84pub type Duration = u16;
85
86/// Lock time of an Elements transaction.
87pub type Lock = u32;
88/// Outpoint of an Elements transaction input (transaction ID + vout).
89pub type Outpoint = (u256, u32);
90/// Pedersen commitment to a confidential value.
91pub type Confidential1 = Point;
92/// Explicit Elements asset ID.
93pub type ExplicitAsset = u256;
94/// Elements asset (confidential or explicit).
95pub type Asset1 = Either<Confidential1, ExplicitAsset>;
96/// Explicit amount of units of an Elements asset.
97pub type ExplicitAmount = u64;
98/// Amount of units of an Elements asset (confidential or explicit).
99pub type Amount1 = Either<Confidential1, ExplicitAmount>;
100/// Explicit 256-bit nonce.
101pub type ExplicitNonce = u256;
102/// Nonce (confidential or explicit).
103pub type Nonce = Either<Confidential1, ExplicitNonce>;
104/// Amount of units of an Elements token (confidential or explicit).
105pub type TokenAmount1 = Amount1;