From 93f9cba77f42df2a63103c34709585e3ddd80b9f Mon Sep 17 00:00:00 2001 From: MarcoMandar Date: Wed, 25 Sep 2024 11:07:47 +0100 Subject: [PATCH 1/2] fix negative value on available allocated tokens. update anon mentions Signed-off-by: MarcoMandar --- .vscode/settings.json | 2 +- README.md | 3 ++- composables/warp-signer.ts | 2 +- nuxt.config.ts | 2 +- pages/_index.vue | 2 +- pages/index.vue | 2 +- stores/useFacilitatorStore.ts | 13 +++++++++---- stores/useUserStore.ts | 4 ++-- 8 files changed, 18 insertions(+), 12 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index ff2bdce..eb21ed4 100755 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,7 +1,7 @@ { "cSpell.words": [ "Arweave", - "anon" + "anyone" ], "files.associations": { "*.css": "tailwindcss" diff --git a/README.md b/README.md index 4b62795..c77b7d4 100755 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # AnyOne Relay Dashboard -This repo houses the code to display the user specific information pertaining to ANON Relays. +This repo houses the code to display the user specific information pertaining to ANYONE Relays. ## Tech used @@ -59,4 +59,5 @@ Data is stored on chain using Arweave - this means it's permanent. Locally or in the app, the data is stored using Pinia. ## Resources + - https://cookbook.g8way.io/concepts/index.html diff --git a/composables/warp-signer.ts b/composables/warp-signer.ts index 9561526..d40340f 100755 --- a/composables/warp-signer.ts +++ b/composables/warp-signer.ts @@ -41,7 +41,7 @@ export class WarpSigner extends InjectedEthereumSigner { override async setPublicKey() { let message = - 'Please sign this message to authenticate with the ANON dashboard. ' + + 'Please sign this message to authenticate with the AnyOne dashboard. ' + 'You will only need to do this once per session when interacting with ' + 'the Relay Registry.'; diff --git a/nuxt.config.ts b/nuxt.config.ts index 2f00f85..12f1871 100755 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -22,7 +22,7 @@ export default defineNuxtConfig({ { hid: 'description', name: 'Description', - content: 'ANON Dashboard', + content: 'ANYONE Dashboard', }, { property: 'og:site_name', content: 'AnyOne Dashboard' }, { name: 'twitter:site', content: '@AnyoneFDN' }, diff --git a/pages/_index.vue b/pages/_index.vue index a8f85f3..9bb44cc 100755 --- a/pages/_index.vue +++ b/pages/_index.vue @@ -203,7 +203,7 @@ const handleClaimAllRewards = async () => { {{ formatEther( - facilitatorStore.avaliableAllocatedTokens || '0' + facilitatorStore.availableAllocatedTokens || '0' ) }} diff --git a/pages/index.vue b/pages/index.vue index 56147a5..b8ebc32 100755 --- a/pages/index.vue +++ b/pages/index.vue @@ -140,7 +140,7 @@ {{ formatEtherNoRound( - facilitatorStore.avaliableAllocatedTokens || '0' + facilitatorStore.availableAllocatedTokens || '0' ) }} diff --git a/stores/useFacilitatorStore.ts b/stores/useFacilitatorStore.ts index 7c059ea..25e0845 100755 --- a/stores/useFacilitatorStore.ts +++ b/stores/useFacilitatorStore.ts @@ -47,12 +47,17 @@ export const useFacilitatorStore = defineStore('facilitator', { setInitialized: (state) => (initialized: boolean) => { state.initialized = initialized; }, - avaliableAllocatedTokens: (state) => { + availableAllocatedTokens: (state) => { if (state.claimableAtomicTokens) { if (state.totalClaimedTokens) { - return BigNumber(state.claimableAtomicTokens) - .minus(state.totalClaimedTokens) - .toString(10); + const allocatedTokens = BigNumber(state.claimableAtomicTokens).minus( + state.totalClaimedTokens + ); + + // Ensure that the value is never negative + return allocatedTokens.isNegative() + ? '0' + : allocatedTokens.toString(10); } return state.claimableAtomicTokens; } diff --git a/stores/useUserStore.ts b/stores/useUserStore.ts index 1d259b6..8be98bd 100755 --- a/stores/useUserStore.ts +++ b/stores/useUserStore.ts @@ -50,7 +50,7 @@ export const useUserStore = defineStore('user', { familyVerifiedCache: {} as Record, }), actions: { - // Get ANON balance + // Get ANYONE balance async getTokenBalance(forceRefresh = false) { if (!this.userData.address) { return; @@ -71,7 +71,7 @@ export const useUserStore = defineStore('user', { this.cacheTimings.tokenBalance = new Date().getTime(); }, - // Get ANON balance in USD using price store + // Get ANYONE balance in USD using price store async getUsdTokenBalance(forceRefresh = false) { if (!this.userData.address) { return; From 40f44f603c44ca2abf869dedc8d4b896709bd92d Mon Sep 17 00:00:00 2001 From: MarcoMandar Date: Wed, 25 Sep 2024 11:09:23 +0100 Subject: [PATCH 2/2] version Signed-off-by: MarcoMandar --- nuxt.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nuxt.config.ts b/nuxt.config.ts index 12f1871..0aadbcb 100755 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -72,7 +72,7 @@ export default defineNuxtConfig({ supportWalletPublicKeyBase64: 'K3jnSGVyHj4kSzgce3+k8gJsfHvUoQeJMNPO8CcsO2s=', commitHash: process.env.NUXT_PUBLIC_COMMIT_HASH || 'dev', - version: '1.2.2', + version: '1.2.3', }, }, plugins: [{ src: '~/plugins/vue-query.client.ts', mode: 'client' }],