Add namespace for LACONIC

This commit is contained in:
IshaVenikar 2024-08-14 18:23:30 +05:30
parent e5c5d13c77
commit 49a20712f4
3 changed files with 62 additions and 2 deletions

View File

@ -22,6 +22,7 @@ import {
EMPTY_FIELD_ERROR,
INVALID_URL_ERROR,
IS_NUMBER_REGEX,
LACONIC,
} from "../utils/constants";
import { getCosmosAccounts } from "../utils/accounts";
import ETH_CHAINS from "../assets/ethereum-chains.json";
@ -162,6 +163,7 @@ const AddNetwork = () => {
break;
case COSMOS:
case LACONIC:
address = (
await getCosmosAccounts(
mnemonic,

View File

@ -3,11 +3,12 @@ import { EIP155_CHAINS } from './wallet-connect/EIP155Data';
export const EIP155 = 'eip155';
export const COSMOS = 'cosmos';
export const LACONIC = 'laconic';
export const DEFAULT_NETWORKS = [
{
chainId: 'laconic_9000-1',
networkName: 'laconicd',
namespace: COSMOS,
namespace: LACONIC,
rpcUrl: process.env.REACT_APP_LACONICD_RPC_URL!,
blockExplorerUrl: '',
nativeDenom: 'alnt',

View File

@ -8,7 +8,7 @@ import { Account, NetworksDataState } from '../../types';
import { EIP155_SIGNING_METHODS } from './EIP155Data';
import { mergeWith } from 'lodash';
import { retrieveAccounts } from '../accounts';
import { COSMOS, EIP155 } from '../constants';
import { COSMOS, EIP155, LACONIC } from '../constants';
import { NETWORK_METHODS } from './common-data';
import { COSMOS_METHODS } from './COSMOSData';
@ -131,6 +131,20 @@ export const getNamespaces = async (
],
accounts: requiredAddresses.filter(account => account.includes(COSMOS)),
},
laconic: {
chains: walletConnectChains.filter(chain => chain.includes(LACONIC)),
methods: [
...Object.values(COSMOS_METHODS),
...Object.values(NETWORK_METHODS),
...(optionalNamespaces.laconic?.methods ?? []),
...(requiredNamespaces.laconic?.methods ?? []),
],
events: [
...(optionalNamespaces.laconic?.events ?? []),
...(requiredNamespaces.laconic?.events ?? []),
],
accounts: requiredAddresses.filter(account => account.includes(LACONIC)),
},
};
return newNamespaces;
@ -161,6 +175,12 @@ export const getNamespaces = async (
events: [],
accounts: [],
},
laconic: {
chains: [],
methods: [],
events: [],
accounts: [],
},
};
case COSMOS:
return {
@ -186,6 +206,43 @@ export const getNamespaces = async (
events: [],
accounts: [],
},
laconic: {
chains: [],
methods: [],
events: [],
accounts: [],
},
};
case LACONIC:
return {
laconic: {
chains: [namespaceChainId],
methods: [
...Object.values(COSMOS_METHODS),
...Object.values(NETWORK_METHODS),
...(optionalNamespaces.laconic?.methods ?? []),
...(requiredNamespaces.laconic?.methods ?? []),
],
events: [
...(optionalNamespaces.laconic?.events ?? []),
...(requiredNamespaces.laconic?.events ?? []),
],
accounts: accounts.map(laconicAccount => {
return `${namespaceChainId}:${laconicAccount.address}`;
}),
},
eip155: {
chains: [],
methods: [],
events: [],
accounts: [],
},
cosmos: {
chains: [],
methods: [],
events: [],
accounts: [],
},
};
default:
break;