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

Typegen - Account for program types automatically #989

Open
danielbate opened this issue May 8, 2023 · 5 comments
Open

Typegen - Account for program types automatically #989

danielbate opened this issue May 8, 2023 · 5 comments
Labels
feat Issue is a feature

Comments

@danielbate
Copy link
Contributor

danielbate commented May 8, 2023

Currently the default behaviour of the typegen CLI is to generate types for the contract program type:

export function resolveProgramType(params: {
contract: boolean;
script: boolean;
predicate: boolean;
}) {
const { contract, script, predicate } = params;
const noneSpecified = !contract && !script && !predicate;
if (contract || noneSpecified) {
return ProgramTypeEnum.CONTRACT;
}
if (predicate) {
return ProgramTypeEnum.PREDICATE;
}
return ProgramTypeEnum.SCRIPT;
}

We have had a couple of questions on the forum suggesting that they would expect typegen default behaviour to account for predicates:

So should we adjust typegen to account for all program types? Program type can be inferred from the ABI programType property. The parameters could remain and act as a filter for when a single program type is required.

@arboleya
Copy link
Member

arboleya commented May 8, 2023

[TL;DR] Currently, ABIs have no information about the program type.


We touched on this here:

And also here:


Maybe we should have an explicit issue for this on the Sway repo?

@arboleya arboleya added feat Issue is a feature blocked and removed question labels May 8, 2023
@arboleya arboleya changed the title Should the default behaviour of the typegen cli account for all program types? Typegen - Account for program types automatically May 8, 2023
@arboleya arboleya added this to the 1. caterpillar milestone Jun 9, 2024
@arboleya arboleya added the p2 label Jun 9, 2024
@arboleya arboleya added p1 and removed p2 labels Jul 3, 2024
@arboleya arboleya removed this from the 1.0 caterpillar milestone Jul 19, 2024
@arboleya
Copy link
Member

@nedsalk Should we address this together with the new abi spec PR?

@nedsalk
Copy link
Contributor

nedsalk commented Jul 20, 2024

@arboleya we can, but I'd do it in a separate PR that can be based off of the "new ABI format" one. Also, I believe that this can bring about some breaking changes like removing contracts/scripts/predicates from the fuels cli if we increase the scope to cover the cli.

@arboleya
Copy link
Member

Makes sense, better to do it in isolation.

@arboleya arboleya removed this from the Caterpillar v1 milestone Sep 7, 2024
@arboleya arboleya added the temp:notion label Sep 8, 2024 — with Linear
@arboleya arboleya added the temp-linear label Sep 8, 2024 — with Linear
Copy link
Contributor

This is being implemented in TS-600

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat Issue is a feature
Projects
None yet
Development

No branches or pull requests

4 participants