Skill — Copyable reference implementation. Use as-is or customize. See Skills Philosophy.
Planned Implementation
Create Order
Fulfill Order
Collection Offers
Resources
Related
- permit — Gasless approvals
NFT marketplace interactions with Seaport
import { Seaport } from './Seaport.js';
const seaport = Seaport({
provider,
seaportAddress: SEAPORT_ADDRESS,
});
// List NFT for sale
const order = await seaport.createOrder({
offer: [{
itemType: 2, // ERC721
token: NFT_ADDRESS,
identifier: tokenId,
}],
consideration: [{
itemType: 0, // ETH
amount: parseEther('1'),
recipient: sellerAddress,
}],
signer,
});
// Buy NFT
await seaport.fulfillOrder({
order,
signer,
value: parseEther('1'),
});
// Fulfill with criteria (trait-based orders)
await seaport.fulfillAdvancedOrder({
order,
criteriaResolvers: [{
identifier: specificTokenId,
proof: merkleProof,
}],
signer,
});
// Make offer on any NFT in collection
const order = await seaport.createOrder({
offer: [{
itemType: 1, // ERC20
token: WETH,
amount: parseEther('0.5'),
}],
consideration: [{
itemType: 4, // ERC721 with criteria
token: NFT_ADDRESS,
identifier: 0,
criteria: collectionMerkleRoot,
recipient: buyerAddress,
}],
signer,
});
Was this page helpful?