useCreateDirectListingBatch

Create multiple direct listings in one batch

Example

const Component = () => {
const { contract } = useContract("{{contract_address}}");
const {
mutate: createDirectListingBatch,
isLoading,
error,
} = useCreateDirectListingBatch(contract);
if (error) {
console.error("failed to create direct listing batch", error);
}
// Sample data
const directListingData = [
{
assetContractAddress: "nft-contract-address",
tokenId: "token-id-1",
quantity: "quantity-1",
currencyContractAddress: "currency-address",
pricePerToken: 1,
},
{
assetContractAddress: "nft-contract-address",
tokenId: "token-id-2",
quantity: 1,
currencyContractAddress: "currency-address",
pricePerToken: 0,
},
];
return (
<button
disabled={isLoading}
onClick={() => createDirectListingBatch(directListingData)}
>
Create batch Direct Listing!
</button>
);
};
function useCreateDirectListingBatch(
contract: RequiredParam<TMarketplaceV3>,
): UseMutationResult<
unknown,
Array<{}>,
unknown
>;

Parameters

an instance of a Marketplace contract

Type

let contract: RequiredParam<TMarketplaceV3>;

Returns

let returnType: UseMutationResult<
unknown,
Array<{}>,
unknown
>;

a mutation object that can be used to create a new batch of direct listings