diff --git a/src/config/gravityBridgeTokens.ts b/src/config/gravityBridgeTokens.ts
index 6601a61..f567eab 100644
--- a/src/config/gravityBridgeTokens.ts
+++ b/src/config/gravityBridgeTokens.ts
@@ -24,4 +24,8 @@ export const CantoGravityTokens = [
nativeName : 'ibc/DC186CA7A8C009B43774EBDC825C935CABA9743504CE6037507E6E5CCE12858A',}
]
+export const ATOMGravityToken = [
+ {...TOKENS.cantoMainnet.ATOM,
+ nativeName: "ibc/9117A26BA81E29FA4F78F57DC2BD90CD3D26848101BA880445F119B22A1E254E"}
+]
diff --git a/src/global/components/cantoNav.tsx b/src/global/components/cantoNav.tsx
index b818af2..6ea4d65 100644
--- a/src/global/components/cantoNav.tsx
+++ b/src/global/components/cantoNav.tsx
@@ -1,6 +1,7 @@
import { useEthers } from "@usedapp/core";
-import { NavBar, useAlert } from "cantoui";
+import { CantoMainnet, useAlert, NavBar } from "cantoui";
import { getAccountBalance, getChainIdandAccount } from "global/utils/walletConnect/addCantoToWallet";
+import { GenPubKey } from "pages/genPubKey";
import { useEffect } from "react";
import { useNetworkInfo } from "stores/networkInfo";
import { addNetwork } from "utils/addCantoToWallet";
@@ -8,19 +9,13 @@ import logo from "./../../assets/logo.svg"
export const CantoNav = () => {
const netWorkInfo = useNetworkInfo();
- const { activateBrowserWallet, account, switchNetwork } = useEthers();
+ const { activateBrowserWallet, account, chainId } = useEthers();
const alert = useAlert();
- async function setChainInfo() {
- const [chainId, account] = await getChainIdandAccount();
- netWorkInfo.setChainId(chainId);
- netWorkInfo.setAccount(account);
- }
-
useEffect(() => {
- setChainInfo();
- //@ts-ignore
-}, [window.ethereum?.networkVersion]);
+ netWorkInfo.setChainId(chainId?.toString());
+ netWorkInfo.setAccount(account);
+}, [account, chainId]);
//@ts-ignore
if (window.ethereum) {
@@ -28,11 +23,6 @@ export const CantoNav = () => {
window.ethereum.on("accountsChanged", () => {
window.location.reload();
});
-
- // //@ts-ignore
- // window.ethereum.on("networkChanged", () => {
- // window.location.reload();
- // });
}
async function getBalance() {
@@ -41,26 +31,29 @@ export const CantoNav = () => {
}
}
useEffect(() => {
- if (!netWorkInfo.isConnected) {
+ if (!netWorkInfo.hasPubKey) {
+ alert.show("Failure",
please connect your wallet to use the bridge
) + }else if (!netWorkInfo.isConnected) { alert.show("Failure",this network is not supported on gravity bridge, please switch networks
) } else { alert.close(); } getBalance(); - },[netWorkInfo.account, netWorkInfo.chainId]) + },[netWorkInfo.account, netWorkInfo.chainId, netWorkInfo.hasPubKey]) return ({bridgeOut ? "gravity bridge" : "ethereum"}
+{"cosmos hub"}
canto
to learn how to bridge ATOM into canto, please read - here
-+ to learn how to bridge ATOM into canto, please read{" "} + + here + {" "} +
++ const [pubKeySuccess, setPubKeySuccess] = useState(""); + const [wasNotConnected, setWasNotConnected] = useState(false); + const networkInfo = useNetworkInfo(); + const {activateBrowserWallet} = useEthers(); + useEffect(() => { + if ( + Number(networkInfo.chainId) == CantoMainnet.chainId && + wasNotConnected == true + ) { + setPubKeySuccess( + "connected to canto network! click above to generate a public key" + ); + } + }, [networkInfo.chainId]); + return ( +
{pubKeySuccess}
+