From f9ec7249f4a96c2891d00461b72b36bf1856969d Mon Sep 17 00:00:00 2001 From: GussevPM Date: Wed, 26 Feb 2025 19:38:25 +0100 Subject: [PATCH 1/7] init --- components/modals/StakingModal.vue | 2 +- pages/faucet.vue | 321 +++++++++++++++++++++++++++++ 2 files changed, 322 insertions(+), 1 deletion(-) create mode 100644 pages/faucet.vue diff --git a/components/modals/StakingModal.vue b/components/modals/StakingModal.vue index 29fc3ae9..b6cd3217 100644 --- a/components/modals/StakingModal.vue +++ b/components/modals/StakingModal.vue @@ -210,7 +210,7 @@ watch( } if (cacheStore.current.validator) { - address.value = cacheStore.current.validator.address + address.value = cacheStore.current.validator.address?.hash } nextTick(() => { diff --git a/pages/faucet.vue b/pages/faucet.vue new file mode 100644 index 00000000..458319f6 --- /dev/null +++ b/pages/faucet.vue @@ -0,0 +1,321 @@ + + + + + From 85856450f3cde9a0363dd03fc9467d10cbd96c9e Mon Sep 17 00:00:00 2001 From: GussevPM Date: Sat, 1 Mar 2025 21:45:39 +0100 Subject: [PATCH 2/7] Add faucet --- assets/icons.json | 4 +- components/modals/SendModal.vue | 1 - pages/calculators/savings.vue | 698 ++++++++++++++++---------------- pages/faucet.vue | 697 ++++++++++++++++++++++--------- services/api/faucet.js | 29 ++ services/config.js | 3 +- 6 files changed, 899 insertions(+), 533 deletions(-) create mode 100644 services/api/faucet.js diff --git a/assets/icons.json b/assets/icons.json index 8812e206..46b82e57 100644 --- a/assets/icons.json +++ b/assets/icons.json @@ -200,5 +200,7 @@ "line-chart": "M3.5,18.5L9.5,12.5L13.5,16.5L22,6.92L20.59,5.5L13.5,13.5L9.5,9.5L2,17L3.5,18.5Z", "bar-chart": "M3,22V8H7V22H3M10,22V2H14V22H10M17,22V14H21V22H17Z", "gantt-chart": "M2,5H10V2H12V22H10V18H6V15H10V13H4V10H10V8H2V5M14,5H17V8H14V5M14,10H19V13H14V10M14,15H22V18H14V15Z", - "crown": "M5 16L3 5L8.5 10L12 4L15.5 10L21 5L19 16H5M19 19C19 19.6 18.6 20 18 20H6C5.4 20 5 19.6 5 19V18H19V19Z" + "crown": "M5 16L3 5L8.5 10L12 4L15.5 10L21 5L19 16H5M19 19C19 19.6 18.6 20 18 20H6C5.4 20 5 19.6 5 19V18H19V19Z", + "drop": "M12 18C12 18.7 12.12 19.36 12.34 20C12.23 20 12.12 20 12 20C8.69 20 6 17.31 6 14C6 10 12 3.25 12 3.25S16.31 8.1 17.62 12C16.93 12.06 16.28 12.22 15.67 12.47C15 10.68 13.5 8.33 12 6.39C10 8.96 8 12.23 8 14C8 16.21 9.79 18 12 18M19 17V14H17V17H14V19H17V22H19V19H22V17H19Z", + "faucet": "M21 21H3C3 19.9 3.9 19 5 19H19C20.11 19 21 19.89 21 21M19 7C19 5.39 17.93 3 15 3S11 5.39 11 7V18H13V7C13 6.54 13.17 5 15 5S17 6.54 17 7H16.5V9H19.5V7H19M7 12C6.45 12 6 12.45 6 13V14H3V15H6V18H8V13C8 12.45 7.55 12 7 12M21 14H18V13C18 12.45 17.55 12 17 12S16 12.45 16 13V18H18V15H21V14Z" } diff --git a/components/modals/SendModal.vue b/components/modals/SendModal.vue index 3440aa35..367f575c 100644 --- a/components/modals/SendModal.vue +++ b/components/modals/SendModal.vue @@ -10,7 +10,6 @@ import Button from "@/components/ui/Button.vue" /** API */ import { search } from "@/services/api/search" -import { fetchAddressByHash } from "@/services/api/address" /** Services */ import amp from "@/services/amp" diff --git a/pages/calculators/savings.vue b/pages/calculators/savings.vue index 6d5e7a92..3a776a37 100644 --- a/pages/calculators/savings.vue +++ b/pages/calculators/savings.vue @@ -304,414 +304,424 @@ useHead({ @@ -721,6 +731,10 @@ useHead({ padding: 20px 24px 60px 24px; } +.breadcrumbs { + margin-bottom: 16px; +} + .left { } diff --git a/pages/faucet.vue b/pages/faucet.vue index 458319f6..0f4e8da0 100644 --- a/pages/faucet.vue +++ b/pages/faucet.vue @@ -1,6 +1,10 @@ - - +const fillValidation = (type, title) => { + if (type && title) { + validation.value = { + type, + title, + } + } else { + validation.value = {} + } +} - diff --git a/services/api/faucet.js b/services/api/faucet.js new file mode 100644 index 00000000..4975a187 --- /dev/null +++ b/services/api/faucet.js @@ -0,0 +1,29 @@ +/** Services */ +import { faucetURL } from "@/services/config" + +export const faucetAddress = "celestia16etnwjxg6dsjuavjpr9tk822czfeylfm9f7x5g" + +export const fetchBalance = async () => { + try { + const data = await useFetch(`${faucetURL}/balance`) + return data + } catch (error) { + console.error(error) + } +} + +export const executeFaucet = async (address) => { + try { + + const data = await useFetch(`${faucetURL}/faucet`, { + method: "post", + body: { + address, + }, + }) + + return data + } catch (error) { + console.error(error) + } +} diff --git a/services/config.js b/services/config.js index 34d066bc..97280b7e 100644 --- a/services/config.js +++ b/services/config.js @@ -107,5 +107,6 @@ export const getStartChainDate = () => { } } -export const tvlServiceURL = "https://tvl.celenium.io/v1" export const blockscoutURL = "https://celestia-l2-router.k8s-dev.blockscout.com/api/v1/celestia/l2BatchMetadata" +export const faucetURL = "https://api-faucet.celenium.io/v1" +export const tvlServiceURL = "https://tvl.celenium.io/v1" From 640003048fd2849d29fe1c761d949367dd6452e4 Mon Sep 17 00:00:00 2001 From: GussevPM Date: Sat, 1 Mar 2025 21:53:54 +0100 Subject: [PATCH 3/7] Add faucet to cmd menu and navigation --- components/LeftSidebar.vue | 9 +++++++-- components/cmd/CommandMenu.vue | 9 +++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/components/LeftSidebar.vue b/components/LeftSidebar.vue index cc34e8ce..19b8d3a5 100644 --- a/components/LeftSidebar.vue +++ b/components/LeftSidebar.vue @@ -127,6 +127,11 @@ const modularLinks = reactive([ const isToolsLinkCollapsed = ref(false) const toolsLinks = reactive([ + { + icon: "drop", + name: "Faucet", + path: "/faucet", + }, { icon: "blob", name: "Blobstream", @@ -351,9 +356,9 @@ const handleNavigate = (url) => { .group_title { border-radius: 5px; - cursor: default; + cursor: pointer; - padding: 4px 6px; + padding: 6px 6px; margin: 0 2px; transition: all 0.2s ease; diff --git a/components/cmd/CommandMenu.vue b/components/cmd/CommandMenu.vue index 52c19ed2..cf664c20 100644 --- a/components/cmd/CommandMenu.vue +++ b/components/cmd/CommandMenu.vue @@ -291,6 +291,15 @@ const rawNavigationActions = [ router.push("/calculators/savings") }, }, + { + type: "callback", + icon: "arrow-narrow-right", + title: "Go to Faucet", + runText: "Open Faucet", + callback: () => { + router.push("/faucet") + }, + }, { type: "callback", icon: "arrow-narrow-right", From 73da6ed18b26c15939245d6814b7825be358cc3d Mon Sep 17 00:00:00 2001 From: GussevPM Date: Sat, 1 Mar 2025 22:24:46 +0100 Subject: [PATCH 4/7] Add faucet to adv --- components/shared/AdvBanner.vue | 6 +++++- services/constants/advertising.js | 9 +++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/components/shared/AdvBanner.vue b/components/shared/AdvBanner.vue index eea02784..fa816677 100644 --- a/components/shared/AdvBanner.vue +++ b/components/shared/AdvBanner.vue @@ -17,11 +17,15 @@ const props = defineProps({ }, }) +const router = useRouter() + const adv = ref({}) const isDisplayed = ref(true) const handleClick = () => { - if (adv.value.link) { + if (adv.value.internalLink) { + router.push(adv.value.internalLink) + } else if (adv.value.link) { window.open(adv.value.link, '_blank') } else if (adv.value.modal) { modalsStore.open(adv.value.modal) diff --git a/services/constants/advertising.js b/services/constants/advertising.js index ff9eaee1..5f5d210e 100644 --- a/services/constants/advertising.js +++ b/services/constants/advertising.js @@ -15,6 +15,15 @@ const advertisements = [ header: 'Celenium survey', body: 'Please take 5 minutes of your time and answer a few questions.', footer: 'Take the survey', + weight: 1.1, + }, + { + name: 'faucet', + internalLink: '/faucet', + icon: 'drop', + header: 'Celenium Faucet', + body: 'Free testnet TIA for the Celestia Mocha network!', + footer: 'Get Tokens', weight: 0.3, }, { From 7fbe3ef3505fe6db9f12b7149f3c6693c68301ed Mon Sep 17 00:00:00 2001 From: GussevPM Date: Sun, 2 Mar 2025 11:45:09 +0100 Subject: [PATCH 5/7] Fixiki --- components/widgets/StakingWidget.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/widgets/StakingWidget.vue b/components/widgets/StakingWidget.vue index 76ce59e3..8d02694d 100644 --- a/components/widgets/StakingWidget.vue +++ b/components/widgets/StakingWidget.vue @@ -19,12 +19,12 @@ const wrapperEl = ref(null) const wrapperWidth = ref(0) const barWidth = computed(() => Math.round(wrapperWidth.value - 32)) -const totalSupply = computed(() => lastHead.value.total_supply / 1_000_000) +const totalSupply = computed(() => lastHead.value?.total_supply / 1_000_000) const totalSupplyUSD = computed(() => totalSupply.value * currentPrice.value?.close) -const totalVotingPower = computed(() => lastHead.value.total_voting_power) +const totalVotingPower = computed(() => lastHead.value?.total_voting_power) const totalVotingPowerUSD = computed(() => totalVotingPower.value * currentPrice.value?.close) -const bondedShare = computed(() => shareOfTotal(lastHead?.value.total_voting_power * 1_000_000, lastHead?.value.total_supply, 2)) +const bondedShare = computed(() => shareOfTotal(lastHead.value?.total_voting_power * 1_000_000, lastHead.value?.total_supply, 2)) const isRefetching = ref(false) const totalValidators = ref(0) From a057e6b3ac1d5933b8846fc53d5a69fe912596b7 Mon Sep 17 00:00:00 2001 From: GussevPM Date: Sun, 2 Mar 2025 12:21:17 +0100 Subject: [PATCH 6/7] Fix runner animation --- pages/faucet.vue | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/pages/faucet.vue b/pages/faucet.vue index 0f4e8da0..04bfca22 100644 --- a/pages/faucet.vue +++ b/pages/faucet.vue @@ -207,6 +207,10 @@ watch( ) await refreshFaucetBalance() +onMounted(() => { + const transferEl = document.getElementById("transferWindow") + document.documentElement.style.setProperty('--runner-distance', `${transferEl.clientWidth}px`) +})