From 64d18f792d5165422966f82719f4f9a89d7140dd Mon Sep 17 00:00:00 2001 From: Kris Kaczor Date: Sun, 20 Aug 2023 22:41:36 +0400 Subject: [PATCH] [ethers-v6] Support node16 moduleSuffix in ethers-v6 target (#863) Co-authored-by: chmanie --- .changeset/moody-mayflies-marry.md | 5 + examples/ethers-v6-nodenext/README.md | 19 + examples/ethers-v6-nodenext/abi/dai.json | 277 +++++++++ examples/ethers-v6-nodenext/package.json | 23 + examples/ethers-v6-nodenext/src/index.ts | 28 + examples/ethers-v6-nodenext/tsconfig.json | 12 + .../types/ethers-contracts/Dai.ts | 543 ++++++++++++++++ .../types/ethers-contracts/common.ts | 129 ++++ .../factories/Dai__factory.ts | 580 ++++++++++++++++++ .../types/ethers-contracts/factories/index.ts | 4 + .../types/ethers-contracts/index.ts | 6 + .../target-ethers-v6/src/codegen/index.ts | 32 +- packages/target-ethers-v6/src/index.ts | 15 +- pnpm-lock.yaml | 24 +- 14 files changed, 1676 insertions(+), 21 deletions(-) create mode 100644 .changeset/moody-mayflies-marry.md create mode 100644 examples/ethers-v6-nodenext/README.md create mode 100644 examples/ethers-v6-nodenext/abi/dai.json create mode 100644 examples/ethers-v6-nodenext/package.json create mode 100644 examples/ethers-v6-nodenext/src/index.ts create mode 100644 examples/ethers-v6-nodenext/tsconfig.json create mode 100644 examples/ethers-v6-nodenext/types/ethers-contracts/Dai.ts create mode 100644 examples/ethers-v6-nodenext/types/ethers-contracts/common.ts create mode 100644 examples/ethers-v6-nodenext/types/ethers-contracts/factories/Dai__factory.ts create mode 100644 examples/ethers-v6-nodenext/types/ethers-contracts/factories/index.ts create mode 100644 examples/ethers-v6-nodenext/types/ethers-contracts/index.ts diff --git a/.changeset/moody-mayflies-marry.md b/.changeset/moody-mayflies-marry.md new file mode 100644 index 000000000..1370de44e --- /dev/null +++ b/.changeset/moody-mayflies-marry.md @@ -0,0 +1,5 @@ +--- +'@typechain/ethers-v6': minor +--- + +Add support for ESM module resolutions using the `--node16-modules` flag in the `ethers-v6` target. diff --git a/examples/ethers-v6-nodenext/README.md b/examples/ethers-v6-nodenext/README.md new file mode 100644 index 000000000..0f070cdd6 --- /dev/null +++ b/examples/ethers-v6-nodenext/README.md @@ -0,0 +1,19 @@ +# TypeChain x Ethers-v6 example + +Note: examples in this dir require building monorepo first + +```sh +# in the root of monorepo +pnpm i +pnpm build +``` + +## Running + +```sh +pnpm install # it will automatically run TypeChain types generation + +# pnpm generate-types to manually regenerate them + +pnpm start +``` diff --git a/examples/ethers-v6-nodenext/abi/dai.json b/examples/ethers-v6-nodenext/abi/dai.json new file mode 100644 index 000000000..ee0d4c48f --- /dev/null +++ b/examples/ethers-v6-nodenext/abi/dai.json @@ -0,0 +1,277 @@ +[ + + { + "inputs": [{ "internalType": "uint256", "name": "chainId_", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "src", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "guy", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "wad", "type": "uint256" } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": true, + "inputs": [ + { "indexed": true, "internalType": "bytes4", "name": "sig", "type": "bytes4" }, + { "indexed": true, "internalType": "address", "name": "usr", "type": "address" }, + { "indexed": true, "internalType": "bytes32", "name": "arg1", "type": "bytes32" }, + { "indexed": true, "internalType": "bytes32", "name": "arg2", "type": "bytes32" }, + { "indexed": false, "internalType": "bytes", "name": "data", "type": "bytes" } + ], + "name": "LogNote", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "src", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "dst", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "wad", "type": "uint256" } + ], + "name": "Transfer", + "type": "event" + }, + { + "constant": true, + "inputs": [], + "name": "DOMAIN_SEPARATOR", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "PERMIT_TYPEHASH", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { "internalType": "address", "name": "", "type": "address" }, + { "internalType": "address", "name": "", "type": "address" } + ], + "name": "allowance", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "usr", "type": "address" }, + { "internalType": "uint256", "name": "wad", "type": "uint256" } + ], + "name": "approve", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "balanceOf", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "usr", "type": "address" }, + { "internalType": "uint256", "name": "wad", "type": "uint256" } + ], + "name": "burn", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "decimals", + "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "guy", "type": "address" }], + "name": "deny", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "usr", "type": "address" }, + { "internalType": "uint256", "name": "wad", "type": "uint256" } + ], + "name": "mint", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "src", "type": "address" }, + { "internalType": "address", "name": "dst", "type": "address" }, + { "internalType": "uint256", "name": "wad", "type": "uint256" } + ], + "name": "move", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "name", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "nonces", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "holder", "type": "address" }, + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "nonce", "type": "uint256" }, + { "internalType": "uint256", "name": "expiry", "type": "uint256" }, + { "internalType": "bool", "name": "allowed", "type": "bool" }, + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "name": "permit", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "usr", "type": "address" }, + { "internalType": "uint256", "name": "wad", "type": "uint256" } + ], + "name": "pull", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "usr", "type": "address" }, + { "internalType": "uint256", "name": "wad", "type": "uint256" } + ], + "name": "push", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "guy", "type": "address" }], + "name": "rely", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "symbol", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalSupply", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "dst", "type": "address" }, + { "internalType": "uint256", "name": "wad", "type": "uint256" } + ], + "name": "transfer", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "src", "type": "address" }, + { "internalType": "address", "name": "dst", "type": "address" }, + { "internalType": "uint256", "name": "wad", "type": "uint256" } + ], + "name": "transferFrom", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "version", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "wards", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + } +] diff --git a/examples/ethers-v6-nodenext/package.json b/examples/ethers-v6-nodenext/package.json new file mode 100644 index 000000000..ddd6428e8 --- /dev/null +++ b/examples/ethers-v6-nodenext/package.json @@ -0,0 +1,23 @@ +{ + "name": "example-ethers-v6-nodenext", + "private": true, + "version": "0.0.1", + "main": "index.js", + "type": "module", + "license": "MIT", + "scripts": { + "generate-types": "typechain --target=ethers-v6 --node16-modules 'abi/*.json'", + "start": "ts-node ./src/index.ts", + "typecheck": "pnpm generate-types && tsc --noEmit" + }, + "devDependencies": { + "@typechain/ethers-v6": "workspace:^0.4.3", + "@types/bn.js": "^5.1.0", + "ts-node": "^10.7.0", + "typechain": "workspace:^8.3.1", + "typescript": "^4.7" + }, + "dependencies": { + "ethers": "^6.1.0" + } +} diff --git a/examples/ethers-v6-nodenext/src/index.ts b/examples/ethers-v6-nodenext/src/index.ts new file mode 100644 index 000000000..33334cf20 --- /dev/null +++ b/examples/ethers-v6-nodenext/src/index.ts @@ -0,0 +1,28 @@ +import { ethers } from 'ethers' + +import { Dai__factory } from '../types/ethers-contracts/factories/Dai__factory.js' + +const RPC_HOST = 'https://mainnet.infura.io/v3/6d6c70e65c77429482df5b64a4d0c943' +const DAI_ADDRESS = '0x6B175474E89094C44Da98b954EedeAC495271d0F' +const BLOCK_NUMBER = 13730326 + +async function main() { + const provider = new ethers.JsonRpcProvider(RPC_HOST) + const dai = Dai__factory.connect(DAI_ADDRESS, provider) + const balance = await dai.balanceOf('0x70b144972C5Ef6CB941A5379240B74239c418CD4') + + console.log(`Our DAI balance is: ${ethers.formatEther(balance)}`) + + console.log(`Listing Transfer events for block ${BLOCK_NUMBER}`) + const eventsFilter = dai.filters.Transfer() + const events = await dai.queryFilter(eventsFilter, BLOCK_NUMBER, BLOCK_NUMBER) + + for (const event of events) { + console.log(`${event.args.src} -> ${event.args.dst} | ${ethers.formatEther(event.args.wad)} DAI`) + } +} + +main().catch((e) => { + console.error(e) + process.exit(1) +}) diff --git a/examples/ethers-v6-nodenext/tsconfig.json b/examples/ethers-v6-nodenext/tsconfig.json new file mode 100644 index 000000000..dbab97e38 --- /dev/null +++ b/examples/ethers-v6-nodenext/tsconfig.json @@ -0,0 +1,12 @@ +{ + "compilerOptions": { + "lib": ["ES2018", "DOM"], + "module": "NodeNext", + "moduleResolution": "node16", + "strict": true, + "target": "ES2018", + "sourceMap": true, + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true + } +} diff --git a/examples/ethers-v6-nodenext/types/ethers-contracts/Dai.ts b/examples/ethers-v6-nodenext/types/ethers-contracts/Dai.ts new file mode 100644 index 000000000..00753e252 --- /dev/null +++ b/examples/ethers-v6-nodenext/types/ethers-contracts/Dai.ts @@ -0,0 +1,543 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import type { + BaseContract, + BigNumberish, + BytesLike, + FunctionFragment, + Result, + Interface, + EventFragment, + AddressLike, + ContractRunner, + ContractMethod, + Listener, +} from "ethers"; +import type { + TypedContractEvent, + TypedDeferredTopicFilter, + TypedEventLog, + TypedLogDescription, + TypedListener, + TypedContractMethod, +} from "./common.js"; + +export interface DaiInterface extends Interface { + getFunction( + nameOrSignature: + | "DOMAIN_SEPARATOR" + | "PERMIT_TYPEHASH" + | "allowance" + | "approve" + | "balanceOf" + | "burn" + | "decimals" + | "deny" + | "mint" + | "move" + | "name" + | "nonces" + | "permit" + | "pull" + | "push" + | "rely" + | "symbol" + | "totalSupply" + | "transfer" + | "transferFrom" + | "version" + | "wards" + ): FunctionFragment; + + getEvent( + nameOrSignatureOrTopic: "Approval" | "LogNote" | "Transfer" + ): EventFragment; + + encodeFunctionData( + functionFragment: "DOMAIN_SEPARATOR", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "PERMIT_TYPEHASH", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "allowance", + values: [AddressLike, AddressLike] + ): string; + encodeFunctionData( + functionFragment: "approve", + values: [AddressLike, BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "balanceOf", + values: [AddressLike] + ): string; + encodeFunctionData( + functionFragment: "burn", + values: [AddressLike, BigNumberish] + ): string; + encodeFunctionData(functionFragment: "decimals", values?: undefined): string; + encodeFunctionData(functionFragment: "deny", values: [AddressLike]): string; + encodeFunctionData( + functionFragment: "mint", + values: [AddressLike, BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "move", + values: [AddressLike, AddressLike, BigNumberish] + ): string; + encodeFunctionData(functionFragment: "name", values?: undefined): string; + encodeFunctionData(functionFragment: "nonces", values: [AddressLike]): string; + encodeFunctionData( + functionFragment: "permit", + values: [ + AddressLike, + AddressLike, + BigNumberish, + BigNumberish, + boolean, + BigNumberish, + BytesLike, + BytesLike + ] + ): string; + encodeFunctionData( + functionFragment: "pull", + values: [AddressLike, BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "push", + values: [AddressLike, BigNumberish] + ): string; + encodeFunctionData(functionFragment: "rely", values: [AddressLike]): string; + encodeFunctionData(functionFragment: "symbol", values?: undefined): string; + encodeFunctionData( + functionFragment: "totalSupply", + values?: undefined + ): string; + encodeFunctionData( + functionFragment: "transfer", + values: [AddressLike, BigNumberish] + ): string; + encodeFunctionData( + functionFragment: "transferFrom", + values: [AddressLike, AddressLike, BigNumberish] + ): string; + encodeFunctionData(functionFragment: "version", values?: undefined): string; + encodeFunctionData(functionFragment: "wards", values: [AddressLike]): string; + + decodeFunctionResult( + functionFragment: "DOMAIN_SEPARATOR", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "PERMIT_TYPEHASH", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "allowance", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "approve", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "balanceOf", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "burn", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "decimals", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "deny", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "mint", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "move", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "name", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "nonces", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "permit", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "pull", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "push", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "rely", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "symbol", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "totalSupply", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "transfer", data: BytesLike): Result; + decodeFunctionResult( + functionFragment: "transferFrom", + data: BytesLike + ): Result; + decodeFunctionResult(functionFragment: "version", data: BytesLike): Result; + decodeFunctionResult(functionFragment: "wards", data: BytesLike): Result; +} + +export namespace ApprovalEvent { + export type InputTuple = [ + src: AddressLike, + guy: AddressLike, + wad: BigNumberish + ]; + export type OutputTuple = [src: string, guy: string, wad: bigint]; + export interface OutputObject { + src: string; + guy: string; + wad: bigint; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace LogNoteEvent { + export type InputTuple = [ + sig: BytesLike, + usr: AddressLike, + arg1: BytesLike, + arg2: BytesLike, + data: BytesLike + ]; + export type OutputTuple = [ + sig: string, + usr: string, + arg1: string, + arg2: string, + data: string + ]; + export interface OutputObject { + sig: string; + usr: string; + arg1: string; + arg2: string; + data: string; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export namespace TransferEvent { + export type InputTuple = [ + src: AddressLike, + dst: AddressLike, + wad: BigNumberish + ]; + export type OutputTuple = [src: string, dst: string, wad: bigint]; + export interface OutputObject { + src: string; + dst: string; + wad: bigint; + } + export type Event = TypedContractEvent; + export type Filter = TypedDeferredTopicFilter; + export type Log = TypedEventLog; + export type LogDescription = TypedLogDescription; +} + +export interface Dai extends BaseContract { + connect(runner?: ContractRunner | null): Dai; + waitForDeployment(): Promise; + + interface: DaiInterface; + + 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; + + DOMAIN_SEPARATOR: TypedContractMethod<[], [string], "view">; + + PERMIT_TYPEHASH: TypedContractMethod<[], [string], "view">; + + allowance: TypedContractMethod< + [arg0: AddressLike, arg1: AddressLike], + [bigint], + "view" + >; + + approve: TypedContractMethod< + [usr: AddressLike, wad: BigNumberish], + [boolean], + "nonpayable" + >; + + balanceOf: TypedContractMethod<[arg0: AddressLike], [bigint], "view">; + + burn: TypedContractMethod< + [usr: AddressLike, wad: BigNumberish], + [void], + "nonpayable" + >; + + decimals: TypedContractMethod<[], [bigint], "view">; + + deny: TypedContractMethod<[guy: AddressLike], [void], "nonpayable">; + + mint: TypedContractMethod< + [usr: AddressLike, wad: BigNumberish], + [void], + "nonpayable" + >; + + move: TypedContractMethod< + [src: AddressLike, dst: AddressLike, wad: BigNumberish], + [void], + "nonpayable" + >; + + name: TypedContractMethod<[], [string], "view">; + + nonces: TypedContractMethod<[arg0: AddressLike], [bigint], "view">; + + permit: TypedContractMethod< + [ + holder: AddressLike, + spender: AddressLike, + nonce: BigNumberish, + expiry: BigNumberish, + allowed: boolean, + v: BigNumberish, + r: BytesLike, + s: BytesLike + ], + [void], + "nonpayable" + >; + + pull: TypedContractMethod< + [usr: AddressLike, wad: BigNumberish], + [void], + "nonpayable" + >; + + push: TypedContractMethod< + [usr: AddressLike, wad: BigNumberish], + [void], + "nonpayable" + >; + + rely: TypedContractMethod<[guy: AddressLike], [void], "nonpayable">; + + symbol: TypedContractMethod<[], [string], "view">; + + totalSupply: TypedContractMethod<[], [bigint], "view">; + + transfer: TypedContractMethod< + [dst: AddressLike, wad: BigNumberish], + [boolean], + "nonpayable" + >; + + transferFrom: TypedContractMethod< + [src: AddressLike, dst: AddressLike, wad: BigNumberish], + [boolean], + "nonpayable" + >; + + version: TypedContractMethod<[], [string], "view">; + + wards: TypedContractMethod<[arg0: AddressLike], [bigint], "view">; + + getFunction( + key: string | FunctionFragment + ): T; + + getFunction( + nameOrSignature: "DOMAIN_SEPARATOR" + ): TypedContractMethod<[], [string], "view">; + getFunction( + nameOrSignature: "PERMIT_TYPEHASH" + ): TypedContractMethod<[], [string], "view">; + getFunction( + nameOrSignature: "allowance" + ): TypedContractMethod< + [arg0: AddressLike, arg1: AddressLike], + [bigint], + "view" + >; + getFunction( + nameOrSignature: "approve" + ): TypedContractMethod< + [usr: AddressLike, wad: BigNumberish], + [boolean], + "nonpayable" + >; + getFunction( + nameOrSignature: "balanceOf" + ): TypedContractMethod<[arg0: AddressLike], [bigint], "view">; + getFunction( + nameOrSignature: "burn" + ): TypedContractMethod< + [usr: AddressLike, wad: BigNumberish], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "decimals" + ): TypedContractMethod<[], [bigint], "view">; + getFunction( + nameOrSignature: "deny" + ): TypedContractMethod<[guy: AddressLike], [void], "nonpayable">; + getFunction( + nameOrSignature: "mint" + ): TypedContractMethod< + [usr: AddressLike, wad: BigNumberish], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "move" + ): TypedContractMethod< + [src: AddressLike, dst: AddressLike, wad: BigNumberish], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "name" + ): TypedContractMethod<[], [string], "view">; + getFunction( + nameOrSignature: "nonces" + ): TypedContractMethod<[arg0: AddressLike], [bigint], "view">; + getFunction( + nameOrSignature: "permit" + ): TypedContractMethod< + [ + holder: AddressLike, + spender: AddressLike, + nonce: BigNumberish, + expiry: BigNumberish, + allowed: boolean, + v: BigNumberish, + r: BytesLike, + s: BytesLike + ], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "pull" + ): TypedContractMethod< + [usr: AddressLike, wad: BigNumberish], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "push" + ): TypedContractMethod< + [usr: AddressLike, wad: BigNumberish], + [void], + "nonpayable" + >; + getFunction( + nameOrSignature: "rely" + ): TypedContractMethod<[guy: AddressLike], [void], "nonpayable">; + getFunction( + nameOrSignature: "symbol" + ): TypedContractMethod<[], [string], "view">; + getFunction( + nameOrSignature: "totalSupply" + ): TypedContractMethod<[], [bigint], "view">; + getFunction( + nameOrSignature: "transfer" + ): TypedContractMethod< + [dst: AddressLike, wad: BigNumberish], + [boolean], + "nonpayable" + >; + getFunction( + nameOrSignature: "transferFrom" + ): TypedContractMethod< + [src: AddressLike, dst: AddressLike, wad: BigNumberish], + [boolean], + "nonpayable" + >; + getFunction( + nameOrSignature: "version" + ): TypedContractMethod<[], [string], "view">; + getFunction( + nameOrSignature: "wards" + ): TypedContractMethod<[arg0: AddressLike], [bigint], "view">; + + getEvent( + key: "Approval" + ): TypedContractEvent< + ApprovalEvent.InputTuple, + ApprovalEvent.OutputTuple, + ApprovalEvent.OutputObject + >; + getEvent( + key: "LogNote" + ): TypedContractEvent< + LogNoteEvent.InputTuple, + LogNoteEvent.OutputTuple, + LogNoteEvent.OutputObject + >; + getEvent( + key: "Transfer" + ): TypedContractEvent< + TransferEvent.InputTuple, + TransferEvent.OutputTuple, + TransferEvent.OutputObject + >; + + filters: { + "Approval(address,address,uint256)": TypedContractEvent< + ApprovalEvent.InputTuple, + ApprovalEvent.OutputTuple, + ApprovalEvent.OutputObject + >; + Approval: TypedContractEvent< + ApprovalEvent.InputTuple, + ApprovalEvent.OutputTuple, + ApprovalEvent.OutputObject + >; + + "LogNote(bytes4,address,bytes32,bytes32,bytes)": TypedContractEvent< + LogNoteEvent.InputTuple, + LogNoteEvent.OutputTuple, + LogNoteEvent.OutputObject + >; + LogNote: TypedContractEvent< + LogNoteEvent.InputTuple, + LogNoteEvent.OutputTuple, + LogNoteEvent.OutputObject + >; + + "Transfer(address,address,uint256)": TypedContractEvent< + TransferEvent.InputTuple, + TransferEvent.OutputTuple, + TransferEvent.OutputObject + >; + Transfer: TypedContractEvent< + TransferEvent.InputTuple, + TransferEvent.OutputTuple, + TransferEvent.OutputObject + >; + }; +} diff --git a/examples/ethers-v6-nodenext/types/ethers-contracts/common.ts b/examples/ethers-v6-nodenext/types/ethers-contracts/common.ts new file mode 100644 index 000000000..192c895b7 --- /dev/null +++ b/examples/ethers-v6-nodenext/types/ethers-contracts/common.ts @@ -0,0 +1,129 @@ +/* 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/examples/ethers-v6-nodenext/types/ethers-contracts/factories/Dai__factory.ts b/examples/ethers-v6-nodenext/types/ethers-contracts/factories/Dai__factory.ts new file mode 100644 index 000000000..625dc9959 --- /dev/null +++ b/examples/ethers-v6-nodenext/types/ethers-contracts/factories/Dai__factory.ts @@ -0,0 +1,580 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import { Contract, Interface, type ContractRunner } from "ethers"; +import type { Dai, DaiInterface } from "../Dai.js"; + +const _abi = [ + { + inputs: [ + { + internalType: "uint256", + name: "chainId_", + type: "uint256", + }, + ], + payable: false, + stateMutability: "nonpayable", + type: "constructor", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "src", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "guy", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "wad", + type: "uint256", + }, + ], + name: "Approval", + type: "event", + }, + { + anonymous: true, + inputs: [ + { + indexed: true, + internalType: "bytes4", + name: "sig", + type: "bytes4", + }, + { + indexed: true, + internalType: "address", + name: "usr", + type: "address", + }, + { + indexed: true, + internalType: "bytes32", + name: "arg1", + type: "bytes32", + }, + { + indexed: true, + internalType: "bytes32", + name: "arg2", + type: "bytes32", + }, + { + indexed: false, + internalType: "bytes", + name: "data", + type: "bytes", + }, + ], + name: "LogNote", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "src", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "dst", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "wad", + type: "uint256", + }, + ], + name: "Transfer", + type: "event", + }, + { + constant: true, + inputs: [], + name: "DOMAIN_SEPARATOR", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: true, + inputs: [], + name: "PERMIT_TYPEHASH", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32", + }, + ], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: true, + inputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + { + internalType: "address", + name: "", + type: "address", + }, + ], + name: "allowance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: false, + inputs: [ + { + internalType: "address", + name: "usr", + type: "address", + }, + { + internalType: "uint256", + name: "wad", + type: "uint256", + }, + ], + name: "approve", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: true, + inputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: false, + inputs: [ + { + internalType: "address", + name: "usr", + type: "address", + }, + { + internalType: "uint256", + name: "wad", + type: "uint256", + }, + ], + name: "burn", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: true, + inputs: [], + name: "decimals", + outputs: [ + { + internalType: "uint8", + name: "", + type: "uint8", + }, + ], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: false, + inputs: [ + { + internalType: "address", + name: "guy", + type: "address", + }, + ], + name: "deny", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: false, + inputs: [ + { + internalType: "address", + name: "usr", + type: "address", + }, + { + internalType: "uint256", + name: "wad", + type: "uint256", + }, + ], + name: "mint", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: false, + inputs: [ + { + internalType: "address", + name: "src", + type: "address", + }, + { + internalType: "address", + name: "dst", + type: "address", + }, + { + internalType: "uint256", + name: "wad", + type: "uint256", + }, + ], + name: "move", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: true, + inputs: [], + name: "name", + outputs: [ + { + internalType: "string", + name: "", + type: "string", + }, + ], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: true, + inputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + name: "nonces", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: false, + inputs: [ + { + internalType: "address", + name: "holder", + type: "address", + }, + { + internalType: "address", + name: "spender", + type: "address", + }, + { + internalType: "uint256", + name: "nonce", + type: "uint256", + }, + { + internalType: "uint256", + name: "expiry", + type: "uint256", + }, + { + internalType: "bool", + name: "allowed", + type: "bool", + }, + { + internalType: "uint8", + name: "v", + type: "uint8", + }, + { + internalType: "bytes32", + name: "r", + type: "bytes32", + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32", + }, + ], + name: "permit", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: false, + inputs: [ + { + internalType: "address", + name: "usr", + type: "address", + }, + { + internalType: "uint256", + name: "wad", + type: "uint256", + }, + ], + name: "pull", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: false, + inputs: [ + { + internalType: "address", + name: "usr", + type: "address", + }, + { + internalType: "uint256", + name: "wad", + type: "uint256", + }, + ], + name: "push", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: false, + inputs: [ + { + internalType: "address", + name: "guy", + type: "address", + }, + ], + name: "rely", + outputs: [], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: true, + inputs: [], + name: "symbol", + outputs: [ + { + internalType: "string", + name: "", + type: "string", + }, + ], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: true, + inputs: [], + name: "totalSupply", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: false, + inputs: [ + { + internalType: "address", + name: "dst", + type: "address", + }, + { + internalType: "uint256", + name: "wad", + type: "uint256", + }, + ], + name: "transfer", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: false, + inputs: [ + { + internalType: "address", + name: "src", + type: "address", + }, + { + internalType: "address", + name: "dst", + type: "address", + }, + { + internalType: "uint256", + name: "wad", + type: "uint256", + }, + ], + name: "transferFrom", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool", + }, + ], + payable: false, + stateMutability: "nonpayable", + type: "function", + }, + { + constant: true, + inputs: [], + name: "version", + outputs: [ + { + internalType: "string", + name: "", + type: "string", + }, + ], + payable: false, + stateMutability: "view", + type: "function", + }, + { + constant: true, + inputs: [ + { + internalType: "address", + name: "", + type: "address", + }, + ], + name: "wards", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + payable: false, + stateMutability: "view", + type: "function", + }, +] as const; + +export class Dai__factory { + static readonly abi = _abi; + static createInterface(): DaiInterface { + return new Interface(_abi) as DaiInterface; + } + static connect(address: string, runner?: ContractRunner | null): Dai { + return new Contract(address, _abi, runner) as unknown as Dai; + } +} diff --git a/examples/ethers-v6-nodenext/types/ethers-contracts/factories/index.ts b/examples/ethers-v6-nodenext/types/ethers-contracts/factories/index.ts new file mode 100644 index 000000000..8daa58d30 --- /dev/null +++ b/examples/ethers-v6-nodenext/types/ethers-contracts/factories/index.ts @@ -0,0 +1,4 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +export { Dai__factory } from "./Dai__factory.js"; diff --git a/examples/ethers-v6-nodenext/types/ethers-contracts/index.ts b/examples/ethers-v6-nodenext/types/ethers-contracts/index.ts new file mode 100644 index 000000000..ef12768a1 --- /dev/null +++ b/examples/ethers-v6-nodenext/types/ethers-contracts/index.ts @@ -0,0 +1,6 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +export type { Dai } from "./Dai.js"; +export * as factories from "./factories/index.js"; +export { Dai__factory } from "./factories/Dai__factory.js"; diff --git a/packages/target-ethers-v6/src/codegen/index.ts b/packages/target-ethers-v6/src/codegen/index.ts index fe9af6639..fa0ff9d16 100644 --- a/packages/target-ethers-v6/src/codegen/index.ts +++ b/packages/target-ethers-v6/src/codegen/index.ts @@ -94,9 +94,10 @@ export function codegenContractTypings(contract: Contract, codegenConfig: Codege }; }` - const commonPath = contract.path.length - ? `${new Array(contract.path.length).fill('..').join('/')}/common` - : './common' + const moduleSuffix = codegenConfig.node16Modules ? '.js' : '' + const commonPath = + (contract.path.length ? `${new Array(contract.path.length).fill('..').join('/')}/common` : './common') + + moduleSuffix const imports = createImportsForUsedIdentifiers( @@ -133,6 +134,7 @@ export function codegenContractFactory( abi: any, bytecode?: BytecodeWithLinkReferences, ): string { + const moduleSuffix = codegenConfig.node16Modules ? '.js' : '' const constructorArgs = (contract.constructor[0] ? generateInputTypes(contract.constructor[0].inputs, { useStructs: true }) : '') + `overrides?: ${ @@ -146,11 +148,11 @@ export function codegenContractFactory( const constructorArgNames = constructorArgNamesWithoutOverrides ? `${constructorArgNamesWithoutOverrides}, overrides || {}` : 'overrides || {}' - if (!bytecode) return codegenAbstractContractFactory(contract, abi) + if (!bytecode) return codegenAbstractContractFactory(contract, abi, moduleSuffix) // tsc with noUnusedLocals would complain about unused imports - const { body, header } = codegenCommonContractFactory(contract, abi) + const { body, header } = codegenCommonContractFactory(contract, abi, moduleSuffix) const source = ` ${header} @@ -181,7 +183,7 @@ export function codegenContractFactory( ${generateLibraryAddressesInterface(contract, bytecode)} ` - const commonPath = `${new Array(contract.path.length + 1).fill('..').join('/')}/common` + const commonPath = `${new Array(contract.path.length + 1).fill('..').join('/')}/common${moduleSuffix}` const imports = createImportsForUsedIdentifiers( @@ -207,8 +209,8 @@ export function codegenContractFactory( return imports + source } -export function codegenAbstractContractFactory(contract: Contract, abi: any): string { - const { body, header } = codegenCommonContractFactory(contract, abi) +export function codegenAbstractContractFactory(contract: Contract, abi: any, moduleSuffix: string): string { + const { body, header } = codegenCommonContractFactory(contract, abi, moduleSuffix) return ` import { Contract, Interface, type ContractRunner } from "ethers"; ${header} @@ -219,7 +221,11 @@ export function codegenAbstractContractFactory(contract: Contract, abi: any): st ` } -function codegenCommonContractFactory(contract: Contract, abi: any): { header: string; body: string } { +function codegenCommonContractFactory( + contract: Contract, + abi: any, + moduleSuffix: string, +): { header: string; body: string } { const imports: Set = new Set([contract.name, contract.name + 'Interface']) contract.constructor[0]?.inputs.forEach(({ type }) => { @@ -229,9 +235,11 @@ function codegenCommonContractFactory(contract: Contract, abi: any): { header: s } }) - const contractTypesImportPath = [...Array(contract.path.length + 1).fill('..'), ...contract.path, contract.name].join( - '/', - ) + const contractTypesImportPath = [ + ...Array(contract.path.length + 1).fill('..'), + ...contract.path, + contract.name + moduleSuffix, + ].join('/') const header = ` import type { ${[...imports.values()].join(', ')} } from "${contractTypesImportPath}"; diff --git a/packages/target-ethers-v6/src/index.ts b/packages/target-ethers-v6/src/index.ts index ebab15d25..c25324a3d 100644 --- a/packages/target-ethers-v6/src/index.ts +++ b/packages/target-ethers-v6/src/index.ts @@ -124,11 +124,12 @@ export default class Ethers extends TypeChainTarget { override afterRun(): FileDescription[] { // For each contract that doesn't have bytecode (it's either abstract, or only ABI was provided) // generate a simplified factory, that allows to interact with deployed contract instances. + const moduleSuffix = this.cfg.flags.node16Modules ? '.js' : '' const abstractFactoryFiles = Object.keys(this.contractsWithoutBytecode).map((contractName) => { const { contract, abi } = this.contractsWithoutBytecode[contractName]! return { path: join(this.outDirAbs, 'factories', ...contract.path, `${contract.name}${FACTORY_POSTFIX}.ts`), - contents: codegenAbstractContractFactory(contract, abi), + contents: codegenAbstractContractFactory(contract, abi, moduleSuffix), } }) @@ -143,10 +144,10 @@ export default class Ethers extends TypeChainTarget { ? { path: join(this.outDirAbs, 'hardhat.d.ts'), contents: generateHardhatHelper(allContracts) } : undefined - const typesBarrels = createBarrelFiles(this.allFiles, { typeOnly: true }) + const typesBarrels = createBarrelFiles(this.allFiles, { typeOnly: true, moduleSuffix }) const factoriesBarrels = createBarrelFiles( this.allFiles.map((s) => `factories/${s}`), - { typeOnly: false, postfix: FACTORY_POSTFIX }, + { typeOnly: false, postfix: FACTORY_POSTFIX, moduleSuffix }, ) const allBarrels = typesBarrels.concat(factoriesBarrels) @@ -154,7 +155,7 @@ export default class Ethers extends TypeChainTarget { const rootIndex = { path: join(this.outDirAbs, 'index.ts'), - contents: createRootIndexContent(rootIndexes, this.allFiles), + contents: createRootIndexContent(rootIndexes, this.allFiles, moduleSuffix), } const allFiles = compact([ @@ -173,13 +174,13 @@ export default class Ethers extends TypeChainTarget { } // root index.ts reexports also from deeper paths -function createRootIndexContent(rootIndexes: FileDescription[], paths: string[]) { +function createRootIndexContent(rootIndexes: FileDescription[], paths: string[], moduleSuffix = '') { const contracts: { path: string[]; name: string }[] = paths.map(parseContractPath) const rootReexports = uniqBy(Object.values(contracts), (c) => c.name).flatMap((c) => { const path = c.path.length === 0 ? c.name : `${c.path.join('/')}/${c.name}` return [ - `export type { ${c.name} } from './${path}';`, - `export { ${c.name}${FACTORY_POSTFIX} } from './factories/${path}${FACTORY_POSTFIX}';`, + `export type { ${c.name} } from './${path}${moduleSuffix}';`, + `export { ${c.name}${FACTORY_POSTFIX} } from './factories/${path}${FACTORY_POSTFIX}${moduleSuffix}';`, ] }) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 018552118..ddd4d5311 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -134,6 +134,28 @@ importers: specifier: ^4.7 version: 4.9.5 + examples/ethers-v6-nodenext: + dependencies: + ethers: + specifier: ^6.1.0 + version: 6.3.0 + devDependencies: + '@typechain/ethers-v6': + specifier: workspace:^0.4.3 + version: link:../../packages/target-ethers-v6 + '@types/bn.js': + specifier: ^5.1.0 + version: 5.1.0 + ts-node: + specifier: ^10.7.0 + version: 10.7.0(@types/node@18.14.0)(typescript@4.9.5) + typechain: + specifier: workspace:^8.3.1 + version: link:../../packages/typechain + typescript: + specifier: ^4.7 + version: 4.9.5 + examples/hardhat: devDependencies: '@ethersproject/abi': @@ -852,7 +874,6 @@ packages: /@adraffy/ens-normalize@1.9.0: resolution: {integrity: sha512-iowxq3U30sghZotgl4s/oJRci6WPBfNO5YYgk2cIOMCHr3LeGPcsZjCEr+33Q4N+oV3OABDAtA+pyvWjbvBifQ==} - dev: true /@apollo/protobufjs@1.2.2: resolution: {integrity: sha512-vF+zxhPiLtkwxONs6YanSt1EpwpGilThpneExUN5K3tCymuxNnVq2yojTvnpRjv2QfsEIt/n7ozPIIzBLwGIDQ==} @@ -7279,7 +7300,6 @@ packages: transitivePeerDependencies: - bufferutil - utf-8-validate - dev: true /ethjs-unit@0.1.6: resolution: {integrity: sha1-xmWSHkduh7ziqdWIpv4EBbLEFpk=}