Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions babel.test.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
presets: [
["@babel/preset-env", { targets: { node: "current" } }],
["@babel/preset-react", { runtime: "automatic" }],
"@babel/preset-typescript",
],
};
22 changes: 22 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/** @type {import('jest').Config} */
const config = {
testEnvironment: "jsdom",
setupFilesAfterEnv: ["@testing-library/jest-dom"],
transform: {
"^.+\\.(ts|tsx|js|jsx)$": [
"babel-jest",
{ configFile: "./babel.test.config.js" },
],
},
moduleNameMapper: {
"^@/(.*)$": "<rootDir>/src/$1",
},
testMatch: [
"**/__tests__/**/*.(test|spec).(ts|tsx|js|jsx)",
"**/*.(test|spec).(ts|tsx|js|jsx)",
],
testPathIgnorePatterns: ["/node_modules/", "/.next/"],
transformIgnorePatterns: ["/node_modules/(?!(@stellar/freighter-api)/)"],
};

module.exports = config;
11,825 changes: 7,854 additions & 3,971 deletions package-lock.json

Large diffs are not rendered by default.

14 changes: 13 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
"start": "next start",
"lint": "eslint",
"test": "node scripts/test-lang-cache.js",
"analyze": "cross-env ANALYZE=true npm run build"
"analyze": "cross-env ANALYZE=true npm run build",
"test:wallet": "jest src/hooks/__tests__/useWallet.test.tsx --no-coverage",
"test:jest": "jest --no-coverage"
},
"dependencies": {
"@stellar/freighter-api": "^6.0.1",
Expand All @@ -37,15 +39,25 @@
"ws": "^8.20.0"
},
"devDependencies": {
"@babel/core": "^7.29.7",
"@babel/preset-env": "^7.29.7",
"@babel/preset-react": "^7.29.7",
"@babel/preset-typescript": "^7.29.7",
"@next/bundle-analyzer": "^15.0.0",
"@tailwindcss/postcss": "^4",
"@testing-library/jest-dom": "^6.9.1",
"@testing-library/react": "^16.3.2",
"@testing-library/user-event": "^14.6.1",
"@types/node": "^20",
"@types/react": "^19",
"@types/react-dom": "^19",
"babel-jest": "^29.7.0",
"babel-plugin-react-compiler": "1.0.0",
"cross-env": "^7.0.3",
"eslint": "^9",
"eslint-config-next": "16.1.6",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"tailwindcss": "^4",
"typescript": "^5",
"webpack-bundle-analyzer": "^4.9.0"
Expand Down
20 changes: 20 additions & 0 deletions src/app/components/providers/FreighterWalletBoundary.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
"use client";

/**
* FreighterWalletBoundary.tsx
*
* Thin client boundary that provides `<FreighterWalletProvider>` to the
* component tree. Wrapping here (rather than in the Server Component layout)
* satisfies Next.js App Router's requirement that Context providers be Client
* Components while keeping layout.tsx a Server Component.
*/

import { FreighterWalletProvider } from "@/context/FreighterWalletContext";

export function FreighterWalletBoundary({
children,
}: {
children: React.ReactNode;
}) {
return <FreighterWalletProvider>{children}</FreighterWalletProvider>;
}
5 changes: 4 additions & 1 deletion src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { ProgressBarProvider } from "./components/TopLoadingBar";
import { UserProvider } from "./components/providers/UserProvider";
import { QueryProvider } from "./components/providers/QueryProvider";
import { ToastProvider } from "@/components/ui/ToastQueue";
import { FreighterWalletBoundary } from "./components/providers/FreighterWalletBoundary";
import Script from "next/script";
import SvgSprite from "@/components/icons/SvgSprite";

Expand Down Expand Up @@ -91,7 +92,9 @@ export default function RootLayout({
<QueryProvider>
<ProgressBarProvider>
<ToastProvider>
{children}
<FreighterWalletBoundary>
{children}
</FreighterWalletBoundary>
</ToastProvider>
</ProgressBarProvider>
</QueryProvider>
Expand Down
Loading