diff --git a/package-lock.json b/package-lock.json index e9bdd98..85ff81e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,6 +5,7 @@ "requires": true, "packages": { "": { + "name": "punk-domains-chrome-extension", "version": "1.0.0", "license": "ISC", "dependencies": { diff --git a/package.json b/package.json index 2b504a8..77a1495 100644 --- a/package.json +++ b/package.json @@ -6,8 +6,8 @@ "scripts": { "serve": "export NODE_ENV=development && webpack --mode='development' --watch --config ./webpack.config.js", "build": "export NODE_ENV=production && webpack --mode='production' --config ./webpack.config.js", - "serve-window": "set NODE_ENV=development && webpack --config ./webpack.config.js", - "build-window": "set NODE_ENV=production && webpack --config ./webpack.config.js" + "serve-windows": "set NODE_ENV=development && webpack --config ./webpack.config.js", + "build-windows": "set NODE_ENV=production && webpack --config ./webpack.config.js" }, "author": "", "license": "ISC", diff --git a/src/assets/img/logo.png b/src/assets/img/logo.png index 2e46fba..e630693 100644 Binary files a/src/assets/img/logo.png and b/src/assets/img/logo.png differ diff --git a/src/background.js b/src/background.js index ab80208..9f88253 100644 --- a/src/background.js +++ b/src/background.js @@ -23,16 +23,23 @@ chrome.webNavigation.onBeforeNavigate.addListener(function(data) { // check if request comes from a block explorer search if ( - url.href.startsWith("https://optimistic.etherscan.io/search?") || - url.href.startsWith("https://polygonscan.com/search?") || url.href.startsWith("https://arbiscan.io/search?") || - url.href.startsWith("https://songbird-explorer.flare.network/search?") || - url.href.startsWith("https://flare-explorer.flare.network/search?") || url.href.startsWith("https://basescan.org/search?") || - url.href.startsWith("https://etherscan.io/search?") || url.href.startsWith("https://bscscan.com/search?") || + url.href.startsWith("https://etherscan.io/search?") || + url.href.startsWith("https://era.zksync.network/search?") || + url.href.startsWith("https://flare-explorer.flare.network") || url.href.startsWith("https://ftmscan.com/search?") || - url.href.startsWith("https://gnosisscan.io/search?") + url.href.startsWith("https://gnosisscan.io/search?") || + url.href.startsWith("https://gnosis.blockscout.com") || + url.href.startsWith("https://kromascan.com/search?") || + url.href.startsWith("https://lineascan.build/search?") || + url.href.startsWith("https://nova.arbiscan.io/search?") || + url.href.startsWith("https://optimistic.etherscan.io/search?") || + url.href.startsWith("https://polygonscan.com/search?") || + url.href.startsWith("https://scan.zkfair.io") || + url.href.startsWith("https://scrollscan.com/search?") || + url.href.startsWith("https://songbird-explorer.flare.network") ) { // if so, redirect user to domain owner's address page on block explorer getDomainHolder(domainName, tldData.address, tldData.chainId).then(function(resp) { @@ -42,24 +49,6 @@ chrome.webNavigation.onBeforeNavigate.addListener(function(data) { return chrome.tabs.update(data.tabId, { url: data.url }); } }); - } else if (url.href.startsWith("https://blockscout.com/xdai/mainnet/search")) { - // gnosis chain explorer support - getDomainHolder(domainName, tldData.address, tldData.chainId).then(function(resp) { - if (resp && resp.startsWith("0x")) { - return chrome.tabs.update(data.tabId, { url: "https://" + url.host + "/xdai/mainnet/address/" + resp }); - } else { - return chrome.tabs.update(data.tabId, { url: data.url }); - } - }); // - } else if (url.href.startsWith("https://explorer.zksync.io/search")) { - // gnosis chain explorer support - getDomainHolder(domainName, tldData.address, tldData.chainId).then(function(resp) { - if (resp && resp.startsWith("0x")) { - return chrome.tabs.update(data.tabId, { url: "https://" + url.host + "/address/" + resp }); - } else { - return chrome.tabs.update(data.tabId, { url: data.url }); - } - }); } else { // otherwise check if user has a URL stored in domain data and redirect there, or redirect to domain page on Punk Domains getDomainDataUrl(domainName, queryParts[1].toLowerCase(), tldData.address, tldData.chainId, result.punkFastMode).then(function(resp) { diff --git a/src/utils/network.js b/src/utils/network.js index f14d9a2..10460ce 100644 --- a/src/utils/network.js +++ b/src/utils/network.js @@ -8,6 +8,21 @@ export const getFallbackProvider = (networkId) => { urls = [ "https://mainnet.optimism.io" ]; + } else if (networkId === 14) { + // Flare Mainnet + urls = [ + "https://flare-api.flare.network/ext/C/rpc" + ]; + } else if (networkId === 19) { + // Songbird Canary-Network + urls = [ + "https://songbird-api.flare.network/ext/C/rpc" + ]; + } else if (networkId === 56) { + // BNB Smart Chain Mainnet + urls = [ + "https://bsc-dataseed.binance.org" + ]; } else if (networkId === 100) { // Gnosis Chain urls = [ @@ -16,51 +31,54 @@ export const getFallbackProvider = (networkId) => { } else if (networkId === 137) { // Polygon PoS Chain urls = [ - "https://polygon-rpc.com/" + "https://rpc.ankr.com/polygon" ]; - } else if (networkId === 42161) { - // Arbitrum + } else if (networkId === 250) { + // Fantom Opera urls = [ - "https://arb1.arbitrum.io/rpc" + "https://rpc.fantom.network" ]; - // + - } else if (networkId === 19) { - // Songbird Canary-Network + } else if (networkId === 255) { + // Kroma urls = [ - "https://songbird-api.flare.network/ext/C/rpc" + "https://api.kroma.network" ]; - } else if (networkId === 14) { - // Flare Mainnet + } else if (networkId === 324) { + // zkSync Era Mainnet urls = [ - "https://flare-api.flare.network/ext/C/rpc" + "https://mainnet.era.zksync.io" ]; - } else if (networkId === 8453) { + }else if (networkId === 8453) { // Base urls = [ "https://mainnet.base.org" ]; - // ++ - } else if (networkId === 1) { - // Ethereum Mainnet + } else if (networkId === 42161) { + // Arbitrum One urls = [ - "https://mainnet.infura.io/v3/" + "https://arb1.arbitrum.io/rpc" ]; - } else if (networkId === 56) { - // BNB Smart Chain Mainnet + } else if (networkId === 42170) { + // Arbitrum Nova urls = [ - "https://bsc-dataseed.binance.org" + "https://nova.arbitrum.io/rpc" ]; - } else if (networkId === 250) { - // Fantom Opera + } else if (networkId === 42766) { + // ZKFair urls = [ - "https://rpc.fantom.network" + "https://rpc.zkfair.io" ]; - } else if (networkId === 324) { - // zkSync Era Mainnet + } else if (networkId === 59144) { + // Linea urls = [ - "https://mainnet.era.zksync.io" + "https://rpc.linea.build" ]; - } + } else if (networkId === 534352) { + // Scroll + urls = [ + "https://rpc.scroll.io" + ]; + } if (urls) { const providers = urls.map(url => new ethers.providers.JsonRpcProvider(url)); diff --git a/src/utils/punk.js b/src/utils/punk.js index 8433a7c..d4aac76 100644 --- a/src/utils/punk.js +++ b/src/utils/punk.js @@ -5,36 +5,41 @@ import { getTldInterface } from "./interfaces"; export const getDomainDataUrl = async (domainName, tld, tldAddress, chainId, mode) => { let baseUrl = "https://punk.domains"; - if (tld === "klima") { - baseUrl = "https://www.kns.earth"; - } else if (tld === "smol") { - baseUrl = "https://smol.domains"; - // + - } else if (tld === "sgb") { - baseUrl = "https://songbird.domains"; - } else if (tld === "flr") { - baseUrl = "https://flr.domains"; - } else if (tld === "basebook") { - baseUrl = "https://id.basebook.xyz"; - // ++ + if (tld === "basebook") { + baseUrl = "https://id.basebook.xyz"; + } else if (tld === "based") { + baseUrl = "https://basednames.xyz"; + } else if (tld === "basepunk") { + baseUrl = "https://id.basepunk.xyz"; } else if (tld === "basin") { baseUrl = "https://app.basin.global"; - } else if (tld === "wildbunch") { - baseUrl = "https://twb.punk.domains"; + } else if (tld === "dope") { + baseUrl = "https://dns.dopewars.gg"; } else if (tld === "fantom") { - baseUrl = "https://fantomnames.org"; + baseUrl = "https://fantomname.org"; + } else if (tld === "flr") { + baseUrl = "https://flr.domains"; } else if (tld === "giveth") { baseUrl = "https://giveth.punk.domains"; + } else if (tld === "klima") { + baseUrl = "https://www.kns.earth"; } else if (tld === "op") { baseUrl = "https://optimistic.domains"; - } else if (tld === "dope") { + } else if (tld === "pool") { baseUrl = "https://names.pooly.me"; + } else if (tld === "ppl") { + baseUrl = "https://ppl.domains"; } else if (tld === "satrap") { baseUrl = "https://id.satraps.io"; + } else if (tld === "scrolly") { + baseUrl = "https://sns.scrolly.xyz"; + } else if (tld === "sgb") { + baseUrl = "https://songbird.domains"; + } else if (tld === "smol") { + baseUrl = "https://smol.domains"; } else if (tld === "zksoul") { baseUrl = "https://id.zkchat.net"; } - const punkUrl = baseUrl + "/#/domain/"+chainId+"/"+tld+"/"+domainName; diff --git a/src/utils/tlds.js b/src/utils/tlds.js index 4224117..191ec6c 100644 --- a/src/utils/tlds.js +++ b/src/utils/tlds.js @@ -1,5 +1,103 @@ export const getTlds = () => { return { + // Arbitrum One + ".arbitrum": { + "address": "0x337EB5061943ECd247649d58D35Dbab0b40D67E0", + "chainId": 42161 + }, + ".arbi": { + "address": "0xe97456E0fB121F65422F43ccbd4A07a0e269B534", + "chainId": 42161 + }, + ".smol": { + "address": "0xE0d972817e94c5FF9BDc49a63d8927A0bA833E4f", + "chainId": 42161 + }, + ".punkangel": { + "address": "0xcC66213645474a7B61BAf95330D01e50789eaF4b", + "chainId": 42161 + }, + ".ppl": { + "address": "0xbC9d19e5f97a572f428F7292DBf3dc182Cc05C82", + "chainId": 42161 + }, + ".misie": { + "address": "0x526Ff108F5d422d0e1d6650E2Bc015BBE1fdb058", + "chainId": 42161 + }, + + // Arbitrum Nova + ".alnova": { + "address": "0x4087fb91A1fBdef05761C02714335D232a2Bf3a1", + "chainId": 42170 + }, + + // Base + ".basebook": { + "address": "0x4087fb91A1fBdef05761C02714335D232a2Bf3a1", + "chainId": 8453 + }, + ".based": { + "address": "0x273dB54929d8392c1997Be361Da89D41af202a49", + "chainId": 8453 + }, + ".basepunk": { + "address": "0xc2C543D39426bfd1dB66bBde2Dd9E4a5c7212876", + "chainId": 8453 + }, + + // BNB Smart Chain Mainnet + ".safu": { + "address": "0xBDACF94dDCAB51c39c2dD50BffEe60Bb8021949a", + "chainId": 56 + }, + ".huwa": { + "address": "0xeFBE0b46649B7A0F1e1D49CCa98aD9CF6bcFB096", + "chainId": 56 + }, + + // Fantom Opera + ".fantom": { + "address": "0xBDACF94dDCAB51c39c2dD50BffEe60Bb8021949a", + "chainId": 250 + }, + + // Flare Mainnet + ".flr": { + "address": "0xBDACF94dDCAB51c39c2dD50BffEe60Bb8021949a", + "chainId": 14 + }, + + // Gnosis Chain + ".gnosis": { + "address": "0xC3E8922657686EC63eaaa9FC1Fe06826802e7e0f", + "chainId": 100 + }, + ".xdai": { + "address": "0xbca24d86e4ad1e011278faefc4ff191a731411ec", + "chainId": 100 + }, + ".bright": { + "address": "0x3490c9817c45a2a394b11a3807f58a8325235ae0", + "chainId": 100 + }, + ".giveth": { + "address": "0xEEa3e593CDAf9D18780f9D58BAD142AF6Bd9522a", + "chainId": 100 + }, + + // Kroma + ".alkroma": { + "address": "0x6c66f1d5684630fb69350a7a88bcca60629d7252", + "chainId": 255 + }, + + // Linea + ".alinea": { + "address": "0x6c66f1d5684630fb69350a7a88bcca60629d7252", + "chainId": 59144 + }, + // Optimism ".wagmi": { "address": "0xC3E8922657686EC63eaaa9FC1Fe06826802e7e0f", @@ -30,24 +128,6 @@ export const getTlds = () => { "chainId": 10 }, - // Gnosis Chain - ".gnosis": { - "address": "0xC3E8922657686EC63eaaa9FC1Fe06826802e7e0f", - "chainId": 100 - }, - ".xdai": { - "address": "0xbca24d86e4ad1e011278faefc4ff191a731411ec", - "chainId": 100 - }, - ".bright": { - "address": "0x3490c9817c45a2a394b11a3807f58a8325235ae0", - "chainId": 100 - }, - ".giveth": { - "address": "0xEEa3e593CDAf9D18780f9D58BAD142AF6Bd9522a", - "chainId": 100 - }, - // Polygon PoS Chain ".ape": { "address": "0x794a8390D94E32b086908D2bA9D66300aA163C62", @@ -69,34 +149,17 @@ export const getTlds = () => { "address": "0x4bF5A99eA2F8De061f7D77BA9edd749503D945Da", "chainId": 137 }, - - // Arbitrum - ".arbitrum": { - "address": "0x337EB5061943ECd247649d58D35Dbab0b40D67E0", - "chainId": 42161 - }, - ".arbi": { - "address": "0xe97456E0fB121F65422F43ccbd4A07a0e269B534", - "chainId": 42161 - }, - ".smol": { - "address": "0xE0d972817e94c5FF9BDc49a63d8927A0bA833E4f", - "chainId": 42161 - }, - ".punkangel": { - "address": "0xcC66213645474a7B61BAf95330D01e50789eaF4b", - "chainId": 42161 - }, - ".ppl": { - "address": "0xbC9d19e5f97a572f428F7292DBf3dc182Cc05C82", - "chainId": 42161 + + // Scroll + ".alscroll": { + "address": "0x4087fb91A1fBdef05761C02714335D232a2Bf3a1", + "chainId": 534352 }, - ".misie": { - "address": "0x526Ff108F5d422d0e1d6650E2Bc015BBE1fdb058", - "chainId": 42161 + ".scrolly": { + "address": "0xc2C543D39426bfd1dB66bBde2Dd9E4a5c7212876", + "chainId": 534352 }, - // + // Songbird ".sgb": { "address": "0xBDACF94dDCAB51c39c2dD50BffEe60Bb8021949a", @@ -107,39 +170,10 @@ export const getTlds = () => { "chainId": 19 }, - // Flare Mainnet - ".flr": { - "address": "0xBDACF94dDCAB51c39c2dD50BffEe60Bb8021949a", - "chainId": 14 - }, - - // Base - ".basebook": { + // ZKFair + ".fairchat": { "address": "0x4087fb91A1fBdef05761C02714335D232a2Bf3a1", - "chainId": 8453 - }, - - // ++ - // BNB Smart Chain Mainnet - ".safu": { - "address": "0xBDACF94dDCAB51c39c2dD50BffEe60Bb8021949a", - "chainId": 56 - }, - ".huwa": { - "address": "0xeFBE0b46649B7A0F1e1D49CCa98aD9CF6bcFB096", - "chainId": 56 - }, - - // Ethereum Mainnet - ".wildbunch": { - "address": "0xaa9E5Ade68C9C3Ea967Dc5dde731fd1f797152Cb", - "chainId": 1 - }, - - // Fantom Opera - ".fantom": { - "address": "0xBDACF94dDCAB51c39c2dD50BffEe60Bb8021949a", - "chainId": 250 + "chainId": 42766 }, // zkSync Era