Skip to main content

signTransaction

Signs a Stellar transaction XDR using the connected wallet. The wallet provider handles the actual signing via its native API (e.g. Freighter, Lobstr, OneKey).

Usage

Building a Transaction XDR

Use the @stellar/stellar-sdk to build a transaction before signing:

Parameters

Returns

Promise<{ signedXdr: string }> - A promise that resolves to an object containing the signed transaction XDR.

Errors

Confirming a transaction

After you submit a signed transaction to Horizon, confirmTransaction polls until the transaction is included in a ledger. It works for both external Stellar wallets and Stellar embedded wallets.
confirmTransaction throws StellarTransactionFailedError when the transaction is included but fails to apply, and StellarTransactionConfirmationTimeoutError when the transaction is not found within the polling window (up to 300 attempts at 3-second intervals).

React

Last modified on November 27, 2026