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

fail to run typechain on Andre Cronje rarity.sol #497

Closed
StErMi opened this issue Oct 7, 2021 · 2 comments
Closed

fail to run typechain on Andre Cronje rarity.sol #497

StErMi opened this issue Oct 7, 2021 · 2 comments
Assignees
Labels

Comments

@StErMi
Copy link

StErMi commented Oct 7, 2021

Hi there, I've tried to use typechain generate types of Andre Cronje rarity.sol contract but I'm getting this error:

SyntaxError: Parameter declaration expected. (476:64)
  474 |       
  475 |
> 476 |     'summoned(address,uint256,uint256)'(owner?: string | null, class?: null, summoner?: null, ): TypedEventFilter<[string, BigNumber, BigNumber], {owner: string,class: BigNumber,summoner: BigNumber }>;
      |                                                                ^
  477 |     
  478 |       summoned(owner?: string | null, class?: null, summoner?: null, ): TypedEventFilter<[string, BigNumber, BigNumber], {owner: string,class: BigNumber,summoner: BigNumber }>;
  479 |       
    at e (/Users/stermi/dev/web3/rarity-achievements/node_modules/typechain/node_modules/prettier/parser-typescript.js:1:322)
    at /Users/stermi/dev/web3/rarity-achievements/node_modules/typechain/node_modules/prettier/parser-typescript.js:22:3328347
    at Object.parse (/Users/stermi/dev/web3/rarity-achievements/node_modules/typechain/node_modules/prettier/parser-typescript.js:22:3328380)
    at Object.parse$a [as parse] (/Users/stermi/dev/web3/rarity-achievements/node_modules/typechain/node_modules/prettier/index.js:13729:19)
    at coreFormat (/Users/stermi/dev/web3/rarity-achievements/node_modules/typechain/node_modules/prettier/index.js:15260:16)
    at formatWithCursor$1 (/Users/stermi/dev/web3/rarity-achievements/node_modules/typechain/node_modules/prettier/index.js:15500:14)
    at /Users/stermi/dev/web3/rarity-achievements/node_modules/typechain/node_modules/prettier/index.js:60458:12
    at Object.format (/Users/stermi/dev/web3/rarity-achievements/node_modules/typechain/node_modules/prettier/index.js:60478:12)
    at prettierOutputTransformer (/Users/stermi/dev/web3/rarity-achievements/node_modules/typechain/src/codegen/outputTransformers/prettier.ts:8:19)
    at /Users/stermi/dev/web3/rarity-achievements/node_modules/typechain/src/typechain/io.ts:22:33 {
  loc: { start: { line: 476, column: 64 } },
  codeFrame: '\x1B[0m \x1B[90m 474 |\x1B[39m       \x1B[0m\n' +
    '\x1B[0m \x1B[90m 475 |\x1B[39m\x1B[0m\n' +
    "\x1B[0m\x1B[31m\x1B[1m>\x1B[22m\x1B[39m\x1B[90m 476 |\x1B[39m     \x1B[32m'summoned(address,uint256,uint256)'\x1B[39m(owner\x1B[33m?\x1B[39m\x1B[33m:\x1B[39m string \x1B[33m|\x1B[39m \x1B[36mnull\x1B[39m\x1B[33m,\x1B[39m \x1B[36mclass\x1B[39m\x1B[33m?\x1B[39m\x1B[33m:\x1B[39m \x1B[36mnull\x1B[39m\x1B[33m,\x1B[39m summoner\x1B[33m?\x1B[39m\x1B[33m:\x1B[39m \x1B[36mnull\x1B[39m\x1B[33m,\x1B[39m )\x1B[33m:\x1B[39m \x1B[33mTypedEventFilter\x1B[39m\x1B[33m<\x1B[39m[string\x1B[33m,\x1B[39m \x1B[33mBigNumber\x1B[39m\x1B[33m,\x1B[39m \x1B[33mBigNumber\x1B[39m]\x1B[33m,\x1B[39m {owner\x1B[33m:\x1B[39m string\x1B[33m,\x1B[39m\x1B[36mclass\x1B[39m\x1B[33m:\x1B[39m \x1B[33mBigNumber\x1B[39m\x1B[33m,\x1B[39msummoner\x1B[33m:\x1B[39m \x1B[33mBigNumber\x1B[39m }\x1B[33m>\x1B[39m\x1B[33m;\x1B[39m\x1B[0m\n" +
    '\x1B[0m \x1B[90m     |\x1B[39m                                                                \x1B[31m\x1B[1m^\x1B[22m\x1B[39m\x1B[0m\n' +
    '\x1B[0m \x1B[90m 477 |\x1B[39m     \x1B[0m\n' +
    '\x1B[0m \x1B[90m 478 |\x1B[39m       summoned(owner\x1B[33m?\x1B[39m\x1B[33m:\x1B[39m string \x1B[33m|\x1B[39m \x1B[36mnull\x1B[39m\x1B[33m,\x1B[39m \x1B[36mclass\x1B[39m\x1B[33m?\x1B[39m\x1B[33m:\x1B[39m \x1B[36mnull\x1B[39m\x1B[33m,\x1B[39m summoner\x1B[33m?\x1B[39m\x1B[33m:\x1B[39m \x1B[36mnull\x1B[39m\x1B[33m,\x1B[39m )\x1B[33m:\x1B[39m \x1B[33mTypedEventFilter\x1B[39m\x1B[33m<\x1B[39m[string\x1B[33m,\x1B[39m \x1B[33mBigNumber\x1B[39m\x1B[33m,\x1B[39m \x1B[33mBigNumber\x1B[39m]\x1B[33m,\x1B[39m {owner\x1B[33m:\x1B[39m string\x1B[33m,\x1B[39m\x1B[36mclass\x1B[39m\x1B[33m:\x1B[39m \x1B[33mBigNumber\x1B[39m\x1B[33m,\x1B[39msummoner\x1B[33m:\x1B[39m \x1B[33mBigNumber\x1B[39m }\x1B[33m>\x1B[39m\x1B[33m;\x1B[39m\x1B[0m\n' +
    '\x1B[0m \x1B[90m 479 |\x1B[39m       \x1B[0m'
}

I think that the problem is because of this: event summoned(address indexed owner, uint256 class, uint256 summoner); and in typescript/js the class is a reserved keyword.

how could that be fixed?

@krzkaczor
Copy link
Member

krzkaczor commented Oct 7, 2021

@StErMi quick fix would be to rename class in abi. We will roll out a proper fix soon.

For a proper fix, we need to have a generic mechanism to rewrite symbols that collide with reserved keywords.

@hasparus
Copy link
Contributor

Hey @StErMi, this should be fixed after you upgrade to [email protected].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants