Skip to content

Commit

Permalink
Merge pull request #153 from P4-Games/build/externalize-explorer-urls
Browse files Browse the repository at this point in the history
merge feature/externalize-explorer-urls into develop
  • Loading branch information
dappsar authored Dec 28, 2024
2 parents 70f656d + 0f91e24 commit 4955b02
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 12 deletions.
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ ARG NEXT_PUBLIC_FROM_ICP
ARG NEXT_PUBLIC_USE_MOCK
ARG NEXT_PUBLIC_UI_URL
ARG NEXT_PUBLIC_ALLOWED_ORIGINS
ARG NEXT_PUBLIC_EXPLORER_L1_URL
ARG NEXT_PUBLIC_EXPLORER_L2_URL
ARG NEXT_PUBLIC_EXPLORER_NFT_URL
ARG RECAPTCHA_API_KEY
ARG PUSH_NETWORK
ARG PUSH_ENVIRONMENT
Expand Down Expand Up @@ -59,6 +62,9 @@ ENV NEXT_PUBLIC_FROM_ICP $NEXT_PUBLIC_FROM_ICP
ENV NEXT_PUBLIC_USE_MOCK $NEXT_PUBLIC_USE_MOCK
ENV NEXT_PUBLIC_UI_URL $NEXT_PUBLIC_UI_URL
ENV NEXT_PUBLIC_ALLOWED_ORIGINS $NEXT_PUBLIC_ALLOWED_ORIGINS
ENV NEXT_PUBLIC_EXPLORER_L1_URL $NEXT_PUBLIC_EXPLORER_L1_URL
ENV NEXT_PUBLIC_EXPLORER_L2_URL $NEXT_PUBLIC_EXPLORER_L2_URL
ENV NEXT_PUBLIC_EXPLORER_NFT_URL $NEXT_PUBLIC_EXPLORER_NFT_URL
ENV RECAPTCHA_API_KEY $RECAPTCHA_API_KEY
ENV PUSH_NETWORK $PUSH_NETWORK
ENV PUSH_ENVIRONMENT $PUSH_ENVIRONMENT
Expand Down
6 changes: 6 additions & 0 deletions cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ steps:
- NEXT_PUBLIC_RECAPTCHA_SITE_KEY=${_NEXT_PUBLIC_RECAPTCHA_SITE_KEY}
- NEXT_PUBLIC_NFT_IMAGE_REPOSITORY=${_NEXT_PUBLIC_NFT_IMAGE_REPOSITORY}
- NEXT_PUBLIC_NFT_MARKETPLACE_URL=${_NEXT_PUBLIC_NFT_MARKETPLACE_URL}
- NEXT_PUBLIC_EXPLORER_L1_URL=${_NEXT_PUBLIC_EXPLORER_L1_URL}
- NEXT_PUBLIC_EXPLORER_L2_URL=${_NEXT_PUBLIC_EXPLORER_L2_URL}
- NEXT_PUBLIC_EXPLORER_NFT_URL=${_NEXT_PUBLIC_EXPLORER_NFT_URL}
secretEnv: [
'BACKEND_API_TOKEN_SECRET'
]
Expand Down Expand Up @@ -75,6 +78,9 @@ steps:
'--build-arg', 'NEXT_PUBLIC_FROM_ICP=${_NEXT_PUBLIC_FROM_ICP}',
'--build-arg', 'NEXT_PUBLIC_UI_URL=${_NEXT_PUBLIC_UI_URL}',
'--build-arg', 'NEXT_PUBLIC_ALLOWED_ORIGINS=${_NEXT_PUBLIC_ALLOWED_ORIGINS}',
'--build-arg', 'NEXT_PUBLIC_EXPLORER_L1_URL=${_NEXT_PUBLIC_EXPLORER_L1_URL}',
'--build-arg', 'NEXT_PUBLIC_EXPLORER_L2_URL=${_NEXT_PUBLIC_EXPLORER_L2_URL}',
'--build-arg', 'NEXT_PUBLIC_EXPLORER_NFT_URL=${_NEXT_PUBLIC_EXPLORER_NFT_URL}',
'.'
]
secretEnv: [
Expand Down
3 changes: 3 additions & 0 deletions example_env
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,7 @@ NEXT_PUBLIC_ALLOWED_ORIGINS=http://localhost:3000
NEXT_PUBLIC_RECAPTCHA_SITE_KEY={recaptcha side key}
NEXT_PUBLIC_NFT_IMAGE_REPOSITORY={gcp|ipfs|icp}
NEXT_PUBLIC_NFT_MARKETPLACE_URL=https://testnets.opensea.io/assets/arbitrum_sepolia/0xAc3F97E45F67052b1AdBbC4d4eB1153Ba14E955d
NEXT_PUBLIC_EXPLORER_L1_URL='https://sepolia.etherscan.io'
NEXT_PUBLIC_EXPLORER_L2_URL='https://sepolia.arbiscan.io/'
NEXT_PUBLIC_EXPLORER_NFT_URL='https://sepolia.arbiscan.io'

3 changes: 3 additions & 0 deletions scripts/docker-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,8 @@ docker build \
--build-arg JWT_SECRET="$JWT_SECRET" \
--build-arg NEXT_PUBLIC_FROM_ICP="$NEXT_PUBLIC_FROM_ICP" \
--build-arg NEXT_PUBLIC_UI_URL="$NEXT_PUBLIC_UI_URL" \
--build-arg NEXT_PUBLIC_EXPLORER_L1_URL="$NEXT_PUBLIC_EXPLORER_L1_URL" \
--build-arg NEXT_PUBLIC_EXPLORER_L2_URL="$NEXT_PUBLIC_EXPLORER_L2_URL" \
--build-arg NEXT_PUBLIC_EXPLORER_NFT_URL="$NEXT_PUBLIC_EXPLORER_NFT_URL" \
--build-arg NEXT_PUBLIC_ALLOWED_ORIGINS="$NEXT_PUBLIC_ALLOWED_ORIGINS" \
-t my-nextjs-app ..
11 changes: 6 additions & 5 deletions src/config-global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ export const USE_MOCK = (process.env.NEXT_PUBLIC_USE_MOCK || 'true') === 'true'
export const ALLOWED_ORIGINS = process.env.NEXT_PUBLIC_ALLOWED_ORIGINS || '*'
export const fromICP = (process.env.NEXT_PUBLIC_FROM_ICP || 'true') === 'true'
export const RECAPTCHA_SITE_KEY = process.env.NEXT_PUBLIC_RECAPTCHA_SITE_KEY || ''
export const EXPLORER_L1_URL: string =
process.env.NEXT_PUBLIC_EXPLORER_L1_URL || 'https://sepolia.etherscan.io'
export const EXPLORER_L2_URL: string =
process.env.NEXT_PUBLIC_EXPLORER_L2_URL || 'https://sepolia.arbiscan.io/'
export const EXPLORER_NFT_URL: string =
process.env.NEXT_PUBLIC_EXPLORER_NFT_URL || 'https://sepolia.arbiscan.io'
export const NFT_IMAGE_REPOSITORY = (
process.env.NEXT_PUBLIC_NFT_IMAGE_REPOSITORY || 'gcp'
).toLowerCase()
Expand All @@ -46,16 +52,11 @@ export const PATH_AFTER_LOGIN = `/dashboard`
export const BOT_WAPP_URL =
'https://api.whatsapp.com/send/?phone=5491164629653&text=MESSAGE&type=phone_number&app_absent=0'

export const EXPLORER_L1 = 'https://sepolia.etherscan.io'
export const EXPLORER_L2 = 'https://l1sload-blockscout.scroll.io' // Scroll devnet Explorer
export const NFT_TRX_EXPLORER = 'https://sepolia.arbiscan.io'

export const NFT_MARKETPLACE_URL =
process.env.NEXT_PUBLIC_NFT_MARKETPLACE_URL ||
'https://testnets.opensea.io/assets/arbitrum_sepolia'

export const NFT_SHARE = 'https://api.whatsapp.com/send/?text=MESSAGE'

export const STORAGE_KEY_TOKEN = 'accessToken'
export const STORAGE_KEY_SETTINGS = 'settings'
export const CONTACT_EMAIL = '[email protected]'
Expand Down
6 changes: 3 additions & 3 deletions src/sections/banking/banking-balances.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { useResponsive } from 'src/hooks/use-responsive'
import { fNumber } from 'src/utils/format-number'

import { useTranslate } from 'src/locales'
import { EXPLORER_L1, EXPLORER_L2, BOT_WAPP_URL } from 'src/config-global'
import { EXPLORER_L1_URL, EXPLORER_L2_URL, BOT_WAPP_URL } from 'src/config-global'

import Iconify from 'src/components/iconify'

Expand All @@ -42,8 +42,8 @@ export default function BankingBalances({
tableData,
...other
}: Props) {
const walletLinkL1 = `${EXPLORER_L1}/address/${tableData?.wallet || ''}`
const walletLinkL2 = `${EXPLORER_L2}/address/${tableData?.wallet || ''}`
const walletLinkL1 = `${EXPLORER_L1_URL}/address/${tableData?.wallet || ''}`
const walletLinkL2 = `${EXPLORER_L2_URL}/address/${tableData?.wallet || ''}`

const { t } = useTranslate()

Expand Down
4 changes: 2 additions & 2 deletions src/sections/banking/banking-recent-transitions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { fNumber } from 'src/utils/format-number'
import { fDate, fTime } from 'src/utils/format-time'

import { useTranslate } from 'src/locales'
import { EXPLORER_L2 } from 'src/config-global'
import { EXPLORER_L2_URL } from 'src/config-global'

import Label from 'src/components/label'
import Iconify from 'src/components/iconify'
Expand Down Expand Up @@ -177,7 +177,7 @@ function BankingRecentTransitionsRow({ userWallet, row, mdUp }: BankingRecentTra
const message: string = `${
trxReceive ? t('transactions.receive-from') : t('transactions.sent-to')
} ${contact}`
const trxLink = `${EXPLORER_L2}/tx/${row.trx_hash}`
const trxLink = `${EXPLORER_L2_URL}/tx/${row.trx_hash}`

const popover = usePopover()

Expand Down
4 changes: 2 additions & 2 deletions src/sections/nfts/nft-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { useTranslate } from 'src/locales'
import {
NFT_SHARE,
UI_API_URL,
NFT_TRX_EXPLORER,
EXPLORER_NFT_URL,
NFT_MARKETPLACE_URL,
NFT_IMAGE_REPOSITORY
} from 'src/config-global'
Expand All @@ -45,7 +45,7 @@ export default function NftItem({ nft }: Props) {

const { trxId, nftId, metadata } = nft

const linkTrx = `${NFT_TRX_EXPLORER}/tx/${trxId}`
const linkTrx = `${EXPLORER_NFT_URL}/tx/${trxId}`
const linkMarketplace = `${NFT_MARKETPLACE_URL}/${nftId}`

const mintUrl = `${UI_API_URL}/nfts/mint/${nftId.toString()}`
Expand Down

0 comments on commit 4955b02

Please sign in to comment.