Can't generate types from contract with fuels typegen

Trying to generate types from contract with version fuels@0.66.1 installed

Input :

npx fuels typegen -i ../contract/out/debug/*-abi.json -o ./src/contracts

Output:

(node:57236) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
node:internal/streams/writable:446
  const state = stream._writableState;
                       ^

TypeError: Cannot read properties of undefined (reading '_writableState')
    at _write (node:internal/streams/writable:446:24)
    at Writable.write (node:internal/streams/writable:502:10)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Node.js v21.6.1

With version fuels@0.69.0 installed ,

Output:

error: no ABI found at '../contract/out/debug/*-abi.json'

My fuelup show output

Default host: x86_64-unknown-linux-gnu
fuelup home: /root/.fuelup

installed toolchains
--------------------
beta-4-x86_64-unknown-linux-gnu (default)
latest-x86_64-unknown-linux-gnu

active toolchain
----------------
beta-4-x86_64-unknown-linux-gnu (default)
  forc : 0.46.1
    - forc-client
      - forc-deploy : 0.46.1
      - forc-run : 0.46.1
    - forc-crypto : not found
    - forc-doc : 0.46.1
    - forc-explore : 0.28.1
    - forc-fmt : 0.46.1
    - forc-lsp : 0.46.1
    - forc-tx : 0.46.1
    - forc-wallet : 0.3.0
  fuel-core : 0.20.5
  fuel-core-keygen : Error getting version string

fuels versions
--------------
forc : 0.45
forc-wallet : 0.45
```Default host: x86_64-unknown-linux-gnu
fuelup home: /root/.fuelup

installed toolchains
--------------------
beta-4-x86_64-unknown-linux-gnu (default)
latest-x86_64-unknown-linux-gnu

active toolchain
----------------
beta-4-x86_64-unknown-linux-gnu (default)
  forc : 0.46.1
    - forc-client
      - forc-deploy : 0.46.1
      - forc-run : 0.46.1
    - forc-crypto : not found
    - forc-doc : 0.46.1
    - forc-explore : 0.28.1
    - forc-fmt : 0.46.1
    - forc-lsp : 0.46.1
    - forc-tx : 0.46.1
    - forc-wallet : 0.3.0
  fuel-core : 0.20.5
  fuel-core-keygen : Error getting version string

fuels versions
--------------
forc : 0.45
forc-wallet : 0.45

Hi there!
Please be aware that keeping older versions of any packages might result in errors. Please always consider to work at least on the latest versions.

Regarding this specific issue, have you checked the abis location by running cd ../contract/out/debug/ ?

1 Like

Hi thanks for the reply,
yes the abis location is indeed in ../contract/out/debug

root@vmd122589:~/fuel-project/contract/out/debug/# ls
contract-abi.json  contract.bin  contract-storage_slots.json

It seems quite off
Are you following the quickstart right?

Yes i made sure to follow it step by step and still get errors , encountered some problems earlier trying to install cargo-generate but fixed it by running :

cargo install cargo-generate --locked cargo .

Maybe this is the problem ? can’t seem to find contracts directory in src

root@vmd122589:~/fuel-project/contract/src# ls
main.rs  main.sw

Well
Please consider that test harness with cargo generate has nothing to do with the typescript typegen.

I’ve just made a fresh installation of the beta-4 toolchain, fuels 0.60, node 16.20 and had no issues.

This is likely to be on your side.
Rather, you’ve executed the command from a wrong location or you had some issues during contract building.

I kindly recommend to start over from a new location.

1 Like