Skip to content

Commit

Permalink
fix network loading
Browse files Browse the repository at this point in the history
  • Loading branch information
H34D committed Feb 21, 2023
1 parent 7c92a93 commit 711caf9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/helpers/masa.ts
Expand Up @@ -37,18 +37,20 @@ export const createNewMasa = async ({
);
if (!environment) return null;

let defaultNetwork = environment.defaultNetwork;
let defaultNetwork;

try {
const chainId: number = await newSigner.getChainId();
console.log({ NETWORK: chainId });
defaultNetwork = getNetworkNameByChainId(chainId);
} catch (error) {
if (error instanceof Error) {
console.warn('Getting network failed!', error.message);
console.warn('Network detection failed!', error.message);
}
}

if (!defaultNetwork) return null;

return new Masa({
wallet: newSigner,
apiUrl: environment.apiUrl,
Expand Down

0 comments on commit 711caf9

Please sign in to comment.