Skip to content

Commit

Permalink
Merge pull request #54 from ChainSafe/lykhoyda/dashboard
Browse files Browse the repository at this point in the history
Lykhoyda/dashboard
  • Loading branch information
Lykhoyda authored Dec 18, 2024
2 parents fe47cf2 + 37a759f commit e569ff1
Show file tree
Hide file tree
Showing 48 changed files with 1,438 additions and 443 deletions.
461 changes: 234 additions & 227 deletions Cargo.lock

Large diffs are not rendered by default.

20 changes: 7 additions & 13 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -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",
]

Expand All @@ -14,13 +16,13 @@ codegen-units = 1

[workspace.dependencies]
## Web dependencies
wasm-bindgen = "0.2.93"
wasm-bindgen = "=0.2.93" # higher versions has an issues with attachment of the file: webz-wallet/snippets/wasm-bindgen-rayon-3e04391371ad0a8e/src/workerHelpers.worker.js
js-sys = "0.3.70"
wasm-bindgen-futures = "0.4.43"
web-sys = { version = "0.3.70", features = [
"console",
] }
wasm-bindgen-rayon = { version = "1.2.1" }
wasm-bindgen-rayon = { version = "=1.2.1" } # Update to higher version cause playwright test in chtomium fail

# WASM specific dependencies
tracing-web = { version = "0.1.3" }
Expand Down Expand Up @@ -79,15 +81,7 @@ byte-unit = { version = "5.1.4", features = ["byte"] }


[patch.crates-io]
zip32 = { git = "https://github.com/zcash/zip32.git", branch = "diversifier_index_ord" }
# TODO: See: https://github.com/RReverser/wasm-bindgen-rayon/pull/12
wasm-bindgen-rayon = { git = "https://github.com/9SMTM6/wasm-bindgen-rayon", rev = "d1816e5bc2bf928ff5442355c04500a381d66a41" }
# TODO: Remove these once the PRs are merged
shardtree = { git = "https://github.com/ec2/incrementalmerkletree.git", rev = "16eff253ad2575d48feec04f7387e6507a7dd698" }
incrementalmerkletree = { git = "https://github.com/ec2/incrementalmerkletree.git", rev = "16eff253ad2575d48feec04f7387e6507a7dd698" }

# [patch.'https://github.com/WilsonGramer/wasm_thread']
# wasm_thread = { git = "https://github.com/ec2/wasm_thread", rev = "9e432077948d927d49373d1d039c23447d3648df" }

