Skip to content

Commit

Permalink
fix: auto connect wallet (#292)
Browse files Browse the repository at this point in the history
  • Loading branch information
hoangdevnull authored Dec 20, 2023
1 parent 74121bb commit cf42d05
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions packages/web/src/hooks/wallet/use-wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,20 @@ export const useWallet = () => {
}
}, [setNetwork, walletAccount]);

function initSession() {
const connectedBySession = sessionId;
if (connectedBySession && walletClient === null) {
connectAdenaClient();
async function initSession() {
try {
const connectedBySession = sessionId;
if (!connectedBySession) return;

const adena = AdenaClient.createAdenaClient();
const data = await adena?.getAccount();
if (data?.status === "failure") return;

if (walletClient === null) {
connectAdenaClient();
}
} catch (err) {
console.log(err);
}
}

Expand Down

0 comments on commit cf42d05

Please sign in to comment.