1

This question already has an answer here:

I prefer the ethers.js library to web3. Is there a way to configure truffle test to use ethers.js instead of web3?

Thanks!

marked as duplicate by ivicaa, shane, Richard Horrocks, Achala Dissanayake, Ismael Jan 25 at 15:55

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

0

Not just what you're asking, but may help. I am using etherlime - it's a framework based on ethers.js. There is a guide how to configure your project from truffle to etherlime and it includes a section for test migration. Hopes it would help - https://etherlime.readthedocs.io/en/latest/migration-from-truffle-guide.html.

Actually, I have wrote some tests using ethers.js but it is a little bit annoying when you need to change the signer(msg.sender) for some function execution. You have to connect a wallet to a contract every time you needed to use different sender.

0

You should be able to use Truffle's web3 instance, and extract the provider to use it with ethers.js.

let web3Provider = new ethers.providers.Web3Provider(web3.currentProvider, network);

Not the answer you're looking for? Browse other questions tagged or ask your own question.