ConnectWalletOptions

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.

These options control how wallet connection is performed, allowing for different connection flows based on your application's needs.

Decision Matrix

OptionsBehavior
(default)Session restore, return null if no session
credentialId and/or contractIdDirect connect, skip session check
fresh = trueSkip session, always WebAuthn
prompt = trueSession restore, WebAuthn if no session
fresh = true, prompt = truefresh takes priority, always WebAuthn

Option Patterns

Silent Session Check (default)

// Returns saved session if valid, null if no session
val result = connectWallet()
if (result == null) {
// Show login UI
}

Session Check with WebAuthn Fallback

// Uses saved session if valid, prompts WebAuthn if no session
connectWallet(ConnectWalletOptions(prompt = true))

Direct Connection with Known Credentials

// Connect to specific contract using known credential ID
connectWallet(ConnectWalletOptions(
credentialId = "abc123...",
contractId = "CABC..."
))

Force Fresh Authentication

// Require WebAuthn authentication even if session exists
connectWallet(ConnectWalletOptions(fresh = true))

Credential-Only Connection

// Provide credential ID, look up contract from storage/indexer
connectWallet(ConnectWalletOptions(credentialId = "abc123..."))

Constructors

Link copied to clipboard
constructor(credentialId: String? = null, contractId: String? = null, fresh: Boolean = false, prompt: Boolean = false)

Properties

Link copied to clipboard

Connect directly to this contract address (C-address). Must be used with credentialId. Cannot be used alone. Useful when you already know both the credential and contract.

Link copied to clipboard

Connect directly using this credential ID (Base64URL-encoded). When provided alone, contract address is looked up from storage, indexer, or derived from deployer. Skips WebAuthn authentication.

Link copied to clipboard

Force fresh WebAuthn authentication, skipping session restore. Use this to require re-authentication even if a valid session exists. Useful for sensitive operations or after session timeout warnings.

Link copied to clipboard

When true, triggers WebAuthn authentication if no valid session exists. When false (default), returns null if no session is found. Has no effect when fresh is true (WebAuthn is always triggered). Has no effect when credentialId is provided (direct connect path).