-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
style: refinements around loader indicator
- Loading branch information
Showing
6 changed files
with
25 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,18 @@ | ||
import { ethers } from "ethers"; | ||
import { getNetworkName } from "../constants"; | ||
import { toaster } from "../toaster"; | ||
import { buttonController, toaster } from "../toaster"; | ||
import { switchNetwork } from "./switch-network"; | ||
|
||
export function notOnCorrectNetwork(currentNetworkId: number, desiredNetworkId: number, web3provider: ethers.providers.Web3Provider) { | ||
if (currentNetworkId !== desiredNetworkId) { | ||
if (desiredNetworkId == void 0) { | ||
console.error(`You must pass in an EVM network ID in the URL query parameters using the key 'network' e.g. '?network=1'`); | ||
} | ||
const networkName = getNetworkName(desiredNetworkId); | ||
if (!networkName) { | ||
toaster.create("error", `This dApp currently does not support payouts for network ID ${desiredNetworkId}`); | ||
} | ||
switchNetwork(web3provider, desiredNetworkId).catch((error) => { | ||
console.error(error); | ||
toaster.create("error", `Please switch to the ${networkName} network to claim this reward.`); | ||
buttonController.hideAll(); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters