@instadapp/avocado-base 0.1.8 → 0.2.0

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.
@@ -0,0 +1,68 @@
1
+ {
2
+ "files.associations": {
3
+ "*.css": "tailwindcss"
4
+ },
5
+ "editor.quickSuggestions": {
6
+ "strings": true
7
+ },
8
+ "tailwindCSS.experimental.configFile": "tailwind.config.ts",
9
+ "tailwindCSS.experimental.classRegex": [
10
+ [
11
+ "ui:\\s*{([^)]*)\\s*}",
12
+ "[\"'`]([^\"'`]*).*?[\"'`]"
13
+ ],
14
+ [
15
+ "/\\*ui\\*/\\s*{([^;]*)}",
16
+ ":\\s*[\"'`]([^\"'`]*).*?[\"'`]"
17
+ ]
18
+ ],
19
+ "tailwindCSS.classAttributes": [
20
+ "class",
21
+ "className",
22
+ "ui"
23
+ ],
24
+ "editor.tabSize": 2,
25
+ "editor.detectIndentation": false,
26
+ // Enable the ESlint flat config support
27
+ "eslint.useFlatConfig": true,
28
+
29
+ // Disable the default formatter, use eslint instead
30
+ "prettier.enable": false,
31
+ "editor.formatOnSave": false,
32
+
33
+ // Auto fix
34
+ "editor.codeActionsOnSave": {
35
+ "source.fixAll.eslint": "explicit",
36
+ "source.organizeImports": "never"
37
+ },
38
+
39
+ // Silent the stylistic rules in you IDE, but still auto fix them
40
+ "eslint.rules.customizations": [
41
+ { "rule": "style/*", "severity": "off" },
42
+ { "rule": "format/*", "severity": "off" },
43
+ { "rule": "*-indent", "severity": "off" },
44
+ { "rule": "*-spacing", "severity": "off" },
45
+ { "rule": "*-spaces", "severity": "off" },
46
+ { "rule": "*-order", "severity": "off" },
47
+ { "rule": "*-dangle", "severity": "off" },
48
+ { "rule": "*-newline", "severity": "off" },
49
+ { "rule": "*quotes", "severity": "off" },
50
+ { "rule": "*semi", "severity": "off" }
51
+ ],
52
+
53
+ // Enable eslint for all supported languages
54
+ "eslint.validate": [
55
+ "javascript",
56
+ "javascriptreact",
57
+ "typescript",
58
+ "typescriptreact",
59
+ "vue",
60
+ "html",
61
+ "markdown",
62
+ "json",
63
+ "jsonc",
64
+ "yaml",
65
+ "toml"
66
+ ]
67
+ }
68
+
@@ -0,0 +1,3 @@
1
+ <svg width="16" height="11" viewBox="0 0 16 11" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M15 1L5.375 10L1 5.90909" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>
3
+ </svg>
@@ -1,5 +1,12 @@
1
1
  <svg width="16" height="16" viewBox="0 0 16 16" fill="none"
2
2
  xmlns="http://www.w3.org/2000/svg">
