From 99890b1ebf952091764d47d4e37f3cda928ce37f Mon Sep 17 00:00:00 2001 From: Iain Date: Tue, 27 Sep 2022 15:20:24 -0400 Subject: [PATCH 1/5] Fix for unused type in new ethers-v5 codegen --- .../typechain-types/Directory/Hello.ts | 1 - .../factories/Counter__factory.ts | 2 +- .../factories/Demo__factory.ts | 2 +- .../factories/Directory/Hello__factory.ts | 2 +- .../StructsInConstructor__factory.ts | 2 +- .../artifacts/contracts/EdgeCases.ts | 1 - .../artifacts/contracts/TestContract.ts | 1 - .../artifacts/contracts/TestContract1.ts | 1 - .../artifacts/contracts/EdgeCases__factory.ts | 2 +- .../contracts/TestContract1__factory.ts | 2 +- .../contracts/TestContract__factory.ts | 2 +- .../contracts/lib/SafeMath__factory.ts | 2 +- .../externalArtifacts/ERC20__factory.ts | 2 +- .../types/v0.6.4/Issue428_Reproduction/A.ts | 1 - .../types/v0.6.4/Issue428_Reproduction/B.ts | 1 - .../v0.6.4/Name-Mangling/NAME12mangling.ts | 1 - .../types/v0.8.9/nested/a/NestedLibrary.ts | 1 - .../types/v0.8.9/nested/b/NestedLibrary.ts | 1 - .../target-ethers-v5/src/codegen/index.ts | 80 +++++++++---------- scripts/compile-contracts.ts | 2 +- 20 files changed, 48 insertions(+), 61 deletions(-) diff --git a/packages/hardhat-test/typechain-types/Directory/Hello.ts b/packages/hardhat-test/typechain-types/Directory/Hello.ts index f5c219bdf..3606d9775 100644 --- a/packages/hardhat-test/typechain-types/Directory/Hello.ts +++ b/packages/hardhat-test/typechain-types/Directory/Hello.ts @@ -9,7 +9,6 @@ import type { TypedEvent, TypedListener, OnEvent, - PromiseOrValue, } from "../common"; export interface HelloInterface extends utils.Interface { diff --git a/packages/hardhat-test/typechain-types/factories/Counter__factory.ts b/packages/hardhat-test/typechain-types/factories/Counter__factory.ts index c3295af98..10e290164 100644 --- a/packages/hardhat-test/typechain-types/factories/Counter__factory.ts +++ b/packages/hardhat-test/typechain-types/factories/Counter__factory.ts @@ -3,7 +3,7 @@ /* eslint-disable */ import { Signer, utils, Contract, ContractFactory, Overrides } from "ethers"; import type { Provider, TransactionRequest } from "@ethersproject/providers"; -import type { PromiseOrValue } from "../common"; + import type { Counter, CounterInterface } from "../Counter"; const _abi = [ diff --git a/packages/hardhat-test/typechain-types/factories/Demo__factory.ts b/packages/hardhat-test/typechain-types/factories/Demo__factory.ts index 30065c7f4..a13eb071f 100644 --- a/packages/hardhat-test/typechain-types/factories/Demo__factory.ts +++ b/packages/hardhat-test/typechain-types/factories/Demo__factory.ts @@ -3,7 +3,7 @@ /* eslint-disable */ import { Signer, utils, Contract, ContractFactory, Overrides } from "ethers"; import type { Provider, TransactionRequest } from "@ethersproject/providers"; -import type { PromiseOrValue } from "../common"; + import type { Demo, DemoInterface } from "../Demo"; const _abi = [ diff --git a/packages/hardhat-test/typechain-types/factories/Directory/Hello__factory.ts b/packages/hardhat-test/typechain-types/factories/Directory/Hello__factory.ts index ba1fe9300..eaf9f60db 100644 --- a/packages/hardhat-test/typechain-types/factories/Directory/Hello__factory.ts +++ b/packages/hardhat-test/typechain-types/factories/Directory/Hello__factory.ts @@ -10,7 +10,7 @@ import { Overrides, } from "ethers"; import type { Provider, TransactionRequest } from "@ethersproject/providers"; -import type { PromiseOrValue } from "../../common"; + import type { Hello, HelloInterface } from "../../Directory/Hello"; const _abi = [ diff --git a/packages/hardhat-test/typechain-types/factories/StructsInConstructor__factory.ts b/packages/hardhat-test/typechain-types/factories/StructsInConstructor__factory.ts index 8ca689e1b..c68218bc4 100644 --- a/packages/hardhat-test/typechain-types/factories/StructsInConstructor__factory.ts +++ b/packages/hardhat-test/typechain-types/factories/StructsInConstructor__factory.ts @@ -3,7 +3,7 @@ /* eslint-disable */ import { Signer, utils, Contract, ContractFactory, Overrides } from "ethers"; import type { Provider, TransactionRequest } from "@ethersproject/providers"; -import type { PromiseOrValue } from "../common"; + import type { StructsInConstructor, StructsInConstructorInterface, diff --git a/packages/hardhat/test/fixture-projects/hardhat-project/typechain-types/artifacts/contracts/EdgeCases.ts b/packages/hardhat/test/fixture-projects/hardhat-project/typechain-types/artifacts/contracts/EdgeCases.ts index 1dbd37100..8eba81138 100644 --- a/packages/hardhat/test/fixture-projects/hardhat-project/typechain-types/artifacts/contracts/EdgeCases.ts +++ b/packages/hardhat/test/fixture-projects/hardhat-project/typechain-types/artifacts/contracts/EdgeCases.ts @@ -9,7 +9,6 @@ import type { TypedEvent, TypedListener, OnEvent, - PromiseOrValue, } from "../../common"; export interface EdgeCasesInterface extends utils.Interface { diff --git a/packages/hardhat/test/fixture-projects/hardhat-project/typechain-types/artifacts/contracts/TestContract.ts b/packages/hardhat/test/fixture-projects/hardhat-project/typechain-types/artifacts/contracts/TestContract.ts index 2e6f94c42..db01ca653 100644 --- a/packages/hardhat/test/fixture-projects/hardhat-project/typechain-types/artifacts/contracts/TestContract.ts +++ b/packages/hardhat/test/fixture-projects/hardhat-project/typechain-types/artifacts/contracts/TestContract.ts @@ -9,7 +9,6 @@ import type { TypedEvent, TypedListener, OnEvent, - PromiseOrValue, } from "../../common"; export interface TestContractInterface extends utils.Interface { diff --git a/packages/hardhat/test/fixture-projects/hardhat-project/typechain-types/artifacts/contracts/TestContract1.ts b/packages/hardhat/test/fixture-projects/hardhat-project/typechain-types/artifacts/contracts/TestContract1.ts index 0a4eed8e5..dff563516 100644 --- a/packages/hardhat/test/fixture-projects/hardhat-project/typechain-types/artifacts/contracts/TestContract1.ts +++ b/packages/hardhat/test/fixture-projects/hardhat-project/typechain-types/artifacts/contracts/TestContract1.ts @@ -9,7 +9,6 @@ import type { TypedEvent, TypedListener, OnEvent, - PromiseOrValue, } from "../../common"; export interface TestContract1Interface extends utils.Interface { diff --git a/packages/hardhat/test/fixture-projects/hardhat-project/typechain-types/factories/artifacts/contracts/EdgeCases__factory.ts b/packages/hardhat/test/fixture-projects/hardhat-project/typechain-types/factories/artifacts/contracts/EdgeCases__factory.ts index 00c370d91..afce3127d 100644 --- a/packages/hardhat/test/fixture-projects/hardhat-project/typechain-types/factories/artifacts/contracts/EdgeCases__factory.ts +++ b/packages/hardhat/test/fixture-projects/hardhat-project/typechain-types/factories/artifacts/contracts/EdgeCases__factory.ts @@ -11,7 +11,7 @@ import { Overrides, } from "ethers"; import type { Provider, TransactionRequest } from "@ethersproject/providers"; -import type { PromiseOrValue } from "../../../common"; + import type { EdgeCases, EdgeCasesInterface, diff --git a/packages/hardhat/test/fixture-projects/hardhat-project/typechain-types/factories/artifacts/contracts/TestContract1__factory.ts b/packages/hardhat/test/fixture-projects/hardhat-project/typechain-types/factories/artifacts/contracts/TestContract1__factory.ts index 6a9e7336b..370c5fc45 100644 --- a/packages/hardhat/test/fixture-projects/hardhat-project/typechain-types/factories/artifacts/contracts/TestContract1__factory.ts +++ b/packages/hardhat/test/fixture-projects/hardhat-project/typechain-types/factories/artifacts/contracts/TestContract1__factory.ts @@ -10,7 +10,7 @@ import { Overrides, } from "ethers"; import type { Provider, TransactionRequest } from "@ethersproject/providers"; -import type { PromiseOrValue } from "../../../common"; + import type { TestContract1, TestContract1Interface, diff --git a/packages/hardhat/test/fixture-projects/hardhat-project/typechain-types/factories/artifacts/contracts/TestContract__factory.ts b/packages/hardhat/test/fixture-projects/hardhat-project/typechain-types/factories/artifacts/contracts/TestContract__factory.ts index dcd2f37ee..d6ac61c26 100644 --- a/packages/hardhat/test/fixture-projects/hardhat-project/typechain-types/factories/artifacts/contracts/TestContract__factory.ts +++ b/packages/hardhat/test/fixture-projects/hardhat-project/typechain-types/factories/artifacts/contracts/TestContract__factory.ts @@ -10,7 +10,7 @@ import { Overrides, } from "ethers"; import type { Provider, TransactionRequest } from "@ethersproject/providers"; -import type { PromiseOrValue } from "../../../common"; + import type { TestContract, TestContractInterface, diff --git a/packages/hardhat/test/fixture-projects/hardhat-project/typechain-types/factories/artifacts/contracts/lib/SafeMath__factory.ts b/packages/hardhat/test/fixture-projects/hardhat-project/typechain-types/factories/artifacts/contracts/lib/SafeMath__factory.ts index b28833eb4..505d3d7c6 100644 --- a/packages/hardhat/test/fixture-projects/hardhat-project/typechain-types/factories/artifacts/contracts/lib/SafeMath__factory.ts +++ b/packages/hardhat/test/fixture-projects/hardhat-project/typechain-types/factories/artifacts/contracts/lib/SafeMath__factory.ts @@ -3,7 +3,7 @@ /* eslint-disable */ import { Signer, utils, Contract, ContractFactory, Overrides } from "ethers"; import type { Provider, TransactionRequest } from "@ethersproject/providers"; -import type { PromiseOrValue } from "../../../../common"; + import type { SafeMath, SafeMathInterface, diff --git a/packages/hardhat/test/fixture-projects/hardhat-project/typechain-types/factories/externalArtifacts/ERC20__factory.ts b/packages/hardhat/test/fixture-projects/hardhat-project/typechain-types/factories/externalArtifacts/ERC20__factory.ts index 23c3cb9cb..01669f08f 100644 --- a/packages/hardhat/test/fixture-projects/hardhat-project/typechain-types/factories/externalArtifacts/ERC20__factory.ts +++ b/packages/hardhat/test/fixture-projects/hardhat-project/typechain-types/factories/externalArtifacts/ERC20__factory.ts @@ -3,7 +3,7 @@ /* eslint-disable */ import { Signer, utils, Contract, ContractFactory, Overrides } from "ethers"; import type { Provider, TransactionRequest } from "@ethersproject/providers"; -import type { PromiseOrValue } from "../../common"; + import type { ERC20, ERC20Interface } from "../../externalArtifacts/ERC20"; const _abi = [ diff --git a/packages/target-ethers-v5-test/types/v0.6.4/Issue428_Reproduction/A.ts b/packages/target-ethers-v5-test/types/v0.6.4/Issue428_Reproduction/A.ts index f58b16918..98287f216 100644 --- a/packages/target-ethers-v5-test/types/v0.6.4/Issue428_Reproduction/A.ts +++ b/packages/target-ethers-v5-test/types/v0.6.4/Issue428_Reproduction/A.ts @@ -9,7 +9,6 @@ import type { TypedEvent, TypedListener, OnEvent, - PromiseOrValue, } from "../../common"; export interface AInterface extends utils.Interface { diff --git a/packages/target-ethers-v5-test/types/v0.6.4/Issue428_Reproduction/B.ts b/packages/target-ethers-v5-test/types/v0.6.4/Issue428_Reproduction/B.ts index d0bfc5f5d..2a49529ef 100644 --- a/packages/target-ethers-v5-test/types/v0.6.4/Issue428_Reproduction/B.ts +++ b/packages/target-ethers-v5-test/types/v0.6.4/Issue428_Reproduction/B.ts @@ -9,7 +9,6 @@ import type { TypedEvent, TypedListener, OnEvent, - PromiseOrValue, } from "../../common"; export interface BInterface extends utils.Interface { diff --git a/packages/target-ethers-v5-test/types/v0.6.4/Name-Mangling/NAME12mangling.ts b/packages/target-ethers-v5-test/types/v0.6.4/Name-Mangling/NAME12mangling.ts index 0bc2c5e14..143ad127c 100644 --- a/packages/target-ethers-v5-test/types/v0.6.4/Name-Mangling/NAME12mangling.ts +++ b/packages/target-ethers-v5-test/types/v0.6.4/Name-Mangling/NAME12mangling.ts @@ -17,7 +17,6 @@ import type { TypedEvent, TypedListener, OnEvent, - PromiseOrValue, } from "../../common"; export interface NAME12manglingInterface extends utils.Interface { diff --git a/packages/target-ethers-v5-test/types/v0.8.9/nested/a/NestedLibrary.ts b/packages/target-ethers-v5-test/types/v0.8.9/nested/a/NestedLibrary.ts index f5cc963ab..3bc95b6bb 100644 --- a/packages/target-ethers-v5-test/types/v0.8.9/nested/a/NestedLibrary.ts +++ b/packages/target-ethers-v5-test/types/v0.8.9/nested/a/NestedLibrary.ts @@ -17,7 +17,6 @@ import type { TypedEvent, TypedListener, OnEvent, - PromiseOrValue, } from "../../../common"; export interface NestedLibraryInterface extends utils.Interface { diff --git a/packages/target-ethers-v5-test/types/v0.8.9/nested/b/NestedLibrary.ts b/packages/target-ethers-v5-test/types/v0.8.9/nested/b/NestedLibrary.ts index 54cdfb326..5eef3ca0b 100644 --- a/packages/target-ethers-v5-test/types/v0.8.9/nested/b/NestedLibrary.ts +++ b/packages/target-ethers-v5-test/types/v0.8.9/nested/b/NestedLibrary.ts @@ -17,7 +17,6 @@ import type { TypedEvent, TypedListener, OnEvent, - PromiseOrValue, } from "../../../common"; export interface NestedLibraryInterface extends utils.Interface { diff --git a/packages/target-ethers-v5/src/codegen/index.ts b/packages/target-ethers-v5/src/codegen/index.ts index 239e1a488..215d70e53 100644 --- a/packages/target-ethers-v5/src/codegen/index.ts +++ b/packages/target-ethers-v5/src/codegen/index.ts @@ -120,29 +120,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 } @@ -204,25 +202,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}`]: ['PormiseOrValue'], + }, + source, + ) return imports + source } diff --git a/scripts/compile-contracts.ts b/scripts/compile-contracts.ts index 806744787..d38161099 100644 --- a/scripts/compile-contracts.ts +++ b/scripts/compile-contracts.ts @@ -24,7 +24,7 @@ main() function panicOnNpm7() { const version = new SemVer(execSync('npm -v', { encoding: 'utf8' }).trim()) - if (version.major > 6) { + if (false && version.major > 6) { console.error( '\n' + `We're sorry, but it seems you are using ${bold('NPM ' + version.format())}.\n` + From feb7ab456b292dc0593a38d96ee20239021cf0b7 Mon Sep 17 00:00:00 2001 From: Iain Date: Tue, 27 Sep 2022 15:21:01 -0400 Subject: [PATCH 2/5] revert removed script check --- scripts/compile-contracts.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/compile-contracts.ts b/scripts/compile-contracts.ts index d38161099..806744787 100644 --- a/scripts/compile-contracts.ts +++ b/scripts/compile-contracts.ts @@ -24,7 +24,7 @@ main() function panicOnNpm7() { const version = new SemVer(execSync('npm -v', { encoding: 'utf8' }).trim()) - if (false && version.major > 6) { + if (version.major > 6) { console.error( '\n' + `We're sorry, but it seems you are using ${bold('NPM ' + version.format())}.\n` + From 94569c1631d786dabaae8aadaf6b38aa379b3473 Mon Sep 17 00:00:00 2001 From: Kris Kaczor Date: Wed, 18 Jan 2023 12:42:23 +0100 Subject: [PATCH 3/5] Add changeset --- .changeset/wise-kings-reply.md | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 .changeset/wise-kings-reply.md diff --git a/.changeset/wise-kings-reply.md b/.changeset/wise-kings-reply.md new file mode 100644 index 000000000..58fcba7af --- /dev/null +++ b/.changeset/wise-kings-reply.md @@ -0,0 +1,8 @@ +--- +"@typechain/hardhat-test": patch +"@typechain/hardhat": patch +"@typechain/ethers-v5-test": patch +"@typechain/ethers-v5": patch +--- + +Fix for unused type in new ethers-v5 codegen From 2e62cee660d34178afa2a907b73d4ff02eacf1b8 Mon Sep 17 00:00:00 2001 From: Kris Kaczor Date: Sun, 7 May 2023 16:37:51 +0200 Subject: [PATCH 4/5] Update wise-kings-reply.md --- .changeset/wise-kings-reply.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/.changeset/wise-kings-reply.md b/.changeset/wise-kings-reply.md index 58fcba7af..b116f43f5 100644 --- a/.changeset/wise-kings-reply.md +++ b/.changeset/wise-kings-reply.md @@ -1,7 +1,4 @@ --- -"@typechain/hardhat-test": patch -"@typechain/hardhat": patch -"@typechain/ethers-v5-test": patch "@typechain/ethers-v5": patch --- From 5704fce4c5e4fbc82b3812ad766088e584f9085c Mon Sep 17 00:00:00 2001 From: Krzysztof Kaczor Date: Sun, 7 May 2023 17:00:31 +0200 Subject: [PATCH 5/5] Fix typo and regenerate files --- .../hardhat-test/typechain-types/factories/Counter__factory.ts | 2 +- .../hardhat-test/typechain-types/factories/Demo__factory.ts | 2 +- .../typechain-types/factories/Directory/Hello__factory.ts | 2 +- .../typechain-types/factories/StructsInConstructor__factory.ts | 2 +- .../factories/artifacts/contracts/EdgeCases__factory.ts | 2 +- .../factories/artifacts/contracts/TestContract1__factory.ts | 2 +- .../factories/artifacts/contracts/TestContract__factory.ts | 2 +- .../factories/artifacts/contracts/lib/SafeMath__factory.ts | 2 +- .../factories/externalArtifacts/ERC20__factory.ts | 2 +- packages/target-ethers-v5/src/codegen/index.ts | 3 +-- 10 files changed, 10 insertions(+), 11 deletions(-) diff --git a/packages/hardhat-test/typechain-types/factories/Counter__factory.ts b/packages/hardhat-test/typechain-types/factories/Counter__factory.ts index aeaf52edc..820009389 100644 --- a/packages/hardhat-test/typechain-types/factories/Counter__factory.ts +++ b/packages/hardhat-test/typechain-types/factories/Counter__factory.ts @@ -3,7 +3,7 @@ /* eslint-disable */ import { Signer, utils, Contract, ContractFactory, Overrides } from "ethers"; import type { Provider, TransactionRequest } from "@ethersproject/providers"; - +import type { PromiseOrValue } from "../common"; import type { Counter, CounterInterface } from "../Counter"; const _abi = [ diff --git a/packages/hardhat-test/typechain-types/factories/Demo__factory.ts b/packages/hardhat-test/typechain-types/factories/Demo__factory.ts index 03ca7bc85..0b8727861 100644 --- a/packages/hardhat-test/typechain-types/factories/Demo__factory.ts +++ b/packages/hardhat-test/typechain-types/factories/Demo__factory.ts @@ -3,7 +3,7 @@ /* eslint-disable */ import { Signer, utils, Contract, ContractFactory, Overrides } from "ethers"; import type { Provider, TransactionRequest } from "@ethersproject/providers"; - +import type { PromiseOrValue } from "../common"; import type { Demo, DemoInterface } from "../Demo"; const _abi = [ diff --git a/packages/hardhat-test/typechain-types/factories/Directory/Hello__factory.ts b/packages/hardhat-test/typechain-types/factories/Directory/Hello__factory.ts index 1c241a5d6..85e2f33d1 100644 --- a/packages/hardhat-test/typechain-types/factories/Directory/Hello__factory.ts +++ b/packages/hardhat-test/typechain-types/factories/Directory/Hello__factory.ts @@ -10,7 +10,7 @@ import { Overrides, } from "ethers"; import type { Provider, TransactionRequest } from "@ethersproject/providers"; - +import type { PromiseOrValue } from "../../common"; import type { Hello, HelloInterface } from "../../Directory/Hello"; const _abi = [ diff --git a/packages/hardhat-test/typechain-types/factories/StructsInConstructor__factory.ts b/packages/hardhat-test/typechain-types/factories/StructsInConstructor__factory.ts index 4e41c651c..20c6572ce 100644 --- a/packages/hardhat-test/typechain-types/factories/StructsInConstructor__factory.ts +++ b/packages/hardhat-test/typechain-types/factories/StructsInConstructor__factory.ts @@ -3,7 +3,7 @@ /* eslint-disable */ import { Signer, utils, Contract, ContractFactory, Overrides } from "ethers"; import type { Provider, TransactionRequest } from "@ethersproject/providers"; - +import type { PromiseOrValue } from "../common"; import type { StructsInConstructor, StructsInConstructorInterface, diff --git a/packages/hardhat/test/fixture-projects/hardhat-project/typechain-types/factories/artifacts/contracts/EdgeCases__factory.ts b/packages/hardhat/test/fixture-projects/hardhat-project/typechain-types/factories/artifacts/contracts/EdgeCases__factory.ts index 90dcecbbb..da4dd32e1 100644 --- a/packages/hardhat/test/fixture-projects/hardhat-project/typechain-types/factories/artifacts/contracts/EdgeCases__factory.ts +++ b/packages/hardhat/test/fixture-projects/hardhat-project/typechain-types/factories/artifacts/contracts/EdgeCases__factory.ts @@ -11,7 +11,7 @@ import { Overrides, } from "ethers"; import type { Provider, TransactionRequest } from "@ethersproject/providers"; - +import type { PromiseOrValue } from "../../../common"; import type { EdgeCases, EdgeCasesInterface, diff --git a/packages/hardhat/test/fixture-projects/hardhat-project/typechain-types/factories/artifacts/contracts/TestContract1__factory.ts b/packages/hardhat/test/fixture-projects/hardhat-project/typechain-types/factories/artifacts/contracts/TestContract1__factory.ts index 4857f4ff8..023a1654b 100644 --- a/packages/hardhat/test/fixture-projects/hardhat-project/typechain-types/factories/artifacts/contracts/TestContract1__factory.ts +++ b/packages/hardhat/test/fixture-projects/hardhat-project/typechain-types/factories/artifacts/contracts/TestContract1__factory.ts @@ -10,7 +10,7 @@ import { Overrides, } from "ethers"; import type { Provider, TransactionRequest } from "@ethersproject/providers"; - +import type { PromiseOrValue } from "../../../common"; import type { TestContract1, TestContract1Interface, diff --git a/packages/hardhat/test/fixture-projects/hardhat-project/typechain-types/factories/artifacts/contracts/TestContract__factory.ts b/packages/hardhat/test/fixture-projects/hardhat-project/typechain-types/factories/artifacts/contracts/TestContract__factory.ts index 47461c477..8716f1a72 100644 --- a/packages/hardhat/test/fixture-projects/hardhat-project/typechain-types/factories/artifacts/contracts/TestContract__factory.ts +++ b/packages/hardhat/test/fixture-projects/hardhat-project/typechain-types/factories/artifacts/contracts/TestContract__factory.ts @@ -10,7 +10,7 @@ import { Overrides, } from "ethers"; import type { Provider, TransactionRequest } from "@ethersproject/providers"; - +import type { PromiseOrValue } from "../../../common"; import type { TestContract, TestContractInterface, diff --git a/packages/hardhat/test/fixture-projects/hardhat-project/typechain-types/factories/artifacts/contracts/lib/SafeMath__factory.ts b/packages/hardhat/test/fixture-projects/hardhat-project/typechain-types/factories/artifacts/contracts/lib/SafeMath__factory.ts index c1a72503f..2f09b542a 100644 --- a/packages/hardhat/test/fixture-projects/hardhat-project/typechain-types/factories/artifacts/contracts/lib/SafeMath__factory.ts +++ b/packages/hardhat/test/fixture-projects/hardhat-project/typechain-types/factories/artifacts/contracts/lib/SafeMath__factory.ts @@ -3,7 +3,7 @@ /* eslint-disable */ import { Signer, utils, Contract, ContractFactory, Overrides } from "ethers"; import type { Provider, TransactionRequest } from "@ethersproject/providers"; - +import type { PromiseOrValue } from "../../../../common"; import type { SafeMath, SafeMathInterface, diff --git a/packages/hardhat/test/fixture-projects/hardhat-project/typechain-types/factories/externalArtifacts/ERC20__factory.ts b/packages/hardhat/test/fixture-projects/hardhat-project/typechain-types/factories/externalArtifacts/ERC20__factory.ts index aba6a6210..9f0ccb753 100644 --- a/packages/hardhat/test/fixture-projects/hardhat-project/typechain-types/factories/externalArtifacts/ERC20__factory.ts +++ b/packages/hardhat/test/fixture-projects/hardhat-project/typechain-types/factories/externalArtifacts/ERC20__factory.ts @@ -3,7 +3,7 @@ /* eslint-disable */ import { Signer, utils, Contract, ContractFactory, Overrides } from "ethers"; import type { Provider, TransactionRequest } from "@ethersproject/providers"; - +import type { PromiseOrValue } from "../../common"; import type { ERC20, ERC20Interface } from "../../externalArtifacts/ERC20"; const _abi = [ diff --git a/packages/target-ethers-v5/src/codegen/index.ts b/packages/target-ethers-v5/src/codegen/index.ts index c13a9d6e8..09643500f 100644 --- a/packages/target-ethers-v5/src/codegen/index.ts +++ b/packages/target-ethers-v5/src/codegen/index.ts @@ -4,7 +4,6 @@ import { CodegenConfig, Contract, createImportsForUsedIdentifiers, - createImportTypeDeclaration, EventDeclaration, FunctionDeclaration, StructType, @@ -215,7 +214,7 @@ export function codegenContractFactory( 'Overrides', ], 'type @ethersproject/providers': ['Provider', 'TransactionRequest'], - [`type ${commonPath}`]: ['PormiseOrValue'], + [`type ${commonPath}`]: ['PromiseOrValue'], }, source, )