@instadapp/avocado-base 0.0.0-dev.a80e59d → 0.0.0-dev.aeaa72b

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.
Files changed (43) hide show
  1. package/.github/workflows/npm-publish-dev.yml +2 -5
  2. package/.vscode/settings.json +67 -0
  3. package/abi/avoFactoryProxy.json +1 -1
  4. package/abi/forwarder.json +1 -1
  5. package/abi/multisigAgnosticForwarder.json +937 -0
  6. package/abi/multisigForwarder.json +697 -0
  7. package/app.vue +5 -5
  8. package/assets/images/icons/check.svg +3 -0
  9. package/assets/images/icons/copy.svg +9 -2
  10. package/assets/images/icons/hammer.svg +5 -0
  11. package/assets/images/icons/info-2.svg +12 -0
  12. package/assets/images/icons/stars.svg +4 -0
  13. package/components/ActionLogo.vue +33 -29
  14. package/components/ActionMetadata.vue +45 -29
  15. package/components/Address.vue +74 -0
  16. package/components/AuthorityAvatar.vue +15 -2
  17. package/components/ChainLogo.vue +22 -224
  18. package/components/CopyClipboard.vue +16 -38
  19. package/components/metadata/Bridge.vue +22 -23
  20. package/components/metadata/CrossTransfer.vue +35 -30
  21. package/components/metadata/GasTopup.vue +14 -15
  22. package/components/metadata/Permit2.vue +12 -13
  23. package/components/metadata/Signers.vue +12 -38
  24. package/components/metadata/Swap.vue +45 -53
  25. package/components/metadata/Transfer.vue +25 -27
  26. package/contracts/MultisigAgnosticForwarder.ts +1423 -0
  27. package/contracts/MultisigForwarder.ts +859 -0
  28. package/contracts/factories/MultisigAgnosticForwarder__factory.ts +2135 -0
  29. package/contracts/factories/MultisigForwarder__factory.ts +721 -0
  30. package/contracts/factories/index.ts +2 -0
  31. package/contracts/index.ts +4 -0
  32. package/eslint.config.mjs +34 -0
  33. package/nuxt.config.ts +21 -12
  34. package/package.json +14 -14
  35. package/server/utils/index.ts +4 -4
  36. package/utils/avocado.ts +17 -17
  37. package/utils/bignumber.ts +47 -36
  38. package/utils/formatter.ts +55 -61
  39. package/utils/helper.ts +33 -41
  40. package/utils/metadata.ts +431 -310
  41. package/utils/network.ts +496 -201
  42. package/utils/services.ts +11 -13
  43. package/utils/utils.d.ts +119 -104
