Skip to content

Commit

Permalink
Update, stake card
Browse files Browse the repository at this point in the history
  • Loading branch information
DemogorGod committed Mar 28, 2023
1 parent 5708326 commit 5ef3ab9
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 24 deletions.
1 change: 1 addition & 0 deletions apps/landing/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import Scrambler from '@/components/Scrambler.vue'
</div>
<div class="flex flex-col justify-center items-end gap-[25px]">
<div class="flex gap-[3px]">
<!-- , 'Permissionless.', 'Any wallet.' -->
<Scrambler
:phrases="['No minimum amount.', 'Maximum staking rewards.', 'Your keys, your coins.']"
:repeat="true"
Expand Down
45 changes: 21 additions & 24 deletions apps/web/src/pages/dashboard/components/Stake.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,41 @@ const stakingStatus = ref({
const app = ref(null as any)
// Helpers
async function getFees() {
try {
const fees = await getDepositFees()
if (fees % 1 === 0) {
return `${fees}.00%`
}
return `${fees}%`
} catch (err){
console.error(err)
return 'Error connecting to SSV network. Please try again momentarily.'
}
}
// Toggles
const toggleSelectWalletModal = (on: boolean, e: any) => {
if(openSelectWalletTab.value && on){
if(e.target.id === ''){
openSelectWalletTab.value = false
}
}
}
const toggleSignTransactionModal = (on: boolean, e: any) => {
if(openSelectWalletTab.value && on){
if(e.target.id === ''){
openSelectWalletTab.value = false
}
}
}
const selectWallet = (wallet: any) => {
selectedWallet.value = wallet
openSelectWalletTab.value = false
}
// Watchers
watch(openSelectWalletTab, () => {
// console.log(openSelectWalletTab.value)
if(openSelectWalletTab.value){
Expand All @@ -54,7 +73,6 @@ watch(openSelectWalletTab, () => {
app.value.removeEventListener('click', (e) => {toggleSelectWalletModal(false, e)})
}
})
watch(openSignTransactionTab, () => {
// console.log(openSelectWalletTab.value)
if(openSignTransactionTab.value){
Expand All @@ -63,18 +81,11 @@ watch(openSignTransactionTab, () => {
app.value.removeEventListener('click', (e) => {toggleSignTransactionModal(false, e)})
}
})
const selectWallet = (wallet: any) => {
selectedWallet.value = wallet
openSelectWalletTab.value = false
}
watch(selectedWallet, () => {
if(selectedWallet.value){
maxETHFromWallet.value = Number(convertToWholeUnits(selectedWallet.value.currency, Number(selectedWallet.value.balance)))
}
})
watch([stakeAmount, selectedWallet], () => {
if(stakeAmount.value && maxETHFromWallet.value) {
if(stakeAmount.value > maxETHFromWallet.value){
Expand All @@ -90,30 +101,16 @@ watch([stakeAmount, selectedWallet], () => {
stakingStatus.value.message = 'Select wallet, then select amount to stake.'
}
})
watch(isMaxETHSelected, () => {
stakeAmount.value = maxETHFromWallet.value
})
// checks if a valid number since we want it to be a text input
watch(stakeAmount, () => {
if(isNaN(stakeAmount.value)){
stakeAmount.value = 0
}
})
async function getFees() {
try {
const fees = await getDepositFees()
if (fees % 1 === 0) {
return `${fees}.00%`
}
return `${fees}%`
} catch (err){
console.error(err)
return 'Error connecting to SSV network. Please try again momentarily.'
}
}
// Action Handlers
const handleConfirm = async () => {
// loading.value = true
// await deposit({ amount: stakeAmount.value.toString(), walletProvider: selectedWallet.value.walletProvider })
Expand Down

0 comments on commit 5ef3ab9

Please sign in to comment.