From 2be2690cbbaf787ae2dd1b36afc89d882f76cf6a Mon Sep 17 00:00:00 2001 From: BeroBurny Date: Wed, 22 May 2024 13:57:21 +0200 Subject: [PATCH] unit format --- web/package.json | 2 +- web/src/lib/components/TokenList.svelte | 3 +- web/src/lib/components/TokenModal.svelte | 3 +- web/src/lib/components/Web3Modal.svelte | 2 - web/src/lib/stores/wallet.ts | 2 +- yarn.lock | 66 +++++++++++++++++++----- 6 files changed, 59 insertions(+), 19 deletions(-) diff --git a/web/package.json b/web/package.json index eda32b5..1affcb0 100644 --- a/web/package.json +++ b/web/package.json @@ -46,6 +46,6 @@ "@floating-ui/dom": "1.6.5", "@metamask/sdk": "^0.20.3", "highlight.js": "11.9.0", - "react": "^18.3.1" + "web3-utils": "^4.2.3" } } diff --git a/web/src/lib/components/TokenList.svelte b/web/src/lib/components/TokenList.svelte index c491704..5089a46 100644 --- a/web/src/lib/components/TokenList.svelte +++ b/web/src/lib/components/TokenList.svelte @@ -6,6 +6,7 @@ import TokenModal from '$lib/components/TokenModal.svelte'; import RequestSendModal from '$lib/components/RequestSendModal.svelte'; import ResponseSendModal from '$lib/components/ResponseSendModal.svelte'; + import { fromWei } from 'web3-utils'; const modalStore = getModalStore(); @@ -70,7 +71,7 @@ {`${token.logoURI}-LOGO`} {token.name} - {token.total} + {fromWei(token.total, 'ether')} {/each} diff --git a/web/src/lib/components/TokenModal.svelte b/web/src/lib/components/TokenModal.svelte index ab2284d..fbd90e0 100644 --- a/web/src/lib/components/TokenModal.svelte +++ b/web/src/lib/components/TokenModal.svelte @@ -2,6 +2,7 @@ import type { SvelteComponent } from 'svelte'; import { getModalStore } from '@skeletonlabs/skeleton'; import { hacks_getChainIcon } from '$lib/hacks'; + import { fromWei } from 'web3-utils'; // Props /** Exposes parent props to this component. */ @@ -40,7 +41,7 @@ {$modalStore[0].value.networks.get(balance.chainId).name} - {balance.balance} + {fromWei(balance.balance, 'mwei')} {/each} diff --git a/web/src/lib/components/Web3Modal.svelte b/web/src/lib/components/Web3Modal.svelte index d9fec2f..95cdd1e 100644 --- a/web/src/lib/components/Web3Modal.svelte +++ b/web/src/lib/components/Web3Modal.svelte @@ -1,7 +1,5 @@ diff --git a/web/src/lib/stores/wallet.ts b/web/src/lib/stores/wallet.ts index e802f96..986ec47 100644 --- a/web/src/lib/stores/wallet.ts +++ b/web/src/lib/stores/wallet.ts @@ -1,4 +1,4 @@ -import { readable, writable } from 'svelte/store'; +import { writable } from 'svelte/store'; import { MetaMaskSDK } from '@metamask/sdk'; diff --git a/yarn.lock b/yarn.lock index 4945dc7..99f088b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3340,6 +3340,13 @@ __metadata: languageName: node linkType: hard +"eventemitter3@npm:^5.0.1": + version: 5.0.1 + resolution: "eventemitter3@npm:5.0.1" + checksum: 4ba5c00c506e6c786b4d6262cfbce90ddc14c10d4667e5c83ae993c9de88aa856033994dd2b35b83e8dc1170e224e66a319fa80adc4c32adcd2379bbc75da814 + languageName: node + linkType: hard + "events@npm:^3.3.0": version: 3.3.0 resolution: "events@npm:3.3.0" @@ -4538,7 +4545,7 @@ __metadata: languageName: node linkType: hard -"loose-envify@npm:^1.0.0, loose-envify@npm:^1.1.0": +"loose-envify@npm:^1.0.0": version: 1.4.0 resolution: "loose-envify@npm:1.4.0" dependencies: @@ -5679,15 +5686,6 @@ __metadata: languageName: node linkType: hard -"react@npm:^18.3.1": - version: 18.3.1 - resolution: "react@npm:18.3.1" - dependencies: - loose-envify: ^1.1.0 - checksum: 283e8c5efcf37802c9d1ce767f302dd569dd97a70d9bb8c7be79a789b9902451e0d16334b05d73299b20f048cbc3c7d288bbbde10b701fa194e2089c237dbea3 - languageName: node - linkType: hard - "read-cache@npm:^1.0.0": version: 1.0.0 resolution: "read-cache@npm:1.0.0" @@ -6963,7 +6961,7 @@ __metadata: languageName: node linkType: hard -"util@npm:^0.12.4": +"util@npm:^0.12.4, util@npm:^0.12.5": version: 0.12.5 resolution: "util@npm:0.12.5" dependencies: @@ -7127,6 +7125,48 @@ __metadata: languageName: node linkType: hard +"web3-errors@npm:^1.1.4": + version: 1.1.4 + resolution: "web3-errors@npm:1.1.4" + dependencies: + web3-types: ^1.3.1 + checksum: a87d2846cfa8dd007fe3b3b474e1e83eaa0609b973413b9bd64f993a34ad6ce527606d4d09bcdcacb352a0b50a084e55ff50100b55d237a2500e22eb84e83e7d + languageName: node + linkType: hard + +"web3-types@npm:^1.3.1, web3-types@npm:^1.5.0, web3-types@npm:^1.6.0": + version: 1.6.0 + resolution: "web3-types@npm:1.6.0" + checksum: 346f40be29617190888e9fabcc7a205910cee32f3d761e6cf1a59c25214431ddb81f5c008d49229fee04813ac505419c7b12c81ccfd8b38f50612e6b0e16b3be + languageName: node + linkType: hard + +"web3-utils@npm:^4.2.3": + version: 4.2.3 + resolution: "web3-utils@npm:4.2.3" + dependencies: + ethereum-cryptography: ^2.0.0 + eventemitter3: ^5.0.1 + web3-errors: ^1.1.4 + web3-types: ^1.6.0 + web3-validator: ^2.0.5 + checksum: 6f76b81586896c5159c7ae3456e066799b64efb69a8d38bfc6fa35933e931711e79a7d55534bfeed4352a77e556c6ad9bcfcc36855e0f7d41b57eabb4221f402 + languageName: node + linkType: hard + +"web3-validator@npm:^2.0.5": + version: 2.0.5 + resolution: "web3-validator@npm:2.0.5" + dependencies: + ethereum-cryptography: ^2.0.0 + util: ^0.12.5 + web3-errors: ^1.1.4 + web3-types: ^1.5.0 + zod: ^3.21.4 + checksum: 456f4d36e61416f402c4b71abb2ccfb4a8ad442f01ac36bd70d75a53f5d2f8bf59009373de438ec16ec32d544c50a03013e9fd2d1778c43eaab67cab94f1eb98 + languageName: node + linkType: hard + "web@workspace:web": version: 0.0.0-use.local resolution: "web@workspace:web" @@ -7152,7 +7192,6 @@ __metadata: postcss: 8.4.38 prettier: ^3.1.1 prettier-plugin-svelte: ^3.1.2 - react: ^18.3.1 svelte: ^4.2.7 svelte-check: ^3.6.0 tailwindcss: 3.4.3 @@ -7161,6 +7200,7 @@ __metadata: vite: ^5.0.3 vite-plugin-tailwind-purgecss: 0.3.3 vitest: ^1.2.0 + web3-utils: ^4.2.3 wrangler: ^3.57.0 languageName: unknown linkType: soft @@ -7504,7 +7544,7 @@ __metadata: languageName: node linkType: hard -"zod@npm:^3.20.6": +"zod@npm:^3.20.6, zod@npm:^3.21.4": version: 3.23.8 resolution: "zod@npm:3.23.8" checksum: 8f14c87d6b1b53c944c25ce7a28616896319d95bc46a9660fe441adc0ed0a81253b02b5abdaeffedbeb23bdd25a0bf1c29d2c12dd919aef6447652dd295e3e69