> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nullark.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Prepare a withdrawal with the SDK

Restore one note, apply fee bounds, and prepare an unsigned Nullark withdrawal.

Restore the backup first. The client then resolves current membership, checks the note's spent state, reads the fee, builds the proof, and repeats the mutable checks before returning calldata.

## Prepare a withdrawal

```ts
import type { HexString, Nullark } from "@nullark/sdk";

type RestoredBundle = Awaited<ReturnType<Nullark["recovery"]["restore"]>>;

export function prepareWithdrawal(input: {
  nullark: Nullark;
  bundle: RestoredBundle;
  childIndex: number;
  destination: HexString;
  maxFeeWei: string;
  minNetAmountWei: string;
}) {
  return input.nullark.withdrawals.prepare({
    bundle: input.bundle,
    childIndex: input.childIndex,
    destination: input.destination,
    maxFeeWei: input.maxFeeWei,
    minNetAmountWei: input.minNetAmountWei
  });
}
```

Set `maxFeeWei` and `minNetAmountWei` from values the user reviewed. Preparation stops when the live fee crosses either bound.

| Input | Type | Use |
| --- | --- | --- |
| `bundle` | Restored bundle | Private bundle returned by recovery or balance lookup |
| `childIndex` | `number` | Unspent child selected by the user |
| `destination` | `HexString` | Full recipient address |
| `maxFeeWei` | Decimal `string` | Highest fee the user accepts |
| `minNetAmountWei` | Decimal `string` | Lowest amount the recipient may receive |

## Review the result

| Field | Show or verify |
| --- | --- |
| `destination` | Full recipient address |
| `grossAmountWei` | Selected private note |
| `feeWei` | Current fee used by the proof |
| `netAmountWei` | Amount the recipient gets |
| `transaction.to` | Active runtime pool |
| `transaction.value` | Always `0` for this withdrawal call |

Simulate the unsigned request, submit it once, and retain the returned hash for reconciliation.

`resolveMembership`, `isNullifierSpent`, and `runtimeFeeReadClient` must read the same runtime used to restore the bundle. Mixing sources fails the safety assumptions behind the proof.
