anvil_core/eth/wallet.rs
1pub use alloy_eip5792::*;
2
3#[derive(Debug, thiserror::Error)]
4pub enum WalletError {
5 /// The transaction value is not 0.
6 ///
7 /// The value should be 0 to prevent draining the sequencer.
8 #[error("transaction value must be zero for delegated transactions")]
9 ValueNotZero,
10 /// The from field is set on the transaction.
11 ///
12 /// Requests with the from field are rejected, since it is implied that it will always be the
13 /// sequencer.
14 #[error("transaction 'from' field should not be set for delegated transactions")]
15 FromSet,
16 /// The nonce field is set on the transaction.
17 ///
18 /// Requests with the nonce field set are rejected, as this is managed by the sequencer.
19 #[error("transaction nonce should not be set for delegated transactions")]
20 NonceSet,
21 /// An authorization item was invalid.
22 ///
23 /// The item is invalid if it tries to delegate an account to a contract that is not
24 /// whitelisted.
25 #[error("invalid authorization address: contract is not whitelisted for delegation")]
26 InvalidAuthorization,
27 /// The to field of the transaction was invalid.
28 ///
29 /// The destination is invalid if:
30 ///
31 /// - There is no bytecode at the destination, or
32 /// - The bytecode is not an EIP-7702 delegation designator, or
33 /// - The delegation designator points to a contract that is not whitelisted
34 #[error("transaction destination is not a valid delegated account")]
35 IllegalDestination,
36 /// The transaction request was invalid.
37 ///
38 /// This is likely an internal error, as most of the request is built by the sequencer.
39 #[error("invalid transaction request format")]
40 InvalidTransactionRequest,
41 /// An internal error occurred.
42 #[error("internal server error occurred")]
43 InternalError,
44}