Skip to content

Commit 8e15d99

Browse files
fix: use actual freighter API methods
1 parent 212a0a7 commit 8e15d99

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

frontend/src/lib/wallet/freighter.ts

Lines changed: 7 additions & 7 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 response = await FreighterApi.isAllowed();
10-
return response.isAllowed === true;
9+
const connected = await FreighterApi.isConnected();
10+
return connected === true;
1111
} catch {
1212
return false;
1313
}
@@ -17,10 +17,10 @@ export async function connectFreighter(): Promise<FreighterConnection | null> {
1717
try {
1818
const installed = await isFreighterInstalled();
1919
if (!installed) {
20-
throw new Error("Freighter wallet is not installed or not allowed");
20+
throw new Error("Freighter wallet is not installed or not connected");
2121
}
2222

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

0 commit comments

Comments
 (0)