Skip to content

Commit

Permalink
refactor: commit the typechain types in version control
Browse files Browse the repository at this point in the history
build: upgrade dev deps
build: upgrade to "typechain" v6.0.2
build: upgrade to "@typechain/ethers-v5" v8.0.1
build: upgrade to "@typechain/hardhat" v3.0.0
refactor: move the typechain types to "src/types"
  • Loading branch information
PaulRBerg committed Nov 6, 2021
1 parent 5dbfc91 commit 4eaa67e
Show file tree
Hide file tree
Showing 6 changed files with 403 additions and 192 deletions.
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
**/.coverage_contracts
**/dist
**/node_modules
**/types

# files
*.env
Expand All @@ -24,3 +23,9 @@ coverage.json
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# types
src/types/*
!src/types/common.ts
!src/types/Greeter.ts
!src/types/factories/Greeter__factory.ts
2 changes: 1 addition & 1 deletion hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const config: HardhatUserConfig = {
},
},
typechain: {
outDir: "types",
outDir: "src/types",
target: "ethers-v5",
},
};
Expand Down
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,37 +8,37 @@
},
"devDependencies": {
"@codechecks/client": "^0.1.12",
"@commitlint/cli": "^13.2.1",
"@commitlint/config-conventional": "^13.2.0",
"@commitlint/cli": "^14.1.0",
"@commitlint/config-conventional": "^14.1.0",
"@ethersproject/abi": "^5.5.0",
"@ethersproject/abstract-signer": "^5.5.0",
"@ethersproject/bignumber": "^5.5.0",
"@ethersproject/bytes": "^5.5.0",
"@ethersproject/providers": "^5.5.0",
"@nomiclabs/hardhat-ethers": "^2.0.2",
"@nomiclabs/hardhat-waffle": "^2.0.1",
"@typechain/ethers-v5": "^7.2.0",
"@typechain/hardhat": "^2.3.1",
"@typechain/ethers-v5": "^8.0.1",
"@typechain/hardhat": "^3.0.0",
"@types/chai": "^4.2.22",
"@types/fs-extra": "^9.0.13",
"@types/mocha": "^9.0.0",
"@types/node": "^16.11.6",
"@typescript-eslint/eslint-plugin": "^5.2.0",
"@typescript-eslint/parser": "^5.2.0",
"@typescript-eslint/eslint-plugin": "^5.3.0",
"@typescript-eslint/parser": "^5.3.0",
"chai": "^4.3.4",
"commitizen": "^4.2.4",
"cross-env": "^7.0.3",
"cz-conventional-changelog": "^3.3.0",
"dotenv": "^10.0.0",
"eslint": "^8.1.0",
"eslint": "^8.2.0",
"eslint-config-prettier": "^8.3.0",
"ethereum-waffle": "^3.4.0",
"ethers": "^5.5.1",
"fs-extra": "^10.0.0",
"hardhat": "^2.6.7",
"hardhat": "^2.6.8",
"hardhat-gas-reporter": "^1.0.4",
"husky": "^7.0.4",
"lint-staged": "^11.2.5",
"lint-staged": "^11.2.6",
"lodash": "^4.17.21",
"mocha": "^9.1.3",
"pinst": "^2.1.6",
Expand All @@ -51,7 +51,7 @@
"solidity-coverage": "^0.7.17",
"ts-generator": "^0.1.1",
"ts-node": "^10.4.0",
"typechain": "^5.2.0",
"typechain": "^6.0.2",
"typescript": "^4.4.4"
},
"files": [
Expand Down
141 changes: 141 additions & 0 deletions src/types/Greeter.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */

import {
ethers,
EventFilter,
Signer,
BigNumber,
BigNumberish,
PopulatedTransaction,
BaseContract,
ContractTransaction,
Overrides,
CallOverrides,
} from "ethers";
import { BytesLike } from "@ethersproject/bytes";
import { Listener, Provider } from "@ethersproject/providers";
import { FunctionFragment, EventFragment, Result } from "@ethersproject/abi";
import type {
TypedEventFilter,
TypedEvent,
TypedListener,
OnEvent,
} from "./common";

