ethers-io / ethers.js

Complete Ethereum library and wallet implementation in JavaScript.
https://ethers.org/
MIT License
7.85k stars 1.82k forks source link

Register a new wordlist for a browser application #3418

Open vrde opened 1 year ago

vrde commented 1 year ago

Ethers Version

5.7.0

Search Terms

wordlist

Describe the Problem

I'm using ethers.js in the browser. I tried to register new wordlists following the documentation.

I installed @ethersproject/wordlists, version 5.7.0, and I tried something like

import { ethers } from "ethers";
import { langEs as es } from "@ethersproject/wordlists";
ethers.Wordlist.register(es);

But it didn't work, printing ethers.wordlists didn't show es but just en.

I ended up doing this:

import { ethers } from "ethers";

import { langEs as es } from "@ethersproject/wordlists/lib/lang-es";
import {
  langZhCn as zh_cn,
  langZhTw as zh_tw,
} from "@ethersproject/wordlists/lib/lang-zh";

ethers.wordlists.es = es;
ethers.wordlists.zh = zh_cn;
ethers.wordlists.zh_cn = zh_cn;
ethers.wordlists.zh_tw = zh_tw;

Code Snippet

No response

Contract ABI

No response

Errors

No response

Environment

Ethereum (mainnet/ropsten/rinkeby/goerli)

Environment (Other)

No response

ko1ebayev commented 2 months ago

up! @etherproject/wordlists does not export other languages except EN in wordlists constant