Skip to content

Commit 691a671

Browse files
committed
faucet: use @scure/bip39
1 parent 72ddb86 commit 691a671

File tree

4 files changed

+6
-2
lines changed

4 files changed

+6
-2
lines changed

.pnp.cjs

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/faucet/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
"@cosmjs/stargate": "workspace:^",
4747
"@cosmjs/utils": "workspace:^",
4848
"@koa/cors": "^5.0",
49+
"@scure/bip39": "^2.0.1",
4950
"koa": "^2.16.1",
5051
"koa-bodyparser": "^4.3"
5152
},

packages/faucet/src/actions/generate.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { Bip39, Random } from "@cosmjs/crypto";
1+
import { generateMnemonic } from "@scure/bip39";
2+
import { wordlist } from "@scure/bip39/wordlists/english.js";
23

34
import * as constants from "../constants";
45
import { makePathBuilder } from "../pathbuilder";
@@ -11,7 +12,7 @@ export async function generate(args: readonly string[]): Promise<void> {
1112
);
1213
}
1314

14-
const mnemonic = Bip39.encode(Random.getBytes(16)).toString();
15+
const mnemonic = generateMnemonic(wordlist);
1516
console.info(`FAUCET_MNEMONIC="${mnemonic}"`);
1617

1718
const pathBuilder = makePathBuilder(constants.pathPattern);

yarn.lock

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,7 @@ __metadata:
427427
"@cosmjs/utils": "workspace:^"
428428
"@istanbuljs/nyc-config-typescript": "npm:^1.0.1"
429429
"@koa/cors": "npm:^5.0"
430+
"@scure/bip39": "npm:^2.0.1"
430431
"@types/jasmine": "npm:^4"
431432
"@types/koa": "npm:^2.15.0"
432433
"@types/koa-bodyparser": "npm:^4.3"

0 commit comments

Comments
 (0)