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

# getWithdrawalRequests

> Fetch a user's withdrawal request history

Fetches a paginated list of withdrawal requests for a user from the backend API. Supports filtering by chain, vault, and status.

## Import

```ts theme={null}
import { getWithdrawalRequests } from "@paxoslabs/amplify-sdk";
```

## Usage

```ts theme={null}
const result = await getWithdrawalRequests({
  userAddress: "0x1234...5678",
  status: "PENDING",
  chainId: 1,
});

for (const request of result.withdrawalRequests) {
  console.log(request.id, request.status, request.orderAmount);
}
```

## Parameters

| Parameter      | Type                      | Required | Description                    |
| -------------- | ------------------------- | -------- | ------------------------------ |
| `userAddress`  | `Address`                 | Yes      | User's wallet address          |
| `chainId`      | `number`                  | No       | Filter by blockchain network   |
| `vaultAddress` | `Address`                 | No       | Filter by vault contract       |
| `status`       | `WithdrawalRequestStatus` | No       | Filter by status               |
| `pageSize`     | `number`                  | No       | Number of results per page     |
| `pageToken`    | `string`                  | No       | Pagination token for next page |

```ts theme={null}
interface GetWithdrawalRequestsParams {
  userAddress: Address;
  chainId?: number;
  vaultAddress?: Address;
  status?: WithdrawalRequestStatus;
  pageSize?: number;
  pageToken?: string;
}
```

## Return Type

```ts theme={null}
interface WithdrawalRequestsResult {
  withdrawalRequests: WithdrawalRequest[];
  nextPageToken: string | null;
}

interface WithdrawalRequest {
  id: string;
  vaultAddress: Address;
  chainId: number;
  wantAssetAddress: Address;
  status: WithdrawalRequestStatus;
  createdAt: string;
  userAddress: Address;
  receiverAddress: Address;
  refundReceiverAddress: Address;
  orderAmount: string;
  orderIndex: number;
  isSubmittedViaSignature: boolean;
  isForceProcessed: boolean;
  isMarkedForRefund: boolean;
  isMarkedForRefundByUser: boolean;
  didOrderFailTransfer: boolean;
}

type WithdrawalRequestStatus =
  | "PENDING"
  | "COMPLETE"
  | "PENDING_REFUND"
  | "REFUNDED";
```

## Example: Withdrawal History Component

```tsx theme={null}
import { useQuery } from "@tanstack/react-query";
import { getWithdrawalRequests } from "@paxoslabs/amplify-sdk";

function WithdrawalHistory({ userAddress }: { userAddress: `0x${string}` }) {
  const { data, isLoading } = useQuery({
    queryKey: ["withdrawalRequests", userAddress],
    queryFn: () => getWithdrawalRequests({ userAddress }),
  });

  if (isLoading) return <p>Loading...</p>;

  return (
    <ul>
      {data?.withdrawalRequests.map((req) => (
        <li key={req.id}>
          {req.orderAmount} - {req.status}
        </li>
      ))}
    </ul>
  );
}
```

## Error Handling

| Error Message Pattern                   | Description          | Resolution                    |
| --------------------------------------- | -------------------- | ----------------------------- |
| `"SDK not initialized"`                 | SDK not initialized  | Call `initAmplifySDK()` first |
| `"Failed to fetch withdrawal requests"` | Network or API error | Check connection and retry    |

## Related

* [Withdrawals Guide](/v0.4.2/intro/products/earn/developers/guides/withdrawals) - Complete withdrawal flow
* [prepareWithdrawalAuthorization](/v0.4.2/intro/products/earn/developers/api/prepareWithdrawalAuthorization) - Start a withdrawal
