Skip to content

Commit

Permalink
make chain loading less offensive
Browse files Browse the repository at this point in the history
  • Loading branch information
H34D committed Feb 21, 2023
1 parent fa879d6 commit 65dc570
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/helpers/masa.ts
Expand Up @@ -37,14 +37,22 @@ export const createNewMasa = async ({
);
if (!environment) return null;

const chainId: number = await newSigner.getChainId();
let defaultNetwork = environment.defaultNetwork;

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

return new Masa({
wallet: newSigner,
apiUrl: environment.apiUrl,
defaultNetwork: getNetworkNameByChainId(chainId),
defaultNetwork,
environment: environment.environment,
arweave: {
host: arweaveConfig?.host || 'arweave.net',
Expand Down

0 comments on commit 65dc570

Please sign in to comment.