ethers.js
ethers.js copied to clipboard
Register a new wordlist for a browser application
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
up! @etherproject/wordlists does not export other languages except EN in wordlists constant