Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.polygon.technology/llms.txt

Use this file to discover all available pages before exploring further.

The Swift SDK supports iOS 15+ and macOS 12+. OMSClient is the entry point for wallet auth, signing, signature verification, ID tokens, transaction helpers, and balance queries.

Install

Add the package in Xcode with File -> Add Package Dependencies, or add the exact package version to Package.swift.
dependencies: [
    .package(url: "https://github.com/0xsequence/swift-sdk.git", exact: "0.1.0-alpha.1")
]
Then add the library product to your target.
.target(
    name: "YourApp",
    dependencies: [
        .product(name: "OMS SDK", package: "swift-sdk")
    ]
)
For CocoaPods, add the pod to your Podfile.
pod 'oms-client-swift-sdk', '0.1.0-alpha.1'
Import the SDK in the files that use it.
import OMS_SDK

Create The Client

Create one OMSClient when your app starts and keep it alive for the current app session.
let oms = OMSClient(
    projectAccessKey: "YOUR_PROJECT_ACCESS_KEY",
    projectId: "YOUR_PROJECT_ID"
)
The client exposes:
PropertyUse
oms.walletAuthentication, session state, wallet selection, signing, signature verification, ID tokens, and transactions.
oms.indexerToken balance reads.
oms.supportedNetworksNetworks supported by this SDK build.

Authenticate With Email

Email auth is a two-step OTP flow.
try await oms.wallet.startEmailAuth(email: "user@example.com")

// Show your OTP input, then complete auth with the user-entered code.
let result = try await oms.wallet.completeEmailAuth(code: "123456")

if case let .walletSelected(walletAddress, _, _, _) = result {
    print("Wallet address:", walletAddress)
}
completeEmailAuth verifies the OTP, loads an existing wallet for the user, or creates one when needed. Wallet metadata and session state are persisted in the device keychain.

Send A Transaction

After authentication, send a native token transaction with oms.wallet.sendTransaction. Values are raw base-unit integer strings. On testnets, fee options are automatically sponsored, so Polygon Amoy is a good first network for testing.
let tx = try await oms.wallet.sendTransaction(
    network: .polygonAmoy,
    to: "0xRecipient",
    value: "0"
)

print("Transaction:", tx.txnHash ?? tx.txnId)