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.
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.
import { parseEther } from "viem";
const response = await client.wipClient.deposit({
amount: parseEther("10"), // 10 IP tokens
});
withdraw
Unwraps the selected amount of WIP to IP.
| Method | Type |
|---|
withdraw | (request: WithdrawRequest) |
Parameters:
request.amount: The amount to withdraw.
import { parseEther } from "viem";
const response = await client.wipClient.withdraw({
amount: parseEther("5"), // 5 WIP tokens
});
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
import { parseEther } from "viem";
const response = await client.wipClient.approve({
spender: "0xC92EC2f4c86458AFee7DD9EB5d8c57920BfCD0Ba",
amount: parseEther("20"), // 20 WIP tokens
});
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.
import { parseEther } from "viem";
const response = await client.wipClient.transfer({
to: "0xC92EC2f4c86458AFee7DD9EB5d8c57920BfCD0Ba",
amount: parseEther("3"), // 3 WIP tokens
});
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.
import { parseEther } from "viem";
const response = await client.wipClient.transferFrom({
to: "0xC92EC2f4c86458AFee7DD9EB5d8c57920BfCD0Ba",
amount: parseEther("2"), // 2 WIP tokens
from: "0x6B86B39F03558A8a4E9252d73F2bDeBfBedf5b68",
});