useCancel
Hook for canceling order.
Import
import useCancel from '@ark-project/react'
Usage
import { useAccount } from '@starknet-react/core'
import { useCancel } from '@ark-project/react'
function App({ orderHash, tokenAddress, tokenId }) {
  const { account } = useAccount()
  const { cancel, data, isLoading, isSuccess } = useCancel()
  return (
    <>
      <button
        onClick={async () => {
          await cancel({
            account,
            orderHash,
            tokenAddress,
            tokenId,
          })
        }}
      >
        Cancel listing
      </button>
      {isLoading && <p>Loading...</p>}
      {isSuccess && <p>{data.transactionHash}</p>}
    </>
  )
}
Return Type
import { type UseCancelReturnType } from '@ark-project/react'
- Name
- cancel
- Type
- (params: CancelParams) => CancelResult
- Description
- Mutation to cancel the order. See CancelParams. 
 
- Name
- cancelAsync
- Type
- (params: CancelParams) => Promise<CancelResult>
- Description
- Async mutation to cancel the order. See CancelParams. 
 
- Name
- data
- Type
- Object
- Description
- The data returned from the mutation. 
 
Parameters
import { type CancelParams } from '@ark-project/core'
config (optional)
Config | undefined
Config to use instead of retrieving from the nearest ArkProvider.