Stellar SDK for iOS & macOS

GitHub release Tests codecov Ask DeepWiki

Build and sign Stellar transactions, query Horizon, and interact with Soroban smart contracts via RPC. Communicate with anchors and external services using built-in support for 17 SEPs.

Installation

Swift Package Manager

.package(name: "stellarsdk", url: "git@github.com:Soneso/stellar-ios-mac-sdk.git", from: "3.5.0"),

CocoaPods

pod 'stellar-ios-mac-sdk', '~> 3.5.0'

Requires iOS 13+, macOS 10.15+, Swift 5.7+.

Quick examples

Send a payment

Transfer XLM between accounts:

let paymentOp = PaymentOperation(sourceAccountId: nil,
                                 destinationAccountId: receiverId,
                                 asset: Asset(type: AssetType.ASSET_TYPE_NATIVE)!,
                                 amount: 100)
let transaction = try Transaction(sourceAccount: senderAccount,
                                  operations: [paymentOp],
                                  memo: Memo.none)
try transaction.sign(keyPair: senderKeyPair, network: .testnet)
let response = await sdk.transactions.submitTransaction(transaction: transaction)

Trust an asset

Enable your account to receive a token (like USDC):

let usdc = ChangeTrustAsset(canonicalForm: "USDC:GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5")!
let trustOp = ChangeTrustOperation(sourceAccountId: nil,
                                   asset: usdc,
                                   limit: nil)
let transaction = try Transaction(sourceAccount: account,
                                  operations: [trustOp],
                                  memo: Memo.none)
try transaction.sign(keyPair: accountKeyPair, network: .testnet)
let response = await sdk.transactions.submitTransaction(transaction: transaction)

Call a smart contract

Invoke a Soroban contract method:

let client = try await SorobanClient.forClientOptions(
    options: ClientOptions(
        sourceAccountKeyPair: keyPair,
        contractId: "CABC...",
        network: .testnet,
        rpcUrl: "https://soroban-testnet.stellar.org",
        enableServerLogging: false
    )
)
let result = try await client.invokeMethod(name: "hello", args: [SCValXDR.symbol("World")])

For complete walkthroughs, see the documentation.

Agent Skill

This repository includes an Agent Skill that teaches AI coding agents how to use this SDK. See skills/ for installation instructions.

Documentation

Guide Description
Quick start Your first transaction in 15 minutes
Getting started Keys, accounts, and fundamentals
SDK usage Transactions, operations, Horizon queries, streaming
Soroban Smart contract deployment and interaction
Smart Accounts OpenZeppelin smart account support: passkeys, multi-signer authorization, context rules, policies
SEPs Anchor integration, authentication, KYC, etc.

API reference

Smart Accounts (Passkey) support

This SDK ships first-class support for OpenZeppelin smart accounts on Stellar: WebAuthn passkey authentication via Apple’s AuthenticationServices, multi-signer authorization, on-chain context rules, and policy contracts (threshold, weighted threshold, spending limit). An optional fee-bump relayer and credential indexer integrate transparently.

See the Smart Accounts documentation for an overview, the developer onboarding guide for conceptual material, the API reference for every public symbol, and the per-platform WebAuthn setup guides: iOS, macOS.

Compatibility

Sample

This SDK is used by the open source LOBSTR Vault (source) and the LOBSTR Wallet.

Feedback

If you’re using this SDK, feedback helps improve it:

Contributing

See CONTRIBUTING.md for guidelines.

License

Apache 2.0. See LICENSE.