Update package version

This commit is contained in:
IshaVenikar 2025-06-06 16:02:33 +05:30
parent af63b9126c
commit 5a04bbe95f
2 changed files with 6 additions and 5 deletions

View File

@ -1,6 +1,6 @@
{
"name": "web-wallet",
"version": "0.1.6",
"version": "0.1.7",
"private": true,
"dependencies": {
"@cerc-io/registry-sdk": "^0.2.5",

View File

@ -1,6 +1,6 @@
import { useEffect, useCallback } from "react";
import { createWallet } from "../utils/accounts";
import { createWallet, isWalletCreated } from "../utils/accounts";
import { sendMessage } from "../utils/misc";
import useAccountsData from "./useAccountsData";
import { useNetworks } from "../context/NetworksContext";
@ -16,14 +16,15 @@ const useGetOrCreateAccounts = () => {
// Wrap the function in useCallback to prevent recreation on each render
const getOrCreateAccountsForChain = useCallback(async (chainId: string) => {
let accountsData = await getAccountsData(chainId);
const isCreated = await isWalletCreated();
if (accountsData.length === 0) {
if (!isCreated) {
console.log("Accounts not found, creating wallet...");
await createWallet(networksData);
accountsData = await getAccountsData(chainId);
}
const accountsData = await getAccountsData(chainId);
// Update the AccountsContext with the new accounts
setAccounts(accountsData);