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/plenty-eels-yell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@typechain/ethers-v5': major
---

Removes PromiseOrValue
21 changes: 8 additions & 13 deletions packages/hardhat-test/typechain-types/Counter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import type {
TypedEvent,
TypedListener,
OnEvent,
PromiseOrValue,
} from "./common";

export interface CounterInterface extends utils.Interface {
Expand Down Expand Up @@ -87,22 +86,22 @@ export interface Counter extends BaseContract {

functions: {
countDown(
overrides?: Overrides & { from?: PromiseOrValue<string> }
overrides?: Overrides & { from?: string }
): Promise<ContractTransaction>;

countUp(
overrides?: Overrides & { from?: PromiseOrValue<string> }
overrides?: Overrides & { from?: string }
): Promise<ContractTransaction>;

getCount(overrides?: CallOverrides): Promise<[BigNumber]>;
};

countDown(
overrides?: Overrides & { from?: PromiseOrValue<string> }
overrides?: Overrides & { from?: string }
): Promise<ContractTransaction>;

countUp(
overrides?: Overrides & { from?: PromiseOrValue<string> }
overrides?: Overrides & { from?: string }
): Promise<ContractTransaction>;

getCount(overrides?: CallOverrides): Promise<BigNumber>;
Expand All @@ -121,24 +120,20 @@ export interface Counter extends BaseContract {
};

estimateGas: {
countDown(
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<BigNumber>;
countDown(overrides?: Overrides & { from?: string }): Promise<BigNumber>;

countUp(
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<BigNumber>;
countUp(overrides?: Overrides & { from?: string }): Promise<BigNumber>;

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

populateTransaction: {
countDown(
overrides?: Overrides & { from?: PromiseOrValue<string> }
overrides?: Overrides & { from?: string }
): Promise<PopulatedTransaction>;

countUp(
overrides?: Overrides & { from?: PromiseOrValue<string> }
overrides?: Overrides & { from?: string }
): Promise<PopulatedTransaction>;

getCount(overrides?: CallOverrides): Promise<PopulatedTransaction>;
Expand Down
11 changes: 2 additions & 9 deletions packages/hardhat-test/typechain-types/Demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,17 @@ import type {
TypedEvent,
TypedListener,
OnEvent,
PromiseOrValue,
} from "./common";

export declare namespace Demo {
export type Struct1Struct = {
a: PromiseOrValue<BigNumberish>;
b: PromiseOrValue<BigNumberish>;
};
export type Struct1Struct = { a: BigNumberish; b: BigNumberish };

export type Struct1StructOutput = [BigNumber, BigNumber] & {
a: BigNumber;
b: BigNumber;
};

export type Struct2Struct = {
a: PromiseOrValue<BigNumberish>;
b: PromiseOrValue<BigNumberish>;
};
export type Struct2Struct = { a: BigNumberish; b: BigNumberish };

export type Struct2StructOutput = [BigNumber, BigNumber] & {
a: BigNumber;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,9 @@ import type {
TypedEvent,
TypedListener,
OnEvent,
PromiseOrValue,
} from "./common";

export type Vector2Struct = {
x: PromiseOrValue<BigNumberish>;
y: PromiseOrValue<BigNumberish>;
};
export type Vector2Struct = { x: BigNumberish; y: BigNumberish };

export type Vector2StructOutput = [BigNumber, BigNumber] & {
x: BigNumber;
Expand Down
2 changes: 0 additions & 2 deletions packages/hardhat-test/typechain-types/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,3 @@ export type GetContractTypeFromFactory<F> = F extends MinEthersFactory<
export type GetARGsTypeFromFactory<F> = F extends MinEthersFactory<any, any>
? Parameters<F["deploy"]>
: never;

export type PromiseOrValue<T> = T | Promise<T>;
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
/* 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 = [
Expand Down Expand Up @@ -81,13 +80,11 @@ export class Counter__factory extends ContractFactory {
}
}

override deploy(
overrides?: Overrides & { from?: PromiseOrValue<string> }
): Promise<Counter> {
override deploy(overrides?: Overrides & { from?: string }): Promise<Counter> {
return super.deploy(overrides || {}) as Promise<Counter>;
}
override getDeployTransaction(
overrides?: Overrides & { from?: PromiseOrValue<string> }
overrides?: Overrides & { from?: string }
): TransactionRequest {
return super.getDeployTransaction(overrides || {});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
/* 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 = [
Expand Down Expand Up @@ -72,14 +71,14 @@ export class Demo__factory extends ContractFactory {
override deploy(
input1: Demo.Struct1Struct,
input2: Demo.Struct2Struct[],
overrides?: Overrides & { from?: PromiseOrValue<string> }
overrides?: Overrides & { from?: string }
): Promise<Demo> {
return super.deploy(input1, input2, overrides || {}) as Promise<Demo>;
}
override getDeployTransaction(
input1: Demo.Struct1Struct,
input2: Demo.Struct2Struct[],
overrides?: Overrides & { from?: PromiseOrValue<string> }
overrides?: Overrides & { from?: string }
): TransactionRequest {
return super.getDeployTransaction(input1, input2, overrides || {});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ 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 = [
Expand Down Expand Up @@ -48,14 +47,14 @@ export class Hello__factory extends ContractFactory {
}

override deploy(
arg0: PromiseOrValue<BigNumberish>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
arg0: BigNumberish,
overrides?: Overrides & { from?: string }
): Promise<Hello> {
return super.deploy(arg0, overrides || {}) as Promise<Hello>;
}
override getDeployTransaction(
arg0: PromiseOrValue<BigNumberish>,
overrides?: Overrides & { from?: PromiseOrValue<string> }
arg0: BigNumberish,
overrides?: Overrides & { from?: string }
): TransactionRequest {
return super.getDeployTransaction(arg0, overrides || {});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
/* 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,
Expand Down Expand Up @@ -58,7 +57,7 @@ export class StructsInConstructor__factory extends ContractFactory {

override deploy(
segment: [Vector2Struct, Vector2Struct],
overrides?: Overrides & { from?: PromiseOrValue<string> }
overrides?: Overrides & { from?: string }
): Promise<StructsInConstructor> {
return super.deploy(
segment,
Expand All @@ -67,7 +66,7 @@ export class StructsInConstructor__factory extends ContractFactory {
}
override getDeployTransaction(
segment: [Vector2Struct, Vector2Struct],
overrides?: Overrides & { from?: PromiseOrValue<string> }
overrides?: Overrides & { from?: string }
): TransactionRequest {
return super.getDeployTransaction(segment, overrides || {});
}
Expand Down
Loading