Skip to content

Commit

Permalink
Merge pull request #1065 from oasisprotocol/mz/faucet
Browse files Browse the repository at this point in the history
Fix Testnet Faucet links
  • Loading branch information
buberdds authored Dec 5, 2023
2 parents 2b7d279 + 8f175c5 commit da7d677
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
1 change: 1 addition & 0 deletions .changelog/1065.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix Testnet Faucet links
2 changes: 1 addition & 1 deletion src/app/pages/ParatimeDashboardPage/ParaTimeSnapshot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export const ParaTimeSnapshot: FC<{ scope: SearchScope }> = ({ scope }) => {
</StyledGrid>
<StyledGrid item xs={22} md={5}>
{scope.network === Network.mainnet && <RosePriceCard />}
{scope.network === Network.testnet && <TestnetFaucet />}
{scope.network === Network.testnet && <TestnetFaucet layer={scope.layer} />}
</StyledGrid>
</Grid>
</>
Expand Down
11 changes: 8 additions & 3 deletions src/app/pages/ParatimeDashboardPage/TestnetFaucet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import { styled } from '@mui/material/styles'
import Typography from '@mui/material/Typography'
import { SnapshotCard } from '../../components/Snapshots/SnapshotCard'
import { COLORS } from '../../../styles/theme/colors'
import { testnet } from '../../utils/externalLinks'
import { faucet } from '../../utils/externalLinks'
import { Layer } from '../../../oasis-nexus/api'

const StyledBox = styled(Box)(({ theme }) => ({
gap: theme.spacing(5),
Expand All @@ -17,7 +18,11 @@ const StyledBox = styled(Box)(({ theme }) => ({
justifyContent: 'space-between',
}))

export const TestnetFaucet: FC = () => {
type TestnetFaucetProps = {
layer: Layer
}

export const TestnetFaucet: FC<TestnetFaucetProps> = ({ layer }) => {
const { t } = useTranslation()

return (
Expand All @@ -32,7 +37,7 @@ export const TestnetFaucet: FC = () => {
{t('testnetFaucet.description')}
</Typography>
<Button
href={testnet.faucet}
href={faucet[layer]}
target="_blank"
rel="noopener noreferrer"
color="secondary"
Expand Down
11 changes: 9 additions & 2 deletions src/app/utils/externalLinks.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { Layer } from '../../oasis-nexus/api'

export const socialMedia = {
telegram: 'https://t.me/oasisprotocolcommunity',
twitter: 'https://twitter.com/oasisprotocol',
Expand Down Expand Up @@ -34,8 +36,13 @@ export const github = {
releaseTag: `${githubLink}releases/tag/`,
}

export const testnet = {
faucet: 'https://faucet.testnet.oasis.dev',
const faucetUrl = 'https://faucet.testnet.oasis.dev/'
const faucetParaTimeBaseUrl = `${faucetUrl}?paratime=`
export const faucet = {
[Layer.consensus]: faucetUrl,
[Layer.emerald]: `${faucetParaTimeBaseUrl}${Layer.emerald}`,
[Layer.sapphire]: `${faucetParaTimeBaseUrl}${Layer.sapphire}`,
[Layer.cipher]: `${faucetParaTimeBaseUrl}${Layer.cipher}`,
}

export const api = {
Expand Down

0 comments on commit da7d677

Please sign in to comment.