Skip to content

Commit

Permalink
Merge most recent changes from develop
Browse files Browse the repository at this point in the history
  • Loading branch information
ccali11 committed Jul 12, 2023
2 parents e4ee20f + f58d3b2 commit 8997b15
Show file tree
Hide file tree
Showing 16 changed files with 500 additions and 1,363 deletions.
11 changes: 11 additions & 0 deletions apps/web/public/trustwallet.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 10 additions & 1 deletion apps/web/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
<script lang="ts" setup>
import { RouterView } from 'vue-router'
import DefaultLayout from '@/layouts/default-layout.vue'
import useTxData from '@/mockData/mock_transaction_data'
import { onMounted } from 'vue'
import useUsers from '@/composables/users'
const { mockData } = useTxData()
// Need this to fix initilizing bug between user.ts and ssv.ts
const { user } = useUsers()
onMounted(() => {
mockData()
})
</script>

<template>
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/charts/LineChartJS.vue
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ watch(props, ()=> {
let rgb = hexToRGB(line_chart.data.datasets[i].backgroundColor)
gradient.addColorStop(0, `rgba(${rgb?.r},${rgb?.g},${rgb?.b}, 0.28)`)
gradient.addColorStop(1, 'rgba(0, 0, 0,0)')
gradient.addColorStop(1, 'rgba(0, 0, 0, 0.0)')
line_chart.data.datasets[i].backgroundColor = gradient
}
Expand Down
29 changes: 15 additions & 14 deletions apps/web/src/composables/contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ const totalWalletBalance = ref<BreakdownAmount>({
})

export default function useContracts() {
const { ethersProviderList, getEthersBalance, getEthersBrowserSigner } = useEthers()
const { ethereumUrl, managerAddress, viewsAddress } = useEnvironment()
const { ethersProviderList, getEthersBalance, getEthersBrowserSigner } = useEthers()
const { getEthersLedgerSigner } = useLedger()
const { getCurrentPrice } = usePrice()
const { getEthersTrezorSigner } = useTrezor()
Expand Down Expand Up @@ -172,19 +172,20 @@ export default function useContracts() {
}))
}

async function getStakingRewards() : Promise<BreakdownAmount> {
const addresses = (user.value as UserWithAccounts).accounts.map((account: Account) => account.address) as string[]
const promises = [] as Array<Promise<ethers.BigNumber>>
// TODO: Replace .getUserRewards with actual method that get's rewards OR figure out how to derive rewards
addresses.forEach((address) => {promises.push(manager.connect(provider).getUserRewards(address))})
const stakingRewards = (await Promise.all(promises)).reduce((a, b) => a.add(b))
const stakingRewardsUSD = parseFloat(ethers.utils.formatEther(stakingRewards)) * (await getCurrentPrice({ coin: 'ETH', currency: 'USD' }))
const stakingRewardsETH = parseFloat(ethers.utils.formatEther(stakingRewards))
return {
exchange: stakingRewardsETH.toFixed(2) + ' ETH',
usd: '$ ' + stakingRewardsUSD.toFixed(2)
}
}
// TODO: Replace .getUserRewards with actual method that get's rewards OR figure out how to derive rewards
// async function getStakingRewards() : Promise<BreakdownAmount> {
// const addresses = (user.value as UserWithAccounts).accounts.map((account: Account) => account.address) as string[]
// const promises = [] as Array<Promise<ethers.BigNumber>>
// // TODO: Replace .getUserRewards with actual method that get's rewards OR figure out how to derive rewards
// addresses.forEach((address) => {promises.push(manager.connect(provider).getUserRewards(address))})
// const stakingRewards = (await Promise.all(promises)).reduce((a, b) => a.add(b))
// const stakingRewardsUSD = parseFloat(ethers.utils.formatEther(stakingRewards)) * (await getCurrentPrice({ coin: 'ETH', currency: 'USD' }))
// const stakingRewardsETH = parseFloat(ethers.utils.formatEther(stakingRewards))
// return {
// exchange: stakingRewardsETH.toFixed(2) + ' ETH',
// usd: '$ ' + stakingRewardsUSD.toFixed(2)
// }
// }

async function getTotalWalletBalance() : Promise<BreakdownAmount> {
const promises = [] as Array<Promise<any>>
Expand Down
2 changes: 0 additions & 2 deletions apps/web/src/composables/router.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { createWebHistory, createRouter } from 'vue-router'
import useUsers from '@/composables/users'

/* eslint-disable @typescript-eslint/ban-ts-comment */
import Overview from '@/pages/overview/Overview.vue'
import Test from '@/pages/test/Test.vue'

Expand Down
6 changes: 4 additions & 2 deletions apps/web/src/composables/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ import { Account, AddAccountOptions, ProviderString, RemoveAccountOptions, UserW
import useEnvironment from '@/composables/environment'
import useEthers from './ethers'
import * as Session from 'supertokens-web-js/recipe/session'
import txData from '../mockData/mock_transaction_data.json'
import useTxData from '../mockData/mock_transaction_data'

const { txData } = useTxData()

const { usersUrl } = useEnvironment()

Expand Down Expand Up @@ -250,7 +252,7 @@ export default function useUsers() {

// TODO: Swap this when the API / data is ready
// rawUserAnalytics.value = data
rawUserAnalytics.value = txData
rawUserAnalytics.value = txData.value

setUserAnalytics()
return { error, message, data }
Expand Down
3 changes: 2 additions & 1 deletion apps/web/src/composables/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ const activeWallets = ref([
'WalletConnect',
'Trezor',
'Ledger',
'IoPay',
'TrustWallet',
// 'IoPay',
] as ProviderString[])
const amount = ref<string>('1')
const amountToStake = ref<string>('1.2')
Expand Down
Loading

0 comments on commit 8997b15

Please sign in to comment.