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 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; } 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 }