@instadapp/avocado-base 0.0.51 → 0.0.52

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 (2) hide show
  1. package/package.json +3 -3
  2. package/utils/helper.ts +7 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instadapp/avocado-base",
3
- "version": "0.0.51",
3
+ "version": "0.0.52",
4
4
  "type": "module",
5
5
  "main": "./nuxt.config.ts",
6
6
  "types": "global.d.ts",
@@ -26,7 +26,7 @@
26
26
  "dependencies": {
27
27
  "@vueuse/nuxt": "^10.2.0",
28
28
  "bignumber.js": "^9.1.1",
29
- "ethers": "^5.7.2",
30
- "xxhashjs": "^0.2.2"
29
+ "crypto-js": "^4.1.1",
30
+ "ethers": "^5.7.2"
31
31
  }
32
32
  }
package/utils/helper.ts CHANGED
@@ -1,4 +1,4 @@
1
- import * as XXH from 'xxhashjs';
1
+ import * as CryptoJS from 'crypto-js';
2
2
 
3
3
  export const indexSorter = (aIndex: number, bIndex: number) => {
4
4
  if (aIndex === -1 && bIndex === -1) {
@@ -62,12 +62,12 @@ export function formatMultipleAddresses(addresses: string[], shorten = true) {
62
62
  return formattedString
63
63
  }
64
64
 
65
- export function generateColor(address: string): string {
66
- const hash = XXH.h32(address, 0xABCD).toNumber()
65
+ export function generateColor(address: string) {
66
+ const hash = parseInt(CryptoJS.MD5(address).toString().substr(0, 8), 16);
67
67
 
68
- const hue = hash % 360
69
- const saturation = 80 + (hash % 30)
70
- const lightness = 70 + (hash % 20)
68
+ const hue = hash % 360;
69
+ const saturation = 80 + (hash % 30);
70
+ const lightness = 70 + (hash % 20);
71
71
 
72
- return `hsl(${hue}, ${saturation}%, ${lightness}%)`
72
+ return `hsl(${hue}, ${saturation}%, ${lightness}%)`;
73
73
  }