dethcrypto / eth-sdk

Type-safe, lightweight SDKs for Ethereum smart contracts
MIT License
432 stars 40 forks source link

Sometimes eth-sdk fails to generate client #106

Closed Pzixel closed 2 years ago

Pzixel commented 2 years ago

I wasn't able to create a MRE to bring any code that reproduces an issue but I hope it may be clear from the error itself:

❯ yarn eth-sdk
yarn run v1.22.17 Loaded sdk definition from /Users/pzixel/Documents/Repos/test/eth-sdk ✔ Getting ABIs ⠙ Generating client/var/folders/_w/s45kr_gx6q1f75q2p7ljft100000gn/T/eth-sdk-64037-gNxOCe0UMMR6/index.ts (16,117): Namespace '"/var/folders/_w/s45kr_gx6q1f75q2p7ljft100000gn/T/eth-sdk-64037-gNxOCe0UMMR6/types/index"' has no exported member 'mainnet'. /var/folders/_w/s45kr_gx6q1f75q2p7ljft100000gn/T/eth-sdk-64037-gNxOCe0UMMR6/index.ts (16,117): Namespace '"/var/folders/_w/s45kr_gx6q1f75q2p7ljft100000gn/T/eth-sdk-64037-gNxOCe0UMMR6/types/index"' has no exported member 'mainnet'. ✖ Generating client

Error: TypeScript compilation failed.

    at /Users/pzixel/Documents/Repos/test/node_modules/@dethcrypto/eth-sdk/src/client/transpileClient.ts:39:15
    at Array.map (<anonymous>)
    at transpileClient (/Users/pzixel/Documents/Repos/test/node_modules/@dethcrypto/eth-sdk/src/client/transpileClient.ts:14:13)
    at async generateSdk (/Users/pzixel/Documents/Repos/test/node_modules/@dethcrypto/eth-sdk/src/client/index.ts:23:3)

I tried to downgrade packages version but it still returns this error.

daniel-ivanco commented 2 years ago

Had the same issue. I've tried to update all @typechain related dependencies to the latest versions and it started to work.

krzkaczor commented 2 years ago

As @daniel-ivanco mentioned -- probably a version mismatch. Please reopen if you have a repro.

rafinskipg commented 1 year ago

Seems to be a problem when the root project has a version of eth-sdk, and then you have a dependency installed that also uses eth-sdk, but different version.

0.3.3 in root and 0.3.1 in dependency