From 75df51b7804c3d277ac3142d6eed13e17afd514c Mon Sep 17 00:00:00 2001 From: Shreerang Kale Date: Thu, 5 Jun 2025 13:51:48 +0530 Subject: [PATCH] Rename methods --- src/components/Accounts.tsx | 2 +- src/hooks/useAddAccountEmbed.ts | 2 +- src/screens/AddNetwork.tsx | 4 ++-- src/utils/accounts.ts | 8 ++++---- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/components/Accounts.tsx b/src/components/Accounts.tsx index ee7eb44..f1de0e6 100644 --- a/src/components/Accounts.tsx +++ b/src/components/Accounts.tsx @@ -85,7 +85,7 @@ const Accounts = () => { const addAccountHandler = async () => { setIsAccountCreating(true); - const newAccount = await addAccount(selectedNetwork!); + const newAccount = await addAccount(selectedNetwork!.chainId); setIsAccountCreating(false); if (newAccount) { updateAccounts(newAccount); diff --git a/src/hooks/useAddAccountEmbed.ts b/src/hooks/useAddAccountEmbed.ts index 1182a90..b64aa86 100644 --- a/src/hooks/useAddAccountEmbed.ts +++ b/src/hooks/useAddAccountEmbed.ts @@ -16,7 +16,7 @@ const useAddAccountEmbed = () => { const { getAccountsData } = useAccountsData(); const addAccountHandler = useCallback(async (network: NetworksDataState) => { - const newAccount = await addAccount(network); + const newAccount = await addAccount(network.chainId); if (newAccount) { setAccounts(prev => [...prev, newAccount]); setCurrentIndex(newAccount.index); diff --git a/src/screens/AddNetwork.tsx b/src/screens/AddNetwork.tsx index 7f804ed..b91eff5 100644 --- a/src/screens/AddNetwork.tsx +++ b/src/screens/AddNetwork.tsx @@ -13,7 +13,7 @@ import { zodResolver } from "@hookform/resolvers/zod"; import { StackParamsList } from "../types"; import { SelectNetworkType } from "../components/SelectNetworkType"; -import { addAccountsForANetwork, getNextAccountId, storeNetworkData } from "../utils/accounts"; +import { addAccountsForNetwork, getNextAccountId, storeNetworkData } from "../utils/accounts"; import { useNetworks } from "../context/NetworksContext"; import { COSMOS, @@ -208,7 +208,7 @@ const AddNetwork = () => { ), ]); - await addAccountsForANetwork(selectedNetwork!, currentNumberOfAccounts - 1); + await addAccountsForNetwork(selectedNetwork!, currentNumberOfAccounts - 1); navigation.navigate("Home"); }, diff --git a/src/utils/accounts.ts b/src/utils/accounts.ts index abeadcb..b65e63d 100644 --- a/src/utils/accounts.ts +++ b/src/utils/accounts.ts @@ -87,7 +87,7 @@ const createWalletFromMnemonic = async ( }; const addAccount = async ( - selectedNetwork: NetworksDataState, + chainId: string, ): Promise => { try { let selectedNetworkAccount @@ -101,7 +101,7 @@ const addAccount = async ( const account = await addAccountFromHDPath(hdPath, network); await updateAccountCounter(namespaceChainId, id); - if (network.networkId === selectedNetwork.networkId) { + if (network.chainId === chainId) { selectedNetworkAccount = account; } } @@ -112,7 +112,7 @@ const addAccount = async ( } }; -const addAccountsForANetwork = async ( +const addAccountsForNetwork = async ( network: NetworksDataState, numberOfAccounts: number, ): Promise => { @@ -372,7 +372,7 @@ export { createWallet, addAccount, addAccountFromHDPath, - addAccountsForANetwork, + addAccountsForNetwork, storeNetworkData, retrieveNetworksData, retrieveAccounts,