From b4d426085e175ae7957b3a40741521aace026991 Mon Sep 17 00:00:00 2001 From: Mateusz Jasiuk Date: Mon, 18 Aug 2025 11:51:48 +0200 Subject: [PATCH] fix: dompurify-imprts --- apps/namadillo/src/utils/sdk.ts | 5 +---- apps/namadillo/src/workers/MaspTxWorker.ts | 2 +- apps/namadillo/tsconfig.json | 2 +- packages/hooks/src/useSanitizedLocation.ts | 8 ++++---- packages/hooks/src/useSanitizedParams.ts | 4 ++-- 5 files changed, 9 insertions(+), 12 deletions(-) diff --git a/apps/namadillo/src/utils/sdk.ts b/apps/namadillo/src/utils/sdk.ts index d793e14dcf..f115fa237f 100644 --- a/apps/namadillo/src/utils/sdk.ts +++ b/apps/namadillo/src/utils/sdk.ts @@ -1,11 +1,8 @@ import { Sdk } from "@namada/sdk-multicore"; -// TODO: The following should work! moduleResolution: "node" prevents this from working. -// import { initSdk } from "@namada/sdk-multicore/inline"; -// TODO: Remove the following work-around once the above is fixed! +import { initSdk } from "@namada/sdk-multicore/inline"; import { nativeTokenAddressAtom } from "atoms/chain"; import { maspIndexerUrlAtom, rpcUrlAtom } from "atoms/settings"; import { getDefaultStore } from "jotai"; -import { initSdk } from "../../../../node_modules/@namada/sdk-multicore/dist/sdk-multicore/src/initInline"; const initializeSdk = async (): Promise => { const store = getDefaultStore(); diff --git a/apps/namadillo/src/workers/MaspTxWorker.ts b/apps/namadillo/src/workers/MaspTxWorker.ts index 8bd4b33f6a..9dda0adb73 100644 --- a/apps/namadillo/src/workers/MaspTxWorker.ts +++ b/apps/namadillo/src/workers/MaspTxWorker.ts @@ -1,4 +1,5 @@ import { Sdk } from "@namada/sdk-multicore"; +import { initSdk } from "@namada/sdk-multicore/inline"; import { IbcTransferMsgValue, ShieldedTransferMsgValue, @@ -10,7 +11,6 @@ import BigNumber from "bignumber.js"; import * as Comlink from "comlink"; import { buildTx, EncodedTxData } from "lib/query"; import { namadaAsset, toDisplayAmount } from "utils"; -import { initSdk } from "../../../../node_modules/@namada/sdk-multicore/dist/sdk-multicore/src/initInline"; import { Broadcast, BroadcastDone, diff --git a/apps/namadillo/tsconfig.json b/apps/namadillo/tsconfig.json index c602a34a56..4b05f23ff9 100644 --- a/apps/namadillo/tsconfig.json +++ b/apps/namadillo/tsconfig.json @@ -11,7 +11,7 @@ "jsx": "react-jsx", "lib": ["dom", "dom.iterable", "esnext"], "module": "esnext", - "moduleResolution": "node", + "moduleResolution": "bundler", "noEmit": false, "noFallthroughCasesInSwitch": true, "resolveJsonModule": true, diff --git a/packages/hooks/src/useSanitizedLocation.ts b/packages/hooks/src/useSanitizedLocation.ts index 4f29e055e3..7b909ad372 100644 --- a/packages/hooks/src/useSanitizedLocation.ts +++ b/packages/hooks/src/useSanitizedLocation.ts @@ -1,12 +1,12 @@ -import { sanitize } from "isomorphic-dompurify"; +import dompurify from "isomorphic-dompurify"; import { Location, useLocation } from "react-router-dom"; export const useSanitizedLocation = (): Location => { const location = useLocation(); return { ...location, - pathname: sanitize(location.pathname), - search: sanitize(location.search), - hash: sanitize(location.hash), + pathname: dompurify.sanitize(location.pathname), + search: dompurify.sanitize(location.search), + hash: dompurify.sanitize(location.hash), }; }; diff --git a/packages/hooks/src/useSanitizedParams.ts b/packages/hooks/src/useSanitizedParams.ts index 0032f29609..67f29fcd45 100644 --- a/packages/hooks/src/useSanitizedParams.ts +++ b/packages/hooks/src/useSanitizedParams.ts @@ -1,4 +1,4 @@ -import { sanitize } from "isomorphic-dompurify"; +import dompurify from "isomorphic-dompurify"; import { Params, useParams } from "react-router-dom"; type ParamsT = Readonly< @@ -12,7 +12,7 @@ export function useSanitizedParams< return Object.entries(params).reduce( (acc, [key, value]) => ({ ...acc, - [key]: typeof value === "string" ? sanitize(value) : value, + [key]: typeof value === "string" ? dompurify.sanitize(value) : value, }), {} as ParamsT );