Check for cosmos namespace while getting cosmos accounts

This commit is contained in:
Shreerang Kale 2025-02-21 16:49:42 +05:30
parent 3363ad7a39
commit f8a7f14077
2 changed files with 4 additions and 3 deletions

View File

@ -58,7 +58,7 @@ const signCosmosMessage = async (
const networks = await retrieveNetworksData();
const currentNetwork = networks.filter(network => {
return cosmosAddress.startsWith(network.addressPrefix ?? '')
return network.namespace === COSMOS && cosmosAddress.startsWith(network.addressPrefix ?? '')
});
const cosmosAccount = await getCosmosAccounts(mnemonic, path, currentNetwork[0].addressPrefix);

View File

@ -19,6 +19,7 @@ import { Account } from '../../types';
import { getMnemonic, getPathKey } from '../misc';
import { getCosmosAccounts, retrieveNetworksData } from '../accounts';
import { COSMOS_METHODS } from './COSMOSData';
import { COSMOS } from '../constants';
interface EthSendTransaction {
type: 'eth_sendTransaction';
@ -83,10 +84,10 @@ export async function approveWalletConnectRequest(
const networks = await retrieveNetworksData();
const currentNetwork = networks.filter(network => {
return account.address.startsWith(network.addressPrefix ?? '')
return network.namespace === COSMOS && account.address.startsWith(network.addressPrefix ?? '')
});
const cosmosAccount = await getCosmosAccounts(mnemonic, path, currentNetwork[0].addressPrefix);
const cosmosAccount = await getCosmosAccounts(mnemonic, path, currentNetwork[0]?.addressPrefix);
const address = account.address;
switch (request.method) {