OZWalletOperations

Operations for creating and connecting smart account wallets.

OZWalletOperations provides high-level wallet lifecycle management:

  • Wallet creation with WebAuthn passkey generation

  • Contract deployment with deterministic address derivation

  • Wallet connection via session restoration or credential lookup

  • Integration with indexer for credential-to-contract discovery

This class requires a WebAuthnProvider to be set on the kit before use. The provider handles platform-specific WebAuthn operations.

Example usage:

val kit = OZSmartAccountKit.create(config)
val walletOps = kit.walletOperations

// Create a new wallet
val wallet = walletOps.createWallet(userName = "Alice", autoSubmit = true)
println("Created wallet: ${wallet.contractId}")

// Connect to existing wallet (returns null if no session and prompt = false)
val connected = walletOps.connectWallet()
if (connected != null) {
println("Connected: ${connected.contractId}")
} else {
println("No active session found")
}

// Connect with WebAuthn prompt fallback if no session
val prompted = walletOps.connectWallet(ConnectWalletOptions(prompt = true))
println("Connected: ${prompted?.contractId}")

Types

Link copied to clipboard
data class ConnectWalletOptions(val credentialId: String? = null, val contractId: String? = null, val fresh: Boolean = false, val prompt: Boolean = false)

Options for connecting to a wallet.

Functions

Link copied to clipboard
suspend fun authenticatePasskey(challenge: ByteArray? = null, credentialIds: List<String>? = null): AuthenticatePasskeyResult

Authenticates with a passkey without connecting to a wallet.

Link copied to clipboard
suspend fun connectWallet(options: OZWalletOperations.ConnectWalletOptions = ConnectWalletOptions()): ConnectWalletResult?

Connects to an existing smart account wallet.

Link copied to clipboard
suspend fun createWallet(userName: String = "Smart Account User", autoSubmit: Boolean = false, autoFund: Boolean = false, nativeTokenContract: String? = null, forceMethod: SubmissionMethod? = null): CreateWalletResult

Creates a new smart account wallet with WebAuthn passkey authentication.

Link copied to clipboard
suspend fun deployPendingCredential(credentialId: String, autoSubmit: Boolean = true, autoFund: Boolean = false, nativeTokenContract: String? = null, forceMethod: SubmissionMethod? = null): DeployPendingResult

Deploys a wallet from a previously created pending credential.