@opensea/sdk 9.0.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.
- package/LICENSE +7 -0
- package/README.md +70 -0
- package/lib/api/accounts.d.ts +27 -0
- package/lib/api/accounts.js +46 -0
- package/lib/api/accounts.js.map +1 -0
- package/lib/api/api.d.ts +489 -0
- package/lib/api/api.js +754 -0
- package/lib/api/api.js.map +1 -0
- package/lib/api/apiPaths.d.ts +46 -0
- package/lib/api/apiPaths.js +176 -0
- package/lib/api/apiPaths.js.map +1 -0
- package/lib/api/chains.d.ts +13 -0
- package/lib/api/chains.js +22 -0
- package/lib/api/chains.js.map +1 -0
- package/lib/api/collections.d.ts +34 -0
- package/lib/api/collections.js +80 -0
- package/lib/api/collections.js.map +1 -0
- package/lib/api/drops.d.ts +21 -0
- package/lib/api/drops.js +39 -0
- package/lib/api/drops.js.map +1 -0
- package/lib/api/events.d.ts +26 -0
- package/lib/api/events.js +43 -0
- package/lib/api/events.js.map +1 -0
- package/lib/api/fetcher.d.ts +24 -0
- package/lib/api/fetcher.js +3 -0
- package/lib/api/fetcher.js.map +1 -0
- package/lib/api/index.d.ts +2 -0
- package/lib/api/index.js +19 -0
- package/lib/api/index.js.map +1 -0
- package/lib/api/listings.d.ts +44 -0
- package/lib/api/listings.js +88 -0
- package/lib/api/listings.js.map +1 -0
- package/lib/api/nfts.d.ts +39 -0
- package/lib/api/nfts.js +79 -0
- package/lib/api/nfts.js.map +1 -0
- package/lib/api/offers.d.ts +54 -0
- package/lib/api/offers.js +124 -0
- package/lib/api/offers.js.map +1 -0
- package/lib/api/orders.d.ts +50 -0
- package/lib/api/orders.js +153 -0
- package/lib/api/orders.js.map +1 -0
- package/lib/api/search.d.ts +13 -0
- package/lib/api/search.js +22 -0
- package/lib/api/search.js.map +1 -0
- package/lib/api/tokens.d.ts +25 -0
- package/lib/api/tokens.js +43 -0
- package/lib/api/tokens.js.map +1 -0
- package/lib/api/types.d.ts +1113 -0
- package/lib/api/types.js +65 -0
- package/lib/api/types.js.map +1 -0
- package/lib/constants.d.ts +22 -0
- package/lib/constants.js +52 -0
- package/lib/constants.js.map +1 -0
- package/lib/index.d.ts +18 -0
- package/lib/index.js +24 -0
- package/lib/index.js.map +1 -0
- package/lib/orders/privateListings.d.ts +12 -0
- package/lib/orders/privateListings.js +130 -0
- package/lib/orders/privateListings.js.map +1 -0
- package/lib/orders/types.d.ts +160 -0
- package/lib/orders/types.js +10 -0
- package/lib/orders/types.js.map +1 -0
- package/lib/orders/utils.d.ts +89 -0
- package/lib/orders/utils.js +177 -0
- package/lib/orders/utils.js.map +1 -0
- package/lib/sdk/assets.d.ts +104 -0
- package/lib/sdk/assets.js +398 -0
- package/lib/sdk/assets.js.map +1 -0
- package/lib/sdk/cancellation.d.ts +97 -0
- package/lib/sdk/cancellation.js +235 -0
- package/lib/sdk/cancellation.js.map +1 -0
- package/lib/sdk/context.d.ts +28 -0
- package/lib/sdk/context.js +3 -0
- package/lib/sdk/context.js.map +1 -0
- package/lib/sdk/fulfillment.d.ts +153 -0
- package/lib/sdk/fulfillment.js +298 -0
- package/lib/sdk/fulfillment.js.map +1 -0
- package/lib/sdk/orders.d.ts +253 -0
- package/lib/sdk/orders.js +679 -0
- package/lib/sdk/orders.js.map +1 -0
- package/lib/sdk/tokens.d.ts +31 -0
- package/lib/sdk/tokens.js +65 -0
- package/lib/sdk/tokens.js.map +1 -0
- package/lib/sdk.d.ts +560 -0
- package/lib/sdk.js +693 -0
- package/lib/sdk.js.map +1 -0
- package/lib/src/api/accounts.d.ts +18 -0
- package/lib/src/api/accounts.js +30 -0
- package/lib/src/api/accounts.js.map +1 -0
- package/lib/src/api/api.d.ts +429 -0
- package/lib/src/api/api.js +652 -0
- package/lib/src/api/api.js.map +1 -0
- package/lib/src/api/apiPaths.d.ts +37 -0
- package/lib/src/api/apiPaths.js +140 -0
- package/lib/src/api/apiPaths.js.map +1 -0
- package/lib/src/api/collections.d.ts +26 -0
- package/lib/src/api/collections.js +57 -0
- package/lib/src/api/collections.js.map +1 -0
- package/lib/src/api/events.d.ts +26 -0
- package/lib/src/api/events.js +42 -0
- package/lib/src/api/events.js.map +1 -0
- package/lib/src/api/fetcher.d.ts +24 -0
- package/lib/src/api/fetcher.js +3 -0
- package/lib/src/api/fetcher.js.map +1 -0
- package/lib/src/api/index.d.ts +2 -0
- package/lib/src/api/index.js +19 -0
- package/lib/src/api/index.js.map +1 -0
- package/lib/src/api/listings.d.ts +44 -0
- package/lib/src/api/listings.js +86 -0
- package/lib/src/api/listings.js.map +1 -0
- package/lib/src/api/nfts.d.ts +35 -0
- package/lib/src/api/nfts.js +66 -0
- package/lib/src/api/nfts.js.map +1 -0
- package/lib/src/api/offers.d.ts +54 -0
- package/lib/src/api/offers.js +122 -0
- package/lib/src/api/offers.js.map +1 -0
- package/lib/src/api/orders.d.ts +50 -0
- package/lib/src/api/orders.js +151 -0
- package/lib/src/api/orders.js.map +1 -0
- package/lib/src/api/search.d.ts +13 -0
- package/lib/src/api/search.js +21 -0
- package/lib/src/api/search.js.map +1 -0
- package/lib/src/api/tokens.d.ts +25 -0
- package/lib/src/api/tokens.js +42 -0
- package/lib/src/api/tokens.js.map +1 -0
- package/lib/src/api/types.d.ts +840 -0
- package/lib/src/api/types.js +65 -0
- package/lib/src/api/types.js.map +1 -0
- package/lib/src/constants.d.ts +22 -0
- package/lib/src/constants.js +52 -0
- package/lib/src/constants.js.map +1 -0
- package/lib/src/index.d.ts +18 -0
- package/lib/src/index.js +24 -0
- package/lib/src/index.js.map +1 -0
- package/lib/src/orders/privateListings.d.ts +12 -0
- package/lib/src/orders/privateListings.js +130 -0
- package/lib/src/orders/privateListings.js.map +1 -0
- package/lib/src/orders/types.d.ts +160 -0
- package/lib/src/orders/types.js +10 -0
- package/lib/src/orders/types.js.map +1 -0
- package/lib/src/orders/utils.d.ts +89 -0
- package/lib/src/orders/utils.js +177 -0
- package/lib/src/orders/utils.js.map +1 -0
- package/lib/src/sdk/assets.d.ts +104 -0
- package/lib/src/sdk/assets.js +397 -0
- package/lib/src/sdk/assets.js.map +1 -0
- package/lib/src/sdk/cancellation.d.ts +97 -0
- package/lib/src/sdk/cancellation.js +234 -0
- package/lib/src/sdk/cancellation.js.map +1 -0
- package/lib/src/sdk/context.d.ts +28 -0
- package/lib/src/sdk/context.js +3 -0
- package/lib/src/sdk/context.js.map +1 -0
- package/lib/src/sdk/fulfillment.d.ts +153 -0
- package/lib/src/sdk/fulfillment.js +296 -0
- package/lib/src/sdk/fulfillment.js.map +1 -0
- package/lib/src/sdk/orders.d.ts +253 -0
- package/lib/src/sdk/orders.js +677 -0
- package/lib/src/sdk/orders.js.map +1 -0
- package/lib/src/sdk/tokens.d.ts +31 -0
- package/lib/src/sdk/tokens.js +64 -0
- package/lib/src/sdk/tokens.js.map +1 -0
- package/lib/src/sdk.d.ts +560 -0
- package/lib/src/sdk.js +675 -0
- package/lib/src/sdk.js.map +1 -0
- package/lib/src/typechain/contracts/ERC1155.d.ts +236 -0
- package/lib/src/typechain/contracts/ERC1155.js +3 -0
- package/lib/src/typechain/contracts/ERC1155.js.map +1 -0
- package/lib/src/typechain/contracts/ERC20.d.ts +141 -0
- package/lib/src/typechain/contracts/ERC20.js +3 -0
- package/lib/src/typechain/contracts/ERC20.js.map +1 -0
- package/lib/src/typechain/contracts/ERC721.d.ts +213 -0
- package/lib/src/typechain/contracts/ERC721.js +3 -0
- package/lib/src/typechain/contracts/ERC721.js.map +1 -0
- package/lib/src/typechain/contracts/Multicall3.d.ts +57 -0
- package/lib/src/typechain/contracts/Multicall3.js +3 -0
- package/lib/src/typechain/contracts/Multicall3.js.map +1 -0
- package/lib/src/typechain/contracts/TransferHelper.d.ts +55 -0
- package/lib/src/typechain/contracts/TransferHelper.js +3 -0
- package/lib/src/typechain/contracts/TransferHelper.js.map +1 -0
- package/lib/src/typechain/contracts/common.d.ts +50 -0
- package/lib/src/typechain/contracts/common.js +3 -0
- package/lib/src/typechain/contracts/common.js.map +1 -0
- package/lib/src/typechain/contracts/factories/ERC1155__factory.d.ts +250 -0
- package/lib/src/typechain/contracts/factories/ERC1155__factory.js +332 -0
- package/lib/src/typechain/contracts/factories/ERC1155__factory.js.map +1 -0
- package/lib/src/typechain/contracts/factories/ERC20__factory.d.ts +174 -0
- package/lib/src/typechain/contracts/factories/ERC20__factory.js +240 -0
- package/lib/src/typechain/contracts/factories/ERC20__factory.js.map +1 -0
- package/lib/src/typechain/contracts/factories/ERC721__factory.d.ts +268 -0
- package/lib/src/typechain/contracts/factories/ERC721__factory.js +351 -0
- package/lib/src/typechain/contracts/factories/ERC721__factory.js.map +1 -0
- package/lib/src/typechain/contracts/factories/Multicall3__factory.d.ts +43 -0
- package/lib/src/typechain/contracts/factories/Multicall3__factory.js +68 -0
- package/lib/src/typechain/contracts/factories/Multicall3__factory.js.map +1 -0
- package/lib/src/typechain/contracts/factories/TransferHelper__factory.d.ts +46 -0
- package/lib/src/typechain/contracts/factories/TransferHelper__factory.js +71 -0
- package/lib/src/typechain/contracts/factories/TransferHelper__factory.js.map +1 -0
- package/lib/src/typechain/contracts/factories/index.d.ts +5 -0
- package/lib/src/typechain/contracts/factories/index.js +17 -0
- package/lib/src/typechain/contracts/factories/index.js.map +1 -0
- package/lib/src/typechain/contracts/index.d.ts +11 -0
- package/lib/src/typechain/contracts/index.js +48 -0
- package/lib/src/typechain/contracts/index.js.map +1 -0
- package/lib/src/types.d.ts +387 -0
- package/lib/src/types.js +127 -0
- package/lib/src/types.js.map +1 -0
- package/lib/src/utils/chain.d.ts +60 -0
- package/lib/src/utils/chain.js +248 -0
- package/lib/src/utils/chain.js.map +1 -0
- package/lib/src/utils/converters.d.ts +37 -0
- package/lib/src/utils/converters.js +137 -0
- package/lib/src/utils/converters.js.map +1 -0
- package/lib/src/utils/dateHelper.d.ts +38 -0
- package/lib/src/utils/dateHelper.js +52 -0
- package/lib/src/utils/dateHelper.js.map +1 -0
- package/lib/src/utils/fees.d.ts +13 -0
- package/lib/src/utils/fees.js +29 -0
- package/lib/src/utils/fees.js.map +1 -0
- package/lib/src/utils/index.d.ts +2 -0
- package/lib/src/utils/index.js +19 -0
- package/lib/src/utils/index.js.map +1 -0
- package/lib/src/utils/protocol.d.ts +75 -0
- package/lib/src/utils/protocol.js +161 -0
- package/lib/src/utils/protocol.js.map +1 -0
- package/lib/src/utils/rateLimit.d.ts +34 -0
- package/lib/src/utils/rateLimit.js +97 -0
- package/lib/src/utils/rateLimit.js.map +1 -0
- package/lib/src/utils/stringHelper.d.ts +18 -0
- package/lib/src/utils/stringHelper.js +24 -0
- package/lib/src/utils/stringHelper.js.map +1 -0
- package/lib/src/utils/utils.d.ts +18 -0
- package/lib/src/utils/utils.js +45 -0
- package/lib/src/utils/utils.js.map +1 -0
- package/lib/typechain/contracts/ERC1155.d.ts +236 -0
- package/lib/typechain/contracts/ERC1155.js +3 -0
- package/lib/typechain/contracts/ERC1155.js.map +1 -0
- package/lib/typechain/contracts/ERC20.d.ts +141 -0
- package/lib/typechain/contracts/ERC20.js +3 -0
- package/lib/typechain/contracts/ERC20.js.map +1 -0
- package/lib/typechain/contracts/ERC721.d.ts +213 -0
- package/lib/typechain/contracts/ERC721.js +3 -0
- package/lib/typechain/contracts/ERC721.js.map +1 -0
- package/lib/typechain/contracts/Multicall3.d.ts +57 -0
- package/lib/typechain/contracts/Multicall3.js +3 -0
- package/lib/typechain/contracts/Multicall3.js.map +1 -0
- package/lib/typechain/contracts/TransferHelper.d.ts +55 -0
- package/lib/typechain/contracts/TransferHelper.js +3 -0
- package/lib/typechain/contracts/TransferHelper.js.map +1 -0
- package/lib/typechain/contracts/common.d.ts +50 -0
- package/lib/typechain/contracts/common.js +3 -0
- package/lib/typechain/contracts/common.js.map +1 -0
- package/lib/typechain/contracts/factories/ERC1155__factory.d.ts +250 -0
- package/lib/typechain/contracts/factories/ERC1155__factory.js +332 -0
- package/lib/typechain/contracts/factories/ERC1155__factory.js.map +1 -0
- package/lib/typechain/contracts/factories/ERC20__factory.d.ts +174 -0
- package/lib/typechain/contracts/factories/ERC20__factory.js +240 -0
- package/lib/typechain/contracts/factories/ERC20__factory.js.map +1 -0
- package/lib/typechain/contracts/factories/ERC721__factory.d.ts +268 -0
- package/lib/typechain/contracts/factories/ERC721__factory.js +351 -0
- package/lib/typechain/contracts/factories/ERC721__factory.js.map +1 -0
- package/lib/typechain/contracts/factories/Multicall3__factory.d.ts +43 -0
- package/lib/typechain/contracts/factories/Multicall3__factory.js +68 -0
- package/lib/typechain/contracts/factories/Multicall3__factory.js.map +1 -0
- package/lib/typechain/contracts/factories/TransferHelper__factory.d.ts +46 -0
- package/lib/typechain/contracts/factories/TransferHelper__factory.js +71 -0
- package/lib/typechain/contracts/factories/TransferHelper__factory.js.map +1 -0
- package/lib/typechain/contracts/factories/index.d.ts +5 -0
- package/lib/typechain/contracts/factories/index.js +17 -0
- package/lib/typechain/contracts/factories/index.js.map +1 -0
- package/lib/typechain/contracts/index.d.ts +11 -0
- package/lib/typechain/contracts/index.js +48 -0
- package/lib/typechain/contracts/index.js.map +1 -0
- package/lib/types.d.ts +389 -0
- package/lib/types.js +129 -0
- package/lib/types.js.map +1 -0
- package/lib/utils/chain.d.ts +64 -0
- package/lib/utils/chain.js +211 -0
- package/lib/utils/chain.js.map +1 -0
- package/lib/utils/chainIds.generated.d.ts +7 -0
- package/lib/utils/chainIds.generated.js +37 -0
- package/lib/utils/chainIds.generated.js.map +1 -0
- package/lib/utils/converters.d.ts +37 -0
- package/lib/utils/converters.js +137 -0
- package/lib/utils/converters.js.map +1 -0
- package/lib/utils/dateHelper.d.ts +38 -0
- package/lib/utils/dateHelper.js +52 -0
- package/lib/utils/dateHelper.js.map +1 -0
- package/lib/utils/fees.d.ts +13 -0
- package/lib/utils/fees.js +29 -0
- package/lib/utils/fees.js.map +1 -0
- package/lib/utils/index.d.ts +2 -0
- package/lib/utils/index.js +19 -0
- package/lib/utils/index.js.map +1 -0
- package/lib/utils/protocol.d.ts +75 -0
- package/lib/utils/protocol.js +161 -0
- package/lib/utils/protocol.js.map +1 -0
- package/lib/utils/rateLimit.d.ts +34 -0
- package/lib/utils/rateLimit.js +97 -0
- package/lib/utils/rateLimit.js.map +1 -0
- package/lib/utils/stringHelper.d.ts +18 -0
- package/lib/utils/stringHelper.js +24 -0
- package/lib/utils/stringHelper.js.map +1 -0
- package/lib/utils/utils.d.ts +18 -0
- package/lib/utils/utils.js +45 -0
- package/lib/utils/utils.js.map +1 -0
- package/package.json +72 -0
- package/src/abi/ERC1155.json +314 -0
- package/src/abi/ERC20.json +222 -0
- package/src/abi/ERC721.json +333 -0
- package/src/abi/Multicall3.json +50 -0
- package/src/abi/TransferHelper.json +53 -0
- package/src/api/accounts.ts +69 -0
- package/src/api/api.ts +1152 -0
- package/src/api/apiPaths.ts +208 -0
- package/src/api/chains.ts +18 -0
- package/src/api/collections.ts +120 -0
- package/src/api/drops.ts +49 -0
- package/src/api/events.ts +71 -0
- package/src/api/fetcher.ts +31 -0
- package/src/api/index.ts +2 -0
- package/src/api/listings.ts +126 -0
- package/src/api/nfts.ts +144 -0
- package/src/api/offers.ts +242 -0
- package/src/api/orders.ts +283 -0
- package/src/api/search.ts +21 -0
- package/src/api/tokens.ts +67 -0
- package/src/api/types.ts +1210 -0
- package/src/constants.ts +90 -0
- package/src/index.ts +22 -0
- package/src/orders/privateListings.ts +173 -0
- package/src/orders/types.ts +191 -0
- package/src/orders/utils.ts +253 -0
- package/src/sdk/assets.ts +591 -0
- package/src/sdk/cancellation.ts +346 -0
- package/src/sdk/context.ts +33 -0
- package/src/sdk/fulfillment.ts +478 -0
- package/src/sdk/orders.ts +1149 -0
- package/src/sdk/tokens.ts +95 -0
- package/src/sdk.ts +1051 -0
- package/src/typechain/contracts/ERC1155.ts +440 -0
- package/src/typechain/contracts/ERC20.ts +286 -0
- package/src/typechain/contracts/ERC721.ts +412 -0
- package/src/typechain/contracts/Multicall3.ts +117 -0
- package/src/typechain/contracts/TransferHelper.ts +122 -0
- package/src/typechain/contracts/common.ts +131 -0
- package/src/typechain/contracts/factories/ERC1155__factory.ts +331 -0
- package/src/typechain/contracts/factories/ERC20__factory.ts +239 -0
- package/src/typechain/contracts/factories/ERC721__factory.ts +350 -0
- package/src/typechain/contracts/factories/Multicall3__factory.ts +67 -0
- package/src/typechain/contracts/factories/TransferHelper__factory.ts +76 -0
- package/src/typechain/contracts/factories/index.ts +8 -0
- package/src/typechain/contracts/index.ts +14 -0
- package/src/types.ts +413 -0
- package/src/utils/chain.ts +224 -0
- package/src/utils/chainIds.generated.ts +34 -0
- package/src/utils/converters.ts +145 -0
- package/src/utils/dateHelper.ts +48 -0
- package/src/utils/fees.ts +31 -0
- package/src/utils/index.ts +2 -0
- package/src/utils/protocol.ts +185 -0
- package/src/utils/rateLimit.ts +147 -0
- package/src/utils/stringHelper.ts +25 -0
- package/src/utils/utils.ts +36 -0
package/src/types.ts
ADDED
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
import type { ChainIdentifier } from "@opensea/api-types"
|
|
2
|
+
import type { BigNumberish } from "ethers"
|
|
3
|
+
import type { Listing, Offer } from "./api/types"
|
|
4
|
+
import type { OrderV2 } from "./orders/types"
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Events emitted by the SDK which can be used by frontend applications
|
|
8
|
+
* to update state or show useful messages to users.
|
|
9
|
+
* @category Events
|
|
10
|
+
*/
|
|
11
|
+
export enum EventType {
|
|
12
|
+
/**
|
|
13
|
+
* Emitted when the transaction is sent to the network and the application
|
|
14
|
+
* is waiting for the transaction to be mined.
|
|
15
|
+
*/
|
|
16
|
+
TransactionCreated = "TransactionCreated",
|
|
17
|
+
/**
|
|
18
|
+
* Emitted when the transaction is mined and confirmed.
|
|
19
|
+
*/
|
|
20
|
+
TransactionConfirmed = "TransactionConfirmed",
|
|
21
|
+
/**
|
|
22
|
+
* Emitted when the transaction has failed to be submitted.
|
|
23
|
+
*/
|
|
24
|
+
TransactionDenied = "TransactionDenied",
|
|
25
|
+
/**
|
|
26
|
+
* Emitted when the transaction has failed to be mined.
|
|
27
|
+
*/
|
|
28
|
+
TransactionFailed = "TransactionFailed",
|
|
29
|
+
/**
|
|
30
|
+
* Emitted when the {@link OpenSeaSDK.wrapEth} method is called.
|
|
31
|
+
*/
|
|
32
|
+
WrapEth = "WrapEth",
|
|
33
|
+
/**
|
|
34
|
+
* Emitted when the {@link OpenSeaSDK.unwrapWeth} method is called.
|
|
35
|
+
*/
|
|
36
|
+
UnwrapWeth = "UnwrapWeth",
|
|
37
|
+
/**
|
|
38
|
+
* Emitted when fulfilling a public or private order.
|
|
39
|
+
*/
|
|
40
|
+
MatchOrders = "MatchOrders",
|
|
41
|
+
/**
|
|
42
|
+
* Emitted when the {@link OpenSeaSDK.cancelOrder} method is called.
|
|
43
|
+
*/
|
|
44
|
+
CancelOrder = "CancelOrder",
|
|
45
|
+
/**
|
|
46
|
+
* Emitted when the {@link OpenSeaSDK.approveOrder} method is called.
|
|
47
|
+
*/
|
|
48
|
+
ApproveOrder = "ApproveOrder",
|
|
49
|
+
/**
|
|
50
|
+
* Emitted when the {@link OpenSeaSDK.transfer} method is called.
|
|
51
|
+
*/
|
|
52
|
+
Transfer = "Transfer",
|
|
53
|
+
/**
|
|
54
|
+
* Emitted when the {@link OpenSeaSDK.batchApproveAssets} method is called.
|
|
55
|
+
*/
|
|
56
|
+
ApproveAllAssets = "ApproveAllAssets",
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Data that gets sent with each {@link EventType}
|
|
61
|
+
* @category Events
|
|
62
|
+
*/
|
|
63
|
+
export interface EventData {
|
|
64
|
+
/**
|
|
65
|
+
* Wallet address of the user who initiated the event.
|
|
66
|
+
*/
|
|
67
|
+
accountAddress?: string
|
|
68
|
+
/**
|
|
69
|
+
* Amount of ETH sent when wrapping or unwrapping.
|
|
70
|
+
*/
|
|
71
|
+
amount?: BigNumberish
|
|
72
|
+
/**
|
|
73
|
+
* The transaction hash of the event.
|
|
74
|
+
*/
|
|
75
|
+
transactionHash?: string
|
|
76
|
+
/**
|
|
77
|
+
* The {@link EventType} of the event.
|
|
78
|
+
*/
|
|
79
|
+
event?: EventType
|
|
80
|
+
/**
|
|
81
|
+
* Error which occurred when transaction was denied or failed.
|
|
82
|
+
*/
|
|
83
|
+
error?: unknown
|
|
84
|
+
/**
|
|
85
|
+
* The {@link OrderV2} object.
|
|
86
|
+
*/
|
|
87
|
+
orderV2?: OrderV2
|
|
88
|
+
/**
|
|
89
|
+
* The order as returned by the API ({@link Offer} or {@link Listing}).
|
|
90
|
+
*/
|
|
91
|
+
order?: Offer | Listing
|
|
92
|
+
/**
|
|
93
|
+
* Array of assets for bulk transfer and batch approval operations.
|
|
94
|
+
*/
|
|
95
|
+
assets?: Array<{
|
|
96
|
+
asset: AssetWithTokenStandard
|
|
97
|
+
toAddress?: string
|
|
98
|
+
amount?: BigNumberish
|
|
99
|
+
}>
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* OpenSea API configuration object
|
|
104
|
+
* @param chain `Chain` to use. Defaults to Ethereum Mainnet (`Chain.Mainnet`)
|
|
105
|
+
* @param apiKey API key to use
|
|
106
|
+
* @param apiBaseUrl Optional base URL to use for the API
|
|
107
|
+
*/
|
|
108
|
+
export interface OpenSeaAPIConfig {
|
|
109
|
+
chain?: Chain
|
|
110
|
+
apiKey?: string
|
|
111
|
+
apiBaseUrl?: string
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Each of the possible chains that OpenSea supports.
|
|
116
|
+
* ⚠️NOTE: When adding to this list, also update:
|
|
117
|
+
* - `scripts/chain-data.json` + run `pnpm sync-chains` (generates `getChainId` mapping)
|
|
118
|
+
* - `getListingPaymentToken`
|
|
119
|
+
* - `getOfferPaymentToken`
|
|
120
|
+
* - `getNativeWrapTokenAddress` (if getOfferPaymentToken isn't the wrapped native asset)
|
|
121
|
+
*/
|
|
122
|
+
export enum Chain {
|
|
123
|
+
Mainnet = "ethereum",
|
|
124
|
+
Polygon = "polygon",
|
|
125
|
+
Base = "base",
|
|
126
|
+
Blast = "blast",
|
|
127
|
+
Arbitrum = "arbitrum",
|
|
128
|
+
Avalanche = "avalanche",
|
|
129
|
+
Optimism = "optimism",
|
|
130
|
+
Solana = "solana",
|
|
131
|
+
Zora = "zora",
|
|
132
|
+
Sei = "sei",
|
|
133
|
+
B3 = "b3",
|
|
134
|
+
BeraChain = "bera_chain",
|
|
135
|
+
ApeChain = "ape_chain",
|
|
136
|
+
Flow = "flow",
|
|
137
|
+
Ronin = "ronin",
|
|
138
|
+
Abstract = "abstract",
|
|
139
|
+
Shape = "shape",
|
|
140
|
+
Unichain = "unichain",
|
|
141
|
+
Gunzilla = "gunzilla",
|
|
142
|
+
HyperEVM = "hyperevm",
|
|
143
|
+
Somnia = "somnia",
|
|
144
|
+
Monad = "monad",
|
|
145
|
+
MegaETH = "megaeth",
|
|
146
|
+
Soneium = "soneium",
|
|
147
|
+
Hyperliquid = "hyperliquid",
|
|
148
|
+
AnimeChain = "animechain",
|
|
149
|
+
Ink = "ink",
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// Compile-time check: every ChainIdentifier from the API spec must be assignable to Chain.
|
|
153
|
+
// If the API adds a new chain, this will error — add it to the Chain enum above.
|
|
154
|
+
// The SDK may have chains not yet in the API spec (e.g. testnets, upcoming chains).
|
|
155
|
+
type _AssertAPIChainsCovered = ChainIdentifier extends `${Chain}` ? true : never
|
|
156
|
+
|
|
157
|
+
const _assertAPIChainsCovered: _AssertAPIChainsCovered = true
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Order side: listing (ask) or offer (bid)
|
|
161
|
+
*/
|
|
162
|
+
export enum OrderSide {
|
|
163
|
+
LISTING = "ask",
|
|
164
|
+
OFFER = "bid",
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Token standards
|
|
169
|
+
*/
|
|
170
|
+
export enum TokenStandard {
|
|
171
|
+
ERC20 = "ERC20",
|
|
172
|
+
ERC721 = "ERC721",
|
|
173
|
+
ERC1155 = "ERC1155",
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* The collection's approval status within OpenSea.
|
|
178
|
+
* Can be one of:
|
|
179
|
+
* - not_requested: brand new collections
|
|
180
|
+
* - requested: collections that requested safelisting on our site
|
|
181
|
+
* - approved: collections that are approved on our site and can be found in search results
|
|
182
|
+
* - verified: verified collections
|
|
183
|
+
*/
|
|
184
|
+
export enum SafelistStatus {
|
|
185
|
+
NOT_REQUESTED = "not_requested",
|
|
186
|
+
REQUESTED = "requested",
|
|
187
|
+
APPROVED = "approved",
|
|
188
|
+
VERIFIED = "verified",
|
|
189
|
+
DISABLED_TOP_TRENDING = "disabled_top_trending",
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Collection fees
|
|
194
|
+
* @category API Models
|
|
195
|
+
*/
|
|
196
|
+
export interface Fee {
|
|
197
|
+
fee: number
|
|
198
|
+
recipient: string
|
|
199
|
+
required: boolean
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Generic Blockchain Asset.
|
|
204
|
+
* @category API Models
|
|
205
|
+
*/
|
|
206
|
+
export interface Asset {
|
|
207
|
+
/** The asset's token ID, or null if ERC-20 */
|
|
208
|
+
tokenId: string | null
|
|
209
|
+
/** The asset's contract address */
|
|
210
|
+
tokenAddress: string
|
|
211
|
+
/** The token standard (e.g. "ERC721") for this asset */
|
|
212
|
+
tokenStandard?: TokenStandard
|
|
213
|
+
/** Optional for ENS names */
|
|
214
|
+
name?: string
|
|
215
|
+
/** Optional for fungible items */
|
|
216
|
+
decimals?: number
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Generic Blockchain Asset, with tokenId required.
|
|
221
|
+
* @category API Models
|
|
222
|
+
*/
|
|
223
|
+
export interface AssetWithTokenId extends Asset {
|
|
224
|
+
/** The asset's token ID */
|
|
225
|
+
tokenId: string
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Generic Blockchain Asset, with tokenStandard required.
|
|
230
|
+
* @category API Models
|
|
231
|
+
*/
|
|
232
|
+
export interface AssetWithTokenStandard extends Asset {
|
|
233
|
+
/** The token standard (e.g. "ERC721") for this asset */
|
|
234
|
+
tokenStandard: TokenStandard
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
interface OpenSeaCollectionStatsIntervalData {
|
|
238
|
+
interval: "one_day" | "seven_day" | "thirty_day"
|
|
239
|
+
volume: number
|
|
240
|
+
volume_diff: number
|
|
241
|
+
volume_change: number
|
|
242
|
+
sales: number
|
|
243
|
+
sales_diff: number
|
|
244
|
+
average_price: number
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* OpenSea Collection Stats
|
|
249
|
+
* @category API Models
|
|
250
|
+
*/
|
|
251
|
+
export interface OpenSeaCollectionStats {
|
|
252
|
+
total: {
|
|
253
|
+
volume: number
|
|
254
|
+
sales: number
|
|
255
|
+
average_price: number
|
|
256
|
+
num_owners: number
|
|
257
|
+
market_cap: number
|
|
258
|
+
floor_price: number
|
|
259
|
+
floor_price_symbol: string
|
|
260
|
+
}
|
|
261
|
+
intervals: OpenSeaCollectionStatsIntervalData[]
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
export interface RarityStrategy {
|
|
265
|
+
strategyId: string
|
|
266
|
+
strategyVersion: string
|
|
267
|
+
calculatedAt: string
|
|
268
|
+
maxRank: number
|
|
269
|
+
tokensScored: number
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* OpenSea collection metadata.
|
|
274
|
+
* @category API Models
|
|
275
|
+
*/
|
|
276
|
+
export interface OpenSeaCollection {
|
|
277
|
+
/** Name of the collection */
|
|
278
|
+
name: string
|
|
279
|
+
/** The identifier (slug) of the collection */
|
|
280
|
+
collection: string
|
|
281
|
+
/** Description of the collection */
|
|
282
|
+
description: string
|
|
283
|
+
/** Image for the collection */
|
|
284
|
+
imageUrl: string
|
|
285
|
+
/** Banner image for the collection */
|
|
286
|
+
bannerImageUrl: string
|
|
287
|
+
/** Owner address of the collection */
|
|
288
|
+
owner: string
|
|
289
|
+
/** The collection's safelist status */
|
|
290
|
+
safelistStatus: SafelistStatus
|
|
291
|
+
/** The category of the collection */
|
|
292
|
+
category: string
|
|
293
|
+
/** If the collection is disabled */
|
|
294
|
+
isDisabled: boolean
|
|
295
|
+
/** If the collection is NSFW (not safe for work) */
|
|
296
|
+
isNSFW: boolean
|
|
297
|
+
/** If trait offers are enabled */
|
|
298
|
+
traitOffersEnabled: boolean
|
|
299
|
+
/** If collection offers are enabled */
|
|
300
|
+
collectionOffersEnabled: boolean
|
|
301
|
+
/** The OpenSea url for the collection */
|
|
302
|
+
openseaUrl: string
|
|
303
|
+
/** The project url for the collection */
|
|
304
|
+
projectUrl: string
|
|
305
|
+
/** The wiki url for the collection */
|
|
306
|
+
wikiUrl: string
|
|
307
|
+
/** The discord url for the collection */
|
|
308
|
+
discordUrl: string
|
|
309
|
+
/** The telegram url for the collection */
|
|
310
|
+
telegramUrl: string
|
|
311
|
+
/** The twitter username for the collection */
|
|
312
|
+
twitterUsername: string
|
|
313
|
+
/** The instagram username for the collection */
|
|
314
|
+
instagramUsername: string
|
|
315
|
+
/** The contracts for the collection */
|
|
316
|
+
contracts: { address: string; chain: Chain }[]
|
|
317
|
+
/** Accounts allowed to edit this collection */
|
|
318
|
+
editors: string[]
|
|
319
|
+
/** The fees for the collection */
|
|
320
|
+
fees: Fee[]
|
|
321
|
+
/** The rarity strategy for the collection */
|
|
322
|
+
rarity: RarityStrategy | null
|
|
323
|
+
/** Pricing currencies for listings and offers in this collection */
|
|
324
|
+
pricingCurrencies?: PricingCurrencies
|
|
325
|
+
/** The total supply of the collection (minted minus burned) */
|
|
326
|
+
totalSupply: number
|
|
327
|
+
/** The number of unique items in the collection */
|
|
328
|
+
uniqueItemCount: number
|
|
329
|
+
/** The created date of the collection */
|
|
330
|
+
createdDate: string
|
|
331
|
+
/** When defined, the zone required for orders for the collection */
|
|
332
|
+
requiredZone?: string
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* Full annotated Fungible Token spec with OpenSea metadata
|
|
337
|
+
*/
|
|
338
|
+
export interface OpenSeaPaymentToken {
|
|
339
|
+
name: string
|
|
340
|
+
symbol: string
|
|
341
|
+
decimals: number
|
|
342
|
+
address: string
|
|
343
|
+
chain: Chain
|
|
344
|
+
imageUrl?: string
|
|
345
|
+
ethPrice?: string
|
|
346
|
+
usdPrice?: string
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* Pricing currencies for a collection, defining default currencies for listings and offers.
|
|
351
|
+
* @category API Models
|
|
352
|
+
*/
|
|
353
|
+
export interface PricingCurrencies {
|
|
354
|
+
listingCurrency?: OpenSeaPaymentToken
|
|
355
|
+
offerCurrency?: OpenSeaPaymentToken
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* OpenSea Account
|
|
360
|
+
* @category API Models
|
|
361
|
+
*/
|
|
362
|
+
export interface OpenSeaAccount {
|
|
363
|
+
address: string
|
|
364
|
+
username: string
|
|
365
|
+
profileImageUrl: string
|
|
366
|
+
bannerImageUrl: string
|
|
367
|
+
website: string
|
|
368
|
+
socialMediaAccounts: SocialMediaAccount[]
|
|
369
|
+
bio: string
|
|
370
|
+
joinedDate: string
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Social media account
|
|
374
|
+
* @category API Models
|
|
375
|
+
*/
|
|
376
|
+
export interface SocialMediaAccount {
|
|
377
|
+
platform: string
|
|
378
|
+
username: string
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* Enhanced Error type for rate limit errors that includes retry-after information
|
|
383
|
+
* @category API Models
|
|
384
|
+
*/
|
|
385
|
+
export interface OpenSeaRateLimitError extends Error {
|
|
386
|
+
/** The HTTP status code of the error response */
|
|
387
|
+
statusCode?: number
|
|
388
|
+
/** The number of seconds to wait before retrying the request */
|
|
389
|
+
retryAfter?: number
|
|
390
|
+
/** The response body from the API */
|
|
391
|
+
responseBody?: unknown
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* Options for controlling HTTP request behavior.
|
|
396
|
+
* @category API Models
|
|
397
|
+
*/
|
|
398
|
+
export interface RequestOptions {
|
|
399
|
+
/**
|
|
400
|
+
* Request timeout in milliseconds.
|
|
401
|
+
* If the request takes longer than this, it will be aborted.
|
|
402
|
+
*/
|
|
403
|
+
timeout?: number
|
|
404
|
+
/**
|
|
405
|
+
* An AbortSignal to cancel the request.
|
|
406
|
+
* Useful for implementing custom cancellation logic or timeouts.
|
|
407
|
+
* @example
|
|
408
|
+
* const controller = new AbortController();
|
|
409
|
+
* setTimeout(() => controller.abort(), 5000);
|
|
410
|
+
* await api.post('/path', body, headers, { signal: controller.signal });
|
|
411
|
+
*/
|
|
412
|
+
signal?: AbortSignal
|
|
413
|
+
}
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import { CROSS_CHAIN_SEAPORT_V1_6_ADDRESS } from "@opensea/seaport-js/lib/constants"
|
|
2
|
+
import {
|
|
3
|
+
ALTERNATE_CONDUIT_ADDRESS,
|
|
4
|
+
ALTERNATE_CONDUIT_KEY,
|
|
5
|
+
ALTERNATE_FEE_RECIPIENT,
|
|
6
|
+
ALTERNATE_SEAPORT_V1_6_ADDRESS,
|
|
7
|
+
ALTERNATE_SIGNED_ZONE_V2_ADDRESS,
|
|
8
|
+
GUNZILLA_FEE_RECIPIENT,
|
|
9
|
+
OPENSEA_CONDUIT_ADDRESS,
|
|
10
|
+
OPENSEA_CONDUIT_ADDRESS_2,
|
|
11
|
+
OPENSEA_CONDUIT_KEY,
|
|
12
|
+
OPENSEA_CONDUIT_KEY_2,
|
|
13
|
+
OPENSEA_FEE_RECIPIENT,
|
|
14
|
+
OPENSEA_SIGNED_ZONE_V2,
|
|
15
|
+
SOMNIA_FEE_RECIPIENT,
|
|
16
|
+
WPOL_ADDRESS,
|
|
17
|
+
} from "../constants"
|
|
18
|
+
import { Chain } from "../types"
|
|
19
|
+
import { CHAIN_ID_MAP } from "./chainIds.generated"
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Checks if a chain uses the alternate protocol addresses.
|
|
23
|
+
* These chains use non-standard Seaport, conduit, and signed zone deployments.
|
|
24
|
+
* @param chain The chain to check
|
|
25
|
+
* @returns True if the chain uses alternate protocol addresses
|
|
26
|
+
*/
|
|
27
|
+
export const usesAlternateProtocol = (chain: Chain): boolean =>
|
|
28
|
+
chain === Chain.Gunzilla || chain === Chain.Somnia || chain === Chain.MegaETH
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Gets the chain ID for a given chain.
|
|
32
|
+
*
|
|
33
|
+
* Uses the generated CHAIN_ID_MAP from scripts/chain-data.json.
|
|
34
|
+
* To add a new chain, update chain-data.json and run `pnpm sync-chains`.
|
|
35
|
+
*
|
|
36
|
+
* @param chain The chain to get the ID for
|
|
37
|
+
* @returns The chain ID as a string
|
|
38
|
+
*/
|
|
39
|
+
export const getChainId = (chain: Chain): string => {
|
|
40
|
+
const id = CHAIN_ID_MAP[chain]
|
|
41
|
+
if (id === undefined) throw new Error(`Unknown chainId for ${chain}`)
|
|
42
|
+
return id
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Returns the default currency for offers on the given chain.
|
|
47
|
+
* @param chain The chain to get the offer payment token for
|
|
48
|
+
* @returns The token address for offers
|
|
49
|
+
*/
|
|
50
|
+
export const getOfferPaymentToken = (chain: Chain) => {
|
|
51
|
+
switch (chain) {
|
|
52
|
+
case Chain.Mainnet:
|
|
53
|
+
return "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" // WETH
|
|
54
|
+
case Chain.Polygon:
|
|
55
|
+
return "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619" // WETH
|
|
56
|
+
case Chain.Avalanche:
|
|
57
|
+
return "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7" // WAVAX
|
|
58
|
+
case Chain.Arbitrum:
|
|
59
|
+
return "0x82af49447d8a07e3bd95bd0d56f35241523fbab1" // WETH
|
|
60
|
+
case Chain.Blast:
|
|
61
|
+
return "0x4300000000000000000000000000000000000004" // WETH
|
|
62
|
+
// MegaETH and OP Chains have WETH at the same address
|
|
63
|
+
case Chain.MegaETH:
|
|
64
|
+
case Chain.Base:
|
|
65
|
+
case Chain.Optimism:
|
|
66
|
+
case Chain.Zora:
|
|
67
|
+
case Chain.B3:
|
|
68
|
+
case Chain.Shape:
|
|
69
|
+
case Chain.Unichain:
|
|
70
|
+
case Chain.Ink:
|
|
71
|
+
return "0x4200000000000000000000000000000000000006" // WETH
|
|
72
|
+
case Chain.BeraChain:
|
|
73
|
+
return "0x6969696969696969696969696969696969696969" // WBERA
|
|
74
|
+
case Chain.Sei:
|
|
75
|
+
return "0xe30fedd158a2e3b13e9badaeabafc5516e95e8c7" // WSEI
|
|
76
|
+
case Chain.Flow:
|
|
77
|
+
return "0xd3bf53dac106a0290b0483ecbc89d40fcc961f3e" // WFLOW
|
|
78
|
+
case Chain.ApeChain:
|
|
79
|
+
return "0x48b62137edfa95a428d35c09e44256a739f6b557" // WAPE
|
|
80
|
+
case Chain.Ronin:
|
|
81
|
+
return "0xe514d9deb7966c8be0ca922de8a064264ea6bcd4" // WRON
|
|
82
|
+
case Chain.Abstract:
|
|
83
|
+
return "0x3439153eb7af838ad19d56e1571fbd09333c2809" // WETH
|
|
84
|
+
case Chain.Gunzilla:
|
|
85
|
+
return "0x5aad7bba61d95c2c4e525a35f4062040264611f1" // WGUN
|
|
86
|
+
case Chain.HyperEVM:
|
|
87
|
+
return "0x5555555555555555555555555555555555555555" // WHYPE
|
|
88
|
+
case Chain.Somnia:
|
|
89
|
+
return "0x046ede9564a72571df6f5e44d0405360c0f4dcab" // WSOMI
|
|
90
|
+
case Chain.Monad:
|
|
91
|
+
return "0x3bd359c1119da7da1d913d1c4d2b7c461115433a" // WMON
|
|
92
|
+
default:
|
|
93
|
+
throw new Error(`Unknown offer currency for ${chain}`)
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Returns the default currency for listings on the given chain.
|
|
99
|
+
* @param chain The chain to get the listing payment token for
|
|
100
|
+
* @returns The token address for listings
|
|
101
|
+
*/
|
|
102
|
+
export const getListingPaymentToken = (chain: Chain) => {
|
|
103
|
+
switch (chain) {
|
|
104
|
+
case Chain.Mainnet:
|
|
105
|
+
case Chain.Somnia:
|
|
106
|
+
case Chain.HyperEVM:
|
|
107
|
+
case Chain.Arbitrum:
|
|
108
|
+
case Chain.Blast:
|
|
109
|
+
case Chain.Base:
|
|
110
|
+
case Chain.Optimism:
|
|
111
|
+
case Chain.Zora:
|
|
112
|
+
case Chain.B3:
|
|
113
|
+
case Chain.Abstract:
|
|
114
|
+
case Chain.Shape:
|
|
115
|
+
case Chain.Unichain:
|
|
116
|
+
case Chain.Monad:
|
|
117
|
+
case Chain.MegaETH:
|
|
118
|
+
case Chain.Ink:
|
|
119
|
+
return "0x0000000000000000000000000000000000000000" // ETH
|
|
120
|
+
case Chain.Polygon:
|
|
121
|
+
return "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619" // WETH
|
|
122
|
+
case Chain.Avalanche:
|
|
123
|
+
return "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7" // WETH
|
|
124
|
+
case Chain.BeraChain:
|
|
125
|
+
return "0x0000000000000000000000000000000000000000" // BERA
|
|
126
|
+
case Chain.Sei:
|
|
127
|
+
return "0x0000000000000000000000000000000000000000" // SEI
|
|
128
|
+
case Chain.Flow:
|
|
129
|
+
return "0xd3bf53dac106a0290b0483ecbc89d40fcc961f3e" // WETH
|
|
130
|
+
case Chain.ApeChain:
|
|
131
|
+
return "0x0000000000000000000000000000000000000000" // APE
|
|
132
|
+
case Chain.Ronin:
|
|
133
|
+
return "0xe514d9deb7966c8be0ca922de8a064264ea6bcd4" // WETH
|
|
134
|
+
case Chain.Gunzilla:
|
|
135
|
+
return "0x0000000000000000000000000000000000000000" // GUN
|
|
136
|
+
default:
|
|
137
|
+
throw new Error(`Unknown listing currency for ${chain}`)
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Get the default conduit key and address for a given chain.
|
|
143
|
+
* @param chain The chain to get the conduit for
|
|
144
|
+
* @returns The conduit key and address for the chain
|
|
145
|
+
*/
|
|
146
|
+
export const getDefaultConduit = (
|
|
147
|
+
chain: Chain,
|
|
148
|
+
): { key: string; address: string } => {
|
|
149
|
+
switch (chain) {
|
|
150
|
+
case Chain.Abstract:
|
|
151
|
+
case Chain.HyperEVM:
|
|
152
|
+
case Chain.Monad:
|
|
153
|
+
return {
|
|
154
|
+
key: OPENSEA_CONDUIT_KEY_2,
|
|
155
|
+
address: OPENSEA_CONDUIT_ADDRESS_2,
|
|
156
|
+
}
|
|
157
|
+
default:
|
|
158
|
+
if (usesAlternateProtocol(chain)) {
|
|
159
|
+
return {
|
|
160
|
+
key: ALTERNATE_CONDUIT_KEY,
|
|
161
|
+
address: ALTERNATE_CONDUIT_ADDRESS,
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
return {
|
|
165
|
+
key: OPENSEA_CONDUIT_KEY,
|
|
166
|
+
address: OPENSEA_CONDUIT_ADDRESS,
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Get the Seaport 1.6 contract address for a given chain.
|
|
173
|
+
* @param chain The chain to get the Seaport address for
|
|
174
|
+
* @returns The Seaport 1.6 address for the chain
|
|
175
|
+
*/
|
|
176
|
+
export const getSeaportAddress = (chain: Chain): string => {
|
|
177
|
+
return usesAlternateProtocol(chain)
|
|
178
|
+
? ALTERNATE_SEAPORT_V1_6_ADDRESS
|
|
179
|
+
: CROSS_CHAIN_SEAPORT_V1_6_ADDRESS
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Get the signed zone address for a given chain.
|
|
184
|
+
* @param chain The chain to get the signed zone address for
|
|
185
|
+
* @returns The signed zone address for the chain
|
|
186
|
+
*/
|
|
187
|
+
export const getSignedZone = (chain: Chain): string => {
|
|
188
|
+
return usesAlternateProtocol(chain)
|
|
189
|
+
? ALTERNATE_SIGNED_ZONE_V2_ADDRESS
|
|
190
|
+
: OPENSEA_SIGNED_ZONE_V2
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Get the fee recipient address for a given chain
|
|
195
|
+
* @param chain The blockchain chain
|
|
196
|
+
* @returns The fee recipient address for the chain
|
|
197
|
+
*/
|
|
198
|
+
export const getFeeRecipient = (chain: Chain): string => {
|
|
199
|
+
switch (chain) {
|
|
200
|
+
case Chain.Gunzilla:
|
|
201
|
+
return GUNZILLA_FEE_RECIPIENT
|
|
202
|
+
case Chain.Somnia:
|
|
203
|
+
return SOMNIA_FEE_RECIPIENT
|
|
204
|
+
case Chain.MegaETH:
|
|
205
|
+
return ALTERNATE_FEE_RECIPIENT
|
|
206
|
+
default:
|
|
207
|
+
return OPENSEA_FEE_RECIPIENT
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Get the appropriate token address for wrap/unwrap operations.
|
|
213
|
+
* For Polygon, use WPOL. For other chains, use the wrapped native asset.
|
|
214
|
+
* @param chain The chain to get the token address for
|
|
215
|
+
* @returns The token address for wrap/unwrap operations
|
|
216
|
+
*/
|
|
217
|
+
export const getNativeWrapTokenAddress = (chain: Chain): string => {
|
|
218
|
+
switch (chain) {
|
|
219
|
+
case Chain.Polygon:
|
|
220
|
+
return WPOL_ADDRESS
|
|
221
|
+
default:
|
|
222
|
+
return getOfferPaymentToken(chain)
|
|
223
|
+
}
|
|
224
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AUTO-GENERATED by scripts/sync-chains.ts — DO NOT EDIT.
|
|
3
|
+
* Source of truth: OpenSea REST API + scripts/chain-data.json
|
|
4
|
+
* Run `pnpm sync-chains` to regenerate.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/** Map chain slug (Chain enum value) to numeric chain ID. */
|
|
8
|
+
export const CHAIN_ID_MAP: Record<string, string> = {
|
|
9
|
+
ethereum: "1",
|
|
10
|
+
optimism: "10",
|
|
11
|
+
unichain: "130",
|
|
12
|
+
polygon: "137",
|
|
13
|
+
monad: "143",
|
|
14
|
+
shape: "360",
|
|
15
|
+
flow: "747",
|
|
16
|
+
hyperevm: "999",
|
|
17
|
+
sei: "1329",
|
|
18
|
+
soneium: "1868",
|
|
19
|
+
ronin: "2020",
|
|
20
|
+
abstract: "2741",
|
|
21
|
+
megaeth: "4326",
|
|
22
|
+
somnia: "5031",
|
|
23
|
+
b3: "8333",
|
|
24
|
+
base: "8453",
|
|
25
|
+
ape_chain: "33139",
|
|
26
|
+
arbitrum: "42161",
|
|
27
|
+
avalanche: "43114",
|
|
28
|
+
gunzilla: "43419",
|
|
29
|
+
ink: "57073",
|
|
30
|
+
animechain: "69000",
|
|
31
|
+
bera_chain: "80094",
|
|
32
|
+
blast: "81457",
|
|
33
|
+
zora: "7777777",
|
|
34
|
+
}
|