OZSmartAccountEvent

public enum OZSmartAccountEvent : Sendable, Equatable, Hashable

Events emitted by the Smart Account Kit during wallet lifecycle operations.

Example:

kit.events.addListener { event in
    switch event {
    case .walletConnected(let contractId, _):
        print("Connected to \(contractId)")
    case .transactionSubmitted(let hash, _):
        print("Transaction \(hash) submitted")
    default:
        break
    }
}
  • Emitted when a wallet is connected.

    This event is fired when connecting to an existing wallet, either through automatic session restoration or an explicit wallet connection call.

    Declaration

    Swift

    case walletConnected(contractId: String, credentialId: String)

    Parameters

    contractId

    The smart account contract address (C… strkey).

    credentialId

    The Base64URL-encoded credential ID.

  • Emitted when a wallet is disconnected.

    This event is fired when disconnect() is called. The session is cleared, but stored credentials remain for future reconnection.

    Declaration

    Swift

    case walletDisconnected(contractId: String)

    Parameters

    contractId

    The smart account contract address that was disconnected.

  • Emitted when a new credential is created (passkey registered).

    This event is fired after successful WebAuthn credential creation, whether during initial wallet setup or when adding a new signer to an existing wallet. Note that the wallet may not be deployed yet.

    Declaration

    Swift

    case credentialCreated(credential: OZStoredCredential)

    Parameters

    credential

    The stored credential data.

  • Emitted when a credential is deleted from storage.

    This event is fired when a credential is removed via the credential management API. If the credential was connected, the wallet is automatically disconnected first.

    Declaration

    Swift

    case credentialDeleted(credentialId: String)

    Parameters

    credentialId

    The Base64URL-encoded credential ID.

  • Emitted when a session expires during a connection attempt.

    This event is fired when attempting to restore a session that has expired. The application should prompt the user to reconnect.

    Declaration

    Swift

    case sessionExpired(contractId: String, credentialId: String)

    Parameters

    contractId

    The smart account contract address.

    credentialId

    The Base64URL-encoded credential ID.

  • Emitted when a transaction is signed.

    This event is fired after successfully collecting all required signatures for a transaction, before submission to the network.

    Declaration

    Swift

    case transactionSigned(contractId: String, credentialId: String?)

    Parameters

    contractId

    The smart account contract address.

    credentialId

    The credential ID used for signing (nil if only external signers contributed).

  • Emitted when a transaction is submitted to the network.

    This event is fired after sending the signed transaction to Soroban RPC or the relayer service. The success flag indicates whether the transaction was successfully sent to the network node, not whether it was included in a ledger.

    Declaration

    Swift

    case transactionSubmitted(hash: String, success: Bool)

    Parameters

    hash

    The transaction hash.

    success

    true if submitted successfully, false if submission failed.

  • Emitted when sync(credentialId:) cannot reach the RPC endpoint and the credential could not be reconciled with on-chain state.

    The credential is retained in local storage so a subsequent sync attempt can retry the on-chain check. The payload identifies which credential was being synced and the underlying error that prevented the check.

    Declaration

    Swift

    case credentialSyncFailed(credentialId: String, error: Error)

    Parameters

    credentialId

    Base64URL-encoded credential identifier being synced.

    error

    The underlying RPC error that prevented the on-chain check.

Type tag

Equatable

  • Two events are equal when they are the same arm with identical associated values. For the credentialSyncFailed(credentialId:error:) arm the error comparison is best-effort: the localizedDescription strings are compared because Error does not conform to Equatable.

    Declaration

    Swift

    public static func == (lhs: OZSmartAccountEvent, rhs: OZSmartAccountEvent) -> Bool

Hashable