Few cleanups to code

This commit is contained in:
Valtteri Karesto
2021-12-13 23:02:03 +02:00
parent 380e196db2
commit 35bc89cf99
3 changed files with 16 additions and 17 deletions

View File

@@ -1,17 +1,18 @@
import toast from "react-hot-toast";
import { useSnapshot } from "valtio";
import { ArrowSquareOut, Copy, Wallet, X } from "phosphor-react";
import React, { useEffect, useState } from "react";
import Dinero from "dinero.js";
import Button from "./Button";
import { addFaucetAccount, deployHook, importAccount } from "../state/actions";
import state from "../state";
import Box from "./Box";
import Container from "./Container";
import Heading from "./Heading";
import { ArrowSquareOut, Copy, Wallet, X } from "phosphor-react";
import Stack from "./Stack";
import Text from "./Text";
import Flex from "./Flex";
import { useSnapshot } from "valtio";
import React, { useEffect, useState } from "react";
import Dinero from "dinero.js";
import {
Dialog,
DialogContent,

View File

@@ -57,3 +57,13 @@ export const addFaucetAccount = async (showToast: boolean = false) => {
});
}
};
// fetch initial faucets
(async function fetchFaucets() {
if (state.accounts.length < 2) {
await addFaucetAccount();
setTimeout(() => {
addFaucetAccount();
}, 10000);
}
})();

View File

@@ -2,7 +2,6 @@ import { proxy, ref, subscribe } from "valtio";
import { devtools } from 'valtio/utils'
import type monaco from "monaco-editor";
import { XrplClient } from "xrpl-client";
import { addFaucetAccount } from "./actions/addFaucetAccount";
export interface IFile {
name: string;
@@ -116,17 +115,6 @@ client.on("offline", () => {
state.clientStatus = "offline";
});
// fetch initial faucets
(async function fetchFaucets() {
if (state.accounts.length < 2) {
await addFaucetAccount();
setTimeout(() => {
addFaucetAccount();
}, 10000);
}
})();
if (process.env.NODE_ENV !== "production") {
devtools(state, "Files State");
}