Builder

public final class Builder : @unchecked Sendable

Builder for creating OZSmartAccountConfig with a fluent API.

Example:

let config = try OZSmartAccountConfig.builder(
    rpcUrl: "https://soroban-testnet.stellar.org",
    networkPassphrase: "Test SDF Network ; September 2015",
    accountWasmHash: "abc123...",
    webauthnVerifierAddress: "CBCD1234..."
)
    .sessionExpiryMs(86_400_000)
    .relayerUrl("https://relayer.example.com")
    .storage(myPersistentStorage)
    .externalWallet(freighterAdapter)
    .build()
  • Initializes a new Builder with the four required configuration fields.

    Declaration

    Swift

    public init(
        rpcUrl: String,
        networkPassphrase: String,
        accountWasmHash: String,
        webauthnVerifierAddress: String
    )

    Parameters

    rpcUrl

    Soroban RPC endpoint URL.

    networkPassphrase

    Stellar network passphrase.

    accountWasmHash

    64-character hex SHA-256 of the smart account contract WASM.

    webauthnVerifierAddress

    WebAuthn verifier contract address (C… strkey).

  • Sets the deployer keypair.

    Declaration

    Swift

    @discardableResult
    public func deployerKeypair(_ value: KeyPair?) -> Builder

    Parameters

    value

    The deployer keypair (nil to use the default).

    Return Value

    self for chaining.

  • Sets the session expiry in milliseconds.

    Declaration

    Swift

    @discardableResult
    public func sessionExpiryMs(_ value: Int64) -> Builder

    Parameters

    value

    The session expiry duration in milliseconds.

    Return Value

    self for chaining.

  • Sets the signature expiration in ledgers.

    Declaration

    Swift

    @discardableResult
    public func signatureExpirationLedgers(_ value: Int) -> Builder

    Parameters

    value

    The signature expiration in ledgers.

    Return Value

    self for chaining.

  • Sets the operation timeout in seconds.

    Declaration

    Swift

    @discardableResult
    public func timeoutInSeconds(_ value: Int) -> Builder

    Parameters

    value

    The timeout in seconds.

    Return Value

    self for chaining.

  • Sets the relayer URL.

    Declaration

    Swift

    @discardableResult
    public func relayerUrl(_ value: String?) -> Builder

    Parameters

    value

    The relayer endpoint URL (nil to disable).

    Return Value

    self for chaining.

  • Sets the indexer URL.

    Declaration

    Swift

    @discardableResult
    public func indexerUrl(_ value: String?) -> Builder

    Parameters

    value

    The indexer endpoint URL (nil to disable).

    Return Value

    self for chaining.

  • Sets the WebAuthn provider.

    Declaration

    Swift

    @discardableResult
    public func webauthnProvider(_ webauthnProvider: WebAuthnProvider?) -> Builder

    Parameters

    webauthnProvider

    The WebAuthn provider (nil to disable passkey support).

    Return Value

    self for chaining.

  • Sets the storage adapter.

    Declaration

    Swift

    @discardableResult
    public func storage(_ storage: OZStorageAdapter) -> Builder

    Parameters

    storage

    The storage adapter for persisting credentials and sessions.

    Return Value

    self for chaining.

  • Sets the external wallet adapter.

    Declaration

    Swift

    @discardableResult
    public func externalWallet(_ externalWallet: OZExternalWalletAdapter?) -> Builder

    Parameters

    externalWallet

    The external wallet adapter (nil to disable external signing).

    Return Value

    self for chaining.

  • Sets the Ed25519 adapter for out-of-process Ed25519 signing.

    When set, the adapter is injected into the kit’s external-signer manager at construction time and consulted before the in-memory Ed25519 keypair registry.

    Declaration

    Swift

    @discardableResult
    public func externalEd25519Adapter(_ adapter: OZExternalEd25519SignerAdapter?) -> Builder

    Parameters

    adapter

    The Ed25519 adapter (nil to disable adapter-based Ed25519 signing).

    Return Value

    self for chaining.

  • Sets the maximum context-rule ID to scan when iterating rules.

    Declaration

    Swift

    @discardableResult
    public func maxContextRuleScanId(_ value: UInt32) -> Builder

    Parameters

    value

    The maximum scan ID.

    Return Value

    self for chaining.

  • Builds the OZSmartAccountConfig.

    Throws

    SmartAccountConfigurationException if validation fails.

    Declaration

    Swift

    public func build() throws -> OZSmartAccountConfig

    Return Value

    A new OZSmartAccountConfig instance.