3
- <path class="copy-path" d="M14.1145 9.94827C14.1816 8.8779 14.2168 7.76883 14.2168 6.63246C14.2168 6.17207 14.211 5.71616 14.1997 5.26549C14.1917 4.94654 14.0882 4.63658 13.8994 4.37941C13.185 3.40646 12.6153 2.80088 11.6777 2.07698C11.4181 1.87657 11.0995 1.76786 10.7717 1.76072C10.4455 1.75361 10.105 1.75 9.74121 1.75C8.63995 1.75 7.75104 1.78308 6.8319 1.84613C6.04346 1.90021 5.41726 2.5279 5.36787 3.31665C5.30084 4.38702 5.26562 5.49608 5.26562 6.63246C5.26562 7.76883 5.30085 8.8779 5.36787 9.94827C5.41726 10.737 6.04346 11.3647 6.8319 11.4188C7.75104 11.4818 8.63995 11.5149 9.74121 11.5149C10.8425 11.5149 11.7314 11.4818 12.6505 11.4188C13.439 11.3647 14.0652 10.737 14.1145 9.94827Z" stroke="#94A3B8" stroke-width="2"/>
4
- <path class="copy-path" d="M10.6341 12.6834C10.7011 11.613 10.7363 10.5039 10.7363 9.36756C10.7363 8.90717 10.7306 8.45126 10.7192 8.00059C10.7112 7.68165 10.6078 7.37169 10.4189 7.11452C9.70458 6.14157 9.13488 5.53599 8.19725 4.81209C7.93767 4.61167 7.61907 4.50297 7.29121 4.49582C6.96506 4.48872 6.62448 4.48511 6.26074 4.48511C5.15949 4.48511 4.27057 4.51819 3.35143 4.58123C2.56299 4.63531 1.9368 5.26301 1.88741 6.05176C1.82038 7.12213 1.78516 8.23119 1.78516 9.36756C1.78516 10.5039 1.82038 11.613 1.88741 12.6834C1.9368 13.4721 2.56299 14.0998 3.35143 14.1539C4.27057 14.2169 5.15949 14.25 6.26074 14.25C7.362 14.25 8.25091 14.2169 9.17005 14.1539C9.95849 14.0998 10.5847 13.4721 10.6341 12.6834Z" stroke="#94A3B8" stroke-width="2"/>
3
+ <g clip-path="url(#clip0_854_51869)">
4
+ <path d="M13.3333 6H7.33333C6.59695 6 6 6.59695 6 7.33333V13.3333C6 14.0697 6.59695 14.6667 7.33333 14.6667H13.3333C14.0697 14.6667 14.6667 14.0697 14.6667 13.3333V7.33333C14.6667 6.59695 14.0697 6 13.3333 6Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
5
+ <path d="M3.33301 10.0002H2.66634C2.31272 10.0002 1.97358 9.85969 1.72353 9.60964C1.47348 9.35959 1.33301 9.02045 1.33301 8.66683V2.66683C1.33301 2.31321 1.47348 1.97407 1.72353 1.72402C1.97358 1.47397 2.31272 1.3335 2.66634 1.3335H8.66634C9.01996 1.3335 9.3591 1.47397 9.60915 1.72402C9.8592 1.97407 9.99967 2.31321 9.99967 2.66683V3.3335" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
6
+ </g>
7
+ <defs>
8
+ <clipPath id="clip0_854_51869">
9
+ <rect width="16" height="16" fill="white"/>
10
+ </clipPath>
11
+ </defs>
5
12
  </svg>
@@ -3,15 +3,14 @@ const props = defineProps<{
3
3
  metadata: {
4
4
  type: MetadataTypes
5
5
  [key: string]: any
6
- };
7
- chain_id: number | string;
8
- compact?: boolean;
9
- tokens?: ITokenPrice[];
10
- }>();
11
-
12
- provide('compact', props.compact);
13
- provide('tokens', props.tokens);
6
+ }
7
+ chain_id: number | string
8
+ compact?: boolean
9
+ tokens?: ITokenPrice[]
10
+ }>()
14
11
 
12
+ provide('compact', props.compact)
13
+ provide('tokens', props.tokens)
15
14
  </script>
16
15
 
17
16
  <template>
@@ -27,7 +26,7 @@ provide('tokens', props.tokens);
27
26
  Chain Agnostic Payments
28
27
  </div>
29
28
 
30
- <div class="text-left w-fit capitalize" v-if="metadata.type === 'import'">
29
+ <div v-if="metadata.type === 'import'" class="text-left w-fit capitalize">
31
30
  Import from {{ metadata.protocol }} ({{ (formatUsd(fromWei(metadata.valueInUsd, 10))) }})
32
31
  </div>
33
32
 
@@ -45,8 +44,10 @@ provide('tokens', props.tokens);
45
44
  </div>
46
45
  <div v-if="metadata.type === 'auth'" class="self-start capitalize flex gap-3">
47
46
  Authority {{ metadata.remove ? 'Removed' : 'Added' }}:
48
- <a class="text-primary break-all" :href="getExplorerUrl(metadata.chainId, `/address/${metadata.address}`)"
49
- target="_blank">
47
+ <a
48
+ class="text-primary break-all" :href="getExplorerUrl(metadata.chainId, `/address/${metadata.address}`)"
49
+ target="_blank"
50
+ >
50
51
  {{ shortenHash(metadata.address) }}
51
52
  </a>
52
53
  <div class="flex gap-3">
@@ -64,19 +65,24 @@ provide('tokens', props.tokens);
64
65
  {{ metadata?.castDetails }}
65
66
  </div>
66
67
 
67
- <MetadataSigners v-if="metadata.type === 'add-signers' || metadata.type === 'remove-signers'" :metadata="metadata"
68
- :compact="compact" />
68
+ <MetadataSigners
69
+ v-if="metadata.type === 'add-signers' || metadata.type === 'remove-signers'"
70
+ :chain_id="chain_id" :metadata="metadata"
71
+ :compact="compact"
72
+ />
69
73
 
70
74
  <div v-if="metadata.type === 'change-threshold'" class="text-left w-fit">
71
75
  Change Threshold to {{ metadata.count }}
72
76
  </div>
73
77
 
74
- <div v-tippy="{
75
- content: metadata.id,
76
- maxWidth: 'none',
77
- interactive: true,
78
- }" v-if="metadata.type === 'rejection'" class="text-left w-fit">
78
+ <div
79
+ v-if="metadata.type === 'rejection'" v-tippy="{
80
+ content: metadata.id,
81
+ maxWidth: 'none',
82
+ interactive: true,
83
+ }" class="text-left w-fit"
84
+ >
79
85
  {{ shortenHash(metadata.id) }}
80
86
  </div>
81
87
  </div>
82
- </template>
88
+ </template>
@@ -0,0 +1,74 @@
1
+ <script setup lang="ts">
2
+ import type { Address } from 'viem'
3
+
4
+ const props = defineProps<{
5
+ address: Address | string
6
+ hideContact?: boolean
7
+ hideCopy?: boolean
8
+ showFull?: boolean
9
+ to?: string
10
+ }>()
11
+
12
+ const nuxtApp = useNuxtApp()
13
+
14
+ console.log()
15
+
16
+ // @ts-expect-error
17
+ const contacts = computed(() => nuxtApp.$contacts?.value)
18
+
19
+ const contactName = computed(() => {
20
+ if (!contacts?.value)
21
+ return null
22
+
23
+ return contacts.value.find(
24
+ // @ts-expect-error
25
+ contract => contract.address?.toLowerCase() === props.address.toLowerCase(),
26
+ )?.name
27
+ })
28
+
29
+ function onMouseEnter() {
30
+ const elements = document.querySelectorAll(`[data-highlight-target="${props.address}"]`)
31
+
32
+ elements.forEach((element) => {
33
+ element.classList.add('address-active')
34
+ })
35
+ }
36
+
37
+ function onMouseLeave() {
38
+ const elements = document.querySelectorAll(`[data-highlight-target="${props.address}"]`)
39
+
40
+ elements.forEach((element) => {
41
+ element.classList.remove('address-active')
42
+ })
43
+ }
44
+
45
+ const NuxtLink = resolveComponent('NuxtLink')
46
+ </script>
47
+
48
+ <template>
49
+ <div class="flex items-center leading-[1.3339em]">
50
+ <Component
51
+ :is="props.to ? NuxtLink : 'span'"
52
+ v-tippy="{ content: showFull ? undefined : address, maxWidth: 'none', placement: 'bottom' }"
53
+ :external="props.to ? true : undefined"
54
+ :target="props.to ? '_blank' : undefined"
55
+ :to="props.to ? props.to : undefined"
56
+ :class="props.to ? 'text-primary' : ''"
57
+ class="px-1 border border-dashed border-opacity-0 -ml-1 border-yellow-500" :data-highlight-target="address"
58
+ @mouseenter="onMouseEnter" @mouseleave="onMouseLeave"
59
+ >
60
+ {{ showFull ? address : shortenHash(address) }}
61
+ </Component>
62
+ <span v-if="contactName && !hideContact" class="leading-[inherit]">
63
+ ({{ contactName }})
64
+ </span>
65
+ <CopyClipboard v-if="!hideCopy" class="ml-1.5" :text="address" />
66
+ </div>
67
+ </template>
68
+
69
+ <style>
70
+ .address-active {
71
+ @apply border-opacity-100 bg-yellow-500/10;
72
+ border-radius: 0.375rem;
73
+ }
74
+ </style>
@@ -1,50 +1,26 @@
1
1
  <script setup lang="ts">
2
2
  import CopySVG from '../assets/images/icons/copy.svg'
3
- import CheckCircle from '../assets/images/icons/check-circle.svg'
3
+ import CheckSVG from '../assets/images/icons/check-circle.svg'
4
4
 
5
5
  defineProps<{
6
6
  text: string
7
- iconOnly?: boolean
8
- successText?: string
9
7
  }>()
10
8
  const { copy, copied } = useClipboard()
11
- const slots = useSlots()
12
9
  </script>
13
10
 
14
11
  <template>
15
- <button class="text-slate-400 font-semibold inline-flex items-center gap-2.5" @click.stop="copy(text)">
16
- <Transition mode="out-in" name="slide-left">
17
- <span v-if="copied && !iconOnly"> {{ successText || 'Copied' }} </span>
18
- <span v-else-if="slots.content">
19
- <slot name="content" />
20
- </span>
21
- </Transition>
22
-
12
+ <button type="button" class="inline-flex copy-btn" @click.stop="copy(text)">
23
13
  <Transition mode="out-in" name="slide">
24
- <CheckCircle v-if="copied" class="w-4 h-4 shrink-0 dark:text-slate-900 text-white svg-circle" />
25
- <slot v-else-if="slots.copy" name="copy" />
26
- <slot v-else name="copy-icon">
27
- <CopySVG />
28
- </slot>
14
+ <CheckSVG v-if="copied" v-tippy="{ content: 'Copied!' }" class="svg-circle text-slate-850 size-[1em]" />
15
+ <CopySVG v-else v-tippy="{ content: 'Copy Address' }" class="text-slate-400 size-[1em]" />
29
16
  </Transition>
30
17
  </button>
31
18
  </template>
32
19
 
33
20
  <style scoped>
34
- .slide-left-enter-active,
35
- .slide-left-leave-active {
36
- transition: all 0.1s ease-out;
37
- }
38
-
39
- .slide-left-enter-from {
40
- opacity: 0;
41
- transform: translateX(30px);
42
- }
43
-
44
- .slide-left-leave-to {
45
- opacity: 0;
46
- transform: translateX(-30px);
47
- }
21
+ .copy-btn:focus:not(:focus-visible) {
22
+ outline: none;
23
+ }
48
24
 
49
25
  .slide-enter-active,
50
26
  .slide-leave-active {
@@ -55,4 +31,12 @@ const slots = useSlots()
55
31
  .slide-leave-to {
56
32
  opacity: 0;
57
33
  }
34
+
35
+ .svg-circle > path:first-child {
36
+ @apply stroke-gray-400 fill-gray-400;
37
+ }
38
+
39
+ .svg-circle.darker > path:first-child {
40
+ @apply fill-gray-700 stroke-none text-gray-500;
41
+ }
58
42
  </style>
@@ -1,49 +1,52 @@
1
1
  <script setup lang="ts">
2
-
3
2
  const props = defineProps<{
4
- metadata: any;
3
+ metadata: any
5
4
  chain_id: number | string
6
- }>();
5
+ }>()
7
6
 
8
- const compact = inject('compact');
9
- const tokens = inject<ITokenPrice[]>('tokens');
7
+ const compact = inject('compact')
8
+ const tokens = inject<ITokenPrice[]>('tokens')
10
9
 
11
10
  const fromToken = asyncComputed(() => {
12
- if (!props?.chain_id) return null;
11
+ if (!props?.chain_id)
12
+ return null
13
13
 
14
- if (Array.isArray(tokens) && !tokens.length) return null;
14
+ if (Array.isArray(tokens) && !tokens.length)
15
+ return null
15
16
 
16
17
  return fetchTokenByAddress(
17
18
  props.metadata?.fromToken,
18
19
  props?.chain_id,
19
- tokens
20
- );
21
- });
20
+ tokens,
21
+ )
22
+ })
22
23
 
23
24
  const toToken = asyncComputed(() => {
24
- if (!props?.metadata?.toChainId) return null;
25
+ if (!props?.metadata?.toChainId)
26
+ return null
25
27
 
26
- if (Array.isArray(tokens) && !tokens.length) return null;
28
+ if (Array.isArray(tokens) && !tokens.length)
29
+ return null
27
30
 
28
- return fetchTokenByAddress(props.metadata?.toToken, props?.metadata?.toChainId, tokens);
29
- });
31
+ return fetchTokenByAddress(props.metadata?.toToken, props?.metadata?.toChainId, tokens)
32
+ })
30
33
 
