Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ethers-wallet without requiring the whole ethers library #33

Closed
mattvick opened this issue Jul 20, 2017 · 4 comments
Closed

Use ethers-wallet without requiring the whole ethers library #33

mattvick opened this issue Jul 20, 2017 · 4 comments
Assignees
Labels
documentation Documentation related issue.

Comments

@mattvick
Copy link

mattvick commented Jul 20, 2017

The docs show the way to create a wallet instance as follows:

var Wallet = ethers.Wallet;

This requires including ethers as a dependency, as follows:

var ethers = require('ethers');

How can the wallet part of the library be used without requiring all parts of the library?

@ricmoo
Copy link
Member

ricmoo commented Jul 20, 2017

Heya!

You can just specify you want the ethers-wallet npm package in your package.json, which only includes the relevant Wallet code.

var ethersWallet = require('ethers-wallet');
var Wallet = ethersWallet.Wallet;

var wallet = new Wallet(privateKey);
var wallet = Wallet.fromMnemonic(mnemonic);
// .. etc ...

There is also a dist package in ethers.js/dist/ethers-wallet.min.js if you are using this in a website.

Let me know if you have any more questions.

@mattvick
Copy link
Author

Thanks @ricmoo

Is there a public repo for documentation site, so I can add these instructions there?

@ricmoo
Copy link
Member

ricmoo commented Jul 26, 2017

The documentation is contained in the ethers.js repo itself (in /docs/source).

I need to go through the documentation sometime soon and make sure it still entirely matches up with the code; a lot of ENS features have been added recently, that haven't made it into the docs.

@ricmoo ricmoo added the documentation Documentation related issue. label Oct 21, 2017
@ricmoo ricmoo self-assigned this Oct 21, 2017
@ricmoo
Copy link
Member

ricmoo commented Oct 22, 2017

Added to the documentation.

See https://docs.ethers.io/ethers.js/html/api-wallet.html

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Documentation related issue.
Projects
None yet
Development

No branches or pull requests

2 participants