@instadapp/avocado-base 0.0.0-dev.424dd71 → 0.0.0-dev.4546ed9

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.
@@ -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>