Closed cygnusv closed 3 months ago
transferred this to the proper repo
@fubuloubu Any update on this issue?
I am unable to reproduce, please supply more info for reproduction steps.
Here is what I am doing:
ct = project.TestContractSol.contract_type # Using Ape but can get a ContractType anyway you want.
abi = ct.mode_dump()["abi"]
The ABI it is showing has the correct casing everywhere for internalType.
...
{'type': 'function',
'name': 'theAddress',
'stateMutability': 'view',
'inputs': [],
'outputs': [{'name': '', 'type': 'address', 'internalType': 'address'}]}]
...
It works because of this code here: https://github.com/ApeWorX/ethpm-types/blob/main/ethpm_types/base.py#L10-L15
Thanks for checking.
It seems that we are doing the following:
def _get_abi(contract_instance: ContractInstance) -> ABI:
"""Returns the ABI of a contract instance."""
contract_abi = list()
for entry in contract_instance.contract_type.abi:
contract_abi.append(entry.dict())
return contract_abi
The .dict()
call seems to now be deprecated ... 🤔 ... I guess we should be using .model_dump()
instead?
@antazoey ran some tests and that clarifies things - we caused the issue 😅 ! Thanks again for following-up. Much appreciated!
Oh yay!
Yes, dict()
is deprecated but I can make the fix apply there as well.
Thank you!
Environment
ape
and plugin versions: 0.7.7What went wrong?
We've been collecting deployment ABIs by reading
my_contract.contract_type.abi
, but we're noticing that with v0.7 there's some new elements that are different than before. Compare the output of v0.7.7:with previous versions (I think this was 0.6.19):
Two differences:
internalType
is now `internal_type``"components": null
is present for non-tuple input/output itemsMy suspicion is that there may be a better, more standard way to get the ABI for a contract you just deployed? If not, was this change intentional?