You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Disclaimer: I'm new to viem (comming from ethers.js), and that is my first type working with the viem typescript types.
I am trying to build functions that operate on "contracts object" that implement interfaces. I'm then calling these functions with "contract objects" that are actual implementation of the interfaces.
For example, lets consider the following solidity code
interfaceMyInterface {
function executeMessage(stringcalldatainput) externalpayablereturns (bytes4);
}
contractMyContractisMyInterface {
function executeMessage(stringcalldatainput) externalpayablereturns (bytes4) { return MyInterface.executeMessage.selector; }
}
Everything works fine, except I have a solidity warning Warning: Unused function parameter. Remove or comment out the variable name to silence this warning.
So I decide to update my solidity code to
contract MyContract is MyInterface {
- function executeMessage(string calldata input) external payable returns (bytes4) { return MyInterface.executeMessage.selector; }+ function executeMessage(string calldata) external payable returns (bytes4) { return MyInterface.executeMessage.selector; }
}
And that is when things start to break!
All of the sudden, I get a typescript error telling me that the types are incompatible. I guess that is because the ABI is not the same for the executeMessage function. In one case it has a named input, and in the other case it doesn't.
I'm getting errors about "legacy" and "eip7702" types being different. Not sure what tx envelops have to do with this, but it really isn't great.
In practice, compatible ABI are often implemented with minor changes to in args name. That doesn't break compatibility, and it should honestly no affect type resolution here.
The text was updated successfully, but these errors were encountered:
Note: I'm not sure weither that is a Hardhat-viem issue (comming from how the ABI are extracted from artefacts) or a viem issue (comming from how contracts are typed).
Feedback
Disclaimer: I'm new to viem (comming from ethers.js), and that is my first type working with the viem typescript types.
I am trying to build functions that operate on "contracts object" that implement interfaces. I'm then calling these functions with "contract objects" that are actual implementation of the interfaces.
For example, lets consider the following solidity code
and the test code
Everything works fine, except I have a solidity warning
Warning: Unused function parameter. Remove or comment out the variable name to silence this warning.
So I decide to update my solidity code to
And that is when things start to break!
All of the sudden, I get a typescript error telling me that the types are incompatible. I guess that is because the ABI is not the same for the executeMessage function. In one case it has a named input, and in the other case it doesn't.
I'm getting errors about "legacy" and "eip7702" types being different. Not sure what tx envelops have to do with this, but it really isn't great.
In practice, compatible ABI are often implemented with minor changes to in args name. That doesn't break compatibility, and it should honestly no affect type resolution here.
The text was updated successfully, but these errors were encountered: