From fab41937c28de45b3b3606b4322a973271c89141 Mon Sep 17 00:00:00 2001
From: Tempe Techie <95053628+tempe-techie@users.noreply.github.com>
Date: Wed, 3 Jan 2024 18:18:53 +0100
Subject: [PATCH] Arbitrum Nova deployment

---
 src/abi/addresses.json       |  1 +
 src/abi/resolver.json        |  1 +
 src/abi/tlds.json            |  3 +++
 src/abi/tokens.json          |  3 +++
 src/hooks/useChainHelpers.ts | 18 +++++++++++++++++-
 src/store/modules/network.ts | 13 +++++++++++++
 6 files changed, 38 insertions(+), 1 deletion(-)

diff --git a/src/abi/addresses.json b/src/abi/addresses.json
index 40016e4..84bd5e2 100644
--- a/src/abi/addresses.json
+++ b/src/abi/addresses.json
@@ -14,6 +14,7 @@
     "4002": "0xeA2f99fE93E5D07F61334C5Eb9c54c5D5C957a6a",
     "80001": "0xC74f279E5A7FDAd6624054518773ae4EC77E78D3",
     "42161": "0x4bD57a848c56E6241296a1256FB2bDEbCdbb9dB0",
+    "42170": "0x2f5cd4366c16AFC3b04A4b2327BbFf9e3955dbC1",
     "42766": "0x2f5cd4366c16AFC3b04A4b2327BbFf9e3955dbC1",
     "59144": "0xbbA4dB63DA448C124ee38EeC636b697CA9bdf9e1",
     "167007": "0x2f5cd4366c16AFC3b04A4b2327BbFf9e3955dbC1",
diff --git a/src/abi/resolver.json b/src/abi/resolver.json
index c89541d..e984cf3 100644
--- a/src/abi/resolver.json
+++ b/src/abi/resolver.json
@@ -13,6 +13,7 @@
   "4002": "0xa97c7AF10ee564EBf452A9347bB9653454Ba69C0",
   "80001": "0xC17E9347Ce26D7630A98eC4158Bd7200E54bf4Cd",
   "42161": "0xd64A2DF9d73CD1Cb50139A3eC3176070e00C67cA",
+  "42170": "0xeA2f99fE93E5D07F61334C5Eb9c54c5D5C957a6a",
   "42766": "0xeA2f99fE93E5D07F61334C5Eb9c54c5D5C957a6a",
   "59144": "0x2f5cd4366c16AFC3b04A4b2327BbFf9e3955dbC1",
   "167007": "0xeA2f99fE93E5D07F61334C5Eb9c54c5D5C957a6a",
diff --git a/src/abi/tlds.json b/src/abi/tlds.json
index 0d7fa90..d9576ff 100644
--- a/src/abi/tlds.json
+++ b/src/abi/tlds.json
@@ -72,6 +72,9 @@
     ".misie": "0x526Ff108F5d422d0e1d6650E2Bc015BBE1fdb058",
     ".ppl": "0xbC9d19e5f97a572f428F7292DBf3dc182Cc05C82"
   },
+  "42170": {
+    ".alnova": "0x4087fb91A1fBdef05761C02714335D232a2Bf3a1"
+  },
   "42766": {
     ".fairchat": "0x4087fb91A1fBdef05761C02714335D232a2Bf3a1"
   },
diff --git a/src/abi/tokens.json b/src/abi/tokens.json
index f8d07ba..a80ee6b 100644
--- a/src/abi/tokens.json
+++ b/src/abi/tokens.json
@@ -73,6 +73,9 @@
     "LINK": "0xf97f4df75117a78c1A5a0DBb814Af92458539FB4",
     "UNI": "0xFa7F8980b0f1E64A2062791cc3b0871572f1F7f0"
   },
+  "42170": {
+    "ETH": "0x0"
+  },
   "42766": {
     "USDC": "0x0"
   },
diff --git a/src/hooks/useChainHelpers.ts b/src/hooks/useChainHelpers.ts
index 9466b59..e9e1908 100644
--- a/src/hooks/useChainHelpers.ts
+++ b/src/hooks/useChainHelpers.ts
@@ -31,6 +31,8 @@ export default function useChainHelpers() {
       return "Fantom Testnet";
     } else if (chainId === 42161) {
       return "Arbitrum";
+    } else if (chainId === 42170) {
+      return "Arbitrum Nova";
     } else if (chainId === 42766) {
       return "ZKFair";
     } else if (chainId === 59144) {
@@ -125,6 +127,11 @@ export default function useChainHelpers() {
         urls = [
           "https://rpc.ankr.com/arbitrum"
         ];
+      } else if (networkId === 42170) {
+        // Arbitrum Nova
+        urls = [
+          "https://nova.arbitrum.io/rpc"
+        ];
       } else if (networkId === 42766) {
         // zkFair
         urls = [
@@ -199,11 +206,20 @@ export default function useChainHelpers() {
       method = "wallet_addEthereumChain"
       params = [{ 
         blockExplorerUrls: [ "https://arbiscan.io" ],
-        chainId: "0xA4B1",
+        chainId: "0xa4b1",
         chainName: "Arbitrum One",
         nativeCurrency: { decimals: 18, name: "ETH", symbol: "ETH" }, 
         rpcUrls: ["https://rpc.ankr.com/arbitrum"]
       }] 
+    } else if (networkName == "Arbitrum Nova") {
+      method = "wallet_addEthereumChain"
+      params = [{ 
+        blockExplorerUrls: [ "https://nova.arbiscan.io" ],
+        chainId: "0xa4ba",
+        chainName: "Arbitrum Nova",
+        nativeCurrency: { decimals: 18, name: "ETH", symbol: "ETH" }, 
+        rpcUrls: ["https://nova.arbitrum.io/rpc"]
+      }] 
     } else if (networkName == "Optimism") {
       method = "wallet_addEthereumChain"
       params = [{ 
diff --git a/src/store/modules/network.ts b/src/store/modules/network.ts
index cb8daa7..2d9b670 100644
--- a/src/store/modules/network.ts
+++ b/src/store/modules/network.ts
@@ -16,6 +16,7 @@ export default {
       137: "Polygon",
       255: "Kroma",
       42161: "Arbitrum",
+      42170: "Arbitrum Nova",
       42766: "ZKFair",
       59144: "Linea",
       534352: "Scroll",
@@ -54,6 +55,8 @@ export default {
         return "https://testnet.ftmscan.com";
       } else if (chainId.value === 42161) {
         return "https://arbiscan.io";
+      } else if (chainId.value === 42170) {
+        return "https://nova.arbiscan.io";
       } else if (chainId.value === 42766) {
         return "https://scan.zkfair.io";
       } else if (chainId.value === 59144) {
@@ -100,6 +103,8 @@ export default {
         return "https://testnet.ftmscan.com";
       } else if (netId === 42161) {
         return "https://arbiscan.io";
+      } else if (netId === 42170) {
+        return "https://nova.arbiscan.io";
       } else if (netId === 42766) {
         return "https://scan.zkfair.io";
       } else if (netId === 59144) {
@@ -190,6 +195,11 @@ export default {
         urls = [
           "https://rpc.ankr.com/arbitrum",
         ];
+      } else if (networkId === 42170) {
+        // Arbitrum Nova
+        urls = [
+          "https://nova.arbitrum.io/rpc",
+        ];
       } else if (networkId === 42766) {
         // ZKFair
         urls = [
@@ -319,6 +329,9 @@ export default {
       } else if (chainId.value === 42161) {
         state.networkName = "Arbitrum";
         state.networkCurrency = "ETH";
+      } else if (chainId.value === 42170) {
+        state.networkName = "Arbitrum Nova";
+        state.networkCurrency = "ETH";
       } else if (chainId.value === 42766) {
         state.networkName = "ZKFair";
         state.networkCurrency = "USDC";