@instadapp/avocado-base 0.1.7 → 0.1.9
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/.vscode/settings.json +68 -0
- package/abi/multisigAgnosticForwarder.json +938 -1
- package/assets/images/icons/check.svg +3 -0
- package/assets/images/icons/copy.svg +9 -2
- package/components/ActionMetadata.vue +25 -19
- package/components/Address.vue +74 -0
- package/components/CopyClipboard.vue +15 -31
- package/components/metadata/CrossTransfer.vue +29 -32
- package/components/metadata/Signers.vue +11 -58
- package/components/metadata/Swap.vue +29 -30
- package/components/metadata/Transfer.vue +25 -27
- package/contracts/MultisigAgnosticForwarder.ts +44 -34
- package/contracts/factories/MultisigAgnosticForwarder__factory.ts +98 -14
- package/eslint.config.mjs +19 -0
- package/nuxt.config.ts +7 -2
- package/package.json +11 -9
- package/utils/metadata.ts +2 -1
- package/utils/network.ts +313 -316
|
@@ -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
|
-
<
|
|
4
|
-
|
|
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
|
|
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
|
|
49
|
-
|
|
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
|
|
68
|
-
|
|
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
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
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
|
|
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="
|
|
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
|
-
<
|
|
25
|
-
<
|
|
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
|
-
.
|
|
35
|
-
|
|
36
|
-
|
|
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)
|
|
11
|
+
if (!props?.chain_id)
|
|
12
|
+
return null
|
|
13
13
|
|
|
14
|
-
if (Array.isArray(tokens) && !tokens.length)
|
|
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)
|
|
25
|
+
if (!props?.metadata?.toChainId)
|
|
26
|
+
return null
|
|
25
27
|
|
|
26
|
-
if (Array.isArray(tokens) && !tokens.length)
|
|
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]"
|
|
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"
|
|
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
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
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
|
-
<
|
|
16
|
-
<
|
|
17
|
-
<
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
|
|
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)
|
|
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)
|
|
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
|
-
|
|
35
|
+
function formatProtocol(protocol: string) {
|
|
35
36
|
return (
|
|
36
37
|
new Map([
|
|
37
|
-
[
|
|
38
|
-
[
|
|
39
|
-
[
|
|
40
|
-
[
|
|
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"
|
|
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"
|
|
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)
|
|
11
|
+
if (!props?.chain_id)
|
|
12
|
+
return null
|
|
13
13
|
|
|
14
|
-
if (Array.isArray(tokens) && !tokens.length)
|
|
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"
|
|
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
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
<
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
:
|
|
44
|
-
|
|
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>
|