Skip to content

Commit

Permalink
Merge pull request #10 from oraichain/hotfix/wallet
Browse files Browse the repository at this point in the history
fix: connect wallet
  • Loading branch information
quangdz1704 authored Jun 8, 2024
2 parents d33750e + 7964e25 commit 08f5154
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/layouts/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ import FutureCompetition from 'components/FutureCompetitionModal';

const App = () => {
const [address, setOraiAddress] = useConfigReducer('address');
const [, setTronAddress] = useConfigReducer('tronAddress');
const [, setMetamaskAddress] = useConfigReducer('metamaskAddress');
const [, setBtcAddress] = useConfigReducer('btcAddress');
const [tronAddr, setTronAddress] = useConfigReducer('tronAddress');
const [metamaskAddr, setMetamaskAddress] = useConfigReducer('metamaskAddress');
const [btcAddr, setBtcAddress] = useConfigReducer('btcAddress');
const [, setStatusChangeAccount] = useConfigReducer('statusChangeAccount');
const loadTokenAmounts = useLoadTokens();
const [persistVersion, setPersistVersion] = useConfigReducer('persistVersion');
Expand Down Expand Up @@ -133,8 +133,10 @@ const App = () => {
}, []);

useEffect(() => {
const checkHasAddressOnStorage = address || tronAddr || metamaskAddr || btcAddr;

// just auto connect keplr in mobile mode
mobileMode && keplrHandler();
(mobileMode || checkHasAddressOnStorage) && keplrHandler();
}, [mobileMode]);

useEffect(() => {
Expand All @@ -158,6 +160,7 @@ const App = () => {

if (walletByNetworks.cosmos || mobileMode) {
oraiAddress = await window.Keplr.getKeplrAddr();

if (oraiAddress) {
const { listAddressCosmos } = await getListAddressCosmos(oraiAddress, walletByNetworks.cosmos);
setCosmosAddress(listAddressCosmos);
Expand Down

0 comments on commit 08f5154

Please sign in to comment.