Skip to content

Commit acfb2ab

Browse files
fix: handle freighter response objects correctly
1 parent 8e15d99 commit acfb2ab

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

frontend/src/lib/wallet/freighter.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ export type FreighterConnection = {
66

77
export async function isFreighterInstalled(): Promise<boolean> {
88
try {
9-
const connected = await FreighterApi.isConnected();
10-
return connected === true;
9+
const response = await FreighterApi.isConnected();
10+
return response.isConnected === true;
1111
} catch {
1212
return false;
1313
}
@@ -20,12 +20,12 @@ export async function connectFreighter(): Promise<FreighterConnection | null> {
2020
throw new Error("Freighter wallet is not installed or not connected");
2121
}
2222

23-
const publicKey = await FreighterApi.getAddress();
24-
if (!publicKey) {
23+
const response = await FreighterApi.getAddress();
24+
if (!response.address) {
2525
throw new Error("Failed to retrieve public key from Freighter");
2626
}
2727

28-
return { publicKey };
28+
return { publicKey: response.address };
2929
} catch (error) {
3030
console.error("Freighter connection error:", error);
3131
return null;
@@ -41,13 +41,13 @@ export async function signTransaction(
4141
transactionXdr: string
4242
): Promise<string | null> {
4343
try {
44-
const signedTxXdr = await FreighterApi.signTransaction(transactionXdr, {
44+
const response = await FreighterApi.signTransaction(transactionXdr, {
4545
networkPassphrase: "Test SDF Network ; September 2015",
4646
});
47-
if (!signedTxXdr) {
47+
if (!response.signedTxXdr) {
4848
throw new Error("Failed to sign transaction");
4949
}
50-
return signedTxXdr;
50+
return response.signedTxXdr;
5151
} catch (error) {
5252
console.error("Transaction signing error:", error);
5353
return null;

0 commit comments

Comments
 (0)