@instadapp/avocado-base 0.0.49 → 0.0.50
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.
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
|
|
3
2
|
const props = defineProps<{
|
|
4
3
|
metadata: {
|
|
5
4
|
type: MetadataTypes
|
|
@@ -55,9 +54,7 @@ provide('tokens', props.tokens);
|
|
|
55
54
|
{{ metadata?.castDetails }}
|
|
56
55
|
</div>
|
|
57
56
|
|
|
58
|
-
<
|
|
59
|
-
{{ formatMultipleAddresses(metadata.addresses) }}
|
|
60
|
-
</div>
|
|
57
|
+
<MetadataSigners v-if="metadata.type === 'add-signers' || metadata.type === 'remove-signers'" :metadata="metadata" :compact="compact" />
|
|
61
58
|
|
|
62
59
|
<div v-if="metadata.type === 'change-threshold'" class="text-left w-fit" >
|
|
63
60
|
Change Threshold to {{ metadata.count }}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
defineProps<{
|
|
3
|
+
address: string
|
|
4
|
+
}>();
|
|
5
|
+
|
|
6
|
+
const randomId = Math.random().toString(36).substr(2, 9);
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<template>
|
|
10
|
+
<svg
|
|
11
|
+
:style="{
|
|
12
|
+
color: generateColor(address),
|
|
13
|
+
}" width="30" height="30" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 30 30"
|
|
14
|
+
>
|
|
15
|
+
<g fill="currentColor" :clip-path="`url(#${randomId})`">
|
|
16
|
+
<rect width="30" height="30" fill-opacity=".4" rx="15" />
|
|
17
|
+
<ellipse cx="15.004" cy="26.399" rx="11.4" ry="6.6" />
|
|
18
|
+
<circle cx="15" cy="12.75" r="5.4" />
|
|
19
|
+
</g>
|
|
20
|
+
<defs>
|
|
21
|
+
<clipPath :id="randomId">
|
|
22
|
+
<rect width="30" height="30" fill="#fff" rx="15" />
|
|
23
|
+
</clipPath>
|
|
24
|
+
</defs>
|
|
25
|
+
</svg>
|
|
26
|
+
</template>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { Tippy } from 'vue-tippy'
|
|
3
|
+
const props = defineProps<{
|
|
4
|
+
metadata: {
|
|
5
|
+
type: MetadataTypes,
|
|
6
|
+
[key: string]: any
|
|
7
|
+
};
|
|
8
|
+
compact?: boolean;
|
|
9
|
+
}>();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<div>
|
|
14
|
+
<div v-if="!compact || metadata.addresses.length < 3" class="flex gap-[14px] flex-wrap">
|
|
15
|
+
<div v-for="address of metadata.addresses" :key="address" class="flex gap-[8px] rounded-full bg-slate-50 dark:bg-gray-850 justify-start items-center px-[8px] py-[6px]">
|
|
16
|
+
<AuthorityAvatar :address="address" class="w-[18px] h-[18px]" />
|
|
17
|
+
<p class="text-xs leading-5">
|
|
18
|
+
{{ shortenHash(address, compact ? 2 : 4) }}
|
|
19
|
+
</p>
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
<div v-else class="flex gap-2 flex-wrap items-center">
|
|
23
|
+
<div v-for="address of [metadata.addresses[0], metadata.addresses[1]]" :key="address" class="flex gap-[8px] rounded-full bg-slate-50 dark:bg-gray-850 justify-start items-center px-[8px] py-[6px]">
|
|
24
|
+
<AuthorityAvatar :address="address" class="w-[18px] h-[18px]" />
|
|
25
|
+
<p class="text-xs leading-5">
|
|
26
|
+
{{ shortenHash(address, 2) }}
|
|
27
|
+
</p>
|
|
28
|
+
</div>
|
|
29
|
+
...
|
|
30
|
+
<Tippy max-width="none" interactive tag="button" content-tag="div" content-class="content-wrapper">
|
|
31
|
+
<template #default>
|
|
32
|
+
<SvgoInfo2 class="w-[16px] h-[16px] text-slate-500 rounded-full" />
|
|
33
|
+
</template>
|
|
34
|
+
<template #content>
|
|
35
|
+
<ul class="flex flex-col gap-2.5">
|
|
36
|
+
<li v-for="address in metadata.addresses" :key="address" class="flex text-xs items-center gap-2.5">
|
|
37
|
+
<AuthorityAvatar class="shrink-0 w-5 h-5" :address="address" />
|
|
38
|
+
{{ address }}
|
|
39
|
+
</li>
|
|
40
|
+
</ul>
|
|
41
|
+
</template>
|
|
42
|
+
</Tippy>
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
</template>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instadapp/avocado-base",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.50",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./nuxt.config.ts",
|
|
6
6
|
"types": "global.d.ts",
|
|
@@ -20,11 +20,13 @@
|
|
|
20
20
|
"nuxt-svgo": "^3.1.0",
|
|
21
21
|
"rimraf": "^3.0.2",
|
|
22
22
|
"typechain": "^8.1.1",
|
|
23
|
-
"unplugin-vue-components": "^0.25.1"
|
|
23
|
+
"unplugin-vue-components": "^0.25.1",
|
|
24
|
+
"vue-tippy": "^6.0.0"
|
|
24
25
|
},
|
|
25
26
|
"dependencies": {
|
|
26
27
|
"@vueuse/nuxt": "^10.2.0",
|
|
27
28
|
"bignumber.js": "^9.1.1",
|
|
28
|
-
"ethers": "^5.7.2"
|
|
29
|
+
"ethers": "^5.7.2",
|
|
30
|
+
"xxhashjs": "^0.2.2"
|
|
29
31
|
}
|
|
30
32
|
}
|
package/utils/helper.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import * as XXH from 'xxhashjs';
|
|
2
|
+
|
|
1
3
|
export const indexSorter = (aIndex: number, bIndex: number) => {
|
|
2
4
|
if (aIndex === -1 && bIndex === -1) {
|
|
3
5
|
return 0; // fallback to other sorting criteria
|
|
@@ -58,4 +60,14 @@ export function formatMultipleAddresses(addresses: string[], shorten = true) {
|
|
|
58
60
|
const formattedString = formatter.format(addresses.map(i => shorten ? shortenHash(i) || '' : i))
|
|
59
61
|
|
|
60
62
|
return formattedString
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export function generateColor(address: string): string {
|
|
66
|
+
const hash = XXH.h32(address, 0xABCD).toNumber()
|
|
67
|
+
|
|
68
|
+
const hue = hash % 360
|
|
69
|
+
const saturation = 80 + (hash % 30)
|
|
70
|
+
const lightness = 70 + (hash % 20)
|
|
71
|
+
|
|
72
|
+
return `hsl(${hue}, ${saturation}%, ${lightness}%)`
|
|
61
73
|
}
|