31
34
  const formattedToAmount = computed(() =>
32
35
  formatDecimal(
33
- fromWei(props.metadata?.amount, toToken?.value?.decimals).toFixed()
34
- )
35
- );
36
+ fromWei(props.metadata?.amount, toToken?.value?.decimals).toFixed(),
37
+ ),
38
+ )
36
39
  </script>
37
40
 
38
41
  <template>
39
- <div class="h-[60px]" v-if="!fromToken">
42
+ <div v-if="!fromToken" class="h-[60px]">
40
43
  <div class="rounded-5 w-24 h-4 loading-box" />
41
44
  </div>
42
- <div class="flex gap-5 flex-col" v-else>
45
+ <div v-else class="flex gap-5 flex-col">
43
46
  <div class="flex items-center gap-5">
44
47
  <span v-if="!compact" class="capitalize text-xs sm:text-sm">Cross-chain send</span>
45
48
  <span class="inline-flex gap-2.5 items-center">
46
- <img width="20" height="20" class="w-5 h-5" :src="fromToken?.logo_url" />
49
+ <img width="20" height="20" class="w-5 h-5" :src="fromToken?.logo_url">
47
50
  {{ formattedToAmount }}
48
51
  <span class="uppercase">{{ fromToken?.symbol }}</span>
49
52
  </span>
@@ -59,18 +62,12 @@ const formattedToAmount = computed(() =>
59
62
 
60
63
  <span class="flex items-center gap-2.5">
61
64
  <ChainLogo class="w-5" :chain="metadata?.toChainId" />
62
-
63
- <a
64
- target="_blank"
65
- class="text-primary"
66
- :href="
67
- getExplorerUrl(
68
- metadata?.toChainId,
69
- `/address/${metadata.receiver}`
70
- )
71
- "
72
- >{{ shortenHash(metadata.receiver) }}</a
73
- >
65
+ <Address
66
+ :address="metadata.receiver" :to="getExplorerUrl(
67
+ metadata?.toChainId,
68
+ `/address/${metadata.receiver}`,
69
+ )"
70
+ />
74
71
  on
75
72
  <span>{{ chainIdToName(metadata?.toChainId) }}</span>
76
73
  </span>
@@ -1,66 +1,19 @@
1
1
  <script setup lang="ts">
2
- import { Tippy } from 'vue-tippy'
3
- import Info2 from '../../assets/images/icons/info-2.svg'
4
-
5
2
  defineProps<{
3
+ chain_id: number | string
6
4
  metadata: {
7
- type: MetadataTypes,
5
+ type: MetadataTypes
8
6
  [key: string]: any
9
- };
10
- compact?: boolean;
11
- }>();
7
+ }
8
+ compact?: boolean
9
+ }>()
12
10
  </script>
13
11
 
14
12
  <template>
