Skip to content

Commit 8b84284

Browse files
committed
update
1 parent 03bf859 commit 8b84284

File tree

16 files changed

+1113
-469
lines changed

16 files changed

+1113
-469
lines changed

packages/thirdweb/src/extensions/marketplace/direct-listings/direct-listings.test.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,19 @@ import { deployERC1155Contract } from "../../prebuilts/deploy-erc1155.js";
2828
import { deployMarketplaceContract } from "../../prebuilts/deploy-marketplace.js";
2929
import { newListingEvent } from "../__generated__/IDirectListings/events/NewListing.js";
3030
import { totalListings } from "../__generated__/IDirectListings/read/totalListings.js";
31+
32+
import type { Abi } from "abitype";
33+
import { toFunctionSelector } from "viem";
34+
import { resolveContractAbi } from "../../../contract/actions/resolve-abi.js";
3135
import { getAllListings } from "./read/getAllListings.js";
3236
import { getAllValidListings } from "./read/getAllValidListings.js";
3337
import { getListing } from "./read/getListing.js";
3438
import { isListingValid } from "./utils.js";
3539
import { buyFromListing } from "./write/buyFromListing.js";
36-
import { createListing } from "./write/createListing.js";
40+
import {
41+
createListing,
42+
isCreateListingSupported,
43+
} from "./write/createListing.js";
3744

3845
const chain = ANVIL_CHAIN;
3946
const client = TEST_CLIENT;
@@ -445,4 +452,12 @@ describe.runIf(process.env.TW_SECRET_KEY)("Marketplace Direct Listings", () => {
445452
});
446453
expect(approveTx).not.toBe(null);
447454
}, 120_000);
455+
456+
it("isCreateListingSupported should return TRUE for thirdweb marketplace contract", async () => {
457+
const abi = await resolveContractAbi<Abi>(marketplaceContract);
458+
const selectors = abi
459+
.filter((f) => f.type === "function")
460+
.map((f) => toFunctionSelector(f));
461+
expect(isCreateListingSupported(selectors)).toBe(true);
462+
});
448463
});

packages/thirdweb/src/extensions/marketplace/direct-listings/write/createListing.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ export function createListing(
130130
throw new Error("Start time must be before end time.");
131131
}
132132

133-
// valdiate quantity
133+
// validate quantity
134134
let quantity: bigint;
135135
if (assetIsERC721) {
136136
// force quantity to 1 for ERC721s

packages/thirdweb/src/extensions/marketplace/direct-listings/write/updateListing.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ export function updateListing(
142142
throw new Error("Start time must be before end time.");
143143
}
144144

145-
// valdiate quantity
145+
// validate quantity
146146
let quantity: bigint;
147147
if (assetIsERC721) {
148148
// force quantity to 1 for ERC721s

0 commit comments

Comments
 (0)