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

# Refunds

> Reclaim unmatched collateral from a P2P market with pnp-core's creatorWithdraw, and understand how unresolvable markets are handled.

In a parimutuel (P2P) market the creator seeds one side. If the opposite side never fully fills,
the **unmatched** portion of the creator's stake is refundable — pulled back with
`client.p2p.creatorWithdraw` (the on-chain `creatorRefundV3` instruction).

## Reclaim unmatched collateral

```ts theme={null}
import { PnpClient } from "pnp-core";

const client = PnpClient.mainnet({ wallet }); // must be the market creator

const res = await client.p2p.creatorWithdraw({ market: 42n });
console.log("refunded:", res.signature);
```

This burns the matching creator-side decision tokens and returns the unmatched collateral to the
creator's wallet.

**market** `PublicKey | bigint | number` *required*

The market to withdraw from — its numeric id or PDA.

**computeUnitLimit** `number` (default: 250000)

CU limit prepended to the tx. `0` skips the compute-budget instruction.

> [!NOTE]
>
> **Signer must be the creator.** A non-creator signer reverts on-chain. Only the *unmatched*
> portion is refundable — collateral matched by a counterparty is locked into the market until
> settlement, then paid out via [redeem](https://pnpprotocol.mintlify.site/sdk/trading.md#redeem-a-winning-position).

## When does unmatched collateral occur?

You seed, say, 100 USDC on YES at 1:1 odds. If takers only cover 60 USDC of NO, then 40 USDC of
your stake is unmatched and refundable via `creatorWithdraw`. Custom `oddsBps` changes the
matching ratio, but the principle is the same: whatever the other side didn't cover comes back.

## Unresolvable markets

If a market's outcome can't be objectively determined, the PnP AI oracle flags it as
**unresolvable**. Check that status before deciding how to unwind a position:

```ts theme={null}
const status = await client.oracle.getResolvableStatus(marketPda);
// "checking" | "resolvable" | "unresolvable"

if (status === "unresolvable") {
  // The market won't be settled to a YES/NO winner; on-chain refund logic applies.
  // Creators can still reclaim unmatched collateral via creatorWithdraw.
}
```

> [!WARNING]
>
> `creatorWithdraw` covers the creator's **unmatched** collateral. Refund handling for fully-matched
> positions on markets the oracle deems unresolvable is enforced on-chain and isn't exposed as a
> distinct SDK method today — track a market's `status` and the oracle's resolvable-status to drive
> your UI.


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