@instadapp/avocado-base 0.0.0-dev.d831e20 → 0.0.0-dev.dcb4af3
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/reject-proposal.svg +3 -3
- package/assets/images/icons/stars.svg +4 -0
- package/assets/images/icons/trash-2.svg +5 -5
- package/components/ActionLogo.vue +33 -29
- package/components/ActionMetadata.vue +44 -29
- package/components/Address.vue +74 -0
- package/components/AuthorityAvatar.vue +39 -0
- package/components/ChainLogo.vue +18 -563
- package/components/CopyClipboard.vue +42 -0
- package/components/metadata/Bridge.vue +33 -14
- package/components/metadata/CrossTransfer.vue +37 -28
- package/components/metadata/GasTopup.vue +17 -12
- package/components/metadata/Permit2.vue +14 -10
- package/components/metadata/Signers.vue +19 -0
- package/components/metadata/Swap.vue +45 -46
- package/components/metadata/Transfer.vue +28 -25
- 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 +16 -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 +34 -30
- package/utils/metadata.ts +431 -310
- package/utils/network.ts +569 -186
- package/utils/services.ts +15 -10
- package/utils/utils.d.ts +122 -104
|
@@ -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>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<svg width="20" height="20" viewBox="0 0 20 20" fill="none"
|
|
2
2
|
xmlns="http://www.w3.org/2000/svg">
|
|
3
|
-
<path d="M11.8555 8.14404L8.14316 11.8564" stroke="
|
|
4
|
-
<path d="M8.14453 8.14404L11.8568 11.8564" stroke="
|
|
5
|
-
<rect x="3.75" y="3.75" width="12.5" height="12.5" rx="6.25" stroke="
|
|
3
|
+
<path d="M11.8555 8.14404L8.14316 11.8564" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
4
|
+
<path d="M8.14453 8.14404L11.8568 11.8564" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
5
|
+
<rect x="3.75" y="3.75" width="12.5" height="12.5" rx="6.25" stroke="currentColor" stroke-width="1.5"/>
|
|
6
6
|
</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,8 +1,8 @@
|
|
|
1
1
|
<svg width="20" height="20" viewBox="0 0 20 20" fill="none"
|
|
2
2
|
xmlns="http://www.w3.org/2000/svg">
|
|
3
|
-
<path d="M4.64453 7.21045H15.3588" stroke="
|
|
4
|
-
<path d="M13.8495 7.21045H6.14754L6.09242 8.20701C5.98681 10.1164 6.07654 12.0315 6.36021 13.9227C6.48391 14.7473 7.19233 15.3574 8.02623 15.3574H11.9708C12.8047 15.3574 13.5131 14.7473 13.6368 13.9227C13.9205 12.0315 14.0102 10.1164 13.9046 8.207L13.8495 7.21045Z" stroke="
|
|
5
|
-
<path d="M7.85938 7.21039V6.7825C7.85938 6.21509 8.08478 5.67091 8.486 5.26969C8.88722 4.86847 9.4314 4.64307 9.99881 4.64307C10.5662 4.64307 11.1104 4.86847 11.5116 5.26969C11.9128 5.67091 12.1382 6.21509 12.1382 6.7825V7.21039" stroke="
|
|
6
|
-
<path d="M8.71484 9.50195V13.0487" stroke="
|
|
7
|
-
<path d="M11.2852 9.50195V13.0487" stroke="
|
|
3
|
+
<path d="M4.64453 7.21045H15.3588" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
|
|
4
|
+
<path d="M13.8495 7.21045H6.14754L6.09242 8.20701C5.98681 10.1164 6.07654 12.0315 6.36021 13.9227C6.48391 14.7473 7.19233 15.3574 8.02623 15.3574H11.9708C12.8047 15.3574 13.5131 14.7473 13.6368 13.9227C13.9205 12.0315 14.0102 10.1164 13.9046 8.207L13.8495 7.21045Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
5
|
+
<path d="M7.85938 7.21039V6.7825C7.85938 6.21509 8.08478 5.67091 8.486 5.26969C8.88722 4.86847 9.4314 4.64307 9.99881 4.64307C10.5662 4.64307 11.1104 4.86847 11.5116 5.26969C11.9128 5.67091 12.1382 6.21509 12.1382 6.7825V7.21039" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
6
|
+
<path d="M8.71484 9.50195V13.0487" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
7
|
+
<path d="M11.2852 9.50195V13.0487" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
8
8
|
</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>
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
|
|
3
2
|
const props = defineProps<{
|
|
4
3
|
metadata: {
|
|
5
4
|
type: MetadataTypes
|
|
6
5
|
[key: string]: any
|
|
7
|
-
}
|
|
8
|
-
chain_id: number | string
|
|
9
|
-
compact?: boolean
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
provide('compact', props.compact);
|
|
6
|
+
}
|
|
7
|
+
chain_id: number | string
|
|
8
|
+
compact?: boolean
|
|
9
|
+
tokens?: ITokenPrice[]
|
|
10
|
+
}>()
|
|
13
11
|
|
|
12
|
+
provide('compact', props.compact)
|
|
13
|
+
provide('tokens', props.tokens)
|
|
14
14
|
</script>
|
|
15
15
|
|
|
16
16
|
<template>
|
|
@@ -19,15 +19,23 @@ provide('compact', props.compact);
|
|
|
19
19
|
<MetadataCrossTransfer v-if="metadata.type === 'cross-transfer'" :metadata="metadata" :chain_id="chain_id" />
|
|
20
20
|
<MetadataGasTopup v-if="metadata.type === 'gas-topup'" :metadata="metadata" :chain_id="chain_id" />
|
|
21
21
|
<MetadataSwap v-if="metadata.type === 'swap'" :metadata="metadata" :chain_id="chain_id" />
|
|
22
|
-
<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" />
|
|
23
23
|
<MetadataPermit2 v-if="metadata.type === 'permit2'" :metadata="metadata" :chain_id="chain_id" />
|
|
24
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
|
+
|
|
25
33
|
<div v-if="metadata.type === 'upgrade'" class="self-start">
|
|
26
34
|
Wallet upgraded to {{ metadata?.version }}
|
|
27
35
|
</div>
|
|
28
36
|
<div v-if="metadata.type === 'dapp'" class="self-start flex items-center gap-2 text-primary">
|
|
29
37
|
<a :href="metadata?.url" target="_blank" rel="noopener noreferrer">{{
|
|
30
|
-
metadata?.name
|
|
38
|
+
metadata?.name || metadata?.url
|
|
31
39
|
}}</a>
|
|
32
40
|
<SvgoExternalLink />
|
|
33
41
|
</div>
|
|
@@ -36,38 +44,45 @@ provide('compact', props.compact);
|
|
|
36
44
|
</div>
|
|
37
45
|
<div v-if="metadata.type === 'auth'" class="self-start capitalize flex gap-3">
|
|
38
46
|
Authority {{ metadata.remove ? 'Removed' : 'Added' }}:
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
<
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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' }})
|
|
50
62
|
</div>
|
|
51
63
|
<div v-if="metadata.type === 'instadapp-pro'" class="self-start capitalize flex gap-3">
|
|
52
64
|
Instadapp Pro |
|
|
53
65
|
{{ metadata?.castDetails }}
|
|
54
66
|
</div>
|
|
55
67
|
|
|
56
|
-
<
|
|
57
|
-
|
|
58
|
-
|
|
68
|
+
<MetadataSigners
|
|
69
|
+
v-if="metadata.type === 'add-signers' || metadata.type === 'remove-signers'"
|
|
70
|
+
:chain_id="chain_id" :metadata="metadata"
|
|
71
|
+
:compact="compact"
|
|
72
|
+
/>
|
|
59
73
|
|
|
60
|
-
|
|
61
|
-
|
|
74
|
+
<div v-if="metadata.type === 'change-threshold'" class="text-left w-fit">
|
|
75
|
+
Change Threshold to {{ metadata.count }}
|
|
62
76
|
</div>
|
|
63
77
|
|
|
64
|
-
<div
|
|
78
|
+
<div
|
|
79
|
+
v-if="metadata.type === 'rejection'" v-tippy="{
|
|
65
80
|
content: metadata.id,
|
|
66
81
|
maxWidth: 'none',
|
|
67
82
|
interactive: true,
|
|
68
|
-
}"
|
|
69
|
-
|
|
70
|
-
|
|
83
|
+
}" class="text-left w-fit"
|
|
84
|
+
>
|
|
85
|
+
{{ shortenHash(metadata.id) }}
|
|
71
86
|
</div>
|
|
72
87
|
</div>
|
|
73
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>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
// @ts-expect-error
|
|
3
|
+
import * as XXH from 'xxhashjs'
|
|
4
|
+
|
|
5
|
+
defineProps<{
|
|
6
|
+
address: string
|
|
7
|
+
}>()
|
|
8
|
+
|
|
9
|
+
const randomId = Math.random().toString(36).substr(2, 9)
|
|
10
|
+
|
|
11
|
+
function generateColor(address: string): string {
|
|
12
|
+
const hash = XXH.h32(address, 0xABCD).toNumber()
|
|
13
|
+
|
|
14
|
+
const hue = hash % 360
|
|
15
|
+
const saturation = 80 + (hash % 30)
|
|
16
|
+
const lightness = 70 + (hash % 20)
|
|
17
|
+
|
|
18
|
+
return `hsl(${hue}, ${saturation}%, ${lightness}%)`
|
|
19
|
+
}
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<template>
|
|
23
|
+
<svg
|
|
24
|
+
:style="{
|
|
25
|
+
color: generateColor(address),
|
|
26
|
+
}" width="30" height="30" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 30 30"
|
|
27
|
+
>
|
|
28
|
+
<g fill="currentColor" :clip-path="`url(#${randomId})`">
|
|
29
|
+
<rect width="30" height="30" fill-opacity=".4" rx="15" />
|
|
30
|
+
<ellipse cx="15.004" cy="26.399" rx="11.4" ry="6.6" />
|
|
31
|
+
<circle cx="15" cy="12.75" r="5.4" />
|
|
32
|
+
</g>
|
|
33
|
+
<defs>
|
|
34
|
+
<clipPath :id="randomId">
|
|
35
|
+
<rect width="30" height="30" fill="#fff" rx="15" />
|
|
36
|
+
</clipPath>
|
|
37
|
+
</defs>
|
|
38
|
+
</svg>
|
|
39
|
+
</template>
|