From 8bdd7bab23016d0c8d977b9c05209f389b8f1830 Mon Sep 17 00:00:00 2001 From: Anton Lykhoyda Date: Thu, 12 Dec 2024 17:34:00 +0100 Subject: [PATCH] add account summary balances --- Cargo.toml | 6 +- justfile | 2 - packages/snap/snap.manifest.json | 2 +- packages/web-wallet/src/App.tsx | 2 +- .../web-wallet/src/assets/icons/coins.svg | 3 + packages/web-wallet/src/assets/index.ts | 2 + .../src/components/Layout/Layout.tsx | 4 +- .../web-wallet/src/context/WebzjsContext.tsx | 43 +++---- .../web-wallet/src/hooks/useWebzjsActions.ts | 112 ++++++++++++++---- .../web-wallet/src/pages/AccountSummary.tsx | 84 ++++++++++++- packages/web-wallet/src/pages/Dashboard.tsx | 6 +- packages/web-wallet/src/pages/Home.tsx | 22 +++- packages/web-wallet/src/utils/index.ts | 1 + packages/web-wallet/src/utils/zatsToZec.ts | 3 + 14 files changed, 231 insertions(+), 61 deletions(-) create mode 100644 packages/web-wallet/src/assets/icons/coins.svg create mode 100644 packages/web-wallet/src/utils/zatsToZec.ts diff --git a/Cargo.toml b/Cargo.toml index 9221896..ab840f5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,8 +1,10 @@ [workspace] resolver = "2" -members = [ "crates/webz-common", - "crates/webz-keys", "crates/webz-requests", +members = [ + "crates/webz-common", + "crates/webz-keys", + "crates/webz-requests", "crates/webz-wallet", ] diff --git a/justfile b/justfile index 05fcb63..b5b5c69 100644 --- a/justfile +++ b/justfile @@ -15,7 +15,6 @@ build-keys *features: build-requests *features: cd crates/webz-requests && wasm-pack build -t web --release --scope webzjs --out-dir ../../packages/webz-requests --no-default-features --features="{{features}}" -Z build-std="panic_abort,std" - # All Wasm Tests test-web *features: WASM_BINDGEN_TEST_TIMEOUT=99999 wasm-pack test --release --firefox --no-default-features --features "wasm no-bundler {{features}}" -Z build-std="panic_abort,std" @@ -28,7 +27,6 @@ test-message-board-web *features: test-simple-web *features: WASM_BINDGEN_TEST_TIMEOUT=99999 wasm-pack test --release --chrome --no-default-features --features "wasm no-bundler {{features}}" -Z build-std="panic_abort,std" --test simple-sync-and-send - # simple example: additional args:, sqlite-db example-simple *features: RUST_LOG="info,zcash_client_backend::sync=debug" cargo run -r --example simple-sync --features "native {{features}}" diff --git a/packages/snap/snap.manifest.json b/packages/snap/snap.manifest.json index cb9482e..5de5b5f 100644 --- a/packages/snap/snap.manifest.json +++ b/packages/snap/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/template-snap-monorepo.git" }, "source": { - "shasum": "5kG/5tKuPrrpApOlFvFR5gCuTloSUZfJ4QCjtVezHu8=", + "shasum": "trfvzpmDcGt2TqfetqwfKPa8kHXQKGf4cytN7W+dHZU=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/web-wallet/src/App.tsx b/packages/web-wallet/src/App.tsx index 1cd8cd4..220fe0c 100644 --- a/packages/web-wallet/src/App.tsx +++ b/packages/web-wallet/src/App.tsx @@ -1,8 +1,8 @@ import { useInterval } from 'usehooks-ts'; -import { RESCAN_INTERVAL } from '@webzjs/demo-wallet/src/App/Constants.tsx'; import { useWebZjsActions } from '@hooks/useWebzjsActions.ts'; import Layout from '@components/Layout/Layout.tsx'; import { Outlet } from 'react-router-dom'; +import { RESCAN_INTERVAL } from './config/constants.ts'; function App() { const { triggerRescan } = useWebZjsActions(); diff --git a/packages/web-wallet/src/assets/icons/coins.svg b/packages/web-wallet/src/assets/icons/coins.svg new file mode 100644 index 0000000..bdf26eb --- /dev/null +++ b/packages/web-wallet/src/assets/icons/coins.svg @@ -0,0 +1,3 @@ + + + diff --git a/packages/web-wallet/src/assets/index.ts b/packages/web-wallet/src/assets/index.ts index 5cf95b6..60f4035 100644 --- a/packages/web-wallet/src/assets/index.ts +++ b/packages/web-wallet/src/assets/index.ts @@ -12,6 +12,7 @@ import ClockSvg from './icons/clock.svg'; import ShieldSvg from './icons/shield.svg'; import ShieldDividedSvg from './icons/shield-divided.svg'; import SummarySvg from './icons/summary.svg'; +import CoinsSvg from './icons/coins.svg'; export { ChainsafeSvg, @@ -26,4 +27,5 @@ export { ShieldSvg, ShieldDividedSvg, SummarySvg, + CoinsSvg, }; diff --git a/packages/web-wallet/src/components/Layout/Layout.tsx b/packages/web-wallet/src/components/Layout/Layout.tsx index 82e5414..83682fa 100644 --- a/packages/web-wallet/src/components/Layout/Layout.tsx +++ b/packages/web-wallet/src/components/Layout/Layout.tsx @@ -5,9 +5,9 @@ import Footer from '../Footer/Footer.tsx'; const Layout = (): React.JSX.Element => { return ( -
+
-
+