> ## 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: Manage delegates

> Check, add, and remove delegates for a Unified Balance

A delegate is an address that you authorize to spend from your Unified Balance
on a given blockchain. In practice, a delegate is often a backend service
signing spends on behalf of a user.

How delegates work:

* Delegation is blockchain-specific.
* Authorizing a delegate on one blockchain does not grant them access on other
  blockchains.
* An authorized delegate can call `spend` with `sourceAccount` set to your
  address so funds are drawn from your Unified Balance.

You can check, add, and remove delegates at any time. For an end-to-end flow on
how a delegate can deposit and spend from a Unified Balance, see the
[delegate quickstart](/app-kit/quickstarts/unified-balance-delegate-deposit-and-spend).

## 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`.

## Check delegate status

The following example reads delegate status for an address.

```typescript TypeScript theme={null}
const status = await kit.unifiedBalance.getDelegateStatus({
  from: { adapter, chain: "Base_Sepolia" },
  delegateAddress: "0xDelegateAddress",
});

console.log("Delegate status:", status); // 'none' | 'pending' | 'ready'
```

`getDelegateStatus` resolves to `'none'` when no delegate is set, `'pending'`
while delegation is still confirming, and `'ready'` when the delegate is active
and authorized to spend.

### Poll until ready

Use `getDelegateStatus` in a poll loop to wait until the delegate is active
before spending. Confirmation time varies by blockchain. For example, on
Ethereum, Base, and Arbitrum it can take up to 15 minutes, while on Arc and
Avalanche it is near-instant. If the delegate was added well before the spend,
`getDelegateStatus` returns `'ready'` immediately and no polling is needed.

This example polls until the delegate is ready before spending:

```typescript TypeScript theme={null}
let status = await kit.unifiedBalance.getDelegateStatus({
  from: { adapter, chain: "Base_Sepolia" },
  delegateAddress: "0xDelegateAddress",
});

while (status === "pending") {
  await new Promise((r) => setTimeout(r, 10_000)); // wait 10 seconds
  status = await kit.unifiedBalance.getDelegateStatus({
    from: { adapter, chain: "Base_Sepolia" },
    delegateAddress: "0xDelegateAddress",
  });
}

if (status === "ready") {
  console.log("Delegate is ready. Safe to spend.");
}
```

## Add a delegate

The following example authorizes a delegate to spend from a Unified Balance on
Base Sepolia.

```typescript TypeScript theme={null}
await kit.unifiedBalance.addDelegate({
  from: { adapter, chain: "Base_Sepolia" },
  delegateAddress: "0xDelegateAddress",
});

console.log("Delegate added.");
```

Delegation is blockchain-specific. To authorize a delegate on multiple
blockchains, call `addDelegate` for each blockchain.

## Remove a delegate

This example removes a delegate from a Unified Balance on Base Sepolia:

```typescript TypeScript theme={null}
await kit.unifiedBalance.removeDelegate({
  from: { adapter, chain: "Base_Sepolia" },
  delegateAddress: "0xDelegateAddress",
});

console.log("Delegate removed.");
```
