xf00f / web3x

Ethereum TypeScript Client Library - for perfect types and tiny builds.
211 stars 27 forks source link

Why does `ContractEntryDefinition` does not fit what webx-codegen outputs ? #55

Closed megaturbo closed 5 years ago

megaturbo commented 5 years ago

When I generate my contract types with web3x-codegen I end up with MyContract.ts and MyContractAbi.ts as intended.

However, in some of my MyContractAbi.ts, the ContractAbi constructor should take an array of ContractEntryDefinition. However some of my entries are set with a gas parameter, which does not fit the ContractEntryDefinition interface. See below:

export default new ContractAbi([
  ...
  {
    "name": "myFunction",
    "outputs": [],
    "inputs": [ ],
    ...
    "gas": 175875
  },
  ...
]);

Hence I got some compiler errors.

What does it depend on to set this gas parameter ? Should we add it to the ContractEntryDefinition interface as an optional parameter ?

xf00f commented 5 years ago

Interesting. Can I ask what's generating your ABI file? Do you have any idea what this gas value is meant to be used for? Is it an estimate? If you note the specification it has no mention of gas. https://solidity.readthedocs.io/en/v0.5.3/abi-spec.html#json

megaturbo commented 5 years ago

Oh you're right, and now that you say that I realized it's only my vyper contracts ABIs that shows this gas parameter.

All my ABI files are all generated by truffle, hence it should use the vyper compiler which apparently does a gas estimate

xf00f commented 5 years ago

Merged into v4.0.4.