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

fix: json-abi not using anonymous when converting to interface #342

Merged
merged 2 commits into from
Oct 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions crates/json-abi/src/to_sol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ impl ToSol for Event {
inputs: &self.inputs,
visibility: None,
state_mutability: None,
anonymous: self.anonymous,
outputs: &[],
}
.to_sol(out);
Expand All @@ -223,6 +224,7 @@ impl ToSol for Error {
inputs: &self.inputs,
visibility: None,
state_mutability: None,
anonymous: false,
outputs: &[],
}
.to_sol(out);
Expand All @@ -237,6 +239,7 @@ impl ToSol for Fallback {
inputs: &[],
visibility: Some("external"),
state_mutability: Some(self.state_mutability),
anonymous: false,
outputs: &[],
}
.to_sol(out);
Expand All @@ -251,6 +254,7 @@ impl ToSol for Receive {
inputs: &[],
visibility: Some("external"),
state_mutability: Some(self.state_mutability),
anonymous: false,
outputs: &[],
}
.to_sol(out);
Expand All @@ -265,6 +269,7 @@ impl ToSol for Function {
inputs: &self.inputs,
visibility: Some("external"),
state_mutability: Some(self.state_mutability),
anonymous: false,
outputs: &self.outputs,
}
.to_sol(out);
Expand All @@ -277,6 +282,7 @@ struct AbiFunction<'a, IN> {
inputs: &'a [IN],
visibility: Option<&'static str>,
state_mutability: Option<StateMutability>,
anonymous: bool,
outputs: &'a [Param],
}

Expand Down Expand Up @@ -320,6 +326,10 @@ impl<IN: ToSol> ToSol for AbiFunction<'_, IN> {
out.push(')');
}

if self.anonymous {
out.push_str(" anonymous");
}

out.push(';');
}
}
Expand Down