@@ -0,0 +1,3 @@
1
+ <svg width="16" height="11" viewBox="0 0 16 11" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M15 1L5.375 10L1 5.90909" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"/>
3
+ </svg>
@@ -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
- <path class="copy-path" d="M14.1145 9.94827C14.1816 8.8779 14.2168 7.76883 14.2168 6.63246C14.2168 6.17207 14.211 5.71616 14.1997 5.26549C14.1917 4.94654 14.0882 4.63658 13.8994 4.37941C13.185 3.40646 12.6153 2.80088 11.6777 2.07698C11.4181 1.87657 11.0995 1.76786 10.7717 1.76072C10.4455 1.75361 10.105 1.75 9.74121 1.75C8.63995 1.75 7.75104 1.78308 6.8319 1.84613C6.04346 1.90021 5.41726 2.5279 5.36787 3.31665C5.30084 4.38702 5.26562 5.49608 5.26562 6.63246C5.26562 7.76883 5.30085 8.8779 5.36787 9.94827C5.41726 10.737 6.04346 11.3647 6.8319 11.4188C7.75104 11.4818 8.63995 11.5149 9.74121 11.5149C10.8425 11.5149 11.7314 11.4818 12.6505 11.4188C13.439 11.3647 14.0652 10.737 14.1145 9.94827Z" stroke="#94A3B8" stroke-width="2"/>
4
- <path class="copy-path" d="M10.6341 12.6834C10.7011 11.613 10.7363 10.5039 10.7363 9.36756C10.7363 8.90717 10.7306 8.45126 10.7192 8.00059C10.7112 7.68165 10.6078 7.37169 10.4189 7.11452C9.70458 6.14157 9.13488 5.53599 8.19725 4.81209C7.93767 4.61167 7.61907 4.50297 7.29121 4.49582C6.96506 4.48872 6.62448 4.48511 6.26074 4.48511C5.15949 4.48511 4.27057 4.51819 3.35143 4.58123C2.56299 4.63531 1.9368 5.26301 1.88741 6.05176C1.82038 7.12213 1.78516 8.23119 1.78516 9.36756C1.78516 10.5039 1.82038 11.613 1.88741 12.6834C1.9368 13.4721 2.56299 14.0998 3.35143 14.1539C4.27057 14.2169 5.15949 14.25 6.26074 14.25C7.362 14.25 8.25091 14.2169 9.17005 14.1539C9.95849 14.0998 10.5847 13.4721 10.6341 12.6834Z" stroke="#94A3B8" stroke-width="2"/>
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 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'
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
- <RefreshSVG class="text-primary" v-if="action === 'swap'"/>
25
- <BridgeSVG class="text-primary" v-else-if="action === 'bridge'"/>
26
- <CrossTransferSVG class="text-primary" v-else-if="action === 'cross-transfer'"/>
27
- <TransferSVG class="text-primary" v-else-if="action === 'transfer'"/>
28
- <PlusCircleSVG class="text-primary" v-else-if="action === 'add-signers' || (action === 'auth' && !remove)"/>
29
- <Trash2SVG class="text-[#EB5757]" v-else-if="action === 'remove-signers' || (action === 'auth' && remove)"/>
30
- <RejectProposalSVG class="text-[#EB5757]" v-else-if="action === 'rejection'"/>
31
- <ChangeThresholdSVG v-else-if="action === 'change-threshold'"/>
32
- <DappSVG v-else-if="action === 'dapp'"/>
33
- <DeploySVG v-else-if="action === 'deploy'"/>
34
- <GasSVG v-else-if="action === 'gas-topup'"/>
35
- <InstadappProSVG v-else-if="action === 'instadapp-pro'"/>
36
- <PermitSignSVG v-else-if="action === 'permit2'"/>
37
- <UpgradeSVG v-else-if="action === 'upgrade'"/>
38
- </template>
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
- <a
41
- class="text-primary break-all"
42
- :href="getExplorerUrl(metadata.chainId, `/address/${metadata.address}`)"
43
- target="_blank"
44
- >
45
- {{ shortenHash(metadata.address) }}
46
- </a>
47
- <div class="flex gap-3">
48
- <ChainLogo class="w-5 h-5" :chain="metadata.chainId"/>
49
- {{ chainIdToName(metadata.chainId) }}
50
- </div>
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 v-if="metadata.type === 'add-signers' || metadata.type === 'remove-signers'" :metadata="metadata" :compact="compact" />
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
- <div v-if="metadata.type === 'change-threshold'" class="text-left w-fit" >
60
- Change Threshold to {{ metadata.count }}
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 v-tippy="{
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
- v-if="metadata.type === 'rejection'" class="text-left w-fit">
69
- {{ shortenHash(metadata.id) }}
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,9 +1,22 @@
1
1
  <script setup lang="ts">
2
+ // @ts-expect-error
3
+ import * as XXH from 'xxhashjs'
4
+
2
5
  defineProps<{
3
6
  address: string
4
- }>();
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)
5
17
 
6
- const randomId = Math.random().toString(36).substr(2, 9);
18
+ return `hsl(${hue}, ${saturation}%, ${lightness}%)`
19
+ }
7
20
  </script>
8
21
 
9
22
  <template>