15
- <div class="font-medium">
16
- <div v-if="!compact || metadata.addresses.length < 3" class="flex gap-[14px] flex-wrap items-end">
17
- <p v-if="!compact" class="text-xs"> {{ formatTxType(metadata.type) }} </p>
18
- <div v-for="address of metadata.addresses" :key="address"
19
- class="flex gap-2 rounded-full bg-slate-100 dark:bg-slate-800 justify-start items-center px-2 py-1.5">
20
- <AuthorityAvatar :address="address" class="w-[18px] h-[18px]" />
21
- <Tippy max-width="none" interactive>
22
- <template #default>
23
- <p class="text-xs leading-5 text-slate-500 dark:text-slate-400">
24
- {{ shortenHash(address, compact ? 2 : 4) }}
25
- </p>
26
- </template>
27
- <template #content>
28
- {{ address }}
29
- </template>
30
- </Tippy>
31
- </div>
32
- </div>
33
- <div v-else class="flex gap-2 flex-wrap items-center">
34
- <div v-for="address of [metadata.addresses[0], metadata.addresses[1]].filter(Boolean)" :key="address"
35
- class="flex gap-2 rounded-full bg-slate-100 dark:bg-slate-800 justify-start items-center px-2 py-1.5">
36
- <AuthorityAvatar :address="address" class="w-[18px] h-[18px]" />
37
-
38
- <Tippy max-width="none" interactive>
39
- <template #default>
40
- <p class="text-xs leading-5 text-slate-400">
41
- {{ shortenHash(address, 2) }}
42
- </p>
43
- </template>
44
- <template #content>
45
- {{ address }}
46
- </template>
47
- </Tippy>
48
- </div>
49
-
50
- <Tippy max-width="none" interactive tag="button" content-tag="div" content-class="content-wrapper">
51
- <template #default>
52
- <Info2 class="w-[16px] h-[16px] text-slate-500 rounded-full" />
53
- </template>
54
- <template #content>
55
- <ul class="flex flex-col gap-2.5">
56
- <li v-for="address in metadata.addresses" :key="address"
57
- class="flex text-xs text-slate-400 items-center gap-2.5">
58
- <AuthorityAvatar class="shrink-0 w-5 h-5" :address="address" />
59
- {{ address }}
60
- </li>
61
- </ul>
62
- </template>
63
- </Tippy>
64
- </div>
65
- </div>
13
+ <ul class="flex gap-2 flex-wrap">
14
+ <li v-for="address in metadata.addresses" :key="address" class="flex rounded-2xl gap-2 bg-gray-900 w-fit items-center py-1.5 px-2.5">
15
+ <AuthorityAvatar class="size-5" :address="address" />
16
+ <Address :address="address" />
17
+ </li>
18
+ </ul>
66
19
  </template>
@@ -1,63 +1,62 @@
1
1
  <script setup lang="ts">
2
-
3
2
  const props = defineProps<{
4
- metadata: any;
3
+ metadata: any
5
4
  chain_id: number | string
6
- }>();
5
+ }>()
7
6
 
8
- const compact = inject('compact');
9
- const tokens = inject<ITokenPrice[]>('tokens');
7
+ const compact = inject('compact')
8
+ const tokens = inject<ITokenPrice[]>('tokens')
10
9
 
11
10
  const buyToken = asyncComputed(() => {
12
- if (Array.isArray(tokens) && !tokens.length) return null;
11
+ if (Array.isArray(tokens) && !tokens.length)
12
+ return null
13
13
  return fetchTokenByAddress(props.metadata?.buyToken, props?.chain_id, tokens)
14
- }
15
- );
14
+ },
15
+ )
16
16
  const sellToken = asyncComputed(() => {
17
- if (Array.isArray(tokens) && !tokens.length) return null;
17
+ if (Array.isArray(tokens) && !tokens.length)
18
+ return null
18
19
  return fetchTokenByAddress(props.metadata?.sellToken, props?.chain_id, tokens)
19
- }
20
- );
20
+ },
21
+ )
21
22
 
22
23
  const sellAmountFormatted = computed(() =>
23
24
  formatDecimal(
24
- fromWei(props.metadata?.sellAmount, sellToken?.value?.decimals).toFixed()
25
- )
26
- );
25
+ fromWei(props.metadata?.sellAmount, sellToken?.value?.decimals).toFixed(),
26
+ ),
27
+ )
27
28
 
28
29
  const buyAmountFormatted = computed(() =>
29
30
  formatDecimal(
30
- fromWei(props.metadata?.buyAmount, buyToken?.value?.decimals).toFixed()
31
- )
32
- );
31
+ fromWei(props.metadata?.buyAmount, buyToken?.value?.decimals).toFixed(),
32
+ ),
33
+ )
33
34
 
34
- const formatProtocol = (protocol: string) => {
35
+ function formatProtocol(protocol: string) {
35
36
  return (
36
37
  new Map([
37
- ["1inch-v5", "1inch"],
38
- ["0x-v1", "0x"],
39
- ["paraswap-v5", "Paraswap"],
40
- ["kyber-v1", "Kyber Network"],
38
+ ['1inch-v5', '1inch'],
39
+ ['0x-v1', '0x'],
40
+ ['paraswap-v5', 'Paraswap'],
41
+ ['kyber-v1', 'Kyber Network'],
41
42
  ]).get(protocol) || protocol
42
- );
43
- };
44
-
45
-
43
+ )
44
+ }
46
45
  </script>
47
46
 
48
47
  <template>
49
48
  <div v-if="!sellToken || !buyToken" class="rounded-5 w-24 h-4 loading-box" />
