[Ethereum] use ether.js with truffle

ethereum-wallet-dappethers.jsgo-ethereum

I have buid a dapp with web3, truffle and metamask, which works perfectly fine.

Now, instead of using a wallet I want to create my own wallet using ether.js, but couldn't figure out a way to use ether.js with truffle.

Is it possible, if yes, how.
Any lead will be appreciated

Best Answer

Truffle use Web3 by default and its injected inside as global dependency. You can't get rid of it, but you can install ether.js as dependency on your project.

truffle init

then you install your module

npm install --save ethers

and eventually you use it in your truffle tests

var ethers = require('ethers');

you can use the ethers library into your tests and then execute with truffle test command.

Consider that you wouldn't have the library if you use truffle develop, since only web3 would be injected.