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.
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.
Description
Contracts compilation using the
--all
flag throws an error after adding a new contract to my project with thecontract new
command. Using the--all
flag with a single flipper contract after project init works fine as expected.Steps to Reproduce
swanky init test
cd test
swanky contract compile --all
works - flipper contract's TS types Generated successfullyswanky contract new hello --template flipper
swanky contract compile --all
throws the described error belowExpected vs. Actual Behavior
Expected: Compile both contracts
flipper
andhello
successfully with TS types generated. Actual Behavior: Unable to compile any contracts.Environment
Logs, Errors or Screenshots
Additional context
This error should be related to the package versions conflict. Upgrading
@727-ventures/typechain-polkadot
should fix this issue.