Skip to content

Commit 67ca80b

Browse files
committed
update
1 parent a9547c5 commit 67ca80b

File tree

20 files changed

+1241
-471
lines changed

20 files changed

+1241
-471
lines changed

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

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { AbiFunction } from "ox";
2+
import type { Abi } from "ox/Abi";
13
import { beforeAll, describe, expect, it } from "vitest";
24
import { TEST_CONTRACT_URI } from "~test/ipfs-uris.js";
35
import { ANVIL_CHAIN } from "../../../../test/src/chains.js";
@@ -7,6 +9,7 @@ import {
79
TEST_ACCOUNT_B,
810
TEST_ACCOUNT_C,
911
} from "../../../../test/src/test-wallets.js";
12+
import { resolveContractAbi } from "../../../contract/actions/resolve-abi.js";
1013
import {
1114
type ThirdwebContract,
1215
getContract,
@@ -33,7 +36,10 @@ import { getAllValidListings } from "./read/getAllValidListings.js";
3336
import { getListing } from "./read/getListing.js";
3437
import { isListingValid } from "./utils.js";
3538
import { buyFromListing } from "./write/buyFromListing.js";
36-
import { createListing } from "./write/createListing.js";
39+
import {
40+
createListing,
41+
isCreateListingSupported,
42+
} from "./write/createListing.js";
3743

3844
const chain = ANVIL_CHAIN;
3945
const client = TEST_CLIENT;
@@ -445,4 +451,12 @@ describe.runIf(process.env.TW_SECRET_KEY)("Marketplace Direct Listings", () => {
445451
});
446452
expect(approveTx).not.toBe(null);
447453
}, 120_000);
454+
455+
it("isCreateListingSupported should return TRUE for thirdweb marketplace contract", async () => {
456+
const abi = await resolveContractAbi<Abi>(marketplaceContract);
457+
const selectors = abi
458+
.filter((f) => f.type === "function")
459+
.map((f) => AbiFunction.getSelector(f));
460+
expect(isCreateListingSupported(selectors)).toBe(true);
461+
});
448462
});

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)