Skip to content

Commit

Permalink
Fix type ContractRunner (#837)
Browse files Browse the repository at this point in the history
Co-authored-by: Clouds Flowing <[email protected]>
  • Loading branch information
krzkaczor and clouds56 authored May 13, 2023
1 parent 6707876 commit 13db3fc
Show file tree
Hide file tree
Showing 28 changed files with 35 additions and 33 deletions.
5 changes: 5 additions & 0 deletions .changeset/ethers-v6-runner.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@typechain/ethers-v6": patch
---

fix import type ContractRunner
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* tslint:disable */
/* eslint-disable */

import { Contract, Interface, ContractRunner } from "ethers";
import { Contract, Interface, type ContractRunner } from "ethers";
import type { Dai, DaiInterface } from "../Dai";

const _abi = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* tslint:disable */
/* eslint-disable */

import { Contract, Interface, ContractRunner } from "ethers";
import { Contract, Interface, type ContractRunner } from "ethers";
import type {
DataTypesInput,
DataTypesInputInterface,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* tslint:disable */
/* eslint-disable */

import { Contract, Interface, ContractRunner } from "ethers";
import { Contract, Interface, type ContractRunner } from "ethers";
import type {
DataTypesPure,
DataTypesPureInterface,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* tslint:disable */
/* eslint-disable */

import { Contract, Interface, ContractRunner } from "ethers";
import { Contract, Interface, type ContractRunner } from "ethers";
import type {
DataTypesView,
DataTypesViewInterface,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* tslint:disable */
/* eslint-disable */

import { Contract, Interface, ContractRunner } from "ethers";
import { Contract, Interface, type ContractRunner } from "ethers";
import type { Events, EventsInterface } from "../../v0.6.4/Events";

const _abi = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* tslint:disable */
/* eslint-disable */

import { Contract, Interface, ContractRunner } from "ethers";
import { Contract, Interface, type ContractRunner } from "ethers";
import type { A, AInterface } from "../../../v0.6.4/Issue428_Reproduction/A";

const _abi = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* tslint:disable */
/* eslint-disable */

import { Contract, Interface, ContractRunner } from "ethers";
import { Contract, Interface, type ContractRunner } from "ethers";
import type { B, BInterface } from "../../../v0.6.4/Issue428_Reproduction/B";

const _abi = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* tslint:disable */
/* eslint-disable */

import { Contract, Interface, ContractRunner } from "ethers";
import { Contract, Interface, type ContractRunner } from "ethers";
import type { Lib, LibInterface } from "../../../v0.6.4/Library/Lib";

const _abi = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* tslint:disable */
/* eslint-disable */

import { Contract, Interface, ContractRunner } from "ethers";
import { Contract, Interface, type ContractRunner } from "ethers";
import type {
LibraryConsumer,
LibraryConsumerInterface,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* tslint:disable */
/* eslint-disable */

import { Contract, Interface, ContractRunner } from "ethers";
import { Contract, Interface, type ContractRunner } from "ethers";
import type {
NAME12mangling,
NAME12manglingInterface,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* tslint:disable */
/* eslint-disable */

import { Contract, Interface, ContractRunner } from "ethers";
import { Contract, Interface, type ContractRunner } from "ethers";
import type { Overloads, OverloadsInterface } from "../../v0.6.4/Overloads";

const _abi = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* tslint:disable */
/* eslint-disable */

import { Contract, Interface, ContractRunner } from "ethers";
import { Contract, Interface, type ContractRunner } from "ethers";
import type {
PayableFactory,
PayableFactoryInterface,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* tslint:disable */
/* eslint-disable */

import { Contract, Interface, ContractRunner } from "ethers";
import { Contract, Interface, type ContractRunner } from "ethers";
import type {
Payable,
PayableInterface,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* tslint:disable */
/* eslint-disable */

import { Contract, Interface, ContractRunner } from "ethers";
import { Contract, Interface, type ContractRunner } from "ethers";
import type {
ISimpleToken,
ISimpleTokenInterface,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* tslint:disable */
/* eslint-disable */

import { Contract, Interface, ContractRunner } from "ethers";
import { Contract, Interface, type ContractRunner } from "ethers";
import type {
Issue552_Reproduction,
Issue552_ReproductionInterface,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* tslint:disable */
/* eslint-disable */

import { Contract, Interface, ContractRunner } from "ethers";
import { Contract, Interface, type ContractRunner } from "ethers";
import type {
KingOfTheHill,
KingOfTheHillInterface,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* tslint:disable */
/* eslint-disable */

import { Contract, Interface, ContractRunner } from "ethers";
import { Contract, Interface, type ContractRunner } from "ethers";
import type {
Withdrawable,
WithdrawableInterface,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* tslint:disable */
/* eslint-disable */

import { Contract, Interface, ContractRunner } from "ethers";
import { Contract, Interface, type ContractRunner } from "ethers";
import type {
ERC721Enumerable,
ERC721EnumerableInterface,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* tslint:disable */
/* eslint-disable */

import { Contract, Interface, ContractRunner } from "ethers";
import { Contract, Interface, type ContractRunner } from "ethers";
import type { ERC721, ERC721Interface } from "../../../v0.8.9/Rarity/ERC721";

const _abi = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* tslint:disable */
/* eslint-disable */

import { Contract, Interface, ContractRunner } from "ethers";
import { Contract, Interface, type ContractRunner } from "ethers";
import type {
IERC721Enumerable,
IERC721EnumerableInterface,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* tslint:disable */
/* eslint-disable */

import { Contract, Interface, ContractRunner } from "ethers";
import { Contract, Interface, type ContractRunner } from "ethers";
import type {
IERC721Receiver,
IERC721ReceiverInterface,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* tslint:disable */
/* eslint-disable */

import { Contract, Interface, ContractRunner } from "ethers";
import { Contract, Interface, type ContractRunner } from "ethers";
import type { IERC721, IERC721Interface } from "../../../v0.8.9/Rarity/IERC721";

const _abi = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* tslint:disable */
/* eslint-disable */

import { Contract, Interface, ContractRunner } from "ethers";
import { Contract, Interface, type ContractRunner } from "ethers";
import type { Rarity, RarityInterface } from "../../../v0.8.9/Rarity/Rarity";

const _abi = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* tslint:disable */
/* eslint-disable */

import { Contract, Interface, ContractRunner } from "ethers";
import { Contract, Interface, type ContractRunner } from "ethers";
import type {
SimpleToken,
SimpleTokenInterface,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* tslint:disable */
/* eslint-disable */

import { Contract, Interface, ContractRunner } from "ethers";
import { Contract, Interface, type ContractRunner } from "ethers";
import type {
NestedLibrary,
NestedLibraryInterface,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* tslint:disable */
/* eslint-disable */

import { Contract, Interface, ContractRunner } from "ethers";
import { Contract, Interface, type ContractRunner } from "ethers";
import type {
NestedLibrary,
NestedLibraryInterface,
Expand Down
11 changes: 4 additions & 7 deletions packages/target-ethers-v6/src/codegen/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export function codegenContractTypings(contract: Contract, codegenConfig: Codege
getFunction<T extends ContractMethod = ContractMethod>(key: string | FunctionFragment): T;
${values(contract.functions)
.flatMap((v) => processDeclaration(v, alwaysGenerateOverloads, generateGetFunctionForContract))
.join('\n')}
Expand Down Expand Up @@ -187,15 +187,12 @@ export function codegenContractFactory(
const imports =
createImportsForUsedIdentifiers(
{
ethers: [
ethers: ['Contract', 'ContractFactory', 'ContractTransactionResponse', 'Interface'],
'type ethers': [
'Signer',
'Contract',
'ContractFactory',
'BytesLike',
'BigNumberish',
'Overrides',
'ContractTransactionResponse',
'Interface',
'AddressLike',
'ContractDeployTransaction',
'Provider',
Expand All @@ -214,7 +211,7 @@ export function codegenContractFactory(
export function codegenAbstractContractFactory(contract: Contract, abi: any): string {
const { body, header } = codegenCommonContractFactory(contract, abi)
return `
import { Contract, Interface, ContractRunner } from "ethers";
import { Contract, Interface, type ContractRunner } from "ethers";
${header}
export class ${contract.name}${FACTORY_POSTFIX} {
Expand Down

0 comments on commit 13db3fc

Please sign in to comment.