ccnext_query_builder/abi/
models.rs1use alloy::{dyn_abi::DynSolType, rpc::types::Log};
2use alloy_json_abi::{Event, Function};
3
4#[derive(Debug, Clone)]
5pub struct FieldMetadata {
6 pub sol_type: DynSolType,
7 pub offset: usize,
8 pub size: Option<usize>,
9 pub is_dynamic: bool,
10 pub value: Option<Vec<u8>>,
11 pub children: Vec<FieldMetadata>,
12}
13
14#[derive(Debug, Clone, Hash, Eq, PartialEq)]
15pub enum QueryableFields {
16 Type,
17 TxChainId,
18 TxNonce,
19 TxGasPrice,
20 TxGasLimit,
21 TxFrom,
22 TxToIsNull,
23 TxTo,
24 TxValue,
25 TxData,
26 TxV,
27 TxR,
28 TxS,
29 TxYParity,
30 TxAccessList,
31 TxMaxPriorityFeePerGas,
32 TxMaxFeePerGas,
33 TxMaxFeePerBlobGas,
34 TxBlobVersionedHashes,
35 RxStatus,
36 RxGasUsed,
37 RxLogBlooms,
38 RxLogs,
39 TxSignedAuthorizations,
40}
41
42#[derive(Debug)]
43pub enum QueryBuilderError {
44 FailedToAbiEncode,
45 FailedToComputeOffsets,
46 MissMatchedLengthDecoding,
47 FieldNotPresentInTx,
48 FieldIsNotStatic,
49 EventSignatureNameProvidedIsNotValidHex,
50 FunctionSignatureNameProvidedIsNotValidHex,
51 AbiProviderNotInitialized,
52 NoAbiFoundForContract(String),
53 ContractAbiRetrievalFailed {
54 contract_addr: String,
55 error_message: String,
56 },
57 FailedToParseAbi(String, String),
58 FailedToFindEventByNameOrSignature(String),
59 FailedToDecodeLog(Box<Log>),
60 AmbigiousEventMatch(String),
61 FailedToFindRxLogsField,
62 FailedToFindTxDataField,
63 MissingLogInAbiOffsets(usize),
64 MissingDataInAbiOffsets,
65 TryingToGetSizeOfDynamicType,
66 FailedToGetEventDataOffsets(Box<Log>),
67 RequestingFunctionArgumentOfAnEmptyCalldataTransaction,
68 RequestingFunctionArgumentButNoToAddressPresent,
69 FailedToFindFunctionByNameOrSignature(String),
70 AmbigiousFunctionMatch(Vec<Function>),
71 DataFieldMissingSize,
72 DataFieldNotLongEnoughForSignatureExtraction,
73 CannotFindArgumentInFunction(Function, String),
74 FailedToResolveSolTypesOfMatchedFunction(Function),
75 FailedToResolveSolTypesOfMatchedEvent(Event),
76 FailedToComputeOffsetsForCalldata,
77 MissingDataInCalldataOffsets,
78}