> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getpara.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Stellar Integration

> Create Stellar wallets and sign Stellar transactions with the Para Swift SDK

Use `WalletType.stellar` to create or load a Stellar wallet, then pass a `StellarTransaction` value to `signTransaction`.

## Quick start

```swift StellarSigning.swift theme={null}
import ParaSwift

let paraManager = ParaManager(apiKey: "your-api-key")

enum StellarWalletError: Error {
    case notFound
}

func getOrCreateStellarWallet(_ paraManager: ParaManager) async throws -> Wallet {
    var wallets = try await paraManager.fetchWallets()
    if let wallet = wallets.first(where: { $0.type == .stellar }) {
        return wallet
    }

    try await paraManager.createWallet(type: .stellar, skipDistributable: false)
    wallets = try await paraManager.fetchWallets()

    guard let wallet = wallets.first(where: { $0.type == .stellar }) else {
        throw StellarWalletError.notFound
    }
    return wallet
}

let wallet = try await getOrCreateStellarWallet(paraManager)

let transaction = StellarTransaction(
    to: "GRECIPIENT_STELLAR_ADDRESS",
    amount: "10",
    memo: .text("hello"),
    networkPassphrase: StellarNetwork.testnetPassphrase
)

let result = try await paraManager.signTransaction(
    walletId: wallet.id,
    transaction: transaction
)

print("Signed transaction: \(result.signedTransaction)")
```

## Display the address

A Stellar wallet uses the same `Wallet` model as the other wallet types. Use `wallet.stellarAddress` to derive the Stellar G-address from the wallet public key when needed.

```swift StellarAddress.swift theme={null}
let address = wallet.stellarAddress ?? wallet.address
print("Stellar address: \(address ?? "No address")")
```

You can also call the address helpers directly:

```swift StellarAddressHelpers.swift theme={null}
let address = try StellarAddress.fromPublicKey(publicKeyHex)
let addressFromSolana = try StellarAddress.fromSolanaAddress(solanaAddress)
```

## Sign a payment

`StellarTransaction` supports native XLM payments and issued assets. The `networkPassphrase` must match the network the transaction will be submitted to.

```swift StellarPayment.swift theme={null}
let xlmPayment = StellarTransaction(
    to: "GRECIPIENT_STELLAR_ADDRESS",
    amount: "10",
    networkPassphrase: StellarNetwork.testnetPassphrase,
    fee: "100",
    timeout: 60
)

let signed = try await paraManager.signTransaction(
    walletId: wallet.id,
    transaction: xlmPayment
)
```

For issued assets, include the asset code and issuer:

```swift StellarAssetPayment.swift theme={null}
let usdcPayment = StellarTransaction(
    to: "GRECIPIENT_STELLAR_ADDRESS",
    amount: "5",
    asset: StellarAsset(
        code: "USDC",
        issuer: "GISSUER_STELLAR_ADDRESS"
    ),
    networkPassphrase: StellarNetwork.publicPassphrase
)
```

## Sign serialized XDR

If your backend or Stellar SDK code already builds the transaction, pass the serialized XDR directly.

```swift StellarXDR.swift theme={null}
let transaction = StellarTransaction(
    serializedXDR: "AAAAAgAAA...",
    networkPassphrase: StellarNetwork.publicPassphrase
)

let result = try await paraManager.signTransaction(
    walletId: wallet.id,
    transaction: transaction
)
```

## Network passphrases

| Network                | Constant                           |
| ---------------------- | ---------------------------------- |
| Stellar Testnet        | `StellarNetwork.testnetPassphrase` |
| Stellar Public Network | `StellarNetwork.publicPassphrase`  |
