l00k / devphase

Development tool for Phala Phat contracts.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Source cannot compile

h4x3rotab opened this issue · comments

Reproduce:

yarn
yarn compile

Produces error:

yarn run v1.22.15
$ tsup
CLI Building entry: src/index.ts, src/cli/index.ts
CLI Using tsconfig: tsconfig.build.json
CLI tsup v6.2.3
CLI Using tsup config: /home/user/workspace/others/devphase/tsup.config.ts
CLI Target: node16
CLI Cleaning output folder
CJS Build start
CJS dist/index.js     28.58 KB
CJS dist/cli/index.js 41.58 KB
CJS ⚡️ Build success in 127ms
DTS Build start
src/service/api/ContractFactory.ts(200,13): error TS2345: Argument of type 'import("/home/user/workspace/others/devphase/node_modules/@polkadot/api/promise/Api").ApiPromise' is not assignable to parameter of type 'import("/home/user/workspace/others/devphase/node_modules/@polkadot/api-contract/node_modules/@polkadot/api/promise/Api").ApiPromise'.
  Property '#private' in type 'ApiPromise' refers to a different member that cannot be accessed from within type 'ApiPromise'.

Error: error occured in dts build
    at Worker.<anonymous> (/home/user/workspace/others/devphase/node_modules/tsup/dist/index.js:2157:26)
    at Worker.emit (node:events:390:28)
    at MessagePort.<anonymous> (node:internal/worker:232:53)
    at MessagePort.[nodejs.internal.kHybridDispatch] (node:internal/event_target:562:20)
    at MessagePort.exports.emitMessage (node:internal/per_context/messageport:23:28)
Error: Failed to compile. Check the logs above.
    at error (/home/user/workspace/others/devphase/node_modules/rollup/dist/shared/rollup.js:198:30)
    at throwPluginError (/home/user/workspace/others/devphase/node_modules/rollup/dist/shared/rollup.js:21718:12)
    at Object.error (/home/user/workspace/others/devphase/node_modules/rollup/dist/shared/rollup.js:22672:20)
    at Object.error (/home/user/workspace/others/devphase/node_modules/rollup/dist/shared/rollup.js:21895:42)
    at Object.transform (/home/user/workspace/others/devphase/node_modules/tsup/dist/rollup.js:7217:20)
    at /home/user/workspace/others/devphase/node_modules/rollup/dist/shared/rollup.js:22879:40
DTS Build error
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Looks like the problem is the ApiPromise from js-sdk is different from polkadot.js, probably different version?

commented

I was not able to reproduce that.
I see some small differences in versions, but hard to expect it was cause of issue.

yarn run v1.22.19
$ tsup
CLI Building entry: src/index.ts, src/cli/index.ts
CLI Using tsconfig: tsconfig.build.json
CLI tsup v6.4.0
CLI Using tsup config: (...)/devphase/tsup.config.ts
CLI Target: node16
CLI Cleaning output folder
CJS Build start
CJS dist/index.js     30.64 KB
CJS dist/cli/index.js 43.47 KB
CJS ⚡️ Build success in 107ms
DTS Build start
DTS ⚡️ Build success in 4404ms
DTS dist/index.d.ts     11.14 KB
DTS dist/cli/index.d.ts 31.00 B
Done in 5.06s.

Could you check with latest revision?

Weird. I still cannot compile it without doing the as unknown as any hack in these two lines. Let's keep the issue for a few more days. I will try to figure it out.

Closed because it works perfectly with:

  • node v16.19.0
  • yarn 1.22.19