@instadapp/avocado-base 0.0.88 → 0.0.90
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/metadata/Swap.vue +22 -29
- package/package.json +1 -1
|
@@ -8,17 +8,15 @@ const props = defineProps<{
|
|
|
8
8
|
const compact = inject('compact');
|
|
9
9
|
const tokens = inject<ITokenPrice[]>('tokens');
|
|
10
10
|
|
|
11
|
-
const buyToken = asyncComputed(() =>
|
|
12
|
-
{
|
|
11
|
+
const buyToken = asyncComputed(() => {
|
|
13
12
|
if (Array.isArray(tokens) && !tokens.length) return null;
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
return fetchTokenByAddress(props.metadata?.buyToken, props?.chain_id, tokens)
|
|
14
|
+
}
|
|
16
15
|
);
|
|
17
|
-
const sellToken = asyncComputed(() =>
|
|
18
|
-
{
|
|
16
|
+
const sellToken = asyncComputed(() => {
|
|
19
17
|
if (Array.isArray(tokens) && !tokens.length) return null;
|
|
20
|
-
return
|
|
21
|
-
|
|
18
|
+
return fetchTokenByAddress(props.metadata?.sellToken, props?.chain_id, tokens)
|
|
19
|
+
}
|
|
22
20
|
);
|
|
23
21
|
|
|
24
22
|
const sellAmountFormatted = computed(() =>
|
|
@@ -49,26 +47,21 @@ const formatProtocol = (protocol: string) => {
|
|
|
49
47
|
|
|
50
48
|
<template>
|
|
51
49
|
<div v-if="!sellToken || !buyToken" class="rounded-5 w-24 h-4 loading-box" />
|
|
52
|
-
<div
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
<span class="
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
<
|
|
65
|
-
|
|
66
|
-
class="capitalize hidden sm:flex items-center gap-2.5"
|
|
67
|
-
v-if="metadata.protocol && !compact"
|
|
68
|
-
>
|
|
69
|
-
On <ProtocolLogo class="w-5 h-5" :name="metadata.protocol" />
|
|
70
|
-
{{ formatProtocol(metadata.protocol) }}
|
|
71
|
-
</span>
|
|
50
|
+
<div class="flex items-center gap-5" v-else>
|
|
51
|
+
<span v-if="!compact" class="capitalize text-xs sm:text-sm">{{ metadata.type }}</span>
|
|
52
|
+
<span class="inline-flex gap-2.5 items-center">
|
|
53
|
+
<img width="20" height="20" class="w-5 h-5" :src="sellToken?.logo_url" />
|
|
54
|
+
{{ sellAmountFormatted }}
|
|
55
|
+
<span class="uppercase">{{ sellToken?.symbol }}</span>
|
|
56
|
+
<SvgoRefresh class="w-4 h-4 text-slate-400 mx-2" />
|
|
57
|
+
<img width="20" height="20" class="w-5 h-5" :src="buyToken?.logo_url" />
|
|
58
|
+
~ {{ buyAmountFormatted }}
|
|
59
|
+
<span class="uppercase">{{ buyToken?.symbol }}</span>
|
|
60
|
+
<span class="capitalize hidden sm:flex items-center gap-2.5" v-if="metadata.protocol && !compact">
|
|
61
|
+
On
|
|
62
|
+
<ProtocolLogo class="w-5 h-5" :name="metadata.protocol" />
|
|
63
|
+
{{ formatProtocol(metadata.protocol) }}
|
|
72
64
|
</span>
|
|
73
|
-
</
|
|
65
|
+
</span>
|
|
66
|
+
</div>
|
|
74
67
|
</template>
|