Error: Type not supported: u256

Have a contract which uses the u256 datatype. Previously was using u64 but had to switch to u256 because of large arithmetic calculations that could potentially overflow u64. However, I’m unable to generate Typescript types via fuels typegen because of this error: error: Type not supported: u256. Any idea how to circumvent this, and generate types successfully?

It’s ongoing via:

2 Likes

oh wow, that’s neat. as I understand the only bottleneck is the Typescript typegen right? will I still be able to deploy said contract, but not be able to use the TS SDK to interact with the contracts, right?

1 Like

@theAusicist that’s correct. The TS SDK cannot encode/decode any u256 elements at the moment, but the fix should be out very soon. We’re actively working on it

3 Likes

Released in: v0.75.0

EDIT: False alarm, issue #1797 hasn’t been released yet.

1 Like

Edit: This feature failed a check because of too many requests to a npm link and didn’t make it into the release. feat!: add support for the `u256` type by Dhaiwat10 · Pull Request #1799 · FuelLabs/fuels-ts · GitHub

I’m running 0.75.0 and still running into a typegen error with u256.

Fuels version

❯ yarn list --pattern fuels
yarn list v1.22.19
├─ @fuels/assets@0.1.5
├─ @fuels/react@0.15.2
├─ @fuels/vm-asm@0.42.1
└─ fuels@0.75.0

Typegen command

❯  yarn fuels typegen -i ../contracts/out/debug/**-abi.json -o ./types
error: Type not supported: u256
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

The offending struct:

struct Stream {
// ...other fields
field: u256,
}

My bad, you are right.

This feature wasn’t included in the last release @ 0.75.0.

I will let you know when it is released.

Released in v0.76.0.

1 Like