From 5dc4f1939f3b8eb7b3b2d1a9735c1f6497dad734 Mon Sep 17 00:00:00 2001 From: Mateusz Jasiuk Date: Thu, 3 Oct 2024 10:12:35 +0200 Subject: [PATCH] chore: cleanup --- apps/namadillo/src/App/App.tsx | 25 ------------------- .../ShieldedSyncWorker.ts} | 8 +++--- apps/namadillo/src/workers/index.ts | 1 + 3 files changed, 5 insertions(+), 29 deletions(-) rename apps/namadillo/src/{App/worker.ts => workers/ShieldedSyncWorker.ts} (88%) create mode 100644 apps/namadillo/src/workers/index.ts diff --git a/apps/namadillo/src/App/App.tsx b/apps/namadillo/src/App/App.tsx index 4d655a297..f6b68e975 100644 --- a/apps/namadillo/src/App/App.tsx +++ b/apps/namadillo/src/App/App.tsx @@ -1,16 +1,12 @@ import { Toasts } from "App/Common/Toast"; import { AppLayout } from "App/Layout/AppLayout"; -import { maspIndexerUrlAtom, rpcUrlAtom } from "atoms/settings"; import { createBrowserHistory } from "history"; import { useExtensionEvents } from "hooks/useExtensionEvents"; import { useOnNamadaExtensionAttached } from "hooks/useOnNamadaExtensionAttached"; import { useTransactionCallback } from "hooks/useTransactionCallbacks"; import { useTransactionNotifications } from "hooks/useTransactionNotifications"; -import { useAtomValue } from "jotai"; import { Outlet } from "react-router-dom"; import { ChainLoader } from "./Setup/ChainLoader"; -import { ShieldedSyncMessageType } from "./worker"; -import Worker from "./worker?worker"; export const history = createBrowserHistory({ window }); @@ -19,27 +15,6 @@ export function App(): JSX.Element { useOnNamadaExtensionAttached(); useTransactionNotifications(); useTransactionCallback(); - - const worker = new Worker(); - const rpcUrl = useAtomValue(rpcUrlAtom); - const maspIndexerUrl = useAtomValue(maspIndexerUrlAtom); - - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (window as any).shieldedSync = () => { - const msg: ShieldedSyncMessageType = { - type: "shielded-sync-singlecore", - payload: { - rpcUrl, - maspIndexerUrl, - vks: [ - "zvknam1qvgwgy79qqqqpq88yru6n3f3ugfme002t7272a0ke8zdr2kt80jhnjwmgxkwm7yc6ydp8tfh8lmd28n8hrmcvqszjm3tnytryaf4qhwu645xks4nnx64m3fnpm8yr6hrpd8jtsupyzz4knqleuy7jdjz32jcz9ual56vrf3estg0e6kew0g9aqs4vg2d6n569c78ttqw4zw6mvjkhwfprcc804qt3yewsrxf8l67p87ltnqjtjkr35pfnnxavs9c5wqpr2t2lf3husqn4zvux", - ], - }, - }; - - worker.postMessage(msg); - }; - return ( <> diff --git a/apps/namadillo/src/App/worker.ts b/apps/namadillo/src/workers/ShieldedSyncWorker.ts similarity index 88% rename from apps/namadillo/src/App/worker.ts rename to apps/namadillo/src/workers/ShieldedSyncWorker.ts index 54e72ef88..0eb55f7c6 100644 --- a/apps/namadillo/src/App/worker.ts +++ b/apps/namadillo/src/workers/ShieldedSyncWorker.ts @@ -5,7 +5,7 @@ import { getSdk } from "@heliax/namada-sdk/web"; export type ShiededSyncPayload = { vks: string[]; rpcUrl: string; - maspIndexerUrl: string; + maspIndexerUrl?: string; }; export type ShieldedSyncMulticore = { @@ -56,10 +56,10 @@ async function shieldedSync( const sdk = getSdk( cryptoMemory, rpcUrl, - maspIndexerUrl, + maspIndexerUrl || "", "", - // TODO: not really used, but required by the SDK, as long as it's valid address it's fine - "tnam1q9k4a0a7cgprwdj8epn28kmv9s5ntu098c3ua875" + // Not really used, but required by the SDK, as long as it's valid address it's fine + "tnam1qxfj3sf6a0meahdu9t6znp05g8zx4dkjtgyn9gfu" ); await sdk.rpc.shieldedSync(payload.vks); } diff --git a/apps/namadillo/src/workers/index.ts b/apps/namadillo/src/workers/index.ts new file mode 100644 index 000000000..f82f0ac07 --- /dev/null +++ b/apps/namadillo/src/workers/index.ts @@ -0,0 +1 @@ +export * from "./ShieldedSyncWorker";