signWithHw

suspend fun signWithHw(preImageTx: PreImageTx, groupId: String): Result<String>

Sign a transaction using threshold MPC with a hardware device via Bluetooth.

This method requires an active transport connection via MpcService. It orchestrates the full presign+sign flow with the hardware device in real-time.

Flow:

  1. Get the active transport from MpcService

  2. Delegate to the chain-specific signWithHw implementation (which loads DKG, does presign+sign via transport, compiles signed tx)

Usage from Flutter:

// Connect to HW device first
await sdk.mpc.scanForDevices();
await sdk.mpc.performDkg(groupId);

// Build and sign transaction
final preImageTx = await sdk.blockchainService.preImageHash(tx, from, fee);
final signedTx = await sdk.blockchainService.signWithHw(preImageTx, groupId);
final broadcast = await sdk.blockchainService.sendTransaction(network, signedTx);

Return

Result containing the signed transaction hex string

Parameters

preImageTx

The PreImageTx from preImageHash

groupId

The MPC group ID for DKG credential lookup