From 9b4bd223b6856db632990d93e3e9fbdbb9d69866 Mon Sep 17 00:00:00 2001 From: Paco Date: Wed, 9 Aug 2023 12:06:07 +0800 Subject: [PATCH 1/3] fix: always use view overrides for statcCalls --- .../test/Payable.test.ts | 21 +++++++++++++++++++ .../target-ethers-v6-test/types/common.ts | 6 ++++-- packages/target-ethers-v6/static/common.ts | 4 ++-- 3 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 packages/target-ethers-v6-test/test/Payable.test.ts diff --git a/packages/target-ethers-v6-test/test/Payable.test.ts b/packages/target-ethers-v6-test/test/Payable.test.ts new file mode 100644 index 000000000..8b266ebf4 --- /dev/null +++ b/packages/target-ethers-v6-test/test/Payable.test.ts @@ -0,0 +1,21 @@ +import type { AssertTrue, IsExact } from 'test-utils' + +import type { Payable } from '../types' +import type { PostfixOverrides } from '../types/common' +import { createNewBlockchain } from './common' + +describe('Payable', () => { + const chain = createNewBlockchain('Payable') + + it('generate view override parameter types for staticCall', async () => { + type InputType = Parameters + // eslint-disable-next-line @typescript-eslint/no-unused-vars + type _t1 = AssertTrue>> + }) + + it('generate view override parameter types for staticCallResult', async () => { + type InputType = Parameters + // eslint-disable-next-line @typescript-eslint/no-unused-vars + type _t1 = AssertTrue>> + }) +}) diff --git a/packages/target-ethers-v6-test/types/common.ts b/packages/target-ethers-v6-test/types/common.ts index 192c895b7..56b5f21e9 100644 --- a/packages/target-ethers-v6-test/types/common.ts +++ b/packages/target-ethers-v6-test/types/common.ts @@ -122,8 +122,10 @@ export interface TypedContractMethod< populateTransaction( ...args: ContractMethodArgs ): Promise; - staticCall(...args: ContractMethodArgs): Promise>; + staticCall( + ...args: ContractMethodArgs + ): Promise>; send(...args: ContractMethodArgs): Promise; estimateGas(...args: ContractMethodArgs): Promise; - staticCallResult(...args: ContractMethodArgs): Promise; + staticCallResult(...args: ContractMethodArgs): Promise; } diff --git a/packages/target-ethers-v6/static/common.ts b/packages/target-ethers-v6/static/common.ts index 1da52a3d4..aa03edaef 100644 --- a/packages/target-ethers-v6/static/common.ts +++ b/packages/target-ethers-v6/static/common.ts @@ -82,8 +82,8 @@ export interface TypedContractMethod< getFragment(...args: ContractMethodArgs): FunctionFragment populateTransaction(...args: ContractMethodArgs): Promise - staticCall(...args: ContractMethodArgs): Promise> + staticCall(...args: ContractMethodArgs): Promise> send(...args: ContractMethodArgs): Promise estimateGas(...args: ContractMethodArgs): Promise - staticCallResult(...args: ContractMethodArgs): Promise + staticCallResult(...args: ContractMethodArgs): Promise } From 6bfe2d752ec168ad1403953aca94ea028af6d60d Mon Sep 17 00:00:00 2001 From: Paco Date: Wed, 9 Aug 2023 12:23:10 +0800 Subject: [PATCH 2/3] Create changeset --- .changeset/moody-lamps-mix.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/moody-lamps-mix.md diff --git a/.changeset/moody-lamps-mix.md b/.changeset/moody-lamps-mix.md new file mode 100644 index 000000000..b3dff33bd --- /dev/null +++ b/.changeset/moody-lamps-mix.md @@ -0,0 +1,5 @@ +--- +"@typechain/ethers-v6": patch +--- + +fix: always use view overrides for statcCalls From bcc40983a26d2fe2eb0b0d1cb68915360ca6fb6c Mon Sep 17 00:00:00 2001 From: Krzysztof Kaczor Date: Sun, 20 Aug 2023 21:58:12 +0200 Subject: [PATCH 3/3] Regenerate files --- .../ethers-v6-nodenext/types/ethers-contracts/common.ts | 6 ++++-- examples/ethers-v6/types/ethers-contracts/common.ts | 6 ++++-- packages/hardhat-test/typechain-types/common.ts | 6 ++++-- .../hardhat-project/typechain-types/common.ts | 6 ++++-- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/examples/ethers-v6-nodenext/types/ethers-contracts/common.ts b/examples/ethers-v6-nodenext/types/ethers-contracts/common.ts index 192c895b7..56b5f21e9 100644 --- a/examples/ethers-v6-nodenext/types/ethers-contracts/common.ts +++ b/examples/ethers-v6-nodenext/types/ethers-contracts/common.ts @@ -122,8 +122,10 @@ export interface TypedContractMethod< populateTransaction( ...args: ContractMethodArgs ): Promise; - staticCall(...args: ContractMethodArgs): Promise>; + staticCall( + ...args: ContractMethodArgs + ): Promise>; send(...args: ContractMethodArgs): Promise; estimateGas(...args: ContractMethodArgs): Promise; - staticCallResult(...args: ContractMethodArgs): Promise; + staticCallResult(...args: ContractMethodArgs): Promise; } diff --git a/examples/ethers-v6/types/ethers-contracts/common.ts b/examples/ethers-v6/types/ethers-contracts/common.ts index 192c895b7..56b5f21e9 100644 --- a/examples/ethers-v6/types/ethers-contracts/common.ts +++ b/examples/ethers-v6/types/ethers-contracts/common.ts @@ -122,8 +122,10 @@ export interface TypedContractMethod< populateTransaction( ...args: ContractMethodArgs ): Promise; - staticCall(...args: ContractMethodArgs): Promise>; + staticCall( + ...args: ContractMethodArgs + ): Promise>; send(...args: ContractMethodArgs): Promise; estimateGas(...args: ContractMethodArgs): Promise; - staticCallResult(...args: ContractMethodArgs): Promise; + staticCallResult(...args: ContractMethodArgs): Promise; } diff --git a/packages/hardhat-test/typechain-types/common.ts b/packages/hardhat-test/typechain-types/common.ts index 192c895b7..56b5f21e9 100644 --- a/packages/hardhat-test/typechain-types/common.ts +++ b/packages/hardhat-test/typechain-types/common.ts @@ -122,8 +122,10 @@ export interface TypedContractMethod< populateTransaction( ...args: ContractMethodArgs ): Promise; - staticCall(...args: ContractMethodArgs): Promise>; + staticCall( + ...args: ContractMethodArgs + ): Promise>; send(...args: ContractMethodArgs): Promise; estimateGas(...args: ContractMethodArgs): Promise; - staticCallResult(...args: ContractMethodArgs): Promise; + staticCallResult(...args: ContractMethodArgs): Promise; } diff --git a/packages/hardhat/test/fixture-projects/hardhat-project/typechain-types/common.ts b/packages/hardhat/test/fixture-projects/hardhat-project/typechain-types/common.ts index 192c895b7..56b5f21e9 100644 --- a/packages/hardhat/test/fixture-projects/hardhat-project/typechain-types/common.ts +++ b/packages/hardhat/test/fixture-projects/hardhat-project/typechain-types/common.ts @@ -122,8 +122,10 @@ export interface TypedContractMethod< populateTransaction( ...args: ContractMethodArgs ): Promise; - staticCall(...args: ContractMethodArgs): Promise>; + staticCall( + ...args: ContractMethodArgs + ): Promise>; send(...args: ContractMethodArgs): Promise; estimateGas(...args: ContractMethodArgs): Promise; - staticCallResult(...args: ContractMethodArgs): Promise; + staticCallResult(...args: ContractMethodArgs): Promise; }