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 2692a89..77a1495 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,9 @@ "main": "index.js", "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" + "build": "export NODE_ENV=production && webpack --mode='production' --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 1e307a2..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 e7f521a..9f88253 100644 --- a/src/background.js +++ b/src/background.js @@ -23,9 +23,23 @@ chrome.webNavigation.onBeforeNavigate.addListener(function(data) { // check if request comes from a block explorer search if ( + url.href.startsWith("https://arbiscan.io/search?") || + url.href.startsWith("https://basescan.org/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://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://arbiscan.io/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) { @@ -35,15 +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 { // 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/style.css b/src/style.css index c867df7..fa42db4 100644 --- a/src/style.css +++ b/src/style.css @@ -2,7 +2,8 @@ body { font-family: 'Roboto Condensed', sans-serif; - background: linear-gradient(90deg, hsla(265, 75%, 26%, 1) 0%, hsla(365, 75%, 26%, 1) 100%); + /* background: linear-gradient(90deg, hsla(265, 75%, 26%, 1) 0%, hsla(365, 75%, 26%, 1) 100%); */ + background: linear-gradient(90deg, #4443f1 0%, #9055f7 100%); color: #DBDFEA; width: 400px; } diff --git a/src/utils/network.js b/src/utils/network.js index 56efaaa..10460ce 100644 --- a/src/utils/network.js +++ b/src/utils/network.js @@ -8,23 +8,77 @@ 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 = [ - "https://rpc.xdaichain.com", "https://rpc.gnosischain.com" ]; } else if (networkId === 137) { // Polygon PoS Chain urls = [ - "https://polygon-rpc.com/" + "https://rpc.ankr.com/polygon" + ]; + } else if (networkId === 250) { + // Fantom Opera + urls = [ + "https://rpc.fantom.network" + ]; + } else if (networkId === 255) { + // Kroma + urls = [ + "https://api.kroma.network" + ]; + } else if (networkId === 324) { + // zkSync Era Mainnet + urls = [ + "https://mainnet.era.zksync.io" + ]; + }else if (networkId === 8453) { + // Base + urls = [ + "https://mainnet.base.org" ]; } else if (networkId === 42161) { - // Arbitrum + // Arbitrum One urls = [ "https://arb1.arbitrum.io/rpc" ]; - } + } else if (networkId === 42170) { + // Arbitrum Nova + urls = [ + "https://nova.arbitrum.io/rpc" + ]; + } else if (networkId === 42766) { + // ZKFair + urls = [ + "https://rpc.zkfair.io" + ]; + } else if (networkId === 59144) { + // Linea + urls = [ + "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)); @@ -32,4 +86,4 @@ export const getFallbackProvider = (networkId) => { } else { return null; } -} \ No newline at end of file +} diff --git a/src/utils/punk.js b/src/utils/punk.js index 329cc19..d4aac76 100644 --- a/src/utils/punk.js +++ b/src/utils/punk.js @@ -4,11 +4,41 @@ import { getTldInterface } from "./interfaces"; export const getDomainDataUrl = async (domainName, tld, tldAddress, chainId, mode) => { let baseUrl = "https://punk.domains"; - - if (tld === "klima") { + + 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 === "dope") { + baseUrl = "https://dns.dopewars.gg"; + } else if (tld === "fantom") { + 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 === "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 db323c7..191ec6c 100644 --- a/src/utils/tlds.js +++ b/src/utils/tlds.js @@ -1,5 +1,104 @@ 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", "chainId": 10 @@ -20,26 +119,16 @@ export const getTlds = () => { "address": "0xC16aCAdf99E4540E6f4E6Da816fd6D2A2C6E1d4F", "chainId": 10 }, - - - ".gnosis": { - "address": "0xC3E8922657686EC63eaaa9FC1Fe06826802e7e0f", - "chainId": 100 - }, - ".xdai": { - "address": "0xbca24d86e4ad1e011278faefc4ff191a731411ec", - "chainId": 100 + ".pool": { + "address": "0xf2C9E463592BD440f0D422E944E5F95c79404586", + "chainId": 10 }, - ".bright": { - "address": "0x3490c9817c45a2a394b11a3807f58a8325235ae0", - "chainId": 100 + ".dope": { + "address": "0x1d33989185AA79a3B9173bC7B1137E527C6A262b", + "chainId": 10 }, - - ".polygon": { - "address": "0xa450bc33d0940d25fB0961c592fb440Fa63ABE03", - "chainId": 137 - }, + // Polygon PoS Chain ".ape": { "address": "0x794a8390D94E32b086908D2bA9D66300aA163C62", "chainId": 137 @@ -56,19 +145,42 @@ export const getTlds = () => { "address": "0xe8b97542A433e7eCc7bB791872af04DF02A1a6E4", "chainId": 137 }, - - - ".arbi": { - "address": "0xe97456E0fB121F65422F43ccbd4A07a0e269B534", - "chainId": 42161 + ".basin": { + "address": "0x4bF5A99eA2F8De061f7D77BA9edd749503D945Da", + "chainId": 137 }, - ".arbitrum": { - "address": "0x337EB5061943ECd247649d58D35Dbab0b40D67E0", - "chainId": 42161 + + // Scroll + ".alscroll": { + "address": "0x4087fb91A1fBdef05761C02714335D232a2Bf3a1", + "chainId": 534352 }, - ".smol": { - "address": "0xE0d972817e94c5FF9BDc49a63d8927A0bA833E4f", - "chainId": 42161 - } + ".scrolly": { + "address": "0xc2C543D39426bfd1dB66bBde2Dd9E4a5c7212876", + "chainId": 534352 + }, + + // Songbird + ".sgb": { + "address": "0xBDACF94dDCAB51c39c2dD50BffEe60Bb8021949a", + "chainId": 19 + }, + ".satrap": { + "address": "0xeFBE0b46649B7A0F1e1D49CCa98aD9CF6bcFB096", + "chainId": 19 + }, + + // ZKFair + ".fairchat": { + "address": "0x4087fb91A1fBdef05761C02714335D232a2Bf3a1", + "chainId": 42766 + }, + + // zkSync Era + ".zksoul": { + "address": "0xe36507aD67Ac0aE6D27D22b407A9338b136315df", + "chainId": 324 + }, + } }