mirror of
https://github.com/Instadapp/assembly.git
synced 2024-07-29 22:37:06 +00:00
handle tx errors
This commit is contained in:
parent
5410695e47
commit
2e740b7ad5
|
@ -109,7 +109,7 @@ export default defineComponent({
|
|||
const { formatNumber, formatUsdMax, formatUsd } = useFormatting()
|
||||
const { isZero, gt, plus } = useBigNumber()
|
||||
const { parseSafeFloat } = useParsing()
|
||||
const { showPendingTransaction } = useNotification()
|
||||
const { showPendingTransaction, showWarning } = useNotification()
|
||||
const { status, displayPositions, liquidation, maxLiquidation, liquidationPrice, liquidationMaxPrice, annualPercentageRateTypes } = useAaveV2Position({
|
||||
overridePosition: (position) => {
|
||||
if (rootTokenKey.value !== position.key) return position
|
||||
|
@ -189,12 +189,16 @@ export default defineComponent({
|
|||
args: [address.value, amount, rateMode, 0, 0],
|
||||
})
|
||||
|
||||
const txHash = await dsa.value.cast({
|
||||
spells,
|
||||
from: account.value,
|
||||
})
|
||||
try {
|
||||
const txHash = await dsa.value.cast({
|
||||
spells,
|
||||
from: account.value,
|
||||
})
|
||||
|
||||
showPendingTransaction(txHash)
|
||||
showPendingTransaction(txHash)
|
||||
} catch (error) {
|
||||
showWarning(error.message)
|
||||
}
|
||||
|
||||
pending.value = false
|
||||
|
||||
|
|
|
@ -122,7 +122,7 @@ export default defineComponent({
|
|||
const { formatNumber, formatUsdMax, formatUsd } = useFormatting()
|
||||
const { isZero, gt, plus, max, minus } = useBigNumber()
|
||||
const { parseSafeFloat } = useParsing()
|
||||
const { showPendingTransaction } = useNotification()
|
||||
const { showPendingTransaction, showWarning } = useNotification()
|
||||
const { status, displayPositions, liquidation, maxLiquidation, liquidationPrice, liquidationMaxPrice, annualPercentageRateTypes } = useAaveV2Position({
|
||||
overridePosition: (position) => {
|
||||
if (rootTokenKey.value !== position.key) return position
|
||||
|
@ -209,12 +209,16 @@ const { showPendingTransaction } = useNotification()
|
|||
args: [address.value, amount, rateMode, 0, 0],
|
||||
})
|
||||
|
||||
const txHash = await dsa.value.cast({
|
||||
spells,
|
||||
from: account.value,
|
||||
})
|
||||
try {
|
||||
const txHash = await dsa.value.cast({
|
||||
spells,
|
||||
from: account.value,
|
||||
})
|
||||
|
||||
showPendingTransaction(txHash)
|
||||
showPendingTransaction(txHash)
|
||||
} catch (error) {
|
||||
showWarning(error.message)
|
||||
}
|
||||
|
||||
pending.value = false
|
||||
|
||||
|
|
|
@ -44,8 +44,10 @@
|
|||
|
||||
<SidebarSectionValueWithIcon class="mt-8" label="Liquidation Price (ETH)">
|
||||
<template #value>
|
||||
{{ formatUsdMax(liquidationPrice, liquidationMaxPrice) }} <span class="text-primary-gray">/
|
||||
{{ formatUsd(liquidationMaxPrice) }}</span>
|
||||
{{ formatUsdMax(liquidationPrice, liquidationMaxPrice) }}
|
||||
<span class="text-primary-gray"
|
||||
>/ {{ formatUsd(liquidationMaxPrice) }}</span
|
||||
>
|
||||
</template>
|
||||
</SidebarSectionValueWithIcon>
|
||||
|
||||
|
@ -92,7 +94,7 @@ export default defineComponent({
|
|||
tokenKey: { type: String, required: true },
|
||||
},
|
||||
setup(props) {
|
||||
const { close} = useSidebar()
|
||||
const { close } = useSidebar()
|
||||
const { networkName, account } = useWeb3()
|
||||
const { dsa } = useDSA()
|
||||
const { getTokenByKey, valInt } = useToken()
|
||||
|
@ -100,7 +102,7 @@ export default defineComponent({
|
|||
const { formatNumber, formatUsdMax, formatUsd } = useFormatting()
|
||||
const { isZero, gt, plus } = useBigNumber()
|
||||
const { parseSafeFloat } = useParsing()
|
||||
const { showPendingTransaction } = useNotification()
|
||||
const { showPendingTransaction, showWarning } = useNotification()
|
||||
const { status, displayPositions, maxLiquidation, liquidationPrice, liquidationMaxPrice } = useAaveV2Position({
|
||||
overridePosition: (position) => {
|
||||
if (rootTokenKey.value !== position.key) return position
|
||||
|
@ -157,12 +159,16 @@ export default defineComponent({
|
|||
args: [address.value, amount, 0, 0],
|
||||
})
|
||||
|
||||
const txHash = await dsa.value.cast({
|
||||
spells,
|
||||
from: account.value,
|
||||
})
|
||||
try {
|
||||
const txHash = await dsa.value.cast({
|
||||
spells,
|
||||
from: account.value,
|
||||
})
|
||||
|
||||
showPendingTransaction(txHash)
|
||||
showPendingTransaction(txHash)
|
||||
} catch (error) {
|
||||
showWarning(error.message)
|
||||
}
|
||||
|
||||
pending.value = false
|
||||
|
||||
|
|
|
@ -6,7 +6,9 @@
|
|||
<template #icon
|
||||
><IconCurrency :currency="rootTokenKey" class="w-20 h-20" noHeight
|
||||
/></template>
|
||||
<template #value>{{ formatNumber(originalBalance) }} {{ symbol }}</template>
|
||||
<template #value
|
||||
>{{ formatNumber(originalBalance) }} {{ symbol }}</template
|
||||
>
|
||||
</SidebarSectionValueWithIcon>
|
||||
|
||||
<div class="bg-[#C5CCE1] bg-opacity-[0.15] mt-10 p-8">
|
||||
|
@ -101,7 +103,7 @@ export default defineComponent({
|
|||
const { formatNumber, formatUsdMax, formatUsd } = useFormatting()
|
||||
const { isZero, gt, plus, max, minus } = useBigNumber()
|
||||
const { parseSafeFloat } = useParsing()
|
||||
const { showPendingTransaction } = useNotification()
|
||||
const { showPendingTransaction, showWarning } = useNotification()
|
||||
const originalBalance = ref('0')
|
||||
const { stats, status, displayPositions, maxLiquidation, liquidationPrice, liquidationMaxPrice } = useAaveV2Position({
|
||||
overridePosition: (position) => {
|
||||
|
@ -176,12 +178,16 @@ export default defineComponent({
|
|||
args: [address.value, amount, 0, 0],
|
||||
})
|
||||
|
||||
const txHash = await dsa.value.cast({
|
||||
spells,
|
||||
from: account.value,
|
||||
})
|
||||
try {
|
||||
const txHash = await dsa.value.cast({
|
||||
spells,
|
||||
from: account.value,
|
||||
})
|
||||
|
||||
showPendingTransaction(txHash)
|
||||
showPendingTransaction(txHash)
|
||||
} catch (error) {
|
||||
showWarning(error.message)
|
||||
}
|
||||
|
||||
pending.value = false
|
||||
|
||||
|
|
|
@ -102,14 +102,14 @@ export default defineComponent({
|
|||
const { formatNumber, formatUsdMax, formatUsd } = useFormatting()
|
||||
const { isZero, gt, div, plus } = useBigNumber()
|
||||
const { parseSafeFloat } = useParsing()
|
||||
const { showPendingTransaction } = useNotification()
|
||||
const { showPendingTransaction, showWarning } = useNotification()
|
||||
|
||||
const tokenId = computed(() => props.tokenId)
|
||||
const tokenKey = computed(() => tokenIdMapping.idToToken[tokenId.value])
|
||||
|
||||
const rootTokenKey = computed(() => ctokens[networkName.value].rootTokens.includes(tokenKey.value) ? tokenKey.value : 'eth')
|
||||
|
||||
const { stats, status: initialStatus,position, displayPositions, liquidation, liquidationPrice, liquidationMaxPrice } = useCompoundPosition({
|
||||
const { stats, status: initialStatus, position, displayPositions, liquidation, liquidationPrice, liquidationMaxPrice } = useCompoundPosition({
|
||||
overridePosition: (position) => {
|
||||
if (tokenId.value !== position.cTokenId) return position
|
||||
|
||||
|
@ -171,12 +171,16 @@ export default defineComponent({
|
|||
args: [tokenId.value, amount, 0, 0],
|
||||
})
|
||||
|
||||
const txHash = await dsa.value.cast({
|
||||
spells,
|
||||
from: account.value,
|
||||
})
|
||||
try {
|
||||
const txHash = await dsa.value.cast({
|
||||
spells,
|
||||
from: account.value,
|
||||
})
|
||||
|
||||
showPendingTransaction(txHash)
|
||||
showPendingTransaction(txHash)
|
||||
} catch (error) {
|
||||
showWarning(error.message)
|
||||
}
|
||||
|
||||
pending.value = false
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@ export default defineComponent({
|
|||
const { formatNumber, formatUsdMax, formatUsd } = useFormatting()
|
||||
const { isZero, gte, plus, max, minus, min } = useBigNumber()
|
||||
const { parseSafeFloat } = useParsing()
|
||||
const { showPendingTransaction } = useNotification()
|
||||
const { showPendingTransaction, showWarning} = useNotification()
|
||||
const tokenId = computed(() => props.tokenId)
|
||||
const tokenKey = computed(() => tokenIdMapping.idToToken[tokenId.value])
|
||||
|
||||
|
@ -188,12 +188,16 @@ export default defineComponent({
|
|||
args: [tokenId.value, amount, 0, 0],
|
||||
})
|
||||
|
||||
const txHash = await dsa.value.cast({
|
||||
spells,
|
||||
from: account.value,
|
||||
})
|
||||
try {
|
||||
const txHash = await dsa.value.cast({
|
||||
spells,
|
||||
from: account.value,
|
||||
})
|
||||
|
||||
showPendingTransaction(txHash)
|
||||
showPendingTransaction(txHash)
|
||||
} catch (error) {
|
||||
showWarning(error.message)
|
||||
}
|
||||
|
||||
pending.value = false
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ export default defineComponent({
|
|||
const { formatNumber, formatUsdMax, formatUsd } = useFormatting()
|
||||
const { isZero, gt, plus } = useBigNumber()
|
||||
const { parseSafeFloat } = useParsing()
|
||||
const { showPendingTransaction } = useNotification()
|
||||
const { showPendingTransaction, showWarning } = useNotification()
|
||||
|
||||
const tokenId = computed(() => props.tokenId)
|
||||
const tokenKey = computed(() => tokenIdMapping.idToToken[tokenId.value])
|
||||
|
@ -169,12 +169,16 @@ export default defineComponent({
|
|||
args: [tokenId.value, amount, 0, 0],
|
||||
})
|
||||
|
||||
const txHash = await dsa.value.cast({
|
||||
spells,
|
||||
from: account.value,
|
||||
})
|
||||
try {
|
||||
const txHash = await dsa.value.cast({
|
||||
spells,
|
||||
from: account.value,
|
||||
})
|
||||
|
||||
showPendingTransaction(txHash)
|
||||
showPendingTransaction(txHash)
|
||||
} catch (error) {
|
||||
showWarning(error.message)
|
||||
}
|
||||
|
||||
pending.value = false
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ export default defineComponent({
|
|||
const { formatNumber, formatUsdMax, formatUsd } = useFormatting()
|
||||
const { isZero, gt, plus, max, minus } = useBigNumber()
|
||||
const { parseSafeFloat } = useParsing()
|
||||
const { showPendingTransaction } = useNotification()
|
||||
const { showPendingTransaction, showWarning } = useNotification()
|
||||
const originalBalance = ref('0')
|
||||
const tokenId = computed(() => props.tokenId)
|
||||
const tokenKey = computed(() => tokenIdMapping.idToToken[tokenId.value])
|
||||
|
@ -111,7 +111,7 @@ export default defineComponent({
|
|||
const rootTokenKey = computed(() => ctokens[networkName.value].rootTokens.includes(tokenKey.value) ? tokenKey.value : 'eth')
|
||||
|
||||
|
||||
const { stats, status,position, displayPositions, liquidation, liquidationPrice, liquidationMaxPrice } = useCompoundPosition({
|
||||
const { stats, status, position, displayPositions, liquidation, liquidationPrice, liquidationMaxPrice } = useCompoundPosition({
|
||||
overridePosition: (position) => {
|
||||
if (tokenId.value !== position.cTokenId) return position
|
||||
originalBalance.value = position.supply
|
||||
|
@ -172,12 +172,16 @@ export default defineComponent({
|
|||
args: [tokenId.value, amount, 0, 0],
|
||||
})
|
||||
|
||||
const txHash = await dsa.value.cast({
|
||||
spells,
|
||||
from: account.value,
|
||||
})
|
||||
try {
|
||||
const txHash = await dsa.value.cast({
|
||||
spells,
|
||||
from: account.value,
|
||||
})
|
||||
|
||||
showPendingTransaction(txHash)
|
||||
showPendingTransaction(txHash)
|
||||
} catch (error) {
|
||||
showWarning(error.message)
|
||||
}
|
||||
|
||||
pending.value = false
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ export default defineComponent({
|
|||
const { formatNumber, formatUsdMax, formatUsd } = useFormatting()
|
||||
const { isZero, gt, div, plus } = useBigNumber()
|
||||
const { parseSafeFloat } = useParsing()
|
||||
const { showPendingTransaction } = useNotification()
|
||||
const { showPendingTransaction, showWarning } = useNotification()
|
||||
|
||||
const amount = ref('')
|
||||
const amountParsed = computed(() => parseSafeFloat(amount.value))
|
||||
|
@ -148,12 +148,16 @@ export default defineComponent({
|
|||
args: [vaultId.value, amount, 0, 0],
|
||||
})
|
||||
|
||||
const txHash = await dsa.value.cast({
|
||||
spells,
|
||||
from: account.value,
|
||||
})
|
||||
try {
|
||||
const txHash = await dsa.value.cast({
|
||||
spells,
|
||||
from: account.value,
|
||||
})
|
||||
|
||||
showPendingTransaction(txHash)
|
||||
showPendingTransaction(txHash)
|
||||
} catch (error) {
|
||||
showWarning(error.message)
|
||||
}
|
||||
|
||||
pending.value = false
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ export default defineComponent({
|
|||
const { formatNumber, formatUsdMax, formatUsd } = useFormatting()
|
||||
const { isZero, gte, plus, max, minus, min } = useBigNumber()
|
||||
const { parseSafeFloat } = useParsing()
|
||||
const { showPendingTransaction } = useNotification()
|
||||
const { showPendingTransaction, showWarning } = useNotification()
|
||||
|
||||
const { debt, collateral, liquidation, liquidationMaxPrice, vaultId, symbol: tokenSymbol } = useMakerdaoPosition()
|
||||
|
||||
|
@ -168,12 +168,16 @@ export default defineComponent({
|
|||
args: [vaultId.value, amount, 0, 0],
|
||||
})
|
||||
|
||||
const txHash = await dsa.value.cast({
|
||||
spells,
|
||||
from: account.value,
|
||||
})
|
||||
try {
|
||||
const txHash = await dsa.value.cast({
|
||||
spells,
|
||||
from: account.value,
|
||||
})
|
||||
|
||||
showPendingTransaction(txHash)
|
||||
showPendingTransaction(txHash)
|
||||
} catch (error) {
|
||||
showWarning(error.message)
|
||||
}
|
||||
|
||||
pending.value = false
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ export default defineComponent({
|
|||
const { formatUsdMax, formatUsd, formatDecimal } = useFormatting()
|
||||
const { plus, isZero } = useBigNumber()
|
||||
const { parseSafeFloat } = useParsing()
|
||||
const { showPendingTransaction } = useNotification()
|
||||
const { showPendingTransaction, showWarning } = useNotification()
|
||||
|
||||
|
||||
const amount = ref('')
|
||||
|
@ -157,12 +157,16 @@ export default defineComponent({
|
|||
})
|
||||
}
|
||||
|
||||
const txHash = await dsa.value.cast({
|
||||
spells,
|
||||
from: account.value,
|
||||
})
|
||||
try {
|
||||
const txHash = await dsa.value.cast({
|
||||
spells,
|
||||
from: account.value,
|
||||
})
|
||||
|
||||
showPendingTransaction(txHash)
|
||||
showPendingTransaction(txHash)
|
||||
} catch (error) {
|
||||
showWarning(error.message)
|
||||
}
|
||||
|
||||
pending.value = false
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ export default defineComponent({
|
|||
const { formatNumber, formatUsdMax, formatUsd } = useFormatting()
|
||||
const { isZero, gt, plus, max, minus } = useBigNumber()
|
||||
const { parseSafeFloat } = useParsing()
|
||||
const { showPendingTransaction } = useNotification()
|
||||
const { showPendingTransaction, showWarning } = useNotification()
|
||||
|
||||
const amount = ref('')
|
||||
const amountParsed = computed(() => parseSafeFloat(amount.value))
|
||||
|
@ -142,12 +142,16 @@ export default defineComponent({
|
|||
args: [vaultId.value, amount, 0, 0],
|
||||
})
|
||||
|
||||
const txHash = await dsa.value.cast({
|
||||
spells,
|
||||
from: account.value,
|
||||
})
|
||||
try {
|
||||
const txHash = await dsa.value.cast({
|
||||
spells,
|
||||
from: account.value,
|
||||
})
|
||||
|
||||
showPendingTransaction(txHash)
|
||||
showPendingTransaction(txHash)
|
||||
} catch (error) {
|
||||
showWarning(error.message)
|
||||
}
|
||||
|
||||
pending.value = false
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user