Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(sol!)!: gen unit/tuple structs for call types with 0/1 param #884

Merged
merged 4 commits into from
Mar 10, 2025

Conversation

yash-atreya
Copy link
Member

@yash-atreya yash-atreya commented Feb 19, 2025

Motivation

Closes #880
Stacked over #883

Solution

sol! {
    function totalSupply() returns (uint256);
    function balanceOf(address) returns (uint256);
}

// Unit struct
pub struct totalSupplyCall;

// Tuple struct
pub struct balanceOfCall(pub Address); // Loses name of the param

// Previously, 
pub struct totalSupplyCall {};
pub struct balanceOfCall { owner: Address }; 
  • Bindings for calls with 2 or more params left unchanged.

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

@yash-atreya yash-atreya added breaking enhancement New feature or request labels Feb 19, 2025
@yash-atreya yash-atreya changed the base branch from main to yash/err-bindings February 19, 2025 10:29
@yash-atreya yash-atreya changed the title feat(sol!)!: gen unit/tuple structs for call types with 0/1 param feat(sol!)!: gen unit/tuple structs for call types with 0/1 param Feb 19, 2025
@yash-atreya yash-atreya marked this pull request as ready for review February 19, 2025 11:12
Copy link
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this lgtm

pending @DaniPopes

@yash-atreya yash-atreya merged commit 0f31158 into yash/err-bindings Mar 10, 2025
28 of 30 checks passed
@yash-atreya yash-atreya deleted the yash/call-bindings branch March 10, 2025 07:51
yash-atreya added a commit that referenced this pull request Mar 12, 2025
…0/1 param (#883)

* feat(`sol!`)!: generate unit/tuple structs for errors with 0/1 param

* fix

* fix: expand as tuple struct only when param is unnamed

* nit

* FieldKind

* fix

* feat(`sol!`)!: gen unit/tuple structs for call types with 0/1 param (#884)

* feat(`sol!`)!: gen unit/tuple structs for call types with 0/1 param

* fix: expand as tuple struct only if single unnamed param

* fix(`sol!`)!: gen unit struct for no param events (#885)

* expand as unit struct if no params

* nit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] feat(sol!)!: improve sol call bindings
2 participants