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

# Users

> Check whether a wallet belongs to an existing Cesto user.

`cesto.users.lookup` resolves a Solana wallet to a Cesto user and tells you whether Cesto
can sign for that user — the **existing Cesto user** path on
[open](https://docs.cesto.co/sdk/open-position.md#existing-cesto-users),
[close](https://docs.cesto.co/sdk/close-position.md#existing-cesto-users), and
[rebalance](https://docs.cesto.co/sdk/rebalance-position.md#existing-cesto-users), where the user approves once by
signing a message instead of signing every transaction.

Call it before offering that flow, so you can fall back to the client-signed one for
wallets Cesto can't sign for.

```ts theme={null}
const user = await cesto.users.lookup({ wallet: 'SOLANA_ADDRESS' });

user.exists;           // true when the wallet resolves to a Cesto user
user.delegatedSigning; // true when Cesto can sign on their behalf
user.migrationStatus;  // 'NOT_REQUIRED' | 'REQUIRED' | 'IN_PROGRESS' | 'COMPLETED' | null
user.provider;         // 'EXTERNAL' | 'PRIVY' | 'PARA' | null
```

There's a convenience boolean when that's all you need:

```ts theme={null}
if (await cesto.users.exists({ wallet })) { /* … */ }
```

> [!NOTE]
>
> An unknown wallet is a **200 with `exists: false`**, not a 404 — branch on the response
> rather than catching an error. `migrationStatus` and `provider` are `null` for unknown
> wallets.

Works with a read-only key.

## Parameters

**wallet** `string` *required*

Solana address (base58) to look up.

## Response

**exists** `boolean`

True when the wallet resolves to a Cesto user.

**delegatedSigning** `boolean`

True when Cesto can sign on the user's behalf — their Privy wallet has a signer attached,
or their older Para wallet still holds an encrypted key share. The field name is
historical; read it as "Cesto holds a key for this user".

**migrationStatus** `'NOT_REQUIRED' | 'REQUIRED' | 'IN_PROGRESS' | 'COMPLETED' | null`

Para → Privy migration gate state. `null` when the wallet is unknown.

**provider** `'EXTERNAL' | 'PRIVY' | 'PARA' | null`

How the user signed up. `null` when the wallet is unknown.

## Choosing a flow

```ts theme={null}
const { exists, delegatedSigning } = await cesto.users.lookup({ wallet });

if (exists && delegatedSigning) {
  // Existing Cesto user: createChallenge → user signs the message → start
} else {
  // The wallet signs its own transactions: prepare → sign → submit
}
```

> [!WARNING]
>
> `delegatedSigning: false` for an existing user is not a bug — an external wallet
> (`provider: 'EXTERNAL'`) is one Cesto never held a key for. Those users always sign their
> own transactions.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.