@instadapp/avocado-base 0.0.0-dev.991c44c → 0.0.0-dev.9d62a67
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/.github/workflows/npm-publish-dev.yml +2 -5
- package/components/ActionLogo.vue +30 -30
- package/components/ActionMetadata.vue +28 -22
- package/components/AuthorityAvatar.vue +4 -5
- package/components/ChainLogo.vue +10 -17
- package/components/CopyClipboard.vue +5 -11
- package/components/metadata/CrossTransfer.vue +11 -3
- package/components/metadata/Signers.vue +26 -23
- package/components/metadata/Swap.vue +22 -29
- package/package.json +10 -7
- package/utils/formatter.ts +1 -1
- package/utils/metadata.ts +54 -6
- package/utils/network.ts +195 -17
- package/utils/utils.d.ts +10 -2
|
@@ -3,7 +3,7 @@ name: NPM Publish(Dev)
|
|
|
3
3
|
on:
|
|
4
4
|
push:
|
|
5
5
|
branches:
|
|
6
|
-
-
|
|
6
|
+
- "main"
|
|
7
7
|
|
|
8
8
|
jobs:
|
|
9
9
|
dev-npm-publish:
|
|
@@ -18,7 +18,7 @@ jobs:
|
|
|
18
18
|
|
|
19
19
|
- uses: actions/setup-node@v3
|
|
20
20
|
with:
|
|
21
|
-
node-version:
|
|
21
|
+
node-version: ">=v18.18.0"
|
|
22
22
|
|
|
23
23
|
- uses: actions/cache@v3
|
|
24
24
|
with:
|
|
@@ -48,6 +48,3 @@ jobs:
|
|
|
48
48
|
token: ${{ secrets.NPM_AUTH_TOKEN }}
|
|
49
49
|
tag: dev
|
|
50
50
|
access: public
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import RefreshSVG from '
|
|
3
|
-
import BridgeSVG from '
|
|
4
|
-
import CrossTransferSVG from '
|
|
5
|
-
import TransferSVG from '
|
|
6
|
-
import PlusCircleSVG from '
|
|
7
|
-
import Trash2SVG from '
|
|
8
|
-
import ChangeThresholdSVG from '
|
|
9
|
-
import DappSVG from '
|
|
10
|
-
import DeploySVG from '
|
|
11
|
-
import GasSVG from '
|
|
12
|
-
import InstadappProSVG from '
|
|
13
|
-
import PermitSignSVG from '
|
|
14
|
-
import RejectProposalSVG from '
|
|
15
|
-
import UpgradeSVG from '
|
|
16
|
-
import HammerSVG from '
|
|
2
|
+
import RefreshSVG from '../assets/images/icons/refresh.svg'
|
|
3
|
+
import BridgeSVG from '../assets/images/icons/bridge.svg'
|
|
4
|
+
import CrossTransferSVG from '../assets/images/icons/cross-transfer.svg'
|
|
5
|
+
import TransferSVG from '../assets/images/icons/transfer.svg'
|
|
6
|
+
import PlusCircleSVG from '../assets/images/icons/plus-circle.svg'
|
|
7
|
+
import Trash2SVG from '../assets/images/icons/trash-2.svg'
|
|
8
|
+
import ChangeThresholdSVG from '../assets/images/icons/change-threshold.svg'
|
|
9
|
+
import DappSVG from '../assets/images/icons/dapp.svg'
|
|
10
|
+
import DeploySVG from '../assets/images/icons/deploy.svg'
|
|
11
|
+
import GasSVG from '../assets/images/icons/gas.svg'
|
|
12
|
+
import InstadappProSVG from '../assets/images/icons/instadapp-pro.svg'
|
|
13
|
+
import PermitSignSVG from '../assets/images/icons/permit-sign.svg'
|
|
14
|
+
import RejectProposalSVG from '../assets/images/icons/reject-proposal.svg'
|
|
15
|
+
import UpgradeSVG from '../assets/images/icons/upgrade.svg'
|
|
16
|
+
import HammerSVG from '../assets/images/icons/hammer.svg'
|
|
17
17
|
|
|
18
18
|
defineProps<{
|
|
19
19
|
action: MetadataTypes
|
|
@@ -22,19 +22,19 @@ defineProps<{
|
|
|
22
22
|
</script>
|
|
23
23
|
|
|
24
24
|
<template>
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
25
|
+
<RefreshSVG class="text-primary" v-if="action === 'swap'" />
|
|
26
|
+
<BridgeSVG class="text-primary" v-else-if="action === 'bridge'" />
|
|
27
|
+
<CrossTransferSVG class="text-primary" v-else-if="action === 'cross-transfer'" />
|
|
28
|
+
<TransferSVG class="text-primary" v-else-if="action === 'transfer'" />
|
|
29
|
+
<PlusCircleSVG class="text-primary" v-else-if="action === 'add-signers' || (action === 'auth' && !remove)" />
|
|
30
|
+
<Trash2SVG class="text-[#EB5757]" v-else-if="action === 'remove-signers' || (action === 'auth' && remove)" />
|
|
31
|
+
<RejectProposalSVG class="text-[#EB5757]" v-else-if="action === 'rejection'" />
|
|
32
|
+
<ChangeThresholdSVG v-else-if="action === 'change-threshold'" />
|
|
33
|
+
<DappSVG v-else-if="action === 'dapp'" />
|
|
34
|
+
<DeploySVG v-else-if="action === 'deploy'" />
|
|
35
|
+
<GasSVG v-else-if="action === 'gas-topup'" />
|
|
36
|
+
<InstadappProSVG v-else-if="action === 'instadapp-pro'" />
|
|
37
|
+
<PermitSignSVG v-else-if="action === 'permit2'" />
|
|
38
|
+
<UpgradeSVG v-else-if="action === 'upgrade'" />
|
|
39
|
+
<HammerSVG v-else-if="action === 'tx-builder'" />
|
|
40
40
|
</template>
|
|
@@ -23,8 +23,12 @@ provide('tokens', props.tokens);
|
|
|
23
23
|
<MetadataBridge v-if="metadata.type === 'bridge'" :metadata="metadata" :chain_id="chain_id" />
|
|
24
24
|
<MetadataPermit2 v-if="metadata.type === 'permit2'" :metadata="metadata" :chain_id="chain_id" />
|
|
25
25
|
|
|
26
|
+
<div v-if="metadata.type === 'mass'">
|
|
27
|
+
Mass Transfer
|
|
28
|
+
</div>
|
|
29
|
+
|
|
26
30
|
<div class="text-left w-fit capitalize" v-if="metadata.type === 'import'">
|
|
27
|
-
Import from {{ metadata.protocol }}
|
|
31
|
+
Import from {{ metadata.protocol }} ({{ (formatUsd(fromWei(metadata.valueInUsd, 10))) }})
|
|
28
32
|
</div>
|
|
29
33
|
|
|
30
34
|
<div v-if="metadata.type === 'upgrade'" class="self-start">
|
|
@@ -32,7 +36,7 @@ provide('tokens', props.tokens);
|
|
|
32
36
|
</div>
|
|
33
37
|
<div v-if="metadata.type === 'dapp'" class="self-start flex items-center gap-2 text-primary">
|
|
34
38
|
<a :href="metadata?.url" target="_blank" rel="noopener noreferrer">{{
|
|
35
|
-
metadata?.name
|
|
39
|
+
metadata?.name || metadata?.url
|
|
36
40
|
}}</a>
|
|
37
41
|
<SvgoExternalLink />
|
|
38
42
|
</div>
|
|
@@ -41,36 +45,38 @@ provide('tokens', props.tokens);
|
|
|
41
45
|
</div>
|
|
42
46
|
<div v-if="metadata.type === 'auth'" class="self-start capitalize flex gap-3">
|
|
43
47
|
Authority {{ metadata.remove ? 'Removed' : 'Added' }}:
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
48
|
+
<a class="text-primary break-all" :href="getExplorerUrl(metadata.chainId, `/address/${metadata.address}`)"
|
|
49
|
+
target="_blank">
|
|
50
|
+
{{ shortenHash(metadata.address) }}
|
|
51
|
+
</a>
|
|
52
|
+
<div class="flex gap-3">
|
|
53
|
+
<ChainLogo class="w-5 h-5" :chain="metadata.chainId" />
|
|
54
|
+
{{ chainIdToName(metadata.chainId) }}
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
<div v-if="metadata.type === 'tx-builder'" class="self-start capitalize flex gap-3">
|
|
58
|
+
<span v-if="!compact">
|
|
59
|
+
Transaction Builder
|
|
60
|
+
</span> ({{ metadata?.actionCount }} {{ toBN(metadata?.actionCount).lt(2) ? 'action' : 'actions' }})
|
|
55
61
|
</div>
|
|
56
62
|
<div v-if="metadata.type === 'instadapp-pro'" class="self-start capitalize flex gap-3">
|
|
57
63
|
Instadapp Pro |
|
|
58
64
|
{{ metadata?.castDetails }}
|
|
59
65
|
</div>
|
|
60
66
|
|
|
61
|
-
<MetadataSigners v-if="metadata.type === 'add-signers' || metadata.type === 'remove-signers'" :metadata="metadata"
|
|
67
|
+
<MetadataSigners v-if="metadata.type === 'add-signers' || metadata.type === 'remove-signers'" :metadata="metadata"
|
|
68
|
+
:compact="compact" />
|
|
62
69
|
|
|
63
|
-
|
|
64
|
-
|
|
70
|
+
<div v-if="metadata.type === 'change-threshold'" class="text-left w-fit">
|
|
71
|
+
Change Threshold to {{ metadata.count }}
|
|
65
72
|
</div>
|
|
66
73
|
|
|
67
74
|
<div v-tippy="{
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
{{ shortenHash(metadata.id) }}
|
|
75
|
+
content: metadata.id,
|
|
76
|
+
maxWidth: 'none',
|
|
77
|
+
interactive: true,
|
|
78
|
+
}" v-if="metadata.type === 'rejection'" class="text-left w-fit">
|
|
79
|
+
{{ shortenHash(metadata.id) }}
|
|
74
80
|
</div>
|
|
75
81
|
</div>
|
|
76
82
|
</template>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
// @ts-expect-error
|
|
2
3
|
import * as XXH from 'xxhashjs';
|
|
3
4
|
|
|
4
5
|
defineProps<{
|
|
@@ -19,11 +20,9 @@ function generateColor(address: string): string {
|
|
|
19
20
|
</script>
|
|
20
21
|
|
|
21
22
|
<template>
|
|
22
|
-
<svg
|
|
23
|
-
:
|
|
24
|
-
|
|
25
|
-
}" width="30" height="30" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 30 30"
|
|
26
|
-
>
|
|
23
|
+
<svg :style="{
|
|
24
|
+
color: generateColor(address),
|
|
25
|
+
}" width="30" height="30" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 30 30">
|
|
27
26
|
<g fill="currentColor" :clip-path="`url(#${randomId})`">
|
|
28
27
|
<rect width="30" height="30" fill-opacity=".4" rx="15" />
|
|
29
28
|
<ellipse cx="15.004" cy="26.399" rx="11.4" ry="6.6" />
|
package/components/ChainLogo.vue
CHANGED
|
@@ -1,22 +1,15 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
<path fill="#97A2B7" fill-rule="evenodd"
|
|
12
|
-
d="M10 3.999A6 6 0 1 0 10 16a6 6 0 0 0 0-12.001Zm0 10.8a4.8 4.8 0 1 1 0-9.6 4.8 4.8 0 0 1 0 9.6ZM6.399 9.67A3.6 3.6 0 0 1 9.68 6.4a.3.3 0 0 1 .318.318v.6a.294.294 0 0 1-.264.282A2.4 2.4 0 0 0 7.6 9.735a.294.294 0 0 1-.3.264h-.6a.312.312 0 0 1-.222-.096.336.336 0 0 1-.078-.234Z"
|
|
13
|
-
clip-rule="evenodd" />
|
|
14
|
-
</svg>
|
|
15
|
-
</template>
|
|
16
|
-
<span v-else-if="stroke" class="outline stroke-color dark:outline-[#161E2D] outline-[#F8FAFC] outline-2 shrink-0 outline outline-offset-[-1.5px] rounded-full">
|
|
17
|
-
<img class="w-full h-full" :src="`https://cdn.instadapp.io/avocado/networks/${chain}.svg`"/>
|
|
2
|
+
<svg v-if="isNetworkNotAvailable" v-bind="$attrs" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 20 20">
|
|
3
|
+
<rect width="20" height="20" fill="#334155" rx="10" />
|
|
4
|
+
<path fill="#97A2B7" fill-rule="evenodd"
|
|
5
|
+
d="M10 3.999A6 6 0 1 0 10 16a6 6 0 0 0 0-12.001Zm0 10.8a4.8 4.8 0 1 1 0-9.6 4.8 4.8 0 0 1 0 9.6ZM6.399 9.67A3.6 3.6 0 0 1 9.68 6.4a.3.3 0 0 1 .318.318v.6a.294.294 0 0 1-.264.282A2.4 2.4 0 0 0 7.6 9.735a.294.294 0 0 1-.3.264h-.6a.312.312 0 0 1-.222-.096.336.336 0 0 1-.078-.234Z"
|
|
6
|
+
clip-rule="evenodd" />
|
|
7
|
+
</svg>
|
|
8
|
+
<span v-else-if="stroke"
|
|
9
|
+
class="outline stroke-color outline-[#161E2D] outline-2 shrink-0 outline outline-offset-[-1.5px] rounded-full">
|
|
10
|
+
<img class="w-full h-full" :src="`https://cdn.instadapp.io/avocado/networks/${chain}.svg`" />
|
|
18
11
|
</span>
|
|
19
|
-
|
|
12
|
+
<img v-else :src="`https://cdn.instadapp.io/avocado/networks/${chain}.svg`" />
|
|
20
13
|
</template>
|
|
21
14
|
|
|
22
15
|
<script lang="ts" setup>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import CopySVG from '
|
|
3
|
-
import CheckCircle from '
|
|
2
|
+
import CopySVG from '../assets/images/icons/copy.svg'
|
|
3
|
+
import CheckCircle from '../assets/images/icons/check-circle.svg'
|
|
4
4
|
|
|
5
5
|
defineProps<{
|
|
6
6
|
text: string
|
|
@@ -12,22 +12,16 @@ const slots = useSlots()
|
|
|
12
12
|
</script>
|
|
13
13
|
|
|
14
14
|
<template>
|
|
15
|
-
<button
|
|
16
|
-
class="text-slate-400 font-semibold inline-flex items-center gap-2.5"
|
|
17
|
-
@click.stop="copy(text)"
|
|
18
|
-
>
|
|
15
|
+
<button class="text-slate-400 font-semibold inline-flex items-center gap-2.5" @click.stop="copy(text)">
|
|
19
16
|
<Transition mode="out-in" name="slide-left">
|
|
20
|
-
<span v-if="copied && !iconOnly"> {{ successText || 'Copied' }}
|
|
17
|
+
<span v-if="copied && !iconOnly"> {{ successText || 'Copied' }} </span>
|
|
21
18
|
<span v-else-if="slots.content">
|
|
22
19
|
<slot name="content" />
|
|
23
20
|
</span>
|
|
24
21
|
</Transition>
|
|
25
22
|
|
|
26
23
|
<Transition mode="out-in" name="slide">
|
|
27
|
-
<CheckCircle
|
|
28
|
-
v-if="copied"
|
|
29
|
-
class="w-4 h-4 shrink-0 dark:text-slate-900 text-white svg-circle"
|
|
30
|
-
/>
|
|
24
|
+
<CheckCircle v-if="copied" class="w-4 h-4 shrink-0 dark:text-slate-900 text-white svg-circle" />
|
|
31
25
|
<slot v-else-if="slots.copy" name="copy" />
|
|
32
26
|
<slot v-else name="copy-icon">
|
|
33
27
|
<CopySVG />
|
|
@@ -20,9 +20,17 @@ const fromToken = asyncComputed(() => {
|
|
|
20
20
|
);
|
|
21
21
|
});
|
|
22
22
|
|
|
23
|
-
const
|
|
23
|
+
const toToken = asyncComputed(() => {
|
|
24
|
+
if (!props?.metadata?.toChainId) return null;
|
|
25
|
+
|
|
26
|
+
if (Array.isArray(tokens) && !tokens.length) return null;
|
|
27
|
+
|
|
28
|
+
return fetchTokenByAddress(props.metadata?.toToken, props?.metadata?.toChainId, tokens);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const formattedToAmount = computed(() =>
|
|
24
32
|
formatDecimal(
|
|
25
|
-
fromWei(props.metadata?.amount,
|
|
33
|
+
fromWei(props.metadata?.amount, toToken?.value?.decimals).toFixed()
|
|
26
34
|
)
|
|
27
35
|
);
|
|
28
36
|
</script>
|
|
@@ -36,7 +44,7 @@ const formattedFromAmount = computed(() =>
|
|
|
36
44
|
<span v-if="!compact" class="capitalize text-xs sm:text-sm">Cross-chain send</span>
|
|
37
45
|
<span class="inline-flex gap-2.5 items-center">
|
|
38
46
|
<img width="20" height="20" class="w-5 h-5" :src="fromToken?.logo_url" />
|
|
39
|
-
{{
|
|
47
|
+
{{ formattedToAmount }}
|
|
40
48
|
<span class="uppercase">{{ fromToken?.symbol }}</span>
|
|
41
49
|
</span>
|
|
42
50
|
</div>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { Tippy } from 'vue-tippy'
|
|
3
|
-
import Info2 from '
|
|
3
|
+
import Info2 from '../../assets/images/icons/info-2.svg'
|
|
4
4
|
|
|
5
5
|
defineProps<{
|
|
6
6
|
metadata: {
|
|
@@ -14,44 +14,47 @@ defineProps<{
|
|
|
14
14
|
<template>
|
|
15
15
|
<div class="font-medium">
|
|
16
16
|
<div v-if="!compact || metadata.addresses.length < 3" class="flex gap-[14px] flex-wrap items-end">
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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">
|
|
23
24
|
{{ shortenHash(address, compact ? 2 : 4) }}
|
|
24
25
|
</p>
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
</template>
|
|
27
|
+
<template #content>
|
|
27
28
|
{{ address }}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
</template>
|
|
30
|
+
</Tippy>
|
|
31
|
+
</div>
|
|
31
32
|
</div>
|
|
32
33
|
<div v-else class="flex gap-2 flex-wrap items-center">
|
|
33
|
-
<div v-for="address of [metadata.addresses[0], metadata.addresses[1]].filter(Boolean)" :key="address"
|
|
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">
|
|
34
36
|
<AuthorityAvatar :address="address" class="w-[18px] h-[18px]" />
|
|
35
37
|
|
|
36
38
|
<Tippy max-width="none" interactive>
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
<template #default>
|
|
40
|
+
<p class="text-xs leading-5 text-slate-400">
|
|
41
|
+
{{ shortenHash(address, 2) }}
|
|
42
|
+
</p>
|
|
43
|
+
</template>
|
|
44
|
+
<template #content>
|
|
43
45
|
{{ address }}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
+
</template>
|
|
47
|
+
</Tippy>
|
|
46
48
|
</div>
|
|
47
|
-
|
|
49
|
+
|
|
48
50
|
<Tippy max-width="none" interactive tag="button" content-tag="div" content-class="content-wrapper">
|
|
49
51
|
<template #default>
|
|
50
52
|
<Info2 class="w-[16px] h-[16px] text-slate-500 rounded-full" />
|
|
51
53
|
</template>
|
|
52
54
|
<template #content>
|
|
53
55
|
<ul class="flex flex-col gap-2.5">
|
|
54
|
-
<li v-for="address in metadata.addresses" :key="address"
|
|
56
|
+
<li v-for="address in metadata.addresses" :key="address"
|
|
57
|
+
class="flex text-xs text-slate-400 items-center gap-2.5">
|
|
55
58
|
<AuthorityAvatar class="shrink-0 w-5 h-5" :address="address" />
|
|
56
59
|
{{ address }}
|
|
57
60
|
</li>
|
|
@@ -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>
|
package/package.json
CHANGED
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instadapp/avocado-base",
|
|
3
|
-
"version": "0.0.0-dev.
|
|
3
|
+
"version": "0.0.0-dev.9d62a67",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./nuxt.config.ts",
|
|
6
6
|
"types": "global.d.ts",
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": ">=v18.18.0"
|
|
9
|
+
},
|
|
7
10
|
"scripts": {
|
|
8
11
|
"build": "nuxt build",
|
|
9
12
|
"dev": "nuxt dev",
|
|
10
13
|
"generate": "nuxt generate",
|
|
11
14
|
"preview": "nuxt preview",
|
|
12
|
-
"generate:contracts": "rimraf contracts && typechain --target=ethers-v5 'abi/*.json' --out-dir 'contracts'"
|
|
15
|
+
"generate:contracts": "rimraf contracts && typechain --target=ethers-v5 'abi/*.json' --out-dir 'contracts'",
|
|
16
|
+
"typecheck": "nuxi typecheck"
|
|
13
17
|
},
|
|
14
18
|
"devDependencies": {
|
|
15
|
-
"@
|
|
16
|
-
"@instadapp/avocado-dev": "npm:@instadapp/avocado@dev",
|
|
17
|
-
"@nuxtjs/tailwindcss": "^6.6.5",
|
|
19
|
+
"@nuxtjs/tailwindcss": "^6.11.3",
|
|
18
20
|
"@typechain/ethers-v5": "^10.2.0",
|
|
19
|
-
"nuxt": "^3.
|
|
20
|
-
"nuxt-svgo": "^
|
|
21
|
+
"nuxt": "^3.10.1",
|
|
22
|
+
"nuxt-svgo": "^4.0.0",
|
|
21
23
|
"rimraf": "^3.0.2",
|
|
22
24
|
"typechain": "^8.1.1",
|
|
23
25
|
"unplugin-vue-components": "^0.25.1",
|
|
@@ -27,6 +29,7 @@
|
|
|
27
29
|
"@vueuse/nuxt": "^10.2.0",
|
|
28
30
|
"bignumber.js": "^9.1.1",
|
|
29
31
|
"ethers": "^5.7.2",
|
|
32
|
+
"viem": "^2.7.16",
|
|
30
33
|
"xxhashjs": "^0.2.2"
|
|
31
34
|
}
|
|
32
35
|
}
|
package/utils/formatter.ts
CHANGED
|
@@ -19,7 +19,7 @@ export function formatPercent(
|
|
|
19
19
|
return formatter.format(valueAsNumber);
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
export function shortenHash(hash: string
|
|
22
|
+
export function shortenHash(hash: string | `0x${string}`, length: number = 4) {
|
|
23
23
|
if (!hash) return;
|
|
24
24
|
if (hash.length < 12) return hash;
|
|
25
25
|
const beginningChars = hash.startsWith("0x") ? length + 2 : length;
|
package/utils/metadata.ts
CHANGED
|
@@ -19,7 +19,9 @@ export const MetadataEnums = {
|
|
|
19
19
|
"remove-signers": "remove-signers",
|
|
20
20
|
"change-threshold": "change-threshold",
|
|
21
21
|
import: "import",
|
|
22
|
-
|
|
22
|
+
mass: "mass",
|
|
23
|
+
"tx-builder": "tx-builder",
|
|
24
|
+
"avocado-bridge": "avocado-bridge",
|
|
23
25
|
} as const;
|
|
24
26
|
|
|
25
27
|
const multiMetadataTypes = ["bytes[]"];
|
|
@@ -58,7 +60,7 @@ const actionMetadataTypes: Record<MetadataTypes, string[]> = {
|
|
|
58
60
|
import: ["bytes32 protocol", "uint256 valueInUsd"],
|
|
59
61
|
auth: ["address address", "uint256 chainId", "bool remove"],
|
|
60
62
|
deploy: [],
|
|
61
|
-
"
|
|
63
|
+
"tx-builder": ["bytes32 actionCount"],
|
|
62
64
|
permit2: [
|
|
63
65
|
"address token",
|
|
64
66
|
"address spender",
|
|
@@ -70,6 +72,8 @@ const actionMetadataTypes: Record<MetadataTypes, string[]> = {
|
|
|
70
72
|
"remove-signers": ["address[] signers"],
|
|
71
73
|
"change-threshold": ["uint8 count"],
|
|
72
74
|
rejection: ["bytes32 id"],
|
|
75
|
+
"avocado-bridge": ["bytes32 id", "uint256 toChainId"],
|
|
76
|
+
mass: ["bool isMass"],
|
|
73
77
|
};
|
|
74
78
|
|
|
75
79
|
const encodeMetadata = (props: MetadataProps) => {
|
|
@@ -97,6 +101,24 @@ export const encodeDappMetadata = (
|
|
|
97
101
|
return single ? encodeMultipleActions(data) : data;
|
|
98
102
|
};
|
|
99
103
|
|
|
104
|
+
export const encodeAvocadoBridgeMetadata = (
|
|
105
|
+
id: string,
|
|
106
|
+
toChainId: string | number,
|
|
107
|
+
single = true
|
|
108
|
+
) => {
|
|
109
|
+
const encodedData = ethers.utils.defaultAbiCoder.encode(
|
|
110
|
+
actionMetadataTypes["avocado-bridge"],
|
|
111
|
+
[id, toChainId]
|
|
112
|
+
);
|
|
113
|
+
|
|
114
|
+
const data = encodeMetadata({
|
|
115
|
+
type: MetadataEnums["avocado-bridge"],
|
|
116
|
+
encodedData,
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
return single ? encodeMultipleActions(data) : data;
|
|
120
|
+
};
|
|
121
|
+
|
|
100
122
|
export const encodeTransferMetadata = (
|
|
101
123
|
params: SendMetadataProps,
|
|
102
124
|
single = true
|
|
@@ -177,10 +199,18 @@ export const encodeDeployMetadata = (single = true) => {
|
|
|
177
199
|
return single ? encodeMultipleActions(data) : data;
|
|
178
200
|
};
|
|
179
201
|
|
|
180
|
-
export const encodeTransactionBuilderMetadata = (
|
|
202
|
+
export const encodeTransactionBuilderMetadata = (
|
|
203
|
+
actionCount: string,
|
|
204
|
+
single = true
|
|
205
|
+
) => {
|
|
206
|
+
const encodedData = ethers.utils.defaultAbiCoder.encode(
|
|
207
|
+
actionMetadataTypes["tx-builder"],
|
|
208
|
+
[actionCount]
|
|
209
|
+
);
|
|
210
|
+
|
|
181
211
|
const data = encodeMetadata({
|
|
182
|
-
type: MetadataEnums["
|
|
183
|
-
encodedData
|
|
212
|
+
type: MetadataEnums["tx-builder"],
|
|
213
|
+
encodedData,
|
|
184
214
|
});
|
|
185
215
|
|
|
186
216
|
return single ? encodeMultipleActions(data) : data;
|
|
@@ -338,6 +368,15 @@ export const encodeImportMetadata = (
|
|
|
338
368
|
return single ? encodeMultipleActions(data) : data;
|
|
339
369
|
};
|
|
340
370
|
|
|
371
|
+
export const encodeMassMetadata = (single = true) => {
|
|
372
|
+
const data = encodeMetadata({
|
|
373
|
+
type: MetadataEnums.mass,
|
|
374
|
+
encodedData: '0x',
|
|
375
|
+
});
|
|
376
|
+
|
|
377
|
+
return single ? encodeMultipleActions(data) : data;
|
|
378
|
+
}
|
|
379
|
+
|
|
341
380
|
export const encodeAddSignersMetadata = (
|
|
342
381
|
addresses: string[],
|
|
343
382
|
single = true
|
|
@@ -468,8 +507,9 @@ const typesPayload: IPayload = {
|
|
|
468
507
|
deploy: (data, type) => ({
|
|
469
508
|
type,
|
|
470
509
|
}),
|
|
471
|
-
"
|
|
510
|
+
"tx-builder": (data, type) => ({
|
|
472
511
|
type,
|
|
512
|
+
actionCount: utils.parseBytes32String(data.actionCount || ""),
|
|
473
513
|
}),
|
|
474
514
|
permit2: (data, type) => ({
|
|
475
515
|
type,
|
|
@@ -512,6 +552,14 @@ const typesPayload: IPayload = {
|
|
|
512
552
|
type,
|
|
513
553
|
count: data.count,
|
|
514
554
|
}),
|
|
555
|
+
"avocado-bridge": (data, type) => ({
|
|
556
|
+
type,
|
|
557
|
+
id: data.id,
|
|
558
|
+
toChainId: data.toChainId ? data.toChainId.toString() : null,
|
|
559
|
+
}),
|
|
560
|
+
mass: (data, type) => ({
|
|
561
|
+
type,
|
|
562
|
+
}),
|
|
515
563
|
};
|
|
516
564
|
|
|
517
565
|
const parseMetadata = (metadata: string) => {
|
package/utils/network.ts
CHANGED
|
@@ -1,4 +1,21 @@
|
|
|
1
1
|
import { ethers } from "ethers";
|
|
2
|
+
import {
|
|
3
|
+
polygon,
|
|
4
|
+
arbitrum,
|
|
5
|
+
mainnet,
|
|
6
|
+
base,
|
|
7
|
+
optimism,
|
|
8
|
+
polygonZkEvm,
|
|
9
|
+
bsc,
|
|
10
|
+
avalanche,
|
|
11
|
+
fantom,
|
|
12
|
+
gnosis,
|
|
13
|
+
aurora,
|
|
14
|
+
fuse,
|
|
15
|
+
scroll,
|
|
16
|
+
opBNB,
|
|
17
|
+
mode,
|
|
18
|
+
} from "viem/chains";
|
|
2
19
|
import {
|
|
3
20
|
AVO_PROD_CHAIN_NAME,
|
|
4
21
|
AVO_PROD_CHAIN_ID,
|
|
@@ -9,11 +26,44 @@ import {
|
|
|
9
26
|
AVO_STAGING_RPC_URL,
|
|
10
27
|
AVO_STAGING_EXPLORER_URL,
|
|
11
28
|
} from "./avocado";
|
|
29
|
+
import { defineChain } from "viem";
|
|
12
30
|
|
|
13
31
|
export const bridgeDisabledNetworks = [];
|
|
14
32
|
|
|
15
33
|
export const networksSimulationNotSupported = [1313161554, 1101];
|
|
16
34
|
|
|
35
|
+
const avocado = defineChain({
|
|
36
|
+
id: AVO_PROD_CHAIN_ID,
|
|
37
|
+
name: AVO_PROD_CHAIN_NAME,
|
|
38
|
+
nativeCurrency: {
|
|
39
|
+
name: "Avocado",
|
|
40
|
+
symbol: "USDC",
|
|
41
|
+
decimals: 18,
|
|
42
|
+
},
|
|
43
|
+
rpcUrls: {
|
|
44
|
+
default: { http: [AVO_PROD_RPC_URL] },
|
|
45
|
+
},
|
|
46
|
+
blockExplorers: {
|
|
47
|
+
default: { name: "Avoscan", url: AVO_PROD_EXPLORER_URL },
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
const avocadoStaging = defineChain({
|
|
52
|
+
id: AVO_STAGING_CHAIN_ID,
|
|
53
|
+
name: AVO_STAGING_CHAIN_NAME,
|
|
54
|
+
nativeCurrency: {
|
|
55
|
+
name: "Avocado",
|
|
56
|
+
symbol: "USDC",
|
|
57
|
+
decimals: 18,
|
|
58
|
+
},
|
|
59
|
+
rpcUrls: {
|
|
60
|
+
default: { http: [AVO_STAGING_RPC_URL] },
|
|
61
|
+
},
|
|
62
|
+
blockExplorers: {
|
|
63
|
+
default: { name: "Avoscan", url: AVO_STAGING_EXPLORER_URL },
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
|
|
17
67
|
export const networks: Network[] = [
|
|
18
68
|
{
|
|
19
69
|
name: "Polygon",
|
|
@@ -22,10 +72,13 @@ export const networks: Network[] = [
|
|
|
22
72
|
zerionName: "polygon",
|
|
23
73
|
color: "#7A4ADD",
|
|
24
74
|
chainId: 137,
|
|
75
|
+
viemChain: polygon,
|
|
25
76
|
balanceResolverAddress: "0x58632D23120b20650262b8A629a14e4F4043E0D9",
|
|
26
77
|
usdcAddress: "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",
|
|
27
78
|
explorerUrl: "https://polygonscan.com",
|
|
28
79
|
apiURL: "https://api.polygonscan.com",
|
|
80
|
+
fakeTransactionHash:
|
|
81
|
+
"0x906c551abd5873a428505b6530ac14d91367820706c7ee525f6d7313265d1c92",
|
|
29
82
|
get serverRpcUrl() {
|
|
30
83
|
return process.env?.POLYGON_RPC_URL || this.params.rpcUrls[0];
|
|
31
84
|
},
|
|
@@ -44,10 +97,13 @@ export const networks: Network[] = [
|
|
|
44
97
|
debankName: "arb",
|
|
45
98
|
ankrName: "arbitrum",
|
|
46
99
|
zerionName: "arbitrum",
|
|
100
|
+
viemChain: arbitrum,
|
|
47
101
|
color: "#2D374B",
|
|
48
102
|
chainId: 42161,
|
|
49
103
|
usdcAddress: "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8",
|
|
50
104
|
balanceResolverAddress: "0xca5f37e6D8bB24c5A7958d5eccE7Bd9Aacc944f2",
|
|
105
|
+
fakeTransactionHash:
|
|
106
|
+
"0x9fa291c3b09d31f19b1fa5dd05f30169d1364036d5f7c14b026410bc07bd8843",
|
|
51
107
|
explorerUrl: "https://arbiscan.io",
|
|
52
108
|
apiURL: "https://api.arbiscan.io",
|
|
53
109
|
get serverRpcUrl() {
|
|
@@ -68,8 +124,11 @@ export const networks: Network[] = [
|
|
|
68
124
|
debankName: "eth",
|
|
69
125
|
ankrName: "eth",
|
|
70
126
|
zerionName: "ethereum",
|
|
127
|
+
viemChain: mainnet,
|
|
71
128
|
chainId: 1,
|
|
72
129
|
explorerUrl: "https://etherscan.io",
|
|
130
|
+
fakeTransactionHash:
|
|
131
|
+
"0x13232dd32cef2f641ead890a507710c96560c8c9c3d5fab6facb5ec563c49433",
|
|
73
132
|
apiURL: "https://api.etherscan.io",
|
|
74
133
|
color: "#5D5FEF",
|
|
75
134
|
get serverRpcUrl() {
|
|
@@ -91,7 +150,10 @@ export const networks: Network[] = [
|
|
|
91
150
|
chainId: 8453,
|
|
92
151
|
color: "#1E2024",
|
|
93
152
|
ankrName: "base",
|
|
153
|
+
viemChain: base,
|
|
94
154
|
explorerUrl: "https://basescan.org",
|
|
155
|
+
fakeTransactionHash:
|
|
156
|
+
"0xf7833d80da33730c4fc5d4c64151f0eaa64c0c0535be022af0228a44cc4e9c8e",
|
|
95
157
|
apiURL: "https://api.basescan.org",
|
|
96
158
|
get serverRpcUrl() {
|
|
97
159
|
return process.env?.BASE_RPC_URL || this.params.rpcUrls[0];
|
|
@@ -114,10 +176,13 @@ export const networks: Network[] = [
|
|
|
114
176
|
ankrName: "optimism",
|
|
115
177
|
zerionName: "optimism",
|
|
116
178
|
color: "#FF0420",
|
|
179
|
+
viemChain: optimism,
|
|
117
180
|
chainId: 10,
|
|
118
181
|
apiURL: "https://api-optimistic.etherscan.io",
|
|
119
182
|
usdcAddress: "0x7f5c764cbc14f9669b88837ca1490cca17c31607",
|
|
120
183
|
balanceResolverAddress: "0xca5f37e6D8bB24c5A7958d5eccE7Bd9Aacc944f2",
|
|
184
|
+
fakeTransactionHash:
|
|
185
|
+
"0xee7311d68059732b05088f2144dfec6c7a4f5fd0433eb85306afcd6bdf17cebc",
|
|
121
186
|
explorerUrl: "https://optimistic.etherscan.io",
|
|
122
187
|
get serverRpcUrl() {
|
|
123
188
|
return process.env?.OPTIMISM_RPC_URL || this.params.rpcUrls[0];
|
|
@@ -137,9 +202,12 @@ export const networks: Network[] = [
|
|
|
137
202
|
chainId: 1101,
|
|
138
203
|
color: "#8544f6",
|
|
139
204
|
ankrName: "polygon_zkevm",
|
|
205
|
+
viemChain: polygonZkEvm,
|
|
140
206
|
explorerUrl: "https://zkevm.polygonscan.com",
|
|
141
207
|
apiURL: "https://api-zkevm.polygonscan.com",
|
|
142
208
|
balanceResolverAddress: "0x48D1Fa5Ee6691a1E0B45d2B515650997BEA27a01",
|
|
209
|
+
fakeTransactionHash:
|
|
210
|
+
"0x1077130463ade91ad4e9c43c3195298e26a99970975238128912490eea12bf41",
|
|
143
211
|
usdcAddress: "0xa8ce8aee21bc2a48a5ef670afcc9274c7bbbc035",
|
|
144
212
|
get serverRpcUrl() {
|
|
145
213
|
return process.env?.POLYGON_ZKEVM_RPC_URL || this.params.rpcUrls[0];
|
|
@@ -162,6 +230,9 @@ export const networks: Network[] = [
|
|
|
162
230
|
color: "#F3BA2F",
|
|
163
231
|
chainId: 56,
|
|
164
232
|
explorerUrl: "https://bscscan.com",
|
|
233
|
+
viemChain: bsc,
|
|
234
|
+
fakeTransactionHash:
|
|
235
|
+
"0x897d54bf8e492f840bd4d8f1e743bfcab8226ab4d5a899e47ee433dcd6d6abf7",
|
|
165
236
|
apiURL: "https://api.bscscan.com",
|
|
166
237
|
usdcAddress: "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d",
|
|
167
238
|
balanceResolverAddress: "0xb808cff38706e267067b0af427726aa099f69f89",
|
|
@@ -184,10 +255,13 @@ export const networks: Network[] = [
|
|
|
184
255
|
ankrName: "avalanche",
|
|
185
256
|
zerionName: "avalanche",
|
|
186
257
|
color: "#EB5757",
|
|
258
|
+
viemChain: avalanche,
|
|
187
259
|
chainId: 43114,
|
|
188
260
|
usdcAddress: "0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e",
|
|
189
261
|
balanceResolverAddress: "0x63009f31D054E0ac9F321Cf0D642375236A4Bf1E",
|
|
190
262
|
explorerUrl: "https://snowtrace.io",
|
|
263
|
+
fakeTransactionHash:
|
|
264
|
+
"0x233aac7402558dd4e23f938a50f983e67f5c9604233981c7ac74e63737b8294e",
|
|
191
265
|
apiURL: "https://api.snowtrace.io",
|
|
192
266
|
get serverRpcUrl() {
|
|
193
267
|
return process.env?.AVALANCHE_RPC_URL || this.params.rpcUrls[0];
|
|
@@ -209,11 +283,14 @@ export const networks: Network[] = [
|
|
|
209
283
|
explorerUrl: "https://ftmscan.com",
|
|
210
284
|
ankrName: "fantom",
|
|
211
285
|
color: "#1969ff",
|
|
286
|
+
viemChain: fantom,
|
|
212
287
|
get serverRpcUrl() {
|
|
213
288
|
return process.env?.FANTOM_RPC_URL || this.params.rpcUrls[0];
|
|
214
289
|
},
|
|
215
290
|
usdcAddress: "0x04068da6c83afcfa0e13ba15a6696662335d5b75",
|
|
216
291
|
balanceResolverAddress: "0x929376c77a2fb8152375a089a4fccf84ff481479",
|
|
292
|
+
fakeTransactionHash:
|
|
293
|
+
"0x1e9a8405d660172314124e06896212c0786d7fb1550b89410d4bc87e9e8054e4",
|
|
217
294
|
params: {
|
|
218
295
|
rpcUrls: ["https://rpc.ankr.com/fantom"],
|
|
219
296
|
chainName: "Fantom",
|
|
@@ -230,9 +307,12 @@ export const networks: Network[] = [
|
|
|
230
307
|
zerionName: "xdai",
|
|
231
308
|
color: "#04795C",
|
|
232
309
|
ankrName: "gnosis",
|
|
310
|
+
viemChain: gnosis,
|
|
233
311
|
chainId: 100,
|
|
234
312
|
balanceResolverAddress: "0xfaa244e276b1597f663975ed007ee4ff70d27849",
|
|
235
313
|
explorerUrl: "https://gnosisscan.io",
|
|
314
|
+
fakeTransactionHash:
|
|
315
|
+
"0x1513033806310a2c3b29f2276f8aa7388461b0ef9f8499c297e68c12187c179b",
|
|
236
316
|
apiURL: "https://api.gnosisscan.io",
|
|
237
317
|
usdcAddress: "0xddafbb505ad214d7b80b1f830fccc89b60fb7a83",
|
|
238
318
|
get serverRpcUrl() {
|
|
@@ -253,7 +333,10 @@ export const networks: Network[] = [
|
|
|
253
333
|
chainId: 1313161554,
|
|
254
334
|
zerionName: "aurora",
|
|
255
335
|
color: "#78d64b",
|
|
336
|
+
viemChain: aurora,
|
|
256
337
|
explorerUrl: "https://explorer.mainnet.aurora.dev",
|
|
338
|
+
fakeTransactionHash:
|
|
339
|
+
"0x0923401c5a80c39a5cd57c098a6c4729edbefd0db6894def7d349493f4ff3ec6",
|
|
257
340
|
get serverRpcUrl() {
|
|
258
341
|
return process.env?.AURORA_RPC_URL || this.params.rpcUrls[0];
|
|
259
342
|
},
|
|
@@ -269,32 +352,119 @@ export const networks: Network[] = [
|
|
|
269
352
|
},
|
|
270
353
|
},
|
|
271
354
|
},
|
|
355
|
+
{
|
|
356
|
+
name: "Fuse",
|
|
357
|
+
chainId: 122,
|
|
358
|
+
zerionName: "fuse",
|
|
359
|
+
color: "#78d64b",
|
|
360
|
+
explorerUrl: "https://explorer.fuse.io",
|
|
361
|
+
viemChain: fuse,
|
|
362
|
+
fakeTransactionHash:
|
|
363
|
+
"0xf22a8031de9b978a57c728e18c6b54633356c39db4d0466e53b9b7c3ee7f8def",
|
|
364
|
+
get serverRpcUrl() {
|
|
365
|
+
return process.env?.FUSE_RPC_URL || this.params.rpcUrls[0];
|
|
366
|
+
},
|
|
367
|
+
usdcAddress: "",
|
|
368
|
+
balanceResolverAddress: "0xdF19Da523DA64bBE82eE0E4DFf00d676A8386474",
|
|
369
|
+
params: {
|
|
370
|
+
rpcUrls: ["https://fuse-mainnet.chainstacklabs.com"],
|
|
371
|
+
chainName: "Fuse",
|
|
372
|
+
nativeCurrency: {
|
|
373
|
+
decimals: 18,
|
|
374
|
+
name: "Fuse",
|
|
375
|
+
symbol: "fuse",
|
|
376
|
+
},
|
|
377
|
+
},
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
name: "Scroll",
|
|
381
|
+
chainId: 534352,
|
|
382
|
+
color: "#78d64b",
|
|
383
|
+
ankrName: 'scroll',
|
|
384
|
+
explorerUrl: "https://scrollscan.com",
|
|
385
|
+
viemChain: scroll,
|
|
386
|
+
fakeTransactionHash:
|
|
387
|
+
"0x6bf297c414264fc8cddd47224632b4426a02138df2f50fe891eca87f6aefea01",
|
|
388
|
+
get serverRpcUrl() {
|
|
389
|
+
return process.env?.SCROLL_RPC_URL || this.params.rpcUrls[0];
|
|
390
|
+
},
|
|
391
|
+
params: {
|
|
392
|
+
rpcUrls: ["https://rpc.scroll.io"],
|
|
393
|
+
chainName: "Scroll",
|
|
394
|
+
nativeCurrency: {
|
|
395
|
+
name: "Ethereum",
|
|
396
|
+
symbol: "ETH",
|
|
397
|
+
decimals: 18,
|
|
398
|
+
},
|
|
399
|
+
},
|
|
400
|
+
},
|
|
401
|
+
{
|
|
402
|
+
name: "opBNB",
|
|
403
|
+
chainId: 204,
|
|
404
|
+
color: "#78d64b",
|
|
405
|
+
explorerUrl: "https://opbnbscan.com",
|
|
406
|
+
viemChain: opBNB,
|
|
407
|
+
fakeTransactionHash:
|
|
408
|
+
"0xb9438a3eae61442bc7d419d79930370ce09ac0f46e0695025751e3bfe1a931e7",
|
|
409
|
+
get serverRpcUrl() {
|
|
410
|
+
return process.env?.OPBNB_RPC_URL || this.params.rpcUrls[0];
|
|
411
|
+
},
|
|
412
|
+
params: {
|
|
413
|
+
rpcUrls: ["https://opbnb-mainnet-rpc.bnbchain.org"],
|
|
414
|
+
chainName: "opBNB",
|
|
415
|
+
nativeCurrency: {
|
|
416
|
+
name: "BNB",
|
|
417
|
+
symbol: "BNB",
|
|
418
|
+
decimals: 18,
|
|
419
|
+
},
|
|
420
|
+
},
|
|
421
|
+
},
|
|
422
|
+
{
|
|
423
|
+
chainId: 34443,
|
|
424
|
+
name: "Mode",
|
|
425
|
+
color: "#d7ff00",
|
|
426
|
+
explorerUrl: 'https://explorer.mode.network',
|
|
427
|
+
fakeTransactionHash: '0xb58002db3481f2c51855a91280ec940d0bebec075c4b362b9f90c21a2b14edbe',
|
|
428
|
+
params: {
|
|
429
|
+
rpcUrls: ["https://1rpc.io/mode"],
|
|
430
|
+
chainName: "Mode",
|
|
431
|
+
nativeCurrency: {
|
|
432
|
+
name: "Ethereum",
|
|
433
|
+
symbol: "ETH",
|
|
434
|
+
decimals: 18,
|
|
435
|
+
}
|
|
436
|
+
},
|
|
437
|
+
get serverRpcUrl() {
|
|
438
|
+
return process.env?.MODE_RPC_URL || this.params.rpcUrls[0];
|
|
439
|
+
},
|
|
440
|
+
viemChain: mode,
|
|
441
|
+
},
|
|
272
442
|
// {
|
|
273
|
-
// name: "
|
|
274
|
-
// chainId:
|
|
275
|
-
//
|
|
276
|
-
// color: "#78d64b",
|
|
277
|
-
// explorerUrl: "https://explorer.fuse.io",
|
|
278
|
-
// get serverRpcUrl() {
|
|
279
|
-
// return process.env?.FUSE_RPC_URL || this.params.rpcUrls[0];
|
|
280
|
-
// },
|
|
281
|
-
// usdcAddress: "",
|
|
282
|
-
// balanceResolverAddress: "0xdF19Da523DA64bBE82eE0E4DFf00d676A8386474",
|
|
443
|
+
// name: "Manta Pacific",
|
|
444
|
+
// chainId: 169,
|
|
445
|
+
// explorerUrl: "https://pacific-explorer.manta.network",
|
|
283
446
|
// params: {
|
|
284
|
-
// rpcUrls: ["https://
|
|
285
|
-
// chainName: "
|
|
447
|
+
// rpcUrls: ["https://pacific-rpc.manta.network/http"],
|
|
448
|
+
// chainName: "Manta Pacific",
|
|
286
449
|
// nativeCurrency: {
|
|
450
|
+
// name: "Ethereum",
|
|
451
|
+
// symbol: "ETH",
|
|
287
452
|
// decimals: 18,
|
|
288
|
-
// name: "Fuse",
|
|
289
|
-
// symbol: "fuse",
|
|
290
453
|
// },
|
|
291
454
|
// },
|
|
455
|
+
// color: "#78d64b",
|
|
456
|
+
// fakeTransactionHash: "0x3fB128aA5AC254C8539996B11C587E521AE0d3ab",
|
|
457
|
+
// get serverRpcUrl() {
|
|
458
|
+
// return process.env?.MANTA_RPC_URL || this.params.rpcUrls[0];
|
|
459
|
+
// },
|
|
292
460
|
// },
|
|
293
461
|
{
|
|
294
462
|
name: AVO_PROD_CHAIN_NAME,
|
|
295
463
|
chainId: AVO_PROD_CHAIN_ID,
|
|
296
464
|
isAvocado: true,
|
|
297
465
|
balanceResolverAddress: "",
|
|
466
|
+
fakeTransactionHash: "",
|
|
467
|
+
viemChain: avocado,
|
|
298
468
|
color: "#16A34A",
|
|
299
469
|
usdcAddress: "",
|
|
300
470
|
serverRpcUrl: AVO_PROD_RPC_URL,
|
|
@@ -316,6 +486,8 @@ export const networks: Network[] = [
|
|
|
316
486
|
serverRpcUrl: AVO_STAGING_RPC_URL,
|
|
317
487
|
color: "#16A34A",
|
|
318
488
|
explorerUrl: AVO_STAGING_EXPLORER_URL,
|
|
489
|
+
viemChain: avocadoStaging,
|
|
490
|
+
fakeTransactionHash: "",
|
|
319
491
|
isAvocado: true,
|
|
320
492
|
balanceResolverAddress: "",
|
|
321
493
|
usdcAddress: "",
|
|
@@ -338,6 +510,7 @@ export const chainUsdcAddresses = [
|
|
|
338
510
|
{ chainId: 56, address: "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d" },
|
|
339
511
|
{ chainId: 100, address: "0xddafbb505ad214d7b80b1f830fccc89b60fb7a83" },
|
|
340
512
|
{ chainId: 137, address: "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174" },
|
|
513
|
+
{ chainId: 137, address: "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359" },
|
|
341
514
|
{ chainId: 250, address: "0x04068da6c83afcfa0e13ba15a6696662335d5b75" },
|
|
342
515
|
{ chainId: 42161, address: "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8" },
|
|
343
516
|
{ chainId: 42161, address: "0xaf88d065e77c8cc2239327c5edb3a432268e5831" },
|
|
@@ -363,12 +536,16 @@ export const availableNetworks = networks.filter(
|
|
|
363
536
|
|
|
364
537
|
export const chainIdToName = (chainId: ChainId | number | string) => {
|
|
365
538
|
const network = getNetworkByChainId(chainId);
|
|
366
|
-
return network
|
|
539
|
+
return network?.name;
|
|
367
540
|
};
|
|
368
541
|
|
|
369
542
|
export const getRpcURLByChainId = (chainId: ChainId | number | string) => {
|
|
370
|
-
|
|
371
|
-
|
|
543
|
+
try {
|
|
544
|
+
const network = getNetworkByChainId(chainId);
|
|
545
|
+
return network.params.rpcUrls[0];
|
|
546
|
+
} catch (e) {
|
|
547
|
+
return "";
|
|
548
|
+
}
|
|
372
549
|
};
|
|
373
550
|
|
|
374
551
|
export const RPCMap = networks.reduce((acc, network) => {
|
|
@@ -410,5 +587,6 @@ export const getExplorerUrl = (
|
|
|
410
587
|
suffix: `/${string}` = "/"
|
|
411
588
|
) => {
|
|
412
589
|
const network = getNetworkByChainId(chainId);
|
|
590
|
+
if (!network) return "";
|
|
413
591
|
return `${network.explorerUrl}${suffix}`;
|
|
414
592
|
};
|
package/utils/utils.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { Chain } from "viem";
|
|
2
|
+
|
|
1
3
|
declare global {
|
|
2
4
|
type ChainId =
|
|
3
5
|
| 1
|
|
@@ -13,7 +15,11 @@ declare global {
|
|
|
13
15
|
| 1313161554
|
|
14
16
|
| 8453
|
|
15
17
|
| 122
|
|
16
|
-
|
|
|
18
|
+
| 534352
|
|
19
|
+
| 204
|
|
20
|
+
| 63400
|
|
21
|
+
| 169
|
|
22
|
+
| 34443
|
|
17
23
|
|
|
18
24
|
type ISlackMessageType = "danger" | "error" | "success" | "banner";
|
|
19
25
|
|
|
@@ -33,8 +39,10 @@ declare global {
|
|
|
33
39
|
isAvocado?: boolean;
|
|
34
40
|
serverRpcUrl: string | undefined;
|
|
35
41
|
balanceResolverAddress?: string;
|
|
36
|
-
usdcAddress
|
|
42
|
+
usdcAddress?: string;
|
|
37
43
|
explorerUrl: string;
|
|
44
|
+
fakeTransactionHash: string;
|
|
45
|
+
viemChain: Chain;
|
|
38
46
|
apiURL?: string;
|
|
39
47
|
params: {
|
|
40
48
|
chainName?: string;
|