From 2dd85b29a80c5506472fd9b25093e775a026a87e Mon Sep 17 00:00:00 2001 From: dappsar Date: Wed, 14 Feb 2024 20:45:00 -0300 Subject: [PATCH 1/2] [build] :rocket: split node provider url env variable --- Dockerfile | 8 ++++++-- README.md | 18 +++++++++++------- cloudbuild.yaml | 8 ++++++-- src/config.js | 43 ++++++++++++++++++++++++++++++++++++------- 4 files changed, 59 insertions(+), 18 deletions(-) diff --git a/Dockerfile b/Dockerfile index e48bb321..846a4c62 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,7 +13,9 @@ ARG MONGODB ARG GAMMA_SERVICE_URL ARG GRAPH_URL ARG WALLET_CONNECT_PROJECT_ID -ARG CHAIN_NODE_PROVIDER_URL +ARG NODE_PROVIDER_MUMBAI_URL +ARG NODE_PROVIDER_BSC_TESTNET_URL +ARG NODE_PROVIDER_OPBNB_TESTNET ARG MAIL_CLIENT ARG MAIL_FROM ARG MAIL_TO @@ -35,7 +37,9 @@ ENV MONGODB $MONGODB ENV GAMMA_SERVICE_URL $GAMMA_SERVICE_URL ENV GRAPH_URL $GRAPH_URL ENV WALLET_CONNECT_PROJECT_ID $WALLET_CONNECT_PROJECT_ID -ENV CHAIN_NODE_PROVIDER_URL $CHAIN_NODE_PROVIDER_URL +ENV NODE_PROVIDER_MUMBAI_URL $NODE_PROVIDER_MUMBAI_URL +ENV NODE_PROVIDER_BSC_TESTNET_URL $NODE_PROVIDER_BSC_TESTNET_URL +ENV NODE_PROVIDER_OPBNB_TESTNET $NODE_PROVIDER_OPBNB_TESTNET ENV MAIL_CLIENT $MAIL_CLIENT ENV MAIL_FROM $MAIL_FROM ENV MAIL_TO $MAIL_TO diff --git a/README.md b/README.md index 44f911a0..0c990f61 100644 --- a/README.md +++ b/README.md @@ -67,9 +67,9 @@ NEXT_PUBLIC_CHAIN_CURRENCY='ETH' NEXT_PUBLIC_CHAIN_RPC_URL='http://localhost:8545' ``` -## Quick commands +# Quick commands -### Install dependencies +## Install dependencies ```sh - yarn install # with yarn @@ -89,19 +89,19 @@ yarn config delete proxy yarn --network-timeout 100000 ``` -### Run App +## Run App ```sh npm run dev / yarn dev ``` -### Use App +## Use App ```sh Open browser in http://localhost:3000/ ``` -### Mock Data +## Mock Data You can load mock data from the alpha, gamma collections and have DAIs in your wallet in a local environment, with these commands: @@ -113,9 +113,9 @@ yarn deploy-mock-data # run the mock data # Then upload the hardhat addresses to your wallets ``` -## Contribution +# Contribution -### Commit changes +## Commit changes The application uses a linter for commit messages, requiring them to be specified in the following format: @@ -154,3 +154,7 @@ git reset --soft HEAD~1 ``` For more information, refer to: [commitlint](https://commitlint.js.org/#/). + +# Links + +* BNB & opBNB node provider: [nodereal.io](https://nodereal.io/) diff --git a/cloudbuild.yaml b/cloudbuild.yaml index ff226422..b8ba2f4d 100644 --- a/cloudbuild.yaml +++ b/cloudbuild.yaml @@ -14,7 +14,9 @@ steps: - GAMMA_SERVICE_URL=${_GAMMA_SERVICE_URL} - GRAPH_URL=${_GRAPH_URL} - WALLET_CONNECT_PROJECT_ID=${_WALLET_CONNECT_PROJECT_ID} - - CHAIN_NODE_PROVIDER_URL=${_CHAIN_NODE_PROVIDER_URL} + - NODE_PROVIDER_MUMBAI_URL=${_CHAIN_NODE_PROVIDER_URL} + - NODE_PROVIDER_BSC_TESTNET_URL=${_NODE_PROVIDER_BSC_TESTNET_URL} + - NODE_PROVIDER_OPBNB_TESTNET=${_NODE_PROVIDER_OPBNB_TESTNET} - MAIL_CLIENT=${_MAIL_CLIENT} - MAIL_FROM=${_MAIL_FROM} - MAIL_TO=${_MAIL_TO} @@ -43,7 +45,9 @@ steps: "--build-arg", "GAMMA_SERVICE_URL=${_GAMMA_SERVICE_URL}", "--build-arg", "GRAPH_URL=${_GRAPH_URL}", "--build-arg", "WALLET_CONNECT_PROJECT_ID=${_WALLET_CONNECT_PROJECT_ID}", - "--build-arg", "CHAIN_NODE_PROVIDER_URL=${_CHAIN_NODE_PROVIDER_URL}", + "--build-arg", "NODE_PROVIDER_MUMBAI_URL=${_NODE_PROVIDER_MUMBAI_URL}", + "--build-arg", "NODE_PROVIDER_BSC_TESTNET_URL=${_NODE_PROVIDER_BSC_TESTNET_URL}", + "--build-arg", "NODE_PROVIDER_OPBNB_TESTNET=${_NODE_PROVIDER_OPBNB_TESTNET}", "--build-arg", "MAIL_CLIENT=${_MAIL_CLIENT}", "--build-arg", "MAIL_FROM=${_MAIL_FROM}", "--build-arg", "MAIL_TO=${_MAIL_TO}", diff --git a/src/config.js b/src/config.js index d1e2ce40..55141228 100644 --- a/src/config.js +++ b/src/config.js @@ -38,8 +38,10 @@ export const MAIL_CONFIG = { export const walletConnectProjectId = process.env.WALLET_CONNECT_PROJECT_ID || 'd66ff03f26d5a3ef19530ba69b815448' // not exposed, included then in NETWORKS variable. -const NodeProviderUrl = - process.env.CHAIN_NODE_PROVIDER_URL || 'https://polygon-mumbai.g.alchemy.com/v2/' +const NodeProviderUrlMumbai = + process.env.NODE_PROVIDER_MUMBAI_URL || 'https://polygon-mumbai.g.alchemy.com/v2/' +const NodeProviderUrlbscTestnet = process.env.NODE_PROVIDER_BSC_TESTNET_URL +const NodeProviderUrlopBnbTestnet = process.env.NODE_PROVIDER_OPBNB_TESTNET // ------------------------------------------------------------------ // client-side environment variables @@ -80,7 +82,8 @@ export const NETWORKS = { ChainRpcUrl: 'http://localhost:8545', chainExplorerUrl: 'http://localhost:8545', chainOpenSeaBaseUrl: 'https://testnets.opensea.io/assets/', - chainNodeProviderUrl: NodeProviderUrl // visible ONLY in server side code! (in cliente side will be undefined) + chainNftUrl: '', + chainNodeProviderUrl: NodeProviderUrlMumbai // visible ONLY in server side code! (in cliente side will be undefined) }, contracts: { daiAddress: '0xfbC22278A96299D91d41C453234d97b4F5Eb9B2d', @@ -101,7 +104,9 @@ export const NETWORKS = { ChainRpcUrl: 'https://rpc-mumbai.maticvigil.com', chainExplorerUrl: 'https://mumbai.polygonscan.com', chainOpenSeaBaseUrl: 'https://testnets.opensea.io/assets/mumbai', - chainNodeProviderUrl: NodeProviderUrl // visible ONLY in server side code! (in cliente side will be undefined) + chainNftUrl: + 'https://mumbai.polygonscan.com/token/0x34658c07F05638E12793d0961595cBc72fA69452', + chainNodeProviderUrl: NodeProviderUrlMumbai // visible ONLY in server side code! (in cliente side will be undefined) }, contracts: { daiAddress: '0xEa4c35c858E15Cef77821278A88435dE57bc8707', @@ -118,11 +123,12 @@ export const NETWORKS = { environment: 'testing', chainName: 'bsc-testnet', chainId: '0x61', - chainCurrency: 'BNB', + chainCurrency: 'tBNB', ChainRpcUrl: 'https://bsc-testnet-dataseed.bnbchain.org', chainExplorerUrl: 'https://testnet.bscscan.com', chainOpenSeaBaseUrl: 'https://testnets.opensea.io/assets/bsc-testnet', - chainNodeProviderUrl: NodeProviderUrl // visible ONLY in server side code! (in cliente side will be undefined) + chainNftUrl: 'https://testnet.bscscan.com/token/0x25f85D878972f9506b4De49cEff480f627935521', + chainNodeProviderUrl: NodeProviderUrlbscTestnet // visible ONLY in server side code! (in cliente side will be undefined) }, contracts: { daiAddress: '0x83330b5803838604d85B7Cba393C930084F45A7d', @@ -133,6 +139,28 @@ export const NETWORKS = { gammaTicketsAddress: '0xA5c3Cd20AB6FF1e299D93ee268370BCC19a32E71' } }, + 'opbnb-testnet': { + config: { + enabled: 'true', + environment: 'testing', + chainName: 'opBNB-testnet', + chainId: '0x15eb', + chainCurrency: 'tBNB', + ChainRpcUrl: 'https://opbnb-testnet-rpc.bnbchain.org', + chainExplorerUrl: 'https://opbnb-testnet.bscscan.com', + chainOpenSeaBaseUrl: '', + chainNftUrl: 'https://testnet.opbnbscan.com/token/0x2842c8fd88f801018e53dddebbc944ae377d0f72', + chainNodeProviderUrl: NodeProviderUrlopBnbTestnet // visible ONLY in server side code! (in cliente side will be undefined) + }, + contracts: { + daiAddress: '0x46480E0d10966Ea274831D9693a56f9c09D7339d', + alphaAddress: '0x36f19A5397DbE26b548b15C158f7a8e00979B408', + gammaCardsAddress: '0x2842c8FD88F801018E53dDDeBbC944aE377D0F72', + gammaPackAddress: '0x1116218412559628B67aa15F3c527D68F0A71b91', + gammaOffersAddress: '0xe810524F7C7C62A2201FdF1bCA20649Bd7D70844', + gammaTicketsAddress: '0xd9988C491805AE2573FA156b27CDE1a6f7B3E073' + } + }, matic: { config: { enabled: 'false', @@ -143,7 +171,8 @@ export const NETWORKS = { ChainRpcUrl: 'https://polygon-mainnet.infura.io', chainExplorerUrl: 'https://polygonscan.com', chainOpenSeaBaseUrl: 'https://opensea.io/assets/matic', - chainNodeProviderUrl: NodeProviderUrl // visible ONLY in server side code! (in cliente side will be undefined) + chainNftUrl: '', + chainNodeProviderUrl: NodeProviderUrlMumbai // visible ONLY in server side code! (in cliente side will be undefined) }, contracts: { daiAddress: '', From 915a39a180ca04620eef889c7df5de06c8989d76 Mon Sep 17 00:00:00 2001 From: dappsar Date: Wed, 14 Feb 2024 20:46:10 -0300 Subject: [PATCH 2/2] [feat] :rocket: add opBNB support and config stuff (#336) --- README.md | 2 +- src/sections/Alpha/AlphaAlbums.jsx | 7 ++++++- src/sections/Gamma/GammaCardInfo.jsx | 7 ++++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 0c990f61..83918e37 100644 --- a/README.md +++ b/README.md @@ -157,4 +157,4 @@ For more information, refer to: [commitlint](https://commitlint.js.org/#/). # Links -* BNB & opBNB node provider: [nodereal.io](https://nodereal.io/) +- BNB & opBNB node provider: [nodereal.io](https://nodereal.io/) diff --git a/src/sections/Alpha/AlphaAlbums.jsx b/src/sections/Alpha/AlphaAlbums.jsx index 1b2e65cd..fc4e5ffc 100644 --- a/src/sections/Alpha/AlphaAlbums.jsx +++ b/src/sections/Alpha/AlphaAlbums.jsx @@ -32,7 +32,12 @@ const AlphaAlbums = ({ albums, clickFromAlbums, setSeasonName }) => { useEffect(() => { const ntwk = getCurrentNetwork() if (ntwk && alphaContract) { - const openSeaUrlGamma = `${ntwk.config.chainOpenSeaBaseUrl}/${alphaContract.address}` + let openSeaUrlGamma = '' + if (ntwk.config.chainOpenSeaBaseUrl === '') { + openSeaUrlGamma = `${ntwk.config.chainNftUrl}` + } else { + openSeaUrlGamma = `${ntwk.config.chainOpenSeaBaseUrl}/${alphaContract.address}` + } setOpenSeaUrl(openSeaUrlGamma) } }, [getCurrentNetwork, alphaContract]) diff --git a/src/sections/Gamma/GammaCardInfo.jsx b/src/sections/Gamma/GammaCardInfo.jsx index 41bce613..1f78dffe 100644 --- a/src/sections/Gamma/GammaCardInfo.jsx +++ b/src/sections/Gamma/GammaCardInfo.jsx @@ -47,7 +47,12 @@ const GammaCardInfo = (props) => { useEffect(() => { const ntwk = getCurrentNetwork() if (ntwk) { - const openSeaUrlGamma = `${ntwk.config.chainOpenSeaBaseUrl}/${gammaCardsContract.address}` + let openSeaUrlGamma = '' + if (ntwk.config.chainOpenSeaBaseUrl === '') { + openSeaUrlGamma = `${ntwk.config.chainNftUrl}` + } else { + openSeaUrlGamma = `${ntwk.config.chainOpenSeaBaseUrl}/${gammaCardsContract.address}` + } setOpenSeaUrl(openSeaUrlGamma) } }, [getCurrentNetwork, gammaCardsContract])