Skip to content

Soneso/stellar-ios-mac-sdk

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.6.0"),

CocoaPods

pod 'stellar-ios-mac-sdk', '~> 3.6.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

The SDK supports OpenZeppelin smart accounts on Stellar — passkey/WebAuthn authentication, multi-signer authorization, context rules, and policies. See the Smart Accounts documentation and the demo app.

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.