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
contractIdThe smart account contract address (
C…strkey).credentialIdThe 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
contractIdThe 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
credentialThe 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
credentialIdThe 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
contractIdThe smart account contract address.
credentialIdThe 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
contractIdThe smart account contract address.
credentialIdThe credential ID used for signing (
nilif 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
hashThe transaction hash.
successtrueif submitted successfully,falseif 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
credentialIdBase64URL-encoded credential identifier being synced.
errorThe underlying RPC error that prevented the on-chain check.
-
Stable type tag used for type-keyed listener registration and lookup.
The tag is the un-namespaced arm name (
"WalletConnected","WalletDisconnected", etc.) and matches the strings consumed byremoveAllListeners(eventType:)andlistenerCount(eventType:).Declaration
Swift
public var eventTypeTag: String { get }
-
Two events are equal when they are the same arm with identical associated values. For the
credentialSyncFailed(credentialId:error:)arm theerrorcomparison is best-effort: thelocalizedDescriptionstrings are compared becauseErrordoes not conform toEquatable.Declaration
Swift
public static func == (lhs: OZSmartAccountEvent, rhs: OZSmartAccountEvent) -> Bool
-
Hash value computed over each arm’s associated values. For the
credentialSyncFailed(credentialId:error:)arm the error’slocalizedDescriptionis hashed becauseErrordoes not conform toHashable.Declaration
Swift
public func hash(into hasher: inout Hasher)
View on GitHub
Install in Dash