#[patch.'https://github.com/chainsafe/librustzcash']
#zcash_address = { path = "../librustzcash/components/zcash_address" }
Expand All @@ -97,4 +91,4 @@ incrementalmerkletree = { git = "https://github.com/ec2/incrementalmerkletree.gi
#zcash_keys = { path = "../librustzcash/zcash_keys" }
#zcash_primitives = { path = "../librustzcash/zcash_primitives" }
#zcash_proofs = { path = "../librustzcash/zcash_proofs" }
#zcash_protocol = { path = "../librustzcash/components/zcash_protocol" }
#zcash_protocol = { path = "../librustzcash/components/zcash_protocol" }
2 changes: 1 addition & 1 deletion crates/webz-wallet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ js-sys.workspace = true
web-sys.workspace = true

wasm-bindgen-futures = "0.4.43"
wasm-bindgen-rayon = { version = "1.2.1", optional = true }
wasm-bindgen-rayon = { version = "=1.2.1", optional = true }

# WASM specific dependencies
tracing-web = { version = "0.1.3", optional = true }
Expand Down
2 changes: 0 additions & 2 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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}}"
Expand Down
2 changes: 1 addition & 1 deletion packages/e2e-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"license": "ISC",
"devDependencies": {
"@parcel/core": "^2.12.0",
"@playwright/test": "^1.47.2",
"@playwright/test": "^1.49.1",
"@types/node": "^22.7.4",
"@webzjs/webz-keys": "workspace:^",
"@webzjs/webz-requests": "workspace:^",
Expand Down
23 changes: 9 additions & 14 deletions packages/e2e-tests/src/index.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
import initWasm, { initThreadPool, WebWallet } from "@webzjs/webz-wallet";

import initWasm, * as WebZWallet from "@webzjs/webz-wallet";
import initKeys, * as WebZKeys from "@webzjs/webz-keys";
import initRequests, * as WebZRequests from "@webzjs/webz-requests";
import initWasm, * as WebZWallet from '@webzjs/webz-wallet';
import { initThreadPool, WebWallet } from '@webzjs/webz-wallet';
import initKeys, * as WebZKeys from '@webzjs/webz-keys';
import initRequests, * as WebZRequests from '@webzjs/webz-requests';

window.WebZWallet = WebZWallet;
window.WebZKeys = WebZKeys;
window.WebZRequests = WebZRequests;

const N_THREADS = 10;
const MAINNET_LIGHTWALLETD_PROXY = "https://zcash-mainnet.chainsafe.dev";
const MAINNET_LIGHTWALLETD_PROXY = 'https://zcash-mainnet.chainsafe.dev';

async function loadPage() {
await new Promise((resolve) => {
window.addEventListener("load", resolve);
window.addEventListener('load', resolve);
});

// Code to executed once the page has loaded
Expand All @@ -22,14 +21,10 @@ async function loadPage() {
await initRequests();
await initThreadPool(N_THREADS);

window.webWallet = new WebWallet(
"main",
MAINNET_LIGHTWALLETD_PROXY,
1
);
window.webWallet = new WebWallet('main', MAINNET_LIGHTWALLETD_PROXY, 1);
window.initialized = true;
console.log("WebWallet initialized");
console.log('WebWallet initialized');
console.log(webWallet);
}

loadPage();
loadPage();
2 changes: 1 addition & 1 deletion packages/snap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"@metamask/eslint-config-nodejs": "^14.0.0",
"@metamask/eslint-config-typescript": "^14.0.0",
"@metamask/snaps-cli": "^6.5.2",
"@metamask/snaps-jest": "^8.6.0",
"@metamask/snaps-jest": "^8.8.1",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^5.42.1",
"eslint": "^9.14.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/snap/snap.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/template-snap-monorepo.git"
},
"source": {
"shasum": "+SKENP/6gsN0rziHiYtTQI27Cu1ssKsp6FUdW/pjriw=",
"shasum": "I0Yfshe6Y+9LqO6LuUhPC0gUMpbHmm6yzzVLPI86hps=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
1 change: 0 additions & 1 deletion packages/web-wallet/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>WebZjs Web Wallet</title>
</head>
Expand Down
9 changes: 7 additions & 2 deletions packages/web-wallet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@
},
"dependencies": {
"@metamask/providers": "^18.2.0",
"@webzjs/webz-keys": "workspace:^",
"@webzjs/webz-wallet": "workspace:^",
"idb-keyval": "^6.2.1",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-router-dom": "^6.27.0"
"react-router-dom": "^6.27.0",
"usehooks-ts": "^3.1.0"
},
"devDependencies": {
"@eslint/js": "^9.13.0",
Expand All @@ -32,6 +36,7 @@
"tailwindcss": "^3.4.14",
"typescript": "~5.6.2",
"typescript-eslint": "^8.11.0",
"vite": "^5.4.10"
"vite": "^5.4.10",
"vite-plugin-svgr": "^4.3.0"
}
}
22 changes: 22 additions & 0 deletions packages/web-wallet/src/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { useInterval } from 'usehooks-ts';
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();

// rescan the wallet periodically
useInterval(() => {
triggerRescan();
}, RESCAN_INTERVAL);

return (
<Layout>
<Outlet />
</Layout>
);
}

export default App;
3 changes: 3 additions & 0 deletions packages/web-wallet/src/assets/icons/arrow-receive.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions packages/web-wallet/src/assets/icons/arrow-transfer.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions packages/web-wallet/src/assets/icons/clock.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions packages/web-wallet/src/assets/icons/coins.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions packages/web-wallet/src/assets/icons/shield-divided.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions packages/web-wallet/src/assets/icons/shield.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

1 comment on commit e569ff1

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.