Skip to content
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
2 changes: 1 addition & 1 deletion internal/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func (s *Server) Handler() http.Handler {
r.URL.Path = "/web/"
static.ServeHTTP(w, r)
})
for _, name := range []string{"app.js", "app.css", "sei.svg"} {
for _, name := range []string{"app.js", "app.css", "sei.svg", "lateral-regular.woff2", "lateral-bold.woff2", "items-text.woff2", "repro-mono.woff2"} {
mux.HandleFunc("GET /"+name, func(w http.ResponseWriter, r *http.Request) {
r.URL.Path = "/web/" + name
static.ServeHTTP(w, r)
Expand Down
6 changes: 5 additions & 1 deletion internal/api/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,11 @@ func TestPage(t *testing.T) {
!strings.Contains(w.Header().Get("Content-Security-Policy"), "frame-ancestors 'none'") {
t.Fatalf("index: %d %v", w.Code, w.Header())
}
for path, kind := range map[string]string{"/app.js": "javascript", "/app.css": "css", "/sei.svg": "svg"} {
for path, kind := range map[string]string{
"/app.js": "javascript", "/app.css": "css", "/sei.svg": "svg",
"/lateral-regular.woff2": "font/woff2", "/lateral-bold.woff2": "font/woff2",
"/items-text.woff2": "font/woff2", "/repro-mono.woff2": "font/woff2",
} {
if w := h.do("GET", path, ""); w.Code != http.StatusOK || !strings.Contains(w.Header().Get("Content-Type"), kind) {
t.Fatalf("%s: %d %s", path, w.Code, w.Header().Get("Content-Type"))
}
Expand Down
247 changes: 130 additions & 117 deletions internal/api/web/app.css

Large diffs are not rendered by default.

13 changes: 10 additions & 3 deletions internal/api/web/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,19 @@ function busy(on) {

function validate() {
const v = $("address").value.trim();
$("field").dataset.state = !v ? "" : ADDRESS.test(v) ? "valid" : "invalid";
return ADDRESS.test(v);
const valid = ADDRESS.test(v);
const invalid = Boolean(v) && !valid;
$("field").dataset.state = !v ? "" : valid ? "valid" : "invalid";
$("address").setAttribute("aria-invalid", String(invalid));
$("hint").textContent = invalid ? "Enter a valid address: 0x followed by 40 hex characters."
: valid ? "Valid EVM address. You're ready to request SEI."
: "Enter an EVM address: 0x + 40 hex characters.";
return valid;
}

async function load() {
info = await (await fetch("/api/info")).json();
document.title = `${info.chainName} faucet`;
$("title").textContent = `${info.chainName} faucet`;
$("network").textContent = info.chainName;
$("amount").textContent = `${sei(info.amountWei)} SEI`;
$("cooldown").textContent = `1 per ${info.addressCooldownSeconds / 3600}h`;
Expand Down Expand Up @@ -99,6 +104,8 @@ $("form").onsubmit = async (e) => {
e.preventDefault();
if (!validate()) {
$("field").dataset.state = "invalid";
$("address").setAttribute("aria-invalid", "true");
$("hint").textContent = "Enter a valid address: 0x followed by 40 hex characters.";
$("address").focus();
show("");
return;
Expand Down
41 changes: 24 additions & 17 deletions internal/api/web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,37 +10,36 @@
<script src="/app.js" defer></script>
</head>
<body>
<a class="skip-link" href="#form">Skip to faucet</a>
<header class="bar">
<a class="brand" href="/"><svg class="lockup light" role="img" aria-label="Sei" viewBox="0 0 312 120" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M39.4746 94.8887C35.8709 91.6137 30.3678 91.6134 26.7643 94.8887L18.3619 102.526C18.106 102.759 18.099 103.159 18.3493 103.398C29.143 113.683 43.7664 120 59.8693 120C75.9748 120 90.6018 113.682 101.396 103.395C101.646 103.156 101.639 102.756 101.383 102.523L92.9835 94.8887C89.3799 91.6136 83.8768 91.6136 80.2732 94.8887L73.6955 100.868C65.8581 107.991 53.8895 107.991 46.0523 100.868L39.4746 94.8887ZM59.8693 0C28.5715 4.93622e-05 2.8597 23.8596 0.00351713 54.3445C-0.0468546 54.8821 0.585694 55.1949 0.986042 54.8326L3.17704 52.8494C11.017 45.7531 22.9623 45.7654 30.7877 52.8778L37.3871 58.8754C40.9907 62.1504 46.4938 62.1505 50.0974 58.8754L56.6617 52.9086C64.5066 45.7783 76.4884 45.7858 84.3241 52.9261L94.9485 62.608C95.6833 63.2776 95.7357 64.4158 95.066 65.1505L92.5401 67.9223L90.0142 70.6948C89.3447 71.4294 88.2063 71.4818 87.4717 70.8123L76.8472 61.1313C73.2443 57.8482 67.7348 57.8444 64.1277 61.1229L57.5634 67.0897C49.726 74.213 37.7575 74.2131 29.9202 67.0897L23.3217 61.0921C19.7236 57.822 14.2312 57.816 10.6264 61.0788L0.842874 69.9354C0.690765 70.0731 0.619382 70.2792 0.655057 70.4813C2.17243 79.0752 5.52196 87.0382 10.2881 93.9545C10.4927 94.2514 10.9118 94.2971 11.1787 94.0546L19.2983 86.6743C27.1356 79.551 39.1041 79.551 46.9415 86.6743L53.5191 92.6536C57.1227 95.9286 62.6259 95.9285 66.2295 92.6536L72.8071 86.6743C80.6444 79.5513 92.6122 79.5513 100.45 86.6743L108.564 94.0496C108.831 94.2921 109.25 94.2464 109.455 93.9494C116.106 84.2949 120 72.601 120 59.9996C120 46.9934 115.852 34.954 108.805 25.1259C108.706 24.9875 108.552 24.8976 108.382 24.8845C105.868 24.6902 103.291 25.4982 101.296 27.3114L94.7319 33.2782C86.8945 40.4014 74.926 40.4016 67.0887 33.2782L60.4902 27.2806C56.892 24.0104 51.3997 24.0045 47.7948 27.2672L37.0229 37.0183C36.2859 37.6853 35.1474 37.6285 34.4803 36.8916L31.9628 34.1107L29.4469 31.3307C28.7799 30.5937 28.8366 29.456 29.5735 28.7889L40.3455 19.0379C48.1854 11.9415 60.1308 11.9539 67.9562 19.0662L74.5555 25.0639C78.1591 28.3389 83.6623 28.3389 87.2658 25.0639L93.8302 19.0971C95.4217 17.6505 97.1836 16.4974 99.0465 15.6382C99.45 15.4521 99.5429 14.9098 99.2067 14.6193C88.6622 5.51073 74.9108 0 59.8693 0Z" fill="black"/><path d="M180.224 1.35791C187.332 1.35791 193.417 2.59704 198.479 5.07406C203.649 7.55111 207.526 11.1587 210.111 15.8974C212.803 20.6361 214.149 26.4519 214.149 33.3446V35.2831H195.248V33.3446C195.248 29.8983 194.71 26.9368 193.633 24.4598C192.556 21.9827 190.887 20.0975 188.625 18.8051C186.471 17.4051 183.724 16.7051 180.386 16.7051H178.932C173.978 16.7051 170.155 18.1052 167.462 20.9052C164.878 23.5976 163.585 27.152 163.585 31.5676V32.3753C163.585 34.9601 164.07 37.3299 165.039 39.4839C166.009 41.6377 167.516 43.5763 169.563 45.2994C171.609 46.9148 174.193 48.2071 177.317 49.1764L192.179 54.0226C197.456 55.7458 201.818 58.0079 205.265 60.8081C208.711 63.6082 211.296 67.1082 213.019 71.3083C214.85 75.4008 215.765 80.1936 215.765 85.6862V86.4939C215.765 93.3866 214.365 99.2563 211.565 104.103C208.765 108.841 204.672 112.45 199.288 114.927C194.01 117.404 187.656 118.642 180.224 118.642H178.932C170.316 118.642 163.208 117.296 157.608 114.604C152.115 111.911 148.13 108.088 145.653 103.133C143.176 98.0716 141.938 91.9327 141.938 84.717V82.1323H161V84.717C161 88.7018 161.592 92.0408 162.777 94.7333C163.962 97.4257 165.901 99.5256 168.593 101.033C171.286 102.541 174.786 103.295 179.094 103.295H180.224C183.671 103.295 186.633 102.703 189.11 101.518C191.587 100.226 193.418 98.3949 194.602 96.0256C195.895 93.6562 196.541 90.8557 196.541 87.6247V86.817C196.541 84.0169 196.002 81.54 194.925 79.3861C193.956 77.2321 192.448 75.3469 190.402 73.7314C188.356 72.0084 185.825 70.6622 182.81 69.6929L168.27 65.0082C163.208 63.3927 158.9 61.1312 155.346 58.2234C151.792 55.2079 149.1 51.5996 147.269 47.3994C145.438 43.0915 144.522 38.1911 144.522 32.6984V31.8907C144.522 25.5365 145.869 20.0976 148.561 15.5743C151.362 10.9434 155.346 7.4434 160.516 5.07406C165.685 2.59702 171.824 1.35794 178.932 1.35791H180.224Z" fill="black"/><path fill-rule="evenodd" clip-rule="evenodd" d="M255.618 33.9908C262.403 33.9908 268.004 35.2292 272.419 37.7062C276.943 40.1833 280.282 44.0607 282.436 49.3379C284.59 54.5074 285.666 61.2386 285.667 69.5314V77.286C285.667 78.4707 285.613 79.6554 285.505 80.84H241.079V82.1323C241.079 87.8403 241.563 92.4177 242.533 95.8641C243.502 99.3104 244.957 101.787 246.895 103.295C248.834 104.695 251.364 105.395 254.488 105.395H255.618C258.526 105.395 260.788 104.91 262.404 103.941C264.127 102.864 265.312 101.464 265.958 99.7411C266.712 97.9103 267.088 95.7025 267.089 93.1178V91.664H284.859V92.9563C284.859 98.0179 283.889 102.433 281.951 106.203C280.12 109.972 277.05 112.934 272.742 115.088C268.435 117.242 262.78 118.319 255.78 118.319H254.488C247.487 118.319 241.618 117.027 236.879 114.442C232.14 111.75 228.586 107.657 226.216 102.164C223.847 96.5639 222.662 89.4558 222.662 80.84V71.4699C222.662 62.8541 223.847 55.7998 226.216 50.3072C228.586 44.7068 232.086 40.6141 236.717 38.0293C241.456 35.3369 247.326 33.9908 254.326 33.9908H255.618ZM254.164 46.7533C249.857 46.7533 246.572 48.4226 244.31 51.7611C242.23 54.9858 241.154 60.3708 241.083 67.9159H267.735V65.8159C267.735 61.0772 267.25 57.3074 266.281 54.5073C265.312 51.7073 263.911 49.7149 262.081 48.5302C260.25 47.3455 257.988 46.7533 255.295 46.7533H254.164Z" fill="black"/><path d="M311.615 117.35H293.522V34.96H311.615V117.35Z" fill="black"/><path d="M311.615 22.6828H293.522V4.91252H311.615V22.6828Z" fill="black"/></svg><svg class="lockup dark" role="img" aria-label="Sei" viewBox="0 0 312 120" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M39.4746 94.8887C35.8709 91.6137 30.3678 91.6134 26.7643 94.8887L18.3619 102.526C18.106 102.759 18.099 103.159 18.3493 103.398C29.143 113.683 43.7664 120 59.8693 120C75.9748 120 90.6018 113.682 101.396 103.395C101.646 103.156 101.639 102.756 101.383 102.523L92.9835 94.8887C89.3799 91.6136 83.8768 91.6136 80.2732 94.8887L73.6955 100.868C65.8581 107.991 53.8895 107.991 46.0523 100.868L39.4746 94.8887ZM59.8693 0C28.5715 4.93622e-05 2.8597 23.8596 0.00351713 54.3445C-0.0468546 54.8821 0.585694 55.1949 0.986042 54.8326L3.17704 52.8494C11.017 45.7531 22.9623 45.7654 30.7877 52.8778L37.3871 58.8754C40.9907 62.1504 46.4938 62.1505 50.0974 58.8754L56.6617 52.9086C64.5066 45.7783 76.4884 45.7858 84.3241 52.9261L94.9485 62.608C95.6833 63.2776 95.7357 64.4158 95.066 65.1505L92.5401 67.9223L90.0142 70.6948C89.3447 71.4294 88.2063 71.4818 87.4717 70.8123L76.8472 61.1313C73.2443 57.8482 67.7348 57.8444 64.1277 61.1229L57.5634 67.0897C49.726 74.213 37.7575 74.2131 29.9202 67.0897L23.3217 61.0921C19.7236 57.822 14.2312 57.816 10.6264 61.0788L0.842874 69.9354C0.690765 70.0731 0.619382 70.2792 0.655057 70.4813C2.17243 79.0752 5.52196 87.0382 10.2881 93.9545C10.4927 94.2514 10.9118 94.2971 11.1787 94.0546L19.2983 86.6743C27.1356 79.551 39.1041 79.551 46.9415 86.6743L53.5191 92.6536C57.1227 95.9286 62.6259 95.9285 66.2295 92.6536L72.8071 86.6743C80.6444 79.5513 92.6122 79.5513 100.45 86.6743L108.564 94.0496C108.831 94.2921 109.25 94.2464 109.455 93.9494C116.106 84.2949 120 72.601 120 59.9996C120 46.9934 115.852 34.954 108.805 25.1259C108.706 24.9875 108.552 24.8976 108.382 24.8845C105.868 24.6902 103.291 25.4982 101.296 27.3114L94.7319 33.2782C86.8945 40.4014 74.926 40.4016 67.0887 33.2782L60.4902 27.2806C56.892 24.0104 51.3997 24.0045 47.7948 27.2672L37.0229 37.0183C36.2859 37.6853 35.1474 37.6285 34.4803 36.8916L31.9628 34.1107L29.4469 31.3307C28.7799 30.5937 28.8366 29.456 29.5735 28.7889L40.3455 19.0379C48.1854 11.9415 60.1308 11.9539 67.9562 19.0662L74.5555 25.0639C78.1591 28.3389 83.6623 28.3389 87.2658 25.0639L93.8302 19.0971C95.4217 17.6505 97.1836 16.4974 99.0465 15.6382C99.45 15.4521 99.5429 14.9098 99.2067 14.6193C88.6622 5.51073 74.9108 0 59.8693 0Z" fill="white"/><path d="M180.224 1.35791C187.332 1.35791 193.417 2.59704 198.479 5.07406C203.649 7.55111 207.526 11.1587 210.111 15.8974C212.803 20.6361 214.149 26.4519 214.149 33.3446V35.2831H195.248V33.3446C195.248 29.8983 194.71 26.9368 193.633 24.4598C192.556 21.9827 190.887 20.0975 188.625 18.8051C186.471 17.4051 183.724 16.7051 180.386 16.7051H178.932C173.978 16.7051 170.155 18.1052 167.462 20.9052C164.878 23.5976 163.585 27.152 163.585 31.5676V32.3753C163.585 34.9601 164.07 37.3299 165.039 39.4839C166.009 41.6377 167.516 43.5763 169.563 45.2994C171.609 46.9148 174.193 48.2071 177.317 49.1764L192.179 54.0226C197.456 55.7458 201.818 58.0079 205.265 60.8081C208.711 63.6082 211.296 67.1082 213.019 71.3083C214.85 75.4008 215.765 80.1936 215.765 85.6862V86.4939C215.765 93.3866 214.365 99.2563 211.565 104.103C208.765 108.841 204.672 112.45 199.288 114.927C194.01 117.404 187.656 118.642 180.224 118.642H178.932C170.316 118.642 163.208 117.296 157.608 114.604C152.115 111.911 148.13 108.088 145.653 103.133C143.176 98.0716 141.938 91.9327 141.938 84.717V82.1323H161V84.717C161 88.7018 161.592 92.0408 162.777 94.7333C163.962 97.4257 165.901 99.5256 168.593 101.033C171.286 102.541 174.786 103.295 179.094 103.295H180.224C183.671 103.295 186.633 102.703 189.11 101.518C191.587 100.226 193.418 98.3949 194.602 96.0256C195.895 93.6562 196.541 90.8557 196.541 87.6247V86.817C196.541 84.0169 196.002 81.54 194.925 79.3861C193.956 77.2321 192.448 75.3469 190.402 73.7314C188.356 72.0084 185.825 70.6622 182.81 69.6929L168.27 65.0082C163.208 63.3927 158.9 61.1312 155.346 58.2234C151.792 55.2079 149.1 51.5996 147.269 47.3994C145.438 43.0915 144.522 38.1911 144.522 32.6984V31.8907C144.522 25.5365 145.869 20.0976 148.561 15.5743C151.362 10.9434 155.346 7.4434 160.516 5.07406C165.685 2.59702 171.824 1.35794 178.932 1.35791H180.224Z" fill="white"/><path fill-rule="evenodd" clip-rule="evenodd" d="M255.618 33.9908C262.403 33.9908 268.004 35.2292 272.419 37.7062C276.943 40.1833 280.282 44.0607 282.436 49.3379C284.59 54.5074 285.666 61.2386 285.667 69.5314V77.286C285.667 78.4707 285.613 79.6554 285.505 80.84H241.079V82.1323C241.079 87.8403 241.563 92.4177 242.533 95.8641C243.502 99.3104 244.957 101.787 246.895 103.295C248.834 104.695 251.364 105.395 254.488 105.395H255.618C258.526 105.395 260.788 104.91 262.404 103.941C264.127 102.864 265.312 101.464 265.958 99.7411C266.712 97.9103 267.088 95.7025 267.089 93.1178V91.664H284.859V92.9563C284.859 98.0179 283.889 102.433 281.951 106.203C280.12 109.972 277.05 112.934 272.742 115.088C268.435 117.242 262.78 118.319 255.78 118.319H254.488C247.487 118.319 241.618 117.027 236.879 114.442C232.14 111.75 228.586 107.657 226.216 102.164C223.847 96.5639 222.662 89.4558 222.662 80.84V71.4699C222.662 62.8541 223.847 55.7998 226.216 50.3072C228.586 44.7068 232.086 40.6141 236.717 38.0293C241.456 35.3369 247.326 33.9908 254.326 33.9908H255.618ZM254.164 46.7533C249.857 46.7533 246.572 48.4226 244.31 51.7611C242.23 54.9858 241.154 60.3708 241.083 67.9159H267.735V65.8159C267.735 61.0772 267.25 57.3074 266.281 54.5073C265.312 51.7073 263.911 49.7149 262.081 48.5302C260.25 47.3455 257.988 46.7533 255.295 46.7533H254.164Z" fill="white"/><path d="M311.615 117.35H293.522V34.96H311.615V117.35Z" fill="white"/><path d="M311.615 22.6828H293.522V4.91252H311.615V22.6828Z" fill="white"/></svg></a>
<span class="pill" id="network">Testnet</span>
<a class="docs-link" href="https://docs.sei.io/">Developer docs <span aria-hidden="true">↗</span></a>
</header>
<main class="layout">
<section class="hero">
<p class="kicker">Testnet faucet</p>
<h1>Get testnet SEI in seconds.</h1>
<p class="lede">Fund a wallet to deploy contracts and send transactions on Sei. Testnet tokens have no value.</p>
<ol class="steps">
<li><span>01</span>Paste an EVM address, or fill it from your wallet.</li>
<li><span>02</span>Confirm you are human.</li>
<li><span>03</span>Get SEI once the transfer is confirmed on chain.</li>
</ol>
<p class="kicker"><span aria-hidden="true">/</span> Built for building</p>
<h1>Get testnet SEI.</h1>
<p class="lede">Your next idea starts here. Fund a wallet to deploy contracts and explore the Sei testnet.</p>
<dl class="stats">
<div><dt>Per claim</dt><dd id="amount">–</dd></div>
<div><dt>Limit</dt><dd id="cooldown">–</dd></div>
<div><dt>Claim limit</dt><dd id="cooldown">–</dd></div>
<div><dt>Faucet balance</dt><dd id="balance">–</dd></div>
</dl>
</section>
<section class="card">
<h2 id="title">Sei testnet faucet</h2>
<section class="card" aria-labelledby="title">
<div class="card-heading"><p class="eyebrow">Testnet faucet</p><span class="pill" id="network">Testnet</span></div>
<h2 id="title">Fund your wallet</h2>
<p class="card-copy">Test tokens. Real possibilities.</p>
<form id="form" novalidate>
<label for="address">Your EVM address</label>
<label for="address">Wallet address</label>
<div class="field" id="field">
<input id="address" placeholder="0x…" autocomplete="off" spellcheck="false" required pattern="0x[0-9a-fA-F]{40}" title="0x followed by 40 hex characters" aria-describedby="hint">
<input id="address" placeholder="0x…" autocomplete="off" autocapitalize="none" spellcheck="false" required pattern="0x[0-9a-fA-F]{40}" title="0x followed by 40 hex characters" aria-describedby="hint" aria-invalid="false">
<button class="inline" id="connect" type="button" hidden>Use wallet</button>
</div>
<p class="hint" id="hint">0x followed by 40 hex characters</p>
<p class="hint" id="hint" aria-live="polite">Enter an EVM address: 0x + 40 hex characters.</p>
<div id="captcha"></div>
<button class="primary" id="submit" type="submit"><span class="spinner" aria-hidden="true"></span><span id="submit-label">Request testnet SEI</span></button>
<button class="primary" id="submit" type="submit"><span class="spinner" aria-hidden="true"></span><span id="submit-label">Request testnet SEI</span><span class="button-arrow" aria-hidden="true">↗</span></button>
<p class="testnet-note">For testing only. Testnet SEI has no monetary value.</p>
</form>
<ol class="progress" id="progress" hidden>
<li data-step="queued">Queued</li>
Expand All @@ -54,7 +53,15 @@ <h2 id="title">Sei testnet faucet</h2>
</dl>
<button class="secondary" id="add" type="button" hidden>Add network to wallet</button>
</section>
<section class="guide" aria-labelledby="guide-title">
<h2 id="guide-title">From wallet to testnet.</h2>
<ol class="steps">
<li><span class="step-number">01</span><div><h3>Bring your wallet</h3><p>Paste your EVM address, or use your connected wallet.</p></div></li>
<li><span class="step-number">02</span><div><h3>Make a request</h3><p>Complete the human verification when prompted.</p></div></li>
<li><span class="step-number">03</span><div><h3>Start building</h3><p>Your SEI arrives once the transfer is confirmed on chain.</p></div></li>
</ol>
</section>
</main>
<footer>Experimental · testnet tokens only</footer>
<footer><span>Sei <span class="footer-divider" aria-hidden="true">/</span> Developer faucet</span><span>Experimental · testnet tokens only</span></footer>
</body>
</html>
Binary file added internal/api/web/items-text.woff2
Binary file not shown.
Binary file added internal/api/web/lateral-bold.woff2
Binary file not shown.
Binary file added internal/api/web/lateral-regular.woff2
Binary file not shown.
Binary file added internal/api/web/repro-mono.woff2
Binary file not shown.
Loading