diff --git a/src/lib/utils/hooks/offer/useCreateOffers.tsx b/src/lib/utils/hooks/offer/useCreateOffers.tsx index 342956881..dbe552938 100644 --- a/src/lib/utils/hooks/offer/useCreateOffers.tsx +++ b/src/lib/utils/hooks/offer/useCreateOffers.tsx @@ -26,6 +26,7 @@ type OfferFieldsFragment = subgraph.OfferFieldsFragment; type UseCreateOffersProps = { sellerToCreate: accounts.CreateSellerArgs | null; + sellerId: string | null; offersToCreate: offers.CreateOfferArgs[]; tokenGatedInfo?: PartialTokenGating | null; conditionDecimals?: number; @@ -46,6 +47,7 @@ export function useCreateOffers() { return useMutation( async ({ sellerToCreate, + sellerId, offersToCreate, tokenGatedInfo, conditionDecimals, @@ -202,22 +204,15 @@ export function useCreateOffers() { ); const decimals = await onBeforeBuildCondition(); const condition = buildCondition(tokenGatedInfo, decimals); - const sellerAddress = sellerToCreate?.assistant; - if (!sellerAddress) { - throw new Error(`sellerAddress is falsy "${sellerAddress}"`); - } - const seller = await coreSDK.getSellerByAssistant(sellerAddress); - if (!seller) { - throw new Error( - `seller could not be found with this address="${sellerAddress}"` - ); - } - const sellerId = seller.id; if (isMetaTx) { const nonce = Date.now(); const { r, s, v, functionName, functionSignature } = await coreSDK.signMetaTxCreateGroup({ - createGroupArgs: { offerIds, sellerId, ...condition }, + createGroupArgs: { + offerIds, + sellerId: sellerId as string, + ...condition + }, nonce }); txResponse = await coreSDK.relayMetaTransaction({ @@ -231,7 +226,7 @@ export function useCreateOffers() { } else { txResponse = await coreSDK.createGroup({ offerIds, - sellerId, + sellerId: sellerId as string, ...condition }); } diff --git a/src/pages/batch-create-offers/BatchCreateOffers.tsx b/src/pages/batch-create-offers/BatchCreateOffers.tsx index c0025d59f..ded7124c8 100644 --- a/src/pages/batch-create-offers/BatchCreateOffers.tsx +++ b/src/pages/batch-create-offers/BatchCreateOffers.tsx @@ -208,6 +208,7 @@ function BatchCreateOffers() { try { const result = await createOffers({ sellerToCreate: null, + sellerId: currentSeller?.sellerIds?.[0] || null, offersToCreate: offersToBeCreated, tokenGatedInfo: null, // TODO: add token gated info conditionDecimals: decimals, diff --git a/src/pages/create-product/CreateProduct.tsx b/src/pages/create-product/CreateProduct.tsx index 3089b1850..fe2211bb7 100644 --- a/src/pages/create-product/CreateProduct.tsx +++ b/src/pages/create-product/CreateProduct.tsx @@ -152,7 +152,7 @@ function CreateProduct() { if ( sellersLoading || - curationLists.isFetching || + curationLists.isLoading || (curationLists.lastSellerIdFetched !== undefined && seller && Number(curationLists.lastSellerIdFetched) < Number(seller.id)) diff --git a/src/pages/create-product/CreateProductInner.tsx b/src/pages/create-product/CreateProductInner.tsx index 5c1a6587c..ebeef5ed6 100644 --- a/src/pages/create-product/CreateProductInner.tsx +++ b/src/pages/create-product/CreateProductInner.tsx @@ -823,6 +823,7 @@ function CreateProductInner({ const isTokenGated = productType?.tokenGatedOffer === "true"; const result = await createOffers({ sellerToCreate: null, + sellerId: currentAssistant?.id || null, offersToCreate, tokenGatedInfo: isTokenGated ? values.tokenGating : null, conditionDecimals: decimals,