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

[BUG] Generating contract ts types throws an error when compiling contracts with the --all flag #200

Open
ipapandinas opened this issue Jan 16, 2024 · 0 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@ipapandinas
Copy link
Contributor

ipapandinas commented Jan 16, 2024

Description

Contracts compilation using the --all flag throws an error after adding a new contract to my project with the contract new command. Using the --all flag with a single flipper contract after project init works fine as expected.

Steps to Reproduce

  1. swanky init test
  2. cd test
  3. swanky contract compile --all works - flipper contract's TS types Generated successfully
  4. swanky contract new hello --template flipper
  5. swanky contract compile --all throws the described error below

Expected vs. Actual Behavior

Expected: Compile both contracts flipper and hello successfully with TS types generated.
Actual Behavior: Unable to compile any contracts.

Environment

  • Operating system: Mac M1 darwin
  • Project version/tag: @astar-network/swanky-cli/3.1.0 darwin-arm64 node-v18.17.1
  • Rust version: rustc 1.72.1
  • Rust toolchain: 1.72-aarch64-apple-darwin
  • Node version: 18.17.1

Logs, Errors or Screenshots

swanky contract compile --all

The contract was built in DEBUG mode.

Your contract artifacts are ready. You can find them in: /test/target/ink/flipper

  - flipper.contract (code + metadata)
  - flipper.wasm (the contract's code)
  - flipper.json (the contract's metadata)
✔ flipper Contract compiled successfully
✔ Moving artifacts OK
✖ Error Generating flipper contract ts types
error:   ProcessError: Command failed with exit code 1: npx typechain-polkadot --in artifacts/flipper --out typedContracts/flipper
@polkadot/util has multiple versions, ensure that there is only one installed.
Either remove and explicitly install matching versions or dedupe using your package manager.
The following conflicting packages were found:
	cjs 12.6.2	node_modules/@polkadot/util/cjs
	cjs 11.1.3	node_modules/@727-ventures/typechain-polkadot/node_modules/@polkadot/util/cjs
node_modules/@727-ventures/typechain-polkadot/src/utils/handlebars-helpers.ts:46
		throw new Error(`Unable to locate ${template}.hbs from ${rootDir}`);
        ^
Error: Unable to locate types-arguments.hbs from node_modules/@727-ventures/typechain-polkadot/src/utils/../templates
    at readTemplate (node_modules/@727-ventures/typechain-polkadot/src/utils/handlebars-helpers.ts:46:9)
    at Object.<anonymous> (node_modules/@727-ventures/typechain-polkadot/src/generators/types-arguments.ts:31:64)
    at Module.m._compile (node_modules/ts-node/src/index.ts:1618:23)
    at Object.require.extensions.<computed> [as .ts] (node_modules/ts-node/src/index.ts:1621:12)
Error Generating flipper contract ts types
    at makeError (file:///opt/homebrew/lib/node_modules/@astar-network/swanky-cli/node_modules/execa/lib/error.js:60:11)
    at handlePromise (file:///opt/homebrew/lib/node_modules/@astar-network/swanky-cli/node_modules/execa/index.js:124:26)
    at async generateTypes (file:///opt/homebrew/lib/node_modules/@astar-network/swanky-cli/dist/lib/command-utils.js:101:5)
    at async file:///opt/homebrew/lib/node_modules/@astar-network/swanky-cli/dist/commands/contract/compile.js:71:50
    at async Spinner.runCommand (file:///opt/homebrew/lib/node_modules/@astar-network/swanky-cli/dist/lib/spinner.js:29:25)
    at async CompileContract.run (file:///opt/homebrew/lib/node_modules/@astar-network/swanky-cli/dist/commands/contract/compile.js:71:13)
    at async CompileContract._run (/opt/homebrew/lib/node_modules/@astar-network/swanky-cli/node_modules/@oclif/core/lib/command.js:117:22)
    at async Config.runCommand (/opt/homebrew/lib/node_modules/@astar-network/swanky-cli/node_modules/@oclif/core/lib/config/config.js:329:25)
    at async run (/opt/homebrew/lib/node_modules/@astar-network/swanky-cli/node_modules/@oclif/core/lib/main.js:89:16)

Additional context

This error should be related to the package versions conflict. Upgrading @727-ventures/typechain-polkadot should fix this issue.

@ipapandinas ipapandinas added bug Something isn't working good first issue Good for newcomers labels Jan 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant