From 08aa4aebdbb12c1a0862ac4a12cc554f69c5aa1f Mon Sep 17 00:00:00 2001 From: Dhaiwat Date: Thu, 29 Aug 2024 14:26:52 +0530 Subject: [PATCH 1/5] feat: embed testnet faucet in `create-fuels` template (#3036) --- .changeset/stupid-books-pull.md | 5 ++ templates/nextjs/src/app/faucet/page.tsx | 79 ++++++++++++++-------- templates/nextjs/src/components/Layout.tsx | 18 ++--- templates/vite/src/components/Layout.tsx | 23 +++---- templates/vite/src/routes/faucet.lazy.tsx | 79 ++++++++++++++-------- 5 files changed, 117 insertions(+), 87 deletions(-) create mode 100644 .changeset/stupid-books-pull.md diff --git a/.changeset/stupid-books-pull.md b/.changeset/stupid-books-pull.md new file mode 100644 index 00000000000..8b30ddf2891 --- /dev/null +++ b/.changeset/stupid-books-pull.md @@ -0,0 +1,5 @@ +--- +"create-fuels": patch +--- + +feat: embed testnet faucet in `create-fuels` template diff --git a/templates/nextjs/src/app/faucet/page.tsx b/templates/nextjs/src/app/faucet/page.tsx index b898284e259..ab414339732 100644 --- a/templates/nextjs/src/app/faucet/page.tsx +++ b/templates/nextjs/src/app/faucet/page.tsx @@ -4,6 +4,7 @@ import { Button } from "@/components/Button"; import { Input } from "@/components/Input"; import { useActiveWallet } from "@/hooks/useActiveWallet"; import { useFaucet } from "@/hooks/useFaucet"; +import { CURRENT_ENVIRONMENT, Environments, TESTNET_FAUCET_LINK } from "@/lib"; import { bn } from "fuels"; import { useEffect, useState } from "react"; import toast from "react-hot-toast"; @@ -50,36 +51,54 @@ export default function Faucet() { return ( <> -

Local Faucet

- -
- - setReceiverAddress(e.target.value)} - placeholder="0x..." - id="receiver-address-input" - /> -
- -
- - setAmountToSend(e.target.value)} - placeholder="5" - type="number" - id="amount-input" - /> -
- - + {CURRENT_ENVIRONMENT === Environments.LOCAL && ( + <> +

Local Faucet

+ +
+ + setReceiverAddress(e.target.value)} + placeholder="0x..." + id="receiver-address-input" + /> +
+ +
+ + setAmountToSend(e.target.value)} + placeholder="5" + type="number" + id="amount-input" + /> +
+ + + + )} + + {CURRENT_ENVIRONMENT === Environments.TESTNET && ( + <> +