Skip to content

Commit f69b38a

Browse files
Request faucet top-up on low balance (#135)
1 parent b49448a commit f69b38a

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

.github/workflows/deploy.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ env:
2020
RUSTC_WRAPPER: sccache
2121
CC: sccache clang
2222
CXX: sccache clang++
23+
FAUCET_TOPUP_REQ_URL: '${{ vars.FAUCET_TOPUP_REQ_URL }}'
2324

2425
jobs:
2526
deploy:

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929

3030
### Added
3131

32+
- [#135] (https://github.com/ChainSafe/forest-explorer/pull/135) Added link to
33+
request for faucet top-up which is configurable using github env var.
34+
3235
### Changed
3336

3437
### Removed

src/faucet/views.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,11 @@ pub fn Faucet(target_network: Network) -> impl IntoView {
4040
);
4141

4242
let (fading_messages, set_fading_messages) = signal(HashSet::new());
43-
43+
let drip_amount = match target_network {
44+
Network::Mainnet => crate::constants::MAINNET_DRIP_AMOUNT.clone(),
45+
Network::Testnet => crate::constants::CALIBNET_DRIP_AMOUNT.clone(),
46+
};
47+
let topup_req_url = option_env!("FAUCET_TOPUP_REQ_URL");
4448
view! {
4549
{move || {
4650
let errors = faucet.get().get_error_messages();
@@ -137,6 +141,12 @@ pub fn Faucet(target_network: Network) -> impl IntoView {
137141
{format!("Rate-limited! {duration}s")}
138142
</button>
139143
}.into_any()
144+
} else if faucet.get().get_faucet_balance() < drip_amount {
145+
view! {
146+
<a href={topup_req_url} target="_blank" class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded-r">
147+
"Request Faucet Top-up"
148+
</a>
149+
}.into_any()
140150
} else {
141151
view! {
142152
<button

0 commit comments

Comments
 (0)