From 26576c477070ddfd4d19dffbeb696c6da92b3e43 Mon Sep 17 00:00:00 2001 From: arobsn <87387688+arobsn@users.noreply.github.com> Date: Mon, 2 Dec 2024 10:13:54 -0300 Subject: [PATCH 1/2] sort tokens alphabetically and rank by know assets --- src/stores/walletStore.ts | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/stores/walletStore.ts b/src/stores/walletStore.ts index e8279ddf..6dac6ee9 100644 --- a/src/stores/walletStore.ts +++ b/src/stores/walletStore.ts @@ -27,6 +27,7 @@ import { hdKeyPool } from "@/common/objectPool"; import HdKey, { IndexedAddress } from "@/chains/ergo/hdKey"; import { graphQLService } from "@/chains/ergo/services/graphQlService"; import { patchArray } from "@/common/reactivity"; +import { assetIconMap } from "@/mappers/assetIconMap"; export type StateAssetSummary = { tokenId: string; @@ -35,6 +36,8 @@ export type StateAssetSummary = { metadata?: BasicAssetMetadata; }; +const KNOWN_ASSETS = new Set(Object.keys(assetIconMap)); + const usePrivateStateStore = defineStore("_wallet", () => { const addresses = shallowRef([]); const assets = shallowRef([]); @@ -204,9 +207,24 @@ export const useWalletStore = defineStore("wallet", () => { summary = summary.filter((x) => x.tokenId === ERG_TOKEN_ID || x.confirmedAmount.gt(0)); } - return summary.sort((a, b) => - a.tokenId === ERG_TOKEN_ID ? Number.MIN_SAFE_INTEGER : a.tokenId.localeCompare(b.tokenId) + if (summary.length <= 1) return summary; + + // sort alphabetically + summary = summary.sort((a, b) => + a.metadata?.name && b.metadata?.name + ? a.metadata.name.localeCompare(b.metadata.name) + : a.tokenId.localeCompare(b.tokenId) + ); + + // rank by known assets + summary = summary.sort((a, b) => + KNOWN_ASSETS.has(a.tokenId) && !KNOWN_ASSETS.has(b.tokenId) ? -1 : 1 ); + + // put ERG first + summary = summary.sort((a) => (a.tokenId === ERG_TOKEN_ID ? -1 : 1)); + + return summary; }); const health = computed(() => ({ From 216cfc1d5657e3c0cb79454dd1290dd058c98dd0 Mon Sep 17 00:00:00 2001 From: arobsn <87387688+arobsn@users.noreply.github.com> Date: Fri, 29 Nov 2024 07:51:15 -0300 Subject: [PATCH 2/2] bump dependencies --- package.json | 4 ++-- pnpm-lock.yaml | 40 +++++++++++++++++++++++++++++++++------- 2 files changed, 35 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 52168851..55078cab 100755 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "@oruga-ui/oruga-next": "0.6.0", "@vuelidate/core": "^2.0.3", "@vuelidate/validators": "^2.0.4", - "@vueuse/core": "^11.3.0", + "@vueuse/core": "^12.0.0", "bignumber.js": "^9.1.2", "cleave.js": "^1.6.0", "crypto-js": "^4.2.0", @@ -46,7 +46,7 @@ "ledger-ergo-js": "^0.1.19", "lodash-es": "^4.17.21", "mdi-vue": "^3.0.13", - "pinia": "^2.2.6", + "pinia": "^2.2.8", "uqr": "^0.1.2", "vue": "^3.5.13", "vue-feather": "^2.0.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5bad0d00..8a7be74a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -51,8 +51,8 @@ importers: specifier: ^2.0.4 version: 2.0.4(vue@3.5.13(typescript@5.6.3)) '@vueuse/core': - specifier: ^11.3.0 - version: 11.3.0(vue@3.5.13(typescript@5.6.3)) + specifier: ^12.0.0 + version: 12.0.0(typescript@5.6.3) bignumber.js: specifier: ^9.1.2 version: 9.1.2 @@ -84,8 +84,8 @@ importers: specifier: ^3.0.13 version: 3.0.13(@mdi/js@7.4.47)(vue@3.5.13(typescript@5.6.3)) pinia: - specifier: ^2.2.6 - version: 2.2.6(typescript@5.6.3)(vue@3.5.13(typescript@5.6.3)) + specifier: ^2.2.8 + version: 2.2.8(typescript@5.6.3)(vue@3.5.13(typescript@5.6.3)) uqr: specifier: ^0.1.2 version: 0.1.2 @@ -1217,6 +1217,9 @@ packages: '@vueuse/core@11.3.0': resolution: {integrity: sha512-7OC4Rl1f9G8IT6rUfi9JrKiXy4bfmHhZ5x2Ceojy0jnd3mHNEvV4JaRygH362ror6/NZ+Nl+n13LPzGiPN8cKA==} + '@vueuse/core@12.0.0': + resolution: {integrity: sha512-C12RukhXiJCbx4MGhjmd/gH52TjJsc3G0E0kQj/kb19H3Nt6n1CA4DRWuTdWWcaFRdlTe0npWDS942mvacvNBw==} + '@vueuse/integrations@11.2.0': resolution: {integrity: sha512-zGXz3dsxNHKwiD9jPMvR3DAxQEOV6VWIEYTGVSB9PNpk4pTWR+pXrHz9gvXWcP2sTk3W2oqqS6KwWDdntUvNVA==} peerDependencies: @@ -1264,12 +1267,18 @@ packages: '@vueuse/metadata@11.3.0': resolution: {integrity: sha512-pwDnDspTqtTo2HwfLw4Rp6yywuuBdYnPYDq+mO38ZYKGebCUQC/nVj/PXSiK9HX5otxLz8Fn7ECPbjiRz2CC3g==} + '@vueuse/metadata@12.0.0': + resolution: {integrity: sha512-Yzimd1D3sjxTDOlF05HekU5aSGdKjxhuhRFHA7gDWLn57PRbBIh+SF5NmjhJ0WRgF3my7T8LBucyxdFJjIfRJQ==} + '@vueuse/shared@11.2.0': resolution: {integrity: sha512-VxFjie0EanOudYSgMErxXfq6fo8vhr5ICI+BuE3I9FnX7ePllEsVrRQ7O6Q1TLgApeLuPKcHQxAXpP+KnlrJsg==} '@vueuse/shared@11.3.0': resolution: {integrity: sha512-P8gSSWQeucH5821ek2mn/ciCk+MS/zoRKqdQIM3bHq6p7GXDAJLmnRRKmF5F65sAVJIfzQlwR3aDzwCn10s8hA==} + '@vueuse/shared@12.0.0': + resolution: {integrity: sha512-3i6qtcq2PIio5i/vVYidkkcgvmTjCqrf26u+Fd4LhnbBmIT6FN8y6q/GJERp8lfcB9zVEfjdV0Br0443qZuJpw==} + '@windicss/config@1.9.3': resolution: {integrity: sha512-u8GUjsfC9r5X1AGYhzb1lX3zZj8wqk6SH1DYex8XUGmZ1M2UpvnUPOFi63XFViduspQ6l2xTX84QtG+lUzhEoQ==} @@ -2884,8 +2893,8 @@ packages: resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} engines: {node: '>=8.6'} - pinia@2.2.6: - resolution: {integrity: sha512-vIsR8JkDN5Ga2vAxqOE2cJj4VtsHnzpR1Fz30kClxlh0yCHfec6uoMeM3e/ddqmwFUejK3NlrcQa/shnpyT4hA==} + pinia@2.2.8: + resolution: {integrity: sha512-NRTYy2g+kju5tBRe0oNlriZIbMNvma8ZJrpHsp3qudyiMEA8jMmPPKQ2QMHg0Oc4BkUyQYWagACabrwriCK9HQ==} peerDependencies: '@vue/composition-api': ^1.4.0 typescript: '>=4.4.4' @@ -4759,6 +4768,15 @@ snapshots: - '@vue/composition-api' - vue + '@vueuse/core@12.0.0(typescript@5.6.3)': + dependencies: + '@types/web-bluetooth': 0.0.20 + '@vueuse/metadata': 12.0.0 + '@vueuse/shared': 12.0.0(typescript@5.6.3) + vue: 3.5.13(typescript@5.6.3) + transitivePeerDependencies: + - typescript + '@vueuse/integrations@11.2.0(focus-trap@7.6.0)(vue@3.5.13(typescript@5.6.3))': dependencies: '@vueuse/core': 11.2.0(vue@3.5.13(typescript@5.6.3)) @@ -4774,6 +4792,8 @@ snapshots: '@vueuse/metadata@11.3.0': {} + '@vueuse/metadata@12.0.0': {} + '@vueuse/shared@11.2.0(vue@3.5.13(typescript@5.6.3))': dependencies: vue-demi: 0.14.10(vue@3.5.13(typescript@5.6.3)) @@ -4788,6 +4808,12 @@ snapshots: - '@vue/composition-api' - vue + '@vueuse/shared@12.0.0(typescript@5.6.3)': + dependencies: + vue: 3.5.13(typescript@5.6.3) + transitivePeerDependencies: + - typescript + '@windicss/config@1.9.3': dependencies: debug: 4.3.6 @@ -6629,7 +6655,7 @@ snapshots: picomatch@2.3.1: {} - pinia@2.2.6(typescript@5.6.3)(vue@3.5.13(typescript@5.6.3)): + pinia@2.2.8(typescript@5.6.3)(vue@3.5.13(typescript@5.6.3)): dependencies: '@vue/devtools-api': 6.6.4 vue: 3.5.13(typescript@5.6.3)