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
//! Core types and data structures for the Tx3 SDK.
//!
//! This module provides the fundamental types used throughout the SDK for representing
//! transaction data, addresses, and various envelope formats.
use ;
/// Flexible key-value arguments for transaction execution.
///
/// This type represents the arguments passed to a transaction invocation.
/// Keys are parameter names and values are JSON values that can represent
/// various types (strings, numbers, booleans, arrays, objects).
///
/// # Example
///
/// ```ignore
/// use serde_json::json;
/// use tx3_sdk::core::ArgMap;
///
/// let mut args = ArgMap::new();
/// args.insert("sender".to_string(), json!("addr1abc..."));
/// args.insert("amount".to_string(), json!(1000000));
/// args.insert("allow_bypass".to_string(), json!(true));
/// ```
pub type ArgMap = Map;
/// Environment variables for transaction execution context.
///
/// Environment variables provide additional context for transaction execution,
/// such as network parameters, protocol constants, or other configuration values
/// that affect how transactions are resolved.
///
/// # Example
///
/// ```ignore
/// use serde_json::json;
/// use tx3_sdk::core::EnvMap;
///
/// let mut env = EnvMap::new();
/// env.insert("network_id".to_string(), json!(1)); // mainnet
/// env.insert("slot".to_string(), json!(50000000));
/// ```
pub type EnvMap = Map;
/// Bech32-encoded blockchain address.
///
/// This type alias represents blockchain addresses in their Bech32-encoded form,
/// which is the human-readable format commonly used in wallets and explorers.
///
/// # Example
///
/// ```ignore
/// use tx3_sdk::core::Address;
///
/// let address: Address = "addr1q9y8r3q4z3q3q3q3q3q3q3q3q3q3q3q3q3q3q3q3q3q3q3q3q3q3q3".to_string();
/// ```
pub type Address = String;
/// UTXO reference in the format `0x[64hex]#[index]`.
///
/// This type alias represents a reference to an unspent transaction output (UTXO)
/// on a UTxO-based blockchain. The format consists of:
/// - A 64-character hexadecimal transaction hash (prefixed with `0x`)
/// - A `#` separator
/// - An output index number
///
/// # Example
///
/// ```ignore
/// use tx3_sdk::core::UtxoRef;
///
/// let utxo_ref: UtxoRef = "0xabc123...def456#0".to_string();
/// ```
pub type UtxoRef = String;
/// A generic envelope for byte-encoded data with content type information.
///
/// This structure wraps binary data (typically encoded as hex or base64 strings)
/// along with metadata about the content type and encoding. It's commonly used
/// for transaction bytes, signatures, and other cryptographic data.
///
/// # Fields
///
/// * `content` - The encoded data as a string (typically hex or base64)
/// * `content_type` - MIME type or encoding identifier (e.g., "application/cbor", "hex")
///
/// # Example
///
/// ```ignore
/// use tx3_sdk::core::BytesEnvelope;
///
/// let envelope = BytesEnvelope {
/// content: "a10081825820abc123...".to_string(),
/// content_type: "application/cbor".to_string(),
/// };
/// ```
/// Encoding format for Transaction Intermediate Representation (TIR) data.
///
/// This enum specifies how TIR data is encoded when serialized.
/// An envelope containing Transaction Intermediate Representation (TIR) data.
///
/// TIR is the intermediate format used by TX3 to represent transactions in a
/// protocol-agnostic way before they are resolved to specific blockchain transactions.
/// This envelope wraps the TIR content with metadata about its encoding and version.
///
/// # Fields
///
/// * `content` - The encoded TIR data
/// * `encoding` - The encoding format used (hex or base64)
/// * `version` - The TIR specification version (e.g., "v1beta0")
///
/// # Example
///
/// ```ignore
/// use tx3_sdk::core::{TirEnvelope, TirEncoding};
///
/// let envelope = TirEnvelope {
/// content: "a10081825820...".to_string(),
/// encoding: TirEncoding::Hex,
/// version: "v1beta0".to_string(),
/// };
/// ```