Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Testnet Faucet links #1065

Merged
merged 1 commit into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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}`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't use our Layer enum in URL

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't use our Layer enum in URL

See #1079 for a fix

[Layer.sapphire]: `${faucetParaTimeBaseUrl}${Layer.sapphire}`,
[Layer.cipher]: `${faucetParaTimeBaseUrl}${Layer.cipher}`,
}

export const api = {
Expand Down
Loading