# Sign a transaction intent

This is the **advanced, backend-orchestrated** way to send a transaction. Your server creates a [transaction intent](/docs/products/embedded-wallet/javascript/smart-wallet/send) with the Openfort API, returns its `id` and the hash that needs signing, and the client signs that hash and submits it. Openfort then broadcasts the transaction.

:::tip
Most apps don't need this. To send a transaction directly from the client, use the [Ethereum provider's `eth_sendTransaction`](/docs/products/embedded-wallet/swift/wallet/send) — it's a single call with no server round-trip. Reach for transaction intents when your backend owns transaction creation, policy selection, or signing orchestration.
:::

## How it works

1. Your **backend** creates a transaction intent via the Openfort API and gets back a `transactionIntentId` and a `signableHash` (the user-operation hash).
2. Your **client** signs that hash with the embedded wallet.
3. You call `sendSignatureTransactionIntentRequest` with the intent id and signature to submit it.

## Usage

```swift
do {
    let params = OFSendSignatureTransactionIntentRequestParams(
        transactionIntentId: transactionIntentId, // from your backend
        signableHash: userOperationHash,           // the hash to sign
        signature: signature,                      // signed with the embedded wallet
        optimistic: false
    )
    let result = try await OFSDK.shared.sendSignatureTransactionIntentRequest(params: params)
    print("Transaction intent: \(result?.id ?? "?")")
} catch {
    print("Failed to submit transaction intent: \(error.localizedDescription)")
}
```

:::note
Set `optimistic: true` to get a result back before the transaction is mined — useful for snappy UI, but the transaction can still fail on-chain afterward. Leave it `false` (or `nil`) to wait for confirmation.
:::

## Parameters

```swift
public struct OFSendSignatureTransactionIntentRequestParams: OFCodableSendable {
    public let transactionIntentId: String
    public let signableHash: String?
    public let signature: String?
    public let optimistic: Bool?
}
```

## Returns

Returns an optional `OFTransactionIntentResponse`:

```swift
public struct OFTransactionIntentResponse: OFCodableSendable, OFTransactionIntentResponseProtocol {
    public let id: String
    public let object: String           // "transactionIntent"
    public let createdAt: Int
    public let updatedAt: Int
    public let abstractionType: OFTransactionAbstractionType
    public let details: OFTransactionDetails?
    public let chainId: Int
    public let response: OFResponseResponse?
    public let interactions: [OFInteraction]?
    public let nextAction: OFNextActionResponse?
    public let policy: OFPolicyOrEntity?
    public let player: OFPlayerOrEntity?
    public let account: OFAccountOrEntity?
}
```

:::note
`OFPolicyOrEntity`, `OFPlayerOrEntity`, and `OFAccountOrEntity` are polymorphic enums that decode as either the full object or a simple `OFEntityIdResponse` (just an `id` field), depending on the API response.
:::

## Next steps

* [Send a transaction](/docs/products/embedded-wallet/swift/wallet/send) — the recommended client-side flow.
* [Sponsored (gasless) transactions](/docs/products/embedded-wallet/swift/wallet/eip-7702)
