-
Notifications
You must be signed in to change notification settings - Fork 238
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Component
sol! macro
Describe the feature you would like
we generate a list of all selectors:
core/crates/sol-macro-expander/src/expand/contract.rs
Lines 921 to 928 in f7d4a85
/// All the selectors of this enum. | |
/// | |
/// Note that the selectors might not be in the same order as the variants. | |
/// No guarantees are made about the order of the selectors. | |
/// | |
/// Prefer using `SolInterface` methods instead. | |
// NOTE: This is currently sorted to allow for binary search in `SolInterface`. | |
pub const SELECTORS: &'static [#selector_type] = &[#(#selectors),*]; |
it would be nice to have an enum representation for those as well, that match to the functions, similar to functions
core/crates/sol-macro-expander/src/expand/contract.rs
Lines 187 to 194 in f7d4a85
let functions_enum = (!functions.is_empty()).then(|| { | |
let mut attrs = enum_attrs; | |
let doc_str = format!("Container for all the [`{name}`](self) function calls."); | |
attrs.push(parse_quote!(#[doc = #doc_str])); | |
attrs.push(parse_quote!(#[derive(Clone)])); | |
let enum_expander = CallLikeExpander { cx, contract_name: name.clone(), extra_methods }; | |
enum_expander.expand(ToExpand::Functions(&functions), attrs) | |
}); |
TODO
- generate a selector enum that supports try_from[u8; 4] etc..
maybe @frankudoags ?
Additional context
No response
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request
Type
Projects
Status
Todo