@@ -1,228 +1,26 @@
1
- <template>
2
- <svg v-if="chain == 137" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
3
- <rect width="22" height="22" x="1" y="1" :fill="generateID('polygon', true)" rx="11" />
4
- <path fill="#fff"
5
- d="M15.086 9.927a.791.791 0 0 0-.752 0L12.58 10.97l-1.191.665-1.723 1.045a.791.791 0 0 1-.752 0l-1.347-.823a.773.773 0 0 1-.376-.665V9.61c0-.253.125-.506.376-.664l1.347-.792a.791.791 0 0 1 .752 0l1.347.823c.22.127.376.38.376.665v1.045l1.19-.697V8.914a.782.782 0 0 0-.375-.665L9.697 6.762a.791.791 0 0 0-.752 0L6.376 8.28A.697.697 0 0 0 6 8.914v2.975c0 .254.125.507.376.665l2.538 1.488c.22.126.501.126.752 0l1.723-1.013 1.19-.697 1.724-1.012a.791.791 0 0 1 .752 0l1.347.79c.22.128.376.38.376.666v1.582a.782.782 0 0 1-.376.665l-1.316.791a.791.791 0 0 1-.752 0l-1.347-.791a.773.773 0 0 1-.376-.665v-1.013l-1.19.697v1.044c0 .253.125.507.375.665l2.538 1.487c.22.127.502.127.752 0l2.538-1.487a.773.773 0 0 0 .376-.665V12.08a.782.782 0 0 0-.376-.665l-2.538-1.487Z" />
6
- <rect v-if="stroke" :class="strokeClass" width="22" height="22" x="1" y="1" rx="11" />
7
- <defs>
8
- <linearGradient :id="generateID('polygon')" x1="12" x2="12" y1="2" y2="22" gradientUnits="userSpaceOnUse">
9
- <stop stop-color="#A177FA" />
10
- <stop offset="1" stop-color="#7A4ADD" />
11
- </linearGradient>
12
- </defs>
13
- </svg>
14
- <svg v-else-if="chain == 42161" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
15
- <rect width="22" height="22" x="1" y="1" :fill="generateID('arb', true)" rx="11" />
16
- <path fill="#28A0F0"
17
- d="m12.031 13.969 1.704 2.673 1.574-.912-2.238-3.526-1.04 1.765ZM16.743 14.658v-.73l-2.445-3.808-.907 1.539 2.36 3.817.853-.495a.378.378 0 0 0 .14-.275v-.048Z" />
18
- <path fill="#fff"
19
- d="m6.5 15.347 1.205.694 4.01-6.43-.68-.018c-.58-.008-1.205.142-1.492.61l-2.277 3.53L6.5 14.91v.437ZM14.023 9.61l-1.793.007-4.058 6.696 1.418.817.386-.654 4.047-6.865Z" />
20
- <path fill="#96BEDC"
21
- d="M17.5 9.602a1.143 1.143 0 0 0-.536-.919l-4.46-2.564a1.16 1.16 0 0 0-1.022 0c-.037.019-4.336 2.512-4.336 2.512a1.146 1.146 0 0 0-.646.968v5.31l.766-1.176-.007-4.098a.377.377 0 0 1 .158-.285 2599 2599 0 0 1 4.406-2.552.388.388 0 0 1 .337-.002l4.401 2.532c.104.066.17.179.175.302v5.076a.37.37 0 0 1-.131.275l-.854.494-.44.255-1.574.912-1.595.925a.387.387 0 0 1-.272-.005l-1.888-1.086-.386.654 1.697.977a43.674 43.674 0 0 0 .27.15c.12.059.293.093.45.093.143 0 .283-.026.415-.078l4.635-2.685c.266-.206.423-.517.437-.854V9.602Z" />
22
- <rect v-if="stroke" :class="strokeClass" width="22" height="22" x="1" y="1" rx="11" />
23
- <defs>
24
- <linearGradient :id="generateID('arb')" x1="12" x2="12" y1="2" y2="22" gradientUnits="userSpaceOnUse">
25
- <stop stop-color="#495775" />
26
- <stop offset="1" stop-color="#2D374B" />
27
- </linearGradient>
28
- </defs>
29
- </svg>
30
-
31
- <svg v-else-if="chain == 43114" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
32
- <rect width="22" height="22" x="1" y="1" :fill="generateID('avax', true)" rx="11" />
33
- <path fill="#fff" fill-rule="evenodd"
34
- d="M12.447 6.96c-.259-.447-.67-.447-.93 0l-4.696 8.27c-.258.453-.047.812.47.812H9.65c.476-.03.905-.283 1.164-.682l2.839-4.92a1.545 1.545 0 0 0 0-1.346l-.847-1.487-.358-.647Zm3.121 5.443c-.259-.447-.676-.447-.934 0l-1.64 2.827c-.253.447-.042.811.47.811h3.244c.518 0 .73-.364.47-.81l-1.61-2.828Z"
35
- clip-rule="evenodd" />
36
- <rect v-if="stroke" :class="strokeClass" width="22" height="22" x="1" y="1" rx="11" />
37
- <defs>
38
- <linearGradient :id="generateID('avax')" x1="12" x2="12" y1="2" y2="22" gradientUnits="userSpaceOnUse">
39
- <stop stop-color="#FF8585" />
40
- <stop offset="1" stop-color="#EB5757" />
41
- </linearGradient>
42
- </defs>
43
- </svg>
44
-
45
- <svg v-else-if="chain == 1" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
46
- <rect width="22" height="22" x="1" y="1" :fill="generateID('eth', true)" rx="11" />
47
- <path fill="#fff" d="M8 12.111 11.998 6v.003L12 6l3.998 6.11.002.001-3.998 2.177h-.002L8 12.111Z" />
48
- <path fill="#fff" d="M11.998 17.997V18L8 12.81l3.998 2.176H12L16 12.81 12 18l-.002-.003Z" />
49
- <rect v-if="stroke" :class="strokeClass" width="22" height="22" x="1" y="1" rx="11" />
50
- <defs>
51
- <linearGradient :id="generateID('eth')" x1="12" x2="12" y1="2" y2="22" gradientUnits="userSpaceOnUse">
52
- <stop stop-color="#8E90FF" />
53
- <stop offset="1" stop-color="#5D5FEF" />
54
- </linearGradient>
55
- </defs>
56
- </svg>
57
-
58
- <svg v-else-if="chain == 10" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
59
- <rect width="22" height="22" x="1" y="1" :fill="generateID('opt', true)" rx="11" />
60
- <path fill="#fff"
61
- d="M9.084 14.656c-.596 0-1.084-.14-1.464-.42-.376-.284-.564-.692-.564-1.216 0-.112.012-.244.036-.404a24.3 24.3 0 0 1 .276-1.3c.34-1.376 1.22-2.064 2.636-2.064.384 0 .732.064 1.036.196a1.532 1.532 0 0 1 .984 1.472c0 .104-.012.236-.036.396-.076.444-.164.88-.272 1.3-.176.684-.476 1.2-.908 1.54-.428.336-1.004.5-1.724.5Zm.108-1.08c.28 0 .516-.084.712-.248.2-.164.344-.416.428-.76.116-.472.204-.88.264-1.232.02-.104.032-.212.032-.324 0-.456-.236-.684-.712-.684a1.1 1.1 0 0 0-.72.248c-.196.164-.336.416-.42.76-.092.336-.18.744-.272 1.232-.02.1-.032.204-.032.316-.004.464.24.692.72.692ZM12.372 14.584c-.056 0-.096-.016-.128-.052-.024-.04-.032-.084-.024-.136l1.036-4.88a.2.2 0 0 1 .084-.136.22.22 0 0 1 .144-.052h1.996c.556 0 1 .116 1.336.344.34.232.512.564.512 1 0 .124-.016.256-.044.392-.124.576-.376 1-.76 1.276-.376.276-.892.412-1.548.412h-1.012l-.344 1.644a.215.215 0 0 1-.084.136.22.22 0 0 1-.144.052h-1.02Zm2.656-2.868a.886.886 0 0 0 .548-.172.822.822 0 0 0 .316-.496c.016-.084.024-.16.024-.224 0-.144-.044-.256-.128-.332-.084-.08-.232-.12-.436-.12h-.9l-.284 1.344h.86Z" />
62
- <rect v-if="stroke" :class="strokeClass" width="22" height="22" x="1" y="1" rx="11" />
63
- <defs>
64
- <linearGradient :id="generateID('opt')" x1="12" x2="12" y1="2" y2="22" gradientUnits="userSpaceOnUse">
65
- <stop stop-color="#FF697A" />
66
- <stop offset="1" stop-color="#FF0420" />
67
- </linearGradient>
68
- </defs>
69
- </svg>
70
-
71
- <svg v-else-if="chain == 100" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
72
- <rect width="22" height="22" x="1" y="1" :fill="generateID('gnosis', true)" rx="11" />
73
- <g fill="#fff" clip-path="url(#clip0_1_911)">
74
- <path
75
- d="M9.527 12.833c.345 0 .681-.115.953-.325L8.293 10.32c-.527.68-.4 1.662.28 2.19.276.207.61.322.954.322ZM16.032 11.271c0-.345-.115-.681-.325-.953l-2.187 2.187a1.559 1.559 0 0 0 2.512-1.234Z" />
76
- <path
77
- d="m17.134 8.89-.968.968a2.204 2.204 0 0 1-3.103 3.104L12 14.024l-1.06-1.06a2.204 2.204 0 0 1-3.104-3.103l-.496-.497-.47-.473A6 6 0 1 0 18 12a5.985 5.985 0 0 0-.866-3.11Z" />
78
- <path
79
- d="M16.34 7.859a5.997 5.997 0 0 0-9.1.49L12 13.114l4.76-4.763a5.804 5.804 0 0 0-.42-.491ZM12 6.785c1.402 0 2.708.541 3.69 1.528L12 12.003l-3.69-3.69A5.157 5.157 0 0 1 12 6.785Z" />
80
- </g>
81
- <rect v-if="stroke" :class="strokeClass" width="22" height="22" x="1" y="1" rx="11" />
82
- <defs>
83
- <linearGradient :id="generateID('gnosis')" x1="12" x2="12" y1="2" y2="22" gradientUnits="userSpaceOnUse">
84
- <stop stop-color="#2BA889" />
85
- <stop offset="1" stop-color="#04795C" />
86
- </linearGradient>
87
- <clipPath id="clip0_1_911">
88
- <path fill="#fff" d="M6 6h12v12H6z" />
89
- </clipPath>
90
- </defs>
91
- </svg>
92
-
93
- <svg v-else-if="chain == 56" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
94
- <rect width="22" height="22" x="1" y="1" :fill="generateID('bsc', true)" rx="11" />
95
- <path fill="#fff"
96
- d="M13.13 15.965v1.346L11.983 18l-1.113-.69v-1.345l1.113.69 1.145-.69ZM7 11.31l1.113.69v2.308l1.916 1.173v1.346L7 14.997V11.31Zm9.967 0v3.693l-3.061 1.83v-1.346l1.916-1.174v-2.307l1.145-.696ZM13.9 9.481l1.146.69v1.345l-1.917 1.174v2.34l-1.113.69-1.107-.69v-2.346l-1.987-1.173v-1.346l1.145-.69 1.917 1.174L13.9 9.48Zm-4.978 2.997 1.113.69v1.345l-1.113-.69v-1.345Zm6.124 0v1.346l-1.113.69v-1.346l1.113-.69Zm-6.933-4.17 1.145.69-1.145.689v1.345L7 10.342V8.998l1.113-.69Zm7.742 0 1.145.69v1.345l-1.146.69V9.686l-1.112-.69 1.112-.69Zm-3.871 0 1.145.69-1.145.689-1.113-.69 1.113-.69Zm0-2.308 3.062 1.83-1.113.689-1.917-1.173-1.954 1.173-1.113-.69L11.984 6Z" />
97
- <rect v-if="stroke" :class="strokeClass" width="22" height="22" x="1" y="1" rx="11" />
98
- <defs>
99
- <linearGradient :id="generateID('bsc')" x1="12" x2="12" y1="2" y2="22" gradientUnits="userSpaceOnUse">
100
- <stop stop-color="#FFD97C" />
101
- <stop offset="1" stop-color="#F3BA2F" />
102
- </linearGradient>
103
- </defs>
104
- </svg>
105
- <svg v-else-if="chain == 1101" width="24" height="24" viewBox="0 0 24 24" fill="none"
106
- xmlns="http://www.w3.org/2000/svg">
107
- <rect x="1" y="1" width="22" height="22" rx="11" :fill="generateID('zkevm', true)" />
108
- <g clip-path="url(#clip0_0_68)">
109
- <path
110
- d="M16.4587 8.44406L12.8483 6.35851C12.5897 6.21032 12.2968 6.13235 11.9988 6.13235C11.7007 6.13235 11.4079 6.21032 11.1493 6.35851L7.53885 8.44406C7.28051 8.59322 7.06599 8.80775 6.91687 9.06611C6.76774 9.32446 6.68927 9.61753 6.68934 9.91583V14.0954C6.6915 14.3916 6.77102 14.682 6.92004 14.9379C7.06905 15.1939 7.28237 15.4064 7.53885 15.5545L11.1493 17.64C11.4076 17.7891 11.7005 17.8676 11.9988 17.8676C12.297 17.8676 12.59 17.7891 12.8483 17.64L16.4587 15.5545C16.7171 15.4053 16.9316 15.1908 17.0807 14.9324C17.2298 14.6741 17.3083 14.381 17.3082 14.0827V9.90309C17.3061 9.60696 17.2265 9.31652 17.0775 9.06058C16.9285 8.80467 16.7152 8.59213 16.4587 8.44406ZM7.53885 9.91583C7.53864 9.7665 7.57778 9.61975 7.65234 9.49037C7.72693 9.36098 7.83428 9.25356 7.9636 9.1789L11.574 7.09546C11.703 7.02038 11.8496 6.98082 11.9988 6.98082C12.148 6.98082 12.2946 7.02038 12.4235 7.09546L16.034 9.1789C16.1614 9.25247 16.2676 9.3579 16.3421 9.48485C16.4165 9.6118 16.4567 9.75594 16.4587 9.90309V10.3278C16.4576 10.6585 16.3256 10.9753 16.0916 11.2089C15.8576 11.4425 15.5406 11.5739 15.2099 11.5745H8.78763C8.33748 11.5734 7.89916 11.7188 7.53885 11.9886V9.91583ZM16.4587 14.0827C16.4589 14.232 16.4198 14.3788 16.3452 14.5082C16.2706 14.6375 16.1633 14.745 16.034 14.8196L12.4235 16.9031C12.2944 16.9776 12.1479 17.0169 11.9988 17.0169C11.8497 17.0169 11.7032 16.9776 11.574 16.9031L7.9636 14.8196C7.83613 14.7461 7.72997 14.6406 7.65551 14.5137C7.58105 14.3867 7.54084 14.2426 7.53885 14.0954V13.6707C7.53998 13.34 7.67196 13.0233 7.90597 12.7896C8.13999 12.556 8.45697 12.4246 8.78763 12.424H15.2099C15.6601 12.4251 16.0984 12.2797 16.4587 12.0099V14.0827Z"
111
- fill="white" />
112
- <path
113
- d="M10.026 9.70346H10.85V10.9374H11.6995V9.70346C11.6995 9.47816 11.61 9.26208 11.4507 9.10276C11.2914 8.94345 11.0753 8.85395 10.85 8.85395H10.026C9.80068 8.85395 9.58461 8.94345 9.42528 9.10276C9.26597 9.26208 9.17647 9.47816 9.17647 9.70346V10.9374H10.026V9.70346Z"
114
- fill="white" />
115
- <path
116
- d="M10.85 14.295H10.026V13.0611H9.17647V14.295C9.17647 14.5203 9.26597 14.7364 9.42528 14.8957C9.58461 15.055 9.80068 15.1445 10.026 15.1445H10.85C11.0753 15.1445 11.2914 15.055 11.4507 14.8957C11.61 14.7364 11.6995 14.5203 11.6995 14.295V13.0611H10.85V14.295Z"
117
- fill="white" />
118
- <path
119
- d="M13.3707 9.70346H14.1968V10.9374H15.0463V9.70346C15.0463 9.47816 14.9568 9.26208 14.7975 9.10276C14.6382 8.94345 14.4221 8.85395 14.1968 8.85395H13.3707C13.1454 8.85395 12.9293 8.94345 12.77 9.10276C12.6106 9.26208 12.5211 9.47816 12.5211 9.70346V10.9374H13.3707V9.70346Z"
120
- fill="white" />
121
- <path
122
- d="M14.1968 14.295H13.3707V13.0611H12.5211V14.295C12.5211 14.5203 12.6106 14.7364 12.77 14.8957C12.9293 15.055 13.1454 15.1445 13.3707 15.1445H14.1968C14.4221 15.1445 14.6382 15.055 14.7975 14.8957C14.9568 14.7364 15.0463 14.5203 15.0463 14.295V13.0611H14.1968V14.295Z"
123
- fill="white" />
124
- </g>
125
- <rect x="1" y="1" width="22" height="22" rx="11" v-if="stroke" :class="strokeClass" />
126
- <defs>
127
- <linearGradient :id="generateID('zkevm')" x1="12" y1="2" x2="12" y2="22" gradientUnits="userSpaceOnUse">
128
- <stop stop-color="#A177FA" />
129
- <stop offset="1" stop-color="#7A4ADD" />
130
- </linearGradient>
131
- <clipPath id="clip0_0_68">
132
- <rect width="12" height="12" fill="white" transform="translate(6 6)" />
133
- </clipPath>
134
- </defs>
135
- </svg>
136
-
137
- <svg v-else-if="chain == 1313161554" width="24" height="24" viewBox="0 0 24 24" fill="none"
138
- xmlns="http://www.w3.org/2000/svg">
139
- <rect x="1" y="1" width="22" height="22" rx="11" :fill="generateID('aurora', true)" />
140
- <path
141
- d="M11.9961 7.26624C12.4182 7.26624 12.8014 7.505 12.9902 7.88257L16.1114 14.1291C16.3835 14.6788 16.1614 15.3451 15.6116 15.6172C15.4561 15.6949 15.2894 15.7338 15.1173 15.7338H8.87486C8.26395 15.7338 7.76411 15.234 7.76411 14.6233C7.76411 14.4511 7.80299 14.279 7.88074 14.1291L11.0019 7.88257C11.1908 7.49944 11.574 7.26069 11.9961 7.26624ZM11.9961 6.5C11.2852 6.5 10.6354 6.89978 10.3188 7.53831L7.19763 13.7848C6.73667 14.7121 7.10877 15.8337 8.03624 16.3001C8.29727 16.4278 8.58607 16.5 8.87486 16.5H15.1228C16.1558 16.5 17 15.6616 17 14.6288C17 14.3401 16.9334 14.0514 16.8001 13.7904L13.6733 7.53831C13.3567 6.89978 12.707 6.5 11.9961 6.5Z"
142
- fill="white" />
143
- <rect x="1" y="1" width="22" height="22" rx="11" stroke-width="2" v-if="stroke" :class="strokeClass" />
144
- <defs>
145
- <linearGradient :id="generateID('aurora')" x1="12" y1="2" x2="12" y2="22" gradientUnits="userSpaceOnUse">
146
- <stop stop-color="#8EEF6B" />
147
- <stop offset="1" stop-color="#70D44B" />
148
- </linearGradient>
149
- </defs>
150
- </svg>
151
-
152
- <svg v-else-if="chain == 250" width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
153
- <rect x="1" y="1" width="22" height="22" rx="11" :fill="generateID('fantom', true)" />
154
- <path fill-rule="evenodd" clip-rule="evenodd"
155
- d="M12.75 10.0625L15 8.75V11.375L12.75 10.0625ZM15 15.6875L12 17.4375L9 15.6875V12.625L12 14.375L15 12.625V15.6875ZM9 8.75L11.25 10.0625L9 11.375V8.75ZM12.375 10.6875L14.625 12L12.375 13.3125V10.6875ZM11.625 13.3125L9.375 12L11.625 10.6875V13.3125ZM14.625 8.125L12 9.625L9.375 8.125L12 6.5625L14.625 8.125ZM8.25 7.875V16.0625L12 18.1875L15.75 16.0625V7.875L12 5.75L8.25 7.875Z"
156
- fill="white" />
157
- <rect x="1" y="1" width="22" height="22" rx="11" stroke-width="2" v-if="stroke" :class="strokeClass" />
158
- <defs>
159
- <linearGradient :id="generateID('fantom')" x1="12" y1="2" x2="12" y2="22" gradientUnits="userSpaceOnUse">
160
- <stop stop-color="#51D3FF" />
161
- <stop offset="1" stop-color="#13B5EC" />
162
- </linearGradient>
163
- </defs>
164
- </svg>
1
+ <script lang="ts" setup>
2
+ const props = defineProps<{
3
+ chain?: ChainId | number | string
4
+ stroke?: boolean
5
+ }>()
165
6
 
