@instadapp/avocado-base 0.0.0-dev.3c3e03a → 0.0.0-dev.40fbb56
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/.vscode/settings.json +67 -0
- package/abi/avoFactoryProxy.json +1 -1
- package/abi/forwarder.json +1 -1
- package/abi/multisigAgnosticForwarder.json +937 -0
- package/abi/multisigForwarder.json +697 -0
- package/app.vue +5 -5
- package/assets/images/icons/check.svg +3 -0
- package/assets/images/icons/copy.svg +9 -2
- package/assets/images/icons/hammer.svg +5 -0
- package/assets/images/icons/info-2.svg +12 -0
- package/assets/images/icons/stars.svg +4 -0
- package/components/ActionLogo.vue +33 -29
- package/components/ActionMetadata.vue +45 -29
- package/components/Address.vue +74 -0
- package/components/AuthorityAvatar.vue +5 -4
- package/components/ChainLogo.vue +22 -25
- package/components/CopyClipboard.vue +16 -38
- package/components/metadata/Bridge.vue +22 -23
- package/components/metadata/CrossTransfer.vue +35 -30
- package/components/metadata/GasTopup.vue +14 -15
- package/components/metadata/Permit2.vue +12 -13
- package/components/metadata/Signers.vue +12 -38
- package/components/metadata/Swap.vue +45 -53
- package/components/metadata/Transfer.vue +25 -27
- package/contracts/MultisigAgnosticForwarder.ts +1423 -0
- package/contracts/MultisigForwarder.ts +859 -0
- package/contracts/factories/MultisigAgnosticForwarder__factory.ts +2135 -0
- package/contracts/factories/MultisigForwarder__factory.ts +721 -0
- package/contracts/factories/index.ts +2 -0
- package/contracts/index.ts +4 -0
- package/eslint.config.mjs +34 -0
- package/nuxt.config.ts +21 -12
- package/package.json +14 -14
- package/server/utils/index.ts +4 -4
- package/utils/avocado.ts +17 -17
- package/utils/bignumber.ts +47 -36
- package/utils/formatter.ts +55 -61
- package/utils/helper.ts +33 -30
- package/utils/metadata.ts +431 -310
- package/utils/network.ts +523 -202
- package/utils/services.ts +11 -13
- package/utils/utils.d.ts +120 -105
|
@@ -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>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg width="18" height="18" viewBox="0 0 18 18" fill="none"
|
|
2
|
+
xmlns="http://www.w3.org/2000/svg">
|
|
3
|
+
<path d="M16.0678 8.64793L17.2102 9.79039C17.4404 10.0205 17.4334 10.4006 17.1947 10.6393L14.169 13.6651C13.9302 13.9038 13.5501 13.9108 13.32 13.6806L12.0532 12.4139C11.8231 12.1837 11.83 11.8036 12.0687 11.5649C12.6078 11.0259 12.9103 10.7041 12.4882 9.98816C12.128 9.37711 10.7867 8.04387 9.9829 8.84766L9.026 9.80457C8.79152 10.0391 8.42065 10.0499 8.18946 9.83216C8.18527 9.82822 8.18113 9.8242 8.17704 9.82011C7.60427 9.24734 6.86936 8.69159 6.39943 8.03122C6.20623 7.75971 6.27917 7.35876 6.56293 7.14058C7.13082 6.70394 7.83604 6.05667 7.51626 5.73688C7.00756 5.22819 6.64232 4.84336 6.00502 4.36291C4.84749 3.49024 2.98873 2.86307 1.68669 2.5009C1.49898 2.44869 1.54877 2.11407 1.74553 2.11091C1.74865 2.11086 1.74938 2.1109 1.7525 2.11067C1.8512 2.10361 5.1158 1.87459 7.10771 2.35491C8.41273 2.66961 9.17363 2.87223 10.3122 3.56383C11.7706 4.44979 12.9611 5.54124 13.3465 6.69684C13.732 7.85244 12.8562 8.45813 13.6146 8.8618C14.0693 9.10386 14.6271 9.08774 15.0305 8.72253C15.3277 8.4534 15.7944 8.37456 16.0678 8.64793Z" fill="currentColor"/>
|
|
4
|
+
<path d="M8.17704 9.82011C8.18113 9.8242 8.18527 9.82822 8.18946 9.83216M8.17704 9.82011L8.18946 9.83216M8.17704 9.82011C7.60427 9.24734 6.86936 8.69159 6.39943 8.03122M8.18946 9.83216C8.42065 10.0499 8.79152 10.0391 9.026 9.80457L9.9829 8.84766C10.7867 8.04387 12.128 9.37711 12.4882 9.98816C12.9103 10.7041 12.6078 11.0259 12.0687 11.5649C11.83 11.8036 11.8231 12.1837 12.0532 12.4139L13.32 13.6806C13.5501 13.9108 13.9302 13.9038 14.169 13.6651L17.1947 10.6393C17.4334 10.4006 17.4404 10.0205 17.2102 9.79039L16.0678 8.64793C15.7944 8.37456 15.3277 8.4534 15.0305 8.72253C14.6271 9.08774 14.0693 9.10386 13.6146 8.8618C12.8562 8.45813 13.732 7.85244 13.3465 6.69684C12.9611 5.54124 11.7706 4.44979 10.3122 3.56383C9.17363 2.87223 8.41273 2.66961 7.10771 2.35492C5.1158 1.87459 1.8512 2.10361 1.7525 2.11067C1.74938 2.1109 1.74865 2.11086 1.74553 2.11091C1.54877 2.11407 1.49898 2.44869 1.68669 2.5009C2.98873 2.86307 4.84749 3.49024 6.00502 4.36291C6.64232 4.84336 7.00756 5.22819 7.51626 5.73688C7.83604 6.05667 7.13082 6.70394 6.56293 7.14058C6.27917 7.35876 6.20623 7.75971 6.39943 8.03122M8.18946 9.83216L2.8021 15.2195C2.47839 15.5432 1.97213 15.6105 1.60516 15.3369C1.46424 15.2318 1.32499 15.1183 1.2164 15.0097C1.1078 14.9011 0.994378 14.7619 0.889279 14.621C0.615587 14.254 0.682904 13.7477 1.00661 13.424L6.39943 8.03122" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
|
|
5
|
+
</svg>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<g clip-path="url(#clip0_13856_490518)">
|
|
3
|
+
<path d="M7 -6.11959e-07C3.13401 -9.49935e-07 9.49935e-07 3.13401 6.11959e-07 7C2.73984e-07 10.866 3.13401 14 7 14C10.866 14 14 10.866 14 7C14 3.13401 10.866 -2.73984e-07 7 -6.11959e-07Z" fill="currentColor"/>
|
|
4
|
+
<path d="M7.00391 9.72217L7.00391 7.38883" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
5
|
+
<path d="M7.00391 4.27783L6.99391 4.27783" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
6
|
+
</g>
|
|
7
|
+
<defs>
|
|
8
|
+
<clipPath id="clip0_13856_490518">
|
|
9
|
+
<rect width="14" height="14" fill="white" transform="translate(14 14) rotate(-180)"/>
|
|
10
|
+
</clipPath>
|
|
11
|
+
</defs>
|
|
12
|
+
</svg>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M11.3112 1.14526L12.8087 5.19216L16.8556 6.68965L12.8087 8.18714L11.3112 12.234L9.8137 8.18714L5.76681 6.68965L9.8137 5.19216L11.3112 1.14526Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3
|
+
<path d="M4.38071 10.3859L5.68884 12.312L7.61493 13.6201L5.68884 14.9283L4.38071 16.8544L3.07258 14.9283L1.14648 13.6201L3.07258 12.312L4.38071 10.3859Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
4
|
+
</svg>
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import CrossTransferSVG from '
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
2
|
+
import BridgeSVG from '../assets/images/icons/bridge.svg'
|
|
3
|
+
import ChangeThresholdSVG from '../assets/images/icons/change-threshold.svg'
|
|
4
|
+
import CrossTransferSVG from '../assets/images/icons/cross-transfer.svg'
|
|
5
|
+
import DappSVG from '../assets/images/icons/dapp.svg'
|
|
6
|
+
import DeploySVG from '../assets/images/icons/deploy.svg'
|
|
7
|
+
import GasSVG from '../assets/images/icons/gas.svg'
|
|
8
|
+
import HammerSVG from '../assets/images/icons/hammer.svg'
|
|
9
|
+
import InstadappProSVG from '../assets/images/icons/instadapp-pro.svg'
|
|
10
|
+
import PermitSignSVG from '../assets/images/icons/permit-sign.svg'
|
|
11
|
+
import PlusCircleSVG from '../assets/images/icons/plus-circle.svg'
|
|
12
|
+
import RefreshSVG from '../assets/images/icons/refresh.svg'
|
|
13
|
+
import RejectProposalSVG from '../assets/images/icons/reject-proposal.svg'
|
|
14
|
+
import StarsSVG from '../assets/images/icons/stars.svg'
|
|
15
|
+
import TransferSVG from '../assets/images/icons/transfer.svg'
|
|
16
|
+
import Trash2SVG from '../assets/images/icons/trash-2.svg'
|
|
17
|
+
import UpgradeSVG from '../assets/images/icons/upgrade.svg'
|
|
16
18
|
|
|
17
19
|
defineProps<{
|
|
18
20
|
action: MetadataTypes
|
|
@@ -21,18 +23,20 @@ defineProps<{
|
|
|
21
23
|
</script>
|
|
22
24
|
|
|
23
25
|
<template>
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
26
|
+
<RefreshSVG v-if="action === 'swap'" class="text-primary" />
|
|
27
|
+
<BridgeSVG v-else-if="action === 'bridge'" class="text-primary" />
|
|
28
|
+
<CrossTransferSVG v-else-if="action === 'cross-transfer'" class="text-primary" />
|
|
29
|
+
<TransferSVG v-else-if="action === 'transfer'" class="text-primary" />
|
|
30
|
+
<PlusCircleSVG v-else-if="action === 'add-signers' || (action === 'auth' && !remove)" class="text-primary" />
|
|
31
|
+
<Trash2SVG v-else-if="action === 'remove-signers' || (action === 'auth' && remove)" class="text-[#EB5757]" />
|
|
32
|
+
<RejectProposalSVG v-else-if="action === 'rejection'" class="text-[#EB5757]" />
|
|
33
|
+
<ChangeThresholdSVG v-else-if="action === 'change-threshold'" />
|
|
34
|
+
<DappSVG v-else-if="action === 'dapp'" />
|
|
35
|
+
<DeploySVG v-else-if="action === 'deploy'" />
|
|
36
|
+
<GasSVG v-else-if="action === 'gas-topup'" />
|
|
37
|
+
<InstadappProSVG v-else-if="action === 'instadapp-pro'" />
|
|
38
|
+
<PermitSignSVG v-else-if="action === 'permit2'" />
|
|
39
|
+
<UpgradeSVG v-else-if="action === 'upgrade'" />
|
|
40
|
+
<HammerSVG v-else-if="action === 'tx-builder'" />
|
|
41
|
+
<StarsSVG v-else-if="action === 'mass'" />
|
|
42
|
+
</template>
|
|
@@ -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>
|
|
@@ -20,15 +19,23 @@ provide('tokens', props.tokens);
|
|
|
20
19
|
<MetadataCrossTransfer v-if="metadata.type === 'cross-transfer'" :metadata="metadata" :chain_id="chain_id" />
|
|
21
20
|
<MetadataGasTopup v-if="metadata.type === 'gas-topup'" :metadata="metadata" :chain_id="chain_id" />
|
|
22
21
|
<MetadataSwap v-if="metadata.type === 'swap'" :metadata="metadata" :chain_id="chain_id" />
|
|
23
|
-
<MetadataBridge v-if="metadata.type === 'bridge'" :metadata="metadata" :chain_id="chain_id" />
|
|
22
|
+
<MetadataBridge v-if="metadata.type === 'bridge' || metadata.type === 'bridge-v2'" :metadata="metadata" :chain_id="chain_id" />
|
|
24
23
|
<MetadataPermit2 v-if="metadata.type === 'permit2'" :metadata="metadata" :chain_id="chain_id" />
|
|
25
24
|
|
|
25
|
+
<div v-if="metadata.type === 'mass'">
|
|
26
|
+
Chain Agnostic Payments
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
<div v-if="metadata.type === 'import'" class="text-left w-fit capitalize">
|
|
30
|
+
Import from {{ metadata.protocol }} ({{ (formatUsd(fromWei(metadata.valueInUsd, 10))) }})
|
|
31
|
+
</div>
|
|
32
|
+
|
|
26
33
|
<div v-if="metadata.type === 'upgrade'" class="self-start">
|
|
27
34
|
Wallet upgraded to {{ metadata?.version }}
|
|
28
35
|
</div>
|
|
29
36
|
<div v-if="metadata.type === 'dapp'" class="self-start flex items-center gap-2 text-primary">
|
|
30
37
|
<a :href="metadata?.url" target="_blank" rel="noopener noreferrer">{{
|
|
31
|
-
metadata?.name
|
|
38
|
+
metadata?.name || metadata?.url
|
|
32
39
|
}}</a>
|
|
33
40
|
<SvgoExternalLink />
|
|
34
41
|
</div>
|
|
@@ -37,36 +44,45 @@ provide('tokens', props.tokens);
|
|
|
37
44
|
</div>
|
|
38
45
|
<div v-if="metadata.type === 'auth'" class="self-start capitalize flex gap-3">
|
|
39
46
|
Authority {{ metadata.remove ? 'Removed' : 'Added' }}:
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
<
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
<a
|
|
48
|
+
class="text-primary break-all" :href="getExplorerUrl(metadata.chainId, `/address/${metadata.address}`)"
|
|
49
|
+
target="_blank"
|
|
50
|
+
>
|
|
51
|
+
{{ shortenHash(metadata.address) }}
|
|
52
|
+
</a>
|
|
53
|
+
<div class="flex gap-3">
|
|
54
|
+
<ChainLogo class="w-5 h-5" :chain="metadata.chainId" />
|
|
55
|
+
{{ chainIdToName(metadata.chainId) }}
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
<div v-if="metadata.type === 'tx-builder'" class="self-start capitalize flex gap-3">
|
|
59
|
+
<span v-if="!compact">
|
|
60
|
+
Transaction Builder
|
|
61
|
+
</span> ({{ metadata?.actionCount }} {{ toBN(metadata?.actionCount).lt(2) ? 'action' : 'actions' }})
|
|
51
62
|
</div>
|
|
52
63
|
<div v-if="metadata.type === 'instadapp-pro'" class="self-start capitalize flex gap-3">
|
|
53
64
|
Instadapp Pro |
|
|
54
65
|
{{ metadata?.castDetails }}
|
|
55
66
|
</div>
|
|
56
67
|
|
|
57
|
-
<MetadataSigners
|
|
68
|
+
<MetadataSigners
|
|
69
|
+
v-if="metadata.type === 'add-signers' || metadata.type === 'remove-signers'"
|
|
70
|
+
:chain_id="chain_id" :metadata="metadata"
|
|
71
|
+
:compact="compact"
|
|
72
|
+
/>
|
|
58
73
|
|
|
59
|
-
|
|
60
|
-
|
|
74
|
+
<div v-if="metadata.type === 'change-threshold'" class="text-left w-fit">
|
|
75
|
+
Change Threshold to {{ metadata.count }}
|
|
61
76
|
</div>
|
|
62
77
|
|
|
63
|
-
<div
|
|
78
|
+
<div
|
|
79
|
+
v-if="metadata.type === 'rejection'" v-tippy="{
|
|
64
80
|
content: metadata.id,
|
|
65
81
|
maxWidth: 'none',
|
|
66
82
|
interactive: true,
|
|
67
|
-
}"
|
|
68
|
-
|
|
69
|
-
|
|
83
|
+
}" class="text-left w-fit"
|
|
84
|
+
>
|
|
85
|
+
{{ shortenHash(metadata.id) }}
|
|
70
86
|
</div>
|
|
71
87
|
</div>
|
|
72
|
-
</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,13 +1,14 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
|
|
2
|
+
// @ts-expect-error
|
|
3
|
+
import * as XXH from 'xxhashjs'
|
|
3
4
|
|
|
4
5
|
defineProps<{
|
|
5
6
|
address: string
|
|
6
|
-
}>()
|
|
7
|
+
}>()
|
|
7
8
|
|
|
8
|
-
const randomId = Math.random().toString(36).substr(2, 9)
|
|
9
|
+
const randomId = Math.random().toString(36).substr(2, 9)
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
function generateColor(address: string): string {
|
|
11
12
|
const hash = XXH.h32(address, 0xABCD).toNumber()
|
|
12
13
|
|
|
13
14
|
const hue = hash % 360
|
package/components/ChainLogo.vue
CHANGED
|
@@ -1,29 +1,26 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<template v-if="isNetworkNotAvailable">
|
|
3
|
-
<svg v-bind="$attrs" class="dark:hidden block" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 20 20">
|
|
4
|
-
<rect width="20" height="20" fill="#CBD5E1" rx="10" />
|
|
5
|
-
<path fill="#fff" fill-rule="evenodd"
|
|
6
|
-
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"
|
|
7
|
-
clip-rule="evenodd" />
|
|
8
|
-
</svg>
|
|
9
|
-
<svg v-bind="$attrs" class="dark:block hidden" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 20 20">
|
|
10
|
-
<rect width="20" height="20" fill="#334155" rx="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`"/>
|
|
18
|
-
</span>
|
|
19
|
-
<img v-else :src="`https://cdn.instadapp.io/avocado/networks/${chain}.svg`"/>
|
|
20
|
-
</template>
|
|
21
|
-
|
|
22
1
|
<script lang="ts" setup>
|
|
23
2
|
const props = defineProps<{
|
|
24
|
-
chain?: ChainId | number | string
|
|
25
|
-
stroke?: boolean
|
|
26
|
-
}>()
|
|
3
|
+
chain?: ChainId | number | string
|
|
4
|
+
stroke?: boolean
|
|
5
|
+
}>()
|
|
27
6
|
|
|
28
|
-
const isNetworkNotAvailable = computed(() => !networks.some(
|
|
7
|
+
const isNetworkNotAvailable = computed(() => !networks.some(network => String(network.chainId) === String(props.chain)))
|
|
29
8
|
</script>
|
|
9
|
+
|
|
10
|
+
<template>
|
|
11
|
+
<svg v-if="isNetworkNotAvailable" v-bind="$attrs" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 20 20">
|
|
12
|
+
<rect width="20" height="20" fill="#334155" rx="10" />
|
|
13
|
+
<path
|
|
14
|
+
fill="#97A2B7" fill-rule="evenodd"
|
|
15
|
+
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"
|
|
16
|
+
clip-rule="evenodd"
|
|
17
|
+
/>
|
|
18
|
+
</svg>
|
|
19
|
+
<span
|
|
20
|
+
v-else-if="stroke"
|
|
21
|
+
class="outline stroke-color outline-[#161E2D] outline-2 shrink-0 outline outline-offset-[-1.5px] rounded-full"
|
|
22
|
+
>
|
|
23
|
+
<img class="w-full h-full" :src="`https://cdn.instadapp.io/avocado/networks/${chain}.svg`">
|
|
24
|
+
</span>
|
|
25
|
+
<img v-else :src="`https://cdn.instadapp.io/avocado/networks/${chain}.svg`">
|
|
26
|
+
</template>
|
|
@@ -1,56 +1,26 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import CheckSVG from '../assets/images/icons/check-circle.svg'
|
|
3
|
+
import CopySVG from '../assets/images/icons/copy.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
|
|
16
|
-
class="text-slate-400 font-semibold inline-flex items-center gap-2.5"
|
|
17
|
-
@click.stop="copy(text)"
|
|
18
|
-
>
|
|
19
|
-
<Transition mode="out-in" name="slide-left">
|
|
20
|
-
<span v-if="copied && !iconOnly"> {{ successText || 'Copied' }} </span>
|
|
21
|
-
<span v-else-if="slots.content">
|
|
22
|
-
<slot name="content" />
|
|
23
|
-
</span>
|
|
24
|
-
</Transition>
|
|
25
|
-
|
|
12
|
+
<button type="button" class="inline-flex copy-btn" @click.stop="copy(text)">
|
|
26
13
|
<Transition mode="out-in" name="slide">
|
|
27
|
-
<
|
|
28
|
-
|
|
29
|
-
class="w-4 h-4 shrink-0 dark:text-slate-900 text-white svg-circle"
|
|
30
|
-
/>
|
|
31
|
-
<slot v-else-if="slots.copy" name="copy" />
|
|
32
|
-
<slot v-else name="copy-icon">
|
|
33
|
-
<CopySVG />
|
|
34
|
-
</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]" />
|
|
35
16
|
</Transition>
|
|
36
17
|
</button>
|
|
37
18
|
</template>
|
|
38
19
|
|
|
39
20
|
<style scoped>
|
|
40
|
-
.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
.slide-left-enter-from {
|
|
46
|
-
opacity: 0;
|
|
47
|
-
transform: translateX(30px);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.slide-left-leave-to {
|
|
51
|
-
opacity: 0;
|
|
52
|
-
transform: translateX(-30px);
|
|
53
|
-
}
|
|
21
|
+
.copy-btn:focus:not(:focus-visible) {
|
|
22
|
+
outline: none;
|
|
23
|
+
}
|
|
54
24
|
|
|
55
25
|
.slide-enter-active,
|
|
56
26
|
.slide-leave-active {
|
|
@@ -61,4 +31,12 @@ const slots = useSlots()
|
|
|
61
31
|
.slide-leave-to {
|
|
62
32
|
opacity: 0;
|
|
63
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
|
+
}
|
|
64
42
|
</style>
|
|
@@ -1,26 +1,25 @@
|
|
|
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
|
-
const toToken = asyncComputed(() =>
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
)
|
|
10
|
+
const toToken = asyncComputed(() => {
|
|
11
|
+
if (Array.isArray(tokens) && !tokens.length)
|
|
12
|
+
return null
|
|
13
|
+
return fetchTokenByAddress(props.metadata?.toToken, props.metadata?.toChainId, tokens)
|
|
14
|
+
},
|
|
15
|
+
)
|
|
17
16
|
|
|
18
|
-
const fromToken = asyncComputed(() =>
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
)
|
|
17
|
+
const fromToken = asyncComputed(() => {
|
|
18
|
+
if (Array.isArray(tokens) && !tokens.length)
|
|
19
|
+
return null
|
|
20
|
+
return fetchTokenByAddress(props.metadata?.fromToken, props.chain_id, tokens)
|
|
21
|
+
},
|
|
22
|
+
)
|
|
24
23
|
|
|
25
24
|
const isTokensSame = computed(() => {
|
|
26
25
|
return toToken.value?.symbol === fromToken.value?.symbol
|
|
@@ -28,25 +27,25 @@ const isTokensSame = computed(() => {
|
|
|
28
27
|
|
|
29
28
|
const bridgeAmountFormatted = computed(() =>
|
|
30
29
|
formatDecimal(
|
|
31
|
-
fromWei(props.metadata?.amount, fromToken?.value?.decimals).toFixed()
|
|
32
|
-
)
|
|
33
|
-
)
|
|
30
|
+
fromWei(props.metadata?.amount, fromToken?.value?.decimals).toFixed(),
|
|
31
|
+
),
|
|
32
|
+
)
|
|
34
33
|
</script>
|
|
35
34
|
|
|
36
35
|
<template>
|
|
37
36
|
<div v-if="!toToken || !fromToken" class="rounded-5 w-24 h-4 loading-box" />
|
|
38
37
|
<div
|
|
39
|
-
class="flex gap-5 items-center"
|
|
40
38
|
v-if="toToken && fromToken"
|
|
39
|
+
class="flex gap-5 items-center"
|
|
41
40
|
>
|
|
42
41
|
<span v-if="!compact" class="capitalize text-xs sm:text-sm">{{ metadata.type }}</span>
|
|
43
42
|
<span class="inline-flex gap-2.5 items-center">
|
|
44
|
-
<img width="20" height="20" class="w-5 h-5" :src="fromToken.logo_url"
|
|
43
|
+
<img width="20" height="20" class="w-5 h-5" :src="fromToken.logo_url">
|
|
45
44
|
{{ bridgeAmountFormatted }}
|
|
46
45
|
<span class="uppercase">{{ fromToken?.symbol }}</span>
|
|
47
46
|
<SvgoBridge class="text-slate-400 w-4 h-4" />
|
|
48
47
|
<template v-if="!isTokensSame">
|
|
49
|
-
<img width="20" height="20" class="w-5 h-5" :src="toToken.logo_url"
|
|
48
|
+
<img width="20" height="20" class="w-5 h-5" :src="toToken.logo_url">
|
|
50
49
|
<span class="uppercase">{{ toToken?.symbol }}</span>
|
|
51
50
|
</template>
|
|
52
51
|
<span class="flex items-center gap-2.5">
|
|
@@ -1,42 +1,53 @@
|
|
|
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
|
+
})
|
|
23
|
+
|
|
24
|
+
const toToken = asyncComputed(() => {
|
|
25
|
+
if (!props?.metadata?.toChainId)
|
|
26
|
+
return null
|
|
27
|
+
|
|
28
|
+
if (Array.isArray(tokens) && !tokens.length)
|
|
29
|
+
return null
|
|
22
30
|
|
|
23
|
-
|
|
31
|
+
return fetchTokenByAddress(props.metadata?.toToken, props?.metadata?.toChainId, tokens)
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
const formattedToAmount = computed(() =>
|
|
24
35
|
formatDecimal(
|
|
25
|
-
fromWei(props.metadata?.amount,
|
|
26
|
-
)
|
|
27
|
-
)
|
|
36
|
+
fromWei(props.metadata?.amount, toToken?.value?.decimals).toFixed(),
|
|
37
|
+
),
|
|
38
|
+
)
|
|
28
39
|
</script>
|
|
29
40
|
|
|
30
41
|
<template>
|
|
31
|
-
<div class="h-[60px]"
|
|
42
|
+
<div v-if="!fromToken" class="h-[60px]">
|
|
32
43
|
<div class="rounded-5 w-24 h-4 loading-box" />
|
|
33
44
|
</div>
|
|
34
|
-
<div class="flex gap-5 flex-col"
|
|
45
|
+
<div v-else class="flex gap-5 flex-col">
|
|
35
46
|
<div class="flex items-center gap-5">
|
|
36
47
|
<span v-if="!compact" class="capitalize text-xs sm:text-sm">Cross-chain send</span>
|
|
37
48
|
<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
|
-
{{
|
|
49
|
+
<img width="20" height="20" class="w-5 h-5" :src="fromToken?.logo_url">
|
|
50
|
+
{{ formattedToAmount }}
|
|
40
51
|
<span class="uppercase">{{ fromToken?.symbol }}</span>
|
|
41
52
|
</span>
|
|
42
53
|
</div>
|
|
@@ -51,18 +62,12 @@ const formattedFromAmount = computed(() =>
|
|
|
51
62
|
|
|
52
63
|
<span class="flex items-center gap-2.5">
|
|
53
64
|
<ChainLogo class="w-5" :chain="metadata?.toChainId" />
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
metadata?.toChainId,
|
|
61
|
-
`/address/${metadata.receiver}`
|
|
62
|
-
)
|
|
63
|
-
"
|
|
64
|
-
>{{ shortenHash(metadata.receiver) }}</a
|
|
65
|
-
>
|
|
65
|
+
<Address
|
|
66
|
+
:address="metadata.receiver" :to="getExplorerUrl(
|
|
67
|
+
metadata?.toChainId,
|
|
68
|
+
`/address/${metadata.receiver}`,
|
|
69
|
+
)"
|
|
70
|
+
/>
|
|
66
71
|
on
|
|
67
72
|
<span>{{ chainIdToName(metadata?.toChainId) }}</span>
|
|
68
73
|
</span>
|