ApeWorX / ethpm-types

Implementation of EIP-2678
Apache License 2.0
14 stars 8 forks source link

json() method differs a lot from json.dumps(.dict()) #9

Closed antazoey closed 2 years ago

antazoey commented 2 years ago

Environment information

Latest everything

What went wrong?

from manifest.json():

Out[1]: '{"compilers":null,"contract_types":{"Interface":{"abi":[{"anonymous":null,"inputs":null,"name":"foo","outputs":null,"stateMutability":"nonpayable","type":"fallback"}],"deployment_bytecode":null,"devdoc":null,"name":"Interface","runtime_bytecode":null,"source_id":"Interface.json","sourcemap":null,"userdoc":null}},"dependencies":null,"deployments":null,"manifest":"ethpm/3","meta":null,"name":null,"sources":{"Interface.json":{"checksum":{"algorithm":"md5","hash":"aaf11362c066814f73d7db766ade0a0c"},"content":"[\\n    {\\"name\\":\\"foo\\",\\"type\\":\\"fallback\\", \\"stateMutability\\":\\"nonpayable\\"}\\n]\\n","installPath":null,"license":null,"type":null,"urls":[]}},"version":null}'

from json.dumps(manifest.dict()):

Out[3]: '{"manifest": "ethpm/3", "sources": {"Interface.json": {"checksum": {"algorithm": "md5", "hash": "aaf11362c066814f73d7db766ade0a0c"}, "urls": [], "content": "[\\n    {\\"name\\":\\"foo\\",\\"type\\":\\"fallback\\", \\"stateMutability\\":\\"nonpayable\\"}\\n]\\n"}}, "contractTypes": {"Interface": {"contractName": "Interface", "sourceId": "Interface.json", "abi": [{"name": "foo", "stateMutability": "nonpayable", "type": "fallback"}]}}}'

I am not sure which one is "right", but the `.json() is the one that causes errors for me.

How can it be fixed?

I am not sure.

fubuloubu commented 2 years ago

Looks like the nulls are probably the culprit