Skip to content

Commit

Permalink
[skip ci] feat: possibility to pass 0 as networkId (temporary for loc…
Browse files Browse the repository at this point in the history
…al-node)
  • Loading branch information
R committed May 20, 2023
1 parent 3151ddf commit 58d3dab
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/VenomConnect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,14 @@ let oldRoot: Root | undefined = undefined;

const _getDefaultVenomNetworkNameById = (networkId: number) => {
switch (networkId) {
case 0:
return "Venom Local Node";
case 1000:
return "Venom Testnet";
case 1:
default:
return "Venom Mainnet";

}
};

Expand Down Expand Up @@ -83,7 +86,7 @@ class VenomConnect {
this.themeConfig = getThemeConfig(theme);

const checkNetworkId =
options.checkNetworkId || defaultOptions.checkNetworkId;
options.checkNetworkId === undefined ? defaultOptions.checkNetworkId : options.checkNetworkId;
this.checkNetworkId = checkNetworkId;

const checkNetworkName =
Expand Down
3 changes: 1 addition & 2 deletions src/providers/connectors/networkIdTimerUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const setupNetworkIdTimer = (
const state = await provider?.getProviderState?.();
// если есть белый список, то чекаем, иначе можно всем
let isAllowedId = true;
if (allowedNetworkIds) {
if (allowedNetworkIds !== undefined) {
if (Array.isArray(allowedNetworkIds)) {
isAllowedId = !!allowedNetworkIds.find(
(id) => state.networkId === id
Expand All @@ -20,7 +20,6 @@ export const setupNetworkIdTimer = (
isAllowedId = state.networkId === allowedNetworkIds;
}
}

const isAuth = !!state?.permissions?.accountInteraction?.address;

// console.log('TESING NET', allowedNetworkIds, state)
Expand Down

0 comments on commit 58d3dab

Please sign in to comment.