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
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.
Example
Errors
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
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
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?
