Skip to content

Commit

Permalink
Merge pull request onflow#63 from onflow/ianthpun/crescendonet
Browse files Browse the repository at this point in the history
Add Crescendo faucet
  • Loading branch information
ianthpun authored Dec 20, 2023
2 parents 5770bcc + 6013ac1 commit 6daded2
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 9 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@ jobs:
NEXT_PUBLIC_SIGNER_ADDRESS: "0xf8d6e0586b0a20c7"
SIGNER_PRIVATE_KEY: "91a22fbd87392b019fbe332c32695c14cf2ba5b6521476a8540228bdf1987068"
NEXT_PUBLIC_TEST_NET_URL: "http://localhost:3000"
NEXT_PUBLIC_CRESCENDO_URL: "http://localhost:3000"
NEXT_PUBLIC_TOKEN_AMOUNT_FLOW: "1000.0"
NEXT_PUBLIC_TOKEN_AMOUNT_FUSD: "10.0"
NEXT_PUBLIC_CONTRACT_FUNGIBLE_TOKEN: "0xee82856bf20e2aa6"
NEXT_PUBLIC_CONTRACT_FLOW_TOKEN: "0x0ae53cb6e3f42a79"
NEXT_PUBLIC_CONTRACT_FUSD: "0xf8d6e0586b0a20c7"
NEXT_PUBLIC_NETWORK: "testnet"

strategy:
matrix:
Expand Down
6 changes: 3 additions & 3 deletions components/FundAccountSubmitted.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Label from "components/Label"
import LoadingFeedback from "components/LoadingFeedback"
import {Box, Flex, Link, Themed, ThemeUICSSObject} from "theme-ui"
import {ClientFundAccountResult} from "./FundAccountPanel"
import publicConfig from "lib/publicConfig"

const styles: Record<string, ThemeUICSSObject> = {
resultsContainer: {
Expand Down Expand Up @@ -46,8 +47,7 @@ export default function FundAccountSubmitted({
<Box mb={4}>
<Themed.h3 sx={{my: 0}}>Account Funded!</Themed.h3>
<Themed.p>
The requested amount has been transfered to your Testnet
account!
{`The requested amount has been transferred to your ${publicConfig.network} account!`}
</Themed.p>
</Box>
<Box>
Expand All @@ -61,7 +61,7 @@ export default function FundAccountSubmitted({
} tokens`}
</div>
<Link
href={`https://flow-view-source.com/testnet/account/${result.address}`}
href={`https://${publicConfig.network}.flowdiver.io/account/${result.address}`}
target="_blank"
variant="secondary"
sx={{fontSize: 1}}
Expand Down
17 changes: 16 additions & 1 deletion components/NetworkLinks.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/** @jsxImportSource theme-ui */

import TabNav, {TabNavLink} from "components/TabNav"
import {TEST_NET} from "lib/constants"
import {TEST_NET, CRESCENDO_NET} from "lib/constants"
import {NETWORK_DISPLAY_NAME} from "lib/network"
import publicConfig from "lib/publicConfig"

Expand Down Expand Up @@ -40,6 +40,21 @@ export default function NetworkLinks() {
/>
Testnet
</TabNavLink>
<TabNavLink
href={publicConfig.crescendoNetUrl}
active={publicConfig.network === CRESCENDO_NET}
>
<img
src={
publicConfig.network === CRESCENDO_NET
? "crescendo-faucet-icon.svg"
: "gray-faucet-icon.svg"
}
alt="Crescendo Faucet"
sx={{mr: 2}}
/>
Crescendo
</TabNavLink>
</TabNav>
</div>
)
Expand Down
2 changes: 1 addition & 1 deletion components/PageTitle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import publicConfig from "lib/publicConfig"
import Head from "next/head"

export const BASE_HTML_TITLE = `Flow ${
publicConfig.network === TEST_NET ? "Testnet" : ""
publicConfig.network === TEST_NET ? "Testnet" : "Crescendo"
} Faucet`

export default function PageTitle({children}: {children?: string}) {
Expand Down
1 change: 1 addition & 0 deletions env.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
NEXT_PUBLIC_NETWORK=testnet
NEXT_PUBLIC_TEST_NET_URL=http://localhost:3000
NEXT_PUBLIC_CRESCENDO_URL=http://localhost:3000
NEXT_PUBLIC_MIXPANEL_TOKEN="dev"
NEXT_PUBLIC_TOKEN_AMOUNT_FLOW=1000.0
NEXT_PUBLIC_TOKEN_AMOUNT_FUSD=10.0
Expand Down
3 changes: 2 additions & 1 deletion flow.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
},
"networks": {
"emulator": "127.0.0.1:3569",
"testnet": "access.devnet.nodes.onflow.org:9000"
"testnet": "access.devnet.nodes.onflow.org:9000",
"crescendo": "access.crescendo.nodes.onflow.org:9000"
},
"accounts": {
"emulator-account": {
Expand Down
4 changes: 3 additions & 1 deletion lib/constants.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
export type Networks = "testnet"
export type Networks = "testnet" | "crescendo"
export type TokenTypes = typeof FLOW_TYPE | typeof FUSD_TYPE

export const TEST_NET = "testnet"
export const CRESCENDO_NET = "crescendo"
export const FLOW_TYPE = "FLOW"
export const FUSD_TYPE = "FUSD"
export const NETWORK_STATUS_URL = "https://status.onflow.org/"
Expand Down Expand Up @@ -36,4 +37,5 @@ export const ADDRESS_REGEXP = /^(0x)?[0-9a-fA-F]{16}$/

export const NETWORK_CODEWORDS = {
testnet: "0x6834ba37b3980209",
crescendo: "0x6834ba37b3980209",
}
11 changes: 9 additions & 2 deletions lib/publicConfig.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import {Networks, TEST_NET, TokenTypes} from "./constants"
import {Networks, TokenTypes} from "./constants"

const network = process.env.NEXT_PUBLIC_NETWORK as Networks | undefined
if (!network) throw "Missing NEXT_PUBLIC_NETWORK"

const network = TEST_NET
const testNetUrl = process.env.NEXT_PUBLIC_TEST_NET_URL
if (!testNetUrl) throw "Missing NEXT_PUBLIC_TEST_NET_URL"

const crescendoNetUrl = process.env.NEXT_PUBLIC_CRESCENDO_URL
if (!crescendoNetUrl) throw "Missing NEXT_PUBLIC_CRESCENDO_URL"

const tokenAmountFlow = process.env.NEXT_PUBLIC_TOKEN_AMOUNT_FLOW
if (!tokenAmountFlow) throw "Missing NEXT_PUBLIC_TOKEN_AMOUNT_FLOW"

Expand All @@ -29,6 +34,7 @@ const walletDiscovery = process.env.NEXT_PUBLIC_WALLET_DISCOVERY
export type PublicConfig = {
network: Networks
testNetUrl: string
crescendoNetUrl: string
tokenAmountFlow: string
tokenAmountFusd: string
hcaptchaSiteKey: string
Expand All @@ -44,6 +50,7 @@ export type PublicConfig = {
const publicConfig: PublicConfig = {
network,
testNetUrl,
crescendoNetUrl,
tokenAmountFlow,
tokenAmountFusd,
hcaptchaSiteKey:
Expand Down
File renamed without changes
File renamed without changes

0 comments on commit 6daded2

Please sign in to comment.