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

# WIP Client

> Used to handle the wrapping/unwrapping of WIP (Wrapped IP) tokens within Story.

## WipClient

### Methods

* deposit
* withdraw
* approve
* balanceOf
* transfer
* transferFrom

### deposit

Wraps the selected amount of IP to WIP. The WIP will be deposited to the wallet that transferred the IP.

| Method    | Type                        |
| --------- | --------------------------- |
| `deposit` | `(request: DepositRequest)` |

Parameters:

* `request.amount`: The amount to deposit.

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { parseEther } from "viem";

  const response = await client.wipClient.deposit({
    amount: parseEther("10"), // 10 IP tokens
  });
  ```

  ```typescript Request Type theme={null}
  export type DepositRequest = {
    amount: TokenAmountInput;
  };
  ```
</CodeGroup>

### withdraw

Unwraps the selected amount of WIP to IP.

| Method     | Type                         |
| ---------- | ---------------------------- |
| `withdraw` | `(request: WithdrawRequest)` |

Parameters:

* `request.amount`: The amount to withdraw.

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { parseEther } from "viem";

  const response = await client.wipClient.withdraw({
    amount: parseEther("5"), // 5 WIP tokens
  });
  ```

  ```typescript Request Type theme={null}
  export type WithdrawRequest = {
    amount: TokenAmountInput;
  };
  ```
</CodeGroup>

### approve

Approve a spender to use the wallet's WIP balance.

| Method    | Type                        |
| --------- | --------------------------- |
| `approve` | `(request: ApproveRequest)` |

Parameters:

* `request.amount`: The amount of WIP tokens to approve.
* `request.spender`: The address that will use the WIP tokens

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { parseEther } from "viem";

  const response = await client.wipClient.approve({
    spender: "0xC92EC2f4c86458AFee7DD9EB5d8c57920BfCD0Ba",
    amount: parseEther("20"), // 20 WIP tokens
  });
  ```

  ```typescript Request Type theme={null}
  export type ApproveRequest = {
    spender: Address;
    amount: TokenAmountInput;
  };
  ```
</CodeGroup>

### balanceOf

Returns the balance of WIP for an address.

| Method      | Type                                 |
| ----------- | ------------------------------------ |
| `balanceOf` | `(addr: Address) => Promise<bigint>` |

Parameters:

* `addr`: The address you want to check the baalnce for.

### transfer

Transfers `amount` of WIP to a recipient `to`.

| Method     | Type                         |
| ---------- | ---------------------------- |
| `transfer` | `(request: TransferRequest)` |

Parameters:

* `request.to`: Who you're transferring to.
* `request.amount`: The amount to transfer.

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { parseEther } from "viem";

  const response = await client.wipClient.transfer({
    to: "0xC92EC2f4c86458AFee7DD9EB5d8c57920BfCD0Ba",
    amount: parseEther("3"), // 3 WIP tokens
  });
  ```

  ```typescript Request Type theme={null}
  export type TransferRequest = {
    to: Address;
    amount: TokenAmountInput;
  };
  ```
</CodeGroup>

### transferFrom

Transfers `amount` of WIP from `from` to a recipient `to`.

| Method         | Type                             |
| -------------- | -------------------------------- |
| `transferFrom` | `(request: TransferFromRequest)` |

Parameters:

* `request.to`: Who you're transferring to.
* `request.amount`: The amount to transfer.
* `request.from`: The address to transfer from.

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { parseEther } from "viem";

  const response = await client.wipClient.transferFrom({
    to: "0xC92EC2f4c86458AFee7DD9EB5d8c57920BfCD0Ba",
    amount: parseEther("2"), // 2 WIP tokens
    from: "0x6B86B39F03558A8a4E9252d73F2bDeBfBedf5b68",
  });
  ```

  ```typescript Request Type theme={null}
  export type TransferFromRequest = {
    to: Address;
    amount: TokenAmountInput;
    from: Address;
  };
  ```
</CodeGroup>
