-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathfulfillListing.test.ts
45 lines (40 loc) · 1.16 KB
/
fulfillListing.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import { getOrderStatus } from "../src/actions/read/index.js";
import { createListing, fulfillListing } from "../src/index.js";
import { accounts, config, mintERC721 } from "./utils/index.js";
describe("fulfillOffer", () => {
it("default", async () => {
const { seller, buyer, listingBroker, saleBroker } = accounts;
const { tokenId, tokenAddress } = await mintERC721({ account: seller });
const startAmount = BigInt(1);
const { orderHash } = await createListing(config, {
starknetAccount: seller,
order: {
brokerId: listingBroker.address,
tokenAddress,
tokenId,
startAmount
},
approveInfo: {
tokenAddress,
tokenId
}
});
await fulfillListing(config, {
starknetAccount: buyer,
fulfillListingInfo: {
orderHash,
tokenAddress,
tokenId,
brokerId: saleBroker.address
},
approveInfo: {
currencyAddress: config.starknetCurrencyContract,
amount: startAmount
}
});
const { orderStatus } = await getOrderStatus(config, {
orderHash
});
expect(orderStatus).toBe("Executed");
}, 50_000);
});