Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the DefaultChainType as default type parameter #5893

Merged
merged 1 commit into from
Oct 30, 2024
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
6 changes: 4 additions & 2 deletions v-next/hardhat-ethers/src/type-extensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ import "@ignored/hardhat-vnext/types/network";
import type { HardhatEthers } from "./types.js";

declare module "@ignored/hardhat-vnext/types/network" {
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- the ChainTypeT must be declared in the interface but in this scenario it's not used
interface NetworkConnection<ChainTypeT extends ChainType | string> {
interface NetworkConnection<
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- the ChainTypeT must be declared in the interface but in this scenario it's not used
ChainTypeT extends ChainType | string = DefaultChainType,
> {
ethers: HardhatEthers;
}
}
6 changes: 4 additions & 2 deletions v-next/hardhat-network-helpers/src/type-extensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ import "@ignored/hardhat-vnext/types/network";
import type { NetworkHelpers } from "./internal/network-helpers/network-helpers.js";

declare module "@ignored/hardhat-vnext/types/network" {
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- the ChainTypeT must be declared in the interface but in this scenario it's not used
interface NetworkConnection<ChainTypeT extends ChainType | string> {
interface NetworkConnection<
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- the ChainTypeT must be declared in the interface but in this scenario it's not used
ChainTypeT extends ChainType | string = DefaultChainType,
> {
networkHelpers: NetworkHelpers;
}
}
4 changes: 3 additions & 1 deletion v-next/hardhat-viem/src/type-extensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import type { HardhatViemHelpers } from "./types.js";

import "@ignored/hardhat-vnext/types/network";
declare module "@ignored/hardhat-vnext/types/network" {
interface NetworkConnection<ChainTypeT extends ChainType | string> {
interface NetworkConnection<
ChainTypeT extends ChainType | string = DefaultChainType,
> {
viem: HardhatViemHelpers<ChainTypeT>;
}
}
9 changes: 7 additions & 2 deletions v-next/hardhat-viem/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import type { ArtifactMap } from "@ignored/hardhat-vnext/types/artifacts";
import type { ChainType } from "@ignored/hardhat-vnext/types/network";
import type {
ChainType,
DefaultChainType,
} from "@ignored/hardhat-vnext/types/network";
import type {
Abi as ViemAbi,
Account as ViemAccount,
Expand All @@ -26,7 +29,9 @@ import type {
WalletActionsL2 as ViemOpStackWalletActionsL2,
} from "viem/op-stack";

export interface HardhatViemHelpers<ChainTypeT extends ChainType | string> {
export interface HardhatViemHelpers<
ChainTypeT extends ChainType | string = DefaultChainType,
> {
/**
* Creates a public client configured with the provided settings.
*
Expand Down
4 changes: 3 additions & 1 deletion v-next/hardhat/src/types/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ export interface NetworkManager {
): Promise<NetworkConnection<ChainTypeT>>;
}

export interface NetworkConnection<ChainTypeT extends ChainType | string> {
export interface NetworkConnection<
ChainTypeT extends ChainType | string = DefaultChainType,
> {
readonly id: number;
readonly networkName: string;
readonly networkConfig: NetworkConfig;
Expand Down