166
- <svg v-else-if="chain == 634 || chain == 63400" width="24" height="24" viewBox="0 0 24 24" fill="none"
167
- xmlns="http://www.w3.org/2000/svg">
168
- <rect x="1" y="1" width="22" height="22" rx="11" :fill="generateID('avo', true)" />
169
- <path
170
- d="M11.9999 17.4052C11.9999 17.7497 12.2787 18.0322 12.6197 17.997C15.6422 17.6854 18 15.1194 18 12C18 8.88061 15.6422 6.31462 12.6197 6.00299C12.2787 5.96765 11.9999 6.25038 11.9999 6.59486V8.25799C11.9999 8.60246 12.2806 8.87521 12.6167 8.94319C14.0353 9.2307 15.1035 10.4899 15.1035 12C15.1035 13.5101 14.0353 14.7693 12.6167 15.0569C12.2806 15.1248 11.9999 15.3978 11.9999 15.7421V17.4052ZM10.1378 7.12664C10.1378 6.70254 9.7247 6.4036 9.34642 6.59132C7.36369 7.57527 6 9.62756 6 12C6 14.3725 7.36369 16.4248 9.34642 17.4087C9.7247 17.5964 10.1378 17.2975 10.1378 16.8734V7.12685V7.12664Z"
171
- fill="white" />
172
- <rect x="1" y="1" width="22" height="22" rx="11" stroke="black" stroke-width="2" v-if="stroke" :class="strokeClass" />
173
- <defs>
174
- <linearGradient :id="generateID('avo')" x1="12" y1="2" x2="12" y2="22" gradientUnits="userSpaceOnUse">
175
- <stop stop-color="#6ED578" />
176
- <stop offset="1" stop-color="#4CA054" />
177
- </linearGradient>
178
- </defs>
179
- </svg>
7
+ const isNetworkNotAvailable = computed(() => !networks.some(network => String(network.chainId) === String(props.chain)))
8
+ </script>
180
9
 
