From 418f4de2e35cca206391b3f2fc02659de3cd59c8 Mon Sep 17 00:00:00 2001 From: kristjanpeterson Date: Tue, 4 Oct 2022 14:12:00 +0300 Subject: [PATCH] Replace Rinkeby with Goerli everywhere, because Rinkeby is getting deprecated. --- backend/src/config.js | 4 ++-- backend/utils/functions/refreshOpensea.js | 4 ++-- frontend/js/app.js | 22 +++++++++++----------- frontend/js/constants.js | 2 +- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/backend/src/config.js b/backend/src/config.js index 79cc89ea19..d9145cff16 100644 --- a/backend/src/config.js +++ b/backend/src/config.js @@ -45,7 +45,7 @@ const extraMetadata = { // ** REQUIRED ** const AUTH = process.env.NFTPORT_API_KEY; // Set this in the .env file to prevent exposing your API key when pushing to Github const LIMIT = 2; // Your API key rate limit -const CHAIN = 'rinkeby'; // only rinkeby, polygon, or ethereum +const CHAIN = 'goerli'; // only goerli, polygon, or ethereum // REQUIRED CONTRACT DETAILS THAT CANNOT BE UPDATED LATER! const CONTRACT_NAME = 'CRYPTOPUNKS'; @@ -54,7 +54,7 @@ const METADATA_UPDATABLE = true; // set to false if you don't want to allow meta const OWNER_ADDRESS = 'YOUR WALLET ADDRESS HERE'; const TREASURY_ADDRESS = 'YOUR WALLET ADDRESS HERE'; const MAX_SUPPLY = 5000; // The maximum number of NFTs that can be minted. CANNOT BE UPDATED! -const MINT_PRICE = 0.01; // Minting price per NFT. Rinkeby = ETH, Ethereum = ETH, Polygon = MATIC. CANNOT BE UPDATED! +const MINT_PRICE = 0.01; // Minting price per NFT. Goerli = ETH, Ethereum = ETH, Polygon = MATIC. CANNOT BE UPDATED! const TOKENS_PER_MINT = 10; // maximum number of NFTs a user can mint in a single transaction. CANNOT BE UPDATED! // REQUIRED CONTRACT DETAILS THAT CAN BE UPDATED LATER. diff --git a/backend/utils/functions/refreshOpensea.js b/backend/utils/functions/refreshOpensea.js index d9427dedd2..9b13b2d2e7 100644 --- a/backend/utils/functions/refreshOpensea.js +++ b/backend/utils/functions/refreshOpensea.js @@ -17,8 +17,8 @@ if (!START || !END) { } const COLLECTION_BASE_URL = - CHAIN.toLowerCase() === "rinkeby" - ? `https://testnets.opensea.io/assets` + CHAIN.toLowerCase() === "goerli" + ? `https://testnets.opensea.io/assets/goerli` : "https://opensea.io/assets/matic"; async function main() { diff --git a/frontend/js/app.js b/frontend/js/app.js index a599398480..f279662c43 100644 --- a/frontend/js/app.js +++ b/frontend/js/app.js @@ -102,8 +102,8 @@ const updateConnectStatus = async () => { async function checkChain() { let chainId = 0; - if(chain === 'rinkeby') { - chainId = 4; + if(chain === 'goerli') { + chainId = 5; } else if(chain === 'polygon') { chainId = 137; } else if(chain === 'ethereum') { @@ -120,15 +120,15 @@ async function checkChain() { // This error code indicates that the chain has not been added to MetaMask. if (err.code === 4902) { try { - if(chain === 'rinkeby') { + if(chain === 'goerli') { await window.ethereum.request({ method: 'wallet_addEthereumChain', params: [ { - chainName: 'Rinkeby Test Network', + chainName: 'Goerli Test Network', chainId: web3.utils.toHex(chainId), nativeCurrency: { name: 'ETH', decimals: 18, symbol: 'ETH' }, - rpcUrls: ['https://rinkeby.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161'], + rpcUrls: ['https://goerli.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161'], }, ], }); @@ -223,7 +223,7 @@ async function loadInfo() { }, 1000); let priceType = ''; - if(chain === 'rinkeby' || chain === 'ethereum') { + if(chain === 'goerli' || chain === 'ethereum') { priceType = 'ETH'; } else if (chain === 'polygon') { priceType = 'MATIC'; @@ -288,7 +288,7 @@ function setTotalPrice() { const totalPriceWei = BigInt(info.deploymentConfig.mintPrice) * BigInt(mintInputValue); let priceType = ''; - if(chain === 'rinkeby' || chain === 'ethereum') { + if(chain === 'goerli' || chain === 'ethereum') { priceType = 'ETH'; } else if (chain === 'polygon') { priceType = 'MATIC'; @@ -317,8 +317,8 @@ async function mint() { .mint(amount) .send({ from: window.address, value: value.toString() }); if(mintTransaction) { - if(chain === 'rinkeby') { - const url = `https://rinkeby.etherscan.io/tx/${mintTransaction.transactionHash}`; + if(chain === 'goerli') { + const url = `https://goerli.etherscan.io/tx/${mintTransaction.transactionHash}`; const mintedContainer = document.querySelector('.minted-container'); const countdownContainer = document.querySelector('.countdown'); const mintedTxnBtn = document.getElementById("mintedTxnBtn"); @@ -354,8 +354,8 @@ async function mint() { .presaleMint(amount, merkleJson) .send({ from: window.address, value: value.toString() }); if(presaleMintTransaction) { - if(chain === 'rinkeby') { - const url = `https://rinkeby.etherscan.io/tx/${presaleMintTransaction.transactionHash}`; + if(chain === 'goerli') { + const url = `https://goerli.etherscan.io/tx/${presaleMintTransaction.transactionHash}`; const mintedContainer = document.querySelector('.minted-container'); const countdownContainer = document.querySelector('.countdown'); const mintedTxnBtn = document.getElementById("mintedTxnBtn"); diff --git a/frontend/js/constants.js b/frontend/js/constants.js index 1d8868462d..a5a7477153 100644 --- a/frontend/js/constants.js +++ b/frontend/js/constants.js @@ -1,5 +1,5 @@ const contractAddress = "YOUR CONTRACT ADDRESS"; // Replace with your own contract address -const chain = 'rinkeby'; // rinkeby, polygon, or ethereum +const chain = 'goerli'; // goerli, polygon, or ethereum const welcome_h1 = "Welcome to the CodeCats NFT Project!!"; const welcome_h2 = "Connect to MetaMask to Get Started";