Skip to content

Commit

Permalink
chain dropdown
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberhorsey committed Dec 8, 2022
1 parent ab3db35 commit 15dae69
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions packages/bridge-ui/src/components/ChainDropdown.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { _ } from "svelte-i18n";
import ChevDown from "./icons/ChevDown.svelte";
import { fromChain } from "../store/chain";
import { fromChain, toChain } from "../store/chain";
import MetaMask from "./icons/MetaMask.svelte";
import { switchEthereumChain } from "../utils/switchEthereumChain";
import { ethereum } from "../store/ethereum";
Expand All @@ -15,6 +15,12 @@
const provider = new ethers.providers.Web3Provider(window.ethereum);
await provider.send("eth_requestAccounts", []);
fromChain.set(chain);
if (chain === CHAIN_MAINNET) {
toChain.set(CHAIN_TKO);
} else {
toChain.set(CHAIN_MAINNET);
}
signer.set(provider.getSigner());
};
</script>
Expand Down Expand Up @@ -45,7 +51,7 @@
>
<svelte:component this={CHAIN_MAINNET.icon} height={24} />
<span class="pl-1.5 text-left flex-1">{CHAIN_MAINNET.name}</span>
<MetaMask />
<MetaMask />
</button>
</li>
<li>
Expand All @@ -57,7 +63,7 @@
>
<svelte:component this={CHAIN_TKO.icon} height={24} />
<span class="pl-1.5 text-left flex-1">{CHAIN_TKO.name}</span>
<MetaMask />
<MetaMask />
</button>
</li>
</ul>
Expand Down

0 comments on commit 15dae69

Please sign in to comment.