Compare commits

...

4 Commits
main ... main

Author SHA1 Message Date
986c9a431f Take private key from browser localstorage instead of accounts context (#16)
Some checks failed
Lint and Build / Run lint and build checks (push) Has been cancelled
Publish wallet docker image on release / Run docker build and publish (release) Successful in 5m7s
Part of https://plan.wireit.in/deepstack/browse/VUL-327/

Reviewed-on: LaconicNetwork/zenith-wallet-web#16
Co-authored-by: Shreerang Kale <shree@deepstacksoft.com>
Co-committed-by: Shreerang Kale <shree@deepstacksoft.com>
2026-02-20 11:09:04 +00:00
2bf84b2920 Use RPC URL from external app if the network already exists (#15)
All checks were successful
Lint and Build / Run lint and build checks (push) Successful in 5m13s
Publish wallet docker image on release / Run docker build and publish (release) Successful in 5m2s
Part of https://plan.wireit.in/deepstack/browse/VUL-327/

Reviewed-on: LaconicNetwork/zenith-wallet-web#15
Co-authored-by: Shreerang Kale <shree@deepstacksoft.com>
Co-committed-by: Shreerang Kale <shree@deepstacksoft.com>
2026-02-17 10:30:30 +00:00
490f4ec8a4 Update lint CI to trigger on push to main branch (#13)
Some checks failed
Lint and Build / Run lint and build checks (push) Failing after 1m36s
Co-authored-by: AdityaSalunkhe21 <adityasalunkhe2204@gmail.com>
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Co-authored-by: Shreerang Kale <shree@deepstacksoft.com>
Reviewed-on: LaconicNetwork/zenith-wallet-web#13
Co-authored-by: Pranav <jadhavpranav89@gmail.com>
Co-committed-by: Pranav <jadhavpranav89@gmail.com>
2025-12-31 06:57:59 +00:00
770f96603b Resolve warnings in react app build (#10)
All checks were successful
Publish wallet docker image on release / Run docker build and publish (release) Successful in 7m15s
Part of https://plan.wireit.in/deepstack/browse/VUL-251/

Co-authored-by: Pranav <jadhavpranav89@gmail.com>
Reviewed-on: LaconicNetwork/zenith-wallet-web#10
2025-10-07 13:42:26 +00:00
6 changed files with 79 additions and 14 deletions

View File

@ -3,17 +3,20 @@ name: Lint and Build
on:
pull_request:
branches: [ main ]
push:
branches: [ main ]
jobs:
lint-and-build:
name: Run lint and build checks
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '22'
@ -22,9 +25,9 @@ jobs:
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Run ESLint
run: yarn lint
- name: Run build
run: yarn build

View File

@ -54,5 +54,20 @@ module.exports = function override(config, env) {
config.resolve.alias['react-native$'] = require.resolve('react-native-web');
// Ignore source map warnings from third-party packages. Ref: https://github.com/facebook/create-react-app/discussions/11767#discussioncomment-3416044
const ignoreSourceMapPackages = [
'@cosmjs',
'@confio/ics23',
'@json-rpc-tools',
'@pedrouid/environment',
'@walletconnect',
'cosmjs-types',
];
config.ignoreWarnings = ignoreSourceMapPackages.map(pkg => ({
module: new RegExp(`node_modules/${pkg.replace('/', '\\/')}`),
message: /Failed to parse source map/,
}));
return config;
};

View File

@ -1,6 +1,6 @@
{
"name": "web-wallet",
"version": "0.1.7-zenith-0.2.2",
"version": "0.1.7-zenith-0.2.5",
"private": true,
"dependencies": {
"@laconic-network/cosmjs-util": "^0.1.0",

View File

@ -1,6 +1,6 @@
import { useEffect, useCallback } from "react";
import { addNewNetwork, createWallet, checkNetworkForChainID, isWalletCreated } from "../utils/accounts";
import { addNewNetwork, createWallet, checkNetworkForChainID, isWalletCreated, updateNetworkRpcUrl } from "../utils/accounts";
import { useNetworks } from "../context/NetworksContext";
import { NETWORK_ADDED_RESPONSE, NETWORK_ADD_FAILED_RESPONSE, NETWORK_ALREADY_EXISTS_RESPONSE, REQUEST_ADD_NETWORK } from "../utils/constants";
import { NetworksFormData } from "../types";
@ -52,6 +52,11 @@ const useCreateNetwork = () => {
chainId
}, sourceOrigin);
} else {
console.log("Network already exists. Updating RPC URL");
const retrievedNetworksData = await updateNetworkRpcUrl(chainId, networkData.rpcUrl);
setNetworksData(retrievedNetworksData);
sendMessage(window.parent, NETWORK_ALREADY_EXISTS_RESPONSE, {
type: NETWORK_ALREADY_EXISTS_RESPONSE,
chainId

View File

@ -1,12 +1,10 @@
import { useEffect } from 'react';
import { useAccounts } from '../context/AccountsContext';
import { retrieveNetworksData, retrieveAccounts } from '../utils/accounts';
import { getPathKey, sendMessage } from '../utils/misc';
import { ACCOUNT_PK_RESPONSE, REQUEST_ACCOUNT_PK } from '../utils/constants';
const useExportPKEmbed = () => {
const { accounts } = useAccounts();
useEffect(() => {
const handleMessage = async (event: MessageEvent) => {
const { type, chainId, address } = event.data;
@ -14,9 +12,23 @@ const useExportPKEmbed = () => {
if (type !== REQUEST_ACCOUNT_PK) return;
try {
const selectedAccount = accounts.find(account => account.address === address);
// Look up the network and accounts directly from storage
// rather than relying on the accounts context, which can be
// overwritten by HomeScreen's fetchAccounts for a different network.
const networksData = await retrieveNetworksData();
const targetNetwork = networksData.find(
net => `${net.namespace}:${net.chainId}` === chainId,
);
if (!targetNetwork) {
throw new Error("Network not found");
}
const networkAccounts = await retrieveAccounts(targetNetwork);
const selectedAccount = networkAccounts?.find(account => account.address === address);
if (!selectedAccount) {
throw new Error("Account not found")
throw new Error("Account not found");
}
const pathKey = await getPathKey(chainId, selectedAccount.index);
@ -37,7 +49,7 @@ const useExportPKEmbed = () => {
return () => {
window.removeEventListener('message', handleMessage);
};
}, [accounts]);
}, []);
};
export default useExportPKEmbed;

View File

@ -459,6 +459,35 @@ const checkNetworkForChainID = async (
return networksData.some((network) => network.chainId === chainId);
}
const updateNetworkRpcUrl = async (
chainId: string,
rpcUrl: string,
): Promise<NetworksDataState[]> => {
const networks = await getInternetCredentials('networks');
if (!networks) {
throw new Error('Networks not found');
}
const networksData: NetworksDataState[] = JSON.parse(networks);
const networkIndex = networksData.findIndex((network) => network.chainId === chainId);
if (networkIndex === -1) {
throw new Error('Network not found');
}
networksData[networkIndex].rpcUrl = rpcUrl;
await setInternetCredentials(
'networks',
'_',
JSON.stringify(networksData),
);
return networksData;
}
const isWalletCreated = async (
): Promise<boolean> => {
const mnemonicServer = await getInternetCredentials("mnemonicServer");
@ -483,5 +512,6 @@ export {
getCosmosAccountByHDPath,
addNewNetwork,
checkNetworkForChainID,
isWalletCreated
isWalletCreated,
updateNetworkRpcUrl
};