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.

MethodType
deposit(request: DepositRequest)

Parameters:

  • request.amount: The amount to deposit.
  • request.txOptions: [Optional] The transaction options.
import { parseEther } from "viem";

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

withdraw

Unwraps the selected amount of WIP to IP.

MethodType
withdraw(request: WithdrawRequest)

Parameters:

  • request.amount: The amount to withdraw.
  • request.txOptions: [Optional] The transaction options.
import { parseEther } from "viem";

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

approve

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

MethodType
approve(request: ApproveRequest)

Parameters:

  • request.amount: The amount of WIP tokens to approve.
  • request.spender: The address that will use the WIP tokens
  • request.txOptions: [Optional] The transaction options.
import { parseEther } from "viem";

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

balanceOf

Returns the balance of WIP for an address.

MethodType
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.

MethodType
transfer(request: TransferRequest)

Parameters:

  • request.to: Who you’re transferring to.
  • request.amount: The amount to transfer.
  • request.txOptions: [Optional] The transaction options.
import { parseEther } from "viem";

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

transferFrom

Transfers amount of WIP from from to a recipient to.

MethodType
transferFrom(request: TransferFromRequest)

Parameters:

  • request.to: Who you’re transferring to.
  • request.amount: The amount to transfer.
  • request.from: The address to transfer from.
  • request.txOptions: [Optional] The transaction options.
import { parseEther } from "viem";

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