Fixes issue #68
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import toast from "react-hot-toast";
|
import toast from "react-hot-toast";
|
||||||
import { derive } from "xrpl-accountlib";
|
import { derive, XRPL_Account } from "xrpl-accountlib";
|
||||||
|
|
||||||
import state from '../index';
|
import state from '../index';
|
||||||
import { names } from './addFaucetAccount';
|
import { names } from './addFaucetAccount';
|
||||||
@@ -12,8 +12,14 @@ export const importAccount = (secret: string) => {
|
|||||||
if (state.accounts.find((acc) => acc.secret === secret)) {
|
if (state.accounts.find((acc) => acc.secret === secret)) {
|
||||||
return toast.error("Account already added!");
|
return toast.error("Account already added!");
|
||||||
}
|
}
|
||||||
const account = derive.familySeed(secret);
|
let account: XRPL_Account | null = null;
|
||||||
if (!account.secret.familySeed) {
|
try {
|
||||||
|
account = derive.familySeed(secret);
|
||||||
|
} catch (err: any) {
|
||||||
|
toast.error(err.message)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!account || !account.secret.familySeed) {
|
||||||
return toast.error(`Couldn't create account!`);
|
return toast.error(`Couldn't create account!`);
|
||||||
}
|
}
|
||||||
state.accounts.push({
|
state.accounts.push({
|
||||||
|
|||||||
Reference in New Issue
Block a user