export interface GreeterInterface extends ethers.utils.Interface {
functions: {
"greet()": FunctionFragment;
"greeting()": FunctionFragment;
"setGreeting(string)": FunctionFragment;
"throwError()": FunctionFragment;
};

encodeFunctionData(functionFragment: "greet", values?: undefined): string;
encodeFunctionData(functionFragment: "greeting", values?: undefined): string;
encodeFunctionData(functionFragment: "setGreeting", values: [string]): string;
encodeFunctionData(
functionFragment: "throwError",
values?: undefined
): string;

decodeFunctionResult(functionFragment: "greet", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "greeting", data: BytesLike): Result;
decodeFunctionResult(
functionFragment: "setGreeting",
data: BytesLike
): Result;
decodeFunctionResult(functionFragment: "throwError", data: BytesLike): Result;

events: {};
}

export interface Greeter extends BaseContract {
connect(signerOrProvider: Signer | Provider | string): this;
attach(addressOrName: string): this;
deployed(): Promise<this>;

interface: GreeterInterface;

queryFilter<TEvent extends TypedEvent>(
event: TypedEventFilter<TEvent>,
fromBlockOrBlockhash?: string | number | undefined,
toBlock?: string | number | undefined
): Promise<Array<TEvent>>;

listeners<TEvent extends TypedEvent>(
eventFilter?: TypedEventFilter<TEvent>
): Array<TypedListener<TEvent>>;
listeners(eventName?: string): Array<Listener>;
removeAllListeners<TEvent extends TypedEvent>(
eventFilter: TypedEventFilter<TEvent>
): this;
removeAllListeners(eventName?: string): this;
off: OnEvent<this>;
on: OnEvent<this>;
once: OnEvent<this>;
removeListener: OnEvent<this>;

functions: {
greet(overrides?: CallOverrides): Promise<[string]>;

greeting(overrides?: CallOverrides): Promise<[string]>;

setGreeting(
_greeting: string,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;

throwError(overrides?: CallOverrides): Promise<[void]>;
};

greet(overrides?: CallOverrides): Promise<string>;

greeting(overrides?: CallOverrides): Promise<string>;

setGreeting(
_greeting: string,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;

throwError(overrides?: CallOverrides): Promise<void>;

callStatic: {
greet(overrides?: CallOverrides): Promise<string>;

greeting(overrides?: CallOverrides): Promise<string>;

setGreeting(_greeting: string, overrides?: CallOverrides): Promise<void>;

throwError(overrides?: CallOverrides): Promise<void>;
};

filters: {};

estimateGas: {
greet(overrides?: CallOverrides): Promise<BigNumber>;

greeting(overrides?: CallOverrides): Promise<BigNumber>;

setGreeting(
_greeting: string,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<BigNumber>;

throwError(overrides?: CallOverrides): Promise<BigNumber>;
};

populateTransaction: {
greet(overrides?: CallOverrides): Promise<PopulatedTransaction>;

greeting(overrides?: CallOverrides): Promise<PopulatedTransaction>;

setGreeting(
_greeting: string,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<PopulatedTransaction>;

throwError(overrides?: CallOverrides): Promise<PopulatedTransaction>;
};
}
44 changes: 44 additions & 0 deletions src/types/common.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
import type { Listener } from "@ethersproject/providers";
import type { Event, EventFilter } from "ethers";

export interface TypedEvent<
TArgsArray extends Array<any> = any,
TArgsObject = any
> extends Event {
args: TArgsArray & TArgsObject;
}

export interface TypedEventFilter<_TEvent extends TypedEvent>
extends EventFilter {}

export interface TypedListener<TEvent extends TypedEvent> {
(...listenerArg: [...__TypechainArgsArray<TEvent>, TEvent]): void;
}

type __TypechainArgsArray<T> = T extends TypedEvent<infer U> ? U : never;

export interface OnEvent<TRes> {
<TEvent extends TypedEvent>(
eventFilter: TypedEventFilter<TEvent>,
listener: TypedListener<TEvent>
): TRes;
(eventName: string, listener: Listener): TRes;
}

export type MinEthersFactory<C, ARGS> = {
deploy(...a: ARGS[]): Promise<C>;
};

export type GetContractTypeFromFactory<F> = F extends MinEthersFactory<
infer C,
any
>
? C
: never;

export type GetARGsTypeFromFactory<F> = F extends MinEthersFactory<any, any>
? Parameters<F["deploy"]>
: never;
Loading

0 comments on commit 4eaa67e

Please sign in to comment.