LDKForm.tsx raw

   1  import { wordlist } from "@scure/bip39/wordlists/english.js";
   2  import { useEffect } from "react";
   3  import { useNavigate, useSearchParams } from "react-router";
   4  import useSetupStore from "src/state/SetupStore";
   5  
   6  import * as bip39 from "@scure/bip39";
   7  import Loading from "src/components/Loading";
   8  
   9  export function LDKForm() {
  10    const navigate = useNavigate();
  11    const [searchParams] = useSearchParams();
  12  
  13    // No configuration needed, automatically proceed with the next step
  14    useEffect(() => {
  15      // only generate a mnemonic if one is not already imported
  16      if (!useSetupStore.getState().nodeInfo.mnemonic) {
  17        useSetupStore.getState().updateNodeInfo({
  18          mnemonic: bip39.generateMnemonic(wordlist, 128),
  19        });
  20      }
  21      useSetupStore.getState().updateNodeInfo({
  22        backendType: "LDK",
  23      });
  24      navigate("/setup/security", {
  25        replace: true,
  26      });
  27    }, [navigate, searchParams]);
  28  
  29    return (
  30      <>
  31        <title>Loading... ยท Alby Hub</title>
  32        <Loading />
  33      </>
  34    );
  35  }
  36