Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/wise-kings-reply.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@typechain/ethers-v5": patch
---

Fix for unused type in new ethers-v5 codegen
1 change: 0 additions & 1 deletion packages/hardhat-test/typechain-types/Directory/Hello.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import type {
TypedEvent,
TypedListener,
OnEvent,
PromiseOrValue,
} from "../common";

export interface HelloInterface extends utils.Interface {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import type {
TypedEvent,
TypedListener,
OnEvent,
PromiseOrValue,
} from "../../common";

export interface EdgeCasesInterface extends utils.Interface {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import type {
TypedEvent,
TypedListener,
OnEvent,
PromiseOrValue,
} from "../../common";

export interface TestContractInterface extends utils.Interface {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import type {
TypedEvent,
TypedListener,
OnEvent,
PromiseOrValue,
} from "../../common";

export interface TestContract1Interface extends utils.Interface {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import type {
TypedEvent,
TypedListener,
OnEvent,
PromiseOrValue,
} from "../../common";

export interface AInterface extends utils.Interface {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import type {
TypedEvent,
TypedListener,
OnEvent,
PromiseOrValue,
} from "../../common";

export interface BInterface extends utils.Interface {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import type {
TypedEvent,
TypedListener,
OnEvent,
PromiseOrValue,
} from "../../common";

export interface NAME12manglingInterface extends utils.Interface {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import type {
TypedEvent,
TypedListener,
OnEvent,
PromiseOrValue,
} from "../../../common";

export interface NestedLibraryInterface extends utils.Interface {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import type {
TypedEvent,
TypedListener,
OnEvent,
PromiseOrValue,
} from "../../../common";

export interface NestedLibraryInterface extends utils.Interface {
Expand Down
81 changes: 38 additions & 43 deletions packages/target-ethers-v5/src/codegen/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
CodegenConfig,
Contract,
createImportsForUsedIdentifiers,
createImportTypeDeclaration,
EventDeclaration,
FunctionDeclaration,
StructType,
Expand Down Expand Up @@ -120,29 +119,27 @@ export function codegenContractTypings(contract: Contract, codegenConfig: Codege
? `${new Array(contract.path.length).fill('..').join('/')}/common`
: './common'

const imports =
createImportsForUsedIdentifiers(
{
'type ethers': [
'BaseContract',
'BigNumber',
'BigNumberish',
'BytesLike',
'CallOverrides',
'ContractTransaction',
'Overrides',
'PayableOverrides',
'PopulatedTransaction',
'Signer',
'utils',
],
'type @ethersproject/abi': ['FunctionFragment', 'Result', 'EventFragment'],
'type @ethersproject/providers': ['Listener', 'Provider'],
},
source,
) +
'\n' +
createImportTypeDeclaration([...EVENT_IMPORTS, 'PromiseOrValue'], commonPath)
const imports = createImportsForUsedIdentifiers(
{
'type ethers': [
'BaseContract',
'BigNumber',
'BigNumberish',
'BytesLike',
'CallOverrides',
'ContractTransaction',
'Overrides',
'PayableOverrides',
'PopulatedTransaction',
'Signer',
'utils',
],
'type @ethersproject/abi': ['FunctionFragment', 'Result', 'EventFragment'],
'type @ethersproject/providers': ['Listener', 'Provider'],
[`type ${commonPath}`]: [...EVENT_IMPORTS, 'PromiseOrValue'],
},
source,
)

return imports + source
}
Expand Down Expand Up @@ -204,25 +201,23 @@ export function codegenContractFactory(

const commonPath = `${new Array(contract.path.length + 1).fill('..').join('/')}/common`

const imports =
createImportsForUsedIdentifiers(
{
ethers: [
'Signer',
'utils',
'Contract',
'ContractFactory',
'PayableOverrides',
'BytesLike',
'BigNumberish',
'Overrides',
],
'type @ethersproject/providers': ['Provider', 'TransactionRequest'],
},
source,
) +
'\n' +
createImportTypeDeclaration(['PromiseOrValue'], commonPath)
const imports = createImportsForUsedIdentifiers(
{
ethers: [
'Signer',
'utils',
'Contract',
'ContractFactory',
'PayableOverrides',
'BytesLike',
'BigNumberish',
'Overrides',
],
'type @ethersproject/providers': ['Provider', 'TransactionRequest'],
[`type ${commonPath}`]: ['PromiseOrValue'],
},
source,
)

return imports + source
}
Expand Down