Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/assets/images/check-mark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions src/assets/images/puzzle-piece-1-outline.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions src/assets/images/puzzle-piece-1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
91 changes: 50 additions & 41 deletions src/components/SendTransaction.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import AppLoader from '@/components/AppLoader.vue'
import GasPrice from '@/components/GasPrice.vue'
import SendTransactionCompact from '@/components/SendTransactionCompact.vue'
import SignMessageAdvancedInfo from '@/components/signMessageAdvancedInfo.vue'
import SlideToSolvePuzzle from '@/components/SlideToSolvePuzzle.vue'
import { useAppStore } from '@/store/app'
import useCurrencyStore from '@/store/currencies'
import { useRequestStore } from '@/store/request'
Expand Down Expand Up @@ -55,50 +56,58 @@ function hideLoader() {

onMounted(async () => {
showLoader('Loading...')
try {
const accountHandler = getRequestHandler().getAccountHandler()
if (appStore.chainType === ChainType.solana_cv25519) {
const accountHandler = getRequestHandler().getAccountHandler()
if (appStore.chainType === ChainType.solana_cv25519) {
try {
const data = await (accountHandler as SolanaAccountHandler).getFee(
props.request.request.params[0]
)
} else {
const baseGasPrice = (
await (accountHandler as EVMAccountHandler).provider.getGasPrice()
).toString()
} catch (e) {
console.error(e)
}
} else {
try {
gasLimit.value = (
await (accountHandler as EVMAccountHandler).provider.estimateGas({
...sanitizeRequest(props.request.request).params[0],
})
).toString()
baseFee.value = new Decimal(baseGasPrice)
.div(Decimal.pow(10, 9))
.toString()
} catch (e) {
gasLimit.value = '21000' // default value for ethereum
}
if (props.request.request.params[0].maxFeePerGas) {
customGasPrice.value.maxFeePerGas = new Decimal(
props.request.request.params[0].maxFeePerGas
)
.div(Decimal.pow(10, 9))
.toString()
} else {
customGasPrice.value.maxFeePerGas = new Decimal(baseFee.value)
.add(1.5)
.toString()
}
if (props.request.request.params[0].maxPriorityFeePerGas) {
customGasPrice.value.maxPriorityFeePerGas = new Decimal(
props.request.request.params[0].maxPriorityFeePerGas
)
try {
const baseGasPrice = (
await (accountHandler as EVMAccountHandler).provider.getGasPrice()
).toString()
baseFee.value = new Decimal(baseGasPrice)
.div(Decimal.pow(10, 9))
.toString()
if (props.request.request.params[0].maxFeePerGas) {
customGasPrice.value.maxFeePerGas = new Decimal(
props.request.request.params[0].maxFeePerGas
)
.div(Decimal.pow(10, 9))
.toString()
} else {
customGasPrice.value.maxFeePerGas = new Decimal(baseFee.value)
.add(1.5)
.toString()
}
if (props.request.request.params[0].maxPriorityFeePerGas) {
customGasPrice.value.maxPriorityFeePerGas = new Decimal(
props.request.request.params[0].maxPriorityFeePerGas
)
.div(Decimal.pow(10, 9))
.toString()
}
customGasPrice.value.gasLimit =
props.request.request.params[0].gasLimit || gasLimit.value
handleSetGasPrice(customGasPrice.value)
} catch (err) {
console.log({ err })
} finally {
hideLoader()
}
customGasPrice.value.gasLimit =
props.request.request.params[0].gasLimit || gasLimit.value
handleSetGasPrice(customGasPrice.value)
} catch (err) {
console.log({ err })
} finally {
hideLoader()
}
})

Expand Down Expand Up @@ -299,14 +308,7 @@ function calculateCurrencyValue(value) {
v-if="route.name !== 'PermissionRequest'"
class="mt-auto flex flex-col gap-4"
>
<div v-if="request.requestOrigin === 'auth-verify'">
<button
class="btn-secondary p-2 uppercase w-full text-sm font-bold"
@click="emits('proceed')"
>
Proceed
</button>
</div>
<SlideToSolvePuzzle v-if="appStore.global" @solved="emits('approve')" />
<div v-else class="flex gap-2">
<button
class="btn-secondary p-2 uppercase w-full text-sm font-bold"
Expand All @@ -325,8 +327,15 @@ function calculateCurrencyValue(value) {
v-if="
route.name === 'requests' && appStore.validAppMode === AppMode.Full
"
class="flex items-center justify-center"
class="flex items-center justify-evenly"
>
<button
v-if="appStore.global"
class="btn-tertiary text-sm font-bold"
@click="emits('reject')"
>
Reject
</button>
<button
class="btn-tertiary text-sm font-bold"
@click.stop="requestStore.skipRequest(request.request.id)"
Expand Down
13 changes: 11 additions & 2 deletions src/components/SendTransactionCompact.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Decimal } from 'decimal.js'
import { computed, onMounted } from 'vue'
import { useRoute } from 'vue-router'

import SlideToSolvePuzzle from '@/components/SlideToSolvePuzzle.vue'
import { useAppStore } from '@/store/app'
import useCurrencyStore from '@/store/currencies'
import { useParentConnectionStore } from '@/store/parentConnection'
Expand Down Expand Up @@ -140,7 +141,8 @@ async function onViewDetails() {
</button>
</div>
<div class="flex flex-col gap-4">
<div class="flex gap-2 text-sm font-bold">
<SlideToSolvePuzzle v-if="appStore.global" @solved="emits('approve')" />
<div v-else class="flex gap-2 text-sm font-bold">
<button
class="uppercase w-full btn-secondary p-2"
@click="emits('reject')"
Expand All @@ -158,8 +160,15 @@ async function onViewDetails() {
v-if="
route.name === 'requests' && appStore.validAppMode === AppMode.Full
"
class="flex items-center justify-center"
class="flex items-center justify-evenly"
>
<button
v-if="appStore.global"
class="btn-tertiary text-sm font-bold"
@click="emits('reject')"
>
Reject
</button>
<button
class="btn-tertiary text-sm font-bold"
@click.stop="requestStore.skipRequest(request.request.id)"
Expand Down
Loading