@instadapp/avocado-base 0.0.0-dev.f34fbf6 → 0.0.0-dev.fa14908
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/abi/forwarder.json +8 -8
- package/app.vue +7 -0
- package/assets/images/icons/arrow-left.svg +5 -0
- package/assets/images/icons/arrow-right.svg +5 -0
- package/assets/images/icons/avocado.svg +4 -0
- package/assets/images/icons/bridge-2.svg +3 -0
- package/assets/images/icons/bridge.svg +7 -0
- package/assets/images/icons/calendar.svg +8 -0
- package/assets/images/icons/change-threshold.svg +4 -0
- package/assets/images/icons/check-circle.svg +4 -0
- package/assets/images/icons/chevron-down.svg +4 -0
- package/assets/images/icons/clipboard.svg +7 -0
- package/assets/images/icons/clock-circle.svg +5 -0
- package/assets/images/icons/copy.svg +5 -0
- package/assets/images/icons/cross-transfer.svg +7 -0
- package/assets/images/icons/dapp.svg +4 -0
- package/assets/images/icons/deploy.svg +12 -0
- package/assets/images/icons/error-circle.svg +6 -0
- package/assets/images/icons/exclamation-circle.svg +13 -0
- package/assets/images/icons/exclamation-octagon.svg +13 -0
- package/assets/images/icons/exclamation-triangle.svg +5 -0
- package/assets/images/icons/external-link.svg +6 -0
- package/assets/images/icons/eye.svg +4 -0
- package/assets/images/icons/flowers.svg +8 -0
- package/assets/images/icons/gas-emoji.svg +193 -0
- package/assets/images/icons/gas.svg +14 -0
- package/assets/images/icons/gift.svg +153 -0
- package/assets/images/icons/globe.svg +110 -0
- package/assets/images/icons/hamburger.svg +6 -0
- package/assets/images/icons/instadapp-pro.svg +4 -0
- package/assets/images/icons/logout.svg +3 -0
- package/assets/images/icons/moon.svg +3 -0
- package/assets/images/icons/multi-send.svg +7 -0
- package/assets/images/icons/network.svg +13 -0
- package/assets/images/icons/options.svg +5 -0
- package/assets/images/icons/permit-sign.svg +11 -0
- package/assets/images/icons/plus-circle.svg +6 -0
- package/assets/images/icons/plus.svg +5 -0
- package/assets/images/icons/power-off-bg.svg +24 -0
- package/assets/images/icons/power-off.svg +19 -0
- package/assets/images/icons/power-on.svg +19 -0
- package/assets/images/icons/qr.svg +20 -0
- package/assets/images/icons/question-circle.svg +14 -0
- package/assets/images/icons/refresh.svg +6 -0
- package/assets/images/icons/reject-proposal.svg +6 -0
- package/assets/images/icons/search.svg +12 -0
- package/assets/images/icons/sun.svg +3 -0
- package/assets/images/icons/transfer.svg +5 -0
- package/assets/images/icons/trash-2.svg +8 -0
- package/assets/images/icons/upgrade.svg +4 -0
- package/assets/images/icons/wave.svg +214 -0
- package/assets/images/icons/x.svg +5 -0
- package/components/ActionLogo.vue +38 -0
- package/components/ActionMetadata.vue +72 -0
- package/components/AuthorityAvatar.vue +38 -0
- package/components/ChainLogo.vue +14 -556
- package/components/CopyClipboard.vue +64 -0
- package/components/metadata/Bridge.vue +59 -0
- package/components/metadata/CrossTransfer.vue +71 -0
- package/components/metadata/GasTopup.vue +39 -0
- package/components/metadata/Permit2.vue +42 -0
- package/components/metadata/Signers.vue +45 -0
- package/components/metadata/Swap.vue +74 -0
- package/components/metadata/Transfer.vue +50 -0
- package/components.d.ts +13 -0
- package/contracts/Forwarder.ts +4 -4
- package/contracts/factories/Forwarder__factory.ts +8 -8
- package/nuxt.config.ts +17 -1
- package/package.json +9 -4
- package/utils/avocado.ts +2 -0
- package/utils/bignumber.ts +20 -0
- package/utils/formatter.ts +1 -1
- package/utils/helper.ts +8 -0
- package/utils/metadata.ts +296 -169
- package/utils/network.ts +133 -79
- package/utils/services.ts +21 -0
- package/utils/utils.d.ts +129 -114
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
|
|
3
|
+
const props = defineProps<{
|
|
4
|
+
metadata: any;
|
|
5
|
+
chain_id: number | string
|
|
6
|
+
}>();
|
|
7
|
+
|
|
8
|
+
const compact = inject('compact');
|
|
9
|
+
const tokens = inject<ITokenPrice[]>('tokens');
|
|
10
|
+
|
|
11
|
+
const toToken = asyncComputed(() =>
|
|
12
|
+
{
|
|
13
|
+
if (Array.isArray(tokens) && !tokens.length) return null;
|
|
14
|
+
return fetchTokenByAddress(props.metadata?.toToken, props.metadata?.toChainId, tokens)
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
const fromToken = asyncComputed(() =>
|
|
19
|
+
{
|
|
20
|
+
if (Array.isArray(tokens) && !tokens.length) return null;
|
|
21
|
+
return fetchTokenByAddress(props.metadata?.fromToken, props.chain_id, tokens)
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
const isTokensSame = computed(() => {
|
|
26
|
+
return toToken.value?.symbol === fromToken.value?.symbol
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
const bridgeAmountFormatted = computed(() =>
|
|
30
|
+
formatDecimal(
|
|
31
|
+
fromWei(props.metadata?.amount, fromToken?.value?.decimals).toFixed()
|
|
32
|
+
)
|
|
33
|
+
);
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<template>
|
|
37
|
+
<div v-if="!toToken || !fromToken" class="rounded-5 w-24 h-4 loading-box" />
|
|
38
|
+
<div
|
|
39
|
+
class="flex gap-5 items-center"
|
|
40
|
+
v-if="toToken && fromToken"
|
|
41
|
+
>
|
|
42
|
+
<span v-if="!compact" class="capitalize text-xs sm:text-sm">{{ metadata.type }}</span>
|
|
43
|
+
<span class="inline-flex gap-2.5 items-center">
|
|
44
|
+
<img width="20" height="20" class="w-5 h-5" :src="fromToken.logo_url" />
|
|
45
|
+
{{ bridgeAmountFormatted }}
|
|
46
|
+
<span class="uppercase">{{ fromToken?.symbol }}</span>
|
|
47
|
+
<SvgoBridge class="text-slate-400 w-4 h-4" />
|
|
48
|
+
<template v-if="!isTokensSame">
|
|
49
|
+
<img width="20" height="20" class="w-5 h-5" :src="toToken.logo_url" />
|
|
50
|
+
<span class="uppercase">{{ toToken?.symbol }}</span>
|
|
51
|
+
</template>
|
|
52
|
+
<span class="flex items-center gap-2.5">
|
|
53
|
+
on
|
|
54
|
+
<ChainLogo class="w-5" :chain="metadata.toChainId" />
|
|
55
|
+
<span>{{ chainIdToName(metadata.toChainId) }}</span>
|
|
56
|
+
</span>
|
|
57
|
+
</span>
|
|
58
|
+
</div>
|
|
59
|
+
</template>
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
|
|
3
|
+
const props = defineProps<{
|
|
4
|
+
metadata: any;
|
|
5
|
+
chain_id: number | string
|
|
6
|
+
}>();
|
|
7
|
+
|
|
8
|
+
const compact = inject('compact');
|
|
9
|
+
const tokens = inject<ITokenPrice[]>('tokens');
|
|
10
|
+
|
|
11
|
+
const fromToken = asyncComputed(() => {
|
|
12
|
+
if (!props?.chain_id) return null;
|
|
13
|
+
|
|
14
|
+
if (Array.isArray(tokens) && !tokens.length) return null;
|
|
15
|
+
|
|
16
|
+
return fetchTokenByAddress(
|
|
17
|
+
props.metadata?.fromToken,
|
|
18
|
+
props?.chain_id,
|
|
19
|
+
tokens
|
|
20
|
+
);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const formattedFromAmount = computed(() =>
|
|
24
|
+
formatDecimal(
|
|
25
|
+
fromWei(props.metadata?.amount, fromToken?.value?.decimals).toFixed()
|
|
26
|
+
)
|
|
27
|
+
);
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<template>
|
|
31
|
+
<div class="h-[60px]" v-if="!fromToken">
|
|
32
|
+
<div class="rounded-5 w-24 h-4 loading-box" />
|
|
33
|
+
</div>
|
|
34
|
+
<div class="flex gap-5 flex-col" v-else>
|
|
35
|
+
<div class="flex items-center gap-5">
|
|
36
|
+
<span v-if="!compact" class="capitalize text-xs sm:text-sm">Cross-chain send</span>
|
|
37
|
+
<span class="inline-flex gap-2.5 items-center">
|
|
38
|
+
<img width="20" height="20" class="w-5 h-5" :src="fromToken?.logo_url" />
|
|
39
|
+
{{ formattedFromAmount }}
|
|
40
|
+
<span class="uppercase">{{ fromToken?.symbol }}</span>
|
|
41
|
+
</span>
|
|
42
|
+
</div>
|
|
43
|
+
|
|
44
|
+
<div class="flex items-center gap-2.5">
|
|
45
|
+
<span class="flex items-center gap-2.5">
|
|
46
|
+
<ChainLogo class="w-5" :chain="chain_id" />
|
|
47
|
+
<span>{{ chainIdToName(chain_id) }}</span>
|
|
48
|
+
</span>
|
|
49
|
+
|
|
50
|
+
<SvgoArrowRight class="w-4 h-4 text-slate-400" />
|
|
51
|
+
|
|
52
|
+
<span class="flex items-center gap-2.5">
|
|
53
|
+
<ChainLogo class="w-5" :chain="metadata?.toChainId" />
|
|
54
|
+
|
|
55
|
+
<a
|
|
56
|
+
target="_blank"
|
|
57
|
+
class="text-primary"
|
|
58
|
+
:href="
|
|
59
|
+
getExplorerUrl(
|
|
60
|
+
metadata?.toChainId,
|
|
61
|
+
`/address/${metadata.receiver}`
|
|
62
|
+
)
|
|
63
|
+
"
|
|
64
|
+
>{{ shortenHash(metadata.receiver) }}</a
|
|
65
|
+
>
|
|
66
|
+
on
|
|
67
|
+
<span>{{ chainIdToName(metadata?.toChainId) }}</span>
|
|
68
|
+
</span>
|
|
69
|
+
</div>
|
|
70
|
+
</div>
|
|
71
|
+
</template>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
|
|
3
|
+
const props = defineProps<{
|
|
4
|
+
metadata: any;
|
|
5
|
+
chain_id: number | string
|
|
6
|
+
}>();
|
|
7
|
+
|
|
8
|
+
const tokens = inject<ITokenPrice[]>('tokens');
|
|
9
|
+
|
|
10
|
+
const token = asyncComputed(() =>
|
|
11
|
+
{
|
|
12
|
+
if (Array.isArray(tokens) && !tokens.length) return null;
|
|
13
|
+
|
|
14
|
+
return fetchTokenByAddress(props.metadata?.token, props?.chain_id, tokens)
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
const compact = inject('compact');
|
|
19
|
+
|
|
20
|
+
const formattedAmount = computed(() =>
|
|
21
|
+
formatDecimal(
|
|
22
|
+
fromWei(props.metadata?.amount, token?.value?.decimals).toFixed()
|
|
23
|
+
)
|
|
24
|
+
);
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<template>
|
|
28
|
+
<div v-if="!token" class="rounded-5 w-24 h-4 loading-box" />
|
|
29
|
+
<div class="flex items-center gap-5" v-else>
|
|
30
|
+
<span v-if="!compact" class="capitalize text-xs sm:text-sm">{{ metadata.type }}</span>
|
|
31
|
+
<span class="inline-flex gap-2.5 items-center">
|
|
32
|
+
<img width="20" height="20" class="w-5 h-5" :src="token?.logo_url" />
|
|
33
|
+
{{ formattedAmount }}
|
|
34
|
+
<span class="uppercase">{{ token?.symbol }}</span>
|
|
35
|
+
<SvgoGas class="w-4 h-4 text-slate-400 mx-2" />
|
|
36
|
+
<span>{{ shortenHash(metadata.onBehalf) }}</span>
|
|
37
|
+
</span>
|
|
38
|
+
</div>
|
|
39
|
+
</template>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
|
|
3
|
+
const props = defineProps<{
|
|
4
|
+
metadata: any;
|
|
5
|
+
chain_id: number | string
|
|
6
|
+
}>();
|
|
7
|
+
|
|
8
|
+
const tokens = inject<ITokenPrice[]>('tokens');
|
|
9
|
+
|
|
10
|
+
const token = asyncComputed(() =>
|
|
11
|
+
{
|
|
12
|
+
if (Array.isArray(tokens) && !tokens.length) return null;
|
|
13
|
+
return fetchTokenByAddress(props.metadata?.token, props?.chain_id, tokens)
|
|
14
|
+
}
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
const calculateDate = (timestamp: number) => {
|
|
18
|
+
return new Date(timestamp * 1000).toLocaleString();
|
|
19
|
+
};
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<template>
|
|
23
|
+
<div v-if="!token" class="rounded-5 w-24 h-4 loading-box" />
|
|
24
|
+
<div v-else class="inline-flex items-center gap-2 flex-wrap">
|
|
25
|
+
<span>Permit2 Allowance: </span>
|
|
26
|
+
<img width="20" height="20" class="w-5 h-5" :src="token?.logo_url" />
|
|
27
|
+
<span class="capitalize">{{ token?.symbol }}</span>
|
|
28
|
+
to
|
|
29
|
+
<NuxtLink
|
|
30
|
+
class="text-primary"
|
|
31
|
+
:href="
|
|
32
|
+
getExplorerUrl(chain_id, `/address/${metadata.spender}`)
|
|
33
|
+
"
|
|
34
|
+
target="_blank"
|
|
35
|
+
external
|
|
36
|
+
>
|
|
37
|
+
{{ shortenHash(metadata.spender) }}
|
|
38
|
+
</NuxtLink>
|
|
39
|
+
|
|
|
40
|
+
<span> Expiration date at {{ calculateDate(metadata?.expiration) }}</span>
|
|
41
|
+
</div>
|
|
42
|
+
</template>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { Tippy } from 'vue-tippy'
|
|
3
|
+
const props = defineProps<{
|
|
4
|
+
metadata: {
|
|
5
|
+
type: MetadataTypes,
|
|
6
|
+
[key: string]: any
|
|
7
|
+
};
|
|
8
|
+
compact?: boolean;
|
|
9
|
+
}>();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<div>
|
|
14
|
+
<div v-if="!compact || metadata.addresses.length < 3" class="flex gap-[14px] flex-wrap">
|
|
15
|
+
<div v-for="address of metadata.addresses" :key="address" class="flex gap-[8px] rounded-full bg-slate-50 dark:bg-gray-850 justify-start items-center px-[8px] py-[6px]">
|
|
16
|
+
<AuthorityAvatar :address="address" class="w-[18px] h-[18px]" />
|
|
17
|
+
<p class="text-xs leading-5">
|
|
18
|
+
{{ shortenHash(address, compact ? 2 : 4) }}
|
|
19
|
+
</p>
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
<div v-else class="flex gap-2 flex-wrap items-center">
|
|
23
|
+
<div v-for="address of [metadata.addresses[0], metadata.addresses[1]]" :key="address" class="flex gap-[8px] rounded-full bg-slate-50 dark:bg-gray-850 justify-start items-center px-[8px] py-[6px]">
|
|
24
|
+
<AuthorityAvatar :address="address" class="w-[18px] h-[18px]" />
|
|
25
|
+
<p class="text-xs leading-5">
|
|
26
|
+
{{ shortenHash(address, 2) }}
|
|
27
|
+
</p>
|
|
28
|
+
</div>
|
|
29
|
+
...
|
|
30
|
+
<Tippy max-width="none" interactive tag="button" content-tag="div" content-class="content-wrapper">
|
|
31
|
+
<template #default>
|
|
32
|
+
<SvgoInfo2 class="w-[16px] h-[16px] text-slate-500 rounded-full" />
|
|
33
|
+
</template>
|
|
34
|
+
<template #content>
|
|
35
|
+
<ul class="flex flex-col gap-2.5">
|
|
36
|
+
<li v-for="address in metadata.addresses" :key="address" class="flex text-xs items-center gap-2.5">
|
|
37
|
+
<AuthorityAvatar class="shrink-0 w-5 h-5" :address="address" />
|
|
38
|
+
{{ address }}
|
|
39
|
+
</li>
|
|
40
|
+
</ul>
|
|
41
|
+
</template>
|
|
42
|
+
</Tippy>
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
</template>
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
|
|
3
|
+
const props = defineProps<{
|
|
4
|
+
metadata: any;
|
|
5
|
+
chain_id: number | string
|
|
6
|
+
}>();
|
|
7
|
+
|
|
8
|
+
const compact = inject('compact');
|
|
9
|
+
const tokens = inject<ITokenPrice[]>('tokens');
|
|
10
|
+
|
|
11
|
+
const buyToken = asyncComputed(() =>
|
|
12
|
+
{
|
|
13
|
+
if (Array.isArray(tokens) && !tokens.length) return null;
|
|
14
|
+
return fetchTokenByAddress(props.metadata?.buyToken, props?.chain_id, tokens)
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
const sellToken = asyncComputed(() =>
|
|
18
|
+
{
|
|
19
|
+
if (Array.isArray(tokens) && !tokens.length) return null;
|
|
20
|
+
return fetchTokenByAddress(props.metadata?.sellToken, props?.chain_id, tokens)
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
const sellAmountFormatted = computed(() =>
|
|
25
|
+
formatDecimal(
|
|
26
|
+
fromWei(props.metadata?.sellAmount, sellToken?.value?.decimals).toFixed()
|
|
27
|
+
)
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
const buyAmountFormatted = computed(() =>
|
|
31
|
+
formatDecimal(
|
|
32
|
+
fromWei(props.metadata?.buyAmount, buyToken?.value?.decimals).toFixed()
|
|
33
|
+
)
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
const formatProtocol = (protocol: string) => {
|
|
37
|
+
return (
|
|
38
|
+
new Map([
|
|
39
|
+
["1inch-v5", "1inch"],
|
|
40
|
+
["0x-v1", "0x"],
|
|
41
|
+
["paraswap-v5", "Paraswap"],
|
|
42
|
+
["kyber-v1", "Kyber Network"],
|
|
43
|
+
]).get(protocol) || protocol
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
<template>
|
|
51
|
+
<div v-if="!sellToken || !buyToken" class="rounded-5 w-24 h-4 loading-box" />
|
|
52
|
+
<div
|
|
53
|
+
class="flex items-center gap-5"
|
|
54
|
+
v-else
|
|
55
|
+
>
|
|
56
|
+
<span v-if="!compact" class="capitalize text-xs sm:text-sm">{{ metadata.type }}</span>
|
|
57
|
+
<span class="inline-flex gap-2.5 items-center">
|
|
58
|
+
<img width="20" height="20" class="w-5 h-5" :src="sellToken?.logo_url" />
|
|
59
|
+
{{ sellAmountFormatted }}
|
|
60
|
+
<span class="uppercase">{{ sellToken?.symbol }}</span>
|
|
61
|
+
<SvgoRefresh class="w-4 h-4 text-slate-400 mx-2" />
|
|
62
|
+
<img width="20" height="20" class="w-5 h-5" :src="buyToken?.logo_url" />
|
|
63
|
+
{{ buyAmountFormatted }}
|
|
64
|
+
<span class="uppercase">{{ buyToken?.symbol }}</span>
|
|
65
|
+
<span
|
|
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>
|
|
72
|
+
</span>
|
|
73
|
+
</div>
|
|
74
|
+
</template>
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
|
|
3
|
+
const props = defineProps<{
|
|
4
|
+
metadata: any;
|
|
5
|
+
chain_id: number | string
|
|
6
|
+
}>();
|
|
7
|
+
|
|
8
|
+
const compact = inject('compact');
|
|
9
|
+
const tokens = inject<ITokenPrice[]>('tokens');
|
|
10
|
+
|
|
11
|
+
const token = asyncComputed(() => {
|
|
12
|
+
if (!props?.chain_id) return null;
|
|
13
|
+
|
|
14
|
+
if (Array.isArray(tokens) && !tokens.length) return null;
|
|
15
|
+
|
|
16
|
+
return fetchTokenByAddress(
|
|
17
|
+
props.metadata?.token,
|
|
18
|
+
props?.chain_id,
|
|
19
|
+
tokens
|
|
20
|
+
);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const formattedAmount = computed(() =>
|
|
24
|
+
formatDecimal(
|
|
25
|
+
fromWei(props.metadata?.amount, token?.value?.decimals).toFixed()
|
|
26
|
+
)
|
|
27
|
+
);
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<template>
|
|
31
|
+
<div v-if="!token" class="rounded-5 w-24 h-4 loading-box" />
|
|
32
|
+
<div class="flex items-center gap-5" v-else>
|
|
33
|
+
<span v-if="!compact" class="capitalize text-xs sm:text-sm">{{ metadata.type }}</span>
|
|
34
|
+
<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>
|
|
48
|
+
</span>
|
|
49
|
+
</div>
|
|
50
|
+
</template>
|
package/components.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/* prettier-ignore */
|
|
3
|
+
// @ts-nocheck
|
|
4
|
+
// Generated by unplugin-vue-components
|
|
5
|
+
// Read more: https://github.com/vuejs/core/pull/3399
|
|
6
|
+
export {}
|
|
7
|
+
|
|
8
|
+
declare module 'vue' {
|
|
9
|
+
export interface GlobalComponents {
|
|
10
|
+
RouterLink: typeof import('vue-router')['RouterLink']
|
|
11
|
+
RouterView: typeof import('vue-router')['RouterView']
|
|
12
|
+
}
|
|
13
|
+
}
|
package/contracts/Forwarder.ts
CHANGED
|
@@ -84,9 +84,9 @@ export declare namespace AvoCoreStructs {
|
|
|
84
84
|
|
|
85
85
|
export type CastForwardParamsStruct = {
|
|
86
86
|
gas: PromiseOrValue<BigNumberish>;
|
|
87
|
-
validUntil: PromiseOrValue<BigNumberish>;
|
|
88
|
-
validAfter: PromiseOrValue<BigNumberish>;
|
|
89
87
|
gasPrice: PromiseOrValue<BigNumberish>;
|
|
88
|
+
validAfter: PromiseOrValue<BigNumberish>;
|
|
89
|
+
validUntil: PromiseOrValue<BigNumberish>;
|
|
90
90
|
};
|
|
91
91
|
|
|
92
92
|
export type CastForwardParamsStructOutput = [
|
|
@@ -96,9 +96,9 @@ export declare namespace AvoCoreStructs {
|
|
|
96
96
|
BigNumber
|
|
97
97
|
] & {
|
|
98
98
|
gas: BigNumber;
|
|
99
|
-
validUntil: BigNumber;
|
|
100
|
-
validAfter: BigNumber;
|
|
101
99
|
gasPrice: BigNumber;
|
|
100
|
+
validAfter: BigNumber;
|
|
101
|
+
validUntil: BigNumber;
|
|
102
102
|
};
|
|
103
103
|
|
|
104
104
|
export type SignatureParamsStruct = {
|
|
@@ -535,7 +535,7 @@ const _abi = [
|
|
|
535
535
|
},
|
|
536
536
|
{
|
|
537
537
|
internalType: "uint256",
|
|
538
|
-
name: "
|
|
538
|
+
name: "gasPrice",
|
|
539
539
|
type: "uint256",
|
|
540
540
|
},
|
|
541
541
|
{
|
|
@@ -545,7 +545,7 @@ const _abi = [
|
|
|
545
545
|
},
|
|
546
546
|
{
|
|
547
547
|
internalType: "uint256",
|
|
548
|
-
name: "
|
|
548
|
+
name: "validUntil",
|
|
549
549
|
type: "uint256",
|
|
550
550
|
},
|
|
551
551
|
],
|
|
@@ -788,7 +788,7 @@ const _abi = [
|
|
|
788
788
|
},
|
|
789
789
|
{
|
|
790
790
|
internalType: "uint256",
|
|
791
|
-
name: "
|
|
791
|
+
name: "gasPrice",
|
|
792
792
|
type: "uint256",
|
|
793
793
|
},
|
|
794
794
|
{
|
|
@@ -798,7 +798,7 @@ const _abi = [
|
|
|
798
798
|
},
|
|
799
799
|
{
|
|
800
800
|
internalType: "uint256",
|
|
801
|
-
name: "
|
|
801
|
+
name: "validUntil",
|
|
802
802
|
type: "uint256",
|
|
803
803
|
},
|
|
804
804
|
],
|
|
@@ -1122,7 +1122,7 @@ const _abi = [
|
|
|
1122
1122
|
},
|
|
1123
1123
|
{
|
|
1124
1124
|
internalType: "uint256",
|
|
1125
|
-
name: "
|
|
1125
|
+
name: "gasPrice",
|
|
1126
1126
|
type: "uint256",
|
|
1127
1127
|
},
|
|
1128
1128
|
{
|
|
@@ -1132,7 +1132,7 @@ const _abi = [
|
|
|
1132
1132
|
},
|
|
1133
1133
|
{
|
|
1134
1134
|
internalType: "uint256",
|
|
1135
|
-
name: "
|
|
1135
|
+
name: "validUntil",
|
|
1136
1136
|
type: "uint256",
|
|
1137
1137
|
},
|
|
1138
1138
|
],
|
|
@@ -1393,7 +1393,7 @@ const _abi = [
|
|
|
1393
1393
|
},
|
|
1394
1394
|
{
|
|
1395
1395
|
internalType: "uint256",
|
|
1396
|
-
name: "
|
|
1396
|
+
name: "gasPrice",
|
|
1397
1397
|
type: "uint256",
|
|
1398
1398
|
},
|
|
1399
1399
|
{
|
|
@@ -1403,7 +1403,7 @@ const _abi = [
|
|
|
1403
1403
|
},
|
|
1404
1404
|
{
|
|
1405
1405
|
internalType: "uint256",
|
|
1406
|
-
name: "
|
|
1406
|
+
name: "validUntil",
|
|
1407
1407
|
type: "uint256",
|
|
1408
1408
|
},
|
|
1409
1409
|
],
|
package/nuxt.config.ts
CHANGED
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
// https://nuxt.com/docs/api/configuration/nuxt-config
|
|
2
|
+
import ViteComponents from "unplugin-vue-components/vite";
|
|
3
|
+
|
|
2
4
|
export default defineNuxtConfig({
|
|
3
|
-
modules: ["@nuxtjs/tailwindcss"],
|
|
5
|
+
modules: ["@nuxtjs/tailwindcss", "nuxt-svgo", "@vueuse/nuxt"],
|
|
6
|
+
svgo: {
|
|
7
|
+
defaultImport: "component",
|
|
8
|
+
autoImportPath: "./assets/images/icons",
|
|
9
|
+
svgoConfig: {
|
|
10
|
+
plugins: ["prefixIds"],
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
vite: {
|
|
14
|
+
plugins: [
|
|
15
|
+
ViteComponents({
|
|
16
|
+
dts: true,
|
|
17
|
+
}),
|
|
18
|
+
],
|
|
19
|
+
},
|
|
4
20
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instadapp/avocado-base",
|
|
3
|
-
"version": "0.0.0-dev.
|
|
3
|
+
"version": "0.0.0-dev.fa14908",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./nuxt.config.ts",
|
|
6
6
|
"types": "global.d.ts",
|
|
@@ -16,12 +16,17 @@
|
|
|
16
16
|
"@instadapp/avocado-dev": "npm:@instadapp/avocado@dev",
|
|
17
17
|
"@nuxtjs/tailwindcss": "^6.6.5",
|
|
18
18
|
"@typechain/ethers-v5": "^10.2.0",
|
|
19
|
-
"nuxt": "^3.
|
|
19
|
+
"nuxt": "^3.6.1",
|
|
20
|
+
"nuxt-svgo": "^3.1.0",
|
|
20
21
|
"rimraf": "^3.0.2",
|
|
21
|
-
"typechain": "^8.1.1"
|
|
22
|
+
"typechain": "^8.1.1",
|
|
23
|
+
"unplugin-vue-components": "^0.25.1",
|
|
24
|
+
"vue-tippy": "^6.0.0"
|
|
22
25
|
},
|
|
23
26
|
"dependencies": {
|
|
27
|
+
"@vueuse/nuxt": "^10.2.0",
|
|
24
28
|
"bignumber.js": "^9.1.1",
|
|
25
|
-
"ethers": "^5.7.2"
|
|
29
|
+
"ethers": "^5.7.2",
|
|
30
|
+
"xxhashjs": "^0.2.2"
|
|
26
31
|
}
|
|
27
32
|
}
|
package/utils/avocado.ts
CHANGED
package/utils/bignumber.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { BigNumber } from "bignumber.js";
|
|
2
2
|
import { BigNumber as BN } from "ethers";
|
|
3
3
|
|
|
4
|
+
type CombinedBigNumber = BigNumber | string | number;
|
|
5
|
+
|
|
4
6
|
export const toBN = (value: BigNumber.Value | BN) =>
|
|
5
7
|
new BigNumber(BN.isBigNumber(value) ? value.toString() : value);
|
|
6
8
|
export const isZero = (value: BigNumber.Value | BN) => toBN(value).isZero();
|
|
@@ -29,3 +31,21 @@ export const ensureValue = (value: any) => {
|
|
|
29
31
|
export const max = (...args: BigNumber.Value[]) => {
|
|
30
32
|
return BigNumber.max(...args);
|
|
31
33
|
};
|
|
34
|
+
|
|
35
|
+
export function pow(value: CombinedBigNumber, exponent: string | number) {
|
|
36
|
+
return toBN(value).pow(toBN(exponent));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function toWei(val: CombinedBigNumber, decimals: number): string {
|
|
40
|
+
const num = toBN(val);
|
|
41
|
+
const multiplier = pow(10, decimals);
|
|
42
|
+
return times(num, multiplier).toFixed(0);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function fromWei(val: CombinedBigNumber, decimal = 18) {
|
|
46
|
+
return toBN(val).div(new BigNumber(10).pow(decimal));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function abs(value: CombinedBigNumber) {
|
|
50
|
+
return toBN(value).abs();
|
|
51
|
+
}
|
package/utils/formatter.ts
CHANGED
package/utils/helper.ts
CHANGED
|
@@ -52,3 +52,11 @@ export function onImageError(this: HTMLImageElement) {
|
|
|
52
52
|
parentElement.classList.add("bg-gray-300");
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
+
|
|
56
|
+
export function formatMultipleAddresses(addresses: string[], shorten = true) {
|
|
57
|
+
const formatter = new Intl.ListFormat('en', { style: 'long', type: 'conjunction' })
|
|
58
|
+
const formattedString = formatter.format(addresses.map(i => shorten ? shortenHash(i) || '' : i))
|
|
59
|
+
|
|
60
|
+
return formattedString
|
|
61
|
+
}
|
|
62
|
+
|