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: Add attributes to ABIFunction #744

Merged
merged 7 commits into from
Dec 16, 2022
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions packages/fuels-core/src/code_gen/functions_gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@ mod tests {
type_id: 1,
..Default::default()
},
..Default::default()
};
let types = [
(
Expand Down
8 changes: 8 additions & 0 deletions packages/fuels-types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ pub struct ABIFunction {
pub inputs: Vec<TypeApplication>,
pub name: String,
pub output: TypeApplication,
pub attributes: Option<Vec<Attribute>>,
}

#[derive(Default, Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
Expand Down Expand Up @@ -93,6 +94,13 @@ pub struct ResolvedLog {
pub resolved_type_name: TokenStream,
}

#[derive(Default, Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Attribute {
pub name: String,
pub arguments: Vec<String>,
}

impl TypeDeclaration {
pub fn is_enum_type(&self) -> bool {
self.type_field.starts_with("enum ")
Expand Down