50
- <div class="flex items-center gap-5" v-else>
49
+ <div v-else class="flex items-center gap-5">
51
50
  <span v-if="!compact" class="capitalize text-xs sm:text-sm">{{ metadata.type }}</span>
52
51
  <span class="inline-flex gap-2.5 items-center">
53
- <img width="20" height="20" class="w-5 h-5" :src="sellToken?.logo_url" />
52
+ <img width="20" height="20" class="w-5 h-5" :src="sellToken?.logo_url">
54
53
  {{ sellAmountFormatted }}
55
54
  <span class="uppercase">{{ sellToken?.symbol }}</span>
56
55
  <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" />
56
+ <img width="20" height="20" class="w-5 h-5" :src="buyToken?.logo_url">
58
57
  ~ {{ buyAmountFormatted }}
59
58
  <span class="uppercase">{{ buyToken?.symbol }}</span>
60
- <span class="capitalize hidden sm:flex items-center gap-2.5" v-if="metadata.protocol && !compact">
59
+ <span v-if="metadata.protocol && !compact" class="capitalize hidden sm:flex items-center gap-2.5">
61
60
  On
62
61
  <ProtocolLogo class="w-5 h-5" :name="metadata.protocol" />
63
62
  {{ formatProtocol(metadata.protocol) }}
@@ -1,50 +1,48 @@
1
1
  <script setup lang="ts">
2
-
3
2
  const props = defineProps<{
4
- metadata: any;
3
+ metadata: any
5
4
  chain_id: number | string
6
- }>();
5
+ }>()
7
6
 
8
- const compact = inject('compact');
9
- const tokens = inject<ITokenPrice[]>('tokens');
7
+ const compact = inject('compact')
8
+ const tokens = inject<ITokenPrice[]>('tokens')
10
9
 
11
10
  const token = asyncComputed(() => {
12
- if (!props?.chain_id) return null;
11
+ if (!props?.chain_id)
12
+ return null
13
13
 
14
- if (Array.isArray(tokens) && !tokens.length) return null;
14
+ if (Array.isArray(tokens) && !tokens.length)
15
+ return null
15
16
 
16
17
  return fetchTokenByAddress(
17
18
  props.metadata?.token,
18
19
  props?.chain_id,
19
- tokens
20
- );
21
- });
20
+ tokens,
21
+ )
22
+ })
22
23
 
23
24
  const formattedAmount = computed(() =>
24
25
  formatDecimal(
25
- fromWei(props.metadata?.amount, token?.value?.decimals).toFixed()
26
- )
27
- );
26
+ fromWei(props.metadata?.amount, token?.value?.decimals).toFixed(),
27
+ ),
28
+ )
28
29
  </script>
29
30
 
30
31
  <template>
31
32
  <div v-if="!token" class="rounded-5 w-24 h-4 loading-box" />
32
- <div class="flex items-center gap-5" v-else>
33
+ <div v-else class="flex items-center gap-5">
33
34
  <span v-if="!compact" class="capitalize text-xs sm:text-sm">{{ metadata.type }}</span>
34
35
  <span class="inline-flex gap-2.5 items-center">
35
- {{ formattedAmount }}
36
- <span class="uppercase">{{ token?.symbol }}</span>
37
- <img width="20" height="20" class="w-5 h-5" :src="token?.logo_url" />
38
- <SvgoArrowRight class="w-4 h-4 text-slate-400 mx-2" />
39
- <NuxtLink
40
- class="text-primary"
41
- target="_blank"
42
- external
43
- :to="
44
- getExplorerUrl(chain_id, `/address/${metadata.receiver}`)
45
- "
46
- >{{ shortenHash(metadata.receiver) }}
47
- </NuxtLink>
36
+ <span class="w-[8em]">
37
+ {{ formattedAmount }}
38
+ <span class="uppercase">{{ token?.symbol }}</span>
39
+ </span>
40
+ <img width="20" height="20" class="w-5 h-5" :src="token?.logo_url">
41
+ <SvgoArrowRight class="w-4 h-4 text-slate-400" />
42
+ <Address
43
+ :to="getExplorerUrl(chain_id, `/address/${metadata.receiver}`)"
44
+ :address="metadata.receiver"
45
+ />
48
46
  </span>
49
47
  </div>
50
48
  </template>