Skip to content

Commit

Permalink
Merge pull request #65 from nabla-studio/DavideSegullo/fix-wallet_reject
Browse files Browse the repository at this point in the history
fix(store): 🐛 fix getWalletData error propagation
  • Loading branch information
DavideSegullo authored Feb 5, 2024
2 parents 4c7aa1e + 2f0a087 commit 7fba905
Showing 1 changed file with 19 additions and 23 deletions.
42 changes: 19 additions & 23 deletions packages/store/src/slices/connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,31 +64,27 @@ export const createConnectSlice: StateCreator<
const wallet = get().wallet;

if (wallet) {
try {
const accounts: AddressWithChain[] = [];
let accountName = '';

for (const chain of get().chains) {
const account = await wallet.getAccount(chain.chain_id);

if (account) {
accountName = account.name;

accounts.push({
...account,
chainId: chain.chain_id,
chainName: chain.chain_name,
});
}
}
const accounts: AddressWithChain[] = [];
let accountName = '';

set({
accountName,
accounts,
});
} catch (error) {
console.error(error);
for (const chain of get().chains) {
const account = await wallet.getAccount(chain.chain_id);

if (account) {
accountName = account.name;

accounts.push({
...account,
chainId: chain.chain_id,
chainName: chain.chain_name,
});
}
}

set({
accountName,
accounts,
});
}
},
suggestChains: async (walletName) => {
Expand Down

0 comments on commit 7fba905

Please sign in to comment.