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
Builderwith the four required configuration fields.Declaration
Swift
public init( rpcUrl: String, networkPassphrase: String, accountWasmHash: String, webauthnVerifierAddress: String )Parameters
rpcUrlSoroban RPC endpoint URL.
networkPassphraseStellar network passphrase.
accountWasmHash64-character hex SHA-256 of the smart account contract WASM.
webauthnVerifierAddressWebAuthn verifier contract address (
C…strkey). -
Sets the deployer keypair.
Declaration
Swift
@discardableResult public func deployerKeypair(_ value: KeyPair?) -> BuilderParameters
valueThe deployer keypair (
nilto use the default).Return Value
selffor chaining. -
Sets the session expiry in milliseconds.
Declaration
Swift
@discardableResult public func sessionExpiryMs(_ value: Int64) -> BuilderParameters
valueThe session expiry duration in milliseconds.
Return Value
selffor chaining. -
Sets the signature expiration in ledgers.
Declaration
Swift
@discardableResult public func signatureExpirationLedgers(_ value: Int) -> BuilderParameters
valueThe signature expiration in ledgers.
Return Value
selffor chaining. -
Sets the operation timeout in seconds.
Declaration
Swift
@discardableResult public func timeoutInSeconds(_ value: Int) -> BuilderParameters
valueThe timeout in seconds.
Return Value
selffor chaining. -
Sets the relayer URL.
Declaration
Swift
@discardableResult public func relayerUrl(_ value: String?) -> BuilderParameters
valueThe relayer endpoint URL (
nilto disable).Return Value
selffor chaining. -
Sets the indexer URL.
Declaration
Swift
@discardableResult public func indexerUrl(_ value: String?) -> BuilderParameters
valueThe indexer endpoint URL (
nilto disable).Return Value
selffor chaining. -
Sets the WebAuthn provider.
Declaration
Swift
@discardableResult public func webauthnProvider(_ webauthnProvider: WebAuthnProvider?) -> BuilderParameters
webauthnProviderThe WebAuthn provider (
nilto disable passkey support).Return Value
selffor chaining. -
Sets the storage adapter.
Declaration
Swift
@discardableResult public func storage(_ storage: OZStorageAdapter) -> BuilderParameters
storageThe storage adapter for persisting credentials and sessions.
Return Value
selffor chaining. -
Sets the external wallet adapter.
Declaration
Swift
@discardableResult public func externalWallet(_ externalWallet: OZExternalWalletAdapter?) -> BuilderParameters
externalWalletThe external wallet adapter (
nilto disable external signing).Return Value
selffor 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?) -> BuilderParameters
adapterThe Ed25519 adapter (
nilto disable adapter-based Ed25519 signing).Return Value
selffor chaining. -
Sets the maximum context-rule ID to scan when iterating rules.
Declaration
Swift
@discardableResult public func maxContextRuleScanId(_ value: UInt32) -> BuilderParameters
valueThe maximum scan ID.
Return Value
selffor chaining. -
Builds the
OZSmartAccountConfig.Throws
SmartAccountConfigurationExceptionif validation fails.Declaration
Swift
public func build() throws -> OZSmartAccountConfigReturn Value
A new
OZSmartAccountConfiginstance.
View on GitHub
Install in Dash