@instadapp/avocado-base 0.0.59 → 0.0.61
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/components/AuthorityAvatar.vue +12 -0
- package/components/ChainLogo.vue +19 -3
- package/nuxt.config.ts +0 -2
- package/package.json +1 -2
- package/utils/helper.ts +0 -11
- package/utils/network.ts +9 -0
- package/utils/utils.d.ts +1 -0
|
@@ -1,9 +1,21 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
import * as XXH from 'xxhashjs';
|
|
3
|
+
|
|
2
4
|
defineProps<{
|
|
3
5
|
address: string
|
|
4
6
|
}>();
|
|
5
7
|
|
|
6
8
|
const randomId = Math.random().toString(36).substr(2, 9);
|
|
9
|
+
|
|
10
|
+
export function generateColor(address: string): string {
|
|
11
|
+
const hash = XXH.h32(address, 0xABCD).toNumber()
|
|
12
|
+
|
|
13
|
+
const hue = hash % 360
|
|
14
|
+
const saturation = 80 + (hash % 30)
|
|
15
|
+
const lightness = 70 + (hash % 20)
|
|
16
|
+
|
|
17
|
+
return `hsl(${hue}, ${saturation}%, ${lightness}%)`
|
|
18
|
+
}
|
|
7
19
|
</script>
|
|
8
20
|
|
|
9
21
|
<template>
|
package/components/ChainLogo.vue
CHANGED
|
@@ -1,13 +1,29 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
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">
|
|
3
17
|
<img class="w-full h-full" :src="`https://cdn.instadapp.io/avocado/networks/${chain}.svg`"/>
|
|
4
18
|
</span>
|
|
5
19
|
<img v-else :src="`https://cdn.instadapp.io/avocado/networks/${chain}.svg`"/>
|
|
6
20
|
</template>
|
|
7
21
|
|
|
8
22
|
<script lang="ts" setup>
|
|
9
|
-
defineProps<{
|
|
10
|
-
chain
|
|
23
|
+
const props = defineProps<{
|
|
24
|
+
chain?: ChainId | number | string;
|
|
11
25
|
stroke?: boolean;
|
|
12
26
|
}>();
|
|
27
|
+
|
|
28
|
+
const isNetworkNotAvailable = computed(() => !networks.some((network) => String(network.chainId) === String(props.chain)))
|
|
13
29
|
</script>
|
package/nuxt.config.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// https://nuxt.com/docs/api/configuration/nuxt-config
|
|
2
2
|
import ViteComponents from "unplugin-vue-components/vite";
|
|
3
|
-
import requireTransform from 'vite-plugin-require-transform'
|
|
4
3
|
|
|
5
4
|
export default defineNuxtConfig({
|
|
6
5
|
modules: ["@nuxtjs/tailwindcss", "nuxt-svgo", "@vueuse/nuxt"],
|
|
@@ -13,7 +12,6 @@ export default defineNuxtConfig({
|
|
|
13
12
|
},
|
|
14
13
|
vite: {
|
|
15
14
|
plugins: [
|
|
16
|
-
requireTransform({}),
|
|
17
15
|
ViteComponents({
|
|
18
16
|
dts: true,
|
|
19
17
|
}),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instadapp/avocado-base",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.61",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./nuxt.config.ts",
|
|
6
6
|
"types": "global.d.ts",
|
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
"rimraf": "^3.0.2",
|
|
22
22
|
"typechain": "^8.1.1",
|
|
23
23
|
"unplugin-vue-components": "^0.25.1",
|
|
24
|
-
"vite-plugin-require-transform": "^1.0.21",
|
|
25
24
|
"vue-tippy": "^6.0.0"
|
|
26
25
|
},
|
|
27
26
|
"dependencies": {
|
package/utils/helper.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import * as XXH from 'xxhashjs';
|
|
2
|
-
|
|
3
1
|
export const indexSorter = (aIndex: number, bIndex: number) => {
|
|
4
2
|
if (aIndex === -1 && bIndex === -1) {
|
|
5
3
|
return 0; // fallback to other sorting criteria
|
|
@@ -62,12 +60,3 @@ export function formatMultipleAddresses(addresses: string[], shorten = true) {
|
|
|
62
60
|
return formattedString
|
|
63
61
|
}
|
|
64
62
|
|
|
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}%)`
|
|
73
|
-
}
|
package/utils/network.ts
CHANGED
|
@@ -23,6 +23,7 @@ export const networks: Network[] = [
|
|
|
23
23
|
balanceResolverAddress: "0x58632D23120b20650262b8A629a14e4F4043E0D9",
|
|
24
24
|
usdcAddress: "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",
|
|
25
25
|
explorerUrl: "https://polygonscan.com",
|
|
26
|
+
apiURL: 'https://api.polygonscan.com',
|
|
26
27
|
get serverRpcUrl() {
|
|
27
28
|
return process.env?.POLYGON_RPC_URL || this.params.rpcUrls[0];
|
|
28
29
|
},
|
|
@@ -46,6 +47,7 @@ export const networks: Network[] = [
|
|
|
46
47
|
usdcAddress: "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8",
|
|
47
48
|
balanceResolverAddress: "0xca5f37e6D8bB24c5A7958d5eccE7Bd9Aacc944f2",
|
|
48
49
|
explorerUrl: "https://arbiscan.io",
|
|
50
|
+
apiURL: 'https://api.arbiscan.io',
|
|
49
51
|
get serverRpcUrl() {
|
|
50
52
|
return process.env?.ARBITRUM_RPC_URL || this.params.rpcUrls[0];
|
|
51
53
|
},
|
|
@@ -66,6 +68,7 @@ export const networks: Network[] = [
|
|
|
66
68
|
zerionName: "ethereum",
|
|
67
69
|
chainId: 1,
|
|
68
70
|
explorerUrl: "https://etherscan.io",
|
|
71
|
+
apiURL: 'https://api.etherscan.io',
|
|
69
72
|
color: "#5D5FEF",
|
|
70
73
|
get serverRpcUrl() {
|
|
71
74
|
return process.env?.MAINNET_RPC_URL || this.params.rpcUrls[0];
|
|
@@ -86,6 +89,7 @@ export const networks: Network[] = [
|
|
|
86
89
|
chainId: 8453,
|
|
87
90
|
color: '#1E2024',
|
|
88
91
|
explorerUrl: 'https://basescan.org',
|
|
92
|
+
apiURL: 'https://api.basescan.org',
|
|
89
93
|
get serverRpcUrl() {
|
|
90
94
|
return process.env?.BASE_RPC_URL || this.params.rpcUrls[0];
|
|
91
95
|
},
|
|
@@ -108,6 +112,7 @@ export const networks: Network[] = [
|
|
|
108
112
|
zerionName: "optimism",
|
|
109
113
|
color: "#FF0420",
|
|
110
114
|
chainId: 10,
|
|
115
|
+
apiURL: 'https://api-optimistic.etherscan.io',
|
|
111
116
|
usdcAddress: "0x7f5c764cbc14f9669b88837ca1490cca17c31607",
|
|
112
117
|
balanceResolverAddress: "0xca5f37e6D8bB24c5A7958d5eccE7Bd9Aacc944f2",
|
|
113
118
|
explorerUrl: "https://optimistic.etherscan.io",
|
|
@@ -129,6 +134,7 @@ export const networks: Network[] = [
|
|
|
129
134
|
chainId: 1101,
|
|
130
135
|
color: "#8544f6",
|
|
131
136
|
explorerUrl: "https://zkevm.polygonscan.com",
|
|
137
|
+
apiURL: 'https://api-zkevm.polygonscan.com',
|
|
132
138
|
balanceResolverAddress: "0x48D1Fa5Ee6691a1E0B45d2B515650997BEA27a01",
|
|
133
139
|
usdcAddress: "0xa8ce8aee21bc2a48a5ef670afcc9274c7bbbc035",
|
|
134
140
|
get serverRpcUrl() {
|
|
@@ -152,6 +158,7 @@ export const networks: Network[] = [
|
|
|
152
158
|
color: "#F3BA2F",
|
|
153
159
|
chainId: 56,
|
|
154
160
|
explorerUrl: "https://bscscan.com",
|
|
161
|
+
apiURL: 'https://api.bscscan.com',
|
|
155
162
|
usdcAddress: "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d",
|
|
156
163
|
balanceResolverAddress: "0xb808cff38706e267067b0af427726aa099f69f89",
|
|
157
164
|
get serverRpcUrl() {
|
|
@@ -177,6 +184,7 @@ export const networks: Network[] = [
|
|
|
177
184
|
usdcAddress: "0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e",
|
|
178
185
|
balanceResolverAddress: "0x63009f31D054E0ac9F321Cf0D642375236A4Bf1E",
|
|
179
186
|
explorerUrl: "https://snowtrace.io",
|
|
187
|
+
apiURL: 'https://api.snowtrace.io',
|
|
180
188
|
get serverRpcUrl() {
|
|
181
189
|
return process.env?.AVALANCHE_RPC_URL || this.params.rpcUrls[0];
|
|
182
190
|
},
|
|
@@ -220,6 +228,7 @@ export const networks: Network[] = [
|
|
|
220
228
|
chainId: 100,
|
|
221
229
|
balanceResolverAddress: "0xfaa244e276b1597f663975ed007ee4ff70d27849",
|
|
222
230
|
explorerUrl: "https://gnosisscan.io",
|
|
231
|
+
apiURL:'https://api.gnosisscan.io',
|
|
223
232
|
usdcAddress: "0xddafbb505ad214d7b80b1f830fccc89b60fb7a83",
|
|
224
233
|
get serverRpcUrl() {
|
|
225
234
|
return process.env?.GNOSIS_RPC_URL || this.params.rpcUrls[0];
|