Skip to content

Commit

Permalink
feat(website): Improve behavior on adding chains and tokens (#14781)
Browse files Browse the repository at this point in the history
Co-authored-by: dave | d1onys1us <13951458+d1onys1us@users.noreply.github.com>
  • Loading branch information
2 people authored and KorbinianK committed Sep 28, 2023
1 parent 2a653a6 commit 017529d
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 14 deletions.
8 changes: 1 addition & 7 deletions packages/website/components/Button/AddTokensButton.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import {
SEPOLIA_ADD_ETHEREUM_CHAIN,
SEPOLIA_ADD_TOKENS,
SEPOLIA_CONFIG,
JOLNIR_ADD_ETHEREUM_CHAIN,
JOLNIR_ADD_TOKENS,
JOLNIR_CONFIG,
} from "../../domain/chain";
Expand All @@ -17,11 +15,7 @@ type ConnectButtonProps = {

const chainMap = {
Sepolia: SEPOLIA_CONFIG.chainId.hex,
};

const configMap = {
Sepolia: SEPOLIA_ADD_ETHEREUM_CHAIN,
Jolnir: JOLNIR_ADD_ETHEREUM_CHAIN,
Jolnir: JOLNIR_CONFIG.chainId.hex,
};

const tokenConfigMap = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {
SEPOLIA_CONFIG,
TAIKO_CONFIG,
TAIKO_ADD_ETHEREUM_CHAIN,
} from "../../domain/chain";

import { switchOrAddChain } from "../../utils/switchOrAddChain";
Expand Down Expand Up @@ -31,12 +30,6 @@ async function ConnectToMetamask(network: ConnectButtonProps["network"]) {
return;
}

let params: any;
if (network === SEPOLIA_CONFIG.names.shortName) {
params = [{ chainId: chainMap[network] }];
} else {
params = [TAIKO_ADD_ETHEREUM_CHAIN];
}
try {
await switchOrAddChain(network);
} catch (error) {
Expand Down

0 comments on commit 017529d

Please sign in to comment.