Skip to content

Commit

Permalink
feat(sol-macro): add json-abi item generation (#422)
Browse files Browse the repository at this point in the history
* feat(sol-macro): add `dyn_abi` attribute

* refactor: contract enum expansion

* chore: rename `ItemFunction.arguments` to `parameters`

* rename 2

* feat: initial implementation

* rename

* docs

* fix: recursive structs

* add additional test
  • Loading branch information
DaniPopes authored Nov 21, 2023
1 parent ee84bff commit f2981ec
Show file tree
Hide file tree
Showing 28 changed files with 1,437 additions and 185 deletions.
6 changes: 6 additions & 0 deletions crates/sol-macro/src/attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ pub struct SolAttrs {
pub all_derives: Option<bool>,
pub extra_methods: Option<bool>,
pub docs: Option<bool>,
pub abi: Option<bool>,

// TODO: Implement
pub rename: Option<LitStr>,
Expand Down Expand Up @@ -138,6 +139,7 @@ impl SolAttrs {
all_derives => bool()?,
extra_methods => bool()?,
docs => bool()?,
abi => bool()?,

rename => lit()?,
rename_all => CasingStyle::from_lit(&lit()?)?,
Expand Down Expand Up @@ -297,6 +299,10 @@ mod tests {
#[sol(docs)] => Ok(sol_attrs! { docs: true }),
#[sol(docs = true)] => Ok(sol_attrs! { docs: true }),
#[sol(docs = false)] => Ok(sol_attrs! { docs: false }),

#[sol(abi)] => Ok(sol_attrs! { abi: true }),
#[sol(abi = true)] => Ok(sol_attrs! { abi: true }),
#[sol(abi = false)] => Ok(sol_attrs! { abi: false }),
}

rename {
Expand Down
Loading

0 comments on commit f2981ec

Please sign in to comment.