question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[ethers] Expose ABI in generated code

See original GitHub issue

I’m using deployMockContract from @ethereum-waffle/mock-contract and it requires an ABI for it to be called. Typechain currently doesn’t expose this but the abi constant is in the generated factory file.

Can there be a configuration option to expose the ABI?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
krzkaczorcommented, Mar 20, 2021

How about adding the data as abi and bytecode static readonly properties of the factory class? IMO it feels better than exporting very generic names like abi or bytecode from each factory file.

Yes I think the only way to make this useful is to expose it as part of the factory class (not module).

I am fine with this change. The only problem that I see is that hardhat users confuse these factories often with factories from hardhat (and we diverge these interfaces even more) but I am planning to address it in a separate ticket (https://github.com/ethereum-ts/TypeChain/issues/359).

1reaction
quezakcommented, Mar 17, 2021

I agree that this would be useful in some cases. I actually used to import the json files too, before the factory classes were added to the ethers target here. @krzkaczor what do you think?

How about adding the data as abi and bytecode static readonly properties of the factory class? IMO it feels better than exporting very generic names like abi or bytecode from each factory file.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[ethers] Expose ABI in generated code · Issue #344 - GitHub
I'm using deployMockContract from @ethereum-waffle/mock-contract and it requires an ABI for it to be called. Typechain currently doesn't ...
Read more >
Documentation - Ethers.js
An ABI often comes from the Solidity or Vyper compiler, but you can use the Human-Readable ABI in code, which the following examples...
Read more >
Contracts — ethers.io 0.0.1 documentation
The Contract API simplifies interacting with a Contract by exposing it as a normal JavaScript object as specified by the Contract ABI.
Read more >
ethereum-abi-types-generator - npm
Generate types from an ethereum ABI json file. ... Contract code to an ContractContext which is exposed in where you defined the --output...
Read more >
Getting started with some Ethereum concepts and interfacing ...
The only additional package we will use for now is ethers.js, ... But not every contract will have its source code exposed here....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found