Builder

class Builder(context: Context)

Builder for MidnightSdk.

Required: network, seed. Optional: accountIndex (default 0), provingMode (default LOCAL), proofServerUrl (default null → network's local-dev proof server).

Constructors

Link copied to clipboard
constructor(context: Context)

Functions

Link copied to clipboard
fun accountIndex(index: Int): <Error class: unknown class>

Set the HD wallet account index (default 0).

Link copied to clipboard

Build the SDK. This is a blocking operation on first launch:

Link copied to clipboard
fun dustCloudBackupFactory(factory: (address: String, dustSeed: ByteArray) -> DustCloudBackup): <Error class: unknown class>

Optional cross-device dust backup. The factory is invoked once during build with the derived address + dust seed (so the coordinator can derive its encryption key); the resulting DustCloudBackup is wired into both the dust-sync cold-start (restore) and the wallet (upload). Omit it (the default) and dust backup is simply absent.

Link copied to clipboard
fun network(network: MidnightNetwork): <Error class: unknown class>

Set the Midnight network (PREPROD, PREVIEW, UNDEPLOYED).

Link copied to clipboard
fun proofServerUrl(url: String?): <Error class: unknown class>

Override the proof-server URL used when provingMode is REMOTE. Null (default) means "use the network's default proof-server URL" (NetworkConfig.forNetwork(network).proofServerUrl, which points at a local proof server on localhost:6300 for every network the SDK supports). Pass an explicit URL to point at a hosted prover.

Link copied to clipboard
fun provingMode(mode: <Error class: unknown class>): <Error class: unknown class>

Pick how transactions are proved. Defaults to ProvingMode.LOCAL — on-device proving with cached keys, no network round-trip per tx.

Link copied to clipboard
fun seed(seed: ByteArray): <Error class: unknown class>

Set the HD wallet seed (from BIP-39 mnemonic). Copied internally — caller should wipe.