-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.tsx
More file actions
33 lines (30 loc) · 988 Bytes
/
Copy pathmain.tsx
File metadata and controls
33 lines (30 loc) · 988 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import { Buffer } from "buffer";
import { StoreProvider } from "./store.js";
import App from "./App.js";
import { testnetGuardError } from "./lib/network.js";
import "./index.css";
// stellar-sdk expects Node's Buffer in the browser.
globalThis.Buffer = globalThis.Buffer ?? Buffer;
const root = createRoot(document.getElementById("root")!);
// Hard guard: testnet-only, mirroring the backend's assertTestnet. Fail visibly before
// mounting the app so a misconfigured PUBLIC passphrase can never sign a transaction.
const guardError = testnetGuardError();
if (guardError) {
root.render(
<div className="mx-auto max-w-xl px-4 py-8">
<div className="rounded-lg border border-danger/40 bg-danger/10 p-4 text-sm">
{guardError}
</div>
</div>,
);
} else {
root.render(
<StrictMode>
<StoreProvider>
<App />
</StoreProvider>
</StrictMode>,
);
}