-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5fc6336
commit 6301325
Showing
1 changed file
with
34 additions
and
1 deletion.
There are no files selected for viewing
35 changes: 34 additions & 1 deletion
35
site/src/routes/blog/start-of-the-endgame/SepoliaFaucetButton.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,34 @@ | ||
<div class="bg-black">Show link to sepolia faucet</div> | ||
<script> | ||
import { ethereumAddress } from '$lib/stores/wallets' | ||
import { get } from "svelte/store"; | ||
import TerminalContainer from "$lib/TerminalContainer.svelte"; | ||
import DemoButton from '$lib/DemoButton.svelte'; | ||
let message = "Copy address"; | ||
const faucetAddress ="https://sepoliafaucet.com/" | ||
function copy() { | ||
let address = get(ethereumAddress); | ||
if (address == null) { | ||
return | ||
} | ||
navigator.clipboard.writeText(address); | ||
message = "Copied" | ||
} | ||
function goToFaucet() { | ||
window.open(faucetAddress, "_blank"); | ||
} | ||
</script> | ||
|
||
<TerminalContainer> | ||
{#if !$ethereumAddress == null} | ||
Connect Metamask to continue | ||
{:else} | ||
<div>Ethereum Address: <span class="text-accent">{$ethereumAddress}</span></div> | ||
<DemoButton on:click={copy}> | ||
{message} | ||
</DemoButton> | ||
<DemoButton on:click={goToFaucet}>Open Sepolia faucet</DemoButton> | ||
{/if} | ||
</TerminalContainer> |