Skip to content

Create #[abi_name(name)] annotation #5955

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

Open
Tracked by #5951
IGI-111 opened this issue May 2, 2024 · 0 comments · May be fixed by #7057
Open
Tracked by #5951

Create #[abi_name(name)] annotation #5955

IGI-111 opened this issue May 2, 2024 · 0 comments · May be fixed by #7057
Assignees
Labels
compiler General compiler. Should eventually become more specific as the issue is triaged language feature Core language features visible to end users logging Related to logging (tracing, stdout, stderr, log-files) team:compiler Compiler Team

Comments

@IGI-111
Copy link
Contributor

IGI-111 commented May 2, 2024

Add support for a new annotation that allows you to change the name of a struct or enum in the type definitions that gets hashed as an event hash and a type id in the ABI spec.

@IGI-111 IGI-111 added compiler General compiler. Should eventually become more specific as the issue is triaged language feature Core language features visible to end users logging Related to logging (tracing, stdout, stderr, log-files) labels May 2, 2024
@IGI-111 IGI-111 added the team:compiler Compiler Team label Feb 10, 2025
tritao added a commit to tritao/sway that referenced this issue Apr 2, 2025
Add `#[abi_name()` attribute to rename enum and struct ABI items.

Here is example of how it can be used:

```sway
contract;

#[abi_name(name = "RenamedMyScript")]
struct MyStruct {}

#[abi_name(name = "RenamedMyEnum")]
enum MyEnum {
  A: ()
}

abi MyAbi {
    fn my_struct() -> MyStruct;
    fn my_enum() -> MyEnum;
}

impl MyAbi for Contract {
  fn my_struct() -> MyStruct { MyStruct{} }
  fn my_enum() -> MyEnum { MyEnum::A }
}
```

Closes FuelLabs#5955.
@tritao tritao linked a pull request Apr 2, 2025 that will close this issue
8 tasks
tritao added a commit to tritao/sway that referenced this issue Apr 2, 2025
Add `#[abi_name(name = "foo")` attribute to rename enum and struct ABI
items.

Here is example of how it can be used:

```sway
contract;

#[abi_name(name = "RenamedMyScript")]
struct MyStruct {}

#[abi_name(name = "RenamedMyEnum")]
enum MyEnum {
  A: ()
}

abi MyAbi {
    fn my_struct() -> MyStruct;
    fn my_enum() -> MyEnum;
}

impl MyAbi for Contract {
  fn my_struct() -> MyStruct { MyStruct{} }
  fn my_enum() -> MyEnum { MyEnum::A }
}
```

Closes FuelLabs#5955.
tritao added a commit to tritao/sway that referenced this issue Apr 4, 2025
Add `#[abi_name(name = "foo")` attribute to rename enum and struct ABI
items.

Here is example of how it can be used:

```sway
contract;

#[abi_name(name = "RenamedMyScript")]
struct MyStruct {}

#[abi_name(name = "RenamedMyEnum")]
enum MyEnum {
  A: ()
}

abi MyAbi {
    fn my_struct() -> MyStruct;
    fn my_enum() -> MyEnum;
}

impl MyAbi for Contract {
  fn my_struct() -> MyStruct { MyStruct{} }
  fn my_enum() -> MyEnum { MyEnum::A }
}
```

Closes FuelLabs#5955.
tritao added a commit to tritao/sway that referenced this issue Apr 7, 2025
Add `#[abi_name(name = "foo")` attribute to rename enum and struct ABI
items.

Here is example of how it can be used:

```sway
contract;

#[abi_name(name = "RenamedMyStruct")]
struct MyStruct {}

#[abi_name(name = "RenamedMyEnum")]
enum MyEnum {
  A: ()
}

abi MyAbi {
    fn my_struct() -> MyStruct;
    fn my_enum() -> MyEnum;
}

impl MyAbi for Contract {
  fn my_struct() -> MyStruct { MyStruct{} }
  fn my_enum() -> MyEnum { MyEnum::A }
}
```

Closes FuelLabs#5955.
tritao added a commit to tritao/sway that referenced this issue Apr 7, 2025
Add `#[abi_name(name = "foo")` attribute to rename enum and struct ABI
items.

Here is example of how it can be used:

```sway
contract;

#[abi_name(name = "RenamedMyStruct")]
struct MyStruct {}

#[abi_name(name = "RenamedMyEnum")]
enum MyEnum {
  A: ()
}

abi MyAbi {
    fn my_struct() -> MyStruct;
    fn my_enum() -> MyEnum;
}

impl MyAbi for Contract {
  fn my_struct() -> MyStruct { MyStruct{} }
  fn my_enum() -> MyEnum { MyEnum::A }
}
```

Closes FuelLabs#5955.
tritao added a commit to tritao/sway that referenced this issue Apr 15, 2025
Add `#[abi_name(name = "foo")` attribute to rename enum and struct ABI
items.

Here is example of how it can be used:

```sway
contract;

#[abi_name(name = "RenamedMyStruct")]
struct MyStruct {}

#[abi_name(name = "RenamedMyEnum")]
enum MyEnum {
  A: ()
}

abi MyAbi {
    fn my_struct() -> MyStruct;
    fn my_enum() -> MyEnum;
}

impl MyAbi for Contract {
  fn my_struct() -> MyStruct { MyStruct{} }
  fn my_enum() -> MyEnum { MyEnum::A }
}
```

Closes FuelLabs#5955.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler General compiler. Should eventually become more specific as the issue is triaged language feature Core language features visible to end users logging Related to logging (tracing, stdout, stderr, log-files) team:compiler Compiler Team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants