Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Auto teleport V1 #7711

Merged
merged 130 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
130 commits
Select commit Hold shift + click to select a range
c55e671
add: basic hasEnough and hasEnoughInOtherChains
hassnian Oct 17, 2023
62fbc85
Merge branch 'main' into issue-7643
hassnian Oct 17, 2023
68cd4d9
add: basic auto teleport modal
hassnian Oct 18, 2023
5cd3054
ref: teleport to composables
hassnian Oct 18, 2023
74e389f
add: transaction steps
hassnian Oct 19, 2023
34786b8
add: action transaction
hassnian Oct 20, 2023
e0251d3
add: checking funds step
hassnian Oct 21, 2023
4f67599
fix: tootltip text alignment
hassnian Oct 22, 2023
429fa59
add: teleport transaction fee
hassnian Oct 22, 2023
b8b8e80
fix: teleport fee
hassnian Oct 22, 2023
a95e170
add: show modal action button
hassnian Oct 22, 2023
0059a72
add: check if add teleport fee
hassnian Oct 22, 2023
9566d14
add: welcome to auto teleport modal
hassnian Oct 23, 2023
f7d8a6b
ref: modal width
hassnian Oct 23, 2023
e60382f
ref: clean up
hassnian Oct 23, 2023
3912f3b
add: auto teleport not available state
hassnian Oct 23, 2023
33122bf
add: auto telport icon
hassnian Oct 23, 2023
0e6ad73
fix typo
hassnian Oct 23, 2023
c3290d8
fix: teleport switch states
hassnian Oct 23, 2023
b25b5d5
add: retry transactino and added spinner animation
hassnian Oct 23, 2023
1141333
styles: spinner animation
hassnian Oct 23, 2023
2dc0ab8
fix: retry state step item styles
hassnian Oct 23, 2023
f1dcc57
ref: added useAutoTeleportTransitionSource
hassnian Oct 24, 2023
9408254
ref: move composables to folder
hassnian Oct 24, 2023
bc4c442
add: rmrk2 to kusama
hassnian Oct 24, 2023
0f868b4
fix: bugs and cleanup
hassnian Oct 24, 2023
3f7acaa
ref: rename status to transactions
hassnian Oct 24, 2023
2176c79
fix: deepscan issue
hassnian Oct 24, 2023
5f85a0b
fix: sync amount to teleport while needed
hassnian Oct 25, 2023
fb49e38
add: action fee
hassnian Oct 25, 2023
f1f3ef6
fix: teleport button states
hassnian Oct 25, 2023
6940c61
fix: missing return
hassnian Oct 25, 2023
f83adc0
ref: rename
hassnian Oct 25, 2023
f9fa422
add: local amount and action
hassnian Oct 25, 2023
09c1b75
fix: auto teleport can do action
hassnian Oct 25, 2023
58ca5a8
add: transalations
hassnian Oct 25, 2023
f8e71f4
ref: rename isError
hassnian Oct 26, 2023
bc32e82
ref: move max to utils
hassnian Oct 26, 2023
d044811
add: action cancelled state
hassnian Oct 26, 2023
26f096e
add: action retry
hassnian Oct 26, 2023
53df283
ref: auto teleport watch
hassnian Oct 26, 2023
50ac6ad
add: has balance state
hassnian Oct 26, 2023
66cb44a
ref: rename useAutoTeleportTransitionDetails
hassnian Oct 26, 2023
9416a41
ref: added getNativeBalance
hassnian Oct 26, 2023
cee92cd
fix: fetch chains balances
hassnian Oct 27, 2023
679fe75
fix: auto teleport icon not reactive sometimes
hassnian Oct 28, 2023
c666d36
Merge branch 'main' into issue-7643
hassnian Oct 28, 2023
ee18f12
ref: move usemultibalance to useMiltipleBalance
hassnian Oct 28, 2023
52e41c0
ref: unify muliple balance
hassnian Oct 28, 2023
04e67a3
ref: move TransactionStepStatus to utils
hassnian Oct 28, 2023
8f3dcfc
Merge branch 'main' into issue-7643
hassnian Oct 28, 2023
8456f96
Merge branch 'issue-7643' of https://github.com/hassnian/nft-gallery …
hassnian Oct 28, 2023
3a57961
add: action details
hassnian Oct 28, 2023
0bab064
add: utils transaltion
hassnian Oct 28, 2023
c79c459
Merge branch 'main' into issue-7643
hassnian Oct 29, 2023
e813ee4
add: modal fix paddings and added missing text
hassnian Oct 29, 2023
b59a655
fix: lint fiat store
hassnian Oct 29, 2023
6ef4faa
add: real action tx fee
hassnian Oct 29, 2023
1e1b0d5
ref: getActionTransactionFee and fix fee
hassnian Oct 29, 2023
3173dd8
fix: fee buffer
hassnian Oct 29, 2023
de908a0
add: action details
hassnian Oct 29, 2023
b3940b1
fix: added existential deposit
hassnian Oct 29, 2023
f4f901c
fix: no async promise
hassnian Oct 29, 2023
68ab430
fix: current chain trasnferable balance
hassnian Oct 29, 2023
079e5c9
remove: loader
hassnian Oct 29, 2023
3077ddc
add: auto teleport turned on by default
hassnian Oct 30, 2023
0321752
fix: blur effect not centered
hassnian Oct 30, 2023
850f087
fix: auto teleport blur
hassnian Oct 30, 2023
45ca8f6
fix: welcome modal blur
hassnian Oct 30, 2023
18d85f1
fix: tooltip color
hassnian Oct 30, 2023
0942b23
fix: welcome title is size 25px
hassnian Oct 30, 2023
afba844
fix: remove placeholder quotes
hassnian Oct 30, 2023
fabc269
fix: helper text align
hassnian Oct 30, 2023
09fc705
fix: spinner grey and loading on signed with autoteleport
hassnian Oct 30, 2023
e17aa61
fix: auto telport modal scroll
hassnian Oct 31, 2023
9422265
fix: is active state for steps
hassnian Oct 31, 2023
6e088d1
fix: clear modal on close
hassnian Oct 31, 2023
f432f09
styles: subheading font size change
hassnian Oct 31, 2023
f99457c
fix: add back notEnoughFuns
hassnian Oct 31, 2023
798f39c
fix: dont refetch balances if present
hassnian Oct 31, 2023
bd027f2
Merge branch 'main' into issue-7643
hassnian Oct 31, 2023
8877ba0
ref: multiple actions buy
hassnian Nov 1, 2023
166835f
ref: use new autoteleport actions listing
hassnian Nov 1, 2023
208e30c
Merge branch 'main' into issue-7643
hassnian Nov 1, 2023
ff82c7f
Merge branch 'main' into issue-7643
hassnian Nov 2, 2023
0669c5d
add: create nft autoteleport
hassnian Nov 3, 2023
79fa379
add: create collection
hassnian Nov 3, 2023
f0fd2df
ref: types fixes
hassnian Nov 4, 2023
f3c724f
ref: move types to file
hassnian Nov 4, 2023
5aedd0b
fix: step item active
hassnian Nov 4, 2023
df9aa47
fix: added back cancelled transactions
hassnian Nov 5, 2023
93214ba
add: header based on actions
hassnian Nov 5, 2023
3496a05
fix: fees and transition change
hassnian Nov 5, 2023
0243991
fix: types
hassnian Nov 5, 2023
54f2711
fix: proxy error
hassnian Nov 5, 2023
3c10dce
fix: auto teleport mint
hassnian Nov 6, 2023
6f6183f
ref: is cancelled
hassnian Nov 6, 2023
3e3aea9
add: map ref types
hassnian Nov 6, 2023
fa314c2
add: loading and state update collection mint
hassnian Nov 6, 2023
8c0f458
fix: utils types fix
hassnian Nov 6, 2023
b58376f
fix: mint collection loader
hassnian Nov 6, 2023
4583e45
ref: similar types
hassnian Nov 6, 2023
45c1786
Merge branch 'main' into issue-7643
hassnian Nov 6, 2023
d95bc75
ref: use optional chain
hassnian Nov 6, 2023
8bc724e
fix: mint less fees issue
hassnian Nov 6, 2023
81dae8f
ref: buy actions
hassnian Nov 6, 2023
fc4817c
fix: actions completed
hassnian Nov 6, 2023
0c5353a
remove: hasTransitionBalances
hassnian Nov 6, 2023
21d4a6d
fix: max by value
hassnian Nov 7, 2023
f7c6d4b
fix: fetch balance taking too long
hassnian Nov 7, 2023
8667611
ref: use button text addFundsViaOnramp
hassnian Nov 7, 2023
69064a0
add: teleport fetch balances
hassnian Nov 7, 2023
39039f1
styles: mobile responsive modals
hassnian Nov 7, 2023
8130638
fix: teleport loading not ending
hassnian Nov 7, 2023
82cc510
add: block number link
hassnian Nov 7, 2023
fedb630
fix: balance fetch interval
hassnian Nov 7, 2023
5771492
fix: autoTeleportStarted state
hassnian Nov 7, 2023
bc2ec4e
fix: deepscan issue
hassnian Nov 7, 2023
5e33efe
Merge branch 'main' into issue-7643
hassnian Nov 8, 2023
35491e1
fix: pr review changes
hassnian Nov 9, 2023
d3ac178
fix: listing issue
hassnian Nov 9, 2023
4c2f249
ref: pr review handle close
hassnian Nov 9, 2023
7043eb9
fix: unnecessary await
hassnian Nov 9, 2023
a1cd273
ref: added ActionsInteractions
hassnian Nov 9, 2023
2e34ac9
ref: auto close delay as prop
hassnian Nov 9, 2023
7ffa2e1
fix: use real mint fees
hassnian Nov 9, 2023
9fe6d3f
Merge branch 'main' into issue-7643
hassnian Nov 9, 2023
a401d58
fix: add status
hassnian Nov 9, 2023
e36c479
Revert "fix: use real mint fees"
hassnian Nov 9, 2023
bf629cf
Merge branch 'main' into issue-7643
hassnian Nov 9, 2023
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
112 changes: 3 additions & 109 deletions components/balance/MultipleBalances.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,40 +59,20 @@

<script setup lang="ts">
import { storeToRefs } from 'pinia'
import { ApiPromise, WsProvider } from '@polkadot/api'
import { decodeAddress, encodeAddress } from '@polkadot/util-crypto'
import { CHAINS, ENDPOINT_MAP } from '@kodadot1/static'
import { NeoSkeleton } from '@kodadot1/brick'
import { balanceOf } from '@kodadot1/sub-api'
import format, { formatNumber } from '@/utils/format/balance'
import { useFiatStore } from '@/stores/fiat'
import { calculateExactUsdFromToken } from '@/utils/calculation'
import { getAssetIdByAccount } from '@/utils/api/bsx/query'
import { toDefaultAddress } from '@/utils/account'
import { formatNumber } from '@/utils/format/balance'

import { ChainToken, useIdentityStore } from '@/stores/identity'
import type { PalletBalancesAccountData } from '@polkadot/types/lookup'

const { accountId } = useAuth()
const { isTestnet } = usePrefix()
const refetchMultipleBalanceTimer = ref()
const identityStore = useIdentityStore()
const { fetchMultipleBalance, currentNetwork } = useMultiBalance()

const {

Check failure on line 71 in components/balance/MultipleBalances.vue

View workflow job for this annotation

GitHub Actions / runner / eslint

[eslint] reported by reviewdog 🐶 Replace `⏎··multiBalances,⏎··multiBalanceNetwork,⏎` with `·multiBalances,·multiBalanceNetwork·` Raw Output: {"ruleId":"prettier/prettier","severity":2,"message":"Replace `⏎··multiBalances,⏎··multiBalanceNetwork,⏎` with `·multiBalances,·multiBalanceNetwork·`","line":71,"column":8,"nodeType":null,"messageId":"replace","endLine":74,"endColumn":1,"fix":{"range":[2192,2233],"text":" multiBalances, multiBalanceNetwork "}}
multiBalances,
multiBalanceAssets,
multiBalanceAssetsTestnet,
multiBalanceNetwork,
} = storeToRefs(identityStore)

const networkToPrefix = {
polkadot: 'dot',
kusama: 'ksm',
basilisk: 'bsx',
kusamaHub: 'ahk',
'basilisk-testnet': 'snek',
polkadotHub: 'ahp',
}

const isBalanceLoading = computed(
() => identityStore.getStatusMultiBalances === 'loading',
)
Expand All @@ -113,92 +93,6 @@
filterEmptyBalanceChains(multiBalances.value.chains[chain]).length !== 0,
)
})
const currentNetwork = computed(() =>
isTestnet.value ? 'test-network' : 'main-network',
)

const fiatStore = useFiatStore()
function calculateUsd(amount: string, token = 'KSM') {
if (!amount) {
return 0
}

const amountToNumber = Number(amount.replace(/\,/g, ''))

return calculateExactUsdFromToken(
amountToNumber,
Number(fiatStore.getCurrentTokenValue(token)),
)
}

async function getBalance(chainName: string, token = 'KSM', tokenId = 0) {
const currentAddress = accountId.value
const prefix = networkToPrefix[chainName]
const chain = CHAINS[prefix]

const defaultAddress = toDefaultAddress(currentAddress)
const publicKey = decodeAddress(currentAddress)
const prefixAddress = encodeAddress(publicKey, chain.ss58Format)
const wsProvider = new WsProvider(ENDPOINT_MAP[prefix])

const api = await ApiPromise.create({
provider: wsProvider,
})

let currentBalance
let nativeBalance

if (tokenId) {
nativeBalance = (
(await api.query.tokens.accounts(
prefixAddress,
tokenId,
)) as PalletBalancesAccountData
).free.toString()
currentBalance = format(nativeBalance, chain.tokenDecimals, false)
} else {
nativeBalance = await balanceOf(api, prefixAddress)
currentBalance = format(nativeBalance, chain.tokenDecimals, false)
}

let selectedTokenId = String(tokenId)
if (chainName === 'basilisk') {
selectedTokenId = await getAssetIdByAccount(api, prefixAddress)
}

const usd = calculateUsd(currentBalance, token)

identityStore.setMultiBalances({
address: defaultAddress,
chains: {
[chainName]: {
[token.toLowerCase()]: {
address: prefixAddress,
balance: currentBalance,
nativeBalance,
usd,
selected: selectedTokenId === String(tokenId),
},
},
},
chainName,
})

identityStore.multiBalanceNetwork = currentNetwork.value

await wsProvider.disconnect()
}

const fetchMultipleBalance = async () => {
await fiatStore.fetchFiatPrice()
const assets = isTestnet.value
? multiBalanceAssetsTestnet.value
: multiBalanceAssets.value

assets.forEach((item) => {
getBalance(item.chain, item.token, Number(item.tokenId))
})
}

onMounted(async () => {
if (currentNetwork.value !== multiBalanceNetwork.value) {
Expand Down
90 changes: 90 additions & 0 deletions components/common/autoTeleport/AutoTeleportActionButton.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@

Check failure on line 1 in components/common/autoTeleport/AutoTeleportActionButton.vue

View workflow job for this annotation

GitHub Actions / runner / eslint

[eslint] reported by reviewdog 🐶 Delete `⏎` Raw Output: {"ruleId":"prettier/prettier","severity":2,"message":"Delete `⏎`","line":1,"column":1,"nodeType":null,"messageId":"delete","endLine":2,"endColumn":1,"fix":{"range":[0,1],"text":""}}
<template>
<div class="is-flex is-flex-direction-column w-full">

Check failure on line 3 in components/common/autoTeleport/AutoTeleportActionButton.vue

View workflow job for this annotation

GitHub Actions / runner / eslint

[eslint] reported by reviewdog 🐶 Delete `··` Raw Output: {"ruleId":"prettier/prettier","severity":2,"message":"Delete `··`","line":3,"column":1,"nodeType":null,"messageId":"delete","endLine":3,"endColumn":3,"fix":{"range":[12,14],"text":""}}

Check failure on line 4 in components/common/autoTeleport/AutoTeleportActionButton.vue

View workflow job for this annotation

GitHub Actions / runner / eslint

[eslint] reported by reviewdog 🐶 Replace `⏎········<div·class="is-flex·is-justify-content-space-between·w-full·mb-4"` with `····<div⏎······class="is-flex·is-justify-content-space-between·w-full·mb-4"⏎·····` Raw Output: {"ruleId":"prettier/prettier","severity":2,"message":"Replace `⏎········<div·class=\"is-flex·is-justify-content-space-between·w-full·mb-4\"` with `····<div⏎······class=\"is-flex·is-justify-content-space-between·w-full·mb-4\"⏎·····`","line":4,"column":1,"nodeType":null,"messageId":"replace","endLine":5,"endColumn":74,"fix":{"range":[70,144],"text":" <div\n class=\"is-flex is-justify-content-space-between w-full mb-4\"\n "}}
<div class="is-flex is-justify-content-space-between w-full mb-4" v-if="allowAutoTeleport">
<div class="is-flex">

Check failure on line 6 in components/common/autoTeleport/AutoTeleportActionButton.vue

View workflow job for this annotation

GitHub Actions / runner / eslint

[eslint] reported by reviewdog 🐶 Delete `······` Raw Output: {"ruleId":"prettier/prettier","severity":2,"message":"Delete `······`","line":6,"column":7,"nodeType":null,"messageId":"delete","endLine":6,"endColumn":13,"fix":{"range":[177,183],"text":""}}
<p class="has-text-weight-bold">{{$t('autoTeleport.autoTeleport')}}</p>

Check failure on line 7 in components/common/autoTeleport/AutoTeleportActionButton.vue

View workflow job for this annotation

GitHub Actions / runner / eslint

[eslint] reported by reviewdog 🐶 Replace `················<p·class="has-text-weight-bold">{{$t('autoTeleport.autoTeleport')}}</p>` with `········<p·class="has-text-weight-bold">⏎··········{{·$t('autoTeleport.autoTeleport')·}}` Raw Output: {"ruleId":"prettier/prettier","severity":2,"message":"Replace `················<p·class=\"has-text-weight-bold\">{{$t('autoTeleport.autoTeleport')}}</p>` with `········<p·class=\"has-text-weight-bold\">⏎··········{{·$t('autoTeleport.autoTeleport')·}}`","line":7,"column":1,"nodeType":null,"messageId":"replace","endLine":7,"endColumn":88,"fix":{"range":[205,292],"text":" <p class=\"has-text-weight-bold\">\n {{ $t('autoTeleport.autoTeleport') }}"}}

Check failure on line 8 in components/common/autoTeleport/AutoTeleportActionButton.vue

View workflow job for this annotation

GitHub Actions / runner / eslint

[eslint] reported by reviewdog 🐶 Trailing spaces not allowed. Raw Output: {"ruleId":"no-trailing-spaces","severity":2,"message":"Trailing spaces not allowed.","line":8,"column":1,"nodeType":"Program","messageId":"trailingSpace","endLine":8,"endColumn":17,"fix":{"range":[293,309],"text":""}}

Check failure on line 8 in components/common/autoTeleport/AutoTeleportActionButton.vue

View workflow job for this annotation

GitHub Actions / runner / eslint

[eslint] reported by reviewdog 🐶 Replace `········` with `</p>⏎` Raw Output: {"ruleId":"prettier/prettier","severity":2,"message":"Replace `········` with `</p>⏎`","line":8,"column":9,"nodeType":null,"messageId":"replace","endLine":8,"endColumn":17,"fix":{"range":[301,309],"text":"</p>\n"}}
<AutoTeleportTooltip :transition="optimalTransition" />

Check failure on line 9 in components/common/autoTeleport/AutoTeleportActionButton.vue

View workflow job for this annotation

GitHub Actions / runner / eslint

[eslint] reported by reviewdog 🐶 Replace `················` with `········` Raw Output: {"ruleId":"prettier/prettier","severity":2,"message":"Replace `················` with `········`","line":9,"column":1,"nodeType":null,"messageId":"replace","endLine":9,"endColumn":17,"fix":{"range":[310,326],"text":" "}}
</div>

<NeoSwitch
v-model="autoTeleport"
data-testid="auto-teleport-switch" />
</div>

<NeoButton
:label="autoTeleportLabel"
variant="k-accent"
no-shadow
:disabled="localDisabled"
class="is-flex is-flex-grow-1 btn-height"
@click="openAutoTeleportModal"
/>

<div class="is-flex is-justify-content-center mt-4" v-if="allowAutoTeleport">
<span class="has-text-grey">Or</span>

<a class="ml-2" @click="rampActive = true"
>+ {{ $t('addFunds') }} Via Onramp</a
>
</div>
</div>

<AutoTeleportModal
v-model="isModalOpen"
:transition="optimalTransition"
@close="isModalOpen = false"
/>

</template>

<script setup lang="ts">
import { NeoButton , NeoSwitch } from '@kodadot1/brick'

const props = defineProps<{
amount: number,
label: string
}>()

const isModalOpen = ref(false)
const rampActive = ref(false)
const { chainSymbol , name } = useChain()
const autoTeleport = ref(false)
const {hasEnoughInCurrentChain, hasEnoughInRichestChain, optimalTransition } = useAutoTeleport(computed(() => props.amount))

const allowAutoTeleport = computed(() => !hasEnoughInCurrentChain.value)

const autoTeleportLabel = computed(() => {
if (hasEnoughInCurrentChain.value) {
return props.label
}

if (hasEnoughInRichestChain.value) {
if (autoTeleport.value) {
return 'Teleport and confirm purchase'
}
}

return `Not enough “${chainSymbol.value}” on “${name.value}”`
})

const localDisabled = computed(() => {
if (!hasEnoughInRichestChain.value || !autoTeleport.value) {
return true
}

return false
})

const openAutoTeleportModal = () => {
isModalOpen.value = true
}


</script>

<style scoped>

</style>
109 changes: 109 additions & 0 deletions components/common/autoTeleport/AutoTeleportModal.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
<template>
<NeoModal
:value="isModalActive"
:can-cancel="['outside', 'escape']"
scroll="clip"
class="top"
@close="onClose">

<div class="modal-width">

<header
class="py-5 pl-6 pr-5 is-flex is-justify-content-space-between is-align-items-center border-bottom">

<span class="modal-card-title is-size-6 has-text-weight-bold">
{{ $t('autoTeleport.signTransactions') }}
</span>

<NeoButton
class="py-1 px-2"
variant="text"
no-shadow
icon="xmark"
size="medium"
@click="onClose" />

</header>

<div class="px-6 pt-4">

<ModalIdentityItem />

<p class="py-2" v-dompurify-html="$t('autoTeleport.header', {
chainName: transition.destination.name,
amountFormatted: transition.amountFormatted,
amountUsd: transition.amountUsd,
sourceNetwork: transition.source?.name
})" />

<p>{{ $t('autoTeleport.dontExit') }}</p>

<hr />

<p v-dompurify-html="$t('autoTeleport.tip')"/>
</div>

<div class="is-flex is-justify-content-space-between py-5 px-6">
<NeoButton
:label="btnLabel"
variant="k-accent"
no-shadow
:disabled="false"
class="is-flex is-flex-grow-1 btn-height"
@click="confirm" />
</div>
</div>
</NeoModal>
</template>

<script setup lang="ts">
import { NeoButton, NeoModal } from '@kodadot1/brick'
import { TeleportTransition } from '@/utils/teleport'


const emit = defineEmits(['confirm'])
const props = defineProps<{
modelValue: boolean,
transition: TeleportTransition
}>()

const isModalActive = useVModel(props, 'modelValue')

const btnLabel = computed(() => {
return 'Finish All Steps First'
})


const onClose = () => {
}

const confirm = () => {
emit('confirm')
}

</script>

<style lang="scss" scoped>
@import '@/assets/styles/abstracts/variables';

.top {
z-index: 1000;
}
.shade-border-color {
@include ktheme() {
border-color: theme('k-shade');
}
}
.modal-width {
width: 25rem;
roiLeo marked this conversation as resolved.
Show resolved Hide resolved
}
.btn-height {
roiLeo marked this conversation as resolved.
Show resolved Hide resolved
height: 3.5rem;
}

:deep(.identity-name-font-weight-regular) {
.identity-name {
font-weight: unset !important;
}
}
</style>
47 changes: 47 additions & 0 deletions components/common/autoTeleport/AutoTeleportTooltip.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<template>
<NeoTooltip size="large" position="top" multiline>
<NeoIcon icon="fa-info-circle" pack="fa-regular" class="ml-2" />

<template #content>
<div class="is-flex">
<NeoIcon icon="fa-info-circle" pack="fa-regular" class="mr-2" />

<span>{{ $t('autoTeleport.autoTeleport') }}</span>
</div>

<p>{{ $t('autoTeleport.tooltip.first') }}</p>
<p>{{ $t('autoTeleport.tooltip.second') }}</p>

<p class="has-text-weight-bold">{{ $t('autoTeleport.tooltip.optimalTransferPath') }}</p>

<div v-if="transition?.source" class="w-full">
<div class="is-flex is-justify-items-space-between">
<span>{{ transition.source.name }}</span>

<span> -> </span>

<span>{{ transition.destination.name }} ({{ transition.token }})</span>
</div>

<div class="is-flex is-justify-items-space-between">
<span>{{ $t('amount') }}</span>

<span>{{ transition.amountFormatted }} ~ {{ transition.amountUsd }}</span>
</div>

</div>

</template>
</NeoTooltip>
</template>

<script setup lang="ts">
import { NeoTooltip, NeoIcon } from "@kodadot1/brick"

defineProps<{
transition: TeleportTransition | null
}>()

</script>

<style scoped></style>
Loading
Loading