From e893d07d3868c9183055e024dfc495a3e655cf60 Mon Sep 17 00:00:00 2001 From: OjusWiZard Date: Sat, 7 Oct 2023 23:55:16 +0530 Subject: [PATCH 1/2] fix: network adding to metamask if not exist Signed-off-by: OjusWiZard --- packages/shared/src/index.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/shared/src/index.tsx b/packages/shared/src/index.tsx index 27c50df0..1c07351f 100644 --- a/packages/shared/src/index.tsx +++ b/packages/shared/src/index.tsx @@ -96,7 +96,7 @@ export const chainInfos: Record = { }, }; -export const addEthereumChain = ( +export const addEthereumChain = async ( chain: string | number, library?: providers.Web3Provider ) => { @@ -108,16 +108,16 @@ export const addEthereumChain = ( // first attempt to switch to that chain try { - return library.send("wallet_switchEthereumChain", [ + return await library.send("wallet_switchEthereumChain", [ { chainId: utils.hexValue(chainId) }, ]); - } catch {} + } catch { } if (!rpcUrls || rpcUrls.length === 0) { return null; } - return library.send("wallet_addEthereumChain", [ + return await library.send("wallet_addEthereumChain", [ { chainId: utils.hexValue(chainId), chainName: name, From 2dba94e3ebaeb07af0d29c3dd4bf54352a4b19ef Mon Sep 17 00:00:00 2001 From: OjusWiZard Date: Sat, 7 Oct 2023 23:56:57 +0530 Subject: [PATCH 2/2] chore: fix metamask warning for unknown chain info Signed-off-by: OjusWiZard --- packages/shared/src/index.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/shared/src/index.tsx b/packages/shared/src/index.tsx index 1c07351f..1c7e7986 100644 --- a/packages/shared/src/index.tsx +++ b/packages/shared/src/index.tsx @@ -61,14 +61,14 @@ export const chainInfos: Record = { id: "xdai", color: "#48a900", chainId: 100, - name: "xDAI Chain", - rpcUrls: ["https://gnosischain-rpc.gateway.pokt.network/"], + name: "Gnosis", + rpcUrls: ["https://rpc.gnosischain.com/"], nativeCurrency: { name: "xDAI", - symbol: "xDAI", + symbol: "XDAI", decimals: 18, }, - blockExplorerUrls: ["https://gnosischain.io/"], + blockExplorerUrls: ["https://gnosisscan.io/"], }, matic: { id: "matic",