-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from Kolektivo-Labs/AnotherDev/Add-pools-header
Another dev/add pools header
- Loading branch information
Showing
13 changed files
with
43,356 additions
and
11,968 deletions.
There are no files selected for viewing
31,284 changes: 31,284 additions & 0 deletions
31,284
src/assets/css/animations/Animación carga regenerativa.json
Large diffs are not rendered by default.
Oops, something went wrong.
23,858 changes: 11,914 additions & 11,944 deletions
23,858
src/assets/css/animations/RegenerativeLoadingAnimation.json
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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,16 +1,73 @@ | ||
<script lang="ts" setup> | ||
import AppHero from '@/components/heros/AppHero.vue'; | ||
import usePoolsVolumeQuery from '@/composables/queries/usePoolsVolumeQuery'; | ||
import useNumbers from '@/composables/useNumbers'; | ||
const { data: poolsVolumes, isLoading: isPoolsVolumesLoading } = | ||
usePoolsVolumeQuery(); | ||
const { toFiatLabel } = useNumbers(); | ||
type Props = { | ||
tokensAmount: number; | ||
}; | ||
defineProps<Props>(); | ||
</script> | ||
|
||
|
||
|
||
<template> | ||
<AppHero class="h-44"> | ||
<h1 class="headline" v-text="$t('defiLiquidityPools')" /> | ||
<p class="mt-2 text-xl text-white" v-text="$t('builtOnBalancer')" /> | ||
</AppHero> | ||
<div class="xl:container xl:px-4 pt-10 md:pt-8 xl:mx-auto"> | ||
<div class="flex flex-col lg:flex-row gap-4"> | ||
<BalCard exposeOverflow> | ||
<div class="flex flex-col gap-4"> | ||
<div class="flex flex-row gap-4 justify-center items-center"> | ||
<div | ||
class="py-2 px-3 w-full rounded-md border dark:border-gray-900 shadow-xl" | ||
> | ||
<h4 | ||
v-if="isPoolsVolumesLoading" | ||
class="w-full text-base font-medium whitespace-nowrap" | ||
> | ||
TVL: ~$ -- | ||
</h4> | ||
<h4 v-else class="w-full text-base font-medium whitespace-nowrap"> | ||
TVL: ~{{ toFiatLabel(poolsVolumes?.totalLiquidity) }} | ||
</h4> | ||
</div> | ||
<div | ||
class="py-2 px-3 w-full rounded-md border dark:border-gray-900 shadow-xl" | ||
> | ||
<h4 | ||
v-if="isPoolsVolumesLoading" | ||
class="w-full text-base font-medium whitespace-nowrap" | ||
> | ||
Volume: ~$ -- | ||
</h4> | ||
<h4 v-else class="w-full text-base font-medium whitespace-nowrap"> | ||
Volume: ~{{ toFiatLabel(poolsVolumes?.totalVolume) }} | ||
</h4> | ||
</div> | ||
</div> | ||
<p> | ||
There are currently {{ tokensAmount }} tokens listed. | ||
<a class="underline underline-offset-2" href="#">View all tokens</a> | ||
or | ||
<a class="underline underline-offset-2" href="#"> | ||
request a new token listing. | ||
</a> | ||
</p> | ||
</div> | ||
</BalCard> | ||
<BalCard growContent> | ||
<div class="flex flex-col justify-between items-start w-full h-full"> | ||
<h4>How pools function</h4> | ||
<p> | ||
Liquidity Providers add It is a long established fact that a reader | ||
will be distracted by the readable content of a page when looking at | ||
its layout. The point of using Lorem Ipsum is that it has. | ||
</p> | ||
<a class="underline underline-offset-2" href="#">Learn more</a> | ||
</div> | ||
</BalCard> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<style> | ||
.headline { | ||
@apply text-white text-center text-4xl md:text-5xl pb-2 font-display font-normal; | ||
} | ||
</style> |
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { balancerSubgraphService } from '@/services/balancer/subgraph/balancer-subgraph.service'; | ||
import { useQuery } from '@tanstack/vue-query'; | ||
import useNetwork from '../useNetwork'; | ||
import QUERY_KEYS from '@/constants/queryKeys'; | ||
|
||
export default function usePoolsVolumeQuery() { | ||
const { networkId } = useNetwork(); | ||
|
||
const getPoolsVolumesQueryFn = async () => { | ||
try { | ||
const { balancers: volumes } = | ||
await balancerSubgraphService.balancers.get(); | ||
return { | ||
totalLiquidity: volumes[0].totalLiquidity, | ||
totalVolume: volumes[0].totalSwapVolume, | ||
}; | ||
} catch (error) { | ||
console.error('Error fetching TVL:', error); | ||
throw error; | ||
} | ||
}; | ||
const getPoolsVolumesQueryKey = reactive( | ||
QUERY_KEYS.Balancers.Pools(networkId) | ||
); | ||
|
||
return useQuery(getPoolsVolumesQueryKey, getPoolsVolumesQueryFn); | ||
} |
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
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
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
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
19 changes: 19 additions & 0 deletions
19
src/services/balancer/subgraph/entities/balancers/index.ts
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import Service from '../../balancer-subgraph.service'; | ||
import queryBuilder from './query'; | ||
import { QueryBuilder } from '@/types/subgraph'; | ||
|
||
export default class Balancers { | ||
service: Service; | ||
query: QueryBuilder; | ||
|
||
constructor(service: Service, query: QueryBuilder = queryBuilder) { | ||
this.service = service; | ||
this.query = query; | ||
} | ||
|
||
public async get(args = {}, attrs = {}): Promise<any> { | ||
const query = this.query(args, attrs); | ||
const balancers = await this.service.client.get(query); | ||
return balancers; | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
src/services/balancer/subgraph/entities/balancers/query.ts
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { merge } from 'lodash'; | ||
|
||
const defaultArgs = {}; | ||
const defaultAttrs = { | ||
totalLiquidity: true, | ||
totalSwapVolume: true, | ||
}; | ||
|
||
export default (args = {}, attrs = {}) => ({ | ||
balancers: { | ||
__args: merge({}, defaultArgs, args), | ||
...merge({}, defaultAttrs, attrs), | ||
}, | ||
}); |
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