buildTransfer

suspend fun buildTransfer(from: String, to: String, amount: BigInteger, tokenType: String, senderPublicKey: String, ttlMinutes: Int = DEFAULT_TTL_MINUTES): UnshieldedTransactionBuilder.BuildResult

Build an unshielded transfer transaction.

Steps:

  1. Validate inputs

  2. Select and lock UTXOs (smallest-first algorithm)

  3. Convert selected UTXOs to UtxoSpend inputs

  4. Create recipient UtxoOutput

  5. Create change UtxoOutput if needed (change 0)

  6. Create UnshieldedOffer with inputs and outputs

  7. Create Intent with TTL

UTXO Locking: Selected UTXOs are automatically marked as PENDING by UtxoManager. If transaction building succeeds but later fails (signing/submission), call utxoManager.unlockUtxos() to release them.

Public Key Derivation: The indexer doesn't provide public keys for UTXOs (security/privacy). The caller must derive the public key from the HD wallet before calling this method. This matches Lace wallet's architecture.

Return

BuildResult.Success with Intent, or BuildResult.InsufficientFunds

Parameters

from

Sender's unshielded address

to

Recipient's unshielded address

amount

Amount to send (in smallest units)

tokenType

Token type identifier (64 hex chars)

senderPublicKey

Sender's BIP-340 public key (33 bytes hex)

ttlMinutes

Transaction time-to-live in minutes (default 30)