-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy patherror.rs
More file actions
106 lines (85 loc) · 3.67 KB
/
error.rs
File metadata and controls
106 lines (85 loc) · 3.67 KB
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
/// Errors from UTXO validation operations.
#[derive(Debug, thiserror::Error)]
pub enum ValidationError {
#[error("UTXO {script_hash} has confidential value")]
ConfidentialValue { script_hash: String },
#[error("UTXO {script_hash} has confidential asset")]
ConfidentialAsset { script_hash: String },
#[error("UTXO {script_hash} has insufficient funds: have {available}, need {required}")]
InsufficientFunds {
script_hash: String,
available: u64,
required: u64,
},
#[error("Fee UTXO {script_hash} has wrong asset: expected {expected}, got {actual}")]
FeeAssetMismatch {
script_hash: String,
expected: String,
actual: String,
},
}
/// Errors from transaction building operations.
#[derive(Debug, thiserror::Error)]
pub enum TransactionBuildError {
#[error("parts_to_split must be greater than 0")]
InvalidSplitParts,
#[error("Send amount {send_amount} exceeds asset UTXO value {available}")]
SendAmountExceedsUtxo { send_amount: u64, available: u64 },
#[error(
"Fee UTXOs must have the same asset: first ({first_script_hash}) has {first_asset}, second ({second_script_hash}) has {second_asset}"
)]
FeeUtxoAssetMismatch {
first_script_hash: String,
first_asset: String,
second_script_hash: String,
second_asset: String,
},
#[error(
"First issuance must produce option token: expected ({expected_token}, {expected_reissuance}), got ({actual_token}, {actual_reissuance})"
)]
OptionTokenMismatch {
expected_token: String,
expected_reissuance: String,
actual_token: String,
actual_reissuance: String,
},
#[error(
"Second issuance must produce grantor token: expected ({expected_token}, {expected_reissuance}), got ({actual_token}, {actual_reissuance})"
)]
GrantorTokenMismatch {
expected_token: String,
expected_reissuance: String,
actual_token: String,
actual_reissuance: String,
},
#[error("Insufficient collateral: need {required}, have {available}")]
InsufficientCollateral { required: u64, available: u64 },
#[error("Insufficient settlement asset: need {required}, have {available}")]
InsufficientSettlementAsset { required: u64, available: u64 },
#[error("Grantor asset UTXO has wrong token: expected {expected}, got {actual}")]
WrongGrantorToken { expected: String, actual: String },
#[error("Settlement asset UTXO has wrong asset: expected {expected}, got {actual}")]
WrongSettlementAsset { expected: String, actual: String },
#[error("Failed to blind transaction: {0}")]
Blinding(#[from] simplicityhl::elements::pset::Error),
#[error("Failed to blind transaction outputs: {0}")]
BlindingOutputs(#[from] simplicityhl::elements::pset::PsetBlindError),
#[error("Transaction amount proof verification failed: {0}")]
AmountProofVerification(#[from] simplicityhl::elements::VerificationError),
#[error("Failed to unblind transaction output: {0}")]
Unblinding(#[from] simplicityhl::elements::UnblindError),
#[error("Invalid lock time: {0}")]
InvalidLockTime(#[from] simplicityhl::elements::locktime::Error),
#[error(transparent)]
Validation(#[from] ValidationError),
}
/// Errors from extracting arguments from Arguments struct.
#[derive(Debug, thiserror::Error)]
pub enum FromArgumentsError {
#[error("Missing witness name: {name}")]
MissingWitness { name: String },
#[error("Wrong value type for {name}: expected {expected}")]
WrongValueType { name: String, expected: String },
#[error("Invalid asset ID bytes for {name}")]
InvalidAssetId { name: String },
}