pub fn create_psbt<D: BatchDatabase>(
	wallet: &Wallet<D>,
	drawee_stacks_private_key: &StacksPrivateKey,
	payee_bitcoin_address: &BitcoinAddress,
	sbtc_wallet_bitcoin_address: &BitcoinAddress,
	amount: u64,
	fulfillment_amount: u64,
	network: BitcoinNetwork,
) -> SBTCResult<PartiallySignedTransaction> {
	let outputs = create_outputs(
		drawee_stacks_private_key,
		payee_bitcoin_address,
		sbtc_wallet_bitcoin_address,
		amount,
		fulfillment_amount,
		network,
	)?;

	let mut tx_builder = wallet.build_tx();

	for (script, amount) in outputs.clone() {
		tx_builder.add_recipient(script, amount);
	}

	let (mut partial_tx, _) = tx_builder.finish().map_err(|err| {
		SBTCError::BDKError(
			"Could not build partially signed withdrawal transaction",
			err,
		)
	})?;

	partial_tx.unsigned_tx.output =
		reorder_outputs(partial_tx.unsigned_tx.output, outputs);

	Ok(partial_tx)
}
Construct a withdrawal request partially signed transaction
sbtc-core/src/operations/op_return/withdrawal_request.rs