diff --git a/packages/hardhat-test/typechain-types/Counter.ts b/packages/hardhat-test/typechain-types/Counter.ts new file mode 100644 index 000000000..9d8ad3bab --- /dev/null +++ b/packages/hardhat-test/typechain-types/Counter.ts @@ -0,0 +1,136 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import type { + BaseContract, + BigNumberish, + BytesLike, + FunctionFragment, + Result, + Interface, + EventFragment, + ContractRunner, + ContractMethod, + Listener, +} from "ethers"; +import type { + TypedContractEvent, + TypedDeferredTopicFilter, + TypedEventLog, + TypedLogDescription, + TypedListener, + TypedContractMethod, +} from "./common"; + +export interface CounterInterface extends Interface { + getFunction( + nameOrSignature: "countDown" | "countUp" | "getCount" + ): FunctionFragment; + + getEvent(nameOrSignatureOrTopic: "CountedTo"): EventFragment; + + encodeFunctionData(functionFragment: "countDown", values?: undefined): string; + encodeFunctionData(functionFragment: "countUp", values?: undefined): string; + encodeFunctionData(functionFragment: "getCount", values?: undefined): string; + + decodeFunctionResult(functionFragment: "countDown", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "countUp", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "getCount", data: BytesLike): Result; +} + +export namespace CountedToEvent { + export type InputTuple = [number: BigNumberish]; + export type OutputTuple = [number: bigint]; + export interface OutputObject { + number: bigint; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export interface Counter extends BaseContract { + connect(runner?: ContractRunner | null): Counter; + waitForDeployment(): Promise; + + interface: CounterInterface; + + queryFilter( + event: TCEvent, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined + ): Promise>>; + queryFilter( + filter: TypedDeferredTopicFilter, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined + ): Promise>>; + + on( + event: TCEvent, + listener: TypedListener + ): Promise; + on( + filter: TypedDeferredTopicFilter, + listener: TypedListener + ): Promise; + + once( + event: TCEvent, + listener: TypedListener + ): Promise; + once( + filter: TypedDeferredTopicFilter, + listener: TypedListener + ): Promise; + + listeners( + event: TCEvent + ): Promise>>; + listeners(eventName?: string): Promise>; + removeAllListeners( + event?: TCEvent + ): Promise; + + countDown: TypedContractMethod<[], [bigint], "nonpayable">; + + countUp: TypedContractMethod<[], [bigint], "nonpayable">; + + getCount: TypedContractMethod<[], [bigint], "view">; + + getFunction( + key: string | FunctionFragment + ): T; + + getFunction( + nameOrSignature: "countDown" + ): TypedContractMethod<[], [bigint], "nonpayable">; + getFunction( + nameOrSignature: "countUp" + ): TypedContractMethod<[], [bigint], "nonpayable">; + getFunction( + nameOrSignature: "getCount" + ): TypedContractMethod<[], [bigint], "view">; + + getEvent( + key: "CountedTo" + ): TypedContractEvent< + CountedToEvent.InputTuple, + CountedToEvent.OutputTuple, + CountedToEvent.OutputObject + >; + + filters: { + "CountedTo(uint256)": TypedContractEvent< + CountedToEvent.InputTuple, + CountedToEvent.OutputTuple, + CountedToEvent.OutputObject + >; + CountedTo: TypedContractEvent< + CountedToEvent.InputTuple, + CountedToEvent.OutputTuple, + CountedToEvent.OutputObject + >; + }; +} diff --git a/packages/hardhat-test/typechain-types/Demo.ts b/packages/hardhat-test/typechain-types/Demo.ts new file mode 100644 index 000000000..dae9aab5a --- /dev/null +++ b/packages/hardhat-test/typechain-types/Demo.ts @@ -0,0 +1,86 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import type { + BaseContract, + BigNumberish, + FunctionFragment, + Interface, + ContractRunner, + ContractMethod, + Listener, +} from "ethers"; +import type { + TypedContractEvent, + TypedDeferredTopicFilter, + TypedEventLog, + TypedListener, +} from "./common"; + +export declare namespace Demo { + export type Struct1Struct = { a: BigNumberish; b: BigNumberish }; + + export type Struct1StructOutput = [a: bigint, b: bigint] & { + a: bigint; + b: bigint; + }; + + export type Struct2Struct = { a: BigNumberish; b: BigNumberish }; + + export type Struct2StructOutput = [a: bigint, b: bigint] & { + a: bigint; + b: bigint; + }; +} + +export interface DemoInterface extends Interface {} + +export interface Demo extends BaseContract { + connect(runner?: ContractRunner | null): Demo; + waitForDeployment(): Promise; + + interface: DemoInterface; + + queryFilter( + event: TCEvent, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined + ): Promise>>; + queryFilter( + filter: TypedDeferredTopicFilter, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined + ): Promise>>; + + on( + event: TCEvent, + listener: TypedListener + ): Promise; + on( + filter: TypedDeferredTopicFilter, + listener: TypedListener + ): Promise; + + once( + event: TCEvent, + listener: TypedListener + ): Promise; + once( + filter: TypedDeferredTopicFilter, + listener: TypedListener + ): Promise; + + listeners( + event: TCEvent + ): Promise>>; + listeners(eventName?: string): Promise>; + removeAllListeners( + event?: TCEvent + ): Promise; + + getFunction( + key: string | FunctionFragment + ): T; + + filters: {}; +} diff --git a/packages/hardhat-test/typechain-types/Directory/Hello.ts b/packages/hardhat-test/typechain-types/Directory/Hello.ts new file mode 100644 index 000000000..a68059bfb --- /dev/null +++ b/packages/hardhat-test/typechain-types/Directory/Hello.ts @@ -0,0 +1,69 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import type { + BaseContract, + FunctionFragment, + Interface, + ContractRunner, + ContractMethod, + Listener, +} from "ethers"; +import type { + TypedContractEvent, + TypedDeferredTopicFilter, + TypedEventLog, + TypedListener, +} from "../common"; + +export interface HelloInterface extends Interface {} + +export interface Hello extends BaseContract { + connect(runner?: ContractRunner | null): Hello; + waitForDeployment(): Promise; + + interface: HelloInterface; + + queryFilter( + event: TCEvent, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined + ): Promise>>; + queryFilter( + filter: TypedDeferredTopicFilter, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined + ): Promise>>; + + on( + event: TCEvent, + listener: TypedListener + ): Promise; + on( + filter: TypedDeferredTopicFilter, + listener: TypedListener + ): Promise; + + once( + event: TCEvent, + listener: TypedListener + ): Promise; + once( + filter: TypedDeferredTopicFilter, + listener: TypedListener + ): Promise; + + listeners( + event: TCEvent + ): Promise>>; + listeners(eventName?: string): Promise>; + removeAllListeners( + event?: TCEvent + ): Promise; + + getFunction( + key: string | FunctionFragment + ): T; + + filters: {}; +} diff --git a/packages/hardhat-test/typechain-types/Directory/index.ts b/packages/hardhat-test/typechain-types/Directory/index.ts new file mode 100644 index 000000000..e7f737e68 --- /dev/null +++ b/packages/hardhat-test/typechain-types/Directory/index.ts @@ -0,0 +1,4 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +export type { Hello } from "./Hello"; diff --git a/packages/hardhat-test/typechain-types/StructsInConstructor.ts b/packages/hardhat-test/typechain-types/StructsInConstructor.ts new file mode 100644 index 000000000..0d9729668 --- /dev/null +++ b/packages/hardhat-test/typechain-types/StructsInConstructor.ts @@ -0,0 +1,77 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import type { + BaseContract, + BigNumberish, + FunctionFragment, + Interface, + ContractRunner, + ContractMethod, + Listener, +} from "ethers"; +import type { + TypedContractEvent, + TypedDeferredTopicFilter, + TypedEventLog, + TypedListener, +} from "./common"; + +export type Vector2Struct = { x: BigNumberish; y: BigNumberish }; + +export type Vector2StructOutput = [x: bigint, y: bigint] & { + x: bigint; + y: bigint; +}; + +export interface StructsInConstructorInterface extends Interface {} + +export interface StructsInConstructor extends BaseContract { + connect(runner?: ContractRunner | null): StructsInConstructor; + waitForDeployment(): Promise; + + interface: StructsInConstructorInterface; + + queryFilter( + event: TCEvent, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined + ): Promise>>; + queryFilter( + filter: TypedDeferredTopicFilter, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined + ): Promise>>; + + on( + event: TCEvent, + listener: TypedListener + ): Promise; + on( + filter: TypedDeferredTopicFilter, + listener: TypedListener + ): Promise; + + once( + event: TCEvent, + listener: TypedListener + ): Promise; + once( + filter: TypedDeferredTopicFilter, + listener: TypedListener + ): Promise; + + listeners( + event: TCEvent + ): Promise>>; + listeners(eventName?: string): Promise>; + removeAllListeners( + event?: TCEvent + ): Promise; + + getFunction( + key: string | FunctionFragment + ): T; + + filters: {}; +} diff --git a/packages/hardhat-test/typechain-types/common.ts b/packages/hardhat-test/typechain-types/common.ts new file mode 100644 index 000000000..56b5f21e9 --- /dev/null +++ b/packages/hardhat-test/typechain-types/common.ts @@ -0,0 +1,131 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import type { + FunctionFragment, + Typed, + EventFragment, + ContractTransaction, + ContractTransactionResponse, + DeferredTopicFilter, + EventLog, + TransactionRequest, + LogDescription, +} from "ethers"; + +export interface TypedDeferredTopicFilter<_TCEvent extends TypedContractEvent> + extends DeferredTopicFilter {} + +export interface TypedContractEvent< + InputTuple extends Array = any, + OutputTuple extends Array = any, + OutputObject = any +> { + (...args: Partial): TypedDeferredTopicFilter< + TypedContractEvent + >; + name: string; + fragment: EventFragment; + getFragment(...args: Partial): EventFragment; +} + +type __TypechainAOutputTuple = T extends TypedContractEvent< + infer _U, + infer W +> + ? W + : never; +type __TypechainOutputObject = T extends TypedContractEvent< + infer _U, + infer _W, + infer V +> + ? V + : never; + +export interface TypedEventLog + extends Omit { + args: __TypechainAOutputTuple & __TypechainOutputObject; +} + +export interface TypedLogDescription + extends Omit { + args: __TypechainAOutputTuple & __TypechainOutputObject; +} + +export type TypedListener = ( + ...listenerArg: [ + ...__TypechainAOutputTuple, + TypedEventLog, + ...undefined[] + ] +) => void; + +export type MinEthersFactory = { + deploy(...a: ARGS[]): Promise; +}; + +export type GetContractTypeFromFactory = F extends MinEthersFactory< + infer C, + any +> + ? C + : never; +export type GetARGsTypeFromFactory = F extends MinEthersFactory + ? Parameters + : never; + +export type StateMutability = "nonpayable" | "payable" | "view"; + +export type BaseOverrides = Omit; +export type NonPayableOverrides = Omit< + BaseOverrides, + "value" | "blockTag" | "enableCcipRead" +>; +export type PayableOverrides = Omit< + BaseOverrides, + "blockTag" | "enableCcipRead" +>; +export type ViewOverrides = Omit; +export type Overrides = S extends "nonpayable" + ? NonPayableOverrides + : S extends "payable" + ? PayableOverrides + : ViewOverrides; + +export type PostfixOverrides, S extends StateMutability> = + | A + | [...A, Overrides]; +export type ContractMethodArgs< + A extends Array, + S extends StateMutability +> = PostfixOverrides<{ [I in keyof A]-?: A[I] | Typed }, S>; + +export type DefaultReturnType = R extends Array ? R[0] : R; + +// export interface ContractMethod = Array, R = any, D extends R | ContractTransactionResponse = R | ContractTransactionResponse> { +export interface TypedContractMethod< + A extends Array = Array, + R = any, + S extends StateMutability = "payable" +> { + (...args: ContractMethodArgs): S extends "view" + ? Promise> + : Promise; + + name: string; + + fragment: FunctionFragment; + + getFragment(...args: ContractMethodArgs): FunctionFragment; + + populateTransaction( + ...args: ContractMethodArgs + ): Promise; + staticCall( + ...args: ContractMethodArgs + ): Promise>; + send(...args: ContractMethodArgs): Promise; + estimateGas(...args: ContractMethodArgs): Promise; + staticCallResult(...args: ContractMethodArgs): Promise; +} diff --git a/packages/hardhat-test/typechain-types/factories/Counter__factory.ts b/packages/hardhat-test/typechain-types/factories/Counter__factory.ts new file mode 100644 index 000000000..3709b5010 --- /dev/null +++ b/packages/hardhat-test/typechain-types/factories/Counter__factory.ts @@ -0,0 +1,113 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import { + Contract, + ContractFactory, + ContractTransactionResponse, + Interface, +} from "ethers"; +import type { Signer, ContractDeployTransaction, ContractRunner } from "ethers"; +import type { NonPayableOverrides } from "../common"; +import type { Counter, CounterInterface } from "../Counter"; + +const _abi = [ + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "uint256", + name: "number", + type: "uint256", + }, + ], + name: "CountedTo", + type: "event", + }, + { + inputs: [], + name: "countDown", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "countUp", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "getCount", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, +] as const; + +const _bytecode = + "0x60806040526000805534801561001457600080fd5b506105f8806100246000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80630bd8599e146100465780635fcbd5b614610064578063a87d942c14610082575b600080fd5b61004e6100a0565b60405161005b9190610432565b60405180910390f35b61006c610183565b6040516100799190610432565b60405180910390f35b61008a610266565b6040516100979190610432565b60405180910390f35b60006100e36040518060400160405280601081526020017f636f756e7455703a20636f756e74203d0000000000000000000000000000000081525060005461026f565b600060016000546100f49190610469565b9050600054811161013a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161013190610412565b60405180910390fd5b806000819055507fa501f5a8ef1a812bff54fb3642cfaec066c351af1716c48a7bdd05e0bb631e676000546040516101729190610432565b60405180910390a160005491505090565b60006101c66040518060400160405280601281526020017f636f756e74446f776e3a20636f756e74203d000000000000000000000000000081525060005461026f565b600060016000546101d791906104bf565b9050600054811061021d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610214906103f2565b60405180910390fd5b806000819055507fa501f5a8ef1a812bff54fb3642cfaec066c351af1716c48a7bdd05e0bb631e676000546040516102559190610432565b60405180910390a160005491505090565b60008054905090565b61030782826040516024016102859291906103c2565b6040516020818303038152906040527f9710a9d0000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505061030b565b5050565b60008151905060006a636f6e736f6c652e6c6f679050602083016000808483855afa5050505050565b600061033f8261044d565b6103498185610458565b93506103598185602086016104fd565b6103628161055f565b840191505092915050565b600061037a601183610458565b915061038582610570565b602082019050919050565b600061039d601083610458565b91506103a882610599565b602082019050919050565b6103bc816104f3565b82525050565b600060408201905081810360008301526103dc8185610334565b90506103eb60208301846103b3565b9392505050565b6000602082019050818103600083015261040b8161036d565b9050919050565b6000602082019050818103600083015261042b81610390565b9050919050565b600060208201905061044760008301846103b3565b92915050565b600081519050919050565b600082825260208201905092915050565b6000610474826104f3565b915061047f836104f3565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156104b4576104b3610530565b5b828201905092915050565b60006104ca826104f3565b91506104d5836104f3565b9250828210156104e8576104e7610530565b5b828203905092915050565b6000819050919050565b60005b8381101561051b578082015181840152602081019050610500565b8381111561052a576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000601f19601f8301169050919050565b7f55696e7432353620756e646572666c6f77000000000000000000000000000000600082015250565b7f55696e74323536206f766572666c6f770000000000000000000000000000000060008201525056fea264697066735822122062e7987659cfb72b2613b81304a8a0e3671f5a2351b8cfece1da96e99b6512b664736f6c63430008070033"; + +type CounterConstructorParams = + | [signer?: Signer] + | ConstructorParameters; + +const isSuperArgs = ( + xs: CounterConstructorParams +): xs is ConstructorParameters => xs.length > 1; + +export class Counter__factory extends ContractFactory { + constructor(...args: CounterConstructorParams) { + if (isSuperArgs(args)) { + super(...args); + } else { + super(_abi, _bytecode, args[0]); + } + } + + override getDeployTransaction( + overrides?: NonPayableOverrides & { from?: string } + ): Promise { + return super.getDeployTransaction(overrides || {}); + } + override deploy(overrides?: NonPayableOverrides & { from?: string }) { + return super.deploy(overrides || {}) as Promise< + Counter & { + deploymentTransaction(): ContractTransactionResponse; + } + >; + } + override connect(runner: ContractRunner | null): Counter__factory { + return super.connect(runner) as Counter__factory; + } + + static readonly bytecode = _bytecode; + static readonly abi = _abi; + static createInterface(): CounterInterface { + return new Interface(_abi) as CounterInterface; + } + static connect(address: string, runner?: ContractRunner | null): Counter { + return new Contract(address, _abi, runner) as unknown as Counter; + } +} diff --git a/packages/hardhat-test/typechain-types/factories/Demo__factory.ts b/packages/hardhat-test/typechain-types/factories/Demo__factory.ts new file mode 100644 index 000000000..b0cba22fe --- /dev/null +++ b/packages/hardhat-test/typechain-types/factories/Demo__factory.ts @@ -0,0 +1,107 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import { + Contract, + ContractFactory, + ContractTransactionResponse, + Interface, +} from "ethers"; +import type { Signer, ContractDeployTransaction, ContractRunner } from "ethers"; +import type { NonPayableOverrides } from "../common"; +import type { Demo, DemoInterface } from "../Demo"; + +const _abi = [ + { + inputs: [ + { + components: [ + { + internalType: "uint256", + name: "a", + type: "uint256", + }, + { + internalType: "uint256", + name: "b", + type: "uint256", + }, + ], + internalType: "struct Demo.Struct1", + name: "input1", + type: "tuple", + }, + { + components: [ + { + internalType: "uint256", + name: "a", + type: "uint256", + }, + { + internalType: "uint256", + name: "b", + type: "uint256", + }, + ], + internalType: "struct Demo.Struct2[]", + name: "input2", + type: "tuple[]", + }, + ], + stateMutability: "nonpayable", + type: "constructor", + }, +] as const; + +const _bytecode = + "0x608060405234801561001057600080fd5b506040516103313803806103318339818101604052810190610032919061018c565b50506102e4565b600061004c6100478461020d565b6101e8565b9050808382526020820190508285604086028201111561006f5761006e6102ad565b5b60005b8581101561009f57816100858882610127565b845260208401935060408301925050600181019050610072565b5050509392505050565b600082601f8301126100be576100bd6102a3565b5b81516100ce848260208601610039565b91505092915050565b6000604082840312156100ed576100ec6102a8565b5b6100f760406101e8565b9050600061010784828501610177565b600083015250602061011b84828501610177565b60208301525092915050565b60006040828403121561013d5761013c6102a8565b5b61014760406101e8565b9050600061015784828501610177565b600083015250602061016b84828501610177565b60208301525092915050565b600081519050610186816102cd565b92915050565b600080606083850312156101a3576101a26102b7565b5b60006101b1858286016100d7565b925050604083015167ffffffffffffffff8111156101d2576101d16102b2565b5b6101de858286016100a9565b9150509250929050565b60006101f2610203565b90506101fe8282610243565b919050565b6000604051905090565b600067ffffffffffffffff82111561022857610227610274565b5b602082029050602081019050919050565b6000819050919050565b61024c826102bc565b810181811067ffffffffffffffff8211171561026b5761026a610274565b5b80604052505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b6102d681610239565b81146102e157600080fd5b50565b603f806102f26000396000f3fe6080604052600080fdfea26469706673582212201d01eb5d1b5bdaa6bed6f2f157914e06e540802623813dc22be9be737413548164736f6c63430008070033"; + +type DemoConstructorParams = + | [signer?: Signer] + | ConstructorParameters; + +const isSuperArgs = ( + xs: DemoConstructorParams +): xs is ConstructorParameters => xs.length > 1; + +export class Demo__factory extends ContractFactory { + constructor(...args: DemoConstructorParams) { + if (isSuperArgs(args)) { + super(...args); + } else { + super(_abi, _bytecode, args[0]); + } + } + + override getDeployTransaction( + input1: Demo.Struct1Struct, + input2: Demo.Struct2Struct[], + overrides?: NonPayableOverrides & { from?: string } + ): Promise { + return super.getDeployTransaction(input1, input2, overrides || {}); + } + override deploy( + input1: Demo.Struct1Struct, + input2: Demo.Struct2Struct[], + overrides?: NonPayableOverrides & { from?: string } + ) { + return super.deploy(input1, input2, overrides || {}) as Promise< + Demo & { + deploymentTransaction(): ContractTransactionResponse; + } + >; + } + override connect(runner: ContractRunner | null): Demo__factory { + return super.connect(runner) as Demo__factory; + } + + static readonly bytecode = _bytecode; + static readonly abi = _abi; + static createInterface(): DemoInterface { + return new Interface(_abi) as DemoInterface; + } + static connect(address: string, runner?: ContractRunner | null): Demo { + return new Contract(address, _abi, runner) as unknown as Demo; + } +} diff --git a/packages/hardhat-test/typechain-types/factories/Directory/Hello__factory.ts b/packages/hardhat-test/typechain-types/factories/Directory/Hello__factory.ts new file mode 100644 index 000000000..98ed3733d --- /dev/null +++ b/packages/hardhat-test/typechain-types/factories/Directory/Hello__factory.ts @@ -0,0 +1,81 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import { + Contract, + ContractFactory, + ContractTransactionResponse, + Interface, +} from "ethers"; +import type { + Signer, + BigNumberish, + ContractDeployTransaction, + ContractRunner, +} from "ethers"; +import type { NonPayableOverrides } from "../../common"; +import type { Hello, HelloInterface } from "../../Directory/Hello"; + +const _abi = [ + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "nonpayable", + type: "constructor", + }, +] as const; + +const _bytecode = + "0x6080604052348015600f57600080fd5b5060405160dc38038060dc8339818101604052810190602d91906045565b506090565b600081519050603f81607c565b92915050565b60006020828403121560585760576077565b5b60006064848285016032565b91505092915050565b6000819050919050565b600080fd5b608381606d565b8114608d57600080fd5b50565b603f80609d6000396000f3fe6080604052600080fdfea2646970667358221220133f91b0425ce510af8b75336b57852d3a7de1c90943e9b26ca086eabb5334d264736f6c63430008070033"; + +type HelloConstructorParams = + | [signer?: Signer] + | ConstructorParameters; + +const isSuperArgs = ( + xs: HelloConstructorParams +): xs is ConstructorParameters => xs.length > 1; + +export class Hello__factory extends ContractFactory { + constructor(...args: HelloConstructorParams) { + if (isSuperArgs(args)) { + super(...args); + } else { + super(_abi, _bytecode, args[0]); + } + } + + override getDeployTransaction( + arg0: BigNumberish, + overrides?: NonPayableOverrides & { from?: string } + ): Promise { + return super.getDeployTransaction(arg0, overrides || {}); + } + override deploy( + arg0: BigNumberish, + overrides?: NonPayableOverrides & { from?: string } + ) { + return super.deploy(arg0, overrides || {}) as Promise< + Hello & { + deploymentTransaction(): ContractTransactionResponse; + } + >; + } + override connect(runner: ContractRunner | null): Hello__factory { + return super.connect(runner) as Hello__factory; + } + + static readonly bytecode = _bytecode; + static readonly abi = _abi; + static createInterface(): HelloInterface { + return new Interface(_abi) as HelloInterface; + } + static connect(address: string, runner?: ContractRunner | null): Hello { + return new Contract(address, _abi, runner) as unknown as Hello; + } +} diff --git a/packages/hardhat-test/typechain-types/factories/Directory/index.ts b/packages/hardhat-test/typechain-types/factories/Directory/index.ts new file mode 100644 index 000000000..c31210d08 --- /dev/null +++ b/packages/hardhat-test/typechain-types/factories/Directory/index.ts @@ -0,0 +1,4 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +export { Hello__factory } from "./Hello__factory"; diff --git a/packages/hardhat-test/typechain-types/factories/StructsInConstructor__factory.ts b/packages/hardhat-test/typechain-types/factories/StructsInConstructor__factory.ts new file mode 100644 index 000000000..863eba46a --- /dev/null +++ b/packages/hardhat-test/typechain-types/factories/StructsInConstructor__factory.ts @@ -0,0 +1,101 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import { + Contract, + ContractFactory, + ContractTransactionResponse, + Interface, +} from "ethers"; +import type { Signer, ContractDeployTransaction, ContractRunner } from "ethers"; +import type { NonPayableOverrides } from "../common"; +import type { + StructsInConstructor, + StructsInConstructorInterface, + Vector2Struct, +} from "../StructsInConstructor"; + +const _abi = [ + { + inputs: [ + { + components: [ + { + internalType: "uint256", + name: "x", + type: "uint256", + }, + { + internalType: "uint256", + name: "y", + type: "uint256", + }, + ], + internalType: "struct Vector2[2]", + name: "segment", + type: "tuple[2]", + }, + ], + stateMutability: "nonpayable", + type: "constructor", + }, +] as const; + +const _bytecode = + "0x608060405234801561001057600080fd5b5060405161029a38038061029a8339818101604052810190610032919061012f565b5061024d565b600061004b61004684610181565b61015c565b905080828560408602820111156100655761006461021b565b5b60005b85811015610095578161007b88826100ca565b845260208401935060408301925050600181019050610068565b5050509392505050565b600082601f8301126100b4576100b3610211565b5b60026100c1848285610038565b91505092915050565b6000604082840312156100e0576100df610216565b5b6100ea604061015c565b905060006100fa8482850161011a565b600083015250602061010e8482850161011a565b60208301525092915050565b60008151905061012981610236565b92915050565b60006080828403121561014557610144610220565b5b60006101538482850161009f565b91505092915050565b6000610166610177565b905061017282826101b1565b919050565b6000604051905090565b600067ffffffffffffffff82111561019c5761019b6101e2565b5b602082029050919050565b6000819050919050565b6101ba82610225565b810181811067ffffffffffffffff821117156101d9576101d86101e2565b5b80604052505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b61023f816101a7565b811461024a57600080fd5b50565b603f8061025b6000396000f3fe6080604052600080fdfea2646970667358221220ca8f8790c645fad67294067b65ba5ff0346d294dc27258dbd8582740604a13a164736f6c63430008070033"; + +type StructsInConstructorConstructorParams = + | [signer?: Signer] + | ConstructorParameters; + +const isSuperArgs = ( + xs: StructsInConstructorConstructorParams +): xs is ConstructorParameters => xs.length > 1; + +export class StructsInConstructor__factory extends ContractFactory { + constructor(...args: StructsInConstructorConstructorParams) { + if (isSuperArgs(args)) { + super(...args); + } else { + super(_abi, _bytecode, args[0]); + } + } + + override getDeployTransaction( + segment: [Vector2Struct, Vector2Struct], + overrides?: NonPayableOverrides & { from?: string } + ): Promise { + return super.getDeployTransaction(segment, overrides || {}); + } + override deploy( + segment: [Vector2Struct, Vector2Struct], + overrides?: NonPayableOverrides & { from?: string } + ) { + return super.deploy(segment, overrides || {}) as Promise< + StructsInConstructor & { + deploymentTransaction(): ContractTransactionResponse; + } + >; + } + override connect( + runner: ContractRunner | null + ): StructsInConstructor__factory { + return super.connect(runner) as StructsInConstructor__factory; + } + + static readonly bytecode = _bytecode; + static readonly abi = _abi; + static createInterface(): StructsInConstructorInterface { + return new Interface(_abi) as StructsInConstructorInterface; + } + static connect( + address: string, + runner?: ContractRunner | null + ): StructsInConstructor { + return new Contract( + address, + _abi, + runner + ) as unknown as StructsInConstructor; + } +} diff --git a/packages/hardhat-test/typechain-types/factories/index.ts b/packages/hardhat-test/typechain-types/factories/index.ts new file mode 100644 index 000000000..5c959d589 --- /dev/null +++ b/packages/hardhat-test/typechain-types/factories/index.ts @@ -0,0 +1,7 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +export * as directory from "./Directory"; +export { Counter__factory } from "./Counter__factory"; +export { Demo__factory } from "./Demo__factory"; +export { StructsInConstructor__factory } from "./StructsInConstructor__factory"; diff --git a/packages/hardhat-test/typechain-types/hardhat.d.ts b/packages/hardhat-test/typechain-types/hardhat.d.ts new file mode 100644 index 000000000..f4155a0c4 --- /dev/null +++ b/packages/hardhat-test/typechain-types/hardhat.d.ts @@ -0,0 +1,117 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import { ethers } from "ethers"; +import { + DeployContractOptions, + FactoryOptions, + HardhatEthersHelpers as HardhatEthersHelpersBase, +} from "@nomicfoundation/hardhat-ethers/types"; + +import * as Contracts from "."; + +declare module "hardhat/types/runtime" { + interface HardhatEthersHelpers extends HardhatEthersHelpersBase { + getContractFactory( + name: "Counter", + signerOrOptions?: ethers.Signer | FactoryOptions + ): Promise; + getContractFactory( + name: "Demo", + signerOrOptions?: ethers.Signer | FactoryOptions + ): Promise; + getContractFactory( + name: "Hello", + signerOrOptions?: ethers.Signer | FactoryOptions + ): Promise; + getContractFactory( + name: "StructsInConstructor", + signerOrOptions?: ethers.Signer | FactoryOptions + ): Promise; + + getContractAt( + name: "Counter", + address: string | ethers.Addressable, + signer?: ethers.Signer + ): Promise; + getContractAt( + name: "Demo", + address: string | ethers.Addressable, + signer?: ethers.Signer + ): Promise; + getContractAt( + name: "Hello", + address: string | ethers.Addressable, + signer?: ethers.Signer + ): Promise; + getContractAt( + name: "StructsInConstructor", + address: string | ethers.Addressable, + signer?: ethers.Signer + ): Promise; + + deployContract( + name: "Counter", + signerOrOptions?: ethers.Signer | DeployContractOptions + ): Promise; + deployContract( + name: "Demo", + signerOrOptions?: ethers.Signer | DeployContractOptions + ): Promise; + deployContract( + name: "Hello", + signerOrOptions?: ethers.Signer | DeployContractOptions + ): Promise; + deployContract( + name: "StructsInConstructor", + signerOrOptions?: ethers.Signer | DeployContractOptions + ): Promise; + + deployContract( + name: "Counter", + args: any[], + signerOrOptions?: ethers.Signer | DeployContractOptions + ): Promise; + deployContract( + name: "Demo", + args: any[], + signerOrOptions?: ethers.Signer | DeployContractOptions + ): Promise; + deployContract( + name: "Hello", + args: any[], + signerOrOptions?: ethers.Signer | DeployContractOptions + ): Promise; + deployContract( + name: "StructsInConstructor", + args: any[], + signerOrOptions?: ethers.Signer | DeployContractOptions + ): Promise; + + // default types + getContractFactory( + name: string, + signerOrOptions?: ethers.Signer | FactoryOptions + ): Promise; + getContractFactory( + abi: any[], + bytecode: ethers.BytesLike, + signer?: ethers.Signer + ): Promise; + getContractAt( + nameOrAbi: string | any[], + address: string | ethers.Addressable, + signer?: ethers.Signer + ): Promise; + deployContract( + name: string, + signerOrOptions?: ethers.Signer | DeployContractOptions + ): Promise; + deployContract( + name: string, + args: any[], + signerOrOptions?: ethers.Signer | DeployContractOptions + ): Promise; + } +} diff --git a/packages/hardhat-test/typechain-types/index.ts b/packages/hardhat-test/typechain-types/index.ts new file mode 100644 index 000000000..8a725f2d1 --- /dev/null +++ b/packages/hardhat-test/typechain-types/index.ts @@ -0,0 +1,14 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import type * as directory from "./Directory"; +export type { directory }; +export type { Counter } from "./Counter"; +export type { Demo } from "./Demo"; +export type { StructsInConstructor } from "./StructsInConstructor"; +export * as factories from "./factories"; +export { Counter__factory } from "./factories/Counter__factory"; +export { Demo__factory } from "./factories/Demo__factory"; +export type { Hello } from "./Directory/Hello"; +export { Hello__factory } from "./factories/Directory/Hello__factory"; +export { StructsInConstructor__factory } from "./factories/StructsInConstructor__factory";