For the complete documentation index, see llms.txt. This page is also available as Markdown.

Signing

Sign transactions, authorization entries, and arbitrary messages using the user's Freighter wallet.

Signing a Transaction

signTransaction()

Pass a transaction XDR string to Freighter for the user to review and sign.

signTransaction(xdr: string, opts?: {
  network?: string,
  networkPassphrase?: string,
  address?: string
}) -> Promise<{ signedTxXdr: string; signerAddress: string } & { error?: FreighterApiError }>

The user will review the transaction details before signing.

Parameters

Parameter
Type
Description

xdr

string

Required. Base64-encoded transaction XDR.

opts.network

string

Network name (maps to Networks enum in @stellar/stellar-sdk).

opts.networkPassphrase

string

Custom passphrase. Ignored if network is also provided.

opts.address

string

Request a specific account's signature. Freighter will switch to that account if available.

Passing network or networkPassphrase lets Freighter warn the user if their wallet is configured to the wrong network.

Example

Errors

Condition
Error message

User rejected

"The user rejected this request."

Extension not installed

"The wallet encountered an internal error"

Signing an Auth Entry

signAuthEntry()

Sign an authorization entry preimage and receive the signed hash back as a base64 string. Used for Soroban contract authorization flows.

See the authorizeEntry helper in js-stellar-base for how signed auth entries are used, or the Soroban development documentation for wallet-side patterns.

Example

Errors

Condition
Error message

User rejected

"The user rejected this request."

Signing a Message

signMessage()

Sign an arbitrary string and receive a base64-encoded Ed25519 signature. Follows SEP-53.

Example

Errors

Condition
Error message

User rejected

"The user rejected this request."

Full Example: Connect, Sign, and Submit

A complete flow from connection to Horizon submission:

Last updated

Was this helpful?