@net-protocol/bazaar 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,247 @@
1
+ /**
2
+ * Bazaar types for NFT listings and collection offers
3
+ */
4
+ /**
5
+ * Seaport order status
6
+ */
7
+ declare enum SeaportOrderStatus {
8
+ CANCELLED = 0,
9
+ EXPIRED = 1,
10
+ OPEN = 2,
11
+ FILLED = 3
12
+ }
13
+ /**
14
+ * NFT listing information
15
+ */
16
+ interface Listing {
17
+ /** Seller's address */
18
+ maker: `0x${string}`;
19
+ /** NFT contract address */
20
+ nftAddress: `0x${string}`;
21
+ /** Token ID */
22
+ tokenId: string;
23
+ /** Price in wei */
24
+ priceWei: bigint;
25
+ /** Price in native currency (formatted) */
26
+ price: number;
27
+ /** Currency symbol (e.g., "eth", "degen") */
28
+ currency: string;
29
+ /** Expiration timestamp in seconds */
30
+ expirationDate: number;
31
+ /** Seaport order hash */
32
+ orderHash: string;
33
+ /** Order status (open, filled, cancelled, expired) */
34
+ orderStatus: SeaportOrderStatus;
35
+ /** Raw message data for fulfillment */
36
+ messageData: `0x${string}`;
37
+ /** Decoded Seaport order components */
38
+ orderComponents?: SeaportOrderComponents;
39
+ }
40
+ /**
41
+ * Collection offer information
42
+ */
43
+ interface CollectionOffer {
44
+ /** Buyer's address */
45
+ maker: `0x${string}`;
46
+ /** NFT collection address */
47
+ nftAddress: `0x${string}`;
48
+ /** Offer price in wei (WETH) */
49
+ priceWei: bigint;
50
+ /** Offer price in native currency (formatted) */
51
+ price: number;
52
+ /** Currency symbol */
53
+ currency: string;
54
+ /** Expiration timestamp in seconds */
55
+ expirationDate: number;
56
+ /** Seaport order hash */
57
+ orderHash: string;
58
+ /** Order status */
59
+ orderStatus: SeaportOrderStatus;
60
+ /** Raw message data for acceptance */
61
+ messageData: `0x${string}`;
62
+ /** Decoded Seaport order components */
63
+ orderComponents?: SeaportOrderComponents;
64
+ }
65
+ /**
66
+ * ERC20 offer information
67
+ */
68
+ interface Erc20Offer {
69
+ /** Buyer's address */
70
+ maker: `0x${string}`;
71
+ /** ERC20 token address being purchased */
72
+ tokenAddress: `0x${string}`;
73
+ /** Amount of tokens being purchased */
74
+ tokenAmount: bigint;
75
+ /** Total WETH price in wei */
76
+ priceWei: bigint;
77
+ /** Price per token in wei (priceWei / tokenAmount) */
78
+ pricePerTokenWei: bigint;
79
+ /** Total price in native currency (formatted) */
80
+ price: number;
81
+ /** Price per token in native currency (formatted) */
82
+ pricePerToken: number;
83
+ /** Currency symbol (e.g., "eth", "hype") */
84
+ currency: string;
85
+ /** Expiration timestamp in seconds */
86
+ expirationDate: number;
87
+ /** Seaport order hash */
88
+ orderHash: `0x${string}`;
89
+ /** Order status */
90
+ orderStatus: SeaportOrderStatus;
91
+ /** Raw message data for acceptance */
92
+ messageData: `0x${string}`;
93
+ /** Decoded Seaport order components */
94
+ orderComponents?: SeaportOrderComponents;
95
+ }
96
+ /**
97
+ * Seaport item types
98
+ */
99
+ declare enum ItemType {
100
+ NATIVE = 0,
101
+ ERC20 = 1,
102
+ ERC721 = 2,
103
+ ERC1155 = 3,
104
+ ERC721_WITH_CRITERIA = 4,
105
+ ERC1155_WITH_CRITERIA = 5
106
+ }
107
+ /**
108
+ * Seaport order type
109
+ */
110
+ declare enum OrderType {
111
+ FULL_OPEN = 0,
112
+ PARTIAL_OPEN = 1,
113
+ FULL_RESTRICTED = 2,
114
+ PARTIAL_RESTRICTED = 3
115
+ }
116
+ /**
117
+ * Seaport offer item
118
+ */
119
+ interface OfferItem {
120
+ itemType: ItemType;
121
+ token: `0x${string}`;
122
+ identifierOrCriteria: bigint;
123
+ startAmount: bigint;
124
+ endAmount: bigint;
125
+ }
126
+ /**
127
+ * Seaport consideration item
128
+ */
129
+ interface ConsiderationItem {
130
+ itemType: ItemType;
131
+ token: `0x${string}`;
132
+ identifierOrCriteria: bigint;
133
+ startAmount: bigint;
134
+ endAmount: bigint;
135
+ recipient: `0x${string}`;
136
+ }
137
+ /**
138
+ * Seaport order parameters
139
+ */
140
+ interface SeaportOrderParameters {
141
+ offerer: `0x${string}`;
142
+ zone: `0x${string}`;
143
+ offer: OfferItem[];
144
+ consideration: ConsiderationItem[];
145
+ orderType: OrderType;
146
+ startTime: bigint;
147
+ endTime: bigint;
148
+ zoneHash: `0x${string}`;
149
+ salt: bigint;
150
+ conduitKey: `0x${string}`;
151
+ totalOriginalConsiderationItems: bigint;
152
+ }
153
+ /**
154
+ * Seaport order components (parameters + counter)
155
+ */
156
+ interface SeaportOrderComponents extends SeaportOrderParameters {
157
+ counter: bigint;
158
+ }
159
+ /**
160
+ * Seaport submission (order + signature)
161
+ */
162
+ interface SeaportSubmission {
163
+ parameters: SeaportOrderParameters;
164
+ counter: bigint;
165
+ signature: `0x${string}`;
166
+ }
167
+ /**
168
+ * Seaport order status info from on-chain
169
+ */
170
+ interface SeaportOrderStatusInfo {
171
+ isValidated: boolean;
172
+ isCancelled: boolean;
173
+ totalFilled: bigint;
174
+ totalSize: bigint;
175
+ }
176
+ /**
177
+ * Parameters for creating an NFT listing
178
+ */
179
+ interface CreateListingParams {
180
+ /** NFT contract address */
181
+ nftAddress: `0x${string}`;
182
+ /** Token ID to list */
183
+ tokenId: string;
184
+ /** Price in wei */
185
+ priceWei: bigint;
186
+ /** Expiration timestamp in seconds (defaults to 24h from now) */
187
+ expirationDate?: number;
188
+ }
189
+ /**
190
+ * Parameters for creating a collection offer
191
+ */
192
+ interface CreateCollectionOfferParams {
193
+ /** NFT collection address */
194
+ nftAddress: `0x${string}`;
195
+ /** Offer price in wei (WETH) */
196
+ priceWei: bigint;
197
+ /** Expiration timestamp in seconds (defaults to 24h from now) */
198
+ expirationDate?: number;
199
+ }
200
+ /**
201
+ * Options for fetching listings
202
+ */
203
+ interface GetListingsOptions {
204
+ /** NFT collection address */
205
+ nftAddress: `0x${string}`;
206
+ /** Exclude listings from this address */
207
+ excludeMaker?: `0x${string}`;
208
+ /** Maximum number of messages to fetch (default: 200) */
209
+ maxMessages?: number;
210
+ }
211
+ /**
212
+ * Options for fetching collection offers
213
+ */
214
+ interface GetCollectionOffersOptions {
215
+ /** NFT collection address */
216
+ nftAddress: `0x${string}`;
217
+ /** Exclude offers from this address */
218
+ excludeMaker?: `0x${string}`;
219
+ /** Maximum number of messages to fetch (default: 100) */
220
+ maxMessages?: number;
221
+ }
222
+ /**
223
+ * Options for fetching ERC20 offers
224
+ */
225
+ interface GetErc20OffersOptions {
226
+ /** ERC20 token address to filter by */
227
+ tokenAddress: `0x${string}`;
228
+ /** Exclude offers from this address */
229
+ excludeMaker?: `0x${string}`;
230
+ /** Maximum number of messages to fetch (default: 200) */
231
+ maxMessages?: number;
232
+ }
233
+ /**
234
+ * Transaction configuration for write operations
235
+ */
236
+ interface WriteTransactionConfig {
237
+ /** Contract address to call */
238
+ to: `0x${string}`;
239
+ /** Function name */
240
+ functionName: string;
241
+ /** Function arguments */
242
+ args: readonly unknown[];
243
+ /** Contract ABI */
244
+ abi: readonly unknown[];
245
+ }
246
+
247
+ export { type CollectionOffer as C, type Erc20Offer as E, type GetListingsOptions as G, ItemType as I, type Listing as L, OrderType as O, type SeaportOrderComponents as S, type WriteTransactionConfig as W, type GetCollectionOffersOptions as a, type GetErc20OffersOptions as b, type SeaportSubmission as c, type SeaportOrderParameters as d, type SeaportOrderStatusInfo as e, SeaportOrderStatus as f, type OfferItem as g, type ConsiderationItem as h, type CreateListingParams as i, type CreateCollectionOfferParams as j };
package/package.json ADDED
@@ -0,0 +1,96 @@
1
+ {
2
+ "name": "@net-protocol/bazaar",
3
+ "version": "0.1.0",
4
+ "description": "NFT marketplace SDK for Net Protocol - listings, collection offers, and ERC20 offers via Seaport",
5
+ "main": "./dist/index.js",
6
+ "types": "./dist/index.d.ts",
7
+ "module": "./dist/index.mjs",
8
+ "sideEffects": false,
9
+ "typesVersions": {
10
+ "*": {
11
+ "react": [
12
+ "./dist/react.d.ts"
13
+ ]
14
+ }
15
+ },
16
+ "exports": {
17
+ ".": {
18
+ "types": "./dist/index.d.ts",
19
+ "import": "./dist/index.mjs",
20
+ "require": "./dist/index.js"
21
+ },
22
+ "./react": {
23
+ "types": "./dist/react.d.ts",
24
+ "import": "./dist/react.mjs",
25
+ "require": "./dist/react.js"
26
+ }
27
+ },
28
+ "files": [
29
+ "dist",
30
+ "README.md"
31
+ ],
32
+ "scripts": {
33
+ "build": "tsup",
34
+ "build:watch": "tsup --watch",
35
+ "clean": "rm -rf dist",
36
+ "typecheck": "tsc --noEmit",
37
+ "prepack": "../../scripts/prepack-modify-deps.sh",
38
+ "prepublishOnly": "yarn build",
39
+ "postpublish": "../../scripts/postpublish-restore-deps.sh",
40
+ "test": "vitest --run",
41
+ "test:watch": "vitest --watch",
42
+ "test:ui": "vitest --ui"
43
+ },
44
+ "dependencies": {
45
+ "@net-protocol/core": "^0.1.7",
46
+ "@opensea/seaport-js": "^4.0.4",
47
+ "viem": "^2.31.4"
48
+ },
49
+ "devDependencies": {
50
+ "@tanstack/react-query": "^5.0.0",
51
+ "@testing-library/react": "^14.0.0",
52
+ "@types/node": "^20.0.0",
53
+ "@types/react": "^18.0.0",
54
+ "@vitest/ui": "^1.0.0",
55
+ "ethers": "^6.0.0",
56
+ "jsdom": "^24.0.0",
57
+ "react": "^18.0.0",
58
+ "react-dom": "^18.0.0",
59
+ "tsup": "^8.0.0",
60
+ "typescript": "^5.0.0",
61
+ "vitest": "^1.0.0",
62
+ "wagmi": "^2.15.0"
63
+ },
64
+ "peerDependencies": {
65
+ "react": "^18.0.0",
66
+ "wagmi": "^2.15.0"
67
+ },
68
+ "peerDependenciesMeta": {
69
+ "react": {
70
+ "optional": true
71
+ },
72
+ "wagmi": {
73
+ "optional": true
74
+ }
75
+ },
76
+ "publishConfig": {
77
+ "access": "public",
78
+ "registry": "https://registry.npmjs.org/"
79
+ },
80
+ "repository": {
81
+ "type": "git",
82
+ "url": "https://github.com/stuckinaboot/net-public.git",
83
+ "directory": "packages/net-bazaar"
84
+ },
85
+ "keywords": [
86
+ "net",
87
+ "protocol",
88
+ "blockchain",
89
+ "ethereum",
90
+ "nft",
91
+ "marketplace",
92
+ "seaport",
93
+ "opensea"
94
+ ],
95
+ "license": "MIT"
96
+ }