useCreateListing

Hook for creating listings.

Import

import { useCreateListing } from '@ark-project/react'

Usage

import { useAccount } from '@starknet-react/core'
import { useCreateListing } from '@ark-project/react';

function App({ tokenAddress, tokenId, startAmount }) {
  const { account } = useAccount();
  const { createListing, data, isLoading, isSuccess } = useCreateListing();

return (
    <>
      <button onClick={async () => {
        await createListing({
          account,
          tokenAddress,
          tokenId,
          amount: BigInt(startAmount),
        });
      }}>
        Create Listing
      </button>
      <div>Status: {status}</div>
      {response && <div>Response: {response.toString()}</div>}
    </>
  );
};

Return Type

import { type useCreateListingReturnType } from '@ark-project/react'
  • Name
    createListing
    Type
    (params: CreateListingParams) => CreateListingResult
    Description

    Mutation to create a listing. See CreateListingParams.

  • Name
    createListingAsync
    Type
    (params: CreateListingParams) => Promise<CreateListingResult>
    Description

    Async mutation to create a listing. See CreateListingParams.

  • Name
    data
    Type
    CreateListingResult
    Description

    The data returned from the mutation.

Parameters

  • Name
    config (optional)
    Type
    Config | undefined
    Description

    Config to use instead of retrieving from the nearest ArkProvider.

Actions

CreateListingParameters and CreateListingResponse for more details.