TypeChain
TypeChain copied to clipboard
🔌 TypeScript bindings for Ethereum smart contracts
I have a contract name of the form `xToken`. The typings are generated for `XToken` which can be imported but the hardhat counterparts don't work. ```ts hre.ethers.getContractFactory('XToken'); // for this...
## Description When there are two (or more?) contracts that share the same name, but which have a different letter case, TypeChain fails to generate the bindings correctly. ## Reproduction...
If there was a single `getEvent(a: "Name1"|...|"EventN") : EventFragment` (instead of an [overload](https://github.com/dethcrypto/TypeChain/blob/0c2b42c756777e69074c2e6283bcff9be8aa9c5f/packages/target-ethers-v5/src/codegen/index.ts#L374)), Typescript would accept things like ```typescript declare const evt : "Name1" | "Name2"; getEvent(evt); ```
After nomiclabs/hardhat#1726 is merged, it should be possible to support typing Waffle's `deployContract` via overloads as described [here](https://github.com/nomiclabs/hardhat/issues/1725#issuecomment-886099650). Would this change be a welcome contribution to this project?
Need to make proper issues in `typescript-eslint` repo: ### @typescript-eslint/no-unused-vars Doesn't respect `_` on unused *types*
`web3.eth.Contract().events.SomeEvent(callback)` returns `Subscription` object but the generated return type is `EventEmitter`. `typechain --target=web3-v1` generates this: ```typescript export interface MyContract extends BaseContract { events: { SomeEvent(cb?: Callback): EventEmitter; } } ```...
Fantastic work with the v5 addition of typings to the "getContractFactory" function - [I added them](https://github.com/paulrberg/solidity-template/blob/3def942b3ae779e491627837d4837b21c138e9d1/scripts/deploy.ts) to my Solidity template. In a similar fashion, it would be nice to have...
`contract.interface.events.AnEvent` contains an `EventFragment` instead of a `TypedEvent`. This does not match the README provided here: https://github.com/ethereum-ts/TypeChain/tree/master/packages/target-ethers-v5 Target: `ethers-v5` I am trying to read args from `receipt.events`: ```typescript receipt.events[0].args.from ```
**Actual:** The generated types for calls to a solidity method that returns a struct make all integer fields be `BN`. However, this is not what Truffle currently does with structs....
If you have a contract Math5_0 typechain will not generate type definitions for it I experienced this using hardhat + hardhat-typechain