Problem with using ethers.js source in other project #3256
Replies: 1 comment 2 replies
-
If you have made changes to I totally get this is complicated, I myself have been in that boat. I'd suggest you another route which I settle in, if all you want is to tweak how ethers work. Ethers is cool, particularly in this context where most functionality can be easily overridden. And this can enable application specific changes possible without maintaining ethers fork, i.e. lets say ethers fixes a bug or new feature added, no headache to update fork, just install latest ethers in your project. // create this module in your project
export class WalletCustom extends Wallet {
// lets say you wanna add another method
myFoo() {
// logic
}
async signTransaction(tx) {
// add any logic you'd want to
const result = await super.signTransaction(tx);
console.log('sign result', result);
return result;
}
}
// in other files
import { WalletCustom } from '../utils/ethers-extended';
const wallet = new WalletCustom('...')
wallet.myFoo() // works!
await contract.connect(wallet).transfer('0xFriend', 1234); // this will use the overriden signTransaction method |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi guys!,
let's say we change the ethers.js wallet package like this:

I'm adding a little my_foo() method like in the picture and run:
npm i && npm run auto-build
I have a project dir like that:
/project_dir/ethers.js
/project_dir/my_project
then I run
npm pack ethers
in the ethers.js dir and everything is packed nicely to a zipped file. then I go to the other my_project dir and runnpm install ../ethers.js/zip_file
when I check the node_modules dir under my_project/node_modules/@etherproject/wallet I cant find my_foo() method.
so basically if I have a local package how can I change that package and see the changes in another project?
Beta Was this translation helpful? Give feedback.
All reactions