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

# How-to: Track operation progress

> Subscribe to phase events on a loan operation to drive a progress UI or log where an operation stopped

`kit.borrow.borrow`, `kit.borrow.repay`, `kit.borrow.addCollateral`,
`kit.borrow.withdrawCollateralRepayIfNeeded`, and `kit.borrow.closeLoan` run
through several phases before they confirm onchain. Subscribe to those phases
with `kit.on` to update a progress UI in real time, log operational metrics, or
diagnose where an operation stopped when it fails.

For the phase names and firing rules, see
[Borrow phase events](/app-kit/references/borrow-phase-events).

## Prerequisites

Before you begin, ensure that you've:

* [Installed the App Kit SDK](/app-kit/tutorials/installation)
* [Configured an adapter](/app-kit/tutorials/adapter-setups)

These are required so any example below runs with a valid `kit` and `adapter`.

## Subscribe to one phase

Pass a `borrow.<phase>` name to `kit.on` to receive only that phase's events.
Each payload carries `operation`, `method` (the phase name), and a `values`
object with the phase `state` (`pending`, `success`, or `error`):

```typescript TypeScript theme={null}
kit.on("borrow.execute", (payload) => {
  if (payload.values.state === "success") {
    console.log("Confirmed in", payload.values.txHash);
  }
  if (payload.values.state === "error") {
    console.error("Failed:", payload.values.errorMessage);
  }
});

await kit.borrow.borrow({
  from: { adapter, chain: "Arc_Testnet" },
  marketId: "0x1111...1111",
  borrowAmount: "1000.0",
});
```

Only the `execute` phase carries a `txHash` when the batch confirms. For which
phases carry hashes and what a stalled `pending` state means, see
[Borrow phase events](/app-kit/references/borrow-phase-events).

## Subscribe to every Borrow phase

Pass `"borrow.*"` to receive events for every phase across every loan operation.
A bare `"*"` also matches, but it delivers bridge, earn, and unified balance
events too, so filter on the payload if you only want Borrow.

```typescript TypeScript theme={null}
kit.on("borrow.*", ({ operation, method, values }) => {
  console.log(operation, method, values.state);
});
```

## Unsubscribe

Pass the same handler reference to `kit.off` to unregister it. Inline arrow
functions create a new reference each call, so store the handler if you plan to
unsubscribe:

```typescript TypeScript theme={null}
import type { BorrowActions } from "@circle-fin/app-kit";

const handler = ({ values }: BorrowActions["execute"]) =>
  console.log(values.state);

kit.on("borrow.execute", handler);

kit.off("borrow.execute", handler);
```
