@net-protocol/bazaar 0.1.8 → 0.1.10
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.
- package/README.md +39 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -0
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.mts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +14 -0
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +14 -0
- package/dist/react.mjs.map +1 -1
- package/dist/{types-oOrmJnNJ.d.mts → types-DTYGArF-.d.mts} +1 -1
- package/dist/{types-oOrmJnNJ.d.ts → types-DTYGArF-.d.ts} +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -19,6 +19,10 @@ Net Bazaar is a decentralized bazaar built on Net Protocol. All orders are store
|
|
|
19
19
|
- **Read collection offers**: Get valid offers for any NFT in a collection
|
|
20
20
|
- **Read ERC20 offers**: Get valid offers for ERC20 tokens
|
|
21
21
|
- **Cancel orders**: Prepare transactions to cancel your listings or offers
|
|
22
|
+
- **Create listings**: Prepare and sign Seaport orders for NFT listings
|
|
23
|
+
- **Create offers**: Prepare and sign collection offers
|
|
24
|
+
- **Fulfill orders**: Buy listings or accept offers
|
|
25
|
+
- **Query ownership**: Check which tokens an address owns on-chain
|
|
22
26
|
|
|
23
27
|
This package provides both React hooks (for UI) and a client class (for non-React code).
|
|
24
28
|
|
|
@@ -114,6 +118,41 @@ const erc20Offers = await client.getErc20Offers({
|
|
|
114
118
|
// Cancel a listing
|
|
115
119
|
const cancelTx = client.prepareCancelListing(listing);
|
|
116
120
|
// Use with wagmi's useWriteContract or viem's writeContract
|
|
121
|
+
|
|
122
|
+
// Create a listing (prepare EIP-712 data + approvals)
|
|
123
|
+
const prepared = await client.prepareCreateListing({
|
|
124
|
+
nftAddress: "0x...",
|
|
125
|
+
tokenId: "42",
|
|
126
|
+
priceWei: 100000000000000n, // 0.0001 ETH
|
|
127
|
+
offerer: "0x...",
|
|
128
|
+
});
|
|
129
|
+
// prepared.eip712 contains the typed data to sign
|
|
130
|
+
// prepared.approvals contains approval txs to send first
|
|
131
|
+
|
|
132
|
+
// Submit a signed listing on-chain
|
|
133
|
+
const submitTx = client.prepareSubmitListing(
|
|
134
|
+
prepared.eip712.orderParameters,
|
|
135
|
+
prepared.eip712.counter,
|
|
136
|
+
signature
|
|
137
|
+
);
|
|
138
|
+
|
|
139
|
+
// Fulfill a listing (buy an NFT)
|
|
140
|
+
const fulfillment = await client.prepareFulfillListing(listing, buyerAddress);
|
|
141
|
+
// fulfillment.approvals + fulfillment.fulfillment contain the txs
|
|
142
|
+
|
|
143
|
+
// Fulfill a collection offer (sell your NFT)
|
|
144
|
+
const offerFulfillment = await client.prepareFulfillCollectionOffer(offer, tokenId, sellerAddress);
|
|
145
|
+
|
|
146
|
+
// Get token IDs owned by an address
|
|
147
|
+
const tokenIds = await client.getOwnedTokens({
|
|
148
|
+
nftAddress: "0x...",
|
|
149
|
+
ownerAddress: "0x...",
|
|
150
|
+
startTokenId: 0n,
|
|
151
|
+
endTokenId: 10000n,
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
// Get recent sales
|
|
155
|
+
const sales = await client.getSales({ nftAddress: "0x..." });
|
|
117
156
|
```
|
|
118
157
|
|
|
119
158
|
## API Reference
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PublicClient } from 'viem';
|
|
2
2
|
import { NetMessage } from '@net-protocol/core';
|
|
3
|
-
import { G as GetListingsOptions, L as Listing, a as GetCollectionOffersOptions, C as CollectionOffer, b as GetErc20OffersOptions, E as Erc20Offer, c as GetErc20ListingsOptions, d as Erc20Listing, e as GetSalesOptions, S as Sale, W as WriteTransactionConfig, f as SeaportOrderComponents, P as PreparedFulfillment, g as CreateListingParams, h as PreparedOrder, i as CreateCollectionOfferParams, j as CreateErc20OfferParams, k as CreateErc20ListingParams, l as SeaportOrderParameters, m as SeaportSubmission, n as SeaportOrderStatusInfo, o as SeaportOrderStatus, p as EIP712OrderData } from './types-
|
|
4
|
-
export {
|
|
3
|
+
import { G as GetListingsOptions, L as Listing, a as GetCollectionOffersOptions, C as CollectionOffer, b as GetErc20OffersOptions, E as Erc20Offer, c as GetErc20ListingsOptions, d as Erc20Listing, e as GetSalesOptions, S as Sale, W as WriteTransactionConfig, f as SeaportOrderComponents, P as PreparedFulfillment, g as CreateListingParams, h as PreparedOrder, i as CreateCollectionOfferParams, j as CreateErc20OfferParams, k as CreateErc20ListingParams, l as SeaportOrderParameters, m as SeaportSubmission, n as SeaportOrderStatusInfo, o as SeaportOrderStatus, p as EIP712OrderData } from './types-DTYGArF-.mjs';
|
|
4
|
+
export { r as ConsiderationItem, I as ItemType, q as OfferItem, O as OrderType } from './types-DTYGArF-.mjs';
|
|
5
5
|
import { Seaport } from '@opensea/seaport-js';
|
|
6
6
|
|
|
7
7
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PublicClient } from 'viem';
|
|
2
2
|
import { NetMessage } from '@net-protocol/core';
|
|
3
|
-
import { G as GetListingsOptions, L as Listing, a as GetCollectionOffersOptions, C as CollectionOffer, b as GetErc20OffersOptions, E as Erc20Offer, c as GetErc20ListingsOptions, d as Erc20Listing, e as GetSalesOptions, S as Sale, W as WriteTransactionConfig, f as SeaportOrderComponents, P as PreparedFulfillment, g as CreateListingParams, h as PreparedOrder, i as CreateCollectionOfferParams, j as CreateErc20OfferParams, k as CreateErc20ListingParams, l as SeaportOrderParameters, m as SeaportSubmission, n as SeaportOrderStatusInfo, o as SeaportOrderStatus, p as EIP712OrderData } from './types-
|
|
4
|
-
export {
|
|
3
|
+
import { G as GetListingsOptions, L as Listing, a as GetCollectionOffersOptions, C as CollectionOffer, b as GetErc20OffersOptions, E as Erc20Offer, c as GetErc20ListingsOptions, d as Erc20Listing, e as GetSalesOptions, S as Sale, W as WriteTransactionConfig, f as SeaportOrderComponents, P as PreparedFulfillment, g as CreateListingParams, h as PreparedOrder, i as CreateCollectionOfferParams, j as CreateErc20OfferParams, k as CreateErc20ListingParams, l as SeaportOrderParameters, m as SeaportSubmission, n as SeaportOrderStatusInfo, o as SeaportOrderStatus, p as EIP712OrderData } from './types-DTYGArF-.js';
|
|
4
|
+
export { r as ConsiderationItem, I as ItemType, q as OfferItem, O as OrderType } from './types-DTYGArF-.js';
|
|
5
5
|
import { Seaport } from '@opensea/seaport-js';
|
|
6
6
|
|
|
7
7
|
/**
|
package/dist/index.js
CHANGED
|
@@ -715,6 +715,20 @@ var BAZAAR_CHAIN_CONFIGS = {
|
|
|
715
715
|
symbol: "WMONAD"
|
|
716
716
|
},
|
|
717
717
|
currencySymbol: "monad"
|
|
718
|
+
},
|
|
719
|
+
// MegaETH
|
|
720
|
+
4326: {
|
|
721
|
+
bazaarAddress: DEFAULT_BAZAAR_ADDRESS,
|
|
722
|
+
collectionOffersAddress: DEFAULT_COLLECTION_OFFERS_ADDRESS,
|
|
723
|
+
seaportAddress: DEFAULT_SEAPORT_ADDRESS,
|
|
724
|
+
feeCollectorAddress: DEFAULT_FEE_COLLECTOR_ADDRESS,
|
|
725
|
+
nftFeeBps: DEFAULT_NFT_FEE_BPS,
|
|
726
|
+
wrappedNativeCurrency: {
|
|
727
|
+
address: "0x4200000000000000000000000000000000000006",
|
|
728
|
+
name: "Wrapped Ether",
|
|
729
|
+
symbol: "WETH"
|
|
730
|
+
},
|
|
731
|
+
currencySymbol: "eth"
|
|
718
732
|
}
|
|
719
733
|
};
|
|
720
734
|
function getBazaarChainConfig(chainId) {
|