Gathering detailed insights and metrics for @opensea/seaport-js
Gathering detailed insights and metrics for @opensea/seaport-js
Gathering detailed insights and metrics for @opensea/seaport-js
Gathering detailed insights and metrics for @opensea/seaport-js
A TypeScript library to interface with the Seaport marketplace.
npm install @opensea/seaport-js
Typescript
Module System
Min. Node Version
Node Version
NPM Version
66.1
Supply Chain
98.7
Quality
85.7
Maintenance
100
Vulnerability
78.4
License
TypeScript (98.21%)
Solidity (1.65%)
JavaScript (0.11%)
Shell (0.02%)
Total Downloads
2,253,462
Last Day
932
Last Week
14,425
Last Month
77,234
Last Year
949,888
258 Stars
505 Commits
182 Forks
13 Watching
10 Branches
28 Contributors
Latest Version
4.0.4
Package Id
@opensea/seaport-js@4.0.4
Unpacked Size
16.23 MB
Size
2.02 MB
File Count
794
NPM Version
10.7.0
Node Version
20.15.0
Publised On
08 Jul 2024
Cumulative downloads
Total Downloads
Last day
-74.2%
932
Compared to previous day
Last week
-31.1%
14,425
Compared to previous week
Last month
10.4%
77,234
Compared to previous month
Last year
-0.8%
949,888
Compared to previous year
2
33
Seaport is a new marketplace protocol for safely and efficiently buying and selling NFTs. This is a TypeScript library intended to make interfacing with the contract reasonable and easy.
This is a TypeScript library to help interface with Seaport. It includes various helper methods and constants that makes interfacing with Seaport easier. These include creating orders, fulfilling orders, doing the necessary balance and approval checks, and more. We recommend taking a look at the Seaport docs to get a better understanding of how the Seaport marketplace works.
We recommend using nvm to manage Node.js versions. Execute nvm use
, if you have nvm
installed.
Then, in your project, run:
1npm install --save @opensea/seaport-js
Instantiate your instance of seaport using your ethers provider:
1import { Seaport } from "@opensea/seaport-js"; 2import { ethers } from "ethers"; 3 4const provider = new ethers.BrowserProvider(window.ethereum); 5 6const seaport = new Seaport(provider);
1import { Seaport } from "@opensea/seaport-js"; 2import { ethers } from "ethers"; 3 4const provider = new ethers.JsonRpcProvider( 5 "https://<network>.alchemyapi.io/v2/YOUR-API-KEY", 6); 7 8const seaport = new Seaport(provider);
1import { Seaport } from "@opensea/seaport-js"; 2import { ethers } from "ethers"; 3 4// Provider must be provided to the signer when supplying a custom signer 5const provider = new ethers.JsonRpcProvider( 6 "https://<network>.alchemyapi.io/v2/YOUR-API-KEY", 7); 8 9const signer = new ethers.Wallet("YOUR_PK", provider); 10 11const seaport = new Seaport(signer);
Look at the relevant definitions in seaport.ts
in order to see the different functionality this library offers.
Many of the main core flows return use cases. What this means is that if you were to create an order (a la createOrder
), the library helps perform the necessary balance and approval checks based on the offer
of the order being created. If the offerer
requires approvals on one asset contract, the actions
field of the use case would contain an approval action that the user should execute first in order for the trade to succeed in the future.
1const offerer = "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266"; 2const fulfiller = "0x70997970c51812dc3a010c7d01b50e0d17dc79c8"; 3const { executeAllActions } = await seaport.createOrder( 4 { 5 offer: [ 6 { 7 itemType: ItemType.ERC721, 8 token: "0x8a90cab2b38dba80c64b7734e58ee1db38b8992e", 9 identifier: "1", 10 }, 11 ], 12 consideration: [ 13 { 14 amount: ethers.parseEther("10").toString(), 15 recipient: offerer, 16 }, 17 ], 18 }, 19 offerer, 20); 21 22const order = await executeAllActions(); 23 24const { executeAllActions: executeAllFulfillActions } = 25 await seaport.fulfillOrder({ 26 order, 27 accountAddress: fulfiller, 28 }); 29 30const transaction = executeAllFulfillActions();
1const offerer = "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266"; 2const fulfiller = "0x70997970c51812dc3a010c7d01b50e0d17dc79c8"; 3const { executeAllActions } = await seaport.createOrder( 4 { 5 offer: [ 6 { 7 amount: parseEther("10").toString(), 8 // WETH 9 token: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", 10 }, 11 ], 12 consideration: [ 13 { 14 itemType: ItemType.ERC721, 15 token: "0x8a90cab2b38dba80c64b7734e58ee1db38b8992e", 16 identifier: "1", 17 recipient: offerer, 18 }, 19 ], 20 }, 21 offerer, 22); 23 24const order = await executeAllActions(); 25 26const { executeAllActions: executeAllFulfillActions } = 27 await seaport.fulfillOrder({ 28 order, 29 accountAddress: fulfiller, 30 }); 31 32const transaction = executeAllFulfillActions();
See the contributing guide for detailed instructions on how to get started with this project.
MIT Copyright 2022 Ozone Networks, Inc.
No vulnerabilities found.
No security vulnerabilities found.