181
- <svg v-else-if="chain == 8453" width="24" height="24" viewBox="0 0 24 24" fill="none"
182
- xmlns="http://www.w3.org/2000/svg">
183
- <rect x="1" y="1" width="22" height="22" rx="11" :fill="generateID('base', true)" />
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" />
184
13
  <path
185
- d="M11.9896 18C15.3091 18 18 15.3137 18 12C18 8.68628 15.3091 6 11.9896 6C8.84021 6 6.2566 8.41794 6 11.4956H13.9445V12.5043H6C6.2566 15.582 8.84021 18 11.9896 18Z"
186
- fill="white" />
187
- <rect v-if="stroke" :class="strokeClass" x="1" y="1" width="22" height="22" rx="11" stroke="#111827"
188
- stroke-width="2" />
189
- <defs>
190
- <linearGradient :id="generateID('base')" x1="12" y1="2" x2="12" y2="22" gradientUnits="userSpaceOnUse">
191
- <stop stop-color="#427FFF" />
192
- <stop offset="1" stop-color="#0052FF" />
193
- </linearGradient>
194
- </defs>
195
- </svg>
196
-
197
-
198
- <template v-else>
199
- <svg v-bind="$attrs" class="dark:hidden block" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 20 20">
200
- <rect width="20" height="20" fill="#CBD5E1" rx="10" />
201
- <path fill="#fff" fill-rule="evenodd"
202
- 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"
203
- clip-rule="evenodd" />
204
- </svg>
205
- <svg v-bind="$attrs" class="dark:block hidden" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 20 20">
206
- <rect width="20" height="20" fill="#334155" rx="10" />
207
- <path fill="#97A2B7" fill-rule="evenodd"
208
- 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"
209
- clip-rule="evenodd" />
210
- </svg>
211
- </template>
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`">
212
26
  </template>
213
-
214
- <script lang="ts" setup>
215
- defineProps<{
216
- chain: ChainId | number | string;
217
- stroke?: boolean;
218
- }>();
219
-
220
- const randomId = Math.random().toString(36).substr(2, 9);
221
-
222
- const generateID = (prefix: string, wrapURL = false) => {
223
- const merged = `${prefix}-${randomId}`;
224
- return wrapURL ? `url(#${merged})` : merged;
225
- };
226
-
227
- const strokeClass = "dark:stroke-gray-900 stroke-slate-50 stroke-2";
228
- </script>