diff --git a/packages/faucet/src/actions/generate.ts b/packages/faucet/src/actions/generate.ts index 48a16450..2e5f9b49 100644 --- a/packages/faucet/src/actions/generate.ts +++ b/packages/faucet/src/actions/generate.ts @@ -2,7 +2,7 @@ import { ChainId } from "@iov/bcp"; import { Bip39, Random } from "@iov/crypto"; import * as constants from "../constants"; -import { setSecretAndCreateIdentities } from "../profile"; +import { createUserProfile } from "../profile"; export async function generate(args: ReadonlyArray): Promise { if (args.length < 1) { @@ -17,5 +17,5 @@ export async function generate(args: ReadonlyArray): Promise { console.info(`FAUCET_MNEMONIC="${mnemonic}"`); // Log the addresses - await setSecretAndCreateIdentities(mnemonic, chainId); + await createUserProfile(mnemonic, chainId, constants.concurrency, true); } diff --git a/packages/faucet/src/actions/start/start.ts b/packages/faucet/src/actions/start/start.ts index 77548ca8..0e96c9a2 100644 --- a/packages/faucet/src/actions/start/start.ts +++ b/packages/faucet/src/actions/start/start.ts @@ -8,7 +8,7 @@ import * as constants from "../../constants"; import { logAccountsState } from "../../debugging"; import { Faucet } from "../../faucet"; import { availableTokensFromHolder } from "../../multichainhelpers"; -import { setSecretAndCreateIdentities } from "../../profile"; +import { createUserProfile } from "../../profile"; import { HttpError } from "./httperror"; import { RequestParser } from "./requestparser"; @@ -32,7 +32,12 @@ export async function start(args: ReadonlyArray): Promise { // Profile if (!constants.mnemonic) throw new Error("The FAUCET_MNEMONIC environment variable is not set"); - const profile = await setSecretAndCreateIdentities(constants.mnemonic, connection.chainId()); + const [profile] = await createUserProfile( + constants.mnemonic, + connection.chainId(), + constants.concurrency, + true, + ); // Faucet const faucet = new Faucet(constants.tokenConfig, connection, connector.codec, profile, true); diff --git a/packages/faucet/src/profile.ts b/packages/faucet/src/profile.ts index c7e28ddb..ec540e01 100644 --- a/packages/faucet/src/profile.ts +++ b/packages/faucet/src/profile.ts @@ -2,7 +2,6 @@ import { ChainId, Identity } from "@iov/bcp"; import { HdPaths, Secp256k1HdWallet, UserProfile } from "@iov/keycontrol"; import { identityToAddress } from "./addresses"; -import * as constants from "./constants"; import { debugPath } from "./hdpaths"; export async function createUserProfile( @@ -29,7 +28,3 @@ export async function createUserProfile( } return [profile, identities]; } - -export async function setSecretAndCreateIdentities(mnemonic: string, chainId: ChainId): Promise { - return (await createUserProfile(mnemonic, chainId, constants.concurrency, true))[0]; -}