WIP

Methods

  • deposit
  • withdraw
  • approve
  • balance_of
  • transfer
  • transfer_from
  • allowance

deposit

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

Method
deposit

Parameters:

  • amount: The amount to deposit.
  • tx_options: [Optional] Transaction options dictionary.
from web3 import Web3

response = story_client.WIP.deposit(
    amount=Web3.to_wei(10, 'ether'),  # 10 IP tokens
    tx_options={"wait_for_transaction": True}
)
print(f"Deposited IP to WIP at transaction hash {response['tx_hash']}")

withdraw

Unwraps the selected amount of WIP to IP.

Method
withdraw

Parameters:

  • amount: The amount to withdraw.
  • tx_options: [Optional] Transaction options dictionary.
from web3 import Web3

response = story_client.WIP.withdraw(
    amount=Web3.to_wei(5, 'ether'),  # 5 WIP tokens
    tx_options={"wait_for_transaction": True}
)
print(f"Withdrew WIP to IP at transaction hash {response['tx_hash']}")

approve

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

Method
approve

Parameters:

  • amount: The amount of WIP tokens to approve.
  • spender: The address that will use the WIP tokens.
  • tx_options: [Optional] Transaction options dictionary.
from web3 import Web3

response = story_client.WIP.approve(
    spender="0xC92EC2f4c86458AFee7DD9EB5d8c57920BfCD0Ba",
    amount=Web3.to_wei(20, 'ether'),  # 20 WIP tokens
    tx_options={"wait_for_transaction": True}
)
print(f"Approved WIP spending at transaction hash {response['tx_hash']}")

balance_of

Returns the balance of WIP for an address.

Method
balance_of

Parameters:

  • address: The address you want to check the balance for.
balance = story_client.WIP.balance_of("0xC92EC2f4c86458AFee7DD9EB5d8c57920BfCD0Ba")
print(f"WIP balance: {balance}")

transfer

Transfers amount of WIP to a recipient to.

Method
transfer

Parameters:

  • to: Who you’re transferring to.
  • amount: The amount to transfer.
  • tx_options: [Optional] Transaction options dictionary.
from web3 import Web3

response = story_client.WIP.transfer(
    to="0xC92EC2f4c86458AFee7DD9EB5d8c57920BfCD0Ba",
    amount=Web3.to_wei(3, 'ether'),  # 3 WIP tokens
    tx_options={"wait_for_transaction": True}
)
print(f"Transferred WIP at transaction hash {response['tx_hash']}")

transfer_from

Transfers amount of WIP from from to a recipient to.

Method
transfer_from

Parameters:

  • to: Who you’re transferring to.
  • amount: The amount to transfer.
  • from_address: The address to transfer from.
  • tx_options: [Optional] Transaction options dictionary.
from web3 import Web3

response = story_client.WIP.transfer_from(
    to="0xC92EC2f4c86458AFee7DD9EB5d8c57920BfCD0Ba",
    amount=Web3.to_wei(2, 'ether'),  # 2 WIP tokens
    from_address="0x6B86B39F03558A8a4E9252d73F2bDeBfBedf5b68",
    tx_options={"wait_for_transaction": True}
)
print(f"Transferred WIP from another account at transaction hash {response['tx_hash']}")

allowance

Returns the amount of WIP tokens that spender is allowed to spend on behalf of owner.

Method
allowance

Parameters:

  • owner: The address of the token owner.
  • spender: The address of the spender.
response = story_client.WIP.allowance(
    owner="0xC92EC2f4c86458AFee7DD9EB5d8c57920BfCD0Ba",
    spender="0x6B86B39F03558A8a4E9252d73F2bDeBfBedf5b68"
)
print(f"Allowance: {response}")