Typescript typegen doesn't support some types

I’m trying to generate ts wrappers for my contracts and getting this error:

error: Type not supported: (struct std::asset_id::AssetId, struct std::asset_id::AssetId, bool)

I indeed have a type (AssetId, AssetId, bool) in the contracts, which doesn’t look that complex for me. Is there a way to support this in the typegen or somehow mitigate this error? I need this ASAP

My fuels-ts version: 0.94.2

Hey @mpoplavkov :wave:

I’ve validated this with our typegen test suite and it looks to generate successfully (see here).

Could you share the Sway code you’re trying to build - so I can take a closer look?

1 Like

I can share only the compilation outputs for now. For example, this script

Would you mind sharing a minimal reproduction of this please?

There’s nothing special in the contracts/scripts apart from using (AssetId, AssetId, bool) type both as function arguments and return parameters.

Feel free to message me on telegram if you need some additional details: mpoplavkov

Ok, looks like the issue is with custom types. Take a look at this contract, for example:

contract;

type Custom = (AssetId, AssetId, bool);

abi MyContract {
    fn test_function(c: Custom) -> Custom;
}

impl MyContract for Contract {
    fn test_function(c: Custom) -> Custom {
        c
    }
}

pnpm fuels typegen gives me the same error for it: “Type not supported: (struct std::asset_id::AssetId, struct std::asset_id::AssetId, bool)”.

But if I remove the custom type, it works:

contract;

abi MyContract {
    fn test_function(c: (AssetId, AssetId, bool)) -> (AssetId, AssetId, bool);
}

impl MyContract for Contract {
    fn test_function(c: (AssetId, AssetId, bool)) -> (AssetId, AssetId, bool) {
        c
    }
}

Please let me know if this can be fixed and how long it will take

Hey @mpoplavkov :wave:

I’ve confirmed the bug you’re experiencing and have created the following issue to track this.

We are unable to give an ETA at this time, but we’ll endeavour to update this thread once we know more.

Hey @mpoplavkov,

If you upgrade to the latest forc version (0.63.4), then this problem should be alleviated with the following patch.

Let us know if you have any issues.

1 Like

It works